--- /dev/null
+/*
+ * Copyright (C) 2003, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AXObjectCache_h
+#define AXObjectCache_h
+
+#include "AccessibilityObject.h"
+#include <limits.h>
+#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
+#include <wtf/RefPtr.h>
+
+#ifdef __OBJC__
+@class WebCoreTextMarker;
+#else
+class WebCoreTextMarker;
+#endif
+
+namespace WebCore {
+
+ class RenderObject;
+ class String;
+ class VisiblePosition;
+ class AccessibilityObject;
+ class Node;
+
+ typedef unsigned AXID;
+
+ struct TextMarkerData {
+ AXID axID;
+ Node* node;
+ int offset;
+ EAffinity affinity;
+ };
+
+ class AXObjectCache {
+ public:
+ ~AXObjectCache();
+
+ // to be used with render objects
+ AccessibilityObject* get(RenderObject*);
+
+ // used for objects without backing elements
+ AccessibilityObject* get(AccessibilityRole);
+
+ void remove(RenderObject*);
+ void remove(AXID);
+
+ void detachWrapper(AccessibilityObject*);
+ void attachWrapper(AccessibilityObject*);
+ void postNotification(RenderObject*, const String&);
+ void postNotificationToElement(RenderObject*, const String&);
+ void childrenChanged(RenderObject*);
+ void selectedChildrenChanged(RenderObject*);
+ void handleActiveDescendantChanged(RenderObject*);
+ void handleAriaRoleChanged(RenderObject*);
+ static void enableAccessibility() { gAccessibilityEnabled = true; }
+ static void enableEnhancedUserInterfaceAccessibility() { gAccessibilityEnhancedUserInterfaceEnabled = true; }
+
+ static bool accessibilityEnabled() { return gAccessibilityEnabled; }
+ static bool accessibilityEnhancedUserInterfaceEnabled() { return gAccessibilityEnhancedUserInterfaceEnabled; }
+
+ void removeAXID(AccessibilityObject*);
+ bool isIDinUse(AXID id) const { return m_idsInUse.contains(id); }
+
+ private:
+ HashMap<AXID, RefPtr<AccessibilityObject> > m_objects;
+ HashMap<RenderObject*, AXID> m_renderObjectMapping;
+ static bool gAccessibilityEnabled;
+ static bool gAccessibilityEnhancedUserInterfaceEnabled;
+
+ HashSet<AXID> m_idsInUse;
+
+ AXID getAXID(AccessibilityObject*);
+ };
+
+#if !HAVE(ACCESSIBILITY)
+ inline void AXObjectCache::handleActiveDescendantChanged(RenderObject*) { }
+ inline void AXObjectCache::handleAriaRoleChanged(RenderObject*) { }
+ inline void AXObjectCache::detachWrapper(AccessibilityObject*) { }
+ inline void AXObjectCache::attachWrapper(AccessibilityObject*) { }
+ inline void AXObjectCache::selectedChildrenChanged(RenderObject*) { }
+ inline void AXObjectCache::postNotification(RenderObject*, const String&) { }
+ inline void AXObjectCache::postNotificationToElement(RenderObject*, const String&) { }
+#endif
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AccessibilityImageMapLink_h
+#define AccessibilityImageMapLink_h
+
+#include "AccessibilityObject.h"
+#include "HTMLAreaElement.h"
+#include "HTMLMapElement.h"
+
+namespace WebCore {
+
+class AccessibilityImageMapLink : public AccessibilityObject {
+
+private:
+ AccessibilityImageMapLink();
+public:
+ static PassRefPtr<AccessibilityImageMapLink> create();
+ virtual ~AccessibilityImageMapLink();
+
+ void setHTMLAreaElement(HTMLAreaElement* element) { m_areaElement = element; }
+ void setHTMLMapElement(HTMLMapElement* element) { m_mapElement = element; }
+ void setParent(AccessibilityObject* parent) { m_parent = parent; }
+
+ virtual AccessibilityRole roleValue() const { return WebCoreLinkRole; }
+ virtual bool accessibilityIsIgnored() const { return false; }
+
+ virtual AccessibilityObject* parentObject() const;
+ virtual Element* anchorElement() const;
+ virtual Element* actionElement() const;
+
+ virtual bool isLink() const { return true; }
+ virtual String title() const;
+ virtual String accessibilityDescription() const;
+
+ virtual IntSize size() const;
+ virtual IntRect elementRect() const;
+
+private:
+ HTMLAreaElement* m_areaElement;
+ HTMLMapElement* m_mapElement;
+ AccessibilityObject* m_parent;
+};
+
+} // namespace WebCore
+
+#endif // AccessibilityImageMapLink_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AccessibilityList_h
+#define AccessibilityList_h
+
+#include "AccessibilityRenderObject.h"
+
+namespace WebCore {
+
+class AccessibilityList : public AccessibilityRenderObject {
+
+private:
+ AccessibilityList(RenderObject*);
+public:
+ static PassRefPtr<AccessibilityList> create(RenderObject*);
+ virtual ~AccessibilityList();
+
+ virtual bool isList() const { return true; };
+ bool isUnorderedList() const;
+ bool isOrderedList() const;
+ bool isDefinitionList() const;
+
+ virtual AccessibilityRole roleValue() const { return ListRole; }
+ virtual bool accessibilityIsIgnored() const;
+
+};
+
+} // namespace WebCore
+
+#endif // AccessibilityList_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AccessibilityListBox_h
+#define AccessibilityListBox_h
+
+#include "AccessibilityObject.h"
+#include "AccessibilityRenderObject.h"
+
+namespace WebCore {
+
+class AccessibilityListBox : public AccessibilityRenderObject {
+
+private:
+ AccessibilityListBox(RenderObject*);
+public:
+ static PassRefPtr<AccessibilityListBox> create(RenderObject*);
+ virtual ~AccessibilityListBox();
+
+ virtual AccessibilityObject* doAccessibilityHitTest(const IntPoint&) const;
+ virtual bool isListBox() const { return true; };
+
+ virtual bool canSetFocusAttribute() const { return true; }
+ virtual bool canSetSelectedChildrenAttribute() const;
+ void setSelectedChildren(AccessibilityChildrenVector&);
+ virtual AccessibilityRole roleValue() const { return ListBoxRole; }
+
+ virtual bool accessibilityIsIgnored() const { return false; }
+
+ virtual void selectedChildren(AccessibilityChildrenVector&);
+ virtual void visibleChildren(AccessibilityChildrenVector&);
+
+ virtual void addChildren();
+
+private:
+ AccessibilityObject* listBoxOptionAccessibilityObject(HTMLElement*) const;
+};
+
+} // namespace WebCore
+
+#endif // AccessibilityListBox_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AccessibilityListBoxOption_h
+#define AccessibilityListBoxOption_h
+
+#include "AccessibilityObject.h"
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class AccessibilityListBox;
+class Element;
+class HTMLElement;
+class HTMLSelectElement;
+class String;
+
+class AccessibilityListBoxOption : public AccessibilityObject {
+
+private:
+ AccessibilityListBoxOption();
+public:
+ static PassRefPtr<AccessibilityListBoxOption> create();
+ virtual ~AccessibilityListBoxOption();
+
+ void setHTMLElement(HTMLElement* element) { m_optionElement = element; }
+
+ virtual AccessibilityRole roleValue() const { return ListBoxOptionRole; }
+ virtual bool accessibilityIsIgnored() const { return false; }
+ virtual bool isSelected() const;
+ virtual bool isEnabled() const;
+ virtual String stringValue() const;
+ virtual Element* actionElement() const;
+
+ virtual void setSelected(bool);
+ virtual bool canSetSelectedAttribute() const;
+
+ virtual IntRect elementRect() const;
+ virtual IntSize size() const;
+ virtual AccessibilityObject* parentObject() const;
+ bool isListBoxOption() const { return true; };
+
+private:
+ HTMLElement* m_optionElement;
+
+ HTMLSelectElement* listBoxOptionParentNode() const;
+ int listBoxOptionIndex() const;
+ IntRect listBoxOptionRect() const;
+ AccessibilityObject* listBoxOptionAccessibilityObject(HTMLElement* element) const;
+};
+
+} // namespace WebCore
+
+#endif // AccessibilityListBoxOption_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Nuanti Ltd.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AccessibilityObject_h
+#define AccessibilityObject_h
+
+#include "VisiblePosition.h"
+#include <wtf/Platform.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+#if PLATFORM(MAC)
+#include <wtf/RetainPtr.h>
+#elif PLATFORM(WIN)
+#include "AccessibilityObjectWrapperWin.h"
+#include "COMPtr.h"
+#elif PLATFORM(CHROMIUM)
+#include "AccessibilityObjectWrapper.h"
+#endif
+
+typedef struct _NSRange NSRange;
+
+#ifdef __OBJC__
+@class AccessibilityObjectWrapper;
+@class NSArray;
+@class NSAttributedString;
+@class NSData;
+@class NSMutableAttributedString;
+@class NSString;
+@class NSValue;
+@class NSView;
+#else
+class NSArray;
+class NSAttributedString;
+class NSData;
+class NSMutableAttributedString;
+class NSString;
+class NSValue;
+class NSView;
+#if PLATFORM(GTK)
+typedef struct _AtkObject AtkObject;
+typedef struct _AtkObject AccessibilityObjectWrapper;
+#else
+class AccessibilityObjectWrapper;
+#endif
+#endif
+
+namespace WebCore {
+
+class AXObjectCache;
+class Element;
+class Frame;
+class FrameView;
+class HTMLAnchorElement;
+class HTMLAreaElement;
+class IntPoint;
+class IntSize;
+class Node;
+class RenderObject;
+class Selection;
+class String;
+class Widget;
+
+enum AccessibilityRole {
+ UnknownRole = 1,
+ ButtonRole,
+ RadioButtonRole,
+ CheckBoxRole,
+ SliderRole,
+ TabGroupRole,
+ TextFieldRole,
+ StaticTextRole,
+ TextAreaRole,
+ ScrollAreaRole,
+ PopUpButtonRole,
+ MenuButtonRole,
+ TableRole,
+ ApplicationRole,
+ GroupRole,
+ RadioGroupRole,
+ ListRole,
+ ScrollBarRole,
+ ValueIndicatorRole,
+ ImageRole,
+ MenuBarRole,
+ MenuRole,
+ MenuItemRole,
+ ColumnRole,
+ RowRole,
+ ToolbarRole,
+ BusyIndicatorRole,
+ ProgressIndicatorRole,
+ WindowRole,
+ DrawerRole,
+ SystemWideRole,
+ OutlineRole,
+ IncrementorRole,
+ BrowserRole,
+ ComboBoxRole,
+ SplitGroupRole,
+ SplitterRole,
+ ColorWellRole,
+ GrowAreaRole,
+ SheetRole,
+ HelpTagRole,
+ MatteRole,
+ RulerRole,
+ RulerMarkerRole,
+ LinkRole,
+ DisclosureTriangleRole,
+ GridRole,
+ CellRole,
+ // AppKit includes SortButtonRole but it is misnamed and really a subrole of ButtonRole so we do not include it here.
+
+ // WebCore-specific roles
+ WebCoreLinkRole,
+ ImageMapLinkRole,
+ ImageMapRole,
+ ListMarkerRole,
+ WebAreaRole,
+ HeadingRole,
+ ListBoxRole,
+ ListBoxOptionRole,
+ TableHeaderContainerRole,
+ DefinitionListTermRole,
+ DefinitionListDefinitionRole
+};
+
+struct VisiblePositionRange {
+
+ VisiblePosition start;
+ VisiblePosition end;
+
+ VisiblePositionRange() {}
+
+ VisiblePositionRange(const VisiblePosition& s, const VisiblePosition& e)
+ : start(s)
+ , end(e)
+ { }
+
+ bool isNull() const { return start.isNull() || end.isNull(); }
+};
+
+struct PlainTextRange {
+
+ unsigned start;
+ unsigned length;
+
+ PlainTextRange()
+ : start(0)
+ , length(0)
+ { }
+
+ PlainTextRange(unsigned s, unsigned l)
+ : start(s)
+ , length(l)
+ { }
+
+ bool isNull() const { return start == 0 && length == 0; }
+};
+
+class AccessibilityObject : public RefCounted<AccessibilityObject> {
+protected:
+ AccessibilityObject();
+public:
+ virtual ~AccessibilityObject();
+
+ typedef Vector<RefPtr<AccessibilityObject> > AccessibilityChildrenVector;
+
+ virtual bool isAccessibilityRenderObject() const { return false; };
+ virtual bool isAnchor() const { return false; };
+ virtual bool isAttachment() const { return false; };
+ virtual bool isHeading() const { return false; };
+ virtual bool isLink() const { return false; };
+ virtual bool isImage() const { return false; };
+ virtual bool isNativeImage() const { return false; };
+ virtual bool isImageButton() const { return false; };
+ virtual bool isPasswordField() const { return false; };
+ virtual bool isTextControl() const { return false; };
+ virtual bool isNativeTextControl() const { return false; };
+ virtual bool isWebArea() const { return false; };
+ virtual bool isCheckboxOrRadio() const { return false; };
+ virtual bool isListBox() const { return roleValue() == ListBoxRole; };
+ virtual bool isMenuRelated() const { return false; }
+ virtual bool isMenu() const { return false; }
+ virtual bool isMenuBar() const { return false; }
+ virtual bool isMenuButton() const { return false; }
+ virtual bool isMenuItem() const { return false; }
+ virtual bool isFileUploadButton() const { return false; };
+ virtual bool isInputImage() const { return false; }
+ virtual bool isProgressIndicator() const { return false; };
+ virtual bool isSlider() const { return false; };
+ virtual bool isControl() const { return false; };
+ virtual bool isList() const { return false; };
+ virtual bool isDataTable() const { return false; };
+ virtual bool isTableRow() const { return false; };
+ virtual bool isTableColumn() const { return false; };
+ virtual bool isTableCell() const { return false; };
+ virtual bool isFieldset() const { return false; };
+ virtual bool isGroup() const { return false; };
+
+ virtual bool isChecked() const { return false; };
+ virtual bool isEnabled() const { return false; };
+ virtual bool isSelected() const { return false; };
+ virtual bool isFocused() const { return false; };
+ virtual bool isHovered() const { return false; };
+ virtual bool isIndeterminate() const { return false; };
+ virtual bool isLoaded() const { return false; };
+ virtual bool isMultiSelect() const { return false; };
+ virtual bool isOffScreen() const { return false; };
+ virtual bool isPressed() const { return false; };
+ virtual bool isReadOnly() const { return false; };
+ virtual bool isVisited() const { return false; };
+
+ virtual bool canSetFocusAttribute() const { return false; };
+ virtual bool canSetTextRangeAttributes() const { return false; };
+ virtual bool canSetValueAttribute() const { return false; };
+ virtual bool canSetSelectedAttribute() const { return false; }
+ virtual bool canSetSelectedChildrenAttribute() const { return false; }
+
+ virtual bool hasIntValue() const { return false; };
+
+ bool accessibilityShouldUseUniqueId() const { return true; };
+ virtual bool accessibilityIsIgnored() const { return true; };
+
+ virtual int intValue() const;
+ virtual float valueForRange() const { return 0.0f; }
+ virtual float maxValueForRange() const { return 0.0f; }
+ virtual float minValueForRange() const {return 0.0f; }
+ virtual int layoutCount() const;
+ static bool isARIAControl(AccessibilityRole);
+ static bool isARIAInput(AccessibilityRole);
+ unsigned axObjectID() const;
+
+ virtual AccessibilityObject* doAccessibilityHitTest(const IntPoint&) const;
+ virtual AccessibilityObject* focusedUIElement() const;
+ virtual AccessibilityObject* firstChild() const;
+ virtual AccessibilityObject* lastChild() const;
+ virtual AccessibilityObject* previousSibling() const;
+ virtual AccessibilityObject* nextSibling() const;
+ virtual AccessibilityObject* parentObject() const;
+ virtual AccessibilityObject* parentObjectUnignored() const;
+ virtual AccessibilityObject* observableObject() const;
+ virtual void linkedUIElements(AccessibilityChildrenVector&) const;
+ virtual AccessibilityObject* titleUIElement() const;
+ virtual AccessibilityRole ariaRoleAttribute() const;
+ virtual bool isPresentationalChildOfAriaRole() const;
+ virtual bool ariaRoleHasPresentationalChildren() const;
+
+ virtual AccessibilityRole roleValue() const;
+ virtual AXObjectCache* axObjectCache() const;
+
+ virtual Element* anchorElement() const;
+ virtual Element* actionElement() const;
+ virtual IntRect boundingBoxRect() const;
+ virtual IntRect elementRect() const;
+ virtual IntSize size() const;
+ IntPoint clickPoint() const;
+
+ virtual KURL url() const;
+ virtual PlainTextRange selectedTextRange() const;
+ virtual Selection selection() const;
+ unsigned selectionStart() const;
+ unsigned selectionEnd() const;
+ virtual String stringValue() const;
+ virtual String ariaAccessiblityName(const String&) const;
+ virtual String ariaLabeledByAttribute() const;
+ virtual String title() const;
+ virtual String ariaDescribedByAttribute() const;
+ virtual String accessibilityDescription() const;
+ virtual String helpText() const;
+ virtual String textUnderElement() const;
+ virtual String text() const;
+ virtual int textLength() const;
+ virtual PassRefPtr<Range> ariaSelectedTextDOMRange() const;
+ virtual String selectedText() const;
+ virtual const AtomicString& accessKey() const;
+ const String& actionVerb() const;
+ virtual Widget* widget() const;
+ virtual Widget* widgetForAttachmentView() const;
+ virtual Document* document() const { return 0; }
+ virtual FrameView* topDocumentFrameView() const { return 0; }
+ virtual FrameView* documentFrameView() const;
+
+ void setAXObjectID(unsigned);
+ virtual void setFocused(bool);
+ virtual void setSelectedText(const String&);
+ virtual void setSelectedTextRange(const PlainTextRange&);
+ virtual void setValue(const String&);
+ virtual void setSelected(bool);
+
+ virtual void detach();
+ virtual void makeRangeVisible(const PlainTextRange&);
+ virtual bool press() const;
+ bool performDefaultAction() const { return press(); }
+
+ virtual void childrenChanged();
+ virtual const AccessibilityChildrenVector& children() { return m_children; }
+ virtual void addChildren();
+ virtual bool canHaveChildren() const { return true; }
+ virtual bool hasChildren() const { return m_haveChildren; };
+ virtual void selectedChildren(AccessibilityChildrenVector&);
+ virtual void visibleChildren(AccessibilityChildrenVector&);
+ virtual bool shouldFocusActiveDescendant() const { return false; }
+ virtual AccessibilityObject* activeDescendant() const { return 0; }
+ virtual void handleActiveDescendantChanged() { }
+
+ virtual VisiblePositionRange visiblePositionRange() const;
+ virtual VisiblePositionRange visiblePositionRangeForLine(unsigned) const;
+
+ VisiblePositionRange visiblePositionRangeForUnorderedPositions(const VisiblePosition&, const VisiblePosition&) const;
+ VisiblePositionRange positionOfLeftWord(const VisiblePosition&) const;
+ VisiblePositionRange positionOfRightWord(const VisiblePosition&) const;
+ VisiblePositionRange leftLineVisiblePositionRange(const VisiblePosition&) const;
+ VisiblePositionRange rightLineVisiblePositionRange(const VisiblePosition&) const;
+ VisiblePositionRange sentenceForPosition(const VisiblePosition&) const;
+ VisiblePositionRange paragraphForPosition(const VisiblePosition&) const;
+ VisiblePositionRange styleRangeForPosition(const VisiblePosition&) const;
+ VisiblePositionRange visiblePositionRangeForRange(const PlainTextRange&) const;
+
+ String stringForVisiblePositionRange(const VisiblePositionRange&) const;
+ virtual IntRect boundsForVisiblePositionRange(const VisiblePositionRange&) const;
+ int lengthForVisiblePositionRange(const VisiblePositionRange&) const;
+ virtual void setSelectedVisiblePositionRange(const VisiblePositionRange&) const;
+
+ virtual VisiblePosition visiblePositionForPoint(const IntPoint&) const;
+ VisiblePosition nextVisiblePosition(const VisiblePosition&) const;
+ VisiblePosition previousVisiblePosition(const VisiblePosition&) const;
+ VisiblePosition nextWordEnd(const VisiblePosition&) const;
+ VisiblePosition previousWordStart(const VisiblePosition&) const;
+ VisiblePosition nextLineEndPosition(const VisiblePosition&) const;
+ VisiblePosition previousLineStartPosition(const VisiblePosition&) const;
+ VisiblePosition nextSentenceEndPosition(const VisiblePosition&) const;
+ VisiblePosition previousSentenceStartPosition(const VisiblePosition&) const;
+ VisiblePosition nextParagraphEndPosition(const VisiblePosition&) const;
+ VisiblePosition previousParagraphStartPosition(const VisiblePosition&) const;
+ virtual VisiblePosition visiblePositionForIndex(unsigned indexValue, bool lastIndexOK) const;
+
+ virtual VisiblePosition visiblePositionForIndex(int) const;
+ virtual int indexForVisiblePosition(const VisiblePosition&) const;
+
+ AccessibilityObject* accessibilityObjectForPosition(const VisiblePosition&) const;
+ int lineForPosition(const VisiblePosition&) const;
+ PlainTextRange plainTextRangeForVisiblePositionRange(const VisiblePositionRange&) const;
+ virtual int index(const VisiblePosition&) const;
+
+ virtual PlainTextRange doAXRangeForLine(unsigned) const;
+ PlainTextRange doAXRangeForPosition(const IntPoint&) const;
+ virtual PlainTextRange doAXRangeForIndex(unsigned) const;
+ PlainTextRange doAXStyleRangeForIndex(unsigned) const;
+
+ virtual String doAXStringForRange(const PlainTextRange&) const;
+ virtual IntRect doAXBoundsForRange(const PlainTextRange&) const;
+
+ unsigned doAXLineForIndex(unsigned);
+
+#if HAVE(ACCESSIBILITY)
+#if PLATFORM(GTK)
+ AccessibilityObjectWrapper* wrapper() const;
+ void setWrapper(AccessibilityObjectWrapper*);
+#else
+ AccessibilityObjectWrapper* wrapper() const { return m_wrapper.get(); }
+ void setWrapper(AccessibilityObjectWrapper* wrapper)
+ {
+ m_wrapper = wrapper;
+ }
+#endif
+#endif
+
+ // a platform-specific method for determining if an attachment is ignored
+#if HAVE(ACCESSIBILITY)
+ bool accessibilityIgnoreAttachment() const;
+#else
+ bool accessibilityIgnoreAttachment() const { return true; }
+#endif
+
+ // allows for an AccessibilityObject to update its render tree or perform
+ // other operations update type operations
+ virtual void updateBackingStore();
+
+protected:
+ unsigned m_id;
+ AccessibilityChildrenVector m_children;
+ mutable bool m_haveChildren;
+
+ virtual void clearChildren();
+ virtual void removeAXObjectID();
+ virtual bool isDetached() const { return true; }
+
+#if PLATFORM(MAC)
+ RetainPtr<AccessibilityObjectWrapper> m_wrapper;
+#elif PLATFORM(WIN)
+ COMPtr<AccessibilityObjectWrapper> m_wrapper;
+#elif PLATFORM(GTK)
+ AtkObject* m_wrapper;
+#elif PLATFORM(CHROMIUM)
+ RefPtr<AccessibilityObjectWrapper> m_wrapper;
+#endif
+};
+
+} // namespace WebCore
+
+#endif // AccessibilityObject_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AccessibilityRenderObject_h
+#define AccessibilityRenderObject_h
+
+#include "AccessibilityObject.h"
+
+namespace WebCore {
+
+class AXObjectCache;
+class Element;
+class Frame;
+class FrameView;
+class HitTestResult;
+class HTMLAnchorElement;
+class HTMLAreaElement;
+class HTMLElement;
+class HTMLLabelElement;
+class HTMLMapElement;
+class HTMLSelectElement;
+class IntPoint;
+class IntSize;
+class Node;
+class RenderObject;
+class RenderListBox;
+class RenderTextControl;
+class RenderView;
+class Selection;
+class String;
+class Widget;
+
+class AccessibilityRenderObject : public AccessibilityObject {
+protected:
+ AccessibilityRenderObject(RenderObject*);
+public:
+ static PassRefPtr<AccessibilityRenderObject> create(RenderObject*);
+ virtual ~AccessibilityRenderObject();
+
+ bool isAccessibilityRenderObject() const { return true; };
+
+ virtual bool isAnchor() const;
+ virtual bool isAttachment() const;
+ virtual bool isHeading() const;
+ virtual bool isLink() const;
+ virtual bool isImageButton() const;
+ virtual bool isImage() const;
+ virtual bool isNativeImage() const;
+ virtual bool isPasswordField() const;
+ virtual bool isTextControl() const;
+ virtual bool isNativeTextControl() const;
+ virtual bool isWebArea() const;
+ virtual bool isCheckboxOrRadio() const;
+ virtual bool isFileUploadButton() const;
+ virtual bool isInputImage() const;
+ virtual bool isProgressIndicator() const;
+ virtual bool isSlider() const;
+ virtual bool isMenuRelated() const;
+ virtual bool isMenu() const;
+ virtual bool isMenuBar() const;
+ virtual bool isMenuButton() const;
+ virtual bool isMenuItem() const;
+ virtual bool isControl() const;
+ virtual bool isFieldset() const;
+ virtual bool isGroup() const;
+
+ virtual bool isEnabled() const;
+ virtual bool isSelected() const;
+ virtual bool isFocused() const;
+ virtual bool isChecked() const;
+ virtual bool isHovered() const;
+ virtual bool isIndeterminate() const;
+ virtual bool isLoaded() const;
+ virtual bool isMultiSelect() const;
+ virtual bool isOffScreen() const;
+ virtual bool isPressed() const;
+ virtual bool isReadOnly() const;
+ virtual bool isVisited() const;
+
+ const AtomicString& getAttribute(const QualifiedName&) const;
+ virtual bool canSetFocusAttribute() const;
+ virtual bool canSetTextRangeAttributes() const;
+ virtual bool canSetValueAttribute() const;
+
+ virtual bool hasIntValue() const;
+
+ virtual bool accessibilityIsIgnored() const;
+
+ static int headingLevel(Node*);
+ virtual int intValue() const;
+ virtual float valueForRange() const;
+ virtual float maxValueForRange() const;
+ virtual float minValueForRange() const;
+ virtual int layoutCount() const;
+
+ virtual AccessibilityObject* doAccessibilityHitTest(const IntPoint&) const;
+ virtual AccessibilityObject* focusedUIElement() const;
+ virtual AccessibilityObject* firstChild() const;
+ virtual AccessibilityObject* lastChild() const;
+ virtual AccessibilityObject* previousSibling() const;
+ virtual AccessibilityObject* nextSibling() const;
+ virtual AccessibilityObject* parentObject() const;
+ virtual AccessibilityObject* observableObject() const;
+ virtual void linkedUIElements(AccessibilityChildrenVector&) const;
+ virtual AccessibilityObject* titleUIElement() const;
+ virtual AccessibilityRole ariaRoleAttribute() const;
+ virtual bool isPresentationalChildOfAriaRole() const;
+ virtual bool ariaRoleHasPresentationalChildren() const;
+ void setAriaRole();
+ virtual AccessibilityRole roleValue() const;
+ virtual AXObjectCache* axObjectCache() const;
+
+ virtual Element* actionElement() const;
+ Element* mouseButtonListener() const;
+ FrameView* frameViewIfRenderView() const;
+ virtual Element* anchorElement() const;
+ AccessibilityObject* menuForMenuButton() const;
+ AccessibilityObject* menuButtonForMenu() const;
+
+ virtual IntRect boundingBoxRect() const;
+ virtual IntRect elementRect() const;
+ virtual IntSize size() const;
+
+ void setRenderer(RenderObject* renderer) { m_renderer = renderer; }
+ RenderObject* renderer() const { return m_renderer; }
+ RenderView* topRenderer() const;
+ RenderTextControl* textControl() const;
+ Document* document() const;
+ FrameView* topDocumentFrameView() const;
+ HTMLLabelElement* labelElementContainer() const;
+
+ virtual KURL url() const;
+ virtual PlainTextRange selectedTextRange() const;
+ virtual Selection selection() const;
+ virtual String stringValue() const;
+ virtual String ariaAccessiblityName(const String&) const;
+ virtual String ariaLabeledByAttribute() const;
+ virtual String title() const;
+ virtual String ariaDescribedByAttribute() const;
+ virtual String accessibilityDescription() const;
+ virtual String helpText() const;
+ virtual String textUnderElement() const;
+ virtual String text() const;
+ virtual int textLength() const;
+ virtual PassRefPtr<Range> ariaSelectedTextDOMRange() const;
+ virtual String selectedText() const;
+ virtual const AtomicString& accessKey() const;
+ virtual const String& actionVerb() const;
+ virtual Widget* widget() const;
+ virtual Widget* widgetForAttachmentView() const;
+ virtual void getDocumentLinks(AccessibilityChildrenVector&);
+ virtual FrameView* documentFrameView() const;
+
+ virtual const AccessibilityChildrenVector& children();
+
+ virtual void setFocused(bool);
+ virtual void setSelectedTextRange(const PlainTextRange&);
+ virtual void setValue(const String&);
+
+ virtual void detach();
+ virtual void childrenChanged();
+ virtual void addChildren();
+ virtual bool canHaveChildren() const;
+ virtual void selectedChildren(AccessibilityChildrenVector&);
+ virtual void visibleChildren(AccessibilityChildrenVector&);
+ virtual bool shouldFocusActiveDescendant() const;
+ virtual AccessibilityObject* activeDescendant() const;
+ virtual void handleActiveDescendantChanged();
+
+ virtual VisiblePositionRange visiblePositionRange() const;
+ virtual VisiblePositionRange visiblePositionRangeForLine(unsigned) const;
+ virtual IntRect boundsForVisiblePositionRange(const VisiblePositionRange&) const;
+ virtual void setSelectedVisiblePositionRange(const VisiblePositionRange&) const;
+
+ virtual VisiblePosition visiblePositionForPoint(const IntPoint&) const;
+ virtual VisiblePosition visiblePositionForIndex(unsigned indexValue, bool lastIndexOK) const;
+ virtual int index(const VisiblePosition&) const;
+
+ virtual VisiblePosition visiblePositionForIndex(int) const;
+ virtual int indexForVisiblePosition(const VisiblePosition&) const;
+
+ virtual PlainTextRange doAXRangeForLine(unsigned) const;
+ virtual PlainTextRange doAXRangeForIndex(unsigned) const;
+
+ virtual String doAXStringForRange(const PlainTextRange&) const;
+ virtual IntRect doAXBoundsForRange(const PlainTextRange&) const;
+
+ virtual void updateBackingStore();
+
+protected:
+ RenderObject* m_renderer;
+ AccessibilityRole m_ariaRole;
+ mutable bool m_childrenDirty;
+
+ void setRenderObject(RenderObject* renderer) { m_renderer = renderer; }
+ virtual void removeAXObjectID();
+
+ virtual bool isDetached() const { return !m_renderer; }
+
+private:
+ void ariaListboxSelectedChildren(AccessibilityChildrenVector&);
+ void ariaListboxVisibleChildren(AccessibilityChildrenVector&);
+
+ Element* menuElementForMenuButton() const;
+ Element* menuItemElementForMenu() const;
+ AccessibilityRole determineAriaRoleAttribute() const;
+
+ IntRect checkboxOrRadioRect() const;
+ void addRadioButtonGroupMembers(AccessibilityChildrenVector& linkedUIElements) const;
+ AccessibilityObject* internalLinkElement() const;
+ AccessibilityObject* accessibilityParentForImageMap(HTMLMapElement* map) const;
+
+ void markChildrenDirty() const { m_childrenDirty = true; }
+};
+
+} // namespace WebCore
+
+#endif // AccessibilityRenderObject_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AccessibilityTable_h
+#define AccessibilityTable_h
+
+#include "AccessibilityRenderObject.h"
+
+namespace WebCore {
+
+class String;
+class AccessibilityTableCell;
+class AccessibilityTableHeaderContainer;
+
+class AccessibilityTable : public AccessibilityRenderObject {
+
+private:
+ AccessibilityTable(RenderObject*);
+public:
+ static PassRefPtr<AccessibilityTable> create(RenderObject*);
+ virtual ~AccessibilityTable();
+
+ virtual bool isDataTable() const;
+ virtual AccessibilityRole roleValue() const;
+
+ virtual bool accessibilityIsIgnored() const;
+
+ virtual void addChildren();
+ virtual void clearChildren();
+
+ AccessibilityChildrenVector& columns();
+ AccessibilityChildrenVector& rows();
+
+ const unsigned columnCount();
+ const unsigned rowCount();
+
+ virtual String title() const;
+
+ // all the cells in the table
+ void cells(AccessibilityChildrenVector&);
+ AccessibilityTableCell* cellForColumnAndRow(unsigned column, unsigned row);
+
+ void columnHeaders(AccessibilityChildrenVector&);
+ void rowHeaders(AccessibilityChildrenVector&);
+
+ // an object that contains, as children, all the objects that act as headers
+ AccessibilityObject* headerContainer();
+
+private:
+ AccessibilityChildrenVector m_rows;
+ AccessibilityChildrenVector m_columns;
+
+ AccessibilityTableHeaderContainer* m_headerContainer;
+ mutable bool m_isAccessibilityTable;
+
+ bool isTableExposableThroughAccessibility();
+};
+
+} // namespace WebCore
+
+#endif // AccessibilityTable_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AccessibilityTableCell_h
+#define AccessibilityTableCell_h
+
+#include "AccessibilityRenderObject.h"
+
+namespace WebCore {
+
+class AccessibilityTableCell : public AccessibilityRenderObject {
+
+private:
+ AccessibilityTableCell(RenderObject*);
+public:
+ static PassRefPtr<AccessibilityTableCell> create(RenderObject*);
+ virtual ~AccessibilityTableCell();
+
+ virtual bool isTableCell() const;
+ virtual AccessibilityRole roleValue() const;
+
+ virtual bool accessibilityIsIgnored() const;
+
+ // fills in the start location and row span of cell
+ void rowIndexRange(pair<int, int>& rowRange);
+ // fills in the start location and column span of cell
+ void columnIndexRange(pair<int, int>& columnRange);
+
+ // if a table cell is not exposed as a table cell, a TH element can
+ // serve as its title ui element
+ AccessibilityObject* titleUIElement() const;
+
+private:
+ int m_rowIndex;
+
+};
+
+} // namespace WebCore
+
+#endif // AccessibilityTableCell_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AccessibilityTableColumn_h
+#define AccessibilityTableColumn_h
+
+#include "AccessibilityObject.h"
+#include "AccessibilityTable.h"
+#include "IntRect.h"
+
+namespace WebCore {
+
+class RenderTableSection;
+
+class AccessibilityTableColumn : public AccessibilityObject {
+
+private:
+ AccessibilityTableColumn();
+public:
+ static PassRefPtr<AccessibilityTableColumn> create();
+ virtual ~AccessibilityTableColumn();
+
+ void setParentTable(AccessibilityTable*);
+ virtual AccessibilityObject* parentObject() const { return m_parentTable; }
+ AccessibilityObject* headerObject();
+
+ virtual AccessibilityRole roleValue() const { return ColumnRole; }
+ virtual bool accessibilityIsIgnored() const { return false; }
+ virtual bool isTableColumn() const { return true; }
+
+ void setColumnIndex(int columnIndex) { m_columnIndex = columnIndex; }
+ int columnIndex() const { return m_columnIndex; }
+
+ virtual const AccessibilityChildrenVector& children();
+ virtual void addChildren();
+
+ virtual IntSize size() const;
+ virtual IntRect elementRect() const;
+
+private:
+ AccessibilityTable* m_parentTable;
+ int m_columnIndex;
+ IntRect m_columnRect;
+
+ AccessibilityObject* headerObjectForSection(RenderTableSection*, bool thTagRequired);
+};
+
+} // namespace WebCore
+
+#endif // AccessibilityTableColumn_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AccessibilityTableHeaderContainer_h
+#define AccessibilityTableHeaderContainer_h
+
+#include "AccessibilityObject.h"
+#include "AccessibilityTable.h"
+#include "IntRect.h"
+
+namespace WebCore {
+
+class AccessibilityTableHeaderContainer : public AccessibilityObject {
+
+private:
+ AccessibilityTableHeaderContainer();
+public:
+ static PassRefPtr<AccessibilityTableHeaderContainer> create();
+ virtual ~AccessibilityTableHeaderContainer();
+
+ virtual AccessibilityRole roleValue() const { return TableHeaderContainerRole; }
+
+ void setParentTable(AccessibilityTable* table) { m_parentTable = table; }
+ virtual AccessibilityObject* parentObject() const { return m_parentTable; }
+
+ virtual bool accessibilityIsIgnored() const { return false; }
+
+ virtual const AccessibilityChildrenVector& children();
+ virtual void addChildren();
+
+ virtual IntSize size() const;
+ virtual IntRect elementRect() const;
+
+private:
+ AccessibilityTable* m_parentTable;
+ IntRect m_headerRect;
+
+};
+
+} // namespace WebCore
+
+#endif // AccessibilityTableHeaderContainer_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AccessibilityTableRow_h
+#define AccessibilityTableRow_h
+
+#include "AccessibilityRenderObject.h"
+
+namespace WebCore {
+
+class AccessibilityTableRow : public AccessibilityRenderObject {
+
+private:
+ AccessibilityTableRow(RenderObject*);
+public:
+ static PassRefPtr<AccessibilityTableRow> create(RenderObject*);
+ virtual ~AccessibilityTableRow();
+
+ virtual bool isTableRow() const;
+ virtual AccessibilityRole roleValue() const;
+
+ // retrieves the "row" header (a th tag in the rightmost column)
+ AccessibilityObject* headerObject();
+
+ virtual bool accessibilityIsIgnored() const;
+
+ void setRowIndex(int rowIndex) { m_rowIndex = rowIndex; }
+ int rowIndex() const { return m_rowIndex; }
+
+ // allows the table to add other children that may not originate
+ // in the row, but their col/row spans overlap into it
+ void appendChild(AccessibilityObject*);
+
+private:
+ int m_rowIndex;
+};
+
+} // namespace WebCore
+
+#endif // AccessibilityTableRow_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef ActiveDOMObject_h
+#define ActiveDOMObject_h
+
+#include <wtf/Assertions.h>
+
+namespace WebCore {
+
+ class ScriptExecutionContext;
+
+ class ActiveDOMObject {
+ public:
+ ActiveDOMObject(ScriptExecutionContext*, void* upcastPointer);
+
+ ScriptExecutionContext* scriptExecutionContext() const { return m_scriptExecutionContext; }
+ virtual bool hasPendingActivity() const;
+
+ virtual void contextDestroyed();
+
+ // canSuspend() is used by the caller if there is a choice between suspending and stopping.
+ // For example, a page won't be suspended and placed in the back/forward cache if it has
+ // the objects that can not be suspended.
+ // However, 'suspend' can be called even if canSuspend() would return 'false'. That
+ // happens in step-by-step JS debugging for example - in this case it would be incorrect
+ // to stop the object. Exact semantics of suspend is up to the object then.
+ virtual bool canSuspend() const;
+ virtual void suspend();
+ virtual void resume();
+ virtual void stop();
+
+ protected:
+ virtual ~ActiveDOMObject();
+
+ template<class T> void setPendingActivity(T* thisObject)
+ {
+ ASSERT(thisObject == this);
+ thisObject->ref();
+ m_pendingActivityCount++;
+ }
+
+ template<class T> void unsetPendingActivity(T* thisObject)
+ {
+ ASSERT(m_pendingActivityCount > 0);
+ --m_pendingActivityCount;
+ thisObject->deref();
+ }
+
+ private:
+ ScriptExecutionContext* m_scriptExecutionContext;
+ unsigned m_pendingActivityCount;
+ };
+
+} // namespace WebCore
+
+#endif // ActiveDOMObject_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Animation_h
+#define Animation_h
+
+#include "PlatformString.h"
+#include "TimingFunction.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+const int cAnimateNone = 0;
+const int cAnimateAll = -2;
+
+class Animation : public RefCounted<Animation> {
+public:
+ ~Animation();
+
+ static PassRefPtr<Animation> create() { return adoptRef(new Animation); };
+
+ bool isDelaySet() const { return m_delaySet; }
+ bool isDirectionSet() const { return m_directionSet; }
+ bool isDurationSet() const { return m_durationSet; }
+ bool isIterationCountSet() const { return m_iterationCountSet; }
+ bool isNameSet() const { return m_nameSet; }
+ bool isPlayStateSet() const { return m_playStateSet; }
+ bool isPropertySet() const { return m_propertySet; }
+ bool isTimingFunctionSet() const { return m_timingFunctionSet; }
+
+ // Flags this to be the special "none" animation (animation-name: none)
+ bool isNoneAnimation() const { return m_isNone; }
+ // We can make placeholder Animation objects to keep the comma-separated lists
+ // of properties in sync. isValidAnimation means this is not a placeholder.
+ bool isValidAnimation() const { return !m_isNone && !m_name.isEmpty(); }
+
+ bool isEmpty() const
+ {
+ return (!m_directionSet && !m_durationSet && !m_nameSet && !m_playStateSet &&
+ !m_iterationCountSet && !m_delaySet && !m_timingFunctionSet && !m_propertySet);
+ }
+
+ bool isEmptyOrZeroDuration() const
+ {
+ return isEmpty() || (m_duration == 0 && m_delay <= 0);
+ }
+
+ void clearDelay() { m_delaySet = false; }
+ void clearDirection() { m_directionSet = false; }
+ void clearDuration() { m_durationSet = false; }
+ void clearIterationCount() { m_iterationCountSet = false; }
+ void clearName() { m_nameSet = false; }
+ void clearPlayState() { m_playStateSet = AnimPlayStatePlaying; }
+ void clearProperty() { m_propertySet = false; }
+ void clearTimingFunction() { m_timingFunctionSet = false; }
+
+ double delay() const { return m_delay; }
+
+ enum AnimationDirection { AnimationDirectionNormal, AnimationDirectionAlternate };
+ AnimationDirection direction() const { return m_direction; }
+
+ double duration() const { return m_duration; }
+
+ enum { IterationCountInfinite = -1 };
+ int iterationCount() const { return m_iterationCount; }
+ const String& name() const { return m_name; }
+ unsigned playState() const { return m_playState; }
+ int property() const { return m_property; }
+ const TimingFunction& timingFunction() const { return m_timingFunction; }
+
+ void setDelay(double c) { m_delay = c; m_delaySet = true; }
+ void setDirection(AnimationDirection d) { m_direction = d; m_directionSet = true; }
+ void setDuration(double d) { ASSERT(d >= 0); m_duration = d; m_durationSet = true; }
+ void setIterationCount(int c) { m_iterationCount = c; m_iterationCountSet = true; }
+ void setName(const String& n) { m_name = n; m_nameSet = true; }
+ void setPlayState(unsigned d) { m_playState = d; m_playStateSet = true; }
+ void setProperty(int t) { m_property = t; m_propertySet = true; }
+ void setTimingFunction(const TimingFunction& f) { m_timingFunction = f; m_timingFunctionSet = true; }
+
+ void setIsNoneAnimation(bool n) { m_isNone = n; }
+
+ Animation& operator=(const Animation& o);
+
+ // return true if all members of this class match (excluding m_next)
+ bool animationsMatch(const Animation*, bool matchPlayStates = true) const;
+
+ // return true every Animation in the chain (defined by m_next) match
+ bool operator==(const Animation& o) const { return animationsMatch(&o); }
+ bool operator!=(const Animation& o) const { return !(*this == o); }
+
+private:
+ Animation();
+ Animation(const Animation& o);
+
+ String m_name;
+ int m_property;
+ int m_iterationCount;
+ double m_delay;
+ double m_duration;
+ TimingFunction m_timingFunction;
+ AnimationDirection m_direction : 1;
+
+ unsigned m_playState : 2;
+
+ bool m_delaySet : 1;
+ bool m_directionSet : 1;
+ bool m_durationSet : 1;
+ bool m_iterationCountSet : 1;
+ bool m_nameSet : 1;
+ bool m_playStateSet : 1;
+ bool m_propertySet : 1;
+ bool m_timingFunctionSet : 1;
+
+ bool m_isNone : 1;
+
+public:
+ static float initialAnimationDelay() { return 0; }
+ static AnimationDirection initialAnimationDirection() { return AnimationDirectionNormal; }
+ static double initialAnimationDuration() { return 0; }
+ static int initialAnimationIterationCount() { return 1; }
+ static String initialAnimationName() { return String("none"); }
+ static unsigned initialAnimationPlayState() { return AnimPlayStatePlaying; }
+ static int initialAnimationProperty() { return cAnimateAll; }
+ static TimingFunction initialAnimationTimingFunction() { return TimingFunction(); }
+};
+
+} // namespace WebCore
+
+#endif // Animation_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef AnimationList_h
+#define AnimationList_h
+
+#include "Animation.h"
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class AnimationList {
+public:
+ void fillUnsetProperties();
+ bool operator==(const AnimationList& o) const;
+ bool operator!=(const AnimationList& o) const
+ {
+ return !(*this == o);
+ }
+
+ size_t size() const { return m_animations.size(); }
+ bool isEmpty() const { return m_animations.isEmpty(); }
+
+ void resize(size_t n) { m_animations.resize(n); }
+ void remove(size_t i) { m_animations.remove(i); }
+ void append(PassRefPtr<Animation> anim) { m_animations.append(anim); }
+
+ Animation* animation(size_t i) { return m_animations[i].get(); }
+ const Animation* animation(size_t i) const { return m_animations[i].get(); }
+
+private:
+ Vector<RefPtr<Animation> > m_animations;
+};
+
+
+} // namespace WebCore
+
+#endif // AnimationList_h
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AppendNodeCommand_h
+#define AppendNodeCommand_h
+
+#include "EditCommand.h"
+
+namespace WebCore {
+
+class AppendNodeCommand : public SimpleEditCommand {
+public:
+ static PassRefPtr<AppendNodeCommand> create(PassRefPtr<Element> parent, PassRefPtr<Node> node)
+ {
+ return adoptRef(new AppendNodeCommand(parent, node));
+ }
+
+private:
+ AppendNodeCommand(PassRefPtr<Element> parent, PassRefPtr<Node> node);
+
+ virtual void doApply();
+ virtual void doUnapply();
+
+ RefPtr<Element> m_parent;
+ RefPtr<Node> m_node;
+};
+
+} // namespace WebCore
+
+#endif // AppendNodeCommand_h
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ApplyStyleCommand_h
+#define ApplyStyleCommand_h
+
+#include "CompositeEditCommand.h"
+
+namespace WebCore {
+
+class CSSPrimitiveValue;
+class HTMLElement;
+class StyleChange;
+
+class ApplyStyleCommand : public CompositeEditCommand {
+public:
+ enum EPropertyLevel { PropertyDefault, ForceBlockProperties };
+
+ static PassRefPtr<ApplyStyleCommand> create(Document* document, CSSStyleDeclaration* style, EditAction action = EditActionChangeAttributes, EPropertyLevel level = PropertyDefault)
+ {
+ return adoptRef(new ApplyStyleCommand(document, style, action, level));
+ }
+ static PassRefPtr<ApplyStyleCommand> create(Document* document, CSSStyleDeclaration* style, const Position& start, const Position& end, EditAction action = EditActionChangeAttributes, EPropertyLevel level = PropertyDefault)
+ {
+ return adoptRef(new ApplyStyleCommand(document, style, start, end, action, level));
+ }
+ static PassRefPtr<ApplyStyleCommand> create(PassRefPtr<Element> element, bool removeOnly = false, EditAction action = EditActionChangeAttributes)
+ {
+ return adoptRef(new ApplyStyleCommand(element, removeOnly, action));
+ }
+
+private:
+ ApplyStyleCommand(Document*, CSSStyleDeclaration*, EditAction, EPropertyLevel);
+ ApplyStyleCommand(Document*, CSSStyleDeclaration*, const Position& start, const Position& end, EditAction, EPropertyLevel);
+ ApplyStyleCommand(PassRefPtr<Element>, bool removeOnly, EditAction);
+
+ virtual void doApply();
+ virtual EditAction editingAction() const;
+
+ CSSMutableStyleDeclaration* style() const { return m_style.get(); }
+
+ // style-removal helpers
+ bool isHTMLStyleNode(CSSMutableStyleDeclaration*, HTMLElement*);
+ void removeHTMLStyleNode(HTMLElement*);
+ void removeHTMLFontStyle(CSSMutableStyleDeclaration*, HTMLElement*);
+ void removeHTMLBidiEmbeddingStyle(CSSMutableStyleDeclaration*, HTMLElement*);
+ void removeCSSStyle(CSSMutableStyleDeclaration*, HTMLElement*);
+ void removeInlineStyle(PassRefPtr<CSSMutableStyleDeclaration>, const Position& start, const Position& end);
+ bool nodeFullySelected(Node*, const Position& start, const Position& end) const;
+ bool nodeFullyUnselected(Node*, const Position& start, const Position& end) const;
+ PassRefPtr<CSSMutableStyleDeclaration> extractTextDecorationStyle(Node*);
+ PassRefPtr<CSSMutableStyleDeclaration> extractAndNegateTextDecorationStyle(Node*);
+ void applyTextDecorationStyle(Node*, CSSMutableStyleDeclaration *style);
+ void pushDownTextDecorationStyleAroundNode(Node*, bool force);
+ void pushDownTextDecorationStyleAtBoundaries(const Position& start, const Position& end);
+
+ // style-application helpers
+ void applyBlockStyle(CSSMutableStyleDeclaration*);
+ void applyRelativeFontStyleChange(CSSMutableStyleDeclaration*);
+ void applyInlineStyle(CSSMutableStyleDeclaration*);
+ void applyInlineStyleToRange(CSSMutableStyleDeclaration*, const Position& start, const Position& end);
+ void addBlockStyle(const StyleChange&, HTMLElement*);
+ void addInlineStyleIfNeeded(CSSMutableStyleDeclaration*, Node* start, Node* end);
+ bool splitTextAtStartIfNeeded(const Position& start, const Position& end);
+ bool splitTextAtEndIfNeeded(const Position& start, const Position& end);
+ bool splitTextElementAtStartIfNeeded(const Position& start, const Position& end);
+ bool splitTextElementAtEndIfNeeded(const Position& start, const Position& end);
+ bool mergeStartWithPreviousIfIdentical(const Position& start, const Position& end);
+ bool mergeEndWithNextIfIdentical(const Position& start, const Position& end);
+ void cleanupUnstyledAppleStyleSpans(Node* dummySpanAncestor);
+
+ void surroundNodeRangeWithElement(Node* start, Node* end, PassRefPtr<Element>);
+ float computedFontSize(const Node*);
+ void joinChildTextNodes(Node*, const Position& start, const Position& end);
+
+ HTMLElement* splitAncestorsWithUnicodeBidi(Node*, bool before, RefPtr<CSSPrimitiveValue> allowedDirection);
+ void removeEmbeddingUpToEnclosingBlock(Node* node, Node* unsplitAncestor);
+
+ void updateStartEnd(const Position& newStart, const Position& newEnd);
+ Position startPosition();
+ Position endPosition();
+
+ RefPtr<CSSMutableStyleDeclaration> m_style;
+ EditAction m_editingAction;
+ EPropertyLevel m_propertyLevel;
+ Position m_start;
+ Position m_end;
+ bool m_useEndingSelection;
+ RefPtr<Element> m_styledInlineElement;
+ bool m_removeOnly;
+};
+
+bool isStyleSpan(const Node*);
+PassRefPtr<HTMLElement> createStyleSpanElement(Document*);
+
+} // namespace WebCore
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1998-2000 Netscape Communications Corporation.
+ * Copyright (C) 2003-6 Apple Computer
+ *
+ * Other contributors:
+ * Nick Blievers <nickb@adacel.com.au>
+ * Jeff Hostetler <jeff@nerdone.com>
+ * Tom Rini <trini@kernel.crashing.org>
+ * Raffaele Sena <raff@netwinder.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of either the Mozilla Public License Version 1.1, found at
+ * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
+ * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
+ * (the "GPL"), in which case the provisions of the MPL or the GPL are
+ * applicable instead of those above. If you wish to allow use of your
+ * version of this file only under the terms of one of those two
+ * licenses (the MPL or the GPL) and not to allow others to use your
+ * version of this file under the LGPL, indicate your decision by
+ * deletingthe provisions above and replace them with the notice and
+ * other provisions required by the MPL or the GPL, as the case may be.
+ * If you do not delete the provisions above, a recipient may use your
+ * version of this file under any of the LGPL, the MPL or the GPL.
+ */
+
+#ifndef Arena_h
+#define Arena_h
+
+#define ARENA_ALIGN_MASK 3
+
+namespace WebCore {
+
+typedef unsigned long uword;
+
+struct Arena {
+ Arena* next; // next arena
+ uword base; // aligned base address
+ uword limit; // end of arena (1+last byte)
+ uword avail; // points to next available byte in arena
+};
+
+struct ArenaPool {
+ Arena first; // first arena in pool list.
+ Arena* current; // current arena.
+ unsigned int arenasize;
+ uword mask; // Mask (power-of-2 - 1)
+};
+
+void InitArenaPool(ArenaPool *pool, const char *name,
+ unsigned int size, unsigned int align);
+void FinishArenaPool(ArenaPool *pool);
+void FreeArenaPool(ArenaPool *pool);
+void* ArenaAllocate(ArenaPool *pool, unsigned int nb);
+
+#define ARENA_ALIGN(pool, n) (((uword)(n) + ARENA_ALIGN_MASK) & ~ARENA_ALIGN_MASK)
+#define INIT_ARENA_POOL(pool, name, size) \
+ InitArenaPool(pool, name, size, ARENA_ALIGN_MASK + 1)
+
+#define ARENA_ALLOCATE(p, pool, nb) \
+ Arena *_a = (pool)->current; \
+ unsigned int _nb = ARENA_ALIGN(pool, nb); \
+ uword _p = _a->avail; \
+ uword _q = _p + _nb; \
+ if (_q > _a->limit) \
+ _p = (uword)ArenaAllocate(pool, _nb); \
+ else \
+ _a->avail = _q; \
+ p = (void *)_p;
+
+#define ARENA_GROW(p, pool, size, incr) \
+ Arena *_a = (pool)->current; \
+ unsigned int _incr = ARENA_ALIGN(pool, incr); \
+ uword _p = _a->avail; \
+ uword _q = _p + _incr; \
+ if (_p == (uword)(p) + ARENA_ALIGN(pool, size) && \
+ _q <= _a->limit) { \
+ _a->avail = _q; \
+ } else { \
+ p = ArenaGrow(pool, p, size, incr); \
+ }
+
+#define ARENA_MARK(pool) ((void *) (pool)->current->avail)
+#define UPTRDIFF(p,q) ((uword)(p) - (uword)(q))
+
+#ifdef DEBUG
+#define FREE_PATTERN 0xDA
+#define CLEAR_UNUSED(a) ASSERT((a)->avail <= (a)->limit); \
+ memset((void*)(a)->avail, FREE_PATTERN, \
+ (a)->limit - (a)->avail)
+#define CLEAR_ARENA(a) memset((void*)(a), FREE_PATTERN, \
+ (a)->limit - (uword)(a))
+#else
+#define CLEAR_UNUSED(a)
+#define CLEAR_ARENA(a)
+#endif
+
+#define ARENA_RELEASE(pool, mark) \
+ char *_m = (char *)(mark); \
+ Arena *_a = (pool)->current; \
+ if (UPTRDIFF(_m, _a->base) <= UPTRDIFF(_a->avail, _a->base)) { \
+ _a->avail = (uword)ARENA_ALIGN(pool, _m); \
+ CLEAR_UNUSED(_a); \
+ } else { \
+ ArenaRelease(pool, _m); \
+ }
+
+#define ARENA_DESTROY(pool, a, pnext) \
+ if ((pool)->current == (a)) (pool)->current = &(pool)->first; \
+ *(pnext) = (a)->next; \
+ CLEAR_ARENA(a); \
+ fastFree(a); \
+ (a) = 0;
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef AtomicString_h
+#define AtomicString_h
+
+#include "AtomicStringImpl.h"
+#include "PlatformString.h"
+
+namespace WebCore {
+
+struct AtomicStringHash;
+
+class AtomicString {
+public:
+ static void init();
+
+ AtomicString() { }
+ AtomicString(const char* s) : m_string(add(s)) { }
+ AtomicString(const UChar* s, int length) : m_string(add(s, length)) { }
+ AtomicString(const UChar* s) : m_string(add(s)) { }
+#if USE(JSC)
+ AtomicString(const JSC::UString& s) : m_string(add(s)) { }
+ AtomicString(const JSC::Identifier& s) : m_string(add(s)) { }
+#endif
+ AtomicString(StringImpl* imp) : m_string(add(imp)) { }
+ AtomicString(AtomicStringImpl* imp) : m_string(imp) { }
+ AtomicString(const String& s) : m_string(add(s.impl())) { }
+
+ // Hash table deleted values, which are only constructed and never copied or destroyed.
+ AtomicString(WTF::HashTableDeletedValueType) : m_string(WTF::HashTableDeletedValue) { }
+ bool isHashTableDeletedValue() const { return m_string.isHashTableDeletedValue(); }
+
+#if USE(JSC)
+ static AtomicStringImpl* find(const JSC::Identifier&);
+#endif
+
+ operator const String&() const { return m_string; }
+ const String& string() const { return m_string; };
+
+#if USE(JSC)
+ operator JSC::UString() const;
+#endif
+
+ AtomicStringImpl* impl() const { return static_cast<AtomicStringImpl *>(m_string.impl()); }
+
+ const UChar* characters() const { return m_string.characters(); }
+ unsigned length() const { return m_string.length(); }
+
+ UChar operator[](unsigned int i) const { return m_string[i]; }
+
+ bool contains(UChar c) const { return m_string.contains(c); }
+ bool contains(const AtomicString& s, bool caseSensitive = true) const
+ { return m_string.contains(s.string(), caseSensitive); }
+
+ int find(UChar c, int start = 0) const { return m_string.find(c, start); }
+ int find(const AtomicString& s, int start = 0, bool caseSentitive = true) const
+ { return m_string.find(s.string(), start, caseSentitive); }
+
+ bool startsWith(const AtomicString& s, bool caseSensitive = true) const
+ { return m_string.startsWith(s.string(), caseSensitive); }
+ bool endsWith(const AtomicString& s, bool caseSensitive = true) const
+ { return m_string.endsWith(s.string(), caseSensitive); }
+
+ int toInt(bool* ok = 0) const { return m_string.toInt(ok); }
+ double toDouble(bool* ok = 0) const { return m_string.toDouble(ok); }
+ float toFloat(bool* ok = 0) const { return m_string.toFloat(ok); }
+ bool percentage(int& p) const { return m_string.percentage(p); }
+
+ bool isNull() const { return m_string.isNull(); }
+ bool isEmpty() const { return m_string.isEmpty(); }
+
+ static void remove(StringImpl*);
+
+#if PLATFORM(CF) || (PLATFORM(QT) && PLATFORM(DARWIN))
+ AtomicString(CFStringRef s) : m_string(add(String(s).impl())) { }
+ CFStringRef createCFString() const { return m_string.createCFString(); }
+#endif
+#ifdef __OBJC__
+ AtomicString(NSString* s) : m_string(add(String(s).impl())) { }
+ operator NSString*() const { return m_string; }
+#endif
+#if PLATFORM(QT)
+ AtomicString(const QString& s) : m_string(add(String(s).impl())) { }
+ operator QString() const { return m_string; }
+#endif
+
+private:
+ String m_string;
+
+ static PassRefPtr<StringImpl> add(const char*);
+ static PassRefPtr<StringImpl> add(const UChar*, int length);
+ static PassRefPtr<StringImpl> add(const UChar*);
+ static PassRefPtr<StringImpl> add(StringImpl*);
+#if USE(JSC)
+ static PassRefPtr<StringImpl> add(const JSC::UString&);
+ static PassRefPtr<StringImpl> add(const JSC::Identifier&);
+#endif
+};
+
+inline bool operator==(const AtomicString& a, const AtomicString& b) { return a.impl() == b.impl(); }
+bool operator==(const AtomicString& a, const char* b);
+inline bool operator==(const AtomicString& a, const String& b) { return equal(a.impl(), b.impl()); }
+inline bool operator==(const char* a, const AtomicString& b) { return b == a; }
+inline bool operator==(const String& a, const AtomicString& b) { return equal(a.impl(), b.impl()); }
+
+inline bool operator!=(const AtomicString& a, const AtomicString& b) { return a.impl() != b.impl(); }
+inline bool operator!=(const AtomicString& a, const char *b) { return !(a == b); }
+inline bool operator!=(const AtomicString& a, const String& b) { return !equal(a.impl(), b.impl()); }
+inline bool operator!=(const char* a, const AtomicString& b) { return !(b == a); }
+inline bool operator!=(const String& a, const AtomicString& b) { return !equal(a.impl(), b.impl()); }
+
+inline bool equalIgnoringCase(const AtomicString& a, const AtomicString& b) { return equalIgnoringCase(a.impl(), b.impl()); }
+inline bool equalIgnoringCase(const AtomicString& a, const char* b) { return equalIgnoringCase(a.impl(), b); }
+inline bool equalIgnoringCase(const AtomicString& a, const String& b) { return equalIgnoringCase(a.impl(), b.impl()); }
+inline bool equalIgnoringCase(const char* a, const AtomicString& b) { return equalIgnoringCase(a, b.impl()); }
+inline bool equalIgnoringCase(const String& a, const AtomicString& b) { return equalIgnoringCase(a.impl(), b.impl()); }
+
+// Define external global variables for the commonly used atomic strings.
+// These are only usable from the main thread.
+#ifndef ATOMICSTRING_HIDE_GLOBALS
+ extern const AtomicString nullAtom;
+ extern const AtomicString emptyAtom;
+ extern const AtomicString textAtom;
+ extern const AtomicString commentAtom;
+ extern const AtomicString starAtom;
+#endif
+
+} // namespace WebCore
+
+
+namespace WTF {
+
+ // AtomicStringHash is the default hash for AtomicString
+ template<typename T> struct DefaultHash;
+ template<> struct DefaultHash<WebCore::AtomicString> {
+ typedef WebCore::AtomicStringHash Hash;
+ };
+
+} // namespace WTF
+
+#endif // AtomicString_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AtomicStringHash_h
+#define AtomicStringHash_h
+
+#include "AtomicString.h"
+#include <wtf/HashTraits.h>
+
+#if 0
+namespace WebCore {
+
+ struct AtomicStringHash {
+ static unsigned hash(const AtomicString& key)
+ {
+ return key.impl()->existingHash();
+ }
+
+ static bool equal(const AtomicString& a, const AtomicString& b)
+ {
+ return a == b;
+ }
+
+ static const bool safeToCompareToEmptyOrDeleted = false;
+ };
+
+}
+
+namespace WTF {
+
+ // WebCore::AtomicStringHash is the default hash for AtomicString
+ template<> struct HashTraits<WebCore::AtomicString> : GenericHashTraits<WebCore::AtomicString> {
+ static const bool emptyValueIsZero = true;
+ static void constructDeletedValue(WebCore::AtomicString& slot) { new (&slot) WebCore::AtomicString(HashTableDeletedValue); }
+ static bool isDeletedValue(const WebCore::AtomicString& slot) { return slot.isHashTableDeletedValue(); }
+ };
+
+}
+#endif
+
+#endif
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef AtomicStringImpl_h
+#define AtomicStringImpl_h
+
+#include "StringImpl.h"
+
+namespace WebCore {
+
+class AtomicStringImpl : public StringImpl
+{
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Peter Kelly (pmk@post.com)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Attr_h
+#define Attr_h
+
+#include "ContainerNode.h"
+#include "Attribute.h"
+
+namespace WebCore {
+
+// Attr can have Text and EntityReference children
+// therefore it has to be a fullblown Node. The plan
+// is to dynamically allocate a textchild and store the
+// resulting nodevalue in the Attribute upon
+// destruction. however, this is not yet implemented.
+
+class Attr : public ContainerNode {
+ friend class NamedAttrMap;
+public:
+ Attr(Element*, Document*, PassRefPtr<Attribute>);
+ ~Attr();
+
+ // Call this after calling the constructor so the
+ // Attr node isn't floating when we append the text node.
+ void createTextChild();
+
+ // DOM methods & attributes for Attr
+ String name() const { return qualifiedName().toString(); }
+ bool specified() const { return m_specified; }
+ Element* ownerElement() const { return m_element; }
+
+ String value() const { return m_attribute->value(); }
+ void setValue(const String&, ExceptionCode&);
+
+ // DOM methods overridden from parent classes
+ virtual String nodeName() const;
+ virtual NodeType nodeType() const;
+ const AtomicString& localName() const;
+ const AtomicString& namespaceURI() const;
+ const AtomicString& prefix() const;
+ virtual void setPrefix(const AtomicString&, ExceptionCode&);
+
+ virtual String nodeValue() const;
+ virtual void setNodeValue(const String&, ExceptionCode&);
+ virtual PassRefPtr<Node> cloneNode(bool deep);
+
+ // Other methods (not part of DOM)
+ virtual bool isAttributeNode() const { return true; }
+ virtual bool childTypeAllowed(NodeType);
+
+ virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
+
+ Attribute* attr() const { return m_attribute.get(); }
+ const QualifiedName& qualifiedName() const { return m_attribute->name(); }
+
+ // An extension to get presentational information for attributes.
+ CSSStyleDeclaration* style() { return m_attribute->style(); }
+
+ void setSpecified(bool specified) { m_specified = specified; }
+
+private:
+ virtual const AtomicString& virtualPrefix() const { return prefix(); }
+ virtual const AtomicString& virtualLocalName() const { return localName(); }
+ virtual const AtomicString& virtualNamespaceURI() const { return namespaceURI(); }
+
+ Element* m_element;
+ RefPtr<Attribute> m_attribute;
+ unsigned m_ignoreChildrenChanged : 31;
+ bool m_specified : 1;
+};
+
+} // namespace WebCore
+
+#endif // Attr_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Peter Kelly (pmk@post.com)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Attribute_h
+#define Attribute_h
+
+#include "QualifiedName.h"
+
+namespace WebCore {
+
+class Attr;
+class CSSStyleDeclaration;
+class Element;
+class NamedAttrMap;
+
+// This has no counterpart in DOM.
+// It is an internal representation of the node value of an Attr.
+// The actual Attr with its value as a Text child is allocated only if needed.
+class Attribute : public RefCounted<Attribute> {
+ friend class Attr;
+ friend class NamedAttrMap;
+public:
+ static PassRefPtr<Attribute> create(const QualifiedName& name, const AtomicString& value)
+ {
+ return adoptRef(new Attribute(name, value));
+ }
+ virtual ~Attribute() { }
+
+ const AtomicString& value() const { return m_value; }
+ const AtomicString& prefix() const { return m_name.prefix(); }
+ const AtomicString& localName() const { return m_name.localName(); }
+ const AtomicString& namespaceURI() const { return m_name.namespaceURI(); }
+
+ const QualifiedName& name() const { return m_name; }
+
+ Attr* attr() const { return m_impl; }
+ PassRefPtr<Attr> createAttrIfNeeded(Element*);
+
+ bool isNull() const { return m_value.isNull(); }
+ bool isEmpty() const { return m_value.isEmpty(); }
+
+ virtual PassRefPtr<Attribute> clone() const;
+
+ // An extension to get the style information for presentational attributes.
+ virtual CSSStyleDeclaration* style() const { return 0; }
+
+ void setValue(const AtomicString& value) { m_value = value; }
+ void setPrefix(const AtomicString& prefix) { m_name.setPrefix(prefix); }
+
+ virtual bool isMappedAttribute() { return false; }
+
+protected:
+ Attribute(const QualifiedName& name, const AtomicString& value)
+ : m_name(name), m_value(value), m_impl(0)
+ {
+ }
+ Attribute(const AtomicString& name, const AtomicString& value)
+ : m_name(nullAtom, name, nullAtom), m_value(value), m_impl(0)
+ {
+ }
+
+private:
+ QualifiedName m_name;
+ AtomicString m_value;
+ Attr* m_impl;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "AuthenticationCF.h"
+
+#include "AuthenticationChallenge.h"
+#include "Credential.h"
+#include "ProtectionSpace.h"
+#include "ResourceHandle.h"
+
+#include <CFNetwork/CFURLAuthChallengePriv.h>
+#include <CFNetwork/CFURLCredentialPriv.h>
+#include <CFNetwork/CFURLProtectionSpacePriv.h>
+
+namespace WebCore {
+
+AuthenticationChallenge::AuthenticationChallenge(const ProtectionSpace& protectionSpace,
+ const Credential& proposedCredential,
+ unsigned previousFailureCount,
+ const ResourceResponse& response,
+ const ResourceError& error)
+ : AuthenticationChallengeBase(protectionSpace,
+ proposedCredential,
+ previousFailureCount,
+ response,
+ error)
+{
+}
+
+AuthenticationChallenge::AuthenticationChallenge(CFURLAuthChallengeRef cfChallenge,
+ ResourceHandle* sourceHandle)
+ : AuthenticationChallengeBase(core(CFURLAuthChallengeGetProtectionSpace(cfChallenge)),
+ core(CFURLAuthChallengeGetProposedCredential(cfChallenge)),
+ CFURLAuthChallengeGetPreviousFailureCount(cfChallenge),
+ (CFURLResponseRef)CFURLAuthChallengeGetFailureResponse(cfChallenge),
+ CFURLAuthChallengeGetError(cfChallenge))
+ , m_sourceHandle(sourceHandle)
+ , m_cfChallenge(cfChallenge)
+{
+}
+
+bool AuthenticationChallenge::platformCompare(const AuthenticationChallenge& a, const AuthenticationChallenge& b)
+{
+ if (a.sourceHandle() != b.sourceHandle())
+ return false;
+
+ if (a.cfURLAuthChallengeRef() != b.cfURLAuthChallengeRef())
+ return false;
+
+ return true;
+}
+
+CFURLAuthChallengeRef createCF(const AuthenticationChallenge& coreChallenge)
+{
+ CFURLProtectionSpaceRef protectionSpace = createCF(coreChallenge.protectionSpace());
+ CFURLCredentialRef credential = createCF(coreChallenge.proposedCredential());
+
+ CFURLAuthChallengeRef result = CFURLAuthChallengeCreate(0, protectionSpace, credential,
+ coreChallenge.previousFailureCount(),
+ coreChallenge.failureResponse().cfURLResponse(),
+ coreChallenge.error());
+ CFRelease(protectionSpace);
+ CFRelease(credential);
+ return result;
+}
+
+CFURLCredentialRef createCF(const Credential& coreCredential)
+{
+ CFURLCredentialPersistence persistence = kCFURLCredentialPersistenceNone;
+ switch (coreCredential.persistence()) {
+ case CredentialPersistenceNone:
+ break;
+ case CredentialPersistenceForSession:
+ persistence = kCFURLCredentialPersistenceForSession;
+ break;
+ case CredentialPersistencePermanent:
+ persistence = kCFURLCredentialPersistencePermanent;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ CFStringRef user = coreCredential.user().createCFString();
+ CFStringRef password = coreCredential.password().createCFString();
+ CFURLCredentialRef result = CFURLCredentialCreate(0, user, password, 0, persistence);
+ CFRelease(user);
+ CFRelease(password);
+
+ return result;
+}
+
+CFURLProtectionSpaceRef createCF(const ProtectionSpace& coreSpace)
+{
+ CFURLProtectionSpaceServerType serverType = kCFURLProtectionSpaceServerHTTP;
+ switch (coreSpace.serverType()) {
+ case ProtectionSpaceServerHTTP:
+ serverType = kCFURLProtectionSpaceServerHTTP;
+ break;
+ case ProtectionSpaceServerHTTPS:
+ serverType = kCFURLProtectionSpaceServerHTTPS;
+ break;
+ case ProtectionSpaceServerFTP:
+ serverType = kCFURLProtectionSpaceServerFTP;
+ break;
+ case ProtectionSpaceServerFTPS:
+ serverType = kCFURLProtectionSpaceServerFTPS;
+ break;
+ case ProtectionSpaceProxyHTTP:
+ serverType = kCFURLProtectionSpaceProxyHTTP;
+ break;
+ case ProtectionSpaceProxyHTTPS:
+ serverType = kCFURLProtectionSpaceProxyHTTPS;
+ break;
+ case ProtectionSpaceProxyFTP:
+ serverType = kCFURLProtectionSpaceProxyFTP;
+ break;
+ case ProtectionSpaceProxySOCKS:
+ serverType = kCFURLProtectionSpaceProxySOCKS;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ CFURLProtectionSpaceAuthenticationScheme scheme = kCFURLProtectionSpaceAuthenticationSchemeDefault;
+ switch (coreSpace.authenticationScheme()) {
+ case ProtectionSpaceAuthenticationSchemeDefault:
+ scheme = kCFURLProtectionSpaceAuthenticationSchemeDefault;
+ break;
+ case ProtectionSpaceAuthenticationSchemeHTTPBasic:
+ scheme = kCFURLProtectionSpaceAuthenticationSchemeHTTPBasic;
+ break;
+ case ProtectionSpaceAuthenticationSchemeHTTPDigest:
+ scheme = kCFURLProtectionSpaceAuthenticationSchemeHTTPDigest;
+ break;
+ case ProtectionSpaceAuthenticationSchemeHTMLForm:
+ scheme = kCFURLProtectionSpaceAuthenticationSchemeHTMLForm;
+ break;
+ case ProtectionSpaceAuthenticationSchemeNTLM:
+ scheme = kCFURLProtectionSpaceAuthenticationSchemeNTLM;
+ break;
+ case ProtectionSpaceAuthenticationSchemeNegotiate:
+ scheme = kCFURLProtectionSpaceAuthenticationSchemeNegotiate;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ CFStringRef host = coreSpace.host().createCFString();
+ CFStringRef realm = coreSpace.realm().createCFString();
+ CFURLProtectionSpaceRef result = CFURLProtectionSpaceCreate(0, host, coreSpace.port(), serverType, realm, scheme);
+ CFRelease(host);
+ CFRelease(realm);
+
+ return result;
+}
+
+Credential core(CFURLCredentialRef cfCredential)
+{
+ if (!cfCredential)
+ return Credential();
+
+ CredentialPersistence persistence = CredentialPersistenceNone;
+ switch (CFURLCredentialGetPersistence(cfCredential)) {
+ case kCFURLCredentialPersistenceNone:
+ break;
+ case kCFURLCredentialPersistenceForSession:
+ persistence = CredentialPersistenceForSession;
+ break;
+ case kCFURLCredentialPersistencePermanent:
+ persistence = CredentialPersistencePermanent;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ return Credential(CFURLCredentialGetUsername(cfCredential), CFURLCredentialCopyPassword(cfCredential), persistence);
+}
+
+ProtectionSpace core(CFURLProtectionSpaceRef cfSpace)
+{
+ ProtectionSpaceServerType serverType = ProtectionSpaceServerHTTP;
+
+ switch (CFURLProtectionSpaceGetServerType(cfSpace)) {
+ case kCFURLProtectionSpaceServerHTTP:
+ break;
+ case kCFURLProtectionSpaceServerHTTPS:
+ serverType = ProtectionSpaceServerHTTPS;
+ break;
+ case kCFURLProtectionSpaceServerFTP:
+ serverType = ProtectionSpaceServerFTP;
+ break;
+ case kCFURLProtectionSpaceServerFTPS:
+ serverType = ProtectionSpaceServerFTPS;
+ break;
+ case kCFURLProtectionSpaceProxyHTTP:
+ serverType = ProtectionSpaceProxyHTTP;
+ break;
+ case kCFURLProtectionSpaceProxyHTTPS:
+ serverType = ProtectionSpaceProxyHTTPS;
+ break;
+ case kCFURLProtectionSpaceProxyFTP:
+ serverType = ProtectionSpaceProxyFTP;
+ break;
+ case kCFURLProtectionSpaceProxySOCKS:
+ serverType = ProtectionSpaceProxySOCKS;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ ProtectionSpaceAuthenticationScheme scheme = ProtectionSpaceAuthenticationSchemeDefault;
+
+ switch (CFURLProtectionSpaceGetAuthenticationScheme(cfSpace)) {
+ case kCFURLProtectionSpaceAuthenticationSchemeDefault:
+ scheme = ProtectionSpaceAuthenticationSchemeDefault;
+ break;
+ case kCFURLProtectionSpaceAuthenticationSchemeHTTPBasic:
+ scheme = ProtectionSpaceAuthenticationSchemeHTTPBasic;
+ break;
+ case kCFURLProtectionSpaceAuthenticationSchemeHTTPDigest:
+ scheme = ProtectionSpaceAuthenticationSchemeHTTPDigest;
+ break;
+ case kCFURLProtectionSpaceAuthenticationSchemeHTMLForm:
+ scheme = ProtectionSpaceAuthenticationSchemeHTMLForm;
+ break;
+ case kCFURLProtectionSpaceAuthenticationSchemeNTLM:
+ scheme = ProtectionSpaceAuthenticationSchemeNTLM;
+ break;
+ case kCFURLProtectionSpaceAuthenticationSchemeNegotiate:
+ scheme = ProtectionSpaceAuthenticationSchemeNegotiate;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ return ProtectionSpace(CFURLProtectionSpaceGetHost(cfSpace),
+ CFURLProtectionSpaceGetPort(cfSpace),
+ serverType,
+ CFURLProtectionSpaceGetRealm(cfSpace),
+ scheme);
+}
+
+};
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AuthenticationCF_h
+#define AuthenticationCF_h
+
+typedef struct _CFURLAuthChallenge* CFURLAuthChallengeRef;
+typedef struct _CFURLCredential* CFURLCredentialRef;
+typedef struct _CFURLProtectionSpace* CFURLProtectionSpaceRef;
+
+namespace WebCore {
+
+class AuthenticationChallenge;
+class Credential;
+class ProtectionSpace;
+
+CFURLAuthChallengeRef createCF(const AuthenticationChallenge&);
+CFURLCredentialRef createCF(const Credential&);
+CFURLProtectionSpaceRef createCF(const ProtectionSpace&);
+
+Credential core(CFURLCredentialRef);
+ProtectionSpace core(CFURLProtectionSpaceRef);
+
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef AuthenticationChallenge_h
+#define AuthenticationChallenge_h
+
+#include "AuthenticationChallengeBase.h"
+#include "ResourceHandle.h"
+#include <wtf/RefPtr.h>
+
+typedef struct _CFURLAuthChallenge* CFURLAuthChallengeRef;
+
+namespace WebCore {
+
+class ResourceHandle;
+
+class AuthenticationChallenge : public AuthenticationChallengeBase {
+public:
+ AuthenticationChallenge() {}
+ AuthenticationChallenge(const ProtectionSpace& protectionSpace, const Credential& proposedCredential, unsigned previousFailureCount, const ResourceResponse& response, const ResourceError& error);
+ AuthenticationChallenge(CFURLAuthChallengeRef, ResourceHandle* sourceHandle);
+
+ ResourceHandle* sourceHandle() const { return m_sourceHandle.get(); }
+ CFURLAuthChallengeRef cfURLAuthChallengeRef() const { return m_cfChallenge.get(); }
+
+private:
+ friend class AuthenticationChallengeBase;
+ static bool platformCompare(const AuthenticationChallenge& a, const AuthenticationChallenge& b);
+
+ RefPtr<ResourceHandle> m_sourceHandle;
+ RetainPtr<CFURLAuthChallengeRef> m_cfChallenge;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef AuthenticationChallengeBase_h
+#define AuthenticationChallengeBase_h
+
+#include "Credential.h"
+#include "ProtectionSpace.h"
+#include "ResourceResponse.h"
+#include "ResourceError.h"
+
+namespace WebCore {
+
+class AuthenticationChallenge;
+
+class AuthenticationChallengeBase {
+public:
+ AuthenticationChallengeBase();
+ AuthenticationChallengeBase(const ProtectionSpace& protectionSpace, const Credential& proposedCredential, unsigned previousFailureCount, const ResourceResponse& response, const ResourceError& error);
+
+ unsigned previousFailureCount() const;
+ const Credential& proposedCredential() const;
+ const ProtectionSpace& protectionSpace() const;
+ const ResourceResponse& failureResponse() const;
+ const ResourceError& error() const;
+
+ bool isNull() const;
+ void nullify();
+
+ static bool compare(const AuthenticationChallenge& a, const AuthenticationChallenge& b);
+
+protected:
+ // The AuthenticationChallenge subclass may "shadow" this method to compare platform specific fields
+ static bool platformCompare(const AuthenticationChallengeBase&, const AuthenticationChallengeBase&) { return true; }
+
+ bool m_isNull;
+ ProtectionSpace m_protectionSpace;
+ Credential m_proposedCredential;
+ unsigned m_previousFailureCount;
+ ResourceResponse m_failureResponse;
+ ResourceError m_error;
+};
+
+inline bool operator==(const AuthenticationChallenge& a, const AuthenticationChallenge& b) { return AuthenticationChallengeBase::compare(a, b); }
+inline bool operator!=(const AuthenticationChallenge& a, const AuthenticationChallenge& b) { return !(a == b); }
+
+}
+
+#endif
--- /dev/null
+/*
+ * This file is part of the HTML rendering engine for KDE.
+ *
+ * Copyright (C) 2002 Lars Knoll (knoll@kde.org)
+ * (C) 2002 Dirk Mueller (mueller@kde.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef AutoTableLayout_h
+#define AutoTableLayout_h
+
+#include "Length.h"
+#include "TableLayout.h"
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class RenderTable;
+class RenderTableCell;
+
+class AutoTableLayout : public TableLayout {
+public:
+ AutoTableLayout(RenderTable*);
+ ~AutoTableLayout();
+
+ virtual void calcPrefWidths(int& minWidth, int& maxWidth);
+ virtual void layout();
+
+protected:
+ void fullRecalc();
+ void recalcColumn(int effCol);
+
+ void calcPercentages() const;
+ int totalPercent() const
+ {
+ if (m_percentagesDirty)
+ calcPercentages();
+ return m_totalPercent;
+ }
+
+ int calcEffectiveWidth();
+
+ void insertSpanCell(RenderTableCell*);
+
+ struct Layout {
+ Layout()
+ : minWidth(0)
+ , maxWidth(0)
+ , effMinWidth(0)
+ , effMaxWidth(0)
+ , calcWidth(0)
+ , emptyCellsOnly(true) {}
+ Length width;
+ Length effWidth;
+ int minWidth;
+ int maxWidth;
+ int effMinWidth;
+ int effMaxWidth;
+ int calcWidth;
+ bool emptyCellsOnly;
+ };
+
+ Vector<Layout, 4> m_layoutStruct;
+ Vector<RenderTableCell*, 4> m_spanCells;
+ bool m_hasPercent : 1;
+ mutable bool m_percentagesDirty : 1;
+ mutable bool m_effWidthDirty : 1;
+ mutable unsigned short m_totalPercent;
+};
+
+} // namespace WebCore
+
+#endif // AutoTableLayout_h
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AutodrainedPool_h
+#define AutodrainedPool_h
+
+#include <wtf/Noncopyable.h>
+
+#ifdef __OBJC__
+@class NSAutoreleasePool;
+#else
+class NSAutoreleasePool;
+#endif
+
+namespace WebCore {
+
+class AutodrainedPool : Noncopyable {
+public:
+ AutodrainedPool(int iterationLimit = 1);
+ ~AutodrainedPool();
+
+ void cycle();
+
+private:
+#if PLATFORM(MAC)
+ int m_iterationLimit;
+ int m_iterationCount;
+ NSAutoreleasePool* m_pool;
+#endif
+};
+
+#if !PLATFORM(MAC)
+inline AutodrainedPool::AutodrainedPool(int) { }
+inline AutodrainedPool::~AutodrainedPool() { }
+inline void AutodrainedPool::cycle() { }
+#endif
+
+} // namespace WebCore
+
+#endif
+
+
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (C) 2009 Google, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BackForwardList_h
+#define BackForwardList_h
+
+#include <wtf/RefCounted.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/HashSet.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class HistoryItem;
+class Page;
+
+typedef Vector<RefPtr<HistoryItem> > HistoryItemVector;
+typedef HashSet<RefPtr<HistoryItem> > HistoryItemHashSet;
+
+#if PLATFORM(CHROMIUM)
+// In the Chromium port, the back/forward list is managed externally.
+// See BackForwardListChromium.cpp
+class BackForwardListClient {
+public:
+ virtual ~BackForwardListClient() {}
+ virtual void addItem(PassRefPtr<HistoryItem>) = 0;
+ virtual void goToItem(HistoryItem*) = 0;
+ virtual HistoryItem* currentItem() = 0;
+ virtual HistoryItem* itemAtIndex(int) = 0;
+ virtual int backListCount() = 0;
+ virtual int forwardListCount() = 0;
+ virtual void close() = 0;
+};
+#endif
+
+class BackForwardList : public RefCounted<BackForwardList> {
+public:
+ static PassRefPtr<BackForwardList> create(Page* page) { return adoptRef(new BackForwardList(page)); }
+ ~BackForwardList();
+
+#if PLATFORM(CHROMIUM)
+ // Must be called before any other methods.
+ void setClient(BackForwardListClient* client) { m_client = client; }
+#endif
+
+ Page* page() { return m_page; }
+
+ void addItem(PassRefPtr<HistoryItem>);
+ void goBack();
+ void goForward();
+ void goToItem(HistoryItem*);
+
+ HistoryItem* backItem();
+ HistoryItem* currentItem();
+ HistoryItem* forwardItem();
+ HistoryItem* itemAtIndex(int);
+
+ void backListWithLimit(int, HistoryItemVector&);
+ void forwardListWithLimit(int, HistoryItemVector&);
+
+ int capacity();
+ void setCapacity(int);
+ bool enabled();
+ void setEnabled(bool);
+ int backListCount();
+ int forwardListCount();
+ bool containsItem(HistoryItem*);
+
+ void close();
+ bool closed();
+
+ void removeItem(HistoryItem*);
+ HistoryItemVector& entries();
+
+ unsigned current();
+ void setCurrent(unsigned newCurrent);
+ bool clearAllPageCaches();
+
+#if ENABLE(WML)
+ void clearWmlPageHistory();
+#endif
+
+private:
+ BackForwardList(Page*);
+
+ Page* m_page;
+#if PLATFORM(CHROMIUM)
+ BackForwardListClient* m_client;
+#else
+ HistoryItemVector m_entries;
+ HistoryItemHashSet m_entryHash;
+ unsigned m_current;
+#endif
+ unsigned m_capacity;
+ bool m_closed;
+ bool m_enabled;
+};
+
+} //namespace WebCore
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BarInfo_h
+#define BarInfo_h
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+ class Frame;
+
+ class BarInfo : public RefCounted<BarInfo> {
+ public:
+ enum Type { Locationbar, Menubar, Personalbar, Scrollbars, Statusbar, Toolbar };
+
+ static PassRefPtr<BarInfo> create(Frame* frame, Type type) { return adoptRef(new BarInfo(frame, type)); }
+
+ void disconnectFrame();
+
+ bool visible() const;
+
+ private:
+ BarInfo(Frame*, Type);
+ Frame* m_frame;
+ Type m_type;
+ };
+
+} // namespace WebCore
+
+#endif // BarInfo_h
--- /dev/null
+/*
+ * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Base64_h
+#define Base64_h
+
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+void base64Encode(const Vector<char>&, Vector<char>&, bool insertLFs = false);
+
+// this decoder is not general purpose - it returns an error if it encounters a linefeed, as needed for window.atob
+bool base64Decode(const Vector<char>&, Vector<char>&);
+bool base64Decode(const char*, unsigned, Vector<char>&);
+
+}
+
+#endif // Base64_h
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BeforeTextInsertedEvent_h
+#define BeforeTextInsertedEvent_h
+
+#include "Event.h"
+
+namespace WebCore {
+
+class BeforeTextInsertedEvent : public Event {
+public:
+ static PassRefPtr<BeforeTextInsertedEvent> create(const String& text)
+ {
+ return adoptRef(new BeforeTextInsertedEvent(text));
+ }
+
+ virtual bool isBeforeTextInsertedEvent() const { return true; }
+
+ const String& text() const { return m_text; }
+ void setText(const String& s) { m_text = s; }
+
+private:
+ BeforeTextInsertedEvent(const String&);
+
+ String m_text;
+};
+
+} // namespace
+
+#endif
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
+ * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef BeforeUnloadEvent_h
+#define BeforeUnloadEvent_h
+
+#include "Event.h"
+
+namespace WebCore {
+
+ class BeforeUnloadEvent : public Event {
+ public:
+ static PassRefPtr<BeforeUnloadEvent> create()
+ {
+ return adoptRef(new BeforeUnloadEvent);
+ }
+
+ virtual bool storesResultAsString() const;
+ virtual void storeResult(const String&);
+
+ String result() const { return m_result; }
+
+ private:
+ BeforeUnloadEvent();
+
+ String m_result;
+ };
+
+} // namespace WebCore
+
+#endif // BeforeUnloadEvent_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2003, 2004, 2006, 2007 Apple Inc. All right reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef BidiContext_h
+#define BidiContext_h
+
+#include <wtf/Assertions.h>
+#include <wtf/RefPtr.h>
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+// Used to keep track of explicit embeddings.
+class BidiContext {
+public:
+ BidiContext(unsigned char level, WTF::Unicode::Direction direction, bool override = false, BidiContext* parent = 0)
+ : m_level(level)
+ , m_direction(direction)
+ , m_override(override)
+ , m_parent(parent)
+ , m_refCount(0)
+ {
+ ASSERT(direction == WTF::Unicode::LeftToRight || direction == WTF::Unicode::RightToLeft);
+ }
+
+ void ref() const { m_refCount++; }
+ void deref() const
+ {
+ m_refCount--;
+ if (m_refCount <= 0)
+ delete this;
+ }
+
+ BidiContext* parent() const { return m_parent.get(); }
+ unsigned char level() const { return m_level; }
+ WTF::Unicode::Direction dir() const { return static_cast<WTF::Unicode::Direction>(m_direction); }
+ bool override() const { return m_override; }
+
+private:
+ unsigned char m_level;
+ unsigned m_direction : 5; // Direction
+ bool m_override : 1;
+ RefPtr<BidiContext> m_parent;
+ mutable int m_refCount;
+};
+
+bool operator==(const BidiContext&, const BidiContext&);
+
+} // namespace WebCore
+
+#endif // BidiContext_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2003, 2004, 2006, 2007, 2008 Apple Inc. All right reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef BidiResolver_h
+#define BidiResolver_h
+
+#include "BidiContext.h"
+#include <wtf/Noncopyable.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+// The BidiStatus at a given position (typically the end of a line) can
+// be cached and then used to restart bidi resolution at that position.
+struct BidiStatus {
+ BidiStatus()
+ : eor(WTF::Unicode::OtherNeutral)
+ , lastStrong(WTF::Unicode::OtherNeutral)
+ , last(WTF::Unicode::OtherNeutral)
+ {
+ }
+
+ BidiStatus(WTF::Unicode::Direction eorDir, WTF::Unicode::Direction lastStrongDir, WTF::Unicode::Direction lastDir, PassRefPtr<BidiContext> bidiContext)
+ : eor(eorDir)
+ , lastStrong(lastStrongDir)
+ , last(lastDir)
+ , context(bidiContext)
+ {
+ }
+
+ WTF::Unicode::Direction eor;
+ WTF::Unicode::Direction lastStrong;
+ WTF::Unicode::Direction last;
+ RefPtr<BidiContext> context;
+};
+
+inline bool operator==(const BidiStatus& status1, const BidiStatus& status2)
+{
+ return status1.eor == status2.eor && status1.last == status2.last && status1.lastStrong == status2.lastStrong && *(status1.context) == *(status2.context);
+}
+
+inline bool operator!=(const BidiStatus& status1, const BidiStatus& status2)
+{
+ return !(status1 == status2);
+}
+
+struct BidiCharacterRun {
+ BidiCharacterRun(int start, int stop, BidiContext* context, WTF::Unicode::Direction dir)
+ : m_start(start)
+ , m_stop(stop)
+ , m_override(context->override())
+ , m_next(0)
+ {
+ if (dir == WTF::Unicode::OtherNeutral)
+ dir = context->dir();
+
+ m_level = context->level();
+
+ // add level of run (cases I1 & I2)
+ if (m_level % 2) {
+ if (dir == WTF::Unicode::LeftToRight || dir == WTF::Unicode::ArabicNumber || dir == WTF::Unicode::EuropeanNumber)
+ m_level++;
+ } else {
+ if (dir == WTF::Unicode::RightToLeft)
+ m_level++;
+ else if (dir == WTF::Unicode::ArabicNumber || dir == WTF::Unicode::EuropeanNumber)
+ m_level += 2;
+ }
+ }
+
+ void destroy() { delete this; }
+
+ int start() const { return m_start; }
+ int stop() const { return m_stop; }
+ unsigned char level() const { return m_level; }
+ bool reversed(bool visuallyOrdered) { return m_level % 2 && !visuallyOrdered; }
+ bool dirOverride(bool visuallyOrdered) { return m_override || visuallyOrdered; }
+
+ BidiCharacterRun* next() const { return m_next; }
+
+ unsigned char m_level;
+ int m_start;
+ int m_stop;
+ bool m_override;
+ BidiCharacterRun* m_next;
+};
+
+template <class Iterator, class Run> class BidiResolver : public Noncopyable {
+public :
+ BidiResolver()
+ : m_direction(WTF::Unicode::OtherNeutral)
+ , reachedEndOfLine(false)
+ , emptyRun(true)
+ , m_firstRun(0)
+ , m_lastRun(0)
+ , m_logicallyLastRun(0)
+ , m_runCount(0)
+ {
+ }
+
+ const Iterator& position() const { return current; }
+ void setPosition(const Iterator& position) { current = position; }
+
+ void increment() { current.increment(); }
+
+ BidiContext* context() const { return m_status.context.get(); }
+ void setContext(PassRefPtr<BidiContext> c) { m_status.context = c; }
+
+ void setLastDir(WTF::Unicode::Direction lastDir) { m_status.last = lastDir; }
+ void setLastStrongDir(WTF::Unicode::Direction lastStrongDir) { m_status.lastStrong = lastStrongDir; }
+ void setEorDir(WTF::Unicode::Direction eorDir) { m_status.eor = eorDir; }
+
+ WTF::Unicode::Direction dir() const { return m_direction; }
+ void setDir(WTF::Unicode::Direction d) { m_direction = d; }
+
+ const BidiStatus& status() const { return m_status; }
+ void setStatus(const BidiStatus s) { m_status = s; }
+
+ void embed(WTF::Unicode::Direction);
+ void commitExplicitEmbedding();
+
+ void createBidiRunsForLine(const Iterator& end, bool visualOrder = false, bool hardLineBreak = false);
+
+ Run* firstRun() const { return m_firstRun; }
+ Run* lastRun() const { return m_lastRun; }
+ Run* logicallyLastRun() const { return m_logicallyLastRun; }
+ unsigned runCount() const { return m_runCount; }
+
+ void addRun(Run*);
+ void prependRun(Run*);
+
+ void moveRunToEnd(Run*);
+ void moveRunToBeginning(Run*);
+
+ void deleteRuns();
+
+protected:
+ void appendRun();
+ void reverseRuns(unsigned start, unsigned end);
+
+ Iterator current;
+ Iterator sor;
+ Iterator eor;
+ Iterator last;
+ BidiStatus m_status;
+ WTF::Unicode::Direction m_direction;
+ Iterator endOfLine;
+ bool reachedEndOfLine;
+ Iterator lastBeforeET;
+ bool emptyRun;
+
+ Run* m_firstRun;
+ Run* m_lastRun;
+ Run* m_logicallyLastRun;
+ unsigned m_runCount;
+
+private:
+ void raiseExplicitEmbeddingLevel(WTF::Unicode::Direction from, WTF::Unicode::Direction to);
+ void lowerExplicitEmbeddingLevel(WTF::Unicode::Direction from);
+
+ Vector<WTF::Unicode::Direction, 8> m_currentExplicitEmbeddingSequence;
+};
+
+template <class Iterator, class Run>
+inline void BidiResolver<Iterator, Run>::addRun(Run* run)
+{
+ if (!m_firstRun)
+ m_firstRun = run;
+ else
+ m_lastRun->m_next = run;
+ m_lastRun = run;
+ m_runCount++;
+}
+
+template <class Iterator, class Run>
+inline void BidiResolver<Iterator, Run>::prependRun(Run* run)
+{
+ ASSERT(!run->m_next);
+
+ if (!m_lastRun)
+ m_lastRun = run;
+ else
+ run->m_next = m_firstRun;
+ m_firstRun = run;
+ m_runCount++;
+}
+
+template <class Iterator, class Run>
+inline void BidiResolver<Iterator, Run>::moveRunToEnd(Run* run)
+{
+ ASSERT(m_firstRun);
+ ASSERT(m_lastRun);
+ ASSERT(run->m_next);
+
+ Run* current = 0;
+ Run* next = m_firstRun;
+ while (next != run) {
+ current = next;
+ next = current->next();
+ }
+
+ if (!current)
+ m_firstRun = run->next();
+ else
+ current->m_next = run->m_next;
+
+ run->m_next = 0;
+ m_lastRun->m_next = run;
+ m_lastRun = run;
+}
+
+template <class Iterator, class Run>
+inline void BidiResolver<Iterator, Run>::moveRunToBeginning(Run* run)
+{
+ ASSERT(m_firstRun);
+ ASSERT(m_lastRun);
+ ASSERT(run != m_firstRun);
+
+ Run* current = m_firstRun;
+ Run* next = current->next();
+ while (next != run) {
+ current = next;
+ next = current->next();
+ }
+
+ current->m_next = run->m_next;
+ if (run == m_lastRun)
+ m_lastRun = current;
+
+ run->m_next = m_firstRun;
+ m_firstRun = run;
+}
+
+template <class Iterator, class Run>
+void BidiResolver<Iterator, Run>::appendRun()
+{
+ if (!emptyRun && !eor.atEnd()) {
+ unsigned startOffset = sor.offset();
+ unsigned endOffset = eor.offset();
+
+ if (!endOfLine.atEnd() && endOffset >= endOfLine.offset()) {
+ reachedEndOfLine = true;
+ endOffset = endOfLine.offset();
+ }
+
+ if (endOffset >= startOffset)
+ addRun(new Run(startOffset, endOffset + 1, context(), m_direction));
+
+ eor.increment();
+ sor = eor;
+ }
+
+ m_direction = WTF::Unicode::OtherNeutral;
+ m_status.eor = WTF::Unicode::OtherNeutral;
+}
+
+template <class Iterator, class Run>
+void BidiResolver<Iterator, Run>::embed(WTF::Unicode::Direction d)
+{
+ using namespace WTF::Unicode;
+
+ ASSERT(d == PopDirectionalFormat || d == LeftToRightEmbedding || d == LeftToRightOverride || d == RightToLeftEmbedding || d == RightToLeftOverride);
+ m_currentExplicitEmbeddingSequence.append(d);
+}
+
+template <class Iterator, class Run>
+void BidiResolver<Iterator, Run>::lowerExplicitEmbeddingLevel(WTF::Unicode::Direction from)
+{
+ using namespace WTF::Unicode;
+
+ if (!emptyRun && eor != last) {
+ ASSERT(m_status.eor != OtherNeutral || eor.atEnd());
+ // bidi.sor ... bidi.eor ... bidi.last eor; need to append the bidi.sor-bidi.eor run or extend it through bidi.last
+ ASSERT(m_status.last == EuropeanNumberSeparator
+ || m_status.last == EuropeanNumberTerminator
+ || m_status.last == CommonNumberSeparator
+ || m_status.last == BoundaryNeutral
+ || m_status.last == BlockSeparator
+ || m_status.last == SegmentSeparator
+ || m_status.last == WhiteSpaceNeutral
+ || m_status.last == OtherNeutral);
+ if (m_direction == OtherNeutral)
+ m_direction = m_status.lastStrong == LeftToRight ? LeftToRight : RightToLeft;
+ if (from == LeftToRight) {
+ // bidi.sor ... bidi.eor ... bidi.last L
+ if (m_status.eor == EuropeanNumber) {
+ if (m_status.lastStrong != LeftToRight) {
+ m_direction = EuropeanNumber;
+ appendRun();
+ }
+ } else if (m_status.eor == ArabicNumber) {
+ m_direction = ArabicNumber;
+ appendRun();
+ } else if (m_status.lastStrong != LeftToRight) {
+ appendRun();
+ m_direction = LeftToRight;
+ }
+ } else if (m_status.eor == EuropeanNumber || m_status.eor == ArabicNumber || m_status.lastStrong == LeftToRight) {
+ appendRun();
+ m_direction = RightToLeft;
+ }
+ eor = last;
+ }
+ appendRun();
+ emptyRun = true;
+ // sor for the new run is determined by the higher level (rule X10)
+ setLastDir(from);
+ setLastStrongDir(from);
+ eor = Iterator();
+}
+
+template <class Iterator, class Run>
+void BidiResolver<Iterator, Run>::raiseExplicitEmbeddingLevel(WTF::Unicode::Direction from, WTF::Unicode::Direction to)
+{
+ using namespace WTF::Unicode;
+
+ if (!emptyRun && eor != last) {
+ ASSERT(m_status.eor != OtherNeutral || eor.atEnd());
+ // bidi.sor ... bidi.eor ... bidi.last eor; need to append the bidi.sor-bidi.eor run or extend it through bidi.last
+ ASSERT(m_status.last == EuropeanNumberSeparator
+ || m_status.last == EuropeanNumberTerminator
+ || m_status.last == CommonNumberSeparator
+ || m_status.last == BoundaryNeutral
+ || m_status.last == BlockSeparator
+ || m_status.last == SegmentSeparator
+ || m_status.last == WhiteSpaceNeutral
+ || m_status.last == OtherNeutral);
+ if (m_direction == OtherNeutral)
+ m_direction = m_status.lastStrong == LeftToRight ? LeftToRight : RightToLeft;
+ if (to == LeftToRight) {
+ // bidi.sor ... bidi.eor ... bidi.last L
+ if (m_status.eor == EuropeanNumber) {
+ if (m_status.lastStrong != LeftToRight) {
+ m_direction = EuropeanNumber;
+ appendRun();
+ }
+ } else if (m_status.eor == ArabicNumber) {
+ m_direction = ArabicNumber;
+ appendRun();
+ } else if (m_status.lastStrong != LeftToRight && from == LeftToRight) {
+ appendRun();
+ m_direction = LeftToRight;
+ }
+ } else if (m_status.eor == ArabicNumber
+ || m_status.eor == EuropeanNumber && (m_status.lastStrong != LeftToRight || from == RightToLeft)
+ || m_status.eor != EuropeanNumber && m_status.lastStrong == LeftToRight && from == RightToLeft) {
+ appendRun();
+ m_direction = RightToLeft;
+ }
+ eor = last;
+ }
+ appendRun();
+ emptyRun = true;
+ setLastDir(to);
+ setLastStrongDir(to);
+ eor = Iterator();
+}
+
+template <class Iterator, class Run>
+void BidiResolver<Iterator, Run>::commitExplicitEmbedding()
+{
+ using namespace WTF::Unicode;
+
+ unsigned char fromLevel = context()->level();
+ RefPtr<BidiContext> toContext = context();
+
+ for (size_t i = 0; i < m_currentExplicitEmbeddingSequence.size(); ++i) {
+ Direction embedding = m_currentExplicitEmbeddingSequence[i];
+ if (embedding == PopDirectionalFormat) {
+ if (BidiContext* parentContext = toContext->parent())
+ toContext = parentContext;
+ } else {
+ Direction direction = (embedding == RightToLeftEmbedding || embedding == RightToLeftOverride) ? RightToLeft : LeftToRight;
+ bool override = embedding == LeftToRightOverride || embedding == RightToLeftOverride;
+ unsigned char level = toContext->level();
+ if (direction == RightToLeft) {
+ // Go to the least greater odd integer
+ level += 1;
+ level |= 1;
+ } else {
+ // Go to the least greater even integer
+ level += 2;
+ level &= ~1;
+ }
+ if (level < 61)
+ toContext = new BidiContext(level, direction, override, toContext.get());
+ }
+ }
+
+ unsigned char toLevel = toContext->level();
+
+ if (toLevel > fromLevel)
+ raiseExplicitEmbeddingLevel(fromLevel % 2 ? RightToLeft : LeftToRight, toLevel % 2 ? RightToLeft : LeftToRight);
+ else if (toLevel < fromLevel)
+ lowerExplicitEmbeddingLevel(fromLevel % 2 ? RightToLeft : LeftToRight);
+
+ setContext(toContext);
+
+ m_currentExplicitEmbeddingSequence.clear();
+}
+
+template <class Iterator, class Run>
+void BidiResolver<Iterator, Run>::deleteRuns()
+{
+ emptyRun = true;
+ if (!m_firstRun)
+ return;
+
+ Run* curr = m_firstRun;
+ while (curr) {
+ Run* s = curr->next();
+ curr->destroy();
+ curr = s;
+ }
+
+ m_firstRun = 0;
+ m_lastRun = 0;
+ m_runCount = 0;
+}
+
+template <class Iterator, class Run>
+void BidiResolver<Iterator, Run>::reverseRuns(unsigned start, unsigned end)
+{
+ if (start >= end)
+ return;
+
+ ASSERT(end < m_runCount);
+
+ // Get the item before the start of the runs to reverse and put it in
+ // |beforeStart|. |curr| should point to the first run to reverse.
+ Run* curr = m_firstRun;
+ Run* beforeStart = 0;
+ unsigned i = 0;
+ while (i < start) {
+ i++;
+ beforeStart = curr;
+ curr = curr->next();
+ }
+
+ Run* startRun = curr;
+ while (i < end) {
+ i++;
+ curr = curr->next();
+ }
+ Run* endRun = curr;
+ Run* afterEnd = curr->next();
+
+ i = start;
+ curr = startRun;
+ Run* newNext = afterEnd;
+ while (i <= end) {
+ // Do the reversal.
+ Run* next = curr->next();
+ curr->m_next = newNext;
+ newNext = curr;
+ curr = next;
+ i++;
+ }
+
+ // Now hook up beforeStart and afterEnd to the startRun and endRun.
+ if (beforeStart)
+ beforeStart->m_next = endRun;
+ else
+ m_firstRun = endRun;
+
+ startRun->m_next = afterEnd;
+ if (!afterEnd)
+ m_lastRun = startRun;
+}
+
+template <class Iterator, class Run>
+void BidiResolver<Iterator, Run>::createBidiRunsForLine(const Iterator& end, bool visualOrder, bool hardLineBreak)
+{
+ using namespace WTF::Unicode;
+
+ ASSERT(m_direction == OtherNeutral);
+
+ emptyRun = true;
+
+ eor = Iterator();
+
+ last = current;
+ bool pastEnd = false;
+ BidiResolver<Iterator, Run> stateAtEnd;
+
+ while (true) {
+ Direction dirCurrent;
+ if (pastEnd && (hardLineBreak || current.atEnd())) {
+ BidiContext* c = context();
+ while (c->parent())
+ c = c->parent();
+ dirCurrent = c->dir();
+ if (hardLineBreak) {
+ // A deviation from the Unicode Bidi Algorithm in order to match
+ // Mac OS X text and WinIE: a hard line break resets bidi state.
+ stateAtEnd.setContext(c);
+ stateAtEnd.setEorDir(dirCurrent);
+ stateAtEnd.setLastDir(dirCurrent);
+ stateAtEnd.setLastStrongDir(dirCurrent);
+ }
+ } else {
+ dirCurrent = current.direction();
+ if (context()->override()
+ && dirCurrent != RightToLeftEmbedding
+ && dirCurrent != LeftToRightEmbedding
+ && dirCurrent != RightToLeftOverride
+ && dirCurrent != LeftToRightOverride
+ && dirCurrent != PopDirectionalFormat)
+ dirCurrent = context()->dir();
+ else if (dirCurrent == NonSpacingMark)
+ dirCurrent = m_status.last;
+ }
+
+ ASSERT(m_status.eor != OtherNeutral || eor.atEnd());
+ switch (dirCurrent) {
+
+ // embedding and overrides (X1-X9 in the Bidi specs)
+ case RightToLeftEmbedding:
+ case LeftToRightEmbedding:
+ case RightToLeftOverride:
+ case LeftToRightOverride:
+ case PopDirectionalFormat:
+ embed(dirCurrent);
+ commitExplicitEmbedding();
+ break;
+
+ // strong types
+ case LeftToRight:
+ switch(m_status.last) {
+ case RightToLeft:
+ case RightToLeftArabic:
+ case EuropeanNumber:
+ case ArabicNumber:
+ if (m_status.last != EuropeanNumber || m_status.lastStrong != LeftToRight)
+ appendRun();
+ break;
+ case LeftToRight:
+ break;
+ case EuropeanNumberSeparator:
+ case EuropeanNumberTerminator:
+ case CommonNumberSeparator:
+ case BoundaryNeutral:
+ case BlockSeparator:
+ case SegmentSeparator:
+ case WhiteSpaceNeutral:
+ case OtherNeutral:
+ if (m_status.eor == EuropeanNumber) {
+ if (m_status.lastStrong != LeftToRight) {
+ // the numbers need to be on a higher embedding level, so let's close that run
+ m_direction = EuropeanNumber;
+ appendRun();
+ if (context()->dir() != LeftToRight) {
+ // the neutrals take the embedding direction, which is R
+ eor = last;
+ m_direction = RightToLeft;
+ appendRun();
+ }
+ }
+ } else if (m_status.eor == ArabicNumber) {
+ // Arabic numbers are always on a higher embedding level, so let's close that run
+ m_direction = ArabicNumber;
+ appendRun();
+ if (context()->dir() != LeftToRight) {
+ // the neutrals take the embedding direction, which is R
+ eor = last;
+ m_direction = RightToLeft;
+ appendRun();
+ }
+ } else if (m_status.lastStrong != LeftToRight) {
+ //last stuff takes embedding dir
+ if (context()->dir() == RightToLeft) {
+ eor = last;
+ m_direction = RightToLeft;
+ }
+ appendRun();
+ }
+ default:
+ break;
+ }
+ eor = current;
+ m_status.eor = LeftToRight;
+ m_status.lastStrong = LeftToRight;
+ m_direction = LeftToRight;
+ break;
+ case RightToLeftArabic:
+ case RightToLeft:
+ switch (m_status.last) {
+ case LeftToRight:
+ case EuropeanNumber:
+ case ArabicNumber:
+ appendRun();
+ case RightToLeft:
+ case RightToLeftArabic:
+ break;
+ case EuropeanNumberSeparator:
+ case EuropeanNumberTerminator:
+ case CommonNumberSeparator:
+ case BoundaryNeutral:
+ case BlockSeparator:
+ case SegmentSeparator:
+ case WhiteSpaceNeutral:
+ case OtherNeutral:
+ if (m_status.eor == EuropeanNumber) {
+ if (m_status.lastStrong == LeftToRight && context()->dir() == LeftToRight)
+ eor = last;
+ appendRun();
+ } else if (m_status.eor == ArabicNumber)
+ appendRun();
+ else if (m_status.lastStrong == LeftToRight) {
+ if (context()->dir() == LeftToRight)
+ eor = last;
+ appendRun();
+ }
+ default:
+ break;
+ }
+ eor = current;
+ m_status.eor = RightToLeft;
+ m_status.lastStrong = dirCurrent;
+ m_direction = RightToLeft;
+ break;
+
+ // weak types:
+
+ case EuropeanNumber:
+ if (m_status.lastStrong != RightToLeftArabic) {
+ // if last strong was AL change EN to AN
+ switch (m_status.last) {
+ case EuropeanNumber:
+ case LeftToRight:
+ break;
+ case RightToLeft:
+ case RightToLeftArabic:
+ case ArabicNumber:
+ eor = last;
+ appendRun();
+ m_direction = EuropeanNumber;
+ break;
+ case EuropeanNumberSeparator:
+ case CommonNumberSeparator:
+ if (m_status.eor == EuropeanNumber)
+ break;
+ case EuropeanNumberTerminator:
+ case BoundaryNeutral:
+ case BlockSeparator:
+ case SegmentSeparator:
+ case WhiteSpaceNeutral:
+ case OtherNeutral:
+ if (m_status.eor == EuropeanNumber) {
+ if (m_status.lastStrong == RightToLeft) {
+ // ENs on both sides behave like Rs, so the neutrals should be R.
+ // Terminate the EN run.
+ appendRun();
+ // Make an R run.
+ eor = m_status.last == EuropeanNumberTerminator ? lastBeforeET : last;
+ m_direction = RightToLeft;
+ appendRun();
+ // Begin a new EN run.
+ m_direction = EuropeanNumber;
+ }
+ } else if (m_status.eor == ArabicNumber) {
+ // Terminate the AN run.
+ appendRun();
+ if (m_status.lastStrong == RightToLeft || context()->dir() == RightToLeft) {
+ // Make an R run.
+ eor = m_status.last == EuropeanNumberTerminator ? lastBeforeET : last;
+ m_direction = RightToLeft;
+ appendRun();
+ // Begin a new EN run.
+ m_direction = EuropeanNumber;
+ }
+ } else if (m_status.lastStrong == RightToLeft) {
+ // Extend the R run to include the neutrals.
+ eor = m_status.last == EuropeanNumberTerminator ? lastBeforeET : last;
+ m_direction = RightToLeft;
+ appendRun();
+ // Begin a new EN run.
+ m_direction = EuropeanNumber;
+ }
+ default:
+ break;
+ }
+ eor = current;
+ m_status.eor = EuropeanNumber;
+ if (m_direction == OtherNeutral)
+ m_direction = LeftToRight;
+ break;
+ }
+ case ArabicNumber:
+ dirCurrent = ArabicNumber;
+ switch (m_status.last) {
+ case LeftToRight:
+ if (context()->dir() == LeftToRight)
+ appendRun();
+ break;
+ case ArabicNumber:
+ break;
+ case RightToLeft:
+ case RightToLeftArabic:
+ case EuropeanNumber:
+ eor = last;
+ appendRun();
+ break;
+ case CommonNumberSeparator:
+ if (m_status.eor == ArabicNumber)
+ break;
+ case EuropeanNumberSeparator:
+ case EuropeanNumberTerminator:
+ case BoundaryNeutral:
+ case BlockSeparator:
+ case SegmentSeparator:
+ case WhiteSpaceNeutral:
+ case OtherNeutral:
+ if (m_status.eor == ArabicNumber
+ || m_status.eor == EuropeanNumber && (m_status.lastStrong == RightToLeft || context()->dir() == RightToLeft)
+ || m_status.eor != EuropeanNumber && m_status.lastStrong == LeftToRight && context()->dir() == RightToLeft) {
+ // Terminate the run before the neutrals.
+ appendRun();
+ // Begin an R run for the neutrals.
+ m_direction = RightToLeft;
+ } else if (m_direction == OtherNeutral)
+ m_direction = m_status.lastStrong == LeftToRight ? LeftToRight : RightToLeft;
+ eor = last;
+ appendRun();
+ default:
+ break;
+ }
+ eor = current;
+ m_status.eor = ArabicNumber;
+ if (m_direction == OtherNeutral)
+ m_direction = ArabicNumber;
+ break;
+ case EuropeanNumberSeparator:
+ case CommonNumberSeparator:
+ break;
+ case EuropeanNumberTerminator:
+ if (m_status.last == EuropeanNumber) {
+ dirCurrent = EuropeanNumber;
+ eor = current;
+ m_status.eor = dirCurrent;
+ } else if (m_status.last != EuropeanNumberTerminator)
+ lastBeforeET = emptyRun ? eor : last;
+ break;
+
+ // boundary neutrals should be ignored
+ case BoundaryNeutral:
+ if (eor == last)
+ eor = current;
+ break;
+ // neutrals
+ case BlockSeparator:
+ // ### what do we do with newline and paragraph seperators that come to here?
+ break;
+ case SegmentSeparator:
+ // ### implement rule L1
+ break;
+ case WhiteSpaceNeutral:
+ break;
+ case OtherNeutral:
+ break;
+ default:
+ break;
+ }
+
+ if (pastEnd) {
+ if (eor == current) {
+ if (!reachedEndOfLine) {
+ eor = endOfLine;
+ switch (m_status.eor) {
+ case LeftToRight:
+ case RightToLeft:
+ case ArabicNumber:
+ m_direction = m_status.eor;
+ break;
+ case EuropeanNumber:
+ m_direction = m_status.lastStrong == LeftToRight ? LeftToRight : EuropeanNumber;
+ break;
+ default:
+ ASSERT(false);
+ }
+ appendRun();
+ }
+ current = end;
+ m_status = stateAtEnd.m_status;
+ sor = stateAtEnd.sor;
+ eor = stateAtEnd.eor;
+ last = stateAtEnd.last;
+ reachedEndOfLine = stateAtEnd.reachedEndOfLine;
+ lastBeforeET = stateAtEnd.lastBeforeET;
+ emptyRun = stateAtEnd.emptyRun;
+ m_direction = OtherNeutral;
+ break;
+ }
+ }
+
+ // set m_status.last as needed.
+ switch (dirCurrent) {
+ case EuropeanNumberTerminator:
+ if (m_status.last != EuropeanNumber)
+ m_status.last = EuropeanNumberTerminator;
+ break;
+ case EuropeanNumberSeparator:
+ case CommonNumberSeparator:
+ case SegmentSeparator:
+ case WhiteSpaceNeutral:
+ case OtherNeutral:
+ switch(m_status.last) {
+ case LeftToRight:
+ case RightToLeft:
+ case RightToLeftArabic:
+ case EuropeanNumber:
+ case ArabicNumber:
+ m_status.last = dirCurrent;
+ break;
+ default:
+ m_status.last = OtherNeutral;
+ }
+ break;
+ case NonSpacingMark:
+ case BoundaryNeutral:
+ case RightToLeftEmbedding:
+ case LeftToRightEmbedding:
+ case RightToLeftOverride:
+ case LeftToRightOverride:
+ case PopDirectionalFormat:
+ // ignore these
+ break;
+ case EuropeanNumber:
+ // fall through
+ default:
+ m_status.last = dirCurrent;
+ }
+
+ last = current;
+
+ if (emptyRun && !(dirCurrent == RightToLeftEmbedding
+ || dirCurrent == LeftToRightEmbedding
+ || dirCurrent == RightToLeftOverride
+ || dirCurrent == LeftToRightOverride
+ || dirCurrent == PopDirectionalFormat)) {
+ sor = current;
+ emptyRun = false;
+ }
+
+ increment();
+ if (!m_currentExplicitEmbeddingSequence.isEmpty())
+ commitExplicitEmbedding();
+
+ if (emptyRun && (dirCurrent == RightToLeftEmbedding
+ || dirCurrent == LeftToRightEmbedding
+ || dirCurrent == RightToLeftOverride
+ || dirCurrent == LeftToRightOverride
+ || dirCurrent == PopDirectionalFormat)) {
+ // exclude the embedding char itself from the new run so that ATSUI will never see it
+ eor = Iterator();
+ last = current;
+ sor = current;
+ }
+
+ if (!pastEnd && (current == end || current.atEnd())) {
+ if (emptyRun)
+ break;
+ stateAtEnd.m_status = m_status;
+ stateAtEnd.sor = sor;
+ stateAtEnd.eor = eor;
+ stateAtEnd.last = last;
+ stateAtEnd.reachedEndOfLine = reachedEndOfLine;
+ stateAtEnd.lastBeforeET = lastBeforeET;
+ stateAtEnd.emptyRun = emptyRun;
+ endOfLine = last;
+ pastEnd = true;
+ }
+ }
+
+ m_logicallyLastRun = m_lastRun;
+
+ // reorder line according to run structure...
+ // do not reverse for visually ordered web sites
+ if (!visualOrder) {
+
+ // first find highest and lowest levels
+ unsigned char levelLow = 128;
+ unsigned char levelHigh = 0;
+ Run* r = firstRun();
+ while (r) {
+ if (r->m_level > levelHigh)
+ levelHigh = r->m_level;
+ if (r->m_level < levelLow)
+ levelLow = r->m_level;
+ r = r->next();
+ }
+
+ // implements reordering of the line (L2 according to Bidi spec):
+ // L2. From the highest level found in the text to the lowest odd level on each line,
+ // reverse any contiguous sequence of characters that are at that level or higher.
+
+ // reversing is only done up to the lowest odd level
+ if (!(levelLow % 2))
+ levelLow++;
+
+ unsigned count = runCount() - 1;
+
+ while (levelHigh >= levelLow) {
+ unsigned i = 0;
+ Run* currRun = firstRun();
+ while (i < count) {
+ while (i < count && currRun && currRun->m_level < levelHigh) {
+ i++;
+ currRun = currRun->next();
+ }
+ unsigned start = i;
+ while (i <= count && currRun && currRun->m_level >= levelHigh) {
+ i++;
+ currRun = currRun->next();
+ }
+ unsigned end = i - 1;
+ reverseRuns(start, end);
+ }
+ levelHigh--;
+ }
+ }
+ endOfLine = Iterator();
+}
+
+} // namespace WebCore
+
+#endif // BidiResolver_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef BindingURI_h
+#define BindingURI_h
+#if ENABLE(XBL)
+
+#include "StringImpl.h"
+
+namespace WebCore {
+
+// This struct holds information about shadows for the text-shadow and box-shadow properties.
+
+struct BindingURI {
+ BindingURI(StringImpl*);
+ ~BindingURI();
+
+ BindingURI* copy();
+
+ bool operator==(const BindingURI& o) const;
+ bool operator!=(const BindingURI& o) const
+ {
+ return !(*this == o);
+ }
+
+ BindingURI* next() { return m_next; }
+ void setNext(BindingURI* n) { m_next = n; }
+
+ StringImpl* uri() { return m_uri; }
+
+ BindingURI* m_next;
+ StringImpl* m_uri;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(XBL)
+#endif // BindingURI_h
--- /dev/null
+/*
+ * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BitmapImage_h
+#define BitmapImage_h
+
+#include "Image.h"
+#include "Color.h"
+#include "IntSize.h"
+
+#if PLATFORM(MAC)
+#include <wtf/RetainPtr.h>
+#endif
+
+#if PLATFORM(WIN)
+typedef struct HBITMAP__ *HBITMAP;
+#endif
+
+namespace WebCore {
+ struct FrameData;
+}
+
+// This complicated-looking declaration tells the FrameData Vector that it should copy without
+// invoking our constructor or destructor. This allows us to have a vector even for a struct
+// that's not copyable.
+namespace WTF {
+ template<> class VectorTraits<WebCore::FrameData> : public SimpleClassVectorTraits {};
+}
+
+namespace WebCore {
+
+template <typename T> class Timer;
+
+// ================================================
+// FrameData Class
+// ================================================
+
+struct FrameData : Noncopyable {
+ FrameData()
+ : m_frame(0)
+ , m_haveMetadata(false)
+ , m_isComplete(false)
+#if ENABLE(RESPECT_EXIF_ORIENTATION)
+ , m_orientation(0)
+#endif
+ , m_bytes(0)
+ , m_scale(0.0f)
+ , m_haveInfo(false)
+ , m_duration(0)
+ , m_hasAlpha(true)
+ {
+ }
+
+ ~FrameData()
+ {
+ clear(true);
+ }
+
+ // Clear the cached image data on the frame, and (optionally) the metadata.
+ // Returns whether there was cached image data to clear.
+ bool clear(bool clearMetadata);
+
+ NativeImagePtr m_frame;
+ bool m_haveMetadata;
+ bool m_isComplete;
+#if ENABLE(RESPECT_EXIF_ORIENTATION)
+ int m_orientation;
+#endif
+ ssize_t m_bytes;
+ float m_scale;
+ bool m_haveInfo;
+ float m_duration;
+ bool m_hasAlpha;
+};
+
+// =================================================
+// BitmapImage Class
+// =================================================
+
+class BitmapImage : public Image {
+ friend class GeneratedImage;
+ friend class GraphicsContext;
+public:
+ static PassRefPtr<BitmapImage> create(NativeImagePtr nativeImage, ImageObserver* observer = 0)
+ {
+ return adoptRef(new BitmapImage(nativeImage, observer));
+ }
+ static PassRefPtr<BitmapImage> create(ImageObserver* observer = 0)
+ {
+ return adoptRef(new BitmapImage(observer));
+ }
+ ~BitmapImage();
+
+ virtual bool isBitmapImage() const { return true; }
+
+ virtual bool hasSingleSecurityOrigin() const { return true; }
+
+ virtual IntSize size() const;
+ IntSize currentFrameSize() const;
+
+ virtual bool dataChanged(bool allDataReceived);
+ virtual String filenameExtension() const;
+
+ // It may look unusual that there is no start animation call as public API. This is because
+ // we start and stop animating lazily. Animation begins whenever someone draws the image. It will
+ // automatically pause once all observers no longer want to render the image anywhere.
+ virtual void stopAnimation();
+ virtual void resetAnimation();
+
+ virtual unsigned decodedSize() const { return m_decodedSize; }
+
+#if PLATFORM(MAC)
+ // Accessors for native image formats.
+ virtual CFDataRef getTIFFRepresentation();
+#endif
+
+#if PLATFORM(CG)
+ virtual CGImageRef getCGImageRef();
+#endif
+
+#if PLATFORM(WIN)
+ virtual bool getHBITMAP(HBITMAP);
+ virtual bool getHBITMAPOfSize(HBITMAP, LPSIZE);
+#endif
+
+ virtual NativeImagePtr nativeImageForCurrentFrame() { return frameAtIndex(currentFrame()); }
+
+#if ENABLE(RESPECT_EXIF_ORIENTATION)
+ // EXIF orientation specified by EXIF spec
+ static const int ImageEXIFOrientationTopLeft = 1;
+ static const int ImageEXIFOrientationTopRight = 2;
+ static const int ImageEXIFOrientationBottomRight = 3;
+ static const int ImageEXIFOrientationBottomLeft = 4;
+ static const int ImageEXIFOrientationLeftTop = 5;
+ static const int ImageEXIFOrientationRightTop = 6;
+ static const int ImageEXIFOrientationRightBottom = 7;
+ static const int ImageEXIFOrientationLeftBottom = 8;
+#endif
+
+protected:
+ enum RepetitionCountStatus {
+ Unknown, // We haven't checked the source's repetition count.
+ Uncertain, // We have a repetition count, but it might be wrong (some GIFs have a count after the image data, and will report "loop once" until all data has been decoded).
+ Certain, // The repetition count is known to be correct.
+ };
+
+ BitmapImage(NativeImagePtr, ImageObserver* = 0);
+ BitmapImage(ImageObserver* = 0);
+
+#if PLATFORM(WIN)
+ virtual void drawFrameMatchingSourceSize(GraphicsContext*, const FloatRect& dstRect, const IntSize& srcSize, CompositeOperator);
+#endif
+ virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator);
+#if PLATFORM(QT) || PLATFORM(WX)
+ virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const TransformationMatrix& patternTransform,
+ const FloatPoint& phase, CompositeOperator, const FloatRect& destRect);
+#endif
+ size_t currentFrame() const { return m_currentFrame; }
+ size_t frameCount();
+ NativeImagePtr frameAtIndex(size_t index, float scaleHint);
+ NativeImagePtr frameAtIndex(size_t);
+ bool frameIsCompleteAtIndex(size_t);
+ float frameDurationAtIndex(size_t);
+ bool frameHasAlphaAtIndex(size_t);
+ int frameOrientationAtIndex(size_t);
+
+ // Decodes and caches a frame. Never accessed except internally.
+ virtual unsigned animatedImageSize();
+ virtual void disableImageAnimation();
+ bool m_imageAnimationDisabled;
+ double m_progressiveLoadChunkTime;
+ unsigned m_progressiveLoadChunkCount;
+
+ void cacheFrame(size_t index, float scaleHint);
+
+ // Cache frame metadata without decoding image.
+ void cacheFrameInfo(size_t index);
+
+ // Called to invalidate cached data. When |destroyAll| is true, we wipe out
+ // the entire frame buffer cache and tell the image source to destroy
+ // everything; this is used when e.g. we want to free some room in the image
+ // cache. If |destroyAll| is false, we only delete frames up to the current
+ // one; this is used while animating large images to keep memory footprint
+ // low without redecoding the whole image on every frame.
+ virtual void destroyDecodedData(bool destroyAll = true);
+
+ // If the image is large enough, calls destroyDecodedData() and passes
+ // |destroyAll| along.
+ void destroyDecodedDataIfNecessary(bool destroyAll);
+
+ // Generally called by destroyDecodedData(), destroys whole-image metadata
+ // and notifies observers that the memory footprint has (hopefully)
+ // decreased by |framesCleared| times the size (in bytes) of a frame.
+ void destroyMetadataAndNotify(int framesCleared);
+
+ // Whether or not size is available yet.
+ bool isSizeAvailable();
+
+ // Animation.
+ int repetitionCount(bool imageKnownToBeComplete); // |imageKnownToBeComplete| should be set if the caller knows the entire image has been decoded.
+ bool shouldAnimate();
+ virtual void startAnimation(bool catchUpIfNecessary = true);
+ void advanceAnimation(Timer<BitmapImage>*);
+
+ // Function that does the real work of advancing the animation. When
+ // skippingFrames is true, we're in the middle of a loop trying to skip over
+ // a bunch of animation frames, so we should not do things like decode each
+ // one or notify our observers.
+ // Returns whether the animation was advanced.
+ bool internalAdvanceAnimation(bool skippingFrames);
+
+ // Handle platform-specific data
+ void initPlatformData();
+ void invalidatePlatformData();
+
+ // Checks to see if the image is a 1x1 solid color. We optimize these images and just do a fill rect instead.
+ void checkForSolidColor();
+
+ virtual bool mayFillWithSolidColor() const { return m_isSolidColor && m_currentFrame == 0; }
+ virtual Color solidColor() const { return m_solidColor; }
+
+ ImageSource m_source;
+ mutable IntSize m_size; // The size to use for the overall image (will just be the size of the first image).
+
+ size_t m_currentFrame; // The index of the current frame of animation.
+ Vector<FrameData> m_frames; // An array of the cached frames of the animation. We have to ref frames to pin them in the cache.
+
+ Timer<BitmapImage>* m_frameTimer;
+ int m_repetitionCount; // How many total animation loops we should do. This will be cAnimationNone if this image type is incapable of animation.
+ RepetitionCountStatus m_repetitionCountStatus;
+ int m_repetitionsComplete; // How many repetitions we've finished.
+ double m_desiredFrameStartTime; // The system time at which we hope to see the next call to startAnimation().
+
+#if PLATFORM(MAC)
+ mutable RetainPtr<CFDataRef> m_tiffRep; // Cached TIFF rep for frame 0. Only built lazily if someone queries for one.
+#endif
+
+ Color m_solidColor; // If we're a 1x1 solid color, this is the color to use to fill.
+ bool m_isSolidColor; // Whether or not we are a 1x1 solid image.
+
+ bool m_animationFinished; // Whether or not we've completed the entire animation.
+
+ bool m_allDataReceived; // Whether or not we've received all our data.
+
+ mutable bool m_haveSize; // Whether or not our |m_size| member variable has the final overall image size yet.
+ bool m_sizeAvailable; // Whether or not we can obtain the size of the first image frame yet from ImageIO.
+ mutable bool m_hasUniformFrameSize;
+
+ unsigned m_decodedSize; // The current size of all decoded frames.
+
+ mutable bool m_haveFrameCount;
+ size_t m_frameCount;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef BorderData_h
+#define BorderData_h
+
+#include "BorderValue.h"
+#include "IntSize.h"
+#include "NinePieceImage.h"
+
+namespace WebCore {
+
+class BorderData {
+public:
+ BorderValue left;
+ BorderValue right;
+ BorderValue top;
+ BorderValue bottom;
+
+ NinePieceImage image;
+
+ IntSize topLeft;
+ IntSize topRight;
+ IntSize bottomLeft;
+ IntSize bottomRight;
+
+ bool hasBorder() const
+ {
+ bool haveImage = image.hasImage();
+ return left.nonZero(!haveImage) || right.nonZero(!haveImage) || top.nonZero(!haveImage) || bottom.nonZero(!haveImage);
+ }
+
+ bool hasBorderRadius() const
+ {
+ if (topLeft.width() > 0)
+ return true;
+ if (topRight.width() > 0)
+ return true;
+ if (bottomLeft.width() > 0)
+ return true;
+ if (bottomRight.width() > 0)
+ return true;
+ return false;
+ }
+
+ unsigned short borderLeftWidth() const
+ {
+ if (!image.hasImage() && (left.style() == BNONE || left.style() == BHIDDEN))
+ return 0;
+ return left.width;
+ }
+
+ unsigned short borderRightWidth() const
+ {
+ if (!image.hasImage() && (right.style() == BNONE || right.style() == BHIDDEN))
+ return 0;
+ return right.width;
+ }
+
+ unsigned short borderTopWidth() const
+ {
+ if (!image.hasImage() && (top.style() == BNONE || top.style() == BHIDDEN))
+ return 0;
+ return top.width;
+ }
+
+ unsigned short borderBottomWidth() const
+ {
+ if (!image.hasImage() && (bottom.style() == BNONE || bottom.style() == BHIDDEN))
+ return 0;
+ return bottom.width;
+ }
+
+ bool operator==(const BorderData& o) const
+ {
+ return left == o.left && right == o.right && top == o.top && bottom == o.bottom && image == o.image &&
+ topLeft == o.topLeft && topRight == o.topRight && bottomLeft == o.bottomLeft && bottomRight == o.bottomRight;
+ }
+
+ bool operator!=(const BorderData& o) const
+ {
+ return !(*this == o);
+ }
+};
+
+} // namespace WebCore
+
+#endif // BorderData_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef BorderValue_h
+#define BorderValue_h
+
+#include "Color.h"
+#include "RenderStyleConstants.h"
+
+namespace WebCore {
+
+class BorderValue {
+public:
+ BorderValue()
+ : width(3)
+ , m_style(BNONE)
+ {
+ }
+
+ Color color;
+ unsigned width : 12;
+ unsigned m_style : 4; // EBorderStyle
+
+ EBorderStyle style() const { return static_cast<EBorderStyle>(m_style); }
+
+ bool nonZero(bool checkStyle = true) const
+ {
+ return width != 0 && (!checkStyle || m_style != BNONE);
+ }
+
+ bool isTransparent() const
+ {
+ return color.isValid() && color.alpha() == 0;
+ }
+
+ bool isVisible(bool checkStyle = true) const
+ {
+ return nonZero(checkStyle) && !isTransparent() && (!checkStyle || m_style != BHIDDEN);
+ }
+
+ bool operator==(const BorderValue& o) const
+ {
+ return width == o.width && m_style == o.m_style && color == o.color;
+ }
+
+ bool operator!=(const BorderValue& o) const
+ {
+ return !(*this == o);
+ }
+};
+
+} // namespace WebCore
+
+#endif // BorderValue_h
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BreakBlockquoteCommand_h
+#define BreakBlockquoteCommand_h
+
+#include "CompositeEditCommand.h"
+
+namespace WebCore {
+
+class BreakBlockquoteCommand : public CompositeEditCommand {
+public:
+ static PassRefPtr<BreakBlockquoteCommand> create(Document* document)
+ {
+ return adoptRef(new BreakBlockquoteCommand(document));
+ }
+
+private:
+ BreakBlockquoteCommand(Document*);
+ virtual void doApply();
+};
+
+} // namespace WebCore
+
+#endif
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef CDATASection_h
+#define CDATASection_h
+
+#include "Text.h"
+
+namespace WebCore {
+
+class CDATASection : public Text {
+public:
+ CDATASection(Document*, const String&);
+ virtual ~CDATASection();
+
+ virtual String nodeName() const;
+ virtual NodeType nodeType() const;
+ virtual PassRefPtr<Node> cloneNode(bool deep);
+ virtual bool childTypeAllowed(NodeType);
+
+protected:
+ virtual PassRefPtr<Text> createNew(PassRefPtr<StringImpl>);
+};
+
+} // namespace WebCore
+
+#endif // CDATASection_h
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSBorderImageValue_h
+#define CSSBorderImageValue_h
+
+#include "CSSValue.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class Rect;
+
+class CSSBorderImageValue : public CSSValue {
+public:
+ static PassRefPtr<CSSBorderImageValue> create(PassRefPtr<CSSValue> image, PassRefPtr<Rect> sliceRect, int horizontalRule, int verticalRule)
+ {
+ return adoptRef(new CSSBorderImageValue(image, sliceRect, horizontalRule, verticalRule));
+ }
+
+ virtual String cssText() const;
+
+ CSSValue* imageValue() const { return m_image.get(); }
+
+ virtual void addSubresourceStyleURLs(ListHashSet<KURL>&, const CSSStyleSheet*);
+
+ // The border image.
+ RefPtr<CSSValue> m_image;
+
+ // These four values are used to make "cuts" in the image. They can be numbers
+ // or percentages.
+ RefPtr<Rect> m_imageSliceRect;
+
+ // Values for how to handle the scaling/stretching/tiling of the image slices.
+ int m_horizontalSizeRule; // Rule for how to adjust the widths of the top/middle/bottom
+ int m_verticalSizeRule; // Rule for how to adjust the heights of the left/middle/right
+
+private:
+ CSSBorderImageValue(PassRefPtr<CSSValue> image, PassRefPtr<Rect> sliceRect, int horizontalRule, int verticalRule);
+};
+
+} // namespace WebCore
+
+#endif // CSSBorderImageValue_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CSSCanvasValue_h
+#define CSSCanvasValue_h
+
+#include "CSSImageGeneratorValue.h"
+#include "HTMLCanvasElement.h"
+
+namespace WebCore {
+
+class Document;
+
+class CSSCanvasValue : public CSSImageGeneratorValue, private CanvasObserver {
+public:
+ static PassRefPtr<CSSCanvasValue> create() { return adoptRef(new CSSCanvasValue); }
+ virtual ~CSSCanvasValue();
+
+ virtual String cssText() const;
+
+ virtual Image* image(RenderObject*, const IntSize&);
+ virtual bool isFixedSize() const { return true; }
+ virtual IntSize fixedSize(const RenderObject*);
+
+ void setName(const String& name) { m_name = name; }
+
+private:
+ CSSCanvasValue()
+ : m_element(0)
+ {
+ }
+
+ virtual void canvasChanged(HTMLCanvasElement* element, const FloatRect& changedRect);
+ virtual void canvasResized(HTMLCanvasElement* element);
+
+ HTMLCanvasElement* element(Document*);
+
+ // The name of the canvas.
+ String m_name;
+ // The document supplies the element and owns it.
+ HTMLCanvasElement* m_element;
+};
+
+} // namespace WebCore
+
+#endif // CSSCanvasValue_h
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * (C) 2002-2003 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2002, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSCharsetRule_h
+#define CSSCharsetRule_h
+
+#include "CSSRule.h"
+#include "PlatformString.h"
+
+namespace WebCore {
+
+class CSSCharsetRule : public CSSRule {
+public:
+ static PassRefPtr<CSSCharsetRule> create(CSSStyleSheet* parent, const String& encoding)
+ {
+ return adoptRef(new CSSCharsetRule(parent, encoding));
+ }
+
+ virtual ~CSSCharsetRule();
+
+ const String& encoding() const { return m_encoding; }
+ void setEncoding(const String& encoding, ExceptionCode&) { m_encoding = encoding; }
+
+ virtual String cssText() const;
+
+private:
+ CSSCharsetRule(CSSStyleSheet* parent, const String& encoding);
+
+ virtual bool isCharsetRule() { return true; }
+
+ // from CSSRule
+ virtual unsigned short type() const { return CHARSET_RULE; }
+
+ String m_encoding;
+};
+
+} // namespace WebCore
+
+#endif // CSSCharsetRule_h
--- /dev/null
+/*
+ * Copyright (C) 2004 Zack Rusin <zack@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef CSSComputedStyleDeclaration_h
+#define CSSComputedStyleDeclaration_h
+
+#include "CSSStyleDeclaration.h"
+#include "Node.h"
+
+namespace WebCore {
+
+class CSSMutableStyleDeclaration;
+
+enum EUpdateLayout { DoNotUpdateLayout = false, UpdateLayout = true };
+
+class CSSComputedStyleDeclaration : public CSSStyleDeclaration {
+public:
+ friend PassRefPtr<CSSComputedStyleDeclaration> computedStyle(PassRefPtr<Node>);
+ virtual ~CSSComputedStyleDeclaration();
+
+ virtual String cssText() const;
+
+ virtual unsigned length() const;
+ virtual String item(unsigned index) const;
+
+ virtual PassRefPtr<CSSValue> getPropertyCSSValue(int propertyID) const;
+ virtual String getPropertyValue(int propertyID) const;
+ virtual bool getPropertyPriority(int propertyID) const;
+ virtual int getPropertyShorthand(int /*propertyID*/) const { return -1; }
+ virtual bool isPropertyImplicit(int /*propertyID*/) const { return false; }
+
+ virtual PassRefPtr<CSSMutableStyleDeclaration> copy() const;
+ virtual PassRefPtr<CSSMutableStyleDeclaration> makeMutable();
+
+ PassRefPtr<CSSValue> getPropertyCSSValue(int propertyID, EUpdateLayout) const;
+#if ENABLE(SVG)
+ PassRefPtr<CSSValue> getSVGPropertyCSSValue(int propertyID, EUpdateLayout) const;
+#endif
+
+ PassRefPtr<CSSMutableStyleDeclaration> copyInheritableProperties() const;
+
+ static void removeComputedInheritablePropertiesFrom(CSSMutableStyleDeclaration*);
+
+private:
+ CSSComputedStyleDeclaration(PassRefPtr<Node>);
+
+ virtual void setCssText(const String&, ExceptionCode&);
+
+ virtual String removeProperty(int propertyID, ExceptionCode&);
+ virtual void setProperty(int propertyId, const String& value, bool important, ExceptionCode&);
+
+ RefPtr<Node> m_node;
+};
+
+inline PassRefPtr<CSSComputedStyleDeclaration> computedStyle(PassRefPtr<Node> node)
+{
+ return adoptRef(new CSSComputedStyleDeclaration(node));
+}
+
+} // namespace WebCore
+
+#endif // CSSComputedStyleDeclaration_h
--- /dev/null
+/*
+ * Copyright (C) 2006 Rob Buis <buis@kde.org>
+ * Copyright (C) 2008 Apple Inc. All right reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSCursorImageValue_h
+#define CSSCursorImageValue_h
+
+#include "CSSImageValue.h"
+#include "IntPoint.h"
+#include <wtf/HashSet.h>
+
+namespace WebCore {
+
+class Element;
+class SVGElement;
+
+class CSSCursorImageValue : public CSSImageValue {
+public:
+ static PassRefPtr<CSSCursorImageValue> create(const String& url, const IntPoint& hotspot)
+ {
+ return adoptRef(new CSSCursorImageValue(url, hotspot));
+ }
+
+ virtual ~CSSCursorImageValue();
+
+ IntPoint hotspot() const { return m_hotspot; }
+
+ bool updateIfSVGCursorIsUsed(Element*);
+ virtual StyleCachedImage* cachedImage(DocLoader*);
+
+#if ENABLE(SVG)
+ void removeReferencedElement(SVGElement*);
+#endif
+
+private:
+ CSSCursorImageValue(const String& url, const IntPoint& hotspot);
+
+ IntPoint m_hotspot;
+
+#if ENABLE(SVG)
+ HashSet<SVGElement*> m_referencedElements;
+#endif
+};
+
+} // namespace WebCore
+
+#endif // CSSCursorImageValue_h
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CSSFontFace_h
+#define CSSFontFace_h
+
+#include "FontTraitsMask.h"
+#include <wtf/HashSet.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+class CSSFontFaceSource;
+class CSSSegmentedFontFace;
+class FontDescription;
+class SimpleFontData;
+
+class CSSFontFace : public RefCounted<CSSFontFace> {
+public:
+ static PassRefPtr<CSSFontFace> create(FontTraitsMask traitsMask) { return adoptRef(new CSSFontFace(traitsMask)); }
+ ~CSSFontFace();
+
+ FontTraitsMask traitsMask() const { return m_traitsMask; }
+
+ struct UnicodeRange;
+
+ void addRange(UChar32 from, UChar32 to) { m_ranges.append(UnicodeRange(from, to)); }
+ const Vector<UnicodeRange>& ranges() const { return m_ranges; }
+
+ void addedToSegmentedFontFace(CSSSegmentedFontFace*);
+ void removedFromSegmentedFontFace(CSSSegmentedFontFace*);
+
+ bool isLoaded() const;
+ bool isValid() const;
+
+ void addSource(CSSFontFaceSource*);
+
+ void fontLoaded(CSSFontFaceSource*);
+
+ SimpleFontData* getFontData(const FontDescription&, bool syntheticBold, bool syntheticItalic);
+
+ struct UnicodeRange {
+ UnicodeRange(UChar32 from, UChar32 to)
+ : m_from(from)
+ , m_to(to)
+ {
+ }
+
+ UChar32 from() const { return m_from; }
+ UChar32 to() const { return m_to; }
+
+ private:
+ UChar32 m_from;
+ UChar32 m_to;
+ };
+
+private:
+ CSSFontFace(FontTraitsMask traitsMask)
+ : m_traitsMask(traitsMask)
+ {
+ }
+
+ FontTraitsMask m_traitsMask;
+ Vector<UnicodeRange> m_ranges;
+ HashSet<CSSSegmentedFontFace*> m_segmentedFontFaces;
+ Vector<CSSFontFaceSource*> m_sources;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * (C) 2002-2003 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2002, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSFontFaceRule_h
+#define CSSFontFaceRule_h
+
+#include "CSSRule.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class CSSMutableStyleDeclaration;
+
+class CSSFontFaceRule : public CSSRule {
+public:
+ static PassRefPtr<CSSFontFaceRule> create()
+ {
+ return adoptRef(new CSSFontFaceRule(0));
+ }
+ static PassRefPtr<CSSFontFaceRule> create(CSSStyleSheet* parent)
+ {
+ return adoptRef(new CSSFontFaceRule(parent));
+ }
+
+ virtual ~CSSFontFaceRule();
+
+ CSSMutableStyleDeclaration* style() const { return m_style.get(); }
+
+ virtual String cssText() const;
+
+ void setDeclaration(PassRefPtr<CSSMutableStyleDeclaration>);
+
+ virtual void addSubresourceStyleURLs(ListHashSet<KURL>& urls);
+
+private:
+ CSSFontFaceRule(CSSStyleSheet* parent);
+
+ virtual bool isFontFaceRule() { return true; }
+
+ // Inherited from CSSRule
+ virtual unsigned short type() const { return FONT_FACE_RULE; }
+
+ RefPtr<CSSMutableStyleDeclaration> m_style;
+};
+
+} // namespace WebCore
+
+#endif // CSSFontFaceRule_h
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CSSFontFaceSource_h
+#define CSSFontFaceSource_h
+
+#include "AtomicString.h"
+#include "CachedResourceClient.h"
+#include "CachedResourceHandle.h"
+#include <wtf/HashMap.h>
+
+#if ENABLE(SVG_FONTS)
+#include "SVGFontFaceElement.h"
+#endif
+
+namespace WebCore {
+
+class CachedFont;
+class CSSFontFace;
+class CSSFontSelector;
+class FontDescription;
+class SimpleFontData;
+
+class CSSFontFaceSource : public CachedResourceClient {
+public:
+ CSSFontFaceSource(const String&, CachedFont* = 0);
+ virtual ~CSSFontFaceSource();
+
+ bool isLoaded() const;
+ bool isValid() const;
+
+ const AtomicString& string() const { return m_string; }
+
+ void setFontFace(CSSFontFace* face) { m_face = face; }
+
+ virtual void fontLoaded(CachedFont*);
+
+ SimpleFontData* getFontData(const FontDescription&, bool syntheticBold, bool syntheticItalic, CSSFontSelector*);
+
+ void pruneTable();
+
+#if ENABLE(SVG_FONTS)
+ SVGFontFaceElement* svgFontFaceElement() const { return m_svgFontFaceElement; }
+ void setSVGFontFaceElement(SVGFontFaceElement* element) { m_svgFontFaceElement = element; }
+#endif
+
+private:
+ AtomicString m_string; // URI for remote, built-in font name for local.
+ CachedResourceHandle<CachedFont> m_font; // For remote fonts, a pointer to our cached resource.
+ CSSFontFace* m_face; // Our owning font face.
+ HashMap<unsigned, SimpleFontData*> m_fontDataTable; // The hash key is composed of size synthetic styles.
+
+#if ENABLE(SVG_FONTS)
+ SVGFontFaceElement* m_svgFontFaceElement;
+ RefPtr<SVGFontElement> m_externalSVGFontElement;
+#endif
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CSSFontFaceSrcValue_h
+#define CSSFontFaceSrcValue_h
+
+#include "CSSValue.h"
+#include "PlatformString.h"
+#include <wtf/PassRefPtr.h>
+
+#if ENABLE(SVG_FONTS)
+#include "SVGFontFaceElement.h"
+#endif
+
+namespace WebCore {
+
+class CSSFontFaceSrcValue : public CSSValue {
+public:
+ static PassRefPtr<CSSFontFaceSrcValue> create(const String& resource)
+ {
+ return adoptRef(new CSSFontFaceSrcValue(resource, false));
+ }
+ static PassRefPtr<CSSFontFaceSrcValue> createLocal(const String& resource)
+ {
+ return adoptRef(new CSSFontFaceSrcValue(resource, true));
+ }
+
+ virtual ~CSSFontFaceSrcValue() { }
+
+ const String& resource() const { return m_resource; }
+ const String& format() const { return m_format; }
+ bool isLocal() const { return m_isLocal; }
+
+ void setFormat(const String& format) { m_format = format; }
+
+ bool isSupportedFormat() const;
+
+#if ENABLE(SVG_FONTS)
+ bool isSVGFontFaceSrc() const;
+
+ SVGFontFaceElement* svgFontFaceElement() const { return m_svgFontFaceElement; }
+ void setSVGFontFaceElement(SVGFontFaceElement* element) { m_svgFontFaceElement = element; }
+#endif
+
+ virtual String cssText() const;
+
+ virtual void addSubresourceStyleURLs(ListHashSet<KURL>&, const CSSStyleSheet*);
+
+private:
+ CSSFontFaceSrcValue(const String& resource, bool local)
+ : m_resource(resource)
+ , m_isLocal(local)
+#if ENABLE(SVG_FONTS)
+ , m_svgFontFaceElement(0)
+#endif
+ {
+ }
+
+ String m_resource;
+ String m_format;
+ bool m_isLocal;
+
+#if ENABLE(SVG_FONTS)
+ SVGFontFaceElement* m_svgFontFaceElement;
+#endif
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CSSFontSelector_h
+#define CSSFontSelector_h
+
+#include "FontSelector.h"
+#include "StringHash.h"
+#include <wtf/HashMap.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class AtomicString;
+class CSSFontFace;
+class CSSFontFaceRule;
+class CSSSegmentedFontFace;
+class Document;
+class DocLoader;
+class FontDescription;
+class String;
+
+class CSSFontSelector : public FontSelector {
+public:
+ static PassRefPtr<CSSFontSelector> create(Document* document)
+ {
+ return adoptRef(new CSSFontSelector(document));
+ }
+ virtual ~CSSFontSelector();
+
+ virtual FontData* getFontData(const FontDescription& fontDescription, const AtomicString& familyName);
+
+ void clearDocument() { m_document = 0; }
+
+ void addFontFaceRule(const CSSFontFaceRule*);
+
+ void fontLoaded();
+ virtual void fontCacheInvalidated();
+
+ bool isEmpty() const;
+
+ DocLoader* docLoader() const;
+
+private:
+ CSSFontSelector(Document*);
+
+ Document* m_document;
+ HashMap<String, Vector<RefPtr<CSSFontFace> >*, CaseFoldingHash> m_fontFaces;
+ HashMap<String, Vector<RefPtr<CSSFontFace> >*, CaseFoldingHash> m_locallyInstalledFontFaces;
+ HashMap<String, HashMap<unsigned, RefPtr<CSSSegmentedFontFace> >*, CaseFoldingHash> m_fonts;
+};
+
+} // namespace WebCore
+
+#endif // CSSFontSelector_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CSSFunctionValue_h
+#define CSSFunctionValue_h
+
+#include "CSSValue.h"
+
+namespace WebCore {
+
+class CSSValueList;
+struct CSSParserFunction;
+
+class CSSFunctionValue : public CSSValue {
+public:
+ static PassRefPtr<CSSFunctionValue> create(CSSParserFunction* function)
+ {
+ return adoptRef(new CSSFunctionValue(function));
+ }
+
+ ~CSSFunctionValue();
+
+ virtual String cssText() const;
+
+ virtual CSSParserValue parserValue() const;
+
+private:
+ CSSFunctionValue(CSSParserFunction*);
+
+ String m_name;
+ RefPtr<CSSValueList> m_args;
+};
+
+}
+#endif
+
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CSSGradientValue_h
+#define CSSGradientValue_h
+
+#include "CSSImageGeneratorValue.h"
+#include "CSSPrimitiveValue.h"
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class FloatPoint;
+class Gradient;
+
+enum CSSGradientType { CSSLinearGradient, CSSRadialGradient };
+
+struct CSSGradientColorStop {
+ CSSGradientColorStop()
+ : m_stop(0)
+ {
+ }
+
+ float m_stop;
+ RefPtr<CSSPrimitiveValue> m_color;
+};
+
+class CSSGradientValue : public CSSImageGeneratorValue {
+public:
+ static PassRefPtr<CSSGradientValue> create()
+ {
+ return adoptRef(new CSSGradientValue);
+ }
+
+ virtual String cssText() const;
+
+ virtual Image* image(RenderObject*, const IntSize&);
+
+ CSSGradientType type() const { return m_type; }
+ void setType(CSSGradientType type) { m_type = type; }
+
+ void setFirstX(PassRefPtr<CSSPrimitiveValue> val) { m_firstX = val; }
+ void setFirstY(PassRefPtr<CSSPrimitiveValue> val) { m_firstY = val; }
+ void setSecondX(PassRefPtr<CSSPrimitiveValue> val) { m_secondX = val; }
+ void setSecondY(PassRefPtr<CSSPrimitiveValue> val) { m_secondY = val; }
+
+ void setFirstRadius(PassRefPtr<CSSPrimitiveValue> val) { m_firstRadius = val; }
+ void setSecondRadius(PassRefPtr<CSSPrimitiveValue> val) { m_secondRadius = val; }
+
+ void addStop(const CSSGradientColorStop& stop) { m_stops.append(stop); }
+
+ void sortStopsIfNeeded();
+
+private:
+ CSSGradientValue()
+ : m_type(CSSLinearGradient)
+ , m_stopsSorted(false)
+ {
+ }
+
+ // Create the gradient for a given size.
+ PassRefPtr<Gradient> createGradient(RenderObject*, const IntSize&);
+
+ // Resolve points/radii to front end values.
+ FloatPoint resolvePoint(CSSPrimitiveValue*, CSSPrimitiveValue*, const IntSize&, float zoomFactor);
+ float resolveRadius(CSSPrimitiveValue*, float zoomFactor);
+
+ // Type
+ CSSGradientType m_type;
+
+ // Points
+ RefPtr<CSSPrimitiveValue> m_firstX;
+ RefPtr<CSSPrimitiveValue> m_firstY;
+
+ RefPtr<CSSPrimitiveValue> m_secondX;
+ RefPtr<CSSPrimitiveValue> m_secondY;
+
+ // Radii (for radial gradients only)
+ RefPtr<CSSPrimitiveValue> m_firstRadius;
+ RefPtr<CSSPrimitiveValue> m_secondRadius;
+
+ // Stops
+ Vector<CSSGradientColorStop> m_stops;
+ bool m_stopsSorted;
+};
+
+} // namespace WebCore
+
+#endif // CSSGradientValue_h
--- /dev/null
+/*
+ * This file is part of the CSS implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef CSSHelper_h
+#define CSSHelper_h
+
+namespace WebCore {
+
+ class String;
+
+ /*
+ * mostly just removes the url("...") brace
+ */
+ String parseURL(const String& url);
+
+ // We always assume 96 CSS pixels in a CSS inch. This is the cold hard truth of the Web.
+ // At high DPI, we may scale a CSS pixel, but the ratio of the CSS pixel to the so-called
+ // "absolute" CSS length units like inch and pt is always fixed and never changes.
+ const float cssPixelsPerInch = 96.0f;
+
+} // namespace WebCore
+
+#endif // CSSHelper_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CSSImageGeneratorValue_h
+#define CSSImageGeneratorValue_h
+
+#include "CSSValue.h"
+#include "IntSizeHash.h"
+#include <wtf/HashMap.h>
+#include <wtf/HashCountedSet.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class Image;
+class StyleGeneratedImage;
+class RenderObject;
+
+class CSSImageGeneratorValue : public CSSValue {
+public:
+ virtual ~CSSImageGeneratorValue();
+
+ void addClient(RenderObject*, const IntSize&);
+ void removeClient(RenderObject*);
+ virtual Image* image(RenderObject*, const IntSize&) = 0;
+
+ StyleGeneratedImage* generatedImage();
+
+ virtual bool isFixedSize() const { return false; }
+ virtual IntSize fixedSize(const RenderObject*) { return IntSize(); }
+
+protected:
+ CSSImageGeneratorValue();
+
+ Image* getImage(RenderObject*, const IntSize&);
+ void putImage(const IntSize&, PassRefPtr<Image>);
+
+ HashCountedSet<IntSize> m_sizes; // A count of how many times a given image size is in use.
+ HashMap<RenderObject*, IntSize> m_clients; // A map from RenderObjects to image sizes.
+ HashMap<IntSize, RefPtr<Image> > m_images; // A cache of Image objects by image size.
+
+ RefPtr<StyleGeneratedImage> m_image;
+ bool m_accessedImage;
+
+private:
+ virtual bool isImageGeneratorValue() const { return true; }
+};
+
+} // namespace WebCore
+
+#endif // CSSImageGeneratorValue_h
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSImageValue_h
+#define CSSImageValue_h
+
+#include "CSSPrimitiveValue.h"
+#include "CachedResourceClient.h"
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class DocLoader;
+class StyleCachedImage;
+
+class CSSImageValue : public CSSPrimitiveValue, private CachedResourceClient {
+public:
+ static PassRefPtr<CSSImageValue> create() { return adoptRef(new CSSImageValue); }
+ static PassRefPtr<CSSImageValue> create(const String& url) { return adoptRef(new CSSImageValue(url)); }
+ virtual ~CSSImageValue();
+
+ virtual StyleCachedImage* cachedImage(DocLoader*);
+
+ virtual bool isImageValue() const { return true; }
+
+protected:
+ CSSImageValue(const String& url);
+
+ StyleCachedImage* cachedImage(DocLoader*, const String& url);
+ String cachedImageURL();
+ void clearCachedImage();
+
+private:
+ CSSImageValue();
+
+ RefPtr<StyleCachedImage> m_image;
+ bool m_accessedImage;
+};
+
+} // namespace WebCore
+
+#endif // CSSImageValue_h
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * (C) 2002-2003 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2002, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSImportRule_h
+#define CSSImportRule_h
+
+#include "CSSRule.h"
+#include "CachedResourceClient.h"
+#include "CachedResourceHandle.h"
+#include "MediaList.h"
+#include "PlatformString.h"
+
+namespace WebCore {
+
+class CachedCSSStyleSheet;
+class MediaList;
+
+class CSSImportRule : public CSSRule, private CachedResourceClient {
+public:
+ static PassRefPtr<CSSImportRule> create(CSSStyleSheet* parent, const String& href, PassRefPtr<MediaList> media)
+ {
+ return adoptRef(new CSSImportRule(parent, href, media));
+ }
+
+ virtual ~CSSImportRule();
+
+ String href() const { return m_strHref; }
+ MediaList* media() const { return m_lstMedia.get(); }
+ CSSStyleSheet* styleSheet() const { return m_styleSheet.get(); }
+
+ virtual String cssText() const;
+
+ // Not part of the CSSOM
+ bool isLoading() const;
+
+ virtual void addSubresourceStyleURLs(ListHashSet<KURL>& urls);
+
+private:
+ CSSImportRule(CSSStyleSheet* parent, const String& href, PassRefPtr<MediaList>);
+
+ virtual bool isImportRule() { return true; }
+ virtual void insertedIntoParent();
+
+ // from CSSRule
+ virtual unsigned short type() const { return IMPORT_RULE; }
+
+ // from CachedResourceClient
+ virtual void setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet*);
+
+ String m_strHref;
+ RefPtr<MediaList> m_lstMedia;
+ RefPtr<CSSStyleSheet> m_styleSheet;
+ CachedResourceHandle<CachedCSSStyleSheet> m_cachedSheet;
+ bool m_loading;
+};
+
+} // namespace WebCore
+
+#endif // CSSImportRule_h
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSInheritedValue_h
+#define CSSInheritedValue_h
+
+#include "CSSValue.h"
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+class CSSInheritedValue : public CSSValue {
+public:
+ static PassRefPtr<CSSInheritedValue> create()
+ {
+ return adoptRef(new CSSInheritedValue);
+ }
+
+ virtual String cssText() const;
+
+private:
+ CSSInheritedValue() { }
+ virtual unsigned short cssValueType() const;
+};
+
+} // namespace WebCore
+
+#endif // CSSInheritedValue_h
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSInitialValue_h
+#define CSSInitialValue_h
+
+#include "CSSValue.h"
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+class CSSInitialValue : public CSSValue {
+public:
+ static PassRefPtr<CSSInitialValue> createExplicit()
+ {
+ static CSSInitialValue* explicitValue = new CSSInitialValue(false);
+ return explicitValue;
+ }
+ static PassRefPtr<CSSInitialValue> createImplicit()
+ {
+ static CSSInitialValue* explicitValue = new CSSInitialValue(true);
+ return explicitValue;
+ }
+
+ virtual String cssText() const;
+
+private:
+ CSSInitialValue(bool implicit)
+ : m_implicit(implicit)
+ {
+ }
+
+ virtual unsigned short cssValueType() const;
+ virtual bool isImplicitInitialValue() const { return m_implicit; }
+
+ bool m_implicit;
+};
+
+} // namespace WebCore
+
+#endif // CSSInitialValue_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Peter Kelly (pmk@post.com)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef CSSMappedAttributeDeclaration_h
+#define CSSMappedAttributeDeclaration_h
+
+#include "CSSMutableStyleDeclaration.h"
+#include "MappedAttributeEntry.h"
+#include "QualifiedName.h"
+
+namespace WebCore {
+
+class CSSMappedAttributeDeclaration : public CSSMutableStyleDeclaration {
+public:
+ static PassRefPtr<CSSMappedAttributeDeclaration> create()
+ {
+ return adoptRef(new CSSMappedAttributeDeclaration(0));
+ }
+
+ virtual ~CSSMappedAttributeDeclaration();
+
+ void setMappedState(MappedAttributeEntry type, const QualifiedName& name, const AtomicString& val)
+ {
+ m_entryType = type;
+ m_attrName = name;
+ m_attrValue = val;
+ }
+
+private:
+ CSSMappedAttributeDeclaration(CSSRule* parentRule)
+ : CSSMutableStyleDeclaration(parentRule)
+ , m_entryType(eNone)
+ , m_attrName(anyQName())
+ {
+ }
+
+ MappedAttributeEntry m_entryType;
+ QualifiedName m_attrName;
+ AtomicString m_attrValue;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * (C) 2002-2003 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2002, 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig (sam@webkit.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSMediaRule_h
+#define CSSMediaRule_h
+
+#include "CSSRule.h"
+#include "CSSRuleList.h"
+#include "MediaList.h"
+#include "PlatformString.h" // needed so bindings will compile
+
+namespace WebCore {
+
+class CSSRuleList;
+class MediaList;
+
+class CSSMediaRule : public CSSRule {
+public:
+ static PassRefPtr<CSSMediaRule> create(CSSStyleSheet* parent, PassRefPtr<MediaList> media, PassRefPtr<CSSRuleList> rules)
+ {
+ return adoptRef(new CSSMediaRule(parent, media, rules));
+ }
+ virtual ~CSSMediaRule();
+
+ MediaList* media() const { return m_lstMedia.get(); }
+ CSSRuleList* cssRules() { return m_lstCSSRules.get(); }
+
+ unsigned insertRule(const String& rule, unsigned index, ExceptionCode&);
+ void deleteRule(unsigned index, ExceptionCode&);
+
+ virtual String cssText() const;
+
+ // Not part of the CSSOM
+ unsigned append(CSSRule*);
+
+private:
+ CSSMediaRule(CSSStyleSheet* parent, PassRefPtr<MediaList>, PassRefPtr<CSSRuleList>);
+
+ virtual bool isMediaRule() { return true; }
+
+ // Inherited from CSSRule
+ virtual unsigned short type() const { return MEDIA_RULE; }
+
+ RefPtr<MediaList> m_lstMedia;
+ RefPtr<CSSRuleList> m_lstCSSRules;
+};
+
+} // namespace WebCore
+
+#endif // CSSMediaRule_h
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSMutableStyleDeclaration_h
+#define CSSMutableStyleDeclaration_h
+
+#include "CSSStyleDeclaration.h"
+#include "CSSPrimitiveValue.h"
+#include "CSSProperty.h"
+#include "KURLHash.h"
+#include "PlatformString.h"
+#include <wtf/ListHashSet.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class Node;
+
+class CSSMutableStyleDeclarationConstIterator {
+public:
+ CSSMutableStyleDeclarationConstIterator(const CSSMutableStyleDeclaration* decl, CSSProperty* current);
+ CSSMutableStyleDeclarationConstIterator(const CSSMutableStyleDeclarationConstIterator& o);
+ ~CSSMutableStyleDeclarationConstIterator();
+
+ const CSSProperty& operator*() const { return *m_current; }
+ const CSSProperty* operator->() const { return m_current; }
+
+ bool operator!=(const CSSMutableStyleDeclarationConstIterator& o) { ASSERT(m_decl == o.m_decl); return m_current != o.m_current; }
+ bool operator==(const CSSMutableStyleDeclarationConstIterator& o) { ASSERT(m_decl == o.m_decl); return m_current == o.m_current; }
+
+ CSSMutableStyleDeclarationConstIterator& operator=(const CSSMutableStyleDeclarationConstIterator& o);
+
+ CSSMutableStyleDeclarationConstIterator& operator++();
+ CSSMutableStyleDeclarationConstIterator& operator--();
+
+private:
+ const CSSMutableStyleDeclaration* m_decl;
+ CSSProperty* m_current;
+};
+
+class CSSMutableStyleDeclaration : public CSSStyleDeclaration {
+public:
+ static PassRefPtr<CSSMutableStyleDeclaration> create()
+ {
+ return adoptRef(new CSSMutableStyleDeclaration);
+ }
+ static PassRefPtr<CSSMutableStyleDeclaration> create(CSSRule* parentRule)
+ {
+ return adoptRef(new CSSMutableStyleDeclaration(parentRule));
+ }
+ static PassRefPtr<CSSMutableStyleDeclaration> create(CSSRule* parentRule, const CSSProperty* const* properties, int numProperties)
+ {
+ return adoptRef(new CSSMutableStyleDeclaration(parentRule, properties, numProperties));
+ }
+ static PassRefPtr<CSSMutableStyleDeclaration> create(const Vector<CSSProperty>& properties, unsigned variableDependentValueCount)
+ {
+ return adoptRef(new CSSMutableStyleDeclaration(0, properties, variableDependentValueCount));
+ }
+
+ CSSMutableStyleDeclaration& operator=(const CSSMutableStyleDeclaration&);
+
+ typedef CSSMutableStyleDeclarationConstIterator const_iterator;
+
+ const_iterator begin() { return const_iterator(this, m_properties.begin()); }
+ const_iterator end() { return const_iterator(this, m_properties.end()); }
+
+ void setNode(Node* node) { m_node = node; }
+
+ virtual bool isMutableStyleDeclaration() const { return true; }
+
+ virtual String cssText() const;
+ virtual void setCssText(const String&, ExceptionCode&);
+
+ virtual unsigned length() const;
+ virtual String item(unsigned index) const;
+
+ virtual PassRefPtr<CSSValue> getPropertyCSSValue(int propertyID) const;
+ virtual String getPropertyValue(int propertyID) const;
+ virtual bool getPropertyPriority(int propertyID) const;
+ virtual int getPropertyShorthand(int propertyID) const;
+ virtual bool isPropertyImplicit(int propertyID) const;
+
+ virtual void setProperty(int propertyId, const String& value, bool important, ExceptionCode&);
+ virtual String removeProperty(int propertyID, ExceptionCode&);
+
+ virtual PassRefPtr<CSSMutableStyleDeclaration> copy() const;
+
+ bool setProperty(int propertyID, int value, bool important = false, bool notifyChanged = true);
+ bool setProperty(int propertyID, const String& value, bool important = false, bool notifyChanged = true);
+
+ String removeProperty(int propertyID, bool notifyChanged = true, bool returnText = false);
+
+ // setLengthProperty treats integers as pixels! (Needed for conversion of HTML attributes.)
+ void setLengthProperty(int propertyId, const String& value, bool important, bool multiLength = false);
+ void setStringProperty(int propertyId, const String& value, CSSPrimitiveValue::UnitTypes, bool important = false); // parsed string value
+ void setImageProperty(int propertyId, const String& url, bool important = false);
+
+ // The following parses an entire new style declaration.
+ void parseDeclaration(const String& styleDeclaration);
+
+ // Besides adding the properties, this also removes any existing properties with these IDs.
+ // It does no notification since it's called by the parser.
+ void addParsedProperties(const CSSProperty* const *, int numProperties);
+ // This does no change notifications since it's only called by createMarkup.
+ void addParsedProperty(const CSSProperty&);
+
+ PassRefPtr<CSSMutableStyleDeclaration> copyBlockProperties() const;
+ void removeBlockProperties();
+ void removePropertiesInSet(const int* set, unsigned length, bool notifyChanged = true);
+
+ void merge(CSSMutableStyleDeclaration*, bool argOverridesOnConflict = true);
+
+ bool hasVariableDependentValue() const { return m_variableDependentValueCount > 0; }
+
+ void setStrictParsing(bool b) { m_strictParsing = b; }
+ bool useStrictParsing() const { return m_strictParsing; }
+
+ void addSubresourceStyleURLs(ListHashSet<KURL>&);
+
+protected:
+ CSSMutableStyleDeclaration(CSSRule* parentRule);
+
+private:
+ CSSMutableStyleDeclaration();
+ CSSMutableStyleDeclaration(CSSRule* parentRule, const Vector<CSSProperty>&, unsigned variableDependentValueCount);
+ CSSMutableStyleDeclaration(CSSRule* parentRule, const CSSProperty* const *, int numProperties);
+
+ virtual PassRefPtr<CSSMutableStyleDeclaration> makeMutable();
+
+ void setChanged();
+
+ String getShorthandValue(const int* properties, int number) const;
+ String getCommonValue(const int* properties, int number) const;
+ String getLayeredShorthandValue(const int* properties, unsigned number) const;
+ String get4Values(const int* properties) const;
+
+ void setPropertyInternal(const CSSProperty&, CSSProperty* slot = 0);
+ bool removeShorthandProperty(int propertyID, bool notifyChanged);
+
+ Vector<CSSProperty>::const_iterator findPropertyWithId(int propertyId) const;
+ Vector<CSSProperty>::iterator findPropertyWithId(int propertyId);
+
+ Vector<CSSProperty> m_properties;
+
+ Node* m_node;
+ unsigned m_variableDependentValueCount : 24;
+ bool m_strictParsing : 1;
+#ifndef NDEBUG
+ unsigned m_iteratorCount : 4;
+#endif
+
+ friend class CSSMutableStyleDeclarationConstIterator;
+};
+
+inline CSSMutableStyleDeclarationConstIterator::CSSMutableStyleDeclarationConstIterator(const CSSMutableStyleDeclaration* decl, CSSProperty* current)
+: m_decl(decl)
+, m_current(current)
+{
+#ifndef NDEBUG
+ const_cast<CSSMutableStyleDeclaration*>(m_decl)->m_iteratorCount++;
+#endif
+}
+
+inline CSSMutableStyleDeclarationConstIterator::CSSMutableStyleDeclarationConstIterator(const CSSMutableStyleDeclarationConstIterator& o)
+: m_decl(o.m_decl)
+, m_current(o.m_current)
+{
+#ifndef NDEBUG
+ const_cast<CSSMutableStyleDeclaration*>(m_decl)->m_iteratorCount++;
+#endif
+}
+
+inline CSSMutableStyleDeclarationConstIterator::~CSSMutableStyleDeclarationConstIterator()
+{
+#ifndef NDEBUG
+ const_cast<CSSMutableStyleDeclaration*>(m_decl)->m_iteratorCount--;
+#endif
+}
+
+inline CSSMutableStyleDeclarationConstIterator& CSSMutableStyleDeclarationConstIterator::operator=(const CSSMutableStyleDeclarationConstIterator& o)
+{
+ m_decl = o.m_decl;
+ m_current = o.m_current;
+#ifndef NDEBUG
+ const_cast<CSSMutableStyleDeclaration*>(m_decl)->m_iteratorCount++;
+#endif
+ return *this;
+}
+
+inline CSSMutableStyleDeclarationConstIterator& CSSMutableStyleDeclarationConstIterator::operator++()
+{
+ ASSERT(m_current != const_cast<CSSMutableStyleDeclaration*>(m_decl)->m_properties.end());
+ ++m_current;
+ return *this;
+}
+
+inline CSSMutableStyleDeclarationConstIterator& CSSMutableStyleDeclarationConstIterator::operator--()
+{
+ --m_current;
+ return *this;
+}
+
+} // namespace WebCore
+
+#endif // CSSMutableStyleDeclaration_h
--- /dev/null
+/*
+ * This file is part of the CSS implementation for KDE.
+ *
+ * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * 1999 Waldo Bastian (bastian@kde.org)
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSNamespace_h
+#define CSSNamespace_h
+
+#include "AtomicString.h"
+
+namespace WebCore {
+
+ struct CSSNamespace {
+ AtomicString m_prefix;
+ AtomicString m_uri;
+ CSSNamespace* m_parent;
+
+ CSSNamespace(const AtomicString& prefix, const AtomicString& uri, CSSNamespace* parent)
+ : m_prefix(prefix)
+ , m_uri(uri)
+ , m_parent(parent)
+ {
+ }
+ ~CSSNamespace() { delete m_parent; }
+
+ const AtomicString& uri() { return m_uri; }
+ const AtomicString& prefix() { return m_prefix; }
+
+ CSSNamespace* namespaceForPrefix(const AtomicString& prefix)
+ {
+ if (prefix == m_prefix)
+ return this;
+ if (m_parent)
+ return m_parent->namespaceForPrefix(prefix);
+ return 0;
+ }
+ };
+
+} // namespace WebCore
+
+#endif // CSSNamespace_h
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * (C) 2002-2003 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2002, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSPageRule_h
+#define CSSPageRule_h
+
+#include "CSSRule.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class CSSMutableStyleDeclaration;
+
+class CSSPageRule : public CSSRule {
+public:
+ static PassRefPtr<CSSPageRule> create(CSSStyleSheet* parent)
+ {
+ return adoptRef(new CSSPageRule(parent));
+ }
+
+ virtual ~CSSPageRule();
+
+ String selectorText() const;
+ void setSelectorText(const String&, ExceptionCode&);
+
+ CSSMutableStyleDeclaration* style() const { return m_style.get(); }
+
+ virtual String cssText() const;
+
+private:
+ CSSPageRule(CSSStyleSheet* parent);
+
+ // Inherited from CSSRule
+ virtual unsigned short type() const { return PAGE_RULE; }
+
+ RefPtr<CSSMutableStyleDeclaration> m_style;
+};
+
+} // namespace WebCore
+
+#endif // CSSPageRule_h
--- /dev/null
+/*
+ * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSParser_h
+#define CSSParser_h
+
+#include "AtomicString.h"
+#include "Color.h"
+#include "CSSParserValues.h"
+#include "CSSSelectorList.h"
+#include "MediaQuery.h"
+#include <wtf/HashSet.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+ class CSSMutableStyleDeclaration;
+ class CSSPrimitiveValue;
+ class CSSProperty;
+ class CSSRule;
+ class CSSRuleList;
+ class CSSSelector;
+ class CSSStyleSheet;
+ class CSSValue;
+ class CSSValueList;
+ class CSSVariablesDeclaration;
+ class Document;
+ class MediaList;
+ class MediaQueryExp;
+ class StyleBase;
+ class StyleList;
+ class WebKitCSSKeyframeRule;
+ class WebKitCSSKeyframesRule;
+
+ class CSSParser {
+ public:
+ CSSParser(bool strictParsing = true);
+ ~CSSParser();
+
+ void parseSheet(CSSStyleSheet*, const String&);
+ PassRefPtr<CSSRule> parseRule(CSSStyleSheet*, const String&);
+ PassRefPtr<CSSRule> parseKeyframeRule(CSSStyleSheet*, const String&);
+ bool parseValue(CSSMutableStyleDeclaration*, int propId, const String&, bool important);
+ static bool parseColor(RGBA32& color, const String&, bool strict = false);
+ bool parseColor(CSSMutableStyleDeclaration*, const String&);
+ bool parseDeclaration(CSSMutableStyleDeclaration*, const String&);
+ bool parseMediaQuery(MediaList*, const String&);
+
+ Document* document() const;
+
+ void addProperty(int propId, PassRefPtr<CSSValue>, bool important);
+ void rollbackLastProperties(int num);
+ bool hasProperties() const { return m_numParsedProperties > 0; }
+
+ bool parseValue(int propId, bool important);
+ bool parseShorthand(int propId, const int* properties, int numProperties, bool important);
+ bool parse4Values(int propId, const int* properties, bool important);
+ bool parseContent(int propId, bool important);
+
+ PassRefPtr<CSSValue> parseBackgroundColor();
+
+ bool parseFillImage(RefPtr<CSSValue>&);
+ PassRefPtr<CSSValue> parseFillPositionXY(bool& xFound, bool& yFound);
+ void parseFillPosition(RefPtr<CSSValue>&, RefPtr<CSSValue>&);
+ PassRefPtr<CSSValue> parseFillSize();
+
+ bool parseFillProperty(int propId, int& propId1, int& propId2, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
+ bool parseFillShorthand(int propId, const int* properties, int numProperties, bool important);
+
+ void addFillValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSValue> rval);
+
+ void addAnimationValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSValue> rval);
+
+ PassRefPtr<CSSValue> parseAnimationDelay();
+ PassRefPtr<CSSValue> parseAnimationDirection();
+ PassRefPtr<CSSValue> parseAnimationDuration();
+ PassRefPtr<CSSValue> parseAnimationIterationCount();
+ PassRefPtr<CSSValue> parseAnimationName();
+ PassRefPtr<CSSValue> parseAnimationPlayState();
+ PassRefPtr<CSSValue> parseAnimationProperty();
+ PassRefPtr<CSSValue> parseAnimationTimingFunction();
+
+ void parseTransformOriginShorthand(RefPtr<CSSValue>&, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
+ bool parseTimingFunctionValue(CSSParserValueList*& args, double& result);
+ bool parseAnimationProperty(int propId, RefPtr<CSSValue>&);
+ bool parseTransitionShorthand(bool important);
+ bool parseAnimationShorthand(bool important);
+
+ bool parseDashboardRegions(int propId, bool important);
+
+ bool parseShape(int propId, bool important);
+
+ bool parseFont(bool important);
+ PassRefPtr<CSSValueList> parseFontFamily();
+
+ bool parseCounter(int propId, int defaultValue, bool important);
+ PassRefPtr<CSSValue> parseCounterContent(CSSParserValueList* args, bool counters);
+
+ bool parseColorParameters(CSSParserValue*, int* colorValues, bool parseAlpha);
+ bool parseHSLParameters(CSSParserValue*, double* colorValues, bool parseAlpha);
+ PassRefPtr<CSSPrimitiveValue> parseColor(CSSParserValue* = 0);
+ bool parseColorFromValue(CSSParserValue*, RGBA32&, bool = false);
+ void parseSelector(const String&, Document* doc, CSSSelectorList&);
+
+ static bool parseColor(const String&, RGBA32& rgb, bool strict);
+
+ bool parseFontStyle(bool important);
+ bool parseFontVariant(bool important);
+ bool parseFontWeight(bool important);
+ bool parseFontFaceSrc();
+ bool parseFontFaceUnicodeRange();
+
+#if ENABLE(SVG)
+ bool parseSVGValue(int propId, bool important);
+ PassRefPtr<CSSValue> parseSVGPaint();
+ PassRefPtr<CSSValue> parseSVGColor();
+ PassRefPtr<CSSValue> parseSVGStrokeDasharray();
+#endif
+
+ // CSS3 Parsing Routines (for properties specific to CSS3)
+ bool parseShadow(int propId, bool important);
+ bool parseBorderImage(int propId, bool important, RefPtr<CSSValue>&);
+
+ bool parseReflect(int propId, bool important);
+
+ // Image generators
+ bool parseCanvas(RefPtr<CSSValue>&);
+ bool parseGradient(RefPtr<CSSValue>&);
+
+ PassRefPtr<CSSValueList> parseTransform();
+ bool parseTransformOrigin(int propId, int& propId1, int& propId2, int& propId3, RefPtr<CSSValue>&, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
+ bool parsePerspectiveOrigin(int propId, int& propId1, int& propId, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
+ bool parseVariable(CSSVariablesDeclaration*, const String& variableName, const String& variableValue);
+ void parsePropertyWithResolvedVariables(int propId, bool important, CSSMutableStyleDeclaration*, CSSParserValueList*);
+
+ int yyparse();
+
+ CSSSelector* createFloatingSelector();
+ CSSSelector* sinkFloatingSelector(CSSSelector*);
+
+ CSSParserValueList* createFloatingValueList();
+ CSSParserValueList* sinkFloatingValueList(CSSParserValueList*);
+
+ CSSParserFunction* createFloatingFunction();
+ CSSParserFunction* sinkFloatingFunction(CSSParserFunction*);
+
+ CSSParserValue& sinkFloatingValue(CSSParserValue&);
+
+ MediaList* createMediaList();
+ CSSRule* createCharsetRule(const CSSParserString&);
+ CSSRule* createImportRule(const CSSParserString&, MediaList*);
+ WebKitCSSKeyframeRule* createKeyframeRule(CSSParserValueList*);
+ WebKitCSSKeyframesRule* createKeyframesRule();
+ CSSRule* createMediaRule(MediaList*, CSSRuleList*);
+ CSSRuleList* createRuleList();
+ CSSRule* createStyleRule(Vector<CSSSelector*>* selectors);
+ CSSRule* createFontFaceRule();
+ CSSRule* createVariablesRule(MediaList*, bool variablesKeyword);
+
+ MediaQueryExp* createFloatingMediaQueryExp(const AtomicString&, CSSParserValueList*);
+ MediaQueryExp* sinkFloatingMediaQueryExp(MediaQueryExp*);
+ Vector<MediaQueryExp*>* createFloatingMediaQueryExpList();
+ Vector<MediaQueryExp*>* sinkFloatingMediaQueryExpList(Vector<MediaQueryExp*>*);
+ MediaQuery* createFloatingMediaQuery(MediaQuery::Restrictor, const String&, Vector<MediaQueryExp*>*);
+ MediaQuery* createFloatingMediaQuery(Vector<MediaQueryExp*>*);
+ MediaQuery* sinkFloatingMediaQuery(MediaQuery*);
+
+ bool addVariable(const CSSParserString&, CSSParserValueList*);
+ bool addVariableDeclarationBlock(const CSSParserString&);
+ bool checkForVariables(CSSParserValueList*);
+ void addUnresolvedProperty(int propId, bool important);
+
+ Vector<CSSSelector*>* reusableSelectorVector() { return &m_reusableSelectorVector; }
+
+ public:
+ bool m_strict;
+ bool m_important;
+ int m_id;
+ CSSStyleSheet* m_styleSheet;
+ RefPtr<CSSRule> m_rule;
+ RefPtr<CSSRule> m_keyframe;
+ MediaQuery* m_mediaQuery;
+ CSSParserValueList* m_valueList;
+ CSSProperty** m_parsedProperties;
+ CSSSelectorList* m_selectorListForParseSelector;
+ unsigned m_numParsedProperties;
+ unsigned m_maxParsedProperties;
+
+ int m_inParseShorthand;
+ int m_currentShorthand;
+ bool m_implicitShorthand;
+
+ bool m_hasFontFaceOnlyValues;
+
+ Vector<String> m_variableNames;
+ Vector<RefPtr<CSSValue> > m_variableValues;
+
+ AtomicString m_defaultNamespace;
+
+ // tokenizer methods and data
+ public:
+ int lex(void* yylval);
+ int token() { return yyTok; }
+ UChar* text(int* length);
+ int lex();
+
+ private:
+ void clearProperties();
+
+ void setupParser(const char* prefix, const String&, const char* suffix);
+
+ bool inShorthand() const { return m_inParseShorthand; }
+
+ void checkForOrphanedUnits();
+
+ void clearVariables();
+
+ void deleteFontFaceOnlyValues();
+
+ UChar* m_data;
+ UChar* yytext;
+ UChar* yy_c_buf_p;
+ UChar yy_hold_char;
+ int yy_last_accepting_state;
+ UChar* yy_last_accepting_cpos;
+ int yyleng;
+ int yyTok;
+ int yy_start;
+
+ Vector<RefPtr<StyleBase> > m_parsedStyleObjects;
+ Vector<RefPtr<CSSRuleList> > m_parsedRuleLists;
+ HashSet<CSSSelector*> m_floatingSelectors;
+ HashSet<CSSParserValueList*> m_floatingValueLists;
+ HashSet<CSSParserFunction*> m_floatingFunctions;
+
+ MediaQuery* m_floatingMediaQuery;
+ MediaQueryExp* m_floatingMediaQueryExp;
+ Vector<MediaQueryExp*>* m_floatingMediaQueryExpList;
+
+ Vector<CSSSelector*> m_reusableSelectorVector;
+
+ // defines units allowed for a certain property, used in parseUnit
+ enum Units {
+ FUnknown = 0x0000,
+ FInteger = 0x0001,
+ FNumber = 0x0002, // Real Numbers
+ FPercent = 0x0004,
+ FLength = 0x0008,
+ FAngle = 0x0010,
+ FTime = 0x0020,
+ FFrequency = 0x0040,
+ FRelative = 0x0100,
+ FNonNeg = 0x0200
+ };
+
+ friend inline Units operator|(Units a, Units b)
+ {
+ return static_cast<Units>(static_cast<unsigned>(a) | static_cast<unsigned>(b));
+ }
+
+ static bool validUnit(CSSParserValue*, Units, bool strict);
+
+ friend class TransformOperationInfo;
+ };
+
+ int cssPropertyID(const CSSParserString&);
+ int cssPropertyID(const String&);
+ int cssValueKeywordID(const CSSParserString&);
+
+ class ShorthandScope {
+ public:
+ ShorthandScope(CSSParser* parser, int propId) : m_parser(parser)
+ {
+ if (!(m_parser->m_inParseShorthand++))
+ m_parser->m_currentShorthand = propId;
+ }
+ ~ShorthandScope()
+ {
+ if (!(--m_parser->m_inParseShorthand))
+ m_parser->m_currentShorthand = 0;
+ }
+
+ private:
+ CSSParser* m_parser;
+ };
+
+} // namespace WebCore
+
+#endif // CSSParser_h
--- /dev/null
+/*
+ * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSParserValues_h
+#define CSSParserValues_h
+
+#include "AtomicString.h"
+
+namespace WebCore {
+
+class CSSValue;
+
+struct CSSParserString {
+ UChar* characters;
+ int length;
+
+ void lower();
+
+ operator String() const { return String(characters, length); }
+ operator AtomicString() const { return AtomicString(characters, length); }
+};
+
+struct CSSParserFunction;
+
+struct CSSParserValue {
+ int id;
+ bool isInt;
+ union {
+ double fValue;
+ int iValue;
+ CSSParserString string;
+ CSSParserFunction* function;
+ };
+ enum {
+ Operator = 0x100000,
+ Function = 0x100001,
+ Q_EMS = 0x100002
+ };
+ int unit;
+
+ bool isVariable() const;
+
+ PassRefPtr<CSSValue> createCSSValue();
+};
+
+class CSSParserValueList {
+public:
+ CSSParserValueList()
+ : m_current(0)
+ , m_variablesCount(0)
+ {
+ }
+ ~CSSParserValueList();
+
+ void addValue(const CSSParserValue&);
+ void deleteValueAt(unsigned);
+
+ unsigned size() const { return m_values.size(); }
+ CSSParserValue* current() { return m_current < m_values.size() ? &m_values[m_current] : 0; }
+ CSSParserValue* next() { ++m_current; return current(); }
+
+ CSSParserValue* valueAt(unsigned i) { return i < m_values.size() ? &m_values[i] : 0; }
+
+ void clear() { m_values.clear(); }
+
+ bool containsVariables() const { return m_variablesCount; }
+
+private:
+ Vector<CSSParserValue, 16> m_values;
+ unsigned m_current;
+ unsigned m_variablesCount;
+};
+
+struct CSSParserFunction {
+ CSSParserString name;
+ CSSParserValueList* args;
+
+ ~CSSParserFunction() { delete args; }
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSPrimitiveValue_h
+#define CSSPrimitiveValue_h
+
+#include "CSSValue.h"
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+class Counter;
+class DashboardRegion;
+class Pair;
+class Rect;
+class RenderStyle;
+class StringImpl;
+
+struct Length;
+
+class CSSPrimitiveValue : public CSSValue {
+public:
+ enum UnitTypes {
+ CSS_UNKNOWN = 0,
+ CSS_NUMBER = 1,
+ CSS_PERCENTAGE = 2,
+ CSS_EMS = 3,
+ CSS_EXS = 4,
+ CSS_PX = 5,
+ CSS_CM = 6,
+ CSS_MM = 7,
+ CSS_IN = 8,
+ CSS_PT = 9,
+ CSS_PC = 10,
+ CSS_DEG = 11,
+ CSS_RAD = 12,
+ CSS_GRAD = 13,
+ CSS_MS = 14,
+ CSS_S = 15,
+ CSS_HZ = 16,
+ CSS_KHZ = 17,
+ CSS_DIMENSION = 18,
+ CSS_STRING = 19,
+ CSS_URI = 20,
+ CSS_IDENT = 21,
+ CSS_ATTR = 22,
+ CSS_COUNTER = 23,
+ CSS_RECT = 24,
+ CSS_RGBCOLOR = 25,
+ CSS_PAIR = 100, // We envision this being exposed as a means of getting computed style values for pairs (border-spacing/radius, background-position, etc.)
+ CSS_DASHBOARD_REGION = 101, // FIXME: Dashboard region should not be a primitive value.
+ CSS_UNICODE_RANGE = 102,
+
+ // These next types are just used internally to allow us to translate back and forth from CSSPrimitiveValues to CSSParserValues.
+ CSS_PARSER_OPERATOR = 103,
+ CSS_PARSER_INTEGER = 104,
+ CSS_PARSER_VARIABLE_FUNCTION_SYNTAX = 105,
+ CSS_PARSER_HEXCOLOR = 106,
+
+ // This is used internally for unknown identifiers
+ CSS_PARSER_IDENTIFIER = 107,
+
+ // This unit is in CSS 3, but that isn't a finished standard yet
+ CSS_TURN = 108
+ };
+
+ static bool isUnitTypeLength(int type) { return type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG; }
+
+ static PassRefPtr<CSSPrimitiveValue> createIdentifier(int ident);
+ static PassRefPtr<CSSPrimitiveValue> createColor(unsigned rgbValue);
+ static PassRefPtr<CSSPrimitiveValue> create(double value, UnitTypes type);
+ static PassRefPtr<CSSPrimitiveValue> create(const String& value, UnitTypes type);
+
+ template<typename T> static PassRefPtr<CSSPrimitiveValue> create(T value)
+ {
+ return adoptRef(new CSSPrimitiveValue(value));
+ }
+
+ virtual ~CSSPrimitiveValue();
+
+ void cleanup();
+
+ unsigned short primitiveType() const { return m_type; }
+
+ bool isVariable() const { return m_type == CSS_PARSER_VARIABLE_FUNCTION_SYNTAX; }
+
+ /*
+ * computes a length in pixels out of the given CSSValue. Need the RenderStyle to get
+ * the fontinfo in case val is defined in em or ex.
+ *
+ * The metrics have to be a bit different for screen and printer output.
+ * For screen output we assume 1 inch == 72 px, for printer we assume 300 dpi
+ *
+ * this is screen/printer dependent, so we probably need a config option for this,
+ * and some tool to calibrate.
+ */
+ int computeLengthInt(RenderStyle*);
+ int computeLengthInt(RenderStyle*, double multiplier);
+ int computeLengthIntForLength(RenderStyle*);
+ int computeLengthIntForLength(RenderStyle*, double multiplier);
+ short computeLengthShort(RenderStyle*);
+ short computeLengthShort(RenderStyle*, double multiplier);
+ float computeLengthFloat(RenderStyle*, bool computingFontSize = false);
+ float computeLengthFloat(RenderStyle*, double multiplier, bool computingFontSize = false);
+ double computeLengthDouble(RenderStyle*, double multiplier = 1.0, bool computingFontSize = false);
+
+ // use with care!!!
+ void setPrimitiveType(unsigned short type) { m_type = type; }
+
+ double getDoubleValue(unsigned short unitType, ExceptionCode&);
+ double getDoubleValue(unsigned short unitType);
+ double getDoubleValue() const { return m_value.num; }
+
+ void setFloatValue(unsigned short unitType, double floatValue, ExceptionCode&);
+ float getFloatValue(unsigned short unitType, ExceptionCode& ec) { return static_cast<float>(getDoubleValue(unitType, ec)); }
+ float getFloatValue(unsigned short unitType) { return static_cast<float>(getDoubleValue(unitType)); }
+ float getFloatValue() const { return static_cast<float>(m_value.num); }
+
+ int getIntValue(unsigned short unitType, ExceptionCode& ec) { return static_cast<int>(getDoubleValue(unitType, ec)); }
+ int getIntValue(unsigned short unitType) { return static_cast<int>(getDoubleValue(unitType)); }
+ int getIntValue() const { return static_cast<int>(m_value.num); }
+
+ void setStringValue(unsigned short stringType, const String& stringValue, ExceptionCode&);
+ String getStringValue(ExceptionCode&) const;
+ String getStringValue() const;
+
+ Counter* getCounterValue(ExceptionCode&) const;
+ Counter* getCounterValue() const { return m_type != CSS_COUNTER ? 0 : m_value.counter; }
+
+ Rect* getRectValue(ExceptionCode&) const;
+ Rect* getRectValue() const { return m_type != CSS_RECT ? 0 : m_value.rect; }
+
+ unsigned getRGBColorValue(ExceptionCode&) const;
+ unsigned getRGBColorValue() const { return m_type != CSS_RGBCOLOR ? 0 : m_value.rgbcolor; }
+
+ Pair* getPairValue(ExceptionCode&) const;
+ Pair* getPairValue() const { return m_type != CSS_PAIR ? 0 : m_value.pair; }
+
+ DashboardRegion* getDashboardRegionValue() const { return m_type != CSS_DASHBOARD_REGION ? 0 : m_value.region; }
+
+ int getIdent();
+ template<typename T> operator T() const; // Defined in CSSPrimitiveValueMappings.h
+
+ virtual bool parseString(const String&, bool = false);
+ virtual String cssText() const;
+
+ virtual bool isQuirkValue() { return false; }
+
+ virtual CSSParserValue parserValue() const;
+
+ virtual void addSubresourceStyleURLs(ListHashSet<KURL>&, const CSSStyleSheet*);
+
+protected:
+ // FIXME: int vs. unsigned overloading is too subtle to distinguish the color and identifier cases.
+ CSSPrimitiveValue(int ident);
+ CSSPrimitiveValue(double, UnitTypes);
+ CSSPrimitiveValue(const String&, UnitTypes);
+
+private:
+ CSSPrimitiveValue();
+ CSSPrimitiveValue(unsigned color); // RGB value
+ CSSPrimitiveValue(const Length&);
+
+ template<typename T> CSSPrimitiveValue(T); // Defined in CSSPrimitiveValueMappings.h
+ template<typename T> CSSPrimitiveValue(T* val) { init(PassRefPtr<T>(val)); }
+ template<typename T> CSSPrimitiveValue(PassRefPtr<T> val) { init(val); }
+
+ static void create(int); // compile-time guard
+ static void create(unsigned); // compile-time guard
+ template<typename T> operator T*(); // compile-time guard
+
+ void init(PassRefPtr<Counter>);
+ void init(PassRefPtr<Rect>);
+ void init(PassRefPtr<Pair>);
+ void init(PassRefPtr<DashboardRegion>); // FIXME: Dashboard region should not be a primitive value.
+
+ virtual bool isPrimitiveValue() const { return true; }
+
+ virtual unsigned short cssValueType() const;
+
+ int m_type;
+ union {
+ int ident;
+ double num;
+ StringImpl* string;
+ Counter* counter;
+ Rect* rect;
+ unsigned rgbcolor;
+ Pair* pair;
+ DashboardRegion* region;
+ } m_value;
+};
+
+} // namespace WebCore
+
+#endif // CSSPrimitiveValue_h
--- /dev/null
+/*
+ * Copyright (C) 2007 Alexey Proskuryakov <ap@nypop.com>.
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 CSSPrimitiveValueMappings_h
+#define CSSPrimitiveValueMappings_h
+
+#include "CSSPrimitiveValue.h"
+#include "CSSValueKeywords.h"
+#include "RenderStyle.h"
+
+namespace WebCore {
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBorderStyle e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case BNONE:
+ m_value.ident = CSSValueNone;
+ break;
+ case BHIDDEN:
+ m_value.ident = CSSValueHidden;
+ break;
+ case INSET:
+ m_value.ident = CSSValueInset;
+ break;
+ case GROOVE:
+ m_value.ident = CSSValueGroove;
+ break;
+ case RIDGE:
+ m_value.ident = CSSValueRidge;
+ break;
+ case OUTSET:
+ m_value.ident = CSSValueOutset;
+ break;
+ case DOTTED:
+ m_value.ident = CSSValueDotted;
+ break;
+ case DASHED:
+ m_value.ident = CSSValueDashed;
+ break;
+ case SOLID:
+ m_value.ident = CSSValueSolid;
+ break;
+ case DOUBLE:
+ m_value.ident = CSSValueDouble;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EBorderStyle() const
+{
+ return (EBorderStyle)(m_value.ident - CSSValueNone);
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(CompositeOperator e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case CompositeClear:
+ m_value.ident = CSSValueClear;
+ break;
+ case CompositeCopy:
+ m_value.ident = CSSValueCopy;
+ break;
+ case CompositeSourceOver:
+ m_value.ident = CSSValueSourceOver;
+ break;
+ case CompositeSourceIn:
+ m_value.ident = CSSValueSourceIn;
+ break;
+ case CompositeSourceOut:
+ m_value.ident = CSSValueSourceOut;
+ break;
+ case CompositeSourceAtop:
+ m_value.ident = CSSValueSourceAtop;
+ break;
+ case CompositeDestinationOver:
+ m_value.ident = CSSValueDestinationOver;
+ break;
+ case CompositeDestinationIn:
+ m_value.ident = CSSValueDestinationIn;
+ break;
+ case CompositeDestinationOut:
+ m_value.ident = CSSValueDestinationOut;
+ break;
+ case CompositeDestinationAtop:
+ m_value.ident = CSSValueDestinationAtop;
+ break;
+ case CompositeXOR:
+ m_value.ident = CSSValueXor;
+ break;
+ case CompositePlusDarker:
+ m_value.ident = CSSValuePlusDarker;
+ break;
+ case CompositeHighlight:
+ m_value.ident = CSSValueHighlight;
+ break;
+ case CompositePlusLighter:
+ m_value.ident = CSSValuePlusLighter;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator CompositeOperator() const
+{
+ switch (m_value.ident) {
+ case CSSValueClear:
+ return CompositeClear;
+ case CSSValueCopy:
+ return CompositeCopy;
+ case CSSValueSourceOver:
+ return CompositeSourceOver;
+ case CSSValueSourceIn:
+ return CompositeSourceIn;
+ case CSSValueSourceOut:
+ return CompositeSourceOut;
+ case CSSValueSourceAtop:
+ return CompositeSourceAtop;
+ case CSSValueDestinationOver:
+ return CompositeDestinationOver;
+ case CSSValueDestinationIn:
+ return CompositeDestinationIn;
+ case CSSValueDestinationOut:
+ return CompositeDestinationOut;
+ case CSSValueDestinationAtop:
+ return CompositeDestinationAtop;
+ case CSSValueXor:
+ return CompositeXOR;
+ case CSSValuePlusDarker:
+ return CompositePlusDarker;
+ case CSSValueHighlight:
+ return CompositeHighlight;
+ case CSSValuePlusLighter:
+ return CompositePlusLighter;
+ default:
+ ASSERT_NOT_REACHED();
+ return CompositeClear;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case NoControlPart:
+ m_value.ident = CSSValueNone;
+ break;
+ case CheckboxPart:
+ m_value.ident = CSSValueCheckbox;
+ break;
+ case RadioPart:
+ m_value.ident = CSSValueRadio;
+ break;
+ case PushButtonPart:
+ m_value.ident = CSSValuePushButton;
+ break;
+ case SquareButtonPart:
+ m_value.ident = CSSValueSquareButton;
+ break;
+ case ButtonPart:
+ m_value.ident = CSSValueButton;
+ break;
+ case ButtonBevelPart:
+ m_value.ident = CSSValueButtonBevel;
+ break;
+ case DefaultButtonPart:
+ m_value.ident = CSSValueDefaultButton;
+ break;
+ case ListboxPart:
+ m_value.ident = CSSValueListbox;
+ break;
+ case ListItemPart:
+ m_value.ident = CSSValueListitem;
+ break;
+ case MediaFullscreenButtonPart:
+ m_value.ident = CSSValueMediaFullscreenButton;
+ break;
+ case MediaPlayButtonPart:
+ m_value.ident = CSSValueMediaPlayButton;
+ break;
+ case MediaMuteButtonPart:
+ m_value.ident = CSSValueMediaMuteButton;
+ break;
+ case MediaSeekBackButtonPart:
+ m_value.ident = CSSValueMediaSeekBackButton;
+ break;
+ case MediaSeekForwardButtonPart:
+ m_value.ident = CSSValueMediaSeekForwardButton;
+ break;
+ case MediaSliderPart:
+ m_value.ident = CSSValueMediaSlider;
+ break;
+ case MediaSliderThumbPart:
+ m_value.ident = CSSValueMediaSliderthumb;
+ break;
+ case MediaTimelineContainerPart:
+ m_value.ident = CSSValueMediaTimelineContainer;
+ break;
+ case MediaCurrentTimePart:
+ m_value.ident = CSSValueMediaCurrentTimeDisplay;
+ break;
+ case MediaTimeRemainingPart:
+ m_value.ident = CSSValueMediaTimeRemainingDisplay;
+ break;
+ case MenulistPart:
+ m_value.ident = CSSValueMenulist;
+ break;
+ case MenulistButtonPart:
+ m_value.ident = CSSValueMenulistButton;
+ break;
+ case MenulistTextPart:
+ m_value.ident = CSSValueMenulistText;
+ break;
+ case MenulistTextFieldPart:
+ m_value.ident = CSSValueMenulistTextfield;
+ break;
+ case SliderHorizontalPart:
+ m_value.ident = CSSValueSliderHorizontal;
+ break;
+ case SliderVerticalPart:
+ m_value.ident = CSSValueSliderVertical;
+ break;
+ case SliderThumbHorizontalPart:
+ m_value.ident = CSSValueSliderthumbHorizontal;
+ break;
+ case SliderThumbVerticalPart:
+ m_value.ident = CSSValueSliderthumbVertical;
+ break;
+ case CaretPart:
+ m_value.ident = CSSValueCaret;
+ break;
+ case SearchFieldPart:
+ m_value.ident = CSSValueSearchfield;
+ break;
+ case SearchFieldDecorationPart:
+ m_value.ident = CSSValueSearchfieldDecoration;
+ break;
+ case SearchFieldResultsDecorationPart:
+ m_value.ident = CSSValueSearchfieldResultsDecoration;
+ break;
+ case SearchFieldResultsButtonPart:
+ m_value.ident = CSSValueSearchfieldResultsButton;
+ break;
+ case SearchFieldCancelButtonPart:
+ m_value.ident = CSSValueSearchfieldCancelButton;
+ break;
+ case TextFieldPart:
+ m_value.ident = CSSValueTextfield;
+ break;
+ case TextAreaPart:
+ m_value.ident = CSSValueTextarea;
+ break;
+ case CapsLockIndicatorPart:
+ m_value.ident = CSSValueCapsLockIndicator;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator ControlPart() const
+{
+ if (m_value.ident == CSSValueNone)
+ return NoControlPart;
+ else
+ return ControlPart(m_value.ident - CSSValueCheckbox + 1);
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillBox e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case BorderFillBox:
+ m_value.ident = CSSValueBorder;
+ break;
+ case PaddingFillBox:
+ m_value.ident = CSSValuePadding;
+ break;
+ case ContentFillBox:
+ m_value.ident = CSSValueContent;
+ break;
+ case TextFillBox:
+ m_value.ident = CSSValueText;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EFillBox() const
+{
+ switch (m_value.ident) {
+ case CSSValueBorder:
+ return BorderFillBox;
+ case CSSValuePadding:
+ return PaddingFillBox;
+ case CSSValueContent:
+ return ContentFillBox;
+ case CSSValueText:
+ return TextFillBox;
+ default:
+ ASSERT_NOT_REACHED();
+ return BorderFillBox;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillRepeat e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case RepeatFill:
+ m_value.ident = CSSValueRepeat;
+ break;
+ case RepeatXFill:
+ m_value.ident = CSSValueRepeatX;
+ break;
+ case RepeatYFill:
+ m_value.ident = CSSValueRepeatY;
+ break;
+ case NoRepeatFill:
+ m_value.ident = CSSValueNoRepeat;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EFillRepeat() const
+{
+ switch (m_value.ident) {
+ case CSSValueRepeat:
+ return RepeatFill;
+ case CSSValueRepeatX:
+ return RepeatXFill;
+ case CSSValueRepeatY:
+ return RepeatYFill;
+ case CSSValueNoRepeat:
+ return NoRepeatFill;
+ default:
+ ASSERT_NOT_REACHED();
+ return RepeatFill;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxAlignment e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case BSTRETCH:
+ m_value.ident = CSSValueStretch;
+ break;
+ case BSTART:
+ m_value.ident = CSSValueStart;
+ break;
+ case BCENTER:
+ m_value.ident = CSSValueCenter;
+ break;
+ case BEND:
+ m_value.ident = CSSValueEnd;
+ break;
+ case BBASELINE:
+ m_value.ident = CSSValueBaseline;
+ break;
+ case BJUSTIFY:
+ m_value.ident = CSSValueJustify;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EBoxAlignment() const
+{
+ switch (m_value.ident) {
+ case CSSValueStretch:
+ return BSTRETCH;
+ case CSSValueStart:
+ return BSTART;
+ case CSSValueEnd:
+ return BEND;
+ case CSSValueCenter:
+ return BCENTER;
+ case CSSValueBaseline:
+ return BBASELINE;
+ case CSSValueJustify:
+ return BJUSTIFY;
+ default:
+ ASSERT_NOT_REACHED();
+ return BSTRETCH;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxDirection e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case BNORMAL:
+ m_value.ident = CSSValueNormal;
+ break;
+ case BREVERSE:
+ m_value.ident = CSSValueReverse;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EBoxDirection() const
+{
+ switch (m_value.ident) {
+ case CSSValueNormal:
+ return BNORMAL;
+ case CSSValueReverse:
+ return BREVERSE;
+ default:
+ ASSERT_NOT_REACHED();
+ return BNORMAL;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxLines e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case SINGLE:
+ m_value.ident = CSSValueSingle;
+ break;
+ case MULTIPLE:
+ m_value.ident = CSSValueMultiple;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EBoxLines() const
+{
+ switch (m_value.ident) {
+ case CSSValueSingle:
+ return SINGLE;
+ case CSSValueMultiple:
+ return MULTIPLE;
+ default:
+ ASSERT_NOT_REACHED();
+ return SINGLE;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxOrient e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case HORIZONTAL:
+ m_value.ident = CSSValueHorizontal;
+ break;
+ case VERTICAL:
+ m_value.ident = CSSValueVertical;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EBoxOrient() const
+{
+ switch (m_value.ident) {
+ case CSSValueHorizontal:
+ case CSSValueInlineAxis:
+ return HORIZONTAL;
+ case CSSValueVertical:
+ return VERTICAL;
+ default:
+ ASSERT_NOT_REACHED();
+ return HORIZONTAL;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ECaptionSide e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case CAPLEFT:
+ m_value.ident = CSSValueLeft;
+ break;
+ case CAPRIGHT:
+ m_value.ident = CSSValueRight;
+ break;
+ case CAPTOP:
+ m_value.ident = CSSValueTop;
+ break;
+ case CAPBOTTOM:
+ m_value.ident = CSSValueBottom;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator ECaptionSide() const
+{
+ switch (m_value.ident) {
+ case CSSValueLeft:
+ return CAPLEFT;
+ case CSSValueRight:
+ return CAPRIGHT;
+ case CSSValueTop:
+ return CAPTOP;
+ case CSSValueBottom:
+ return CAPBOTTOM;
+ default:
+ ASSERT_NOT_REACHED();
+ return CAPTOP;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EClear e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case CNONE:
+ m_value.ident = CSSValueNone;
+ break;
+ case CLEFT:
+ m_value.ident = CSSValueLeft;
+ break;
+ case CRIGHT:
+ m_value.ident = CSSValueRight;
+ break;
+ case CBOTH:
+ m_value.ident = CSSValueBoth;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EClear() const
+{
+ switch (m_value.ident) {
+ case CSSValueNone:
+ return CNONE;
+ case CSSValueLeft:
+ return CLEFT;
+ case CSSValueRight:
+ return CRIGHT;
+ case CSSValueBoth:
+ return CBOTH;
+ default:
+ ASSERT_NOT_REACHED();
+ return CNONE;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ECursor e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case CURSOR_AUTO:
+ m_value.ident = CSSValueAuto;
+ break;
+ case CURSOR_CROSS:
+ m_value.ident = CSSValueCrosshair;
+ break;
+ case CURSOR_DEFAULT:
+ m_value.ident = CSSValueDefault;
+ break;
+ case CURSOR_POINTER:
+ m_value.ident = CSSValuePointer;
+ break;
+ case CURSOR_MOVE:
+ m_value.ident = CSSValueMove;
+ break;
+ case CURSOR_CELL:
+ m_value.ident = CSSValueCell;
+ break;
+ case CURSOR_VERTICAL_TEXT:
+ m_value.ident = CSSValueVerticalText;
+ break;
+ case CURSOR_CONTEXT_MENU:
+ m_value.ident = CSSValueContextMenu;
+ break;
+ case CURSOR_ALIAS:
+ m_value.ident = CSSValueAlias;
+ break;
+ case CURSOR_COPY:
+ m_value.ident = CSSValueCopy;
+ break;
+ case CURSOR_NONE:
+ m_value.ident = CSSValueNone;
+ break;
+ case CURSOR_PROGRESS:
+ m_value.ident = CSSValueProgress;
+ break;
+ case CURSOR_NO_DROP:
+ m_value.ident = CSSValueNoDrop;
+ break;
+ case CURSOR_NOT_ALLOWED:
+ m_value.ident = CSSValueNotAllowed;
+ break;
+ case CURSOR_WEBKIT_ZOOM_IN:
+ m_value.ident = CSSValueWebkitZoomIn;
+ break;
+ case CURSOR_WEBKIT_ZOOM_OUT:
+ m_value.ident = CSSValueWebkitZoomOut;
+ break;
+ case CURSOR_E_RESIZE:
+ m_value.ident = CSSValueEResize;
+ break;
+ case CURSOR_NE_RESIZE:
+ m_value.ident = CSSValueNeResize;
+ break;
+ case CURSOR_NW_RESIZE:
+ m_value.ident = CSSValueNwResize;
+ break;
+ case CURSOR_N_RESIZE:
+ m_value.ident = CSSValueNResize;
+ break;
+ case CURSOR_SE_RESIZE:
+ m_value.ident = CSSValueSeResize;
+ break;
+ case CURSOR_SW_RESIZE:
+ m_value.ident = CSSValueSwResize;
+ break;
+ case CURSOR_S_RESIZE:
+ m_value.ident = CSSValueSResize;
+ break;
+ case CURSOR_W_RESIZE:
+ m_value.ident = CSSValueWResize;
+ break;
+ case CURSOR_EW_RESIZE:
+ m_value.ident = CSSValueEwResize;
+ break;
+ case CURSOR_NS_RESIZE:
+ m_value.ident = CSSValueNsResize;
+ break;
+ case CURSOR_NESW_RESIZE:
+ m_value.ident = CSSValueNeswResize;
+ break;
+ case CURSOR_NWSE_RESIZE:
+ m_value.ident = CSSValueNwseResize;
+ break;
+ case CURSOR_COL_RESIZE:
+ m_value.ident = CSSValueColResize;
+ break;
+ case CURSOR_ROW_RESIZE:
+ m_value.ident = CSSValueRowResize;
+ break;
+ case CURSOR_TEXT:
+ m_value.ident = CSSValueText;
+ break;
+ case CURSOR_WAIT:
+ m_value.ident = CSSValueWait;
+ break;
+ case CURSOR_HELP:
+ m_value.ident = CSSValueHelp;
+ break;
+ case CURSOR_ALL_SCROLL:
+ m_value.ident = CSSValueAllScroll;
+ break;
+ case CURSOR_WEBKIT_GRAB:
+ m_value.ident = CSSValueWebkitGrab;
+ break;
+ case CURSOR_WEBKIT_GRABBING:
+ m_value.ident = CSSValueWebkitGrabbing;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator ECursor() const
+{
+ if (m_value.ident == CSSValueCopy)
+ return CURSOR_COPY;
+ if (m_value.ident == CSSValueNone)
+ return CURSOR_NONE;
+ return static_cast<ECursor>(m_value.ident - CSSValueAuto);
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EDisplay e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case INLINE:
+ m_value.ident = CSSValueInline;
+ break;
+ case BLOCK:
+ m_value.ident = CSSValueBlock;
+ break;
+ case LIST_ITEM:
+ m_value.ident = CSSValueListItem;
+ break;
+ case RUN_IN:
+ m_value.ident = CSSValueRunIn;
+ break;
+ case COMPACT:
+ m_value.ident = CSSValueCompact;
+ break;
+ case INLINE_BLOCK:
+ m_value.ident = CSSValueInlineBlock;
+ break;
+ case TABLE:
+ m_value.ident = CSSValueTable;
+ break;
+ case INLINE_TABLE:
+ m_value.ident = CSSValueInlineTable;
+ break;
+ case TABLE_ROW_GROUP:
+ m_value.ident = CSSValueTableRowGroup;
+ break;
+ case TABLE_HEADER_GROUP:
+ m_value.ident = CSSValueTableHeaderGroup;
+ break;
+ case TABLE_FOOTER_GROUP:
+ m_value.ident = CSSValueTableFooterGroup;
+ break;
+ case TABLE_ROW:
+ m_value.ident = CSSValueTableRow;
+ break;
+ case TABLE_COLUMN_GROUP:
+ m_value.ident = CSSValueTableColumnGroup;
+ break;
+ case TABLE_COLUMN:
+ m_value.ident = CSSValueTableColumn;
+ break;
+ case TABLE_CELL:
+ m_value.ident = CSSValueTableCell;
+ break;
+ case TABLE_CAPTION:
+ m_value.ident = CSSValueTableCaption;
+ break;
+ case BOX:
+ m_value.ident = CSSValueWebkitBox;
+ break;
+ case INLINE_BOX:
+ m_value.ident = CSSValueWebkitInlineBox;
+ break;
+ case NONE:
+ m_value.ident = CSSValueNone;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EDisplay() const
+{
+ if (m_value.ident == CSSValueNone)
+ return NONE;
+ return static_cast<EDisplay>(m_value.ident - CSSValueInline);
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EEmptyCell e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case SHOW:
+ m_value.ident = CSSValueShow;
+ break;
+ case HIDE:
+ m_value.ident = CSSValueHide;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EEmptyCell() const
+{
+ switch (m_value.ident) {
+ case CSSValueShow:
+ return SHOW;
+ case CSSValueHide:
+ return HIDE;
+ default:
+ ASSERT_NOT_REACHED();
+ return SHOW;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFloat e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case FNONE:
+ m_value.ident = CSSValueNone;
+ break;
+ case FLEFT:
+ m_value.ident = CSSValueLeft;
+ break;
+ case FRIGHT:
+ m_value.ident = CSSValueRight;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EFloat() const
+{
+ switch (m_value.ident) {
+ case CSSValueLeft:
+ return FLEFT;
+ case CSSValueRight:
+ return FRIGHT;
+ case CSSValueNone:
+ case CSSValueCenter: // Non-standard CSS value
+ return FNONE;
+ default:
+ ASSERT_NOT_REACHED();
+ return FNONE;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EKHTMLLineBreak e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case LBNORMAL:
+ m_value.ident = CSSValueNormal;
+ break;
+ case AFTER_WHITE_SPACE:
+ m_value.ident = CSSValueAfterWhiteSpace;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EKHTMLLineBreak() const
+{
+ switch (m_value.ident) {
+ case CSSValueAfterWhiteSpace:
+ return AFTER_WHITE_SPACE;
+ case CSSValueNormal:
+ return LBNORMAL;
+ default:
+ ASSERT_NOT_REACHED();
+ return LBNORMAL;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStylePosition e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case OUTSIDE:
+ m_value.ident = CSSValueOutside;
+ break;
+ case INSIDE:
+ m_value.ident = CSSValueInside;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EListStylePosition() const
+{
+ return (EListStylePosition)(m_value.ident - CSSValueOutside);
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStyleType e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case LNONE:
+ m_value.ident = CSSValueNone;
+ break;
+ case DISC:
+ m_value.ident = CSSValueDisc;
+ break;
+ case CIRCLE:
+ m_value.ident = CSSValueCircle;
+ break;
+ case SQUARE:
+ m_value.ident = CSSValueSquare;
+ break;
+ case LDECIMAL:
+ m_value.ident = CSSValueDecimal;
+ break;
+ case DECIMAL_LEADING_ZERO:
+ m_value.ident = CSSValueDecimalLeadingZero;
+ break;
+ case LOWER_ROMAN:
+ m_value.ident = CSSValueLowerRoman;
+ break;
+ case UPPER_ROMAN:
+ m_value.ident = CSSValueUpperRoman;
+ break;
+ case LOWER_GREEK:
+ m_value.ident = CSSValueLowerGreek;
+ break;
+ case LOWER_ALPHA:
+ m_value.ident = CSSValueLowerAlpha;
+ break;
+ case LOWER_LATIN:
+ m_value.ident = CSSValueLowerLatin;
+ break;
+ case UPPER_ALPHA:
+ m_value.ident = CSSValueUpperAlpha;
+ break;
+ case UPPER_LATIN:
+ m_value.ident = CSSValueUpperLatin;
+ break;
+ case HEBREW:
+ m_value.ident = CSSValueHebrew;
+ break;
+ case ARMENIAN:
+ m_value.ident = CSSValueArmenian;
+ break;
+ case GEORGIAN:
+ m_value.ident = CSSValueGeorgian;
+ break;
+ case CJK_IDEOGRAPHIC:
+ m_value.ident = CSSValueCjkIdeographic;
+ break;
+ case HIRAGANA:
+ m_value.ident = CSSValueHiragana;
+ break;
+ case KATAKANA:
+ m_value.ident = CSSValueKatakana;
+ break;
+ case HIRAGANA_IROHA:
+ m_value.ident = CSSValueHiraganaIroha;
+ break;
+ case KATAKANA_IROHA:
+ m_value.ident = CSSValueKatakanaIroha;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EListStyleType() const
+{
+ switch (m_value.ident) {
+ case CSSValueNone:
+ return LNONE;
+ default:
+ return static_cast<EListStyleType>(m_value.ident - CSSValueDisc);
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarginCollapse e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case MCOLLAPSE:
+ m_value.ident = CSSValueCollapse;
+ break;
+ case MSEPARATE:
+ m_value.ident = CSSValueSeparate;
+ break;
+ case MDISCARD:
+ m_value.ident = CSSValueDiscard;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EMarginCollapse() const
+{
+ switch (m_value.ident) {
+ case CSSValueCollapse:
+ return MCOLLAPSE;
+ case CSSValueSeparate:
+ return MSEPARATE;
+ case CSSValueDiscard:
+ return MDISCARD;
+ default:
+ ASSERT_NOT_REACHED();
+ return MCOLLAPSE;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarqueeBehavior e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case MNONE:
+ m_value.ident = CSSValueNone;
+ break;
+ case MSCROLL:
+ m_value.ident = CSSValueScroll;
+ break;
+ case MSLIDE:
+ m_value.ident = CSSValueSlide;
+ break;
+ case MALTERNATE:
+ m_value.ident = CSSValueAlternate;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EMarqueeBehavior() const
+{
+ switch (m_value.ident) {
+ case CSSValueNone:
+ return MNONE;
+ case CSSValueScroll:
+ return MSCROLL;
+ case CSSValueSlide:
+ return MSLIDE;
+ case CSSValueAlternate:
+ return MALTERNATE;
+ default:
+ ASSERT_NOT_REACHED();
+ return MNONE;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarqueeDirection e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case MFORWARD:
+ m_value.ident = CSSValueForwards;
+ break;
+ case MBACKWARD:
+ m_value.ident = CSSValueBackwards;
+ break;
+ case MAUTO:
+ m_value.ident = CSSValueAuto;
+ break;
+ case MUP:
+ m_value.ident = CSSValueUp;
+ break;
+ case MDOWN:
+ m_value.ident = CSSValueDown;
+ break;
+ case MLEFT:
+ m_value.ident = CSSValueLeft;
+ break;
+ case MRIGHT:
+ m_value.ident = CSSValueRight;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EMarqueeDirection() const
+{
+ switch (m_value.ident) {
+ case CSSValueForwards:
+ return MFORWARD;
+ case CSSValueBackwards:
+ return MBACKWARD;
+ case CSSValueAuto:
+ return MAUTO;
+ case CSSValueAhead:
+ case CSSValueUp: // We don't support vertical languages, so AHEAD just maps to UP.
+ return MUP;
+ case CSSValueReverse:
+ case CSSValueDown: // REVERSE just maps to DOWN, since we don't do vertical text.
+ return MDOWN;
+ case CSSValueLeft:
+ return MLEFT;
+ case CSSValueRight:
+ return MRIGHT;
+ default:
+ ASSERT_NOT_REACHED();
+ return MAUTO;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMatchNearestMailBlockquoteColor e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case BCNORMAL:
+ m_value.ident = CSSValueNormal;
+ break;
+ case MATCH:
+ m_value.ident = CSSValueMatch;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EMatchNearestMailBlockquoteColor() const
+{
+ switch (m_value.ident) {
+ case CSSValueNormal:
+ return BCNORMAL;
+ case CSSValueMatch:
+ return MATCH;
+ default:
+ ASSERT_NOT_REACHED();
+ return BCNORMAL;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ENBSPMode e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case NBNORMAL:
+ m_value.ident = CSSValueNormal;
+ break;
+ case SPACE:
+ m_value.ident = CSSValueSpace;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator ENBSPMode() const
+{
+ switch (m_value.ident) {
+ case CSSValueSpace:
+ return SPACE;
+ case CSSValueNormal:
+ return NBNORMAL;
+ default:
+ ASSERT_NOT_REACHED();
+ return NBNORMAL;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EOverflow e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case OVISIBLE:
+ m_value.ident = CSSValueVisible;
+ break;
+ case OHIDDEN:
+ m_value.ident = CSSValueHidden;
+ break;
+ case OSCROLL:
+ m_value.ident = CSSValueScroll;
+ break;
+ case OAUTO:
+ m_value.ident = CSSValueAuto;
+ break;
+ case OMARQUEE:
+ m_value.ident = CSSValueWebkitMarquee;
+ break;
+ case OOVERLAY:
+ m_value.ident = CSSValueOverlay;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EOverflow() const
+{
+ switch (m_value.ident) {
+ case CSSValueVisible:
+ return OVISIBLE;
+ case CSSValueHidden:
+ return OHIDDEN;
+ case CSSValueScroll:
+ return OSCROLL;
+ case CSSValueAuto:
+ return OAUTO;
+ case CSSValueWebkitMarquee:
+ return OMARQUEE;
+ case CSSValueOverlay:
+ return OOVERLAY;
+ default:
+ ASSERT_NOT_REACHED();
+ return OVISIBLE;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPageBreak e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case PBAUTO:
+ m_value.ident = CSSValueAuto;
+ break;
+ case PBALWAYS:
+ m_value.ident = CSSValueAlways;
+ break;
+ case PBAVOID:
+ m_value.ident = CSSValueAvoid;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EPageBreak() const
+{
+ switch (m_value.ident) {
+ case CSSValueAuto:
+ return PBAUTO;
+ case CSSValueLeft:
+ case CSSValueRight:
+ case CSSValueAlways:
+ return PBALWAYS; // CSS2.1: "Conforming user agents may map left/right to always."
+ case CSSValueAvoid:
+ return PBAVOID;
+ default:
+ ASSERT_NOT_REACHED();
+ return PBAUTO;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPosition e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case StaticPosition:
+ m_value.ident = CSSValueStatic;
+ break;
+ case RelativePosition:
+ m_value.ident = CSSValueRelative;
+ break;
+ case AbsolutePosition:
+ m_value.ident = CSSValueAbsolute;
+ break;
+ case FixedPosition:
+ m_value.ident = CSSValueFixed;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EPosition() const
+{
+ switch (m_value.ident) {
+ case CSSValueStatic:
+ return StaticPosition;
+ case CSSValueRelative:
+ return RelativePosition;
+ case CSSValueAbsolute:
+ return AbsolutePosition;
+ case CSSValueFixed:
+ return FixedPosition;
+ default:
+ ASSERT_NOT_REACHED();
+ return StaticPosition;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EResize e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case RESIZE_BOTH:
+ m_value.ident = CSSValueBoth;
+ break;
+ case RESIZE_HORIZONTAL:
+ m_value.ident = CSSValueHorizontal;
+ break;
+ case RESIZE_VERTICAL:
+ m_value.ident = CSSValueVertical;
+ break;
+ case RESIZE_NONE:
+ m_value.ident = CSSValueNone;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EResize() const
+{
+ switch (m_value.ident) {
+ case CSSValueBoth:
+ return RESIZE_BOTH;
+ case CSSValueHorizontal:
+ return RESIZE_HORIZONTAL;
+ case CSSValueVertical:
+ return RESIZE_VERTICAL;
+ case CSSValueAuto:
+ ASSERT_NOT_REACHED(); // Depends on settings, thus should be handled by the caller.
+ return RESIZE_NONE;
+ case CSSValueNone:
+ return RESIZE_NONE;
+ default:
+ ASSERT_NOT_REACHED();
+ return RESIZE_NONE;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETableLayout e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case TAUTO:
+ m_value.ident = CSSValueAuto;
+ break;
+ case TFIXED:
+ m_value.ident = CSSValueFixed;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator ETableLayout() const
+{
+ switch (m_value.ident) {
+ case CSSValueFixed:
+ return TFIXED;
+ case CSSValueAuto:
+ return TAUTO;
+ default:
+ ASSERT_NOT_REACHED();
+ return TAUTO;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextAlign e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case TAAUTO:
+ m_value.ident = CSSValueAuto;
+ break;
+ case LEFT:
+ m_value.ident = CSSValueLeft;
+ break;
+ case RIGHT:
+ m_value.ident = CSSValueRight;
+ break;
+ case CENTER:
+ m_value.ident = CSSValueCenter;
+ break;
+ case JUSTIFY:
+ m_value.ident = CSSValueJustify;
+ break;
+ case WEBKIT_LEFT:
+ m_value.ident = CSSValueWebkitLeft;
+ break;
+ case WEBKIT_RIGHT:
+ m_value.ident = CSSValueWebkitRight;
+ break;
+ case WEBKIT_CENTER:
+ m_value.ident = CSSValueWebkitCenter;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator ETextAlign() const
+{
+ switch (m_value.ident) {
+ case CSSValueStart:
+ case CSSValueEnd:
+ ASSERT_NOT_REACHED(); // Depends on direction, thus should be handled by the caller.
+ return LEFT;
+ default:
+ return static_cast<ETextAlign>(m_value.ident - CSSValueWebkitAuto);
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextSecurity e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case TSNONE:
+ m_value.ident = CSSValueNone;
+ break;
+ case TSDISC:
+ m_value.ident = CSSValueDisc;
+ break;
+ case TSCIRCLE:
+ m_value.ident = CSSValueCircle;
+ break;
+ case TSSQUARE:
+ m_value.ident = CSSValueSquare;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator ETextSecurity() const
+{
+ switch (m_value.ident) {
+ case CSSValueNone:
+ return TSNONE;
+ case CSSValueDisc:
+ return TSDISC;
+ case CSSValueCircle:
+ return TSCIRCLE;
+ case CSSValueSquare:
+ return TSSQUARE;
+ default:
+ ASSERT_NOT_REACHED();
+ return TSNONE;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextTransform e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case CAPITALIZE:
+ m_value.ident = CSSValueCapitalize;
+ break;
+ case UPPERCASE:
+ m_value.ident = CSSValueUppercase;
+ break;
+ case LOWERCASE:
+ m_value.ident = CSSValueLowercase;
+ break;
+ case TTNONE:
+ m_value.ident = CSSValueNone;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator ETextTransform() const
+{
+ switch (m_value.ident) {
+ case CSSValueCapitalize:
+ return CAPITALIZE;
+ case CSSValueUppercase:
+ return UPPERCASE;
+ case CSSValueLowercase:
+ return LOWERCASE;
+ case CSSValueNone:
+ return TTNONE;
+ default:
+ ASSERT_NOT_REACHED();
+ return TTNONE;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUnicodeBidi e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case UBNormal:
+ m_value.ident = CSSValueNormal;
+ break;
+ case Embed:
+ m_value.ident = CSSValueEmbed;
+ break;
+ case Override:
+ m_value.ident = CSSValueBidiOverride;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EUnicodeBidi() const
+{
+ switch (m_value.ident) {
+ case CSSValueNormal:
+ return UBNormal;
+ case CSSValueEmbed:
+ return Embed;
+ case CSSValueBidiOverride:
+ return Override;
+ default:
+ ASSERT_NOT_REACHED();
+ return UBNormal;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserDrag e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case DRAG_AUTO:
+ m_value.ident = CSSValueAuto;
+ break;
+ case DRAG_NONE:
+ m_value.ident = CSSValueNone;
+ break;
+ case DRAG_ELEMENT:
+ m_value.ident = CSSValueElement;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EUserDrag() const
+{
+ switch (m_value.ident) {
+ case CSSValueAuto:
+ return DRAG_AUTO;
+ case CSSValueNone:
+ return DRAG_NONE;
+ case CSSValueElement:
+ return DRAG_ELEMENT;
+ default:
+ ASSERT_NOT_REACHED();
+ return DRAG_AUTO;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserModify e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case READ_ONLY:
+ m_value.ident = CSSValueReadOnly;
+ break;
+ case READ_WRITE:
+ m_value.ident = CSSValueReadWrite;
+ break;
+ case READ_WRITE_PLAINTEXT_ONLY:
+ m_value.ident = CSSValueReadWritePlaintextOnly;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EUserModify() const
+{
+ return static_cast<EUserModify>(m_value.ident - CSSValueReadOnly);
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserSelect e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case SELECT_NONE:
+ m_value.ident = CSSValueNone;
+ break;
+ case SELECT_TEXT:
+ m_value.ident = CSSValueText;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EUserSelect() const
+{
+ switch (m_value.ident) {
+ case CSSValueAuto:
+ return SELECT_TEXT;
+ case CSSValueNone:
+ return SELECT_NONE;
+ case CSSValueText:
+ return SELECT_TEXT;
+ default:
+ ASSERT_NOT_REACHED();
+ return SELECT_TEXT;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EVisibility e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case VISIBLE:
+ m_value.ident = CSSValueVisible;
+ break;
+ case HIDDEN:
+ m_value.ident = CSSValueHidden;
+ break;
+ case COLLAPSE:
+ m_value.ident = CSSValueCollapse;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EVisibility() const
+{
+ switch (m_value.ident) {
+ case CSSValueHidden:
+ return HIDDEN;
+ case CSSValueVisible:
+ return VISIBLE;
+ case CSSValueCollapse:
+ return COLLAPSE;
+ default:
+ ASSERT_NOT_REACHED();
+ return VISIBLE;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWhiteSpace e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case NORMAL:
+ m_value.ident = CSSValueNormal;
+ break;
+ case PRE:
+ m_value.ident = CSSValuePre;
+ break;
+ case PRE_WRAP:
+ m_value.ident = CSSValuePreWrap;
+ break;
+ case PRE_LINE:
+ m_value.ident = CSSValuePreLine;
+ break;
+ case NOWRAP:
+ m_value.ident = CSSValueNowrap;
+ break;
+ case KHTML_NOWRAP:
+ m_value.ident = CSSValueWebkitNowrap;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EWhiteSpace() const
+{
+ switch (m_value.ident) {
+ case CSSValueWebkitNowrap:
+ return KHTML_NOWRAP;
+ case CSSValueNowrap:
+ return NOWRAP;
+ case CSSValuePre:
+ return PRE;
+ case CSSValuePreWrap:
+ return PRE_WRAP;
+ case CSSValuePreLine:
+ return PRE_LINE;
+ case CSSValueNormal:
+ return NORMAL;
+ default:
+ ASSERT_NOT_REACHED();
+ return NORMAL;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWordBreak e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case NormalWordBreak:
+ m_value.ident = CSSValueNormal;
+ break;
+ case BreakAllWordBreak:
+ m_value.ident = CSSValueBreakAll;
+ break;
+ case BreakWordBreak:
+ m_value.ident = CSSValueBreakWord;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EWordBreak() const
+{
+ switch (m_value.ident) {
+ case CSSValueBreakAll:
+ return BreakAllWordBreak;
+ case CSSValueBreakWord:
+ return BreakWordBreak;
+ case CSSValueNormal:
+ return NormalWordBreak;
+ default:
+ ASSERT_NOT_REACHED();
+ return NormalWordBreak;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWordWrap e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case NormalWordWrap:
+ m_value.ident = CSSValueNormal;
+ break;
+ case BreakWordWrap:
+ m_value.ident = CSSValueBreakWord;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EWordWrap() const
+{
+ switch (m_value.ident) {
+ case CSSValueBreakWord:
+ return BreakWordWrap;
+ case CSSValueNormal:
+ return NormalWordWrap;
+ default:
+ ASSERT_NOT_REACHED();
+ return NormalWordWrap;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextDirection e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case LTR:
+ m_value.ident = CSSValueLtr;
+ break;
+ case RTL:
+ m_value.ident = CSSValueRtl;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator TextDirection() const
+{
+ switch (m_value.ident) {
+ case CSSValueLtr:
+ return LTR;
+ case CSSValueRtl:
+ return RTL;
+ default:
+ ASSERT_NOT_REACHED();
+ return LTR;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPointerEvents e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case PE_NONE:
+ m_value.ident = CSSValueNone;
+ break;
+ case PE_STROKE:
+ m_value.ident = CSSValueStroke;
+ break;
+ case PE_FILL:
+ m_value.ident = CSSValueFill;
+ break;
+ case PE_PAINTED:
+ m_value.ident = CSSValuePainted;
+ break;
+ case PE_VISIBLE:
+ m_value.ident = CSSValueVisible;
+ break;
+ case PE_VISIBLE_STROKE:
+ m_value.ident = CSSValueVisiblestroke;
+ break;
+ case PE_VISIBLE_FILL:
+ m_value.ident = CSSValueVisiblefill;
+ break;
+ case PE_VISIBLE_PAINTED:
+ m_value.ident = CSSValueVisiblepainted;
+ break;
+ case PE_AUTO:
+ m_value.ident = CSSValueAuto;
+ break;
+ case PE_ALL:
+ m_value.ident = CSSValueAll;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EPointerEvents() const
+{
+ switch (m_value.ident) {
+ case CSSValueAll:
+ return PE_ALL;
+ case CSSValueAuto:
+ return PE_AUTO;
+ case CSSValueNone:
+ return PE_NONE;
+ case CSSValueVisiblepainted:
+ return PE_VISIBLE_PAINTED;
+ case CSSValueVisiblefill:
+ return PE_VISIBLE_FILL;
+ case CSSValueVisiblestroke:
+ return PE_VISIBLE_STROKE;
+ case CSSValueVisible:
+ return PE_VISIBLE;
+ case CSSValuePainted:
+ return PE_PAINTED;
+ case CSSValueFill:
+ return PE_FILL;
+ case CSSValueStroke:
+ return PE_STROKE;
+ default:
+ ASSERT_NOT_REACHED();
+ return PE_ALL;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EImageLoadingBorder e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case IMAGE_LOADING_BORDER_NONE:
+ m_value.ident = CSSValueNone;
+ break;
+ case IMAGE_LOADING_BORDER_OUTLINE:
+ m_value.ident = CSSValueWebkitLoadingOutline;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EImageLoadingBorder() const
+{
+ switch (m_value.ident) {
+ case CSSValueNone:
+ return IMAGE_LOADING_BORDER_NONE;
+ case CSSValueWebkitLoadingOutline:
+ return IMAGE_LOADING_BORDER_OUTLINE;
+ default:
+ ASSERT_NOT_REACHED();
+ return IMAGE_LOADING_BORDER_NONE;
+ }
+}
+
+#if ENABLE(SVG)
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineCap e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case ButtCap:
+ m_value.ident = CSSValueButt;
+ break;
+ case RoundCap:
+ m_value.ident = CSSValueRound;
+ break;
+ case SquareCap:
+ m_value.ident = CSSValueSquare;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator LineCap() const
+{
+ switch (m_value.ident) {
+ case CSSValueButt:
+ return ButtCap;
+ case CSSValueRound:
+ return RoundCap;
+ case CSSValueSquare:
+ return SquareCap;
+ default:
+ ASSERT_NOT_REACHED();
+ return ButtCap;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineJoin e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case MiterJoin:
+ m_value.ident = CSSValueMiter;
+ break;
+ case RoundJoin:
+ m_value.ident = CSSValueRound;
+ break;
+ case BevelJoin:
+ m_value.ident = CSSValueBevel;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator LineJoin() const
+{
+ switch (m_value.ident) {
+ case CSSValueMiter:
+ return MiterJoin;
+ case CSSValueRound:
+ return RoundJoin;
+ case CSSValueBevel:
+ return BevelJoin;
+ default:
+ ASSERT_NOT_REACHED();
+ return MiterJoin;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WindRule e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case RULE_NONZERO:
+ m_value.ident = CSSValueNonzero;
+ break;
+ case RULE_EVENODD:
+ m_value.ident = CSSValueEvenodd;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator WindRule() const
+{
+ switch (m_value.ident) {
+ case CSSValueNonzero:
+ return RULE_NONZERO;
+ case CSSValueEvenodd:
+ return RULE_EVENODD;
+ default:
+ ASSERT_NOT_REACHED();
+ return RULE_NONZERO;
+ }
+}
+
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EAlignmentBaseline e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case AB_AUTO:
+ m_value.ident = CSSValueAuto;
+ break;
+ case AB_BASELINE:
+ m_value.ident = CSSValueBaseline;
+ break;
+ case AB_BEFORE_EDGE:
+ m_value.ident = CSSValueBeforeEdge;
+ break;
+ case AB_TEXT_BEFORE_EDGE:
+ m_value.ident = CSSValueTextBeforeEdge;
+ break;
+ case AB_MIDDLE:
+ m_value.ident = CSSValueMiddle;
+ break;
+ case AB_CENTRAL:
+ m_value.ident = CSSValueCentral;
+ break;
+ case AB_AFTER_EDGE:
+ m_value.ident = CSSValueAfterEdge;
+ break;
+ case AB_TEXT_AFTER_EDGE:
+ m_value.ident = CSSValueTextAfterEdge;
+ break;
+ case AB_IDEOGRAPHIC:
+ m_value.ident = CSSValueIdeographic;
+ break;
+ case AB_ALPHABETIC:
+ m_value.ident = CSSValueAlphabetic;
+ break;
+ case AB_HANGING:
+ m_value.ident = CSSValueHanging;
+ break;
+ case AB_MATHEMATICAL:
+ m_value.ident = CSSValueMathematical;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EAlignmentBaseline() const
+{
+ switch (m_value.ident) {
+ case CSSValueAuto:
+ return AB_AUTO;
+ case CSSValueBaseline:
+ return AB_BASELINE;
+ case CSSValueBeforeEdge:
+ return AB_BEFORE_EDGE;
+ case CSSValueTextBeforeEdge:
+ return AB_TEXT_BEFORE_EDGE;
+ case CSSValueMiddle:
+ return AB_MIDDLE;
+ case CSSValueCentral:
+ return AB_CENTRAL;
+ case CSSValueAfterEdge:
+ return AB_AFTER_EDGE;
+ case CSSValueTextAfterEdge:
+ return AB_TEXT_AFTER_EDGE;
+ case CSSValueIdeographic:
+ return AB_IDEOGRAPHIC;
+ case CSSValueAlphabetic:
+ return AB_ALPHABETIC;
+ case CSSValueHanging:
+ return AB_HANGING;
+ case CSSValueMathematical:
+ return AB_MATHEMATICAL;
+ default:
+ ASSERT_NOT_REACHED();
+ return AB_AUTO;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EColorInterpolation e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case CI_AUTO:
+ m_value.ident = CSSValueAuto;
+ break;
+ case CI_SRGB:
+ m_value.ident = CSSValueSrgb;
+ break;
+ case CI_LINEARRGB:
+ m_value.ident = CSSValueLinearrgb;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EColorInterpolation() const
+{
+ switch (m_value.ident) {
+ case CSSValueSrgb:
+ return CI_SRGB;
+ case CSSValueLinearrgb:
+ return CI_LINEARRGB;
+ case CSSValueAuto:
+ return CI_AUTO;
+ default:
+ ASSERT_NOT_REACHED();
+ return CI_AUTO;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EColorRendering e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case CR_AUTO:
+ m_value.ident = CSSValueAuto;
+ break;
+ case CR_OPTIMIZESPEED:
+ m_value.ident = CSSValueOptimizespeed;
+ break;
+ case CR_OPTIMIZEQUALITY:
+ m_value.ident = CSSValueOptimizequality;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EColorRendering() const
+{
+ switch (m_value.ident) {
+ case CSSValueOptimizespeed:
+ return CR_OPTIMIZESPEED;
+ case CSSValueOptimizequality:
+ return CR_OPTIMIZEQUALITY;
+ case CSSValueAuto:
+ return CR_AUTO;
+ default:
+ ASSERT_NOT_REACHED();
+ return CR_AUTO;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EDominantBaseline e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case DB_AUTO:
+ m_value.ident = CSSValueAuto;
+ break;
+ case DB_USE_SCRIPT:
+ m_value.ident = CSSValueUseScript;
+ break;
+ case DB_NO_CHANGE:
+ m_value.ident = CSSValueNoChange;
+ break;
+ case DB_RESET_SIZE:
+ m_value.ident = CSSValueResetSize;
+ break;
+ case DB_CENTRAL:
+ m_value.ident = CSSValueCentral;
+ break;
+ case DB_MIDDLE:
+ m_value.ident = CSSValueMiddle;
+ break;
+ case DB_TEXT_BEFORE_EDGE:
+ m_value.ident = CSSValueTextBeforeEdge;
+ break;
+ case DB_TEXT_AFTER_EDGE:
+ m_value.ident = CSSValueTextAfterEdge;
+ break;
+ case DB_IDEOGRAPHIC:
+ m_value.ident = CSSValueIdeographic;
+ break;
+ case DB_ALPHABETIC:
+ m_value.ident = CSSValueAlphabetic;
+ break;
+ case DB_HANGING:
+ m_value.ident = CSSValueHanging;
+ break;
+ case DB_MATHEMATICAL:
+ m_value.ident = CSSValueMathematical;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EDominantBaseline() const
+{
+ switch (m_value.ident) {
+ case CSSValueAuto:
+ return DB_AUTO;
+ case CSSValueUseScript:
+ return DB_USE_SCRIPT;
+ case CSSValueNoChange:
+ return DB_NO_CHANGE;
+ case CSSValueResetSize:
+ return DB_RESET_SIZE;
+ case CSSValueIdeographic:
+ return DB_IDEOGRAPHIC;
+ case CSSValueAlphabetic:
+ return DB_ALPHABETIC;
+ case CSSValueHanging:
+ return DB_HANGING;
+ case CSSValueMathematical:
+ return DB_MATHEMATICAL;
+ case CSSValueCentral:
+ return DB_CENTRAL;
+ case CSSValueMiddle:
+ return DB_MIDDLE;
+ case CSSValueTextAfterEdge:
+ return DB_TEXT_AFTER_EDGE;
+ case CSSValueTextBeforeEdge:
+ return DB_TEXT_BEFORE_EDGE;
+ default:
+ ASSERT_NOT_REACHED();
+ return DB_AUTO;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EImageRendering e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case IR_AUTO:
+ m_value.ident = CSSValueAuto;
+ break;
+ case IR_OPTIMIZESPEED:
+ m_value.ident = CSSValueOptimizespeed;
+ break;
+ case IR_OPTIMIZEQUALITY:
+ m_value.ident = CSSValueOptimizequality;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EImageRendering() const
+{
+ switch (m_value.ident) {
+ case CSSValueAuto:
+ return IR_AUTO;
+ case CSSValueOptimizespeed:
+ return IR_OPTIMIZESPEED;
+ case CSSValueOptimizequality:
+ return IR_OPTIMIZEQUALITY;
+ default:
+ ASSERT_NOT_REACHED();
+ return IR_AUTO;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EShapeRendering e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case IR_AUTO:
+ m_value.ident = CSSValueAuto;
+ break;
+ case IR_OPTIMIZESPEED:
+ m_value.ident = CSSValueOptimizespeed;
+ break;
+ case SR_CRISPEDGES:
+ m_value.ident = CSSValueCrispedges;
+ break;
+ case SR_GEOMETRICPRECISION:
+ m_value.ident = CSSValueGeometricprecision;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EShapeRendering() const
+{
+ switch (m_value.ident) {
+ case CSSValueAuto:
+ return SR_AUTO;
+ case CSSValueOptimizespeed:
+ return SR_OPTIMIZESPEED;
+ case CSSValueCrispedges:
+ return SR_CRISPEDGES;
+ case CSSValueGeometricprecision:
+ return SR_GEOMETRICPRECISION;
+ default:
+ ASSERT_NOT_REACHED();
+ return SR_AUTO;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextAnchor e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case TA_START:
+ m_value.ident = CSSValueStart;
+ break;
+ case TA_MIDDLE:
+ m_value.ident = CSSValueMiddle;
+ break;
+ case TA_END:
+ m_value.ident = CSSValueEnd;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator ETextAnchor() const
+{
+ switch (m_value.ident) {
+ case CSSValueStart:
+ return TA_START;
+ case CSSValueMiddle:
+ return TA_MIDDLE;
+ case CSSValueEnd:
+ return TA_END;
+ default:
+ ASSERT_NOT_REACHED();
+ return TA_START;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextRendering e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case TR_AUTO:
+ m_value.ident = CSSValueAuto;
+ break;
+ case TR_OPTIMIZESPEED:
+ m_value.ident = CSSValueOptimizespeed;
+ break;
+ case TR_OPTIMIZELEGIBILITY:
+ m_value.ident = CSSValueOptimizelegibility;
+ break;
+ case TR_GEOMETRICPRECISION:
+ m_value.ident = CSSValueGeometricprecision;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator ETextRendering() const
+{
+ switch (m_value.ident) {
+ case CSSValueAuto:
+ return TR_AUTO;
+ case CSSValueOptimizespeed:
+ return TR_OPTIMIZESPEED;
+ case CSSValueOptimizelegibility:
+ return TR_OPTIMIZELEGIBILITY;
+ case CSSValueGeometricprecision:
+ return TR_GEOMETRICPRECISION;
+ default:
+ ASSERT_NOT_REACHED();
+ return TR_AUTO;
+ }
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWritingMode e)
+ : m_type(CSS_IDENT)
+{
+ switch (e) {
+ case WM_LRTB:
+ m_value.ident = CSSValueLrTb;
+ break;
+ case WM_LR:
+ m_value.ident = CSSValueLr;
+ break;
+ case WM_RLTB:
+ m_value.ident = CSSValueRlTb;
+ break;
+ case WM_RL:
+ m_value.ident = CSSValueRl;
+ break;
+ case WM_TBRL:
+ m_value.ident = CSSValueTbRl;
+ break;
+ case WM_TB:
+ m_value.ident = CSSValueTb;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator EWritingMode() const
+{
+ return static_cast<EWritingMode>(m_value.ident - CSSValueLrTb);
+}
+
+#endif
+
+}
+
+#endif
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSProperty_h
+#define CSSProperty_h
+
+#include "CSSValue.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class CSSProperty {
+public:
+ CSSProperty(int propID, PassRefPtr<CSSValue> value, bool important = false, int shorthandID = 0, bool implicit = false)
+ : m_id(propID)
+ , m_shorthandID(shorthandID)
+ , m_important(important)
+ , m_implicit(implicit)
+ , m_value(value)
+ {
+ }
+
+ CSSProperty& operator=(const CSSProperty& other)
+ {
+ m_id = other.m_id;
+ m_shorthandID = other.m_shorthandID;
+ m_important = other.m_important;
+ m_implicit = other.m_implicit;
+ m_value = other.m_value;
+ return *this;
+ }
+
+ int id() const { return m_id; }
+ int shorthandID() const { return m_shorthandID; }
+
+ bool isImportant() const { return m_important; }
+ bool isImplicit() const { return m_implicit; }
+
+ CSSValue* value() const { return m_value.get(); }
+
+ String cssText() const;
+
+ friend bool operator==(const CSSProperty&, const CSSProperty&);
+
+ // Make sure the following fits in 4 bytes. Really.
+ int m_id : 15;
+ int m_shorthandID : 15; // If this property was set as part of a shorthand, gives the shorthand.
+ bool m_important : 1;
+ bool m_implicit : 1; // Whether or not the property was set implicitly as the result of a shorthand.
+
+ RefPtr<CSSValue> m_value;
+};
+
+} // namespace WebCore
+
+namespace WTF {
+ // Properties in Vector can be initialized with memset and moved using memcpy.
+ template<> struct VectorTraits<WebCore::CSSProperty> : SimpleClassVectorTraits { };
+}
+
+#endif // CSSProperty_h
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSPropertyLonghand_h
+#define CSSPropertyLonghand_h
+
+namespace WebCore {
+
+class CSSPropertyLonghand {
+public:
+ CSSPropertyLonghand()
+ : m_properties(0)
+ , m_length(0)
+ {
+ }
+
+ CSSPropertyLonghand(const int* firstProperty, unsigned numProperties)
+ : m_properties(firstProperty)
+ , m_length(numProperties)
+ {
+ }
+
+ const int* properties() const { return m_properties; }
+ unsigned length() const { return m_length; }
+
+private:
+ const int* m_properties;
+ unsigned m_length;
+};
+
+// Returns an empty list if the property is not a shorthand
+CSSPropertyLonghand longhandForProperty(int);
+
+} // namespace WebCore
+
+#endif // CSSPropertyLonghand_h
--- /dev/null
+#
+# CSS property names
+#
+# Some properties are used internally, but are not part of CSS. They are used to get
+# HTML4 compatibility in the rendering engine.
+#
+# Microsoft extensions are documented here:
+# http://msdn.microsoft.com/workshop/author/css/reference/attributes.asp
+#
+
+background
+background-attachment
+background-color
+background-image
+background-position
+background-position-x
+background-position-y
+background-repeat
+border
+border-bottom
+border-bottom-color
+border-bottom-style
+border-bottom-width
+border-collapse
+border-color
+border-left
+border-left-color
+border-left-style
+border-left-width
+border-right
+border-right-color
+border-right-style
+border-right-width
+border-spacing
+border-style
+border-top
+border-top-color
+border-top-style
+border-top-width
+border-width
+bottom
+caption-side
+clear
+clip
+color
+content
+counter-increment
+counter-reset
+cursor
+direction
+display
+empty-cells
+float
+font
+font-family
+font-size
+font-stretch
+font-style
+font-variant
+font-weight
+height
+left
+letter-spacing
+line-height
+list-style
+list-style-image
+list-style-position
+list-style-type
+margin
+margin-bottom
+margin-left
+margin-right
+margin-top
+max-height
+max-width
+min-height
+min-width
+opacity
+orphans
+outline
+outline-color
+outline-offset
+outline-style
+outline-width
+overflow
+overflow-x
+overflow-y
+padding
+padding-bottom
+padding-left
+padding-right
+padding-top
+page
+page-break-after
+page-break-before
+page-break-inside
+pointer-events
+position
+quotes
+resize
+right
+scrollbar-3dlight-color
+scrollbar-arrow-color
+scrollbar-darkshadow-color
+scrollbar-face-color
+scrollbar-highlight-color
+scrollbar-shadow-color
+scrollbar-track-color
+size
+src
+table-layout
+text-align
+text-decoration
+text-indent
+text-line-through
+text-line-through-color
+text-line-through-mode
+text-line-through-style
+text-line-through-width
+text-overflow
+text-overline
+text-overline-color
+text-overline-mode
+text-overline-style
+text-overline-width
+text-shadow
+text-transform
+text-underline
+text-underline-color
+text-underline-mode
+text-underline-style
+text-underline-width
+top
+unicode-bidi
+unicode-range
+vertical-align
+visibility
+white-space
+widows
+width
+word-break
+word-spacing
+word-wrap
+z-index
+zoom
+-webkit-animation
+-webkit-animation-delay
+-webkit-animation-direction
+-webkit-animation-duration
+-webkit-animation-iteration-count
+-webkit-animation-name
+-webkit-animation-play-state
+-webkit-animation-timing-function
+-webkit-appearance
+-webkit-backface-visibility
+-webkit-background-clip
+-webkit-background-composite
+-webkit-background-origin
+-webkit-background-size
+-webkit-binding
+-webkit-border-bottom-left-radius
+-webkit-border-bottom-right-radius
+-webkit-border-fit
+-webkit-border-horizontal-spacing
+-webkit-border-image
+-webkit-border-radius
+-webkit-border-top-left-radius
+-webkit-border-top-right-radius
+-webkit-border-vertical-spacing
+-webkit-box-align
+-webkit-box-direction
+-webkit-box-flex
+-webkit-box-flex-group
+-webkit-box-lines
+-webkit-box-ordinal-group
+-webkit-box-orient
+-webkit-box-pack
+-webkit-box-reflect
+-webkit-box-shadow
+-webkit-box-sizing
+-webkit-column-break-after
+-webkit-column-break-before
+-webkit-column-break-inside
+-webkit-column-count
+-webkit-column-gap
+-webkit-column-rule
+-webkit-column-rule-color
+-webkit-column-rule-style
+-webkit-column-rule-width
+-webkit-column-width
+-webkit-columns
+-webkit-font-size-delta
+-webkit-highlight
+-webkit-image-loading-border
+-webkit-line-break
+-webkit-line-clamp
+-webkit-margin-bottom-collapse
+-webkit-margin-collapse
+-webkit-margin-start
+-webkit-margin-top-collapse
+-webkit-marquee
+-webkit-marquee-direction
+-webkit-marquee-increment
+-webkit-marquee-repetition
+-webkit-marquee-speed
+-webkit-marquee-style
+-webkit-mask
+-webkit-mask-attachment
+-webkit-mask-box-image
+-webkit-mask-clip
+-webkit-mask-composite
+-webkit-mask-image
+-webkit-mask-origin
+-webkit-mask-position
+-webkit-mask-position-x
+-webkit-mask-position-y
+-webkit-mask-repeat
+-webkit-mask-size
+-webkit-match-nearest-mail-blockquote-color
+-webkit-nbsp-mode
+-webkit-padding-start
+-webkit-perspective
+-webkit-perspective-origin
+-webkit-perspective-origin-x
+-webkit-perspective-origin-y
+-webkit-rtl-ordering
+-webkit-text-decorations-in-effect
+-webkit-text-fill-color
+-webkit-text-security
+-webkit-text-size-adjust
+-webkit-text-stroke
+-webkit-text-stroke-color
+-webkit-text-stroke-width
+-webkit-transform
+-webkit-transform-origin
+-webkit-transform-origin-x
+-webkit-transform-origin-y
+-webkit-transform-origin-z
+-webkit-transform-style
+-webkit-transition
+-webkit-transition-delay
+-webkit-transition-duration
+-webkit-transition-property
+-webkit-transition-timing-function
+-webkit-user-drag
+-webkit-user-modify
+-webkit-user-select
+-webkit-variable-declaration-block
+-webkit-touch-callout
+-webkit-tap-highlight-color
+-webkit-composition-fill-color
+-webkit-composition-frame-color
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSQuirkPrimitiveValue_h
+#define CSSQuirkPrimitiveValue_h
+
+#include "CSSPrimitiveValue.h"
+
+namespace WebCore {
+
+// This value is used to handle quirky margins in reflow roots (body, td, and th) like WinIE.
+// The basic idea is that a stylesheet can use the value __qem (for quirky em) instead of em.
+// When the quirky value is used, if you're in quirks mode, the margin will collapse away
+// inside a table cell.
+class CSSQuirkPrimitiveValue : public CSSPrimitiveValue {
+public:
+ static PassRefPtr<CSSQuirkPrimitiveValue> create(double value, UnitTypes type)
+ {
+ return adoptRef(new CSSQuirkPrimitiveValue(value, type));
+ }
+
+private:
+ CSSQuirkPrimitiveValue(double num, UnitTypes type)
+ : CSSPrimitiveValue(num, type)
+ {
+ }
+
+ virtual bool isQuirkValue() { return true; }
+};
+
+} // namespace WebCore
+
+#endif // CSSQuirkPrimitiveValue_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CSSReflectValue_h
+#define CSSReflectValue_h
+
+#include "CSSReflectionDirection.h"
+#include "CSSValue.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class CSSPrimitiveValue;
+
+class CSSReflectValue : public CSSValue {
+public:
+ static PassRefPtr<CSSReflectValue> create(CSSReflectionDirection direction,
+ PassRefPtr<CSSPrimitiveValue> offset, PassRefPtr<CSSValue> mask)
+ {
+ return adoptRef(new CSSReflectValue(direction, offset, mask));
+ }
+
+ CSSReflectionDirection direction() const { return m_direction; }
+ CSSPrimitiveValue* offset() const { return m_offset.get(); }
+ CSSValue* mask() const { return m_mask.get(); }
+
+ virtual String cssText() const;
+
+ virtual void addSubresourceStyleURLs(ListHashSet<KURL>&, const CSSStyleSheet*);
+
+private:
+ CSSReflectValue(CSSReflectionDirection direction,
+ PassRefPtr<CSSPrimitiveValue> offset, PassRefPtr<CSSValue> mask)
+ : m_direction(direction)
+ , m_offset(offset)
+ , m_mask(mask)
+ {
+ }
+
+ CSSReflectionDirection m_direction;
+ RefPtr<CSSPrimitiveValue> m_offset;
+ RefPtr<CSSValue> m_mask;
+};
+
+} // namespace WebCore
+
+#endif // CSSReflectValue_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CSSReflectionDirection_h
+#define CSSReflectionDirection_h
+
+namespace WebCore {
+
+enum CSSReflectionDirection { ReflectionBelow, ReflectionAbove, ReflectionLeft, ReflectionRight };
+
+} // namespace WebCore
+
+#endif // CSSReflectionDirection_h
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * (C) 2002-2003 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2002, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSRule_h
+#define CSSRule_h
+
+#include "CSSStyleSheet.h"
+#include "KURLHash.h"
+#include <wtf/ListHashSet.h>
+
+namespace WebCore {
+
+typedef int ExceptionCode;
+
+class CSSRule : public StyleBase {
+public:
+ // FIXME: Change name to Type.
+ enum CSSRuleType {
+ UNKNOWN_RULE,
+ STYLE_RULE,
+ CHARSET_RULE,
+ IMPORT_RULE,
+ MEDIA_RULE,
+ FONT_FACE_RULE,
+ PAGE_RULE,
+ VARIABLES_RULE,
+ WEBKIT_KEYFRAMES_RULE,
+ WEBKIT_KEYFRAME_RULE
+ };
+
+ // FIXME: Change to return CSSRuleType.
+ virtual unsigned short type() const = 0;
+
+ CSSStyleSheet* parentStyleSheet() const;
+ CSSRule* parentRule() const;
+
+ virtual String cssText() const = 0;
+ void setCssText(const String&, ExceptionCode&);
+
+ virtual void addSubresourceStyleURLs(ListHashSet<KURL>&) { }
+
+protected:
+ CSSRule(CSSStyleSheet* parent)
+ : StyleBase(parent)
+ {
+ }
+
+private:
+ virtual bool isRule() { return true; }
+};
+
+} // namespace WebCore
+
+#endif // CSSRule_h
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * (C) 2002-2003 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2002, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSRuleList_h
+#define CSSRuleList_h
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class CSSRule;
+class StyleList;
+
+class CSSRuleList : public RefCounted<CSSRuleList> {
+public:
+ static PassRefPtr<CSSRuleList> create(StyleList* list, bool omitCharsetRules = false)
+ {
+ return adoptRef(new CSSRuleList(list, omitCharsetRules));
+ }
+ static PassRefPtr<CSSRuleList> create()
+ {
+ return adoptRef(new CSSRuleList);
+ }
+ ~CSSRuleList();
+
+ unsigned length() const;
+ CSSRule* item(unsigned index);
+
+ // FIXME: Not part of the DOM. Only used by media rules. We should be able to remove them if we changed media rules to work
+ // as StyleLists instead.
+ unsigned insertRule(CSSRule*, unsigned index);
+ void deleteRule(unsigned index);
+ void append(CSSRule*);
+
+private:
+ CSSRuleList();
+ CSSRuleList(StyleList*, bool omitCharsetRules);
+
+ RefPtr<StyleList> m_list;
+ Vector<RefPtr<CSSRule> > m_lstCSSRules; // FIXME: Want to eliminate, but used by IE rules() extension and still used by media rules.
+};
+
+} // namespace WebCore
+
+#endif // CSSRuleList_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CSSSegmentedFontFace_h
+#define CSSSegmentedFontFace_h
+
+#include <wtf/HashMap.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+class CSSFontFace;
+class CSSFontSelector;
+class FontData;
+class FontDescription;
+class SegmentedFontData;
+
+class CSSSegmentedFontFace : public RefCounted<CSSSegmentedFontFace> {
+public:
+ static PassRefPtr<CSSSegmentedFontFace> create(CSSFontSelector* selector) { return adoptRef(new CSSSegmentedFontFace(selector)); }
+ ~CSSSegmentedFontFace();
+
+ bool isLoaded() const;
+ bool isValid() const;
+ CSSFontSelector* fontSelector() const { return m_fontSelector; }
+
+ void fontLoaded(CSSFontFace*);
+
+ void appendFontFace(PassRefPtr<CSSFontFace>);
+
+ FontData* getFontData(const FontDescription&);
+
+private:
+ CSSSegmentedFontFace(CSSFontSelector*);
+
+ void pruneTable();
+
+ CSSFontSelector* m_fontSelector;
+ HashMap<unsigned, SegmentedFontData*> m_fontDataTable;
+ Vector<RefPtr<CSSFontFace>, 1> m_fontFaces;
+};
+
+} // namespace WebCore
+
+#endif // CSSSegmentedFontFace_h
--- /dev/null
+/*
+ * This file is part of the CSS implementation for KDE.
+ *
+ * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * 1999 Waldo Bastian (bastian@kde.org)
+ * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSSelector_h
+#define CSSSelector_h
+
+#include "QualifiedName.h"
+#include <wtf/Noncopyable.h>
+#include <wtf/OwnPtr.h>
+
+namespace WebCore {
+
+ // this class represents a selector for a StyleRule
+ class CSSSelector : Noncopyable {
+ public:
+ CSSSelector()
+ : m_tag(anyQName())
+ , m_relation(Descendant)
+ , m_match(None)
+ , m_pseudoType(PseudoNotParsed)
+ , m_parsedNth(false)
+ , m_isLastInSelectorList(false)
+ , m_hasRareData(false)
+ {
+ }
+
+ CSSSelector(const QualifiedName& qName)
+ : m_tag(qName)
+ , m_relation(Descendant)
+ , m_match(None)
+ , m_pseudoType(PseudoNotParsed)
+ , m_parsedNth(false)
+ , m_isLastInSelectorList(false)
+ , m_hasRareData(false)
+ {
+ }
+
+ ~CSSSelector()
+ {
+ if (m_hasRareData)
+ delete m_data.m_rareData;
+ else
+ delete m_data.m_tagHistory;
+ }
+
+ /**
+ * Re-create selector text from selector's data
+ */
+ String selectorText() const;
+
+ // checks if the 2 selectors (including sub selectors) agree.
+ bool operator==(const CSSSelector&);
+
+ // tag == -1 means apply to all elements (Selector = *)
+
+ unsigned specificity();
+
+ /* how the attribute value has to match.... Default is Exact */
+ enum Match {
+ None = 0,
+ Id,
+ Class,
+ Exact,
+ Set,
+ List,
+ Hyphen,
+ PseudoClass,
+ PseudoElement,
+ Contain, // css3: E[foo*="bar"]
+ Begin, // css3: E[foo^="bar"]
+ End // css3: E[foo$="bar"]
+ };
+
+ enum Relation {
+ Descendant = 0,
+ Child,
+ DirectAdjacent,
+ IndirectAdjacent,
+ SubSelector
+ };
+
+ enum PseudoType {
+ PseudoNotParsed = 0,
+ PseudoUnknown,
+ PseudoEmpty,
+ PseudoFirstChild,
+ PseudoFirstOfType,
+ PseudoLastChild,
+ PseudoLastOfType,
+ PseudoOnlyChild,
+ PseudoOnlyOfType,
+ PseudoFirstLine,
+ PseudoFirstLetter,
+ PseudoNthChild,
+ PseudoNthOfType,
+ PseudoNthLastChild,
+ PseudoNthLastOfType,
+ PseudoLink,
+ PseudoVisited,
+ PseudoAnyLink,
+ PseudoAutofill,
+ PseudoHover,
+ PseudoDrag,
+ PseudoFocus,
+ PseudoActive,
+ PseudoChecked,
+ PseudoEnabled,
+ PseudoFullPageMedia,
+ PseudoDisabled,
+ PseudoInputPlaceholder,
+ PseudoReadOnly,
+ PseudoReadWrite,
+ PseudoIndeterminate,
+ PseudoTarget,
+ PseudoBefore,
+ PseudoAfter,
+ PseudoLang,
+ PseudoNot,
+ PseudoResizer,
+ PseudoRoot,
+ PseudoScrollbar,
+ PseudoScrollbarBack,
+ PseudoScrollbarButton,
+ PseudoScrollbarCorner,
+ PseudoScrollbarForward,
+ PseudoScrollbarThumb,
+ PseudoScrollbarTrack,
+ PseudoScrollbarTrackPiece,
+ PseudoWindowInactive,
+ PseudoCornerPresent,
+ PseudoDecrement,
+ PseudoIncrement,
+ PseudoHorizontal,
+ PseudoVertical,
+ PseudoStart,
+ PseudoEnd,
+ PseudoDoubleButton,
+ PseudoSingleButton,
+ PseudoNoButton,
+ PseudoSelection,
+ PseudoFileUploadButton,
+ PseudoSliderThumb,
+ PseudoSearchCancelButton,
+ PseudoSearchDecoration,
+ PseudoSearchResultsDecoration,
+ PseudoSearchResultsButton,
+ PseudoMediaControlsPanel,
+ PseudoMediaControlsMuteButton,
+ PseudoMediaControlsPlayButton,
+ PseudoMediaControlsTimelineContainer,
+ PseudoMediaControlsCurrentTimeDisplay,
+ PseudoMediaControlsTimeRemainingDisplay,
+ PseudoMediaControlsTimeline,
+ PseudoMediaControlsSeekBackButton,
+ PseudoMediaControlsSeekForwardButton,
+ PseudoMediaControlsFullscreenButton
+ };
+
+ PseudoType pseudoType() const
+ {
+ if (m_pseudoType == PseudoNotParsed)
+ extractPseudoType();
+ return static_cast<PseudoType>(m_pseudoType);
+ }
+
+ CSSSelector* tagHistory() const { return m_hasRareData ? m_data.m_rareData->m_tagHistory.get() : m_data.m_tagHistory; }
+ void setTagHistory(CSSSelector* tagHistory);
+
+ bool hasTag() const { return m_tag != anyQName(); }
+ bool hasAttribute() const { return m_match == Id || m_match == Class || (m_hasRareData && m_data.m_rareData->m_attribute != anyQName()); }
+
+ const QualifiedName& attribute() const;
+ const AtomicString& argument() const { return m_hasRareData ? m_data.m_rareData->m_argument : nullAtom; }
+ CSSSelector* simpleSelector() const { return m_hasRareData ? m_data.m_rareData->m_simpleSelector.get() : 0; }
+
+ void setAttribute(const QualifiedName& value);
+ void setArgument(const AtomicString& value);
+ void setSimpleSelector(CSSSelector* value);
+
+ bool parseNth();
+ bool matchNth(int count);
+
+ Relation relation() const { return static_cast<Relation>(m_relation); }
+
+ bool isLastInSelectorList() const { return m_isLastInSelectorList; }
+ void setLastInSelectorList() { m_isLastInSelectorList = true; }
+
+ mutable AtomicString m_value;
+ QualifiedName m_tag;
+
+ unsigned m_relation : 3; // enum Relation
+ mutable unsigned m_match : 4; // enum Match
+ mutable unsigned m_pseudoType : 8; // PseudoType
+
+ private:
+ bool m_parsedNth : 1; // Used for :nth-*
+ bool m_isLastInSelectorList : 1;
+ bool m_hasRareData : 1;
+
+ void extractPseudoType() const;
+
+ struct RareData {
+ RareData(CSSSelector* tagHistory)
+ : m_tagHistory(tagHistory)
+ , m_simpleSelector(0)
+ , m_attribute(anyQName())
+ , m_argument(nullAtom)
+ , m_a(0)
+ , m_b(0)
+ {
+ }
+
+ bool parseNth();
+ bool matchNth(int count);
+
+ OwnPtr<CSSSelector> m_tagHistory;
+ OwnPtr<CSSSelector> m_simpleSelector; // Used for :not.
+ QualifiedName m_attribute; // used for attribute selector
+ AtomicString m_argument; // Used for :contains, :lang and :nth-*
+ int m_a; // Used for :nth-*
+ int m_b; // Used for :nth-*
+ };
+
+ void createRareData()
+ {
+ if (m_hasRareData)
+ return;
+ m_data.m_rareData = new RareData(m_data.m_tagHistory);
+ m_hasRareData = true;
+ }
+
+ union DataUnion {
+ DataUnion() : m_tagHistory(0) { }
+ CSSSelector* m_tagHistory;
+ RareData* m_rareData;
+ } m_data;
+ };
+
+} // namespace WebCore
+
+#endif // CSSSelector_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CSSSelectorList_h
+#define CSSSelectorList_h
+
+#include "CSSSelector.h"
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+ class CSSSelectorList : Noncopyable {
+ public:
+ CSSSelectorList() : m_selectorArray(0) { }
+ ~CSSSelectorList();
+
+ void adopt(CSSSelectorList& list);
+ void adoptSelectorVector(Vector<CSSSelector*>& selectorVector);
+
+ CSSSelector* first() const { return m_selectorArray ? m_selectorArray : 0; }
+ static CSSSelector* next(CSSSelector* previous) { return previous->isLastInSelectorList() ? 0 : previous + 1; }
+ bool hasOneSelector() const { return m_selectorArray ? m_selectorArray->isLastInSelectorList() : false; }
+
+ private:
+ void deleteSelectors();
+
+ // End of the array is indicated by m_isLastInSelectorList bit in the last item.
+ CSSSelector* m_selectorArray;
+ };
+
+}
+
+#endif
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSStyleDeclaration_h
+#define CSSStyleDeclaration_h
+
+#include "StyleBase.h"
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+class CSSMutableStyleDeclaration;
+class CSSRule;
+class CSSValue;
+
+typedef int ExceptionCode;
+
+class CSSStyleDeclaration : public StyleBase {
+public:
+ static bool isPropertyName(const String&);
+
+ CSSRule* parentRule() const;
+
+ virtual String cssText() const = 0;
+ virtual void setCssText(const String&, ExceptionCode&) = 0;
+
+ virtual unsigned length() const = 0;
+ virtual String item(unsigned index) const = 0;
+
+ PassRefPtr<CSSValue> getPropertyCSSValue(const String& propertyName);
+ String getPropertyValue(const String& propertyName);
+ String getPropertyPriority(const String& propertyName);
+ String getPropertyShorthand(const String& propertyName);
+ bool isPropertyImplicit(const String& propertyName);
+
+ virtual PassRefPtr<CSSValue> getPropertyCSSValue(int propertyID) const = 0;
+ virtual String getPropertyValue(int propertyID) const = 0;
+ virtual bool getPropertyPriority(int propertyID) const = 0;
+ virtual int getPropertyShorthand(int propertyID) const = 0;
+ virtual bool isPropertyImplicit(int propertyID) const = 0;
+
+ void setProperty(const String& propertyName, const String& value, ExceptionCode&);
+ void setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode&);
+ String removeProperty(const String& propertyName, ExceptionCode&);
+ virtual void setProperty(int propertyId, const String& value, bool important, ExceptionCode&) = 0;
+ virtual String removeProperty(int propertyID, ExceptionCode&) = 0;
+
+ virtual PassRefPtr<CSSMutableStyleDeclaration> copy() const = 0;
+ virtual PassRefPtr<CSSMutableStyleDeclaration> makeMutable() = 0;
+
+ void diff(CSSMutableStyleDeclaration*) const;
+
+ PassRefPtr<CSSMutableStyleDeclaration> copyPropertiesInSet(const int* set, unsigned length) const;
+
+protected:
+ CSSStyleDeclaration(CSSRule* parentRule = 0);
+};
+
+} // namespace WebCore
+
+#endif // CSSStyleDeclaration_h
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * (C) 2002-2003 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2002, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSStyleRule_h
+#define CSSStyleRule_h
+
+#include "CSSRule.h"
+#include "CSSSelectorList.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class CSSMutableStyleDeclaration;
+class CSSSelector;
+
+class CSSStyleRule : public CSSRule {
+public:
+ static PassRefPtr<CSSStyleRule> create(CSSStyleSheet* parent)
+ {
+ return adoptRef(new CSSStyleRule(parent));
+ }
+ virtual ~CSSStyleRule();
+
+ String selectorText() const;
+ void setSelectorText(const String&, ExceptionCode&);
+
+ CSSMutableStyleDeclaration* style() const { return m_style.get(); }
+
+ virtual String cssText() const;
+
+ // Not part of the CSSOM
+ virtual bool parseString(const String&, bool = false);
+
+ void adoptSelectorVector(Vector<CSSSelector*>& selectors) { m_selectorList.adoptSelectorVector(selectors); }
+ void setDeclaration(PassRefPtr<CSSMutableStyleDeclaration>);
+
+ const CSSSelectorList& selectorList() const { return m_selectorList; }
+ CSSMutableStyleDeclaration* declaration() { return m_style.get(); }
+
+ virtual void addSubresourceStyleURLs(ListHashSet<KURL>& urls);
+
+private:
+ CSSStyleRule(CSSStyleSheet* parent);
+
+ virtual bool isStyleRule() { return true; }
+
+ // Inherited from CSSRule
+ virtual unsigned short type() const { return STYLE_RULE; }
+
+ RefPtr<CSSMutableStyleDeclaration> m_style;
+ CSSSelectorList m_selectorList;
+};
+
+} // namespace WebCore
+
+#endif // CSSStyleRule_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef CSSStyleSelector_h
+#define CSSStyleSelector_h
+
+#include "CSSFontSelector.h"
+#include "KeyframeList.h"
+#include "LinkHash.h"
+#include "MediaQueryExp.h"
+#include "RenderStyle.h"
+#include "StringHash.h"
+#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class CSSMutableStyleDeclaration;
+class CSSPrimitiveValue;
+class CSSProperty;
+class CSSFontFace;
+class CSSFontFaceRule;
+class CSSRuleData;
+class CSSRuleDataList;
+class CSSRuleList;
+class CSSRuleSet;
+class CSSSelector;
+class CSSStyleRule;
+class CSSStyleSheet;
+class CSSValue;
+class CSSVariableDependentValue;
+class CSSVariablesRule;
+class Document;
+class Element;
+class Frame;
+class FrameView;
+class KURL;
+class MediaQueryEvaluator;
+class Node;
+class Settings;
+class StyleImage;
+class StyleSheet;
+class StyleSheetList;
+class StyledElement;
+class WebKitCSSKeyframesRule;
+
+class MediaQueryResult {
+public:
+ MediaQueryResult(const MediaQueryExp& expr, bool result)
+ : m_expression(expr)
+ , m_result(result)
+ {
+ }
+
+ MediaQueryExp m_expression;
+ bool m_result;
+};
+
+ // This class selects a RenderStyle for a given element based on a collection of stylesheets.
+ class CSSStyleSelector : Noncopyable {
+ public:
+ CSSStyleSelector(Document*, const String& userStyleSheet, StyleSheetList*, CSSStyleSheet*, bool strictParsing, bool matchAuthorAndUserStyles);
+ ~CSSStyleSelector();
+
+ void initElementAndPseudoState(Element*);
+ void initForStyleResolve(Element*, RenderStyle* parentStyle = 0, RenderStyle::PseudoId = RenderStyle::NOPSEUDO);
+ PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle = 0, bool allowSharing = true, bool resolveForRootDefault = false);
+ void keyframeStylesForAnimation(Element*, const RenderStyle*, KeyframeList& list);
+
+ PassRefPtr<RenderStyle> pseudoStyleForElement(RenderStyle::PseudoId, Element*, RenderStyle* parentStyle = 0);
+
+ private:
+ RenderStyle* locateSharedStyle();
+ Node* locateCousinList(Element* parent, unsigned depth = 1);
+ bool canShareStyleWithElement(Node*);
+
+ RenderStyle* style() const { return m_style.get(); }
+
+ public:
+ // These methods will give back the set of rules that matched for a given element (or a pseudo-element).
+ PassRefPtr<CSSRuleList> styleRulesForElement(Element*, bool authorOnly);
+ PassRefPtr<CSSRuleList> pseudoStyleRulesForElement(Element*, const String& pseudoStyle, bool authorOnly);
+
+ // Given a CSS keyword in the range (xx-small to -webkit-xxx-large), this function will return
+ // the correct font size scaled relative to the user's default (medium).
+ float fontSizeForKeyword(int keyword, bool quirksMode, bool monospace) const;
+
+ private:
+ // When the CSS keyword "larger" is used, this function will attempt to match within the keyword
+ // table, and failing that, will simply multiply by 1.2.
+ float largerFontSize(float size, bool quirksMode) const;
+
+ // Like the previous function, but for the keyword "smaller".
+ float smallerFontSize(float size, bool quirksMode) const;
+
+ public:
+ void setStyle(PassRefPtr<RenderStyle> s) { m_style = s; } // Used by the document when setting up its root style.
+ void setFontSize(FontDescription&, float size);
+
+ void applyPropertyToStyle(int id, CSSValue*, RenderStyle*);
+
+ private:
+ float getComputedSizeFromSpecifiedSize(bool isAbsoluteSize, float specifiedSize);
+
+ public:
+ Color getColorFromPrimitiveValue(CSSPrimitiveValue*);
+
+ bool hasSelectorForAttribute(const AtomicString&);
+
+ CSSFontSelector* fontSelector() { return m_fontSelector.get(); }
+
+ // Checks if a compound selector (which can consist of multiple simple selectors) matches the current element.
+ bool checkSelector(CSSSelector*);
+
+ void addViewportDependentMediaQueryResult(const MediaQueryExp*, bool result);
+
+ bool affectedByViewportChange() const;
+
+ void allVisitedStateChanged() { m_checker.allVisitedStateChanged(); }
+ void visitedStateChanged(LinkHash visitedHash) { m_checker.visitedStateChanged(visitedHash); }
+
+ void addVariables(CSSVariablesRule* variables);
+ CSSValue* resolveVariableDependentValue(CSSVariableDependentValue*);
+ void resolveVariablesForDeclaration(CSSMutableStyleDeclaration* decl, CSSMutableStyleDeclaration* newDecl, HashSet<String>& usedBlockVariables);
+
+ void addKeyframeStyle(PassRefPtr<WebKitCSSKeyframesRule> rule);
+
+ static bool createTransformOperations(CSSValue* inValue, RenderStyle* inStyle, TransformOperations& outOperations);
+
+ private:
+ enum SelectorMatch { SelectorMatches, SelectorFailsLocally, SelectorFailsCompletely };
+
+ // This function fixes up the default font size if it detects that the current generic font family has changed. -dwh
+ void checkForGenericFamilyChange(RenderStyle*, RenderStyle* parentStyle);
+ void checkForZoomChange(RenderStyle*, RenderStyle* parentStyle);
+ void checkForTextSizeAdjust();
+
+ void adjustRenderStyle(RenderStyle*, Element*);
+
+ void addMatchedRule(CSSRuleData* rule) { m_matchedRules.append(rule); }
+ void addMatchedDeclaration(CSSMutableStyleDeclaration* decl);
+
+ void matchRules(CSSRuleSet*, int& firstRuleIndex, int& lastRuleIndex);
+ void matchRulesForList(CSSRuleDataList*, int& firstRuleIndex, int& lastRuleIndex);
+ void sortMatchedRules(unsigned start, unsigned end);
+
+ void applyDeclarations(bool firstPass, bool important, int startIndex, int endIndex);
+
+ CSSRuleSet* m_authorStyle;
+ CSSRuleSet* m_userStyle;
+ RefPtr<CSSStyleSheet> m_userSheet;
+
+ bool m_hasUAAppearance;
+ BorderData m_borderData;
+ FillLayer m_backgroundData;
+ Color m_backgroundColor;
+
+ typedef HashMap<AtomicStringImpl*, RefPtr<WebKitCSSKeyframesRule> > KeyframesRuleMap;
+ KeyframesRuleMap m_keyframesRuleMap;
+
+ public:
+ static RenderStyle* styleNotYetAvailable() { return s_styleNotYetAvailable; }
+
+ class SelectorChecker : public Noncopyable {
+ public:
+ SelectorChecker(Document*, bool strictParsing);
+
+ bool checkSelector(CSSSelector*, Element*) const;
+ SelectorMatch checkSelector(CSSSelector*, Element*, HashSet<AtomicStringImpl*>* selectorAttrs, RenderStyle::PseudoId& dynamicPseudo, bool isAncestor, bool isSubSelector, RenderStyle* = 0, RenderStyle* elementParentStyle = 0) const;
+ bool checkOneSelector(CSSSelector*, Element*, HashSet<AtomicStringImpl*>* selectorAttrs, RenderStyle::PseudoId& dynamicPseudo, bool isAncestor, bool isSubSelector, RenderStyle*, RenderStyle* elementParentStyle) const;
+ PseudoState checkPseudoState(Element*, bool checkVisited = true) const;
+ bool checkScrollbarPseudoClass(CSSSelector*, RenderStyle::PseudoId& dynamicPseudo) const;
+
+ void allVisitedStateChanged();
+ void visitedStateChanged(LinkHash visitedHash);
+
+ Document* m_document;
+ bool m_strictParsing;
+ bool m_collectRulesOnly;
+ RenderStyle::PseudoId m_pseudoStyle;
+ bool m_documentIsHTML;
+ mutable HashSet<LinkHash, LinkHashHash> m_linksCheckedForVisitedState;
+ };
+
+ private:
+ static RenderStyle* s_styleNotYetAvailable;
+
+ void init();
+
+ void matchUARules(int& firstUARule, int& lastUARule);
+ void updateFont();
+ void cacheBorderAndBackground();
+
+ void mapFillAttachment(FillLayer*, CSSValue*);
+ void mapFillClip(FillLayer*, CSSValue*);
+ void mapFillComposite(FillLayer*, CSSValue*);
+ void mapFillOrigin(FillLayer*, CSSValue*);
+ void mapFillImage(FillLayer*, CSSValue*);
+ void mapFillRepeat(FillLayer*, CSSValue*);
+ void mapFillSize(FillLayer*, CSSValue*);
+ void mapFillXPosition(FillLayer*, CSSValue*);
+ void mapFillYPosition(FillLayer*, CSSValue*);
+
+ void mapAnimationDelay(Animation*, CSSValue*);
+ void mapAnimationDirection(Animation*, CSSValue*);
+ void mapAnimationDuration(Animation*, CSSValue*);
+ void mapAnimationIterationCount(Animation*, CSSValue*);
+ void mapAnimationName(Animation*, CSSValue*);
+ void mapAnimationPlayState(Animation*, CSSValue*);
+ void mapAnimationProperty(Animation*, CSSValue*);
+ void mapAnimationTimingFunction(Animation*, CSSValue*);
+
+ void mapNinePieceImage(CSSValue*, NinePieceImage&);
+
+ void applyProperty(int id, CSSValue*);
+#if ENABLE(SVG)
+ void applySVGProperty(int id, CSSValue*);
+#endif
+
+ StyleImage* styleImage(CSSValue* value);
+
+ // We collect the set of decls that match in |m_matchedDecls|. We then walk the
+ // set of matched decls four times, once for those properties that others depend on (like font-size),
+ // and then a second time for all the remaining properties. We then do the same two passes
+ // for any !important rules.
+ Vector<CSSMutableStyleDeclaration*, 64> m_matchedDecls;
+
+ // A buffer used to hold the set of matched rules for an element, and a temporary buffer used for
+ // merge sorting.
+ Vector<CSSRuleData*, 32> m_matchedRules;
+
+ RefPtr<CSSRuleList> m_ruleList;
+
+ MediaQueryEvaluator* m_medium;
+ RefPtr<RenderStyle> m_rootDefaultStyle;
+
+ RenderStyle::PseudoId m_dynamicPseudo;
+
+ SelectorChecker m_checker;
+
+ RefPtr<RenderStyle> m_style;
+ RenderStyle* m_parentStyle;
+ Element* m_element;
+ StyledElement* m_styledElement;
+ Node* m_parentNode;
+ CSSValue* m_lineHeightValue;
+ bool m_fontDirty;
+ bool m_matchAuthorAndUserStyles;
+
+ RefPtr<CSSFontSelector> m_fontSelector;
+ HashSet<AtomicStringImpl*> m_selectorAttrs;
+ Vector<CSSMutableStyleDeclaration*> m_additionalAttributeStyleDecls;
+ Vector<MediaQueryResult*> m_viewportDependentMediaQueryResults;
+
+ HashMap<String, CSSVariablesRule*> m_variablesMap;
+ HashMap<CSSMutableStyleDeclaration*, RefPtr<CSSMutableStyleDeclaration> > m_resolvedVariablesDeclarations;
+ };
+
+ class CSSRuleData {
+ public:
+ CSSRuleData(unsigned pos, CSSStyleRule* r, CSSSelector* sel, CSSRuleData* prev = 0)
+ : m_position(pos)
+ , m_rule(r)
+ , m_selector(sel)
+ , m_next(0)
+ {
+ if (prev)
+ prev->m_next = this;
+ }
+
+ ~CSSRuleData() { delete m_next; }
+
+ unsigned position() { return m_position; }
+ CSSStyleRule* rule() { return m_rule; }
+ CSSSelector* selector() { return m_selector; }
+ CSSRuleData* next() { return m_next; }
+
+ private:
+ unsigned m_position;
+ CSSStyleRule* m_rule;
+ CSSSelector* m_selector;
+ CSSRuleData* m_next;
+ };
+
+ class CSSRuleDataList {
+ public:
+ CSSRuleDataList(unsigned pos, CSSStyleRule* rule, CSSSelector* sel)
+ : m_first(new CSSRuleData(pos, rule, sel))
+ , m_last(m_first)
+ {
+ }
+
+ ~CSSRuleDataList() { delete m_first; }
+
+ CSSRuleData* first() { return m_first; }
+ CSSRuleData* last() { return m_last; }
+
+ void append(unsigned pos, CSSStyleRule* rule, CSSSelector* sel) { m_last = new CSSRuleData(pos, rule, sel, m_last); }
+
+ private:
+ CSSRuleData* m_first;
+ CSSRuleData* m_last;
+ };
+
+} // namespace WebCore
+
+#endif // CSSStyleSelector_h
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSStyleSheet_h
+#define CSSStyleSheet_h
+
+#include "CSSRuleList.h"
+#include "StyleSheet.h"
+
+namespace WebCore {
+
+class CSSNamespace;
+class CSSParser;
+class CSSRule;
+class DocLoader;
+class Document;
+
+typedef int ExceptionCode;
+
+class CSSStyleSheet : public StyleSheet {
+public:
+ static PassRefPtr<CSSStyleSheet> create()
+ {
+ return adoptRef(new CSSStyleSheet(static_cast<CSSStyleSheet*>(0), String(), String()));
+ }
+ static PassRefPtr<CSSStyleSheet> create(Node* ownerNode)
+ {
+ return adoptRef(new CSSStyleSheet(ownerNode, String(), String()));
+ }
+ static PassRefPtr<CSSStyleSheet> create(Node* ownerNode, const String& href)
+ {
+ return adoptRef(new CSSStyleSheet(ownerNode, href, String()));
+ }
+ static PassRefPtr<CSSStyleSheet> create(Node* ownerNode, const String& href, const String& charset)
+ {
+ return adoptRef(new CSSStyleSheet(ownerNode, href, charset));
+ }
+ static PassRefPtr<CSSStyleSheet> create(CSSRule* ownerRule, const String& href, const String& charset)
+ {
+ return adoptRef(new CSSStyleSheet(ownerRule, href, charset));
+ }
+
+ virtual ~CSSStyleSheet();
+
+ CSSRule* ownerRule() const;
+ PassRefPtr<CSSRuleList> cssRules(bool omitCharsetRules = false);
+ unsigned insertRule(const String& rule, unsigned index, ExceptionCode&);
+ void deleteRule(unsigned index, ExceptionCode&);
+
+ // IE Extensions
+ PassRefPtr<CSSRuleList> rules() { return cssRules(true); }
+ int addRule(const String& selector, const String& style, int index, ExceptionCode&);
+ int addRule(const String& selector, const String& style, ExceptionCode&);
+ void removeRule(unsigned index, ExceptionCode& ec) { deleteRule(index, ec); }
+
+ void addNamespace(CSSParser*, const AtomicString& prefix, const AtomicString& uri);
+ const AtomicString& determineNamespace(const AtomicString& prefix);
+
+ virtual void styleSheetChanged();
+
+ virtual bool parseString(const String&, bool strict = true);
+
+ virtual bool isLoading();
+
+ virtual void checkLoaded();
+
+ Document* doc() { return m_doc; }
+
+ const String& charset() const { return m_charset; }
+
+ bool loadCompleted() const { return m_loadCompleted; }
+
+ virtual KURL completeURL(const String& url) const;
+ virtual void addSubresourceStyleURLs(ListHashSet<KURL>&);
+
+ void setStrictParsing(bool b) { m_strictParsing = b; }
+ bool useStrictParsing() const { return m_strictParsing; }
+
+private:
+ CSSStyleSheet(Node* ownerNode, const String& href, const String& charset);
+ CSSStyleSheet(CSSStyleSheet* parentSheet, const String& href, const String& charset);
+ CSSStyleSheet(CSSRule* ownerRule, const String& href, const String& charset);
+
+ virtual bool isCSSStyleSheet() const { return true; }
+ virtual String type() const { return "text/css"; }
+
+ Document* m_doc;
+ CSSNamespace* m_namespaces;
+ String m_charset;
+ bool m_loadCompleted : 1;
+ bool m_strictParsing : 1;
+};
+
+} // namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CSSTimingFunctionValue_h
+#define CSSTimingFunctionValue_h
+
+#include "CSSValue.h"
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+class CSSTimingFunctionValue : public CSSValue {
+public:
+ static PassRefPtr<CSSTimingFunctionValue> create(double x1, double y1, double x2, double y2)
+ {
+ return adoptRef(new CSSTimingFunctionValue(x1, y1, x2, y2));
+ }
+
+ virtual String cssText() const;
+
+ double x1() const { return m_x1; }
+ double y1() const { return m_y1; }
+ double x2() const { return m_x2; }
+ double y2() const { return m_y2; }
+
+private:
+ CSSTimingFunctionValue(double x1, double y1, double x2, double y2)
+ : m_x1(x1)
+ , m_y1(y1)
+ , m_x2(x2)
+ , m_y2(y2)
+ {
+ }
+
+ virtual bool isTimingFunctionValue() const { return true; }
+
+ double m_x1;
+ double m_y1;
+ double m_x2;
+ double m_y2;
+};
+
+} // namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CSSUnicodeRangeValue_h
+#define CSSUnicodeRangeValue_h
+
+#include "CSSValue.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+class CSSUnicodeRangeValue : public CSSValue {
+public:
+ static PassRefPtr<CSSUnicodeRangeValue> create(UChar32 from, UChar32 to)
+ {
+ return adoptRef(new CSSUnicodeRangeValue(from, to));
+ }
+
+ virtual ~CSSUnicodeRangeValue();
+
+ UChar32 from() const { return m_from; }
+ UChar32 to() const { return m_to; }
+
+ virtual String cssText() const;
+
+private:
+ CSSUnicodeRangeValue(UChar32 from, UChar32 to)
+ : m_from(from)
+ , m_to(to)
+ {
+ }
+
+ UChar32 m_from;
+ UChar32 m_to;
+};
+
+} // namespace WebCore
+
+#endif // CSSUnicodeRangeValue_h
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * (C) 2002-2003 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2002, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSUnknownRule_h
+#define CSSUnknownRule_h
+
+#include "CSSRule.h"
+
+namespace WebCore {
+
+class CSSUnknownRule : public CSSRule {
+private:
+ virtual unsigned short type() const { return UNKNOWN_RULE; }
+};
+
+} // namespace WebCore
+
+#endif // CSSUnknownRule_h
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSValue_h
+#define CSSValue_h
+
+#include "StyleBase.h"
+
+#include "CSSParserValues.h"
+#include "KURLHash.h"
+#include <wtf/ListHashSet.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class CSSStyleSheet;
+
+typedef int ExceptionCode;
+
+class CSSValue : public RefCounted<CSSValue> {
+public:
+ // FIXME: Change name to Type.
+ enum UnitTypes {
+ CSS_INHERIT = 0,
+ CSS_PRIMITIVE_VALUE = 1,
+ CSS_VALUE_LIST = 2,
+ CSS_CUSTOM = 3,
+ CSS_INITIAL = 4
+ };
+
+ virtual ~CSSValue() { }
+
+ // FIXME: Change this to return UnitTypes.
+ virtual unsigned short cssValueType() const { return CSS_CUSTOM; }
+
+ virtual String cssText() const = 0;
+ void setCssText(const String&, ExceptionCode&) { } // FIXME: Not implemented.
+
+ virtual bool isFontValue() const { return false; }
+ virtual bool isImageGeneratorValue() const { return false; }
+ virtual bool isImageValue() const { return false; }
+ virtual bool isImplicitInitialValue() const { return false; }
+ virtual bool isPrimitiveValue() const { return false; }
+ virtual bool isTimingFunctionValue() const { return false; }
+ virtual bool isValueList() const { return false; }
+ virtual bool isWebKitCSSTransformValue() const { return false; }
+
+#if ENABLE(SVG)
+ virtual bool isSVGColor() const { return false; }
+ virtual bool isSVGPaint() const { return false; }
+#endif
+
+ virtual bool isVariableDependentValue() const { return false; }
+ virtual CSSParserValue parserValue() const { ASSERT_NOT_REACHED(); return CSSParserValue(); }
+
+ virtual void addSubresourceStyleURLs(ListHashSet<KURL>&, const CSSStyleSheet*) { }
+};
+
+} // namespace WebCore
+
+#endif // CSSValue_h
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSValueList_h
+#define CSSValueList_h
+
+#include "CSSValue.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class CSSParserValueList;
+
+class CSSValueList : public CSSValue {
+public:
+ static PassRefPtr<CSSValueList> createCommaSeparated()
+ {
+ return adoptRef(new CSSValueList(false));
+ }
+ static PassRefPtr<CSSValueList> createSpaceSeparated()
+ {
+ return adoptRef(new CSSValueList(true));
+ }
+ static PassRefPtr<CSSValueList> createFromParserValueList(CSSParserValueList* list)
+ {
+ return adoptRef(new CSSValueList(list));
+ }
+
+ virtual ~CSSValueList();
+
+ size_t length() const { return m_values.size(); }
+ CSSValue* item(unsigned);
+ CSSValue* itemWithoutBoundsCheck(unsigned index) { return m_values[index].get(); }
+
+ void append(PassRefPtr<CSSValue>);
+ void prepend(PassRefPtr<CSSValue>);
+
+ virtual String cssText() const;
+
+ CSSParserValueList* createParserValueList() const;
+
+ virtual void addSubresourceStyleURLs(ListHashSet<KURL>&, const CSSStyleSheet*);
+
+protected:
+ CSSValueList(bool isSpaceSeparated);
+ CSSValueList(CSSParserValueList*);
+
+private:
+ virtual bool isValueList() const { return true; }
+
+ virtual unsigned short cssValueType() const;
+
+ Vector<RefPtr<CSSValue> > m_values;
+ bool m_isSpaceSeparated;
+};
+
+} // namespace WebCore
+
+#endif // CSSValueList_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CSSVariableDependentValue_h
+#define CSSVariableDependentValue_h
+
+#include "CSSValue.h"
+
+namespace WebCore {
+
+class CSSValueList;
+
+class CSSVariableDependentValue : public CSSValue {
+public:
+ static PassRefPtr<CSSVariableDependentValue> create(PassRefPtr<CSSValueList> valueList)
+ {
+ return adoptRef(new CSSVariableDependentValue(valueList));
+ }
+ virtual ~CSSVariableDependentValue();
+
+ virtual String cssText() const;
+
+ bool isVariableDependentValue() const { return true; }
+
+ CSSValueList* valueList() const { return m_list.get(); }
+
+private:
+ CSSVariableDependentValue(PassRefPtr<CSSValueList>);
+
+ RefPtr<CSSValueList> m_list;
+};
+
+}
+#endif
+
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CSSVariablesDeclaration_h
+#define CSSVariablesDeclaration_h
+
+#include "PlatformString.h"
+#include "StringHash.h"
+#include "StyleBase.h"
+#include <wtf/HashMap.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+typedef int ExceptionCode;
+
+class CSSMutableStyleDeclaration;
+class CSSRule;
+class CSSValue;
+class CSSValueList;
+
+class CSSVariablesDeclaration : public StyleBase {
+public:
+ static PassRefPtr<CSSVariablesDeclaration> create(StyleBase* owningRule, const Vector<String>& names, const Vector<RefPtr<CSSValue> >& values)
+ {
+ return adoptRef(new CSSVariablesDeclaration(owningRule, names, values));
+ }
+ virtual ~CSSVariablesDeclaration();
+
+ String getVariableValue(const String&);
+ String removeVariable(const String&, ExceptionCode&);
+ void setVariable(const String&, const String&, ExceptionCode&);
+
+ unsigned length() const;
+ String item(unsigned index);
+
+ CSSRule* parentRule();
+
+ String cssText() const;
+ void setCssText(const String&); // FIXME: The spec contradicts itself regarding whether or not cssText is settable.
+
+ void addParsedVariable(const String& variableName, PassRefPtr<CSSValue> variableValue, bool updateNamesList = true);
+
+ CSSValueList* getParsedVariable(const String& variableName);
+ CSSMutableStyleDeclaration* getParsedVariableDeclarationBlock(const String& variableName);
+
+private:
+ CSSVariablesDeclaration(StyleBase* owningRule, const Vector<String>& names, const Vector<RefPtr<CSSValue> >& values);
+
+ void setChanged();
+
+protected:
+ Vector<String> m_variableNames;
+ HashMap<String, RefPtr<CSSValue> > m_variablesMap;
+};
+
+} // namespace WebCore
+
+#endif // CSSVariablesDeclaration_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CSSVariablesRule_h
+#define CSSVariablesRule_h
+
+#include "CSSRule.h"
+#include "CSSVariablesDeclaration.h"
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class CSSStyleSheet;
+class MediaList;
+
+class CSSVariablesRule : public CSSRule {
+public:
+ static PassRefPtr<CSSVariablesRule> create(CSSStyleSheet* parent, MediaList* mediaList, bool variablesKeyword)
+ {
+ return adoptRef(new CSSVariablesRule(parent, mediaList, variablesKeyword));
+ }
+
+ virtual ~CSSVariablesRule();
+
+ // CSSVariablesRule interface
+ MediaList* media() const { return m_lstMedia.get(); }
+ CSSVariablesDeclaration* variables() { return m_variables.get(); }
+
+ // Inherited from CSSRule
+ virtual unsigned short type() const { return VARIABLES_RULE; }
+ virtual String cssText() const;
+ virtual bool isVariablesRule() { return true; }
+
+ // Used internally. Does not notify the document of the change. Only intended
+ // for use on initial parse.
+ void setDeclaration(PassRefPtr<CSSVariablesDeclaration> decl) { m_variables = decl; }
+
+private:
+ CSSVariablesRule(CSSStyleSheet* parent, MediaList*, bool variablesKeyword);
+
+ RefPtr<MediaList> m_lstMedia;
+ RefPtr<CSSVariablesDeclaration> m_variables;
+ bool m_variablesKeyword;
+};
+
+} // namespace WebCore
+
+#endif // CSSVariablesRule_h
--- /dev/null
+/*
+ * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CString_h
+#define CString_h
+
+#include "SharedBuffer.h"
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+ class CStringBuffer : public RefCounted<CStringBuffer> {
+ public:
+ static PassRefPtr<CStringBuffer> create(unsigned length) { return adoptRef(new CStringBuffer(length)); }
+
+ char* data() { return m_vector.data(); }
+ size_t length() const { return m_vector.size(); }
+
+ PassRefPtr<SharedBuffer> releaseBuffer() { return SharedBuffer::adoptVector(m_vector); }
+
+ private:
+ CStringBuffer(unsigned length) : m_vector(length) { }
+
+ Vector<char> m_vector;
+ };
+
+ // A container for a null-terminated char array supporting copy-on-write
+ // assignment. The contained char array may be null.
+ class CString {
+ public:
+ CString() { }
+ CString(const char*);
+ CString(const char*, unsigned length);
+ static CString newUninitialized(size_t length, char*& characterBuffer);
+
+ const char* data() const;
+ char* mutableData();
+ unsigned length() const;
+
+ bool isNull() const { return !m_buffer; }
+
+ PassRefPtr<SharedBuffer> releaseBuffer();
+
+ private:
+ void copyBufferIfNeeded();
+ void init(const char*, unsigned length);
+ RefPtr<CStringBuffer> m_buffer;
+ };
+
+ bool operator==(const CString& a, const CString& b);
+ inline bool operator!=(const CString& a, const CString& b) { return !(a == b); }
+
+} // namespace WebCore
+
+#endif // CString_h
--- /dev/null
+/*
+ Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
+ Copyright (C) 2001 Dirk Mueller <mueller@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+ This class provides all functionality needed for loading images, style sheets and html
+ pages from the web. It has a memory cache for these objects.
+*/
+
+#ifndef Cache_h
+#define Cache_h
+
+#include "CachePolicy.h"
+#include "CachedResource.h"
+#include "PlatformString.h"
+#include "StringHash.h"
+#include "loader.h"
+#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class CachedCSSStyleSheet;
+class CachedResource;
+class DocLoader;
+class KURL;
+
+// This cache holds subresources used by Web pages: images, scripts, stylesheets, etc.
+
+// The cache keeps a flexible but bounded window of dead resources that grows/shrinks
+// depending on the live resource load. Here's an example of cache growth over time,
+// with a min dead resource capacity of 25% and a max dead resource capacity of 50%:
+
+// |-----| Dead: -
+// |----------| Live: +
+// --|----------| Cache boundary: | (objects outside this mark have been evicted)
+// --|----------++++++++++|
+// -------|-----+++++++++++++++|
+// -------|-----+++++++++++++++|+++++
+
+class Cache : Noncopyable {
+public:
+ friend Cache* cache();
+
+ typedef HashMap<String, CachedResource*> CachedResourceMap;
+
+ struct LRUList {
+ CachedResource* m_head;
+ CachedResource* m_tail;
+ LRUList() : m_head(0), m_tail(0) { }
+ };
+
+ struct TypeStatistic {
+ int count;
+ int size;
+ int liveSize;
+ int decodedSize;
+ int purgeableSize;
+ int purgedSize;
+ TypeStatistic() : count(0), size(0), liveSize(0), decodedSize(0), purgeableSize(0), purgedSize(0) { }
+ void addResource(CachedResource*);
+ };
+
+ struct Statistics {
+ TypeStatistic images;
+ TypeStatistic cssStyleSheets;
+ TypeStatistic scripts;
+#if ENABLE(XSLT)
+ TypeStatistic xslStyleSheets;
+#endif
+#if ENABLE(XBL)
+ TypeStatistic xblDocs;
+#endif
+ TypeStatistic fonts;
+ };
+
+ // The loader that fetches resources.
+ Loader* loader() { return &m_loader; }
+
+ // Request resources from the cache. A load will be initiated and a cache object created if the object is not
+ // found in the cache.
+ CachedResource* requestResource(DocLoader*, CachedResource::Type, const KURL& url, const String& charset, bool isPreload = false);
+
+ CachedCSSStyleSheet* requestUserCSSStyleSheet(DocLoader*, const String& url, const String& charset);
+
+ void revalidateResource(CachedResource*, DocLoader*);
+ void revalidationSucceeded(CachedResource* revalidatingResource, const ResourceResponse&);
+ void revalidationFailed(CachedResource* revalidatingResource);
+
+ // Sets the cache's memory capacities, in bytes. These will hold only approximately,
+ // since the decoded cost of resources like scripts and stylesheets is not known.
+ // - minDeadBytes: The maximum number of bytes that dead resources should consume when the cache is under pressure.
+ // - maxDeadBytes: The maximum number of bytes that dead resources should consume when the cache is not under pressure.
+ // - totalBytes: The maximum number of bytes that the cache should consume overall.
+ void setCapacities(unsigned minDeadBytes, unsigned maxDeadBytes, unsigned totalBytes);
+
+ // Turn the cache on and off. Disabling the cache will remove all resources from the cache. They may
+ // still live on if they are referenced by some Web page though.
+ void setDisabled(bool);
+ bool disabled() const { return m_disabled; }
+
+ void setPruneEnabled(bool enabled) { m_pruneEnabled = enabled; }
+ void prune()
+ {
+ if (m_liveSize + m_deadSize <= m_capacity && m_maxDeadCapacity && m_deadSize <= m_maxDeadCapacity) // Fast path.
+ return;
+
+ pruneDeadResources(); // Prune dead first, in case it was "borrowing" capacity from live.
+ pruneLiveResources();
+ }
+
+ void setDeadDecodedDataDeletionInterval(double interval) { m_deadDecodedDataDeletionInterval = interval; }
+ double deadDecodedDataDeletionInterval() const { return m_deadDecodedDataDeletionInterval; }
+
+ // Remove an existing cache entry from both the resource map and from the LRU list.
+ void remove(CachedResource* resource) { evict(resource); }
+
+ void addDocLoader(DocLoader*);
+ void removeDocLoader(DocLoader*);
+
+ CachedResource* resourceForURL(const String&);
+
+ // Calls to put the cached resource into and out of LRU lists.
+ void insertInLRUList(CachedResource*);
+ void removeFromLRUList(CachedResource*);
+
+ // Called to adjust the cache totals when a resource changes size.
+ void adjustSize(bool live, int delta);
+
+ // Track decoded resources that are in the cache and referenced by a Web page.
+ void insertInLiveDecodedResourcesList(CachedResource*);
+ void removeFromLiveDecodedResourcesList(CachedResource*);
+
+ void addToLiveResourcesSize(CachedResource*);
+ void removeFromLiveResourcesSize(CachedResource*);
+
+ // Function to collect cache statistics for the caches window in the Safari Debug menu.
+ Statistics getStatistics();
+
+private:
+ Cache();
+ ~Cache(); // Not implemented to make sure nobody accidentally calls delete -- WebCore does not delete singletons.
+
+ LRUList* lruListFor(CachedResource*);
+ void resourceAccessed(CachedResource*);
+#ifndef NDEBUG
+ void dumpStats();
+ void dumpLRULists(bool includeLive) const;
+#endif
+
+ unsigned liveCapacity() const;
+ unsigned deadCapacity() const;
+
+ void pruneDeadResources(); // Flush decoded and encoded data from resources not referenced by Web pages.
+public:
+ void pruneLiveResources(bool critical = false); // Flush decoded data from resources still referenced by Web pages.
+private:
+
+ void evict(CachedResource*);
+
+ // Member variables.
+ HashSet<DocLoader*> m_docLoaders;
+ Loader m_loader;
+
+ bool m_disabled; // Whether or not the cache is enabled.
+ bool m_pruneEnabled;
+ bool m_inPruneDeadResources;
+
+ unsigned m_capacity;
+ unsigned m_minDeadCapacity;
+ unsigned m_maxDeadCapacity;
+ double m_deadDecodedDataDeletionInterval;
+
+ unsigned m_liveSize; // The number of bytes currently consumed by "live" resources in the cache.
+ unsigned m_deadSize; // The number of bytes currently consumed by "dead" resources in the cache.
+
+ // Size-adjusted and popularity-aware LRU list collection for cache objects. This collection can hold
+ // more resources than the cached resource map, since it can also hold "stale" muiltiple versions of objects that are
+ // waiting to die when the clients referencing them go away.
+ Vector<LRUList, 32> m_allResources;
+
+ // List just for live resources with decoded data. Access to this list is based off of painting the resource.
+ LRUList m_liveDecodedResources;
+
+ // A URL-based map of all resources that are in the cache (including the freshest version of objects that are currently being
+ // referenced by a Web page).
+ HashMap<String, CachedResource*> m_resources;
+};
+
+// Function to obtain the global cache.
+Cache* cache();
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CachePolicy_h
+#define CachePolicy_h
+
+namespace WebCore {
+
+ enum CachePolicy {
+ CachePolicyCache,
+ CachePolicyVerify,
+ CachePolicyRevalidate,
+ CachePolicyReload
+ };
+
+}
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
+ Copyright (C) 2001 Dirk Mueller <mueller@kde.org>
+ Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+ This class provides all functionality needed for loading images, style sheets and html
+ pages from the web. It has a memory cache for these objects.
+*/
+
+#ifndef CachedCSSStyleSheet_h
+#define CachedCSSStyleSheet_h
+
+#include "CachedResource.h"
+#include "TextEncoding.h"
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+ class DocLoader;
+ class TextResourceDecoder;
+
+ class CachedCSSStyleSheet : public CachedResource {
+ public:
+ CachedCSSStyleSheet(const String& URL, const String& charset);
+ virtual ~CachedCSSStyleSheet();
+
+ const String sheetText(bool enforceMIMEType = true) const;
+
+ virtual void addClient(CachedResourceClient*);
+
+ virtual void allClientsRemoved();
+
+ virtual void setEncoding(const String&);
+ virtual String encoding() const;
+ virtual void data(PassRefPtr<SharedBuffer> data, bool allDataReceived);
+ virtual void error();
+
+ virtual bool schedule() const { return true; }
+
+ void checkNotify();
+
+ private:
+ bool canUseSheet(bool enforceMIMEType) const;
+
+ protected:
+ RefPtr<TextResourceDecoder> m_decoder;
+ String m_decodedSheetText;
+ };
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CachedFont_h
+#define CachedFont_h
+
+#include "CachedResource.h"
+#include "FontRenderingMode.h"
+#include <wtf/Vector.h>
+
+#if ENABLE(SVG_FONTS)
+#include "SVGElement.h"
+#include "SVGDocument.h"
+#endif
+
+namespace WebCore {
+
+class DocLoader;
+class Cache;
+class FontCustomPlatformData;
+class FontPlatformData;
+class SVGFontElement;
+
+class CachedFont : public CachedResource {
+public:
+ CachedFont(const String& url);
+ virtual ~CachedFont();
+
+ virtual void load(DocLoader* docLoader);
+
+ virtual void addClient(CachedResourceClient*);
+ virtual void data(PassRefPtr<SharedBuffer> data, bool allDataReceived);
+ virtual void error();
+
+ virtual void allClientsRemoved();
+
+ virtual bool schedule() const { return true; }
+
+ void checkNotify();
+
+ void beginLoadIfNeeded(DocLoader* dl);
+
+ bool ensureCustomFontData();
+ FontPlatformData platformDataFromCustomData(float size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode);
+
+#if ENABLE(SVG_FONTS)
+ bool isSVGFont() const { return m_isSVGFont; }
+ void setSVGFont(bool isSVG) { m_isSVGFont = isSVG; }
+ bool ensureSVGFontData();
+ SVGFontElement* getSVGFontById(const String&) const;
+#endif
+
+private:
+ FontCustomPlatformData* m_fontData;
+ bool m_loadInitiated;
+
+#if ENABLE(SVG_FONTS)
+ bool m_isSVGFont;
+ RefPtr<SVGDocument> m_externalSVGDocument;
+#endif
+
+ friend class Cache;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CachedFrame_h
+#define CachedFrame_h
+
+#include "KURL.h"
+#include "ScriptCachedFrameData.h"
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+ class CachedFramePlatformData;
+ class DOMWindow;
+ class Document;
+ class DocumentLoader;
+ class Frame;
+ class FrameView;
+ class Node;
+
+class CachedFrame : public Noncopyable {
+public:
+ CachedFrame(Frame*);
+ ~CachedFrame();
+
+ void restore(Frame*);
+ void clear();
+
+ Document* document() const { return m_document.get(); }
+ DocumentLoader* documentLoader() const { return m_documentLoader.get(); }
+ FrameView* view() const { return m_view.get(); }
+ Node* mousePressNode() const { return m_mousePressNode.get(); }
+ const KURL& url() const { return m_URL; }
+ DOMWindow* domWindow() const { return m_cachedFrameScriptData.domWindow(); }
+
+ void setCachedFramePlatformData(CachedFramePlatformData*);
+ CachedFramePlatformData* cachedFramePlatformData();
+
+private:
+ RefPtr<Document> m_document;
+ RefPtr<DocumentLoader> m_documentLoader;
+ RefPtr<FrameView> m_view;
+ RefPtr<Node> m_mousePressNode;
+ KURL m_URL;
+ ScriptCachedFrameData m_cachedFrameScriptData;
+ OwnPtr<CachedFramePlatformData> m_cachedFramePlatformData;
+};
+
+} // namespace WebCore
+
+#endif // CachedFrame_h
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef CachedFramePlatformData_h
+#define CachedFramePlatformData_h
+
+namespace WebCore {
+
+// The purpose of this class is to give each platform a vessel to store platform data when a page
+// goes into the Back/Forward page cache, and perform some action with that data when the page comes out.
+// Each platform should subclass this class as neccessary
+
+class CachedFramePlatformData {
+public:
+ virtual ~CachedFramePlatformData() { }
+ virtual void clear() { }
+};
+
+} // namespace WebCore
+
+#endif // CachedFramePlatformData_h
--- /dev/null
+/*
+ Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
+ Copyright (C) 2001 Dirk Mueller <mueller@kde.org>
+ Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef CachedImage_h
+#define CachedImage_h
+
+#include "CachedResource.h"
+#include "ImageObserver.h"
+#include "Image.h"
+#include "IntRect.h"
+#include "Timer.h"
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class DocLoader;
+class Cache;
+
+class CachedImage : public CachedResource, public ImageObserver {
+ friend class Cache;
+
+public:
+ CachedImage(const String& url);
+ CachedImage(Image*);
+ virtual ~CachedImage();
+
+ virtual void load(DocLoader* docLoader);
+
+ Image* image() const;
+
+ bool canRender(float multiplier) const { return !errorOccurred() && !imageSize(multiplier).isEmpty(); }
+
+ // These are only used for SVGImage right now
+ void setImageContainerSize(const IntSize&);
+ bool usesImageContainerSize() const;
+ bool imageHasRelativeWidth() const;
+ bool imageHasRelativeHeight() const;
+
+ // Both of these methods take a zoom multiplier that can be used to increase the natural size of the image by the
+ // zoom.
+ IntSize imageSize(float multiplier) const; // returns the size of the complete image.
+ IntRect imageRect(float multiplier) const; // The size of the currently decoded portion of the image.
+
+ virtual void addClient(CachedResourceClient*);
+
+ virtual void allClientsRemoved();
+ virtual void destroyDecodedData();
+
+ virtual void data(PassRefPtr<SharedBuffer> data, bool allDataReceived);
+ virtual void error();
+
+ virtual bool schedule() const { return true; }
+
+ void checkNotify();
+
+ virtual bool isImage() const { return true; }
+
+ void clear();
+
+ bool stillNeedsLoad() const { return !m_errorOccurred && m_status == Unknown && m_loading == false; }
+ void load();
+
+ // ImageObserver
+ virtual void decodedSizeChanged(const Image* image, int delta);
+ virtual void didDraw(const Image*);
+
+ virtual bool shouldPauseAnimation(const Image*);
+ virtual void animationAdvanced(const Image*);
+ virtual void changedInRect(const Image*, const IntRect&);
+
+ virtual bool shouldDecodeFrame(const Image* image, const IntSize& frameSize);
+
+private:
+ void createImage();
+ size_t maximumDecodedImageSize();
+ // If not null, changeRect is the changed part of the image.
+ void notifyObservers(const IntRect* changeRect = 0);
+ void decodedDataDeletionTimerFired(Timer<CachedImage>*);
+
+ RefPtr<Image> m_image;
+ Timer<CachedImage> m_decodedDataDeletionTimer;
+
+public:
+ unsigned animatedImageSize();
+ void stopAnimatedImage();
+
+private:
+ bool checkOutOfMemory();
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CachedPage_h
+#define CachedPage_h
+
+#include "CachedFrame.h"
+
+namespace WebCore {
+
+ class CachedFrame;
+ class CachedFramePlatformData;
+ class DOMWindow;
+ class Document;
+ class DocumentLoader;
+ class FrameView;
+ class KURL;
+ class Node;
+ class Page;
+
+class CachedPage : public RefCounted<CachedPage> {
+public:
+ static PassRefPtr<CachedPage> create(Page*);
+ ~CachedPage();
+
+ void restore(Page*);
+ void clear();
+
+ Document* document() const { return m_cachedMainFrame.document(); }
+ DocumentLoader* documentLoader() const { return m_cachedMainFrame.documentLoader(); }
+ FrameView* view() const { return m_cachedMainFrame.view(); }
+ Node* mousePressNode() const { return m_cachedMainFrame.mousePressNode(); }
+ const KURL& url() const { return m_cachedMainFrame.url(); }
+ DOMWindow* domWindow() const { return m_cachedMainFrame.domWindow(); }
+
+ double timeStamp() const { return m_timeStamp; }
+
+ CachedFrame* cachedMainFrame() { return &m_cachedMainFrame; }
+
+private:
+ CachedPage(Page*);
+
+ double m_timeStamp;
+ CachedFrame m_cachedMainFrame;
+};
+
+} // namespace WebCore
+
+#endif // CachedPage_h
+
--- /dev/null
+/*
+ Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
+ Copyright (C) 2001 Dirk Mueller <mueller@kde.org>
+ Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef CachedResource_h
+#define CachedResource_h
+
+#include "CachePolicy.h"
+#include "PlatformString.h"
+#include "ResourceResponse.h"
+#include "SharedBuffer.h"
+#include <wtf/HashCountedSet.h>
+#include <wtf/HashSet.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/Vector.h>
+#include <time.h>
+
+namespace WebCore {
+
+class Cache;
+class CachedResourceClient;
+class CachedResourceHandleBase;
+class DocLoader;
+class InspectorResource;
+class Request;
+class PurgeableBuffer;
+
+// A resource that is held in the cache. Classes who want to use this object should derive
+// from CachedResourceClient, to get the function calls in case the requested data has arrived.
+// This class also does the actual communication with the loader to obtain the resource from the network.
+class CachedResource {
+ friend class Cache;
+ friend class InspectorResource;
+
+public:
+ enum Type {
+ ImageResource,
+ CSSStyleSheet,
+ Script,
+ FontResource
+#if ENABLE(XSLT)
+ , XSLStyleSheet
+#endif
+#if ENABLE(XBL)
+ , XBL
+#endif
+ };
+
+ enum Status {
+ NotCached, // this URL is not cached
+ Unknown, // let cache decide what to do with it
+ New, // inserting new item
+ Pending, // only partially loaded
+ Cached // regular case
+ };
+
+ CachedResource(const String& url, Type);
+ virtual ~CachedResource();
+
+ virtual void load(DocLoader* docLoader) { load(docLoader, false, false, true); }
+ void load(DocLoader*, bool incremental, bool skipCanLoadCheck, bool sendResourceLoadCallbacks);
+
+ virtual void setEncoding(const String&) { }
+ virtual String encoding() const { return String(); }
+ virtual void data(PassRefPtr<SharedBuffer> data, bool allDataReceived) = 0;
+ virtual void error() = 0;
+
+ const String &url() const { return m_url; }
+ Type type() const { return m_type; }
+
+ virtual void addClient(CachedResourceClient*);
+ void removeClient(CachedResourceClient*);
+ bool hasClients() const { return !m_clients.isEmpty(); }
+ void deleteIfPossible();
+
+ enum PreloadResult {
+ PreloadNotReferenced,
+ PreloadReferenced,
+ PreloadReferencedWhileLoading,
+ PreloadReferencedWhileComplete
+ };
+ PreloadResult preloadResult() const { return m_preloadResult; }
+ void setRequestedFromNetworkingLayer() { m_requestedFromNetworkingLayer = true; }
+
+ virtual void allClientsRemoved() { }
+
+ unsigned count() const { return m_clients.size(); }
+
+ Status status() const { return m_status; }
+
+ unsigned size() const { return encodedSize() + decodedSize() + overheadSize(); }
+ unsigned encodedSize() const { return m_encodedSize; }
+ unsigned decodedSize() const { return m_decodedSize; }
+ unsigned overheadSize() const;
+
+ bool isLoaded() const { return !m_loading; }
+ void setLoading(bool b) { m_loading = b; }
+
+ virtual bool isImage() const { return false; }
+
+ unsigned accessCount() const { return m_accessCount; }
+ void increaseAccessCount() { m_accessCount++; }
+
+ // Computes the status of an object after loading.
+ // Updates the expire date on the cache entry file
+ void finish();
+
+ // Called by the cache if the object has been removed from the cache
+ // while still being referenced. This means the object should delete itself
+ // if the number of clients observing it ever drops to 0.
+ void setInCache(bool b) { m_inCache = b; }
+ bool inCache() const { return m_inCache; }
+
+ void setInLiveDecodedResourcesList(bool b) { m_inLiveDecodedResourcesList = b; }
+ bool inLiveDecodedResourcesList() { return m_inLiveDecodedResourcesList; }
+
+ void setRequest(Request*);
+
+ SharedBuffer* data() const { ASSERT(!m_purgeableData); return m_data.get(); }
+
+ void setResponse(const ResourceResponse&);
+ const ResourceResponse& response() const { return m_response; }
+
+ bool canDelete() const { return !hasClients() && !m_request && !m_preloadCount && !m_handleCount && !m_resourceToRevalidate && !m_isBeingRevalidated; }
+
+ bool isExpired() const;
+
+ virtual bool schedule() const { return false; }
+
+ // List of acceptable MIME types seperated by ",".
+ // A MIME type may contain a wildcard, e.g. "text/*".
+ String accept() const { return m_accept; }
+ void setAccept(const String& accept) { m_accept = accept; }
+
+ bool errorOccurred() const { return m_errorOccurred; }
+ bool sendResourceLoadCallbacks() const { return m_sendResourceLoadCallbacks; }
+
+ virtual void destroyDecodedData() { }
+
+ void setDocLoader(DocLoader* docLoader) { m_docLoader = docLoader; }
+
+ bool isPreloaded() const { return m_preloadCount; }
+ void increasePreloadCount() { ++m_preloadCount; }
+ void decreasePreloadCount() { ASSERT(m_preloadCount); --m_preloadCount; }
+
+ void registerHandle(CachedResourceHandleBase* h) { ++m_handleCount; if (m_resourceToRevalidate) m_handlesToRevalidate.add(h); }
+ void unregisterHandle(CachedResourceHandleBase* h) { --m_handleCount; if (m_resourceToRevalidate) m_handlesToRevalidate.remove(h); if (!m_handleCount) deleteIfPossible(); }
+
+ bool canUseCacheValidator() const;
+ bool mustRevalidate(CachePolicy) const;
+ bool isCacheValidator() const { return m_resourceToRevalidate; }
+ CachedResource* resourceToRevalidate() const { return m_resourceToRevalidate; }
+
+ bool isPurgeable() const;
+ bool wasPurged() const;
+
+protected:
+ void setEncodedSize(unsigned);
+ void setDecodedSize(unsigned);
+ void didAccessDecodedData(double timeStamp);
+
+ bool makePurgeable(bool purgeable);
+ bool isSafeToMakePurgeable() const;
+
+ DocLoader* docLoader() const { return m_docLoader; }
+
+ HashCountedSet<CachedResourceClient*> m_clients;
+
+ String m_url;
+ String m_accept;
+ Request* m_request;
+
+ ResourceResponse m_response;
+ RefPtr<SharedBuffer> m_data;
+ OwnPtr<PurgeableBuffer> m_purgeableData;
+
+ Type m_type;
+ Status m_status;
+
+ bool m_errorOccurred;
+
+private:
+ // These are called by the friendly Cache only
+ void setResourceToRevalidate(CachedResource*);
+ void switchClientsToRevalidatedResource();
+ void clearResourceToRevalidate();
+ void setExpirationDate(time_t expirationDate) { m_expirationDate = expirationDate; }
+
+ unsigned m_encodedSize;
+ unsigned m_decodedSize;
+ unsigned m_accessCount;
+ unsigned m_inLiveDecodedResourcesList;
+ double m_lastDecodedAccessTime; // Used as a "thrash guard" in the cache
+
+ bool m_sendResourceLoadCallbacks;
+
+ unsigned m_preloadCount;
+ PreloadResult m_preloadResult;
+ bool m_requestedFromNetworkingLayer;
+
+protected:
+ bool m_inCache;
+ bool m_loading;
+ bool m_expireDateChanged;
+#ifndef NDEBUG
+ bool m_deleted;
+ unsigned m_lruIndex;
+#endif
+
+private:
+ CachedResource* m_nextInAllResourcesList;
+ CachedResource* m_prevInAllResourcesList;
+
+ CachedResource* m_nextInLiveResourcesList;
+ CachedResource* m_prevInLiveResourcesList;
+
+ DocLoader* m_docLoader; // only non-0 for resources that are not in the cache
+
+ unsigned m_handleCount;
+ // If this field is non-null we are using the resource as a proxy for checking whether an existing resource is still up to date
+ // using HTTP If-Modified-Since/If-None-Match headers. If the response is 304 all clients of this resource are moved
+ // to to be clients of m_resourceToRevalidate and the resource is deleted. If not, the field is zeroed and this
+ // resources becomes normal resource load.
+ CachedResource* m_resourceToRevalidate;
+ bool m_isBeingRevalidated;
+ // These handles will need to be updated to point to the m_resourceToRevalidate in case we get 304 response.
+ HashSet<CachedResourceHandleBase*> m_handlesToRevalidate;
+
+ time_t m_expirationDate;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
+ Copyright (C) 2001 Dirk Mueller <mueller@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+ This class provides all functionality needed for loading images, style sheets and html
+ pages from the web. It has a memory cache for these objects.
+*/
+
+#ifndef CachedResourceClient_h
+#define CachedResourceClient_h
+
+#if ENABLE(XBL)
+namespace XBL {
+ class XBLDocument;
+}
+#endif
+
+namespace WebCore {
+
+ class CachedCSSStyleSheet;
+ class CachedFont;
+ class CachedResource;
+ class CachedImage;
+ class String;
+ class Image;
+ class IntRect;
+
+ /**
+ * @internal
+ *
+ * a client who wants to load stylesheets, images or scripts from the web has to
+ * inherit from this class and overload one of the 3 functions
+ *
+ */
+ class CachedResourceClient
+ {
+ public:
+ virtual ~CachedResourceClient() { }
+
+ // Called whenever a frame of an image changes, either because we got more data from the network or
+ // because we are animating. If not null, the IntRect is the changed rect of the image.
+ virtual void imageChanged(CachedImage*, const IntRect* = 0) { };
+
+ // Called to find out if this client wants to actually display the image. Used to tell when we
+ // can halt animation. Content nodes that hold image refs for example would not render the image,
+ // but RenderImages would (assuming they have visibility: visible and their render tree isn't hidden
+ // e.g., in the b/f cache or in a background tab).
+ virtual bool willRenderImage(CachedImage*) { return false; }
+
+ virtual bool memoryLimitReached() { return false; }
+
+ virtual void setCSSStyleSheet(const String& /*URL*/, const String& /*charset*/, const CachedCSSStyleSheet*) { }
+ virtual void setXSLStyleSheet(const String& /*URL*/, const String& /*sheet*/) { }
+
+ virtual void fontLoaded(CachedFont*) {};
+
+#if ENABLE(XBL)
+ virtual void setXBLDocument(const String& /*URL*/, XBL::XBLDocument*) { }
+#endif
+
+ virtual void notifyFinished(CachedResource*) { }
+ };
+
+}
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
+ Copyright (C) 2001 Dirk Mueller <mueller@kde.org>
+ Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+ This class provides all functionality needed for loading images, style sheets and html
+ pages from the web. It has a memory cache for these objects.
+*/
+
+#ifndef CachedResourceClientWalker_h
+#define CachedResourceClientWalker_h
+
+#include <wtf/HashCountedSet.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+ class CachedResourceClient;
+
+ // Call this "walker" instead of iterator so people won't expect Qt or STL-style iterator interface.
+ // Just keep calling next() on this. It's safe from deletions of items.
+ class CachedResourceClientWalker {
+ public:
+ CachedResourceClientWalker(const HashCountedSet<CachedResourceClient*>&);
+ CachedResourceClient* next();
+ private:
+ const HashCountedSet<CachedResourceClient*>& m_clientSet;
+ Vector<CachedResourceClient*> m_clientVector;
+ size_t m_index;
+ };
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CachedResourceHandle_h
+#define CachedResourceHandle_h
+
+#include "CachedResource.h"
+
+namespace WebCore {
+
+ class CachedResourceHandleBase {
+ public:
+ ~CachedResourceHandleBase() { if (m_resource) m_resource->unregisterHandle(this); }
+ CachedResource* get() const { return m_resource; }
+
+ bool operator!() const { return !m_resource; }
+
+ // This conversion operator allows implicit conversion to bool but not to other integer types.
+ typedef CachedResource* CachedResourceHandleBase::*UnspecifiedBoolType;
+ operator UnspecifiedBoolType() const { return m_resource ? &CachedResourceHandleBase::m_resource : 0; }
+
+ protected:
+ CachedResourceHandleBase() : m_resource(0) {}
+ CachedResourceHandleBase(CachedResource* res) { m_resource = res; if (m_resource) m_resource->registerHandle(this); }
+ CachedResourceHandleBase(const CachedResourceHandleBase& o) : m_resource(o.m_resource) { if (m_resource) m_resource->registerHandle(this); }
+
+ void setResource(CachedResource*);
+
+ private:
+ CachedResourceHandleBase& operator=(const CachedResourceHandleBase&) { return *this; }
+
+ friend class CachedResource;
+
+ CachedResource* m_resource;
+ };
+
+ template <class R> class CachedResourceHandle : public CachedResourceHandleBase {
+ public:
+ CachedResourceHandle() { }
+ CachedResourceHandle(R* res) : CachedResourceHandleBase(res) { }
+ CachedResourceHandle(const CachedResourceHandle<R>& o) : CachedResourceHandleBase(o) { }
+
+ R* get() const { return reinterpret_cast<R*>(CachedResourceHandleBase::get()); }
+ R* operator->() const { return get(); }
+
+ CachedResourceHandle& operator=(R* res) { setResource(res); return *this; }
+ CachedResourceHandle& operator=(const CachedResourceHandle& o) { setResource(o.get()); return *this; }
+ bool operator==(const CachedResourceHandleBase& o) const { return get() == o.get(); }
+ bool operator!=(const CachedResourceHandleBase& o) const { return get() != o.get(); }
+ };
+
+ template <class R, class RR> bool operator==(const CachedResourceHandle<R>& h, const RR* res)
+ {
+ return h.get() == res;
+ }
+ template <class R, class RR> bool operator==(const RR* res, const CachedResourceHandle<R>& h)
+ {
+ return h.get() == res;
+ }
+ template <class R, class RR> bool operator!=(const CachedResourceHandle<R>& h, const RR* res)
+ {
+ return h.get() != res;
+ }
+ template <class R, class RR> bool operator!=(const RR* res, const CachedResourceHandle<R>& h)
+ {
+ return h.get() != res;
+ }
+}
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
+ Copyright (C) 2001 Dirk Mueller <mueller@kde.org>
+ Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+ This class provides all functionality needed for loading images, style sheets and html
+ pages from the web. It has a memory cache for these objects.
+*/
+
+#ifndef CachedScript_h
+#define CachedScript_h
+
+#include "CachedResource.h"
+#include "TextEncoding.h"
+#include "Timer.h"
+
+namespace WebCore {
+
+ class DocLoader;
+
+ class CachedScript : public CachedResource {
+ public:
+ CachedScript(const String& url, const String& charset);
+ virtual ~CachedScript();
+
+ const String& script();
+
+ virtual void addClient(CachedResourceClient*);
+ virtual void allClientsRemoved();
+
+ virtual void setEncoding(const String&);
+ virtual String encoding() const;
+ virtual void data(PassRefPtr<SharedBuffer> data, bool allDataReceived);
+ virtual void error();
+
+ virtual bool schedule() const { return false; }
+
+ void checkNotify();
+
+ virtual void destroyDecodedData();
+
+ private:
+ void decodedDataDeletionTimerFired(Timer<CachedScript>*);
+
+ String m_script;
+ TextEncoding m_encoding;
+ Timer<CachedScript> m_decodedDataDeletionTimer;
+ };
+}
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
+ Copyright (C) 2001 Dirk Mueller <mueller@kde.org>
+ Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+ This class provides all functionality needed for loading images, style sheets and html
+ pages from the web. It has a memory cache for these objects.
+*/
+
+#ifndef CachedXBLDocument_h
+#define CachedXBLDocument_h
+
+#include "CachedResource.h"
+#include <wtf/Vector.h>
+
+namespace WebCore {
+ class CachedResource;
+ class Request;
+ class DocLoader;
+ class TextResourceDecoder;
+ class CachedResourceClient;
+
+#if ENABLE(XBL)
+ class CachedXBLDocument : public CachedResource {
+ public:
+ CachedXBLDocument(const String& url);
+ virtual ~CachedXBLDocument();
+
+ XBL::XBLDocument* document() const { return m_document; }
+
+ virtual void addClient(CachedResourceClient*);
+
+ virtual void setEncoding(const String&);
+ virtual String encoding() const;
+ virtual void data(Vector<char>&, bool allDataReceived);
+ virtual void error();
+
+ virtual bool schedule() const { return true; }
+
+ void checkNotify();
+
+ protected:
+ XBL::XBLDocument* m_document;
+ RefPtr<TextResourceDecoder> m_decoder;
+ };
+
+#endif
+
+}
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
+ Copyright (C) 2001 Dirk Mueller <mueller@kde.org>
+ Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+ This class provides all functionality needed for loading images, style sheets and html
+ pages from the web. It has a memory cache for these objects.
+*/
+
+#ifndef CachedXSLStyleSheet_h
+#define CachedXSLStyleSheet_h
+
+#include "CachedResource.h"
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+ class DocLoader;
+ class TextResourceDecoder;
+
+#if ENABLE(XSLT)
+ class CachedXSLStyleSheet : public CachedResource {
+ public:
+ CachedXSLStyleSheet(const String& url);
+
+ const String& sheet() const { return m_sheet; }
+
+ virtual void addClient(CachedResourceClient*);
+
+ virtual void setEncoding(const String&);
+ virtual String encoding() const;
+ virtual void data(PassRefPtr<SharedBuffer> data, bool allDataReceived);
+ virtual void error();
+
+ virtual bool schedule() const { return true; }
+
+ void checkNotify();
+
+ protected:
+ String m_sheet;
+ RefPtr<TextResourceDecoder> m_decoder;
+ };
+
+#endif
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2007 Alp Toker <alp@atoker.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CanvasGradient_h
+#define CanvasGradient_h
+
+#include "Gradient.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+ class String;
+
+ typedef int ExceptionCode;
+
+ class CanvasGradient : public RefCounted<CanvasGradient> {
+ public:
+ static PassRefPtr<CanvasGradient> create(const FloatPoint& p0, const FloatPoint& p1)
+ {
+ return adoptRef(new CanvasGradient(p0, p1));
+ }
+ static PassRefPtr<CanvasGradient> create(const FloatPoint& p0, float r0, const FloatPoint& p1, float r1)
+ {
+ return adoptRef(new CanvasGradient(p0, r0, p1, r1));
+ }
+
+ Gradient* gradient() const { return m_gradient.get(); }
+
+ void addColorStop(float value, const String& color, ExceptionCode&);
+
+ void getColor(float value, float* r, float* g, float* b, float* a) const { m_gradient->getColor(value, r, g, b, a); }
+
+ private:
+ CanvasGradient(const FloatPoint& p0, const FloatPoint& p1);
+ CanvasGradient(const FloatPoint& p0, float r0, const FloatPoint& p1, float r1);
+
+ RefPtr<Gradient> m_gradient;
+ };
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CanvasPattern_h
+#define CanvasPattern_h
+
+#include "Pattern.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+ class Image;
+ class String;
+
+ typedef int ExceptionCode;
+
+ class CanvasPattern : public RefCounted<CanvasPattern> {
+ public:
+ static void parseRepetitionType(const String&, bool& repeatX, bool& repeatY, ExceptionCode&);
+
+ static PassRefPtr<CanvasPattern> create(Image* image, bool repeatX, bool repeatY, bool originClean)
+ {
+ return adoptRef(new CanvasPattern(image, repeatX, repeatY, originClean));
+ }
+
+ Pattern* pattern() const { return m_pattern.get(); }
+
+ bool originClean() const { return m_originClean; }
+
+ private:
+ CanvasPattern(Image*, bool repeatX, bool repeatY, bool originClean);
+
+ RefPtr<Pattern> m_pattern;
+ bool m_originClean;
+ };
+
+} // namespace WebCore
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CanvasPixelArray_h
+#define CanvasPixelArray_h
+
+#include <wtf/ByteArray.h>
+#include <wtf/MathExtras.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+ class CanvasPixelArray : public RefCounted<CanvasPixelArray> {
+ public:
+ static PassRefPtr<CanvasPixelArray> create(unsigned length);
+
+ WTF::ByteArray* data() { return m_data.get(); }
+ unsigned length() const { return m_data->length(); }
+
+ void set(unsigned index, double value)
+ {
+ m_data->set(index, value);
+ }
+
+ bool get(unsigned index, unsigned char& result) const
+ {
+ return m_data->get(index, result);
+ }
+
+ private:
+ CanvasPixelArray(unsigned length);
+ RefPtr<WTF::ByteArray> m_data;
+ };
+
+} // namespace WebCore
+
+#endif // CanvasPixelArray_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CanvasRenderingContext2D_h
+#define CanvasRenderingContext2D_h
+
+#include "TransformationMatrix.h"
+#include "FloatSize.h"
+#include "Font.h"
+#include "GraphicsTypes.h"
+#include "Path.h"
+#include "PlatformString.h"
+#include <wtf/Vector.h>
+
+#if PLATFORM(CG)
+#include <CoreGraphics/CoreGraphics.h>
+#endif
+
+namespace WebCore {
+
+ class CanvasGradient;
+ class CanvasPattern;
+ class CanvasStyle;
+ class FloatRect;
+ class GraphicsContext;
+ class HTMLCanvasElement;
+ class HTMLImageElement;
+ class ImageData;
+ class KURL;
+ class TextMetrics;
+
+ typedef int ExceptionCode;
+
+ class CanvasRenderingContext2D : Noncopyable {
+ public:
+ CanvasRenderingContext2D(HTMLCanvasElement*);
+
+ void ref();
+ void deref();
+
+ HTMLCanvasElement* canvas() const { return m_canvas; }
+
+ CanvasStyle* strokeStyle() const;
+ void setStrokeStyle(PassRefPtr<CanvasStyle>);
+
+ CanvasStyle* fillStyle() const;
+ void setFillStyle(PassRefPtr<CanvasStyle>);
+
+ float lineWidth() const;
+ void setLineWidth(float);
+
+ String lineCap() const;
+ void setLineCap(const String&);
+
+ String lineJoin() const;
+ void setLineJoin(const String&);
+
+ float miterLimit() const;
+ void setMiterLimit(float);
+
+ float shadowOffsetX() const;
+ void setShadowOffsetX(float);
+
+ float shadowOffsetY() const;
+ void setShadowOffsetY(float);
+
+ float shadowBlur() const;
+ void setShadowBlur(float);
+
+ String shadowColor() const;
+ void setShadowColor(const String&);
+
+ float globalAlpha() const;
+ void setGlobalAlpha(float);
+
+ String globalCompositeOperation() const;
+ void setGlobalCompositeOperation(const String&);
+
+ void save();
+ void restore();
+
+ void scale(float sx, float sy);
+ void rotate(float angleInRadians);
+ void translate(float tx, float ty);
+ void transform(float m11, float m12, float m21, float m22, float dx, float dy);
+ void setTransform(float m11, float m12, float m21, float m22, float dx, float dy);
+
+ void setStrokeColor(const String& color);
+ void setStrokeColor(float grayLevel);
+ void setStrokeColor(const String& color, float alpha);
+ void setStrokeColor(float grayLevel, float alpha);
+ void setStrokeColor(float r, float g, float b, float a);
+ void setStrokeColor(float c, float m, float y, float k, float a);
+
+ void setFillColor(const String& color);
+ void setFillColor(float grayLevel);
+ void setFillColor(const String& color, float alpha);
+ void setFillColor(float grayLevel, float alpha);
+ void setFillColor(float r, float g, float b, float a);
+ void setFillColor(float c, float m, float y, float k, float a);
+
+ void beginPath();
+ void closePath();
+
+ void moveTo(float x, float y);
+ void lineTo(float x, float y);
+ void quadraticCurveTo(float cpx, float cpy, float x, float y);
+ void bezierCurveTo(float cp1x, float cp1y, float cp2x, float cp2y, float x, float y);
+ void arcTo(float x0, float y0, float x1, float y1, float radius, ExceptionCode&);
+ void arc(float x, float y, float r, float sa, float ea, bool clockwise, ExceptionCode&);
+ void rect(float x, float y, float width, float height);
+
+ void fill();
+ void stroke();
+ void clip();
+
+ bool isPointInPath(const float x, const float y);
+
+ void clearRect(float x, float y, float width, float height);
+ void fillRect(float x, float y, float width, float height);
+ void strokeRect(float x, float y, float width, float height);
+ void strokeRect(float x, float y, float width, float height, float lineWidth);
+
+ void setShadow(float width, float height, float blur);
+ void setShadow(float width, float height, float blur, const String& color);
+ void setShadow(float width, float height, float blur, float grayLevel);
+ void setShadow(float width, float height, float blur, const String& color, float alpha);
+ void setShadow(float width, float height, float blur, float grayLevel, float alpha);
+ void setShadow(float width, float height, float blur, float r, float g, float b, float a);
+ void setShadow(float width, float height, float blur, float c, float m, float y, float k, float a);
+
+ void clearShadow();
+
+ void drawImage(HTMLImageElement*, float x, float y);
+ void drawImage(HTMLImageElement*, float x, float y, float width, float height, ExceptionCode&);
+ void drawImage(HTMLImageElement*, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionCode&);
+ void drawImage(HTMLCanvasElement*, float x, float y);
+ void drawImage(HTMLCanvasElement*, float x, float y, float width, float height, ExceptionCode&);
+ void drawImage(HTMLCanvasElement*, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionCode&);
+
+ void drawImageFromRect(HTMLImageElement*, float sx, float sy, float sw, float sh,
+ float dx, float dy, float dw, float dh, const String& compositeOperation);
+
+ void setAlpha(float);
+
+ void setCompositeOperation(const String&);
+
+ PassRefPtr<CanvasGradient> createLinearGradient(float x0, float y0, float x1, float y1, ExceptionCode&);
+ PassRefPtr<CanvasGradient> createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1, ExceptionCode&);
+ PassRefPtr<CanvasPattern> createPattern(HTMLImageElement*, const String& repetitionType, ExceptionCode&);
+ PassRefPtr<CanvasPattern> createPattern(HTMLCanvasElement*, const String& repetitionType, ExceptionCode&);
+
+ PassRefPtr<ImageData> createImageData(float width, float height) const;
+ PassRefPtr<ImageData> getImageData(float sx, float sy, float sw, float sh, ExceptionCode&) const;
+ void putImageData(ImageData*, float dx, float dy, ExceptionCode&);
+ void putImageData(ImageData*, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight, ExceptionCode&);
+
+ void reset();
+
+ String font() const;
+ void setFont(const String&);
+
+ String textAlign() const;
+ void setTextAlign(const String&);
+
+ String textBaseline() const;
+ void setTextBaseline(const String&);
+
+ void fillText(const String& text, float x, float y);
+ void fillText(const String& text, float x, float y, float maxWidth);
+ void strokeText(const String& text, float x, float y);
+ void strokeText(const String& text, float x, float y, float maxWidth);
+ PassRefPtr<TextMetrics> measureText(const String& text);
+
+ LineCap getLineCap() const { return state().m_lineCap; }
+ LineJoin getLineJoin() const { return state().m_lineJoin; }
+
+ private:
+ struct State {
+ State();
+
+ RefPtr<CanvasStyle> m_strokeStyle;
+ RefPtr<CanvasStyle> m_fillStyle;
+ float m_lineWidth;
+ LineCap m_lineCap;
+ LineJoin m_lineJoin;
+ float m_miterLimit;
+ FloatSize m_shadowOffset;
+ float m_shadowBlur;
+ String m_shadowColor;
+ float m_globalAlpha;
+ CompositeOperator m_globalComposite;
+ TransformationMatrix m_transform;
+ bool m_invertibleCTM;
+
+ // Text state.
+ TextAlign m_textAlign;
+ TextBaseline m_textBaseline;
+
+ String m_unparsedFont;
+ Font m_font;
+ bool m_realizedFont;
+ };
+ Path m_path;
+
+ State& state() { return m_stateStack.last(); }
+ const State& state() const { return m_stateStack.last(); }
+
+ void applyShadow();
+
+ enum CanvasWillDrawOption {
+ CanvasWillDrawApplyTransform = 1,
+ CanvasWillDrawApplyShadow = 1 << 1,
+ CanvasWillDrawApplyClip = 1 << 2,
+ CanvasWillDrawApplyAll = 0xffffffff
+ };
+
+ void willDraw(const FloatRect&, unsigned options = CanvasWillDrawApplyAll);
+
+ GraphicsContext* drawingContext() const;
+
+ void applyStrokePattern();
+ void applyFillPattern();
+
+ void drawTextInternal(const String& text, float x, float y, bool fill, float maxWidth = 0, bool useMaxWidth = false);
+
+ const Font& accessFont();
+
+#if ENABLE(DASHBOARD_SUPPORT)
+ void clearPathForDashboardBackwardCompatibilityMode();
+#endif
+
+ void checkOrigin(const KURL&);
+
+ HTMLCanvasElement* m_canvas;
+ Vector<State, 1> m_stateStack;
+ };
+
+} // namespace WebCore
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CanvasStyle_h
+#define CanvasStyle_h
+
+#include "PlatformString.h"
+
+namespace WebCore {
+
+ class CanvasGradient;
+ class CanvasPattern;
+ class GraphicsContext;
+
+ class CanvasStyle : public RefCounted<CanvasStyle> {
+ public:
+ static PassRefPtr<CanvasStyle> create(const String& color) { return adoptRef(new CanvasStyle(color)); }
+ static PassRefPtr<CanvasStyle> create(float grayLevel) { return adoptRef(new CanvasStyle(grayLevel)); }
+ static PassRefPtr<CanvasStyle> create(const String& color, float alpha) { return adoptRef(new CanvasStyle(color, alpha)); }
+ static PassRefPtr<CanvasStyle> create(float grayLevel, float alpha) { return adoptRef(new CanvasStyle(grayLevel, alpha)); }
+ static PassRefPtr<CanvasStyle> create(float r, float g, float b, float a) { return adoptRef(new CanvasStyle(r, g, b, a)); }
+ static PassRefPtr<CanvasStyle> create(float c, float m, float y, float k, float a) { return adoptRef(new CanvasStyle(c, m, y, k, a)); }
+ static PassRefPtr<CanvasStyle> create(PassRefPtr<CanvasGradient> gradient) { return adoptRef(new CanvasStyle(gradient)); }
+ static PassRefPtr<CanvasStyle> create(PassRefPtr<CanvasPattern> pattern) { return adoptRef(new CanvasStyle(pattern)); }
+
+ String color() const { return m_color; }
+ CanvasGradient* canvasGradient() const { return m_gradient.get(); }
+ CanvasPattern* canvasPattern() const { return m_pattern.get(); }
+
+ void applyFillColor(GraphicsContext*);
+ void applyStrokeColor(GraphicsContext*);
+
+ private:
+ CanvasStyle(const String& color);
+ CanvasStyle(float grayLevel);
+ CanvasStyle(const String& color, float alpha);
+ CanvasStyle(float grayLevel, float alpha);
+ CanvasStyle(float r, float g, float b, float a);
+ CanvasStyle(float c, float m, float y, float k, float a);
+ CanvasStyle(PassRefPtr<CanvasGradient>);
+ CanvasStyle(PassRefPtr<CanvasPattern>);
+
+ enum Type { ColorString, ColorStringWithAlpha, GrayLevel, RGBA, CMYKA, Gradient, ImagePattern };
+
+ Type m_type;
+
+ String m_color;
+ RefPtr<CanvasGradient> m_gradient;
+ RefPtr<CanvasPattern> m_pattern;
+
+ float m_alpha;
+
+ float m_grayLevel;
+
+ float m_red;
+ float m_green;
+ float m_blue;
+
+ float m_cyan;
+ float m_magenta;
+ float m_yellow;
+ float m_black;
+ };
+
+} // namespace WebCore
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef CharacterData_h
+#define CharacterData_h
+
+#include "EventTargetNode.h"
+
+namespace WebCore {
+
+class CharacterData : public EventTargetNode {
+public:
+ CharacterData(Document*, const String& text, bool isText = false);
+ CharacterData(Document*, bool isText = false);
+ virtual ~CharacterData();
+
+ // DOM methods & attributes for CharacterData
+
+ String data() const { return m_data; }
+ void setData(const String&, ExceptionCode&);
+ unsigned length() const { return m_data->length(); }
+ String substringData(unsigned offset, unsigned count, ExceptionCode&);
+ void appendData(const String&, ExceptionCode&);
+ void insertData(unsigned offset, const String&, ExceptionCode&);
+ void deleteData(unsigned offset, unsigned count, ExceptionCode&);
+ void replaceData(unsigned offset, unsigned count, const String &arg, ExceptionCode&);
+
+ bool containsOnlyWhitespace() const;
+
+ // DOM methods overridden from parent classes
+
+ virtual String nodeValue() const;
+ virtual void setNodeValue(const String&, ExceptionCode&);
+
+ // Other methods (not part of DOM)
+
+ virtual bool isCharacterDataNode() const { return true; }
+ virtual int maxCharacterOffset() const;
+ StringImpl* string() { return m_data.get(); }
+
+ virtual bool offsetInCharacters() const;
+ virtual bool rendererIsNeeded(RenderStyle*);
+
+protected:
+ RefPtr<StringImpl> m_data;
+
+ void dispatchModifiedEvent(StringImpl* oldValue);
+
+private:
+ void checkCharDataOperation(unsigned offset, ExceptionCode&);
+};
+
+} // namespace WebCore
+
+#endif // CharacterData_h
+
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CharacterNames_h
+#define CharacterNames_h
+
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+ // Names here are taken from the Unicode standard.
+
+ // Note, these are UChar constants, not UChar32, which makes them
+ // more convenient for WebCore code that mostly uses UTF-16.
+
+ const UChar blackSquare = 0x25A0;
+ const UChar bullet = 0x2022;
+ const UChar horizontalEllipsis = 0x2026;
+ const UChar ideographicSpace = 0x3000;
+ const UChar ideographicComma = 0x3001;
+ const UChar ideographicFullStop = 0x3002;
+ const UChar leftToRightMark = 0x200E;
+ const UChar leftToRightEmbed = 0x202A;
+ const UChar leftToRightOverride = 0x202D;
+ const UChar newlineCharacter = 0x000A;
+ const UChar noBreakSpace = 0x00A0;
+ const UChar objectReplacementCharacter = 0xFFFC;
+ const UChar popDirectionalFormatting = 0x202C;
+ const UChar replacementCharacter = 0xFFFD;
+ const UChar rightToLeftMark = 0x200F;
+ const UChar rightToLeftEmbed = 0x202B;
+ const UChar rightToLeftOverride = 0x202E;
+ const UChar softHyphen = 0x00AD;
+ const UChar whiteBullet = 0x25E6;
+ const UChar zeroWidthSpace = 0x200B;
+
+ const UChar AppleLogo = 0xF8FF;
+ const UChar BigDot = 0x25CF;
+}
+
+#endif // CharacterNames_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ChildNodeList_h
+#define ChildNodeList_h
+
+#include "DynamicNodeList.h"
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+ class ChildNodeList : public DynamicNodeList {
+ public:
+ static PassRefPtr<ChildNodeList> create(PassRefPtr<Node> rootNode, Caches* caches)
+ {
+ return adoptRef(new ChildNodeList(rootNode, caches));
+ }
+
+ virtual unsigned length() const;
+ virtual Node* item(unsigned index) const;
+
+ protected:
+ ChildNodeList(PassRefPtr<Node> rootNode, Caches*);
+
+ virtual bool nodeMatches(Element*) const;
+ };
+
+} // namespace WebCore
+
+#endif // ChildNodeList_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef Chrome_h
+#define Chrome_h
+
+#include "FileChooser.h"
+#include "FocusDirection.h"
+#include "HostWindow.h"
+#include <wtf/Forward.h>
+#include <wtf/RefPtr.h>
+
+#ifndef __OBJC__
+class WAKView;
+#else
+@class WAKView;
+#endif
+
+#if PLATFORM(MAC)
+#ifndef __OBJC__
+class NSView;
+#endif
+#endif
+
+namespace WebCore {
+
+ class ChromeClient;
+ class ContextMenu;
+ class FloatRect;
+ class Frame;
+ class Geolocation;
+ class HitTestResult;
+ class IntRect;
+ class Page;
+ class String;
+
+ struct FrameLoadRequest;
+ struct WindowFeatures;
+
+ class Chrome : public HostWindow {
+ public:
+ Chrome(Page*, ChromeClient*);
+ ~Chrome();
+
+ ChromeClient* client() { return m_client; }
+
+ // HostWindow methods.
+ virtual void repaint(const IntRect&, bool contentChanged, bool immediate = false, bool repaintContentOnly = false);
+ virtual void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
+ virtual IntPoint screenToWindow(const IntPoint&) const;
+ virtual IntRect windowToScreen(const IntRect&) const;
+ virtual PlatformWidget platformWindow() const;
+ virtual void scrollRectIntoView(const IntRect&, const ScrollView*) const;
+
+ void contentsSizeChanged(Frame*, const IntSize&) const;
+
+ void setWindowRect(const FloatRect&) const;
+ FloatRect windowRect() const;
+
+ FloatRect pageRect() const;
+
+ float scaleFactor();
+
+ void focus(bool userGesture) const;
+ void unfocus() const;
+
+ bool canTakeFocus(FocusDirection) const;
+ void takeFocus(FocusDirection) const;
+
+ Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&, const bool) const;
+ void show() const;
+
+ bool canRunModal() const;
+ bool canRunModalNow() const;
+ void runModal() const;
+
+ void setToolbarsVisible(bool) const;
+ bool toolbarsVisible() const;
+
+ void setStatusbarVisible(bool) const;
+ bool statusbarVisible() const;
+
+ void setScrollbarsVisible(bool) const;
+ bool scrollbarsVisible() const;
+
+ void setMenubarVisible(bool) const;
+ bool menubarVisible() const;
+
+ void setResizable(bool) const;
+
+ bool canRunBeforeUnloadConfirmPanel();
+ bool runBeforeUnloadConfirmPanel(const String& message, Frame* frame);
+
+ void closeWindowSoon();
+
+ void runJavaScriptAlert(Frame*, const String&);
+ bool runJavaScriptConfirm(Frame*, const String&);
+ bool runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result);
+ void setStatusbarText(Frame*, const String&);
+ bool shouldInterruptJavaScript();
+
+ IntRect windowResizerRect() const;
+
+ void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
+
+ void setToolTip(const HitTestResult&);
+
+ void print(Frame*);
+
+ void enableSuddenTermination();
+ void disableSuddenTermination();
+
+ bool requestGeolocationPermissionForFrame(Frame*, Geolocation*);
+
+ void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
+
+#if PLATFORM(MAC)
+ void focusNSView(NSView*);
+#endif
+
+ private:
+ Page* m_page;
+ ChromeClient* m_client;
+ };
+}
+
+#endif // Chrome_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef ChromeClient_h
+#define ChromeClient_h
+
+#include "FocusDirection.h"
+#include "GraphicsContext.h"
+#include "HostWindow.h"
+#include "ScrollTypes.h"
+#include <wtf/Forward.h>
+#include <wtf/Vector.h>
+
+#include "Console.h"
+#include <wtf/HashMap.h>
+
+#if PLATFORM(MAC)
+#include "WebCoreKeyboardUIMode.h"
+#endif
+
+#define NSResponder WAKResponder
+#ifndef __OBJC__
+class WAKResponder;
+#else
+@class WAKResponder;
+#endif
+
+#ifndef __OBJC__
+class NSMenu;
+class NSResponder;
+#endif
+
+namespace WebCore {
+
+ class AtomicString;
+ class FileChooser;
+ class FloatRect;
+ class Frame;
+ class Geolocation;
+ class HTMLParserQuirks;
+ class HitTestResult;
+ class IntRect;
+ class Node;
+ class Page;
+ class String;
+ class Widget;
+
+ struct FrameLoadRequest;
+ struct ViewportArguments;
+ struct WindowFeatures;
+
+#if USE(ACCELERATED_COMPOSITING)
+ class GraphicsLayer;
+#endif
+
+ class ChromeClient {
+ public:
+ virtual void chromeDestroyed() = 0;
+
+ virtual void setWindowRect(const FloatRect&) = 0;
+ virtual FloatRect windowRect() = 0;
+
+ virtual FloatRect pageRect() = 0;
+
+ virtual float scaleFactor() = 0;
+
+ virtual void focus(bool userGesture) = 0;
+ virtual void unfocus() = 0;
+
+ virtual bool canTakeFocus(FocusDirection) = 0;
+ virtual void takeFocus(FocusDirection) = 0;
+
+ // The Frame pointer provides the ChromeClient with context about which
+ // Frame wants to create the new Page. Also, the newly created window
+ // should not be shown to the user until the ChromeClient of the newly
+ // created Page has its show method called.
+ virtual Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&, const bool userGesture) = 0;
+ virtual void show() = 0;
+
+ virtual bool canRunModal() = 0;
+ virtual void runModal() = 0;
+
+ virtual void setToolbarsVisible(bool) = 0;
+ virtual bool toolbarsVisible() = 0;
+
+ virtual void setStatusbarVisible(bool) = 0;
+ virtual bool statusbarVisible() = 0;
+
+ virtual void setScrollbarsVisible(bool) = 0;
+ virtual bool scrollbarsVisible() = 0;
+
+ virtual void setMenubarVisible(bool) = 0;
+ virtual bool menubarVisible() = 0;
+
+ virtual void setResizable(bool) = 0;
+
+ virtual void addMessageToConsole(MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceID) = 0;
+
+ virtual bool canRunBeforeUnloadConfirmPanel() = 0;
+ virtual bool runBeforeUnloadConfirmPanel(const String& message, Frame* frame) = 0;
+
+ virtual void closeWindowSoon() = 0;
+
+ virtual void runJavaScriptAlert(Frame*, const String&) = 0;
+ virtual bool runJavaScriptConfirm(Frame*, const String&) = 0;
+ virtual bool runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result) = 0;
+ virtual void setStatusbarText(const String&) = 0;
+ virtual bool shouldInterruptJavaScript() = 0;
+ virtual bool tabsToLinks() const = 0;
+
+ virtual IntRect windowResizerRect() const = 0;
+
+ // Methods used by HostWindow.
+ virtual void repaint(const IntRect&, bool contentChanged, bool immediate = false, bool repaintContentOnly = false) = 0;
+ virtual void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) = 0;
+ virtual IntPoint screenToWindow(const IntPoint&) const = 0;
+ virtual IntRect windowToScreen(const IntRect&) const = 0;
+ virtual PlatformWidget platformWindow() const = 0;
+ virtual void contentsSizeChanged(Frame*, const IntSize&) const = 0;
+ virtual void scrollRectIntoView(const IntRect&, const ScrollView*) const {} // Platforms other than Mac can implement this if it ever becomes necessary for them to do so.
+ // End methods used by HostWindow.
+
+ virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags) = 0;
+
+ virtual void setToolTip(const String&) = 0;
+
+ virtual void print(Frame*) = 0;
+
+ virtual void exceededDatabaseQuota(Frame*, const String& databaseName) = 0;
+
+#if ENABLE(DASHBOARD_SUPPORT)
+ virtual void dashboardRegionsChanged();
+#endif
+
+ virtual void populateVisitedLinks();
+
+ virtual FloatRect customHighlightRect(Node*, const AtomicString& type, const FloatRect& lineRect);
+ virtual void paintCustomHighlight(Node*, const AtomicString& type, const FloatRect& boxRect, const FloatRect& lineRect,
+ bool behindText, bool entireLine);
+
+ virtual bool shouldReplaceWithGeneratedFileForUpload(const String& path, String& generatedFilename);
+ virtual String generateReplacementFile(const String& path);
+
+ virtual void enableSuddenTermination();
+ virtual void disableSuddenTermination();
+
+ virtual bool paintCustomScrollbar(GraphicsContext*, const FloatRect&, ScrollbarControlSize,
+ ScrollbarControlState, ScrollbarPart pressedPart, bool vertical,
+ float value, float proportion, ScrollbarControlPartMask);
+ virtual bool paintCustomScrollCorner(GraphicsContext*, const FloatRect&);
+
+#if ENABLE(TOUCH_EVENTS)
+ virtual void eventRegionsChanged(const HashMap< RefPtr<Node>, unsigned>&) const = 0;
+ virtual void didPreventDefaultForEvent() const = 0;
+#endif
+ virtual void didReceiveDocType(Frame*) const = 0;
+ virtual void setNeedsScrollNotifications(Frame*, bool) const = 0;
+ virtual void observedContentChange(Frame*) const = 0;
+ virtual void clearContentChangeObservers(Frame*) const = 0;
+ virtual void didReceiveViewportArguments(Frame*, const ViewportArguments&) const = 0;
+ virtual void notifyRevealedSelectionByScrollingFrame(Frame*) const = 0;
+ virtual bool isStopping() const = 0;
+ virtual void didLayout() const = 0;
+
+ // This is an synchronous call. The ChromeClient can display UI asking the user for permission
+ // to use Geolococation. The ChromeClient must call Geolocation::setShouldClearCache() appropriately.
+ virtual bool requestGeolocationPermissionForFrame(Frame*, Geolocation*) { return false; }
+
+ virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>) = 0;
+
+ // Notification that the given form element has changed. This function
+ // will be called frequently, so handling should be very fast.
+ virtual void formStateDidChange(const Node*) = 0;
+
+ virtual HTMLParserQuirks* createHTMLParserQuirks() = 0;
+
+#if USE(ACCELERATED_COMPOSITING)
+ // Pass 0 as the GraphicsLayer to detatch the root layer.
+ virtual void attachRootGraphicsLayer(Frame*, GraphicsLayer*) { }
+ // Sets a flag to specify that the next time content is drawn to the window,
+ // the changes appear on the screen in synchrony with updates to GraphicsLayers.
+ virtual void setNeedsOneShotDrawingSynchronization() { }
+ // Sets a flag to specify that the view needs to be updated, so we need
+ // to do an eager layout before the drawing.
+ virtual void scheduleViewUpdate() { }
+#endif
+
+#if PLATFORM(MAC)
+ virtual KeyboardUIMode keyboardUIMode() { return KeyboardAccessDefault; }
+
+ virtual NSResponder *firstResponder() { return 0; }
+ virtual void makeFirstResponder(NSResponder *) { }
+
+#endif
+
+ protected:
+ virtual ~ChromeClient() { }
+ };
+
+}
+
+#endif // ChromeClient_h
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef ClassNames_h
+#define ClassNames_h
+
+#include "AtomicString.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+ class ClassNamesData : Noncopyable {
+ public:
+ ClassNamesData(const String& string, bool shouldFoldCase)
+ : m_string(string), m_shouldFoldCase(shouldFoldCase), m_createdVector(false)
+ {
+ }
+
+ bool contains(const AtomicString& string)
+ {
+ ensureVector();
+ size_t size = m_vector.size();
+ for (size_t i = 0; i < size; ++i) {
+ if (m_vector[i] == string)
+ return true;
+ }
+ return false;
+ }
+
+ bool containsAll(ClassNamesData&);
+
+ size_t size() { ensureVector(); return m_vector.size(); }
+ const AtomicString& operator[](size_t i) { ensureVector(); ASSERT(i < size()); return m_vector[i]; }
+
+ private:
+ void ensureVector() { if (!m_createdVector) createVector(); }
+ void createVector();
+
+ typedef Vector<AtomicString, 8> ClassNameVector;
+ String m_string;
+ bool m_shouldFoldCase;
+ ClassNameVector m_vector;
+ bool m_createdVector;
+ };
+
+ class ClassNames {
+ public:
+ ClassNames() { }
+ ClassNames(const String& string, bool shouldFoldCase) : m_data(new ClassNamesData(string, shouldFoldCase)) { }
+
+ void set(const String& string, bool shouldFoldCase) { m_data.set(new ClassNamesData(string, shouldFoldCase)); }
+ void clear() { m_data.clear(); }
+
+ bool contains(const AtomicString& string) const { return m_data && m_data->contains(string); }
+ bool containsAll(const ClassNames& names) const { return !names.m_data || (m_data && m_data->containsAll(*names.m_data)); }
+
+ size_t size() const { return m_data ? m_data->size() : 0; }
+ const AtomicString& operator[](size_t i) const { ASSERT(i < size()); return (*m_data)[i]; }
+
+ private:
+ OwnPtr<ClassNamesData> m_data;
+ };
+
+ inline bool isClassWhitespace(UChar c)
+ {
+ return c == ' ' || c == '\r' || c == '\n' || c == '\t' || c == '\f';
+ }
+
+} // namespace WebCore
+
+#endif // ClassNames_h
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 David Smith (catfish.man@gmail.com)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ClassNodeList_h
+#define ClassNodeList_h
+
+#include "ClassNames.h"
+#include "DynamicNodeList.h"
+
+namespace WebCore {
+
+ class ClassNodeList : public DynamicNodeList {
+ public:
+ static PassRefPtr<ClassNodeList> create(PassRefPtr<Node> rootNode, const String& classNames, Caches* caches)
+ {
+ return adoptRef(new ClassNodeList(rootNode, classNames, caches));
+ }
+
+ private:
+ ClassNodeList(PassRefPtr<Node> rootNode, const String& classNames, Caches*);
+
+ virtual bool nodeMatches(Element*) const;
+
+ ClassNames m_classNames;
+ };
+
+} // namespace WebCore
+
+#endif // ClassNodeList_h
--- /dev/null
+/*
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
+ * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Clipboard_h
+#define Clipboard_h
+
+#include "CachedResourceHandle.h"
+#include "ClipboardAccessPolicy.h"
+#include "DragActions.h"
+#include "DragImage.h"
+#include "IntPoint.h"
+#include "Node.h"
+
+namespace WebCore {
+
+ // State available during IE's events for drag and drop and copy/paste
+ class Clipboard : public RefCounted<Clipboard> {
+ public:
+ virtual ~Clipboard() { }
+
+ // Is this operation a drag-drop or a copy-paste?
+ bool isForDragging() const { return m_forDragging; }
+
+ String dropEffect() const { return m_dropEffect; }
+ void setDropEffect(const String&);
+ String effectAllowed() const { return m_effectAllowed; }
+ void setEffectAllowed(const String&);
+
+ virtual void clearData(const String& type) = 0;
+ virtual void clearAllData() = 0;
+ virtual String getData(const String& type, bool& success) const = 0;
+ virtual bool setData(const String& type, const String& data) = 0;
+
+ // extensions beyond IE's API
+ virtual HashSet<String> types() const = 0;
+
+ IntPoint dragLocation() const { return m_dragLoc; }
+ CachedImage* dragImage() const { return m_dragImage.get(); }
+ virtual void setDragImage(CachedImage*, const IntPoint&) = 0;
+ Node* dragImageElement() { return m_dragImageElement.get(); }
+ virtual void setDragImageElement(Node*, const IntPoint&) = 0;
+
+ virtual DragImageRef createDragImage(IntPoint& dragLocation) const = 0;
+ virtual void declareAndWriteDragImage(Element*, const KURL&, const String& title, Frame*) = 0;
+ virtual void writeURL(const KURL&, const String&, Frame*) = 0;
+ virtual void writeRange(Range*, Frame*) = 0;
+
+ virtual bool hasData() = 0;
+
+ void setAccessPolicy(ClipboardAccessPolicy);
+
+ bool sourceOperation(DragOperation&) const;
+ bool destinationOperation(DragOperation&) const;
+ void setSourceOperation(DragOperation);
+ void setDestinationOperation(DragOperation);
+
+ void setDragHasStarted() { m_dragStarted = true; }
+
+ protected:
+ Clipboard(ClipboardAccessPolicy, bool isForDragging);
+
+ ClipboardAccessPolicy policy() const { return m_policy; }
+ bool dragStarted() const { return m_dragStarted; }
+
+ private:
+ ClipboardAccessPolicy m_policy;
+ String m_dropEffect;
+ String m_effectAllowed;
+ bool m_dragStarted;
+
+ protected:
+ bool m_forDragging;
+ IntPoint m_dragLoc;
+ CachedResourceHandle<CachedImage> m_dragImage;
+ RefPtr<Node> m_dragImageElement;
+ };
+
+} // namespace WebCore
+
+#endif // Clipboard_h
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ClipboardAccessPolicy_h
+#define ClipboardAccessPolicy_h
+
+namespace WebCore {
+
+enum ClipboardAccessPolicy {
+ ClipboardNumb, ClipboardImageWritable, ClipboardWritable, ClipboardTypesReadable, ClipboardReadable
+};
+
+} // namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
+ * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ClipboardEvent_h
+#define ClipboardEvent_h
+
+#include "Clipboard.h"
+#include "Event.h"
+
+namespace WebCore {
+
+ class ClipboardEvent : public Event {
+ public:
+ static PassRefPtr<ClipboardEvent> create()
+ {
+ return adoptRef(new ClipboardEvent);
+ }
+ static PassRefPtr<ClipboardEvent> create(const AtomicString& type, bool canBubbleArg, bool cancelableArg, PassRefPtr<Clipboard> clipboardArg)
+ {
+ return adoptRef(new ClipboardEvent(type, canBubbleArg, cancelableArg, clipboardArg));
+ }
+
+ Clipboard* clipboard() const { return m_clipboard.get(); }
+
+ virtual bool isClipboardEvent() const;
+
+ private:
+ ClipboardEvent();
+ ClipboardEvent(const AtomicString& type, bool canBubbleArg, bool cancelableArg, PassRefPtr<Clipboard>);
+
+ RefPtr<Clipboard> m_clipboard;
+ };
+
+} // namespace WebCore
+
+#endif // ClipboardEvent_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef CollapsedBorderValue_h
+#define CollapsedBorderValue_h
+
+#include "BorderValue.h"
+
+namespace WebCore {
+
+struct CollapsedBorderValue {
+ CollapsedBorderValue()
+ : border(0)
+ , precedence(BOFF)
+ {
+ }
+
+ CollapsedBorderValue(const BorderValue* b, EBorderPrecedence p)
+ : border(b)
+ , precedence(p)
+ {
+ }
+
+ int width() const { return border && border->nonZero() ? border->width : 0; }
+ EBorderStyle style() const { return border ? border->style() : BHIDDEN; }
+ bool exists() const { return border; }
+ Color color() const { return border ? border->color : Color(); }
+ bool isTransparent() const { return border ? border->isTransparent() : true; }
+
+ bool operator==(const CollapsedBorderValue& o) const
+ {
+ if (!border)
+ return !o.border;
+ if (!o.border)
+ return false;
+ return *border == *o.border && precedence == o.precedence;
+ }
+
+ const BorderValue* border;
+ EBorderPrecedence precedence;
+};
+
+} // namespace WebCore
+
+#endif // CollapsedBorderValue_h
--- /dev/null
+/*
+ * Copyright (C) 2003-6 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Color_h
+#define Color_h
+
+#include <wtf/Platform.h>
+
+#if PLATFORM(CG)
+typedef struct CGColor* CGColorRef;
+#endif
+
+#if PLATFORM(QT)
+#include <qglobal.h>
+QT_BEGIN_NAMESPACE
+class QColor;
+QT_END_NAMESPACE
+#endif
+
+#if PLATFORM(GTK)
+typedef struct _GdkColor GdkColor;
+#endif
+
+#if PLATFORM(WX)
+class wxColour;
+#endif
+
+namespace WebCore {
+
+class String;
+class Color;
+
+typedef unsigned RGBA32; // RGBA quadruplet
+
+RGBA32 makeRGB(int r, int g, int b);
+RGBA32 makeRGBA(int r, int g, int b, int a);
+
+RGBA32 colorWithOverrideAlpha(RGBA32 color, float overrideAlpha);
+RGBA32 makeRGBA32FromFloats(float r, float g, float b, float a);
+RGBA32 makeRGBAFromHSLA(double h, double s, double l, double a);
+
+int differenceSquared(const Color&, const Color&);
+
+class Color {
+public:
+ Color() : m_color(0), m_valid(false) { }
+ Color(RGBA32 col) : m_color(col), m_valid(true) { }
+ Color(int r, int g, int b) : m_color(makeRGB(r, g, b)), m_valid(true) { }
+ Color(int r, int g, int b, int a) : m_color(makeRGBA(r, g, b, a)), m_valid(true) { }
+ // Color is currently limited to 32bit RGBA, perhaps some day we'll support better colors
+ Color(float r, float g, float b, float a) : m_color(makeRGBA32FromFloats(r, g, b, a)), m_valid(true) { }
+ explicit Color(const String&);
+ explicit Color(const char*);
+
+ String name() const;
+ void setNamedColor(const String&);
+
+ bool isValid() const { return m_valid; }
+
+ bool hasAlpha() const { return alpha() < 255; }
+
+ int red() const { return (m_color >> 16) & 0xFF; }
+ int green() const { return (m_color >> 8) & 0xFF; }
+ int blue() const { return m_color & 0xFF; }
+ int alpha() const { return (m_color >> 24) & 0xFF; }
+
+ RGBA32 rgb() const { return m_color; } // Preserve the alpha.
+ void setRGB(int r, int g, int b) { m_color = makeRGB(r, g, b); m_valid = true; }
+ void setRGB(RGBA32 rgb) { m_color = rgb; m_valid = true; }
+ void getRGBA(float& r, float& g, float& b, float& a) const;
+ void getRGBA(double& r, double& g, double& b, double& a) const;
+
+ Color light() const;
+ Color dark() const;
+
+ bool isDark() const;
+
+ Color blend(const Color&) const;
+ Color blendWithWhite() const;
+
+#if PLATFORM(QT)
+ Color(const QColor&);
+ operator QColor() const;
+#endif
+
+#if PLATFORM(GTK)
+ Color(const GdkColor&);
+ // We can't sensibly go back to GdkColor without losing the alpha value
+#endif
+
+#if PLATFORM(WX)
+ Color(const wxColour&);
+ operator wxColour() const;
+#endif
+
+#if PLATFORM(CG)
+ Color(CGColorRef);
+#endif
+
+ static bool parseHexColor(const String& name, RGBA32& rgb);
+
+ static const RGBA32 black = 0xFF000000;
+ static const RGBA32 white = 0xFFFFFFFF;
+ static const RGBA32 darkGray = 0xFF808080;
+ static const RGBA32 gray = 0xFFA0A0A0;
+ static const RGBA32 lightGray = 0xFFC0C0C0;
+ static const RGBA32 transparent = 0x00000000;
+ static const RGBA32 tap = 0x4D1A1A1A;
+ static const RGBA32 compositionFill = 0x3CAFC0E3;
+ static const RGBA32 compositionFrame = 0x3C4D80B4;
+
+private:
+ RGBA32 m_color;
+ bool m_valid;
+};
+
+inline bool operator==(const Color& a, const Color& b)
+{
+ return a.rgb() == b.rgb() && a.isValid() == b.isValid();
+}
+
+inline bool operator!=(const Color& a, const Color& b)
+{
+ return !(a == b);
+}
+
+Color focusRingColor();
+
+#if PLATFORM(CG)
+CGColorRef cgColor(const Color&);
+#endif
+
+} // namespace WebCore
+
+#endif // Color_h
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") 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 APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ColorMac_h
+#define ColorMac_h
+
+#include "Color.h"
+
+
+namespace WebCore {
+
+
+ bool usesTestModeFocusRingColor();
+ void setUsesTestModeFocusRingColor(bool);
+
+}
+
+#endif
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Comment_h
+#define Comment_h
+
+#include "CharacterData.h"
+
+namespace WebCore {
+
+class Comment : public CharacterData
+{
+public:
+ Comment(Document*, const String &_text);
+ Comment(Document*);
+ virtual ~Comment();
+
+ // DOM methods overridden from parent classes
+ virtual String nodeName() const;
+ virtual NodeType nodeType() const;
+ virtual PassRefPtr<Node> cloneNode(bool deep);
+
+ // Other methods (not part of DOM)
+ virtual bool isCommentNode() const { return true; }
+ virtual bool childTypeAllowed(NodeType);
+};
+
+} // namespace WebCore
+
+#endif // Comment_h
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CompositeEditCommand_h
+#define CompositeEditCommand_h
+
+#include "EditCommand.h"
+#include "CSSPropertyNames.h"
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class CSSStyleDeclaration;
+class Text;
+
+class CompositeEditCommand : public EditCommand {
+public:
+ bool isFirstCommand(EditCommand* command) { return !m_commands.isEmpty() && m_commands.first() == command; }
+
+protected:
+ CompositeEditCommand(Document*);
+
+ //
+ // sugary-sweet convenience functions to help create and apply edit commands in composite commands
+ //
+ void appendNode(PassRefPtr<Node>, PassRefPtr<Element> parent);
+ void applyCommandToComposite(PassRefPtr<EditCommand>);
+ void applyStyle(CSSStyleDeclaration*, EditAction = EditActionChangeAttributes);
+ void applyStyle(CSSStyleDeclaration*, const Position& start, const Position& end, EditAction = EditActionChangeAttributes);
+ void applyStyledElement(PassRefPtr<Element>);
+ void removeStyledElement(PassRefPtr<Element>);
+ void deleteSelection(bool smartDelete = false, bool mergeBlocksAfterDelete = true, bool replace = false, bool expandForSpecialElements = true);
+ void deleteSelection(const Selection&, bool smartDelete = false, bool mergeBlocksAfterDelete = true, bool replace = false, bool expandForSpecialElements = true);
+ virtual void deleteTextFromNode(PassRefPtr<Text>, unsigned offset, unsigned count);
+ void inputText(const String&, bool selectInsertedText = false);
+ void insertNodeAfter(PassRefPtr<Node>, PassRefPtr<Node> refChild);
+ void insertNodeAt(PassRefPtr<Node>, const Position&);
+ void insertNodeAtTabSpanPosition(PassRefPtr<Node>, const Position&);
+ void insertNodeBefore(PassRefPtr<Node>, PassRefPtr<Node> refChild);
+ void insertParagraphSeparator(bool useDefaultParagraphElement = false);
+ void insertLineBreak();
+ void insertTextIntoNode(PassRefPtr<Text>, unsigned offset, const String& text);
+ void joinTextNodes(PassRefPtr<Text>, PassRefPtr<Text>);
+ void mergeIdenticalElements(PassRefPtr<Element>, PassRefPtr<Element>);
+ void rebalanceWhitespace();
+ void rebalanceWhitespaceAt(const Position&);
+ void prepareWhitespaceAtPositionForSplit(Position&);
+ void removeCSSProperty(PassRefPtr<CSSMutableStyleDeclaration>, CSSPropertyID);
+ void removeNodeAttribute(PassRefPtr<Element>, const QualifiedName& attribute);
+ void removeChildrenInRange(PassRefPtr<Node>, unsigned from, unsigned to);
+ virtual void removeNode(PassRefPtr<Node>);
+ void removeNodePreservingChildren(PassRefPtr<Node>);
+ void removeNodeAndPruneAncestors(PassRefPtr<Node>);
+ void prune(PassRefPtr<Node>);
+ void replaceTextInNode(PassRefPtr<Text>, unsigned offset, unsigned count, const String& replacementText);
+ Position positionOutsideTabSpan(const Position&);
+ void setNodeAttribute(PassRefPtr<Element>, const QualifiedName& attribute, const AtomicString& value);
+ void splitElement(PassRefPtr<Element>, PassRefPtr<Node> atChild);
+ void splitTextNode(PassRefPtr<Text>, unsigned offset);
+ void splitTextNodeContainingElement(PassRefPtr<Text>, unsigned offset);
+ void wrapContentsInDummySpan(PassRefPtr<Element>);
+
+ void deleteInsignificantText(PassRefPtr<Text>, unsigned start, unsigned end);
+ void deleteInsignificantText(const Position& start, const Position& end);
+ void deleteInsignificantTextDownstream(const Position&);
+
+ PassRefPtr<Node> appendBlockPlaceholder(PassRefPtr<Element>);
+ PassRefPtr<Node> insertBlockPlaceholder(const Position&);
+ PassRefPtr<Node> addBlockPlaceholderIfNeeded(Element*);
+ void removePlaceholderAt(const Position&);
+
+ PassRefPtr<Node> insertNewDefaultParagraphElementAt(const Position&);
+
+ PassRefPtr<Node> moveParagraphContentsToNewBlockIfNecessary(const Position&);
+
+ void pushAnchorElementDown(Node*);
+ void pushPartiallySelectedAnchorElementsDown();
+
+ void moveParagraph(const VisiblePosition&, const VisiblePosition&, const VisiblePosition&, bool preserveSelection = false, bool preserveStyle = true);
+ void moveParagraphs(const VisiblePosition&, const VisiblePosition&, const VisiblePosition&, bool preserveSelection = false, bool preserveStyle = true);
+
+ bool breakOutOfEmptyListItem();
+ bool breakOutOfEmptyMailBlockquotedParagraph();
+
+ Position positionAvoidingSpecialElementBoundary(const Position&);
+
+ PassRefPtr<Node> splitTreeToNode(Node*, Node*, bool splitAncestor = false);
+
+ Vector<RefPtr<EditCommand> > m_commands;
+
+private:
+ virtual void doUnapply();
+ virtual void doReapply();
+};
+
+} // namespace WebCore
+
+#endif // CompositeEditCommand_h
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Console_h
+#define Console_h
+
+#include "PlatformString.h"
+
+#if USE(JSC)
+#include <profiler/Profile.h>
+#endif
+
+#include <wtf/RefCounted.h>
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+#if USE(JSC)
+ typedef Vector<RefPtr<JSC::Profile> > ProfilesArray;
+#endif
+
+ class Frame;
+ class Page;
+ class String;
+ class ScriptCallStack;
+
+ // Keep in sync with inspector/front-end/Console.js
+ enum MessageSource {
+ HTMLMessageSource,
+ WMLMessageSource,
+ XMLMessageSource,
+ JSMessageSource,
+ CSSMessageSource,
+ OtherMessageSource
+ };
+
+ enum MessageLevel {
+ TipMessageLevel,
+ LogMessageLevel,
+ WarningMessageLevel,
+ ErrorMessageLevel,
+ ObjectMessageLevel,
+ NodeMessageLevel,
+ TraceMessageLevel,
+ StartGroupMessageLevel,
+ EndGroupMessageLevel
+ };
+
+ class Console : public RefCounted<Console> {
+ public:
+ static PassRefPtr<Console> create(Frame* frame) { return adoptRef(new Console(frame)); }
+
+ void disconnectFrame();
+
+ void addMessage(MessageSource, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL);
+
+ void debug(ScriptCallStack*);
+ void error(ScriptCallStack*);
+ void info(ScriptCallStack*);
+ void log(ScriptCallStack*);
+ void warn(ScriptCallStack*);
+ void dir(ScriptCallStack*);
+ void dirxml(ScriptCallStack*);
+ void trace(ScriptCallStack*);
+ void assertCondition(bool condition, ScriptCallStack*);
+ void count(ScriptCallStack*);
+#if USE(JSC)
+ void profile(const JSC::UString&, ScriptCallStack*);
+ void profileEnd(const JSC::UString&, ScriptCallStack*);
+#endif
+ void time(const String&);
+ void timeEnd(const String&, ScriptCallStack*);
+ void group(ScriptCallStack*);
+ void groupEnd();
+
+ static bool shouldPrintExceptions();
+ static void setShouldPrintExceptions(bool);
+
+#if USE(JSC)
+ const ProfilesArray& profiles() const { return m_profiles; }
+#endif
+
+ private:
+ inline Page* page() const;
+ void addMessage(MessageLevel, ScriptCallStack*, bool acceptNoArguments = false);
+
+ Console(Frame*);
+
+ Frame* m_frame;
+#if USE(JSC)
+ ProfilesArray m_profiles;
+#endif
+ };
+
+} // namespace WebCore
+
+#endif // Console_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ContainerNode_h
+#define ContainerNode_h
+
+#include "EventTargetNode.h"
+#include "FloatPoint.h"
+
+namespace WebCore {
+
+typedef void (*NodeCallback)(Node*);
+
+namespace Private {
+ template<class GenericNode, class GenericNodeContainer>
+ void addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, GenericNodeContainer* container);
+};
+
+class ContainerNode : public EventTargetNode {
+public:
+ ContainerNode(Document*, bool isElement = false);
+ virtual ~ContainerNode();
+
+ Node* firstChild() const { return m_firstChild; }
+ Node* lastChild() const { return m_lastChild; }
+
+ virtual bool insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionCode&, bool shouldLazyAttach = false);
+ virtual bool replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionCode&, bool shouldLazyAttach = false);
+ virtual bool removeChild(Node* child, ExceptionCode&);
+ virtual bool appendChild(PassRefPtr<Node> newChild, ExceptionCode&, bool shouldLazyAttach = false);
+
+ virtual ContainerNode* addChild(PassRefPtr<Node>);
+ bool hasChildNodes() const { return m_firstChild; }
+ virtual void attach();
+ virtual void detach();
+ virtual void willRemove();
+ virtual IntRect getRect() const;
+ virtual void setFocus(bool = true);
+ virtual void setActive(bool active = true, bool pause = false);
+ virtual void setHovered(bool = true);
+ unsigned childNodeCount() const;
+ Node* childNode(unsigned index) const;
+
+ virtual void insertedIntoDocument();
+ virtual void removedFromDocument();
+ virtual void insertedIntoTree(bool deep);
+ virtual void removedFromTree(bool deep);
+ virtual void childrenChanged(bool createdByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
+
+ virtual bool removeChildren();
+
+ void removeAllChildren();
+
+ void cloneChildNodes(ContainerNode* clone);
+
+protected:
+ static void queuePostAttachCallback(NodeCallback, Node*);
+ void suspendPostAttachCallbacks();
+ void resumePostAttachCallbacks();
+
+ template<class GenericNode, class GenericNodeContainer>
+ friend void appendChildToContainer(GenericNode* child, GenericNodeContainer* container);
+
+ template<class GenericNode, class GenericNodeContainer>
+ friend void Private::addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, GenericNodeContainer* container);
+
+ void setFirstChild(Node* child) { m_firstChild = child; }
+ void setLastChild(Node* child) { m_lastChild = child; }
+
+private:
+ static void dispatchPostAttachCallbacks();
+
+ bool getUpperLeftCorner(FloatPoint&) const;
+ bool getLowerRightCorner(FloatPoint&) const;
+
+ Node* m_firstChild;
+ Node* m_lastChild;
+};
+
+inline unsigned Node::containerChildNodeCount() const
+{
+ ASSERT(isContainerNode());
+ return static_cast<const ContainerNode*>(this)->childNodeCount();
+}
+
+inline Node* Node::containerChildNode(unsigned index) const
+{
+ ASSERT(isContainerNode());
+ return static_cast<const ContainerNode*>(this)->childNode(index);
+}
+
+inline Node* Node::containerFirstChild() const
+{
+ ASSERT(isContainerNode());
+ return static_cast<const ContainerNode*>(this)->firstChild();
+}
+
+inline Node* Node::containerLastChild() const
+{
+ ASSERT(isContainerNode());
+ return static_cast<const ContainerNode*>(this)->lastChild();
+}
+
+} // namespace WebCore
+
+#endif // ContainerNode_h
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ContainerNodeAlgorithms_h
+#define ContainerNodeAlgorithms_h
+
+#include <wtf/Assertions.h>
+
+namespace WebCore {
+
+class Node;
+
+namespace Private {
+
+ template<class GenericNode, class GenericNodeContainer>
+ void addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, GenericNodeContainer* container);
+
+};
+
+// Helper functions for TreeShared-derived classes, which have a 'Node' style interface
+// This applies to 'ContainerNode' and 'SVGElementInstance'
+template<class GenericNode, class GenericNodeContainer>
+void removeAllChildrenInContainer(GenericNodeContainer* container)
+{
+ // List of nodes to be deleted.
+ GenericNode* head = 0;
+ GenericNode* tail = 0;
+
+ Private::addChildNodesToDeletionQueue<GenericNode, GenericNodeContainer>(head, tail, container);
+
+ GenericNode* n;
+ GenericNode* next;
+ while ((n = head) != 0) {
+ ASSERT(n->m_deletionHasBegun);
+
+ next = n->nextSibling();
+ n->setNextSibling(0);
+
+ head = next;
+ if (next == 0)
+ tail = 0;
+
+ if (n->hasChildNodes())
+ Private::addChildNodesToDeletionQueue<GenericNode, GenericNodeContainer>(head, tail, static_cast<GenericNodeContainer*>(n));
+
+ delete n;
+ }
+}
+
+template<class GenericNode, class GenericNodeContainer>
+void appendChildToContainer(GenericNode* child, GenericNodeContainer* container)
+{
+ child->setParent(container);
+
+ GenericNode* lastChild = container->lastChild();
+ if (lastChild) {
+ child->setPreviousSibling(lastChild);
+ lastChild->setNextSibling(child);
+ } else
+ container->setFirstChild(child);
+
+ container->setLastChild(child);
+}
+
+// Helper methods for removeAllChildrenInContainer, hidden from WebCore namespace
+namespace Private {
+
+ template<class GenericNode, bool dispatchRemovalNotification>
+ struct NodeRemovalDispatcher {
+ static void dispatch(GenericNode*)
+ {
+ // no-op, by default
+ }
+ };
+
+ template<class GenericNode>
+ struct NodeRemovalDispatcher<GenericNode, true> {
+ static void dispatch(GenericNode* node)
+ {
+ if (node->inDocument())
+ node->removedFromDocument();
+ }
+ };
+
+ template<class GenericNode>
+ struct ShouldDispatchRemovalNotification {
+ static const bool value = false;
+ };
+
+ template<>
+ struct ShouldDispatchRemovalNotification<Node> {
+ static const bool value = true;
+ };
+
+ template<class GenericNode, class GenericNodeContainer>
+ void addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, GenericNodeContainer* container)
+ {
+ // We have to tell all children that their parent has died.
+ GenericNode* next = 0;
+ for (GenericNode* n = container->firstChild(); n != 0; n = next) {
+ ASSERT(!n->m_deletionHasBegun);
+
+ next = n->nextSibling();
+ n->setPreviousSibling(0);
+ n->setNextSibling(0);
+ n->setParent(0);
+
+ if (!n->refCount()) {
+#ifndef NDEBUG
+ n->m_deletionHasBegun = true;
+#endif
+ // Add the node to the list of nodes to be deleted.
+ // Reuse the nextSibling pointer for this purpose.
+ if (tail)
+ tail->setNextSibling(n);
+ else
+ head = n;
+
+ tail = n;
+ } else
+ NodeRemovalDispatcher<GenericNode, ShouldDispatchRemovalNotification<GenericNode>::value>::dispatch(n);
+ }
+
+ container->setFirstChild(0);
+ container->setLastChild(0);
+ }
+};
+
+} // namespace WebCore
+
+#endif // ContainerNodeAlgorithms_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ContentData_h
+#define ContentData_h
+
+#include "RenderStyleConstants.h"
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+class CounterContent;
+class StringImpl;
+class StyleImage;
+
+struct ContentData : Noncopyable {
+ ContentData()
+ : m_type(CONTENT_NONE)
+ , m_next(0)
+ {
+ }
+
+ ~ContentData()
+ {
+ clear();
+ }
+
+ void clear();
+
+ StyleContentType m_type;
+ union {
+ StyleImage* m_image;
+ StringImpl* m_text;
+ CounterContent* m_counter;
+ } m_content;
+ ContentData* m_next;
+};
+
+} // namespace WebCore
+
+#endif // ContentData_h
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ContentType_h
+#define ContentType_h
+
+#include "PlatformString.h"
+
+namespace WebCore {
+
+ class ContentType {
+ public:
+ ContentType(const String& type);
+
+ String parameter (const String& parameterName) const;
+ String type() const;
+ const String& raw() const { return m_type; }
+ private:
+ String m_type;
+ };
+
+} // namespace WebCore
+
+#endif // ContentType_h
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ContextMenu_h
+#define ContextMenu_h
+
+#include <wtf/Noncopyable.h>
+
+#include "ContextMenuItem.h"
+#include "HitTestResult.h"
+#include "PlatformMenuDescription.h"
+#include "PlatformString.h"
+#if PLATFORM(MAC)
+#include <wtf/RetainPtr.h>
+#elif PLATFORM(QT)
+#include <QMenu>
+#endif
+
+namespace WebCore {
+class MenuEventProxy;
+
+ class ContextMenuController;
+
+ class ContextMenu : Noncopyable
+ {
+ public:
+ ContextMenu(const HitTestResult&);
+ ContextMenu(const HitTestResult&, const PlatformMenuDescription);
+ ~ContextMenu();
+
+ void populate();
+ void addInspectElementItem();
+ void checkOrEnableIfNeeded(ContextMenuItem&) const;
+
+ void insertItem(unsigned position, ContextMenuItem&);
+ void appendItem(ContextMenuItem&);
+
+ ContextMenuItem* itemWithAction(unsigned);
+ ContextMenuItem* itemAtIndex(unsigned, const PlatformMenuDescription);
+
+ unsigned itemCount() const;
+
+ HitTestResult hitTestResult() const { return m_hitTestResult; }
+ ContextMenuController* controller() const;
+
+ PlatformMenuDescription platformDescription() const;
+ void setPlatformDescription(PlatformMenuDescription);
+
+ PlatformMenuDescription releasePlatformDescription();
+#if PLATFORM(WX)
+ static ContextMenuItem* itemWithId(int);
+#endif
+ private:
+ HitTestResult m_hitTestResult;
+#if PLATFORM(MAC)
+ // Keep this in sync with the PlatformMenuDescription typedef
+ RetainPtr<NSMutableArray> m_platformDescription;
+#elif PLATFORM(QT)
+ QList<ContextMenuItem> m_items;
+#else
+ PlatformMenuDescription m_platformDescription;
+#endif
+ };
+
+}
+
+#endif // ContextMenu_h
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ContextMenuClient_h
+#define ContextMenuClient_h
+
+#include "PlatformMenuDescription.h"
+
+namespace WebCore {
+ class ContextMenu;
+ class ContextMenuItem;
+ class Frame;
+ class HitTestResult;
+ class KURL;
+ class String;
+
+ class ContextMenuClient {
+ public:
+ virtual ~ContextMenuClient() { }
+ virtual void contextMenuDestroyed() = 0;
+
+ virtual PlatformMenuDescription getCustomMenuFromDefaultItems(ContextMenu*) = 0;
+ virtual void contextMenuItemSelected(ContextMenuItem*, const ContextMenu*) = 0;
+
+ virtual void downloadURL(const KURL& url) = 0;
+ virtual void searchWithGoogle(const Frame*) = 0;
+ virtual void lookUpInDictionary(Frame*) = 0;
+ virtual void speak(const String&) = 0;
+ virtual void stopSpeaking() = 0;
+
+#if PLATFORM(MAC)
+ virtual void searchWithSpotlight() = 0;
+#endif
+ };
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ContextMenuController_h
+#define ContextMenuController_h
+
+#include <wtf/Noncopyable.h>
+#include <wtf/OwnPtr.h>
+
+namespace WebCore {
+
+ class ContextMenu;
+ class ContextMenuClient;
+ class ContextMenuItem;
+ class Event;
+ class Page;
+
+ class ContextMenuController : Noncopyable {
+ public:
+ ContextMenuController(Page*, ContextMenuClient*);
+ ~ContextMenuController();
+
+ ContextMenuClient* client() { return m_client; }
+
+ ContextMenu* contextMenu() const { return m_contextMenu.get(); }
+ void clearContextMenu();
+
+ void handleContextMenuEvent(Event*);
+ void contextMenuItemSelected(ContextMenuItem*);
+
+ private:
+ Page* m_page;
+ ContextMenuClient* m_client;
+ OwnPtr<ContextMenu> m_contextMenu;
+ };
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ContextMenuItem_h
+#define ContextMenuItem_h
+
+#include "PlatformMenuDescription.h"
+#include "PlatformString.h"
+#include <wtf/OwnPtr.h>
+
+#if PLATFORM(MAC)
+#include <wtf/RetainPtr.h>
+
+#ifdef __OBJC__
+@class NSMenuItem;
+#else
+class NSMenuItem;
+#endif
+#elif PLATFORM(WIN)
+typedef struct tagMENUITEMINFOW* LPMENUITEMINFO;
+#elif PLATFORM(GTK)
+typedef struct _GtkMenuItem GtkMenuItem;
+#elif PLATFORM(QT)
+#include <QAction>
+#elif PLATFORM(WX)
+class wxMenuItem;
+#endif
+
+namespace WebCore {
+
+ class ContextMenu;
+
+ // This enum needs to be in sync with the WebMenuItemTag enum in WebUIDelegate.h and the
+ // extra values in WebUIDelegatePrivate.h
+ enum ContextMenuAction {
+ ContextMenuItemTagNoAction=0, // This item is not actually in WebUIDelegate.h
+ ContextMenuItemTagOpenLinkInNewWindow=1,
+ ContextMenuItemTagDownloadLinkToDisk,
+ ContextMenuItemTagCopyLinkToClipboard,
+ ContextMenuItemTagOpenImageInNewWindow,
+ ContextMenuItemTagDownloadImageToDisk,
+ ContextMenuItemTagCopyImageToClipboard,
+ ContextMenuItemTagOpenFrameInNewWindow,
+ ContextMenuItemTagCopy,
+ ContextMenuItemTagGoBack,
+ ContextMenuItemTagGoForward,
+ ContextMenuItemTagStop,
+ ContextMenuItemTagReload,
+ ContextMenuItemTagCut,
+ ContextMenuItemTagPaste,
+#if PLATFORM(GTK)
+ ContextMenuItemTagDelete,
+ ContextMenuItemTagSelectAll,
+ ContextMenuItemTagInputMethods,
+ ContextMenuItemTagUnicode,
+#endif
+ ContextMenuItemTagSpellingGuess,
+ ContextMenuItemTagNoGuessesFound,
+ ContextMenuItemTagIgnoreSpelling,
+ ContextMenuItemTagLearnSpelling,
+ ContextMenuItemTagOther,
+ ContextMenuItemTagSearchInSpotlight,
+ ContextMenuItemTagSearchWeb,
+ ContextMenuItemTagLookUpInDictionary,
+ ContextMenuItemTagOpenWithDefaultApplication,
+ ContextMenuItemPDFActualSize,
+ ContextMenuItemPDFZoomIn,
+ ContextMenuItemPDFZoomOut,
+ ContextMenuItemPDFAutoSize,
+ ContextMenuItemPDFSinglePage,
+ ContextMenuItemPDFFacingPages,
+ ContextMenuItemPDFContinuous,
+ ContextMenuItemPDFNextPage,
+ ContextMenuItemPDFPreviousPage,
+ // These are new tags! Not a part of API!!!!
+ ContextMenuItemTagOpenLink = 2000,
+ ContextMenuItemTagIgnoreGrammar,
+ ContextMenuItemTagSpellingMenu, // Spelling or Spelling/Grammar sub-menu
+ ContextMenuItemTagShowSpellingPanel,
+ ContextMenuItemTagCheckSpelling,
+ ContextMenuItemTagCheckSpellingWhileTyping,
+ ContextMenuItemTagCheckGrammarWithSpelling,
+ ContextMenuItemTagFontMenu, // Font sub-menu
+ ContextMenuItemTagShowFonts,
+ ContextMenuItemTagBold,
+ ContextMenuItemTagItalic,
+ ContextMenuItemTagUnderline,
+ ContextMenuItemTagOutline,
+ ContextMenuItemTagStyles,
+ ContextMenuItemTagShowColors,
+ ContextMenuItemTagSpeechMenu, // Speech sub-menu
+ ContextMenuItemTagStartSpeaking,
+ ContextMenuItemTagStopSpeaking,
+ ContextMenuItemTagWritingDirectionMenu, // Writing Direction sub-menu
+ ContextMenuItemTagDefaultDirection,
+ ContextMenuItemTagLeftToRight,
+ ContextMenuItemTagRightToLeft,
+ ContextMenuItemTagPDFSinglePageScrolling,
+ ContextMenuItemTagPDFFacingPagesScrolling,
+ ContextMenuItemTagInspectElement,
+ ContextMenuItemTagTextDirectionMenu, // Text Direction sub-menu
+ ContextMenuItemTagTextDirectionDefault,
+ ContextMenuItemTagTextDirectionLeftToRight,
+ ContextMenuItemTagTextDirectionRightToLeft,
+ ContextMenuItemBaseApplicationTag = 10000
+ };
+
+ enum ContextMenuItemType {
+ ActionType,
+ CheckableActionType,
+ SeparatorType,
+ SubmenuType
+ };
+
+#if PLATFORM(MAC)
+ typedef void* PlatformMenuItemDescription;
+#elif PLATFORM(WIN)
+ typedef LPMENUITEMINFO PlatformMenuItemDescription;
+#elif PLATFORM(QT)
+ struct PlatformMenuItemDescription {
+ PlatformMenuItemDescription()
+ : type(ActionType),
+ action(ContextMenuItemTagNoAction),
+ checked(false),
+ enabled(true)
+ {}
+
+ ContextMenuItemType type;
+ ContextMenuAction action;
+ String title;
+ QList<ContextMenuItem> subMenuItems;
+ bool checked;
+ bool enabled;
+ };
+#elif PLATFORM(GTK)
+ struct PlatformMenuItemDescription {
+ PlatformMenuItemDescription()
+ : type(ActionType)
+ , action(ContextMenuItemTagNoAction)
+ , subMenu(0)
+ , checked(false)
+ , enabled(true)
+ {}
+
+ ContextMenuItemType type;
+ ContextMenuAction action;
+ String title;
+ GtkMenu* subMenu;
+ bool checked;
+ bool enabled;
+ };
+#elif PLATFORM(WX)
+ struct PlatformMenuItemDescription {
+ PlatformMenuItemDescription()
+ : type(ActionType),
+ action(ContextMenuItemTagNoAction),
+ checked(false),
+ enabled(true)
+ {}
+
+ ContextMenuItemType type;
+ ContextMenuAction action;
+ String title;
+ wxMenu * subMenu;
+ bool checked;
+ bool enabled;
+ };
+#else
+ typedef void* PlatformMenuItemDescription;
+#endif
+
+ class ContextMenuItem {
+ public:
+ ContextMenuItem(PlatformMenuItemDescription);
+ ContextMenuItem(ContextMenu* subMenu = 0);
+ ContextMenuItem(ContextMenuItemType type, ContextMenuAction action, const String& title, ContextMenu* subMenu = 0);
+#if PLATFORM(GTK)
+ ContextMenuItem(GtkMenuItem*);
+#endif
+ ~ContextMenuItem();
+
+ PlatformMenuItemDescription releasePlatformDescription();
+
+ ContextMenuItemType type() const;
+ void setType(ContextMenuItemType);
+
+ ContextMenuAction action() const;
+ void setAction(ContextMenuAction);
+
+ String title() const;
+ void setTitle(const String&);
+
+ PlatformMenuDescription platformSubMenu() const;
+ void setSubMenu(ContextMenu*);
+
+ void setChecked(bool = true);
+
+ void setEnabled(bool = true);
+ bool enabled() const;
+
+ // FIXME: Do we need a keyboard accelerator here?
+#if PLATFORM(GTK)
+ static GtkMenuItem* createNativeMenuItem(const PlatformMenuItemDescription&);
+#endif
+
+ private:
+#if PLATFORM(MAC)
+ RetainPtr<NSMenuItem> m_platformDescription;
+#else
+ PlatformMenuItemDescription m_platformDescription;
+#endif
+ };
+
+}
+
+#endif // ContextMenuItem_h
--- /dev/null
+/*
+ * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CookieJar_h
+#define CookieJar_h
+
+namespace WebCore {
+
+ class KURL;
+ class String;
+ class Document;
+
+ String cookies(const Document*, const KURL&);
+ void setCookies(Document*, const KURL&, const KURL& policyBaseURL, const String&);
+ bool cookiesEnabled(const Document*);
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Coordinates_h
+#define Coordinates_h
+
+#include "Event.h"
+#include "PlatformString.h"
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+typedef int ExceptionCode;
+
+class Coordinates : public RefCounted<Coordinates> {
+public:
+ static PassRefPtr<Coordinates> create(double latitude, double longitude, bool providesAltitude, double altitude, double accuracy, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed) { return adoptRef(new Coordinates(latitude, longitude, providesAltitude, altitude, accuracy, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed)); }
+
+ double latitude() const { return m_latitude; }
+ double longitude() const { return m_longitude; }
+ double altitude() const { return m_altitude; }
+ double accuracy() const { return m_accuracy; }
+ double altitudeAccuracy() const { return m_altitudeAccuracy; }
+ double heading() const { return m_heading; }
+ double speed() const { return m_speed; }
+
+ bool canProvideAltitude() const { return m_canProvideAltitude; }
+ bool canProvideAltitudeAccuracy() const { return m_canProvideAltitudeAccuracy; }
+ bool canProvideHeading() const { return m_canProvideHeading; }
+ bool canProvideSpeed() const { return m_canProvideSpeed; }
+
+ String toString() const;
+
+private:
+ Coordinates(double latitude, double longitude, bool providesAltitude, double altitude, double accuracy, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed)
+ : m_latitude(latitude)
+ , m_longitude(longitude)
+ , m_altitude(altitude)
+ , m_accuracy(accuracy)
+ , m_altitudeAccuracy(altitudeAccuracy)
+ , m_heading(heading)
+ , m_speed(speed)
+ , m_canProvideAltitude(providesAltitude)
+ , m_canProvideAltitudeAccuracy(providesAltitudeAccuracy)
+ , m_canProvideHeading(providesHeading)
+ , m_canProvideSpeed(providesSpeed)
+ {
+ }
+
+ double m_latitude;
+ double m_longitude;
+ double m_altitude;
+ double m_accuracy;
+ double m_altitudeAccuracy;
+ double m_heading;
+ double m_speed;
+
+ bool m_canProvideAltitude;
+ bool m_canProvideAltitudeAccuracy;
+ bool m_canProvideHeading;
+ bool m_canProvideSpeed;
+};
+
+} // namespace WebCore
+
+#endif // Coordinates_h
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CoreTextController_h
+#define CoreTextController_h
+
+#if USE(CORE_TEXT)
+
+#include "Font.h"
+#include "GlyphBuffer.h"
+#include <wtf/RetainPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class CoreTextController {
+public:
+ CoreTextController(const Font*, const TextRun&, bool mayUseNaturalWritingDirection = false);
+
+ // Advance and emit glyphs up to the specified character.
+ void advance(unsigned to, GlyphBuffer* = 0);
+
+ // Compute the character offset for a given x coordinate.
+ int offsetForPosition(int x, bool includePartialGlyphs);
+
+ // Returns the width of everything we've consumed so far.
+ float runWidthSoFar() const { return m_runWidthSoFar; }
+
+ float totalWidth() const { return m_totalWidth; }
+
+ // Extra width to the left of the leftmost glyph.
+ float finalRoundingWidth() const { return m_finalRoundingWidth; }
+
+private:
+ class CoreTextRun {
+ public:
+ CoreTextRun(CTRunRef, const SimpleFontData*, const UChar* characters, unsigned stringLocation, size_t stringLength);
+ CoreTextRun(const SimpleFontData*, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr);
+
+ CTRunRef ctRun() const { return m_CTRun.get(); }
+ unsigned glyphCount() const { return m_glyphCount; }
+ const SimpleFontData* fontData() const { return m_fontData; }
+ const UChar* characters() const { return m_characters; }
+ unsigned stringLocation() const { return m_stringLocation; }
+ size_t stringLength() const { return m_stringLength; }
+ CFIndex indexAt(size_t i) const { return m_indices[i]; }
+
+ private:
+ RetainPtr<CTRunRef> m_CTRun;
+ unsigned m_glyphCount;
+ const SimpleFontData* m_fontData;
+ const UChar* m_characters;
+ unsigned m_stringLocation;
+ size_t m_stringLength;
+ const CFIndex* m_indices;
+ // Used only if CTRunGet*Ptr fails or if this is a missing glyphs run.
+ RetainPtr<CFMutableDataRef> m_indicesData;
+ };
+
+ void collectCoreTextRuns();
+ void collectCoreTextRunsForCharacters(const UChar*, unsigned length, unsigned stringLocation, const SimpleFontData*);
+ void adjustGlyphsAndAdvances();
+
+ const Font& m_font;
+ const TextRun& m_run;
+ bool m_mayUseNaturalWritingDirection;
+
+ Vector<UChar, 256> m_smallCapsBuffer;
+
+ Vector<CoreTextRun, 16> m_coreTextRuns;
+ Vector<CGSize, 256> m_adjustedAdvances;
+ Vector<CGGlyph, 256> m_adjustedGlyphs;
+
+ unsigned m_currentCharacter;
+ int m_end;
+
+ CGFloat m_totalWidth;
+
+ float m_runWidthSoFar;
+ unsigned m_numGlyphsSoFar;
+ size_t m_currentRun;
+ unsigned m_glyphInCurrentRun;
+ float m_finalRoundingWidth;
+ float m_padding;
+ float m_padPerSpace;
+
+ unsigned m_lastRoundingGlyph;
+};
+
+} // namespace WebCore
+#endif // USE(CORE_TEXT)
+#endif // CoreTextController_h
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef Counter_h
+#define Counter_h
+
+#include "CSSPrimitiveValue.h"
+#include "PlatformString.h"
+
+namespace WebCore {
+
+class Counter : public RefCounted<Counter> {
+public:
+ static PassRefPtr<Counter> create(PassRefPtr<CSSPrimitiveValue> identifier, PassRefPtr<CSSPrimitiveValue> listStyle, PassRefPtr<CSSPrimitiveValue> separator)
+ {
+ return adoptRef(new Counter(identifier, listStyle, separator));
+ }
+
+ String identifier() const { return m_identifier ? m_identifier->getStringValue() : String(); }
+ String listStyle() const { return m_listStyle ? m_listStyle->getStringValue() : String(); }
+ String separator() const { return m_separator ? m_separator->getStringValue() : String(); }
+
+ int listStyleNumber() const { return m_listStyle ? m_listStyle->getIntValue() : 0; }
+
+ void setIdentifier(PassRefPtr<CSSPrimitiveValue> identifier) { m_identifier = identifier; }
+ void setListStyle(PassRefPtr<CSSPrimitiveValue> listStyle) { m_listStyle = listStyle; }
+ void setSeparator(PassRefPtr<CSSPrimitiveValue> separator) { m_separator = separator; }
+
+private:
+ Counter(PassRefPtr<CSSPrimitiveValue> identifier, PassRefPtr<CSSPrimitiveValue> listStyle, PassRefPtr<CSSPrimitiveValue> separator)
+ : m_identifier(identifier)
+ , m_listStyle(listStyle)
+ , m_separator(separator)
+ {
+ }
+
+ RefPtr<CSSPrimitiveValue> m_identifier; // string
+ RefPtr<CSSPrimitiveValue> m_listStyle; // int
+ RefPtr<CSSPrimitiveValue> m_separator; // string
+};
+
+} // namespace WebCore
+
+#endif // Counter_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef CounterContent_h
+#define CounterContent_h
+
+#include "AtomicString.h"
+#include "RenderStyleConstants.h"
+
+namespace WebCore {
+
+class CounterContent {
+public:
+ CounterContent(const AtomicString& identifier, EListStyleType style, const AtomicString& separator)
+ : m_identifier(identifier)
+ , m_listStyle(style)
+ , m_separator(separator)
+ {
+ }
+
+ const AtomicString& identifier() const { return m_identifier; }
+ EListStyleType listStyle() const { return m_listStyle; }
+ const AtomicString& separator() const { return m_separator; }
+
+private:
+ AtomicString m_identifier;
+ EListStyleType m_listStyle;
+ AtomicString m_separator;
+};
+
+static inline bool operator!=(const CounterContent& a, const CounterContent& b)
+{
+ return a.identifier() != b.identifier()
+ || a.listStyle() != b.listStyle()
+ || a.separator() != b.separator();
+}
+
+
+} // namespace WebCore
+
+#endif // CounterContent_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef CounterDirectives_h
+#define CounterDirectives_h
+
+#include "AtomicStringImpl.h"
+#include <wtf/HashMap.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+struct CounterDirectives {
+ CounterDirectives()
+ : m_reset(false)
+ , m_increment(false)
+ {
+ }
+
+ bool m_reset;
+ int m_resetValue;
+ bool m_increment;
+ int m_incrementValue;
+};
+
+bool operator==(const CounterDirectives&, const CounterDirectives&);
+inline bool operator!=(const CounterDirectives& a, const CounterDirectives& b) { return !(a == b); }
+
+typedef HashMap<RefPtr<AtomicStringImpl>, CounterDirectives> CounterDirectiveMap;
+
+} // namespace WebCore
+
+#endif // CounterDirectives_h
--- /dev/null
+/*
+ * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+*/
+
+#ifndef CounterNode_h
+#define CounterNode_h
+
+#include <wtf/Noncopyable.h>
+
+// This implements a counter tree that is used for finding parents in counters() lookup,
+// and for propagating count changes when nodes are added or removed.
+
+// Parents represent unique counters and their scope, which are created either explicitly
+// by "counter-reset" style rules or implicitly by referring to a counter that is not in scope.
+// Such nodes are tagged as "reset" nodes, although they are not all due to "counter-reset".
+
+// Not that render tree children are often counter tree siblings due to counter scoping rules.
+
+namespace WebCore {
+
+class RenderObject;
+
+class CounterNode : Noncopyable {
+public:
+ CounterNode(RenderObject*, bool isReset, int value);
+
+ bool isReset() const { return m_isReset; }
+ int value() const { return m_value; }
+ int countInParent() const { return m_countInParent; }
+ RenderObject* renderer() const { return m_renderer; }
+
+ CounterNode* parent() const { return m_parent; }
+ CounterNode* previousSibling() const { return m_previousSibling; }
+ CounterNode* nextSibling() const { return m_nextSibling; }
+ CounterNode* firstChild() const { return m_firstChild; }
+ CounterNode* lastChild() const { return m_lastChild; }
+
+ void insertAfter(CounterNode* newChild, CounterNode* beforeChild);
+ void removeChild(CounterNode*);
+
+private:
+ int computeCountInParent() const;
+ void recount();
+
+ bool m_isReset;
+ int m_value;
+ int m_countInParent;
+ RenderObject* m_renderer;
+
+ CounterNode* m_parent;
+ CounterNode* m_previousSibling;
+ CounterNode* m_nextSibling;
+ CounterNode* m_firstChild;
+ CounterNode* m_lastChild;
+};
+
+} // namespace WebCore
+
+#ifndef NDEBUG
+// Outside the WebCore namespace for ease of invocation from gdb.
+void showTree(const WebCore::CounterNode*);
+#endif
+
+#endif // CounterNode_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CreateLinkCommand_h
+#define CreateLinkCommand_h
+
+#include "CompositeEditCommand.h"
+
+namespace WebCore {
+
+class CreateLinkCommand : public CompositeEditCommand {
+public:
+ static PassRefPtr<CreateLinkCommand> create(Document* document, const String& linkURL)
+ {
+ return adoptRef(new CreateLinkCommand(document, linkURL));
+ }
+
+private:
+ CreateLinkCommand(Document*, const String& linkURL);
+
+ virtual void doApply();
+ virtual EditAction editingAction() const { return EditActionCreateLink; }
+
+ String m_url;
+};
+
+} // namespace WebCore
+
+#endif // CreateLinkCommand_h
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef Credential_h
+#define Credential_h
+
+#include "PlatformString.h"
+
+namespace WebCore {
+
+enum CredentialPersistence {
+ CredentialPersistenceNone,
+ CredentialPersistenceForSession,
+ CredentialPersistencePermanent
+};
+
+class Credential {
+
+public:
+ Credential();
+ Credential(const String& user, const String& password, CredentialPersistence);
+
+ const String& user() const;
+ const String& password() const;
+ bool hasPassword() const;
+ CredentialPersistence persistence() const;
+
+private:
+ String m_user;
+ String m_password;
+ CredentialPersistence m_persistence;
+};
+
+bool operator==(const Credential& a, const Credential& b);
+inline bool operator!=(const Credential& a, const Credential& b) { return !(a == b); }
+
+};
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+namespace WebCore {
+
+ class HTTPHeaderMap;
+ class ResourceResponse;
+ class SecurityOrigin;
+ class String;
+
+ bool isSimpleCrossOriginAccessRequest(const String& method, const HTTPHeaderMap&);
+ bool isOnAccessControlSimpleRequestMethodWhitelist(const String&);
+ bool isOnAccessControlSimpleRequestHeaderWhitelist(const String& name, const String& value);
+ bool isOnAccessControlResponseHeaderWhitelist(const String&);
+
+ bool passesAccessControlCheck(const ResourceResponse&, bool includeCredentials, SecurityOrigin*);
+
+} // namespace WebCore
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include "KURLHash.h"
+#include "StringHash.h"
+
+namespace WebCore {
+
+ class HTTPHeaderMap;
+ class ResourceResponse;
+
+ class CrossOriginPreflightResultCacheItem : Noncopyable {
+ public:
+ CrossOriginPreflightResultCacheItem(bool credentials)
+ : m_absoluteExpiryTime(0)
+ , m_credentials(credentials)
+ {
+ }
+
+ bool parse(const ResourceResponse&);
+ bool allowsCrossOriginMethod(const String&) const;
+ bool allowsCrossOriginHeaders(const HTTPHeaderMap&) const;
+ bool allowsRequest(bool includeCredentials, const String& method, const HTTPHeaderMap& requestHeaders) const;
+
+ private:
+ typedef HashSet<String, CaseFoldingHash> HeadersSet;
+
+ // FIXME: A better solution to holding onto the absolute expiration time might be
+ // to start a timer for the expiration delta that removes this from the cache when
+ // it fires.
+ double m_absoluteExpiryTime;
+ bool m_credentials;
+ HashSet<String> m_methods;
+ HeadersSet m_headers;
+ };
+
+ class CrossOriginPreflightResultCache : Noncopyable {
+ public:
+ static CrossOriginPreflightResultCache& shared();
+
+ void appendEntry(const String& origin, const KURL&, CrossOriginPreflightResultCacheItem*);
+ bool canSkipPreflight(const String& origin, const KURL&, bool includeCredentials, const String& method, const HTTPHeaderMap& requestHeaders);
+
+ private:
+ CrossOriginPreflightResultCache() { }
+
+ typedef HashMap<std::pair<String, KURL>, CrossOriginPreflightResultCacheItem*> CrossOriginPreflightResultHashMap;
+
+ CrossOriginPreflightResultHashMap m_preflightHashMap;
+ Mutex m_mutex;
+ };
+
+} // namespace WebCore
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Cursor_h
+#define Cursor_h
+
+#include <wtf/Platform.h>
+
+#if PLATFORM(WIN)
+typedef struct HICON__* HICON;
+typedef HICON HCURSOR;
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+#elif PLATFORM(GTK)
+typedef struct _GdkCursor GdkCursor;
+#elif PLATFORM(QT)
+#include <QCursor>
+#elif PLATFORM(CHROMIUM)
+#include "PlatformCursor.h"
+#endif
+
+
+#if PLATFORM(WX)
+class wxCursor;
+#endif
+
+namespace WebCore {
+
+ class Image;
+ class IntPoint;
+
+
+ class Cursor {
+ public:
+ Cursor()
+ { }
+
+ };
+
+ static Cursor* _cursor = 0;
+ static const Cursor& cursor() {
+ if (_cursor == 0)
+ _cursor = new Cursor();
+ return *_cursor;
+ }
+ inline const Cursor& pointerCursor() { return cursor(); }
+ inline const Cursor& crossCursor() { return cursor(); }
+ inline const Cursor& handCursor() { return cursor(); }
+ inline const Cursor& moveCursor() { return cursor(); }
+ inline const Cursor& iBeamCursor() { return cursor(); }
+ inline const Cursor& waitCursor() { return cursor(); }
+ inline const Cursor& helpCursor() { return cursor(); }
+ inline const Cursor& eastResizeCursor() { return cursor(); }
+ inline const Cursor& northResizeCursor() { return cursor(); }
+ inline const Cursor& northEastResizeCursor() { return cursor(); }
+ inline const Cursor& northWestResizeCursor() { return cursor(); }
+ inline const Cursor& southResizeCursor() { return cursor(); }
+ inline const Cursor& southEastResizeCursor() { return cursor(); }
+ inline const Cursor& southWestResizeCursor() { return cursor(); }
+ inline const Cursor& westResizeCursor() { return cursor(); }
+ inline const Cursor& northSouthResizeCursor() { return cursor(); }
+ inline const Cursor& eastWestResizeCursor() { return cursor(); }
+ inline const Cursor& northEastSouthWestResizeCursor() { return cursor(); }
+ inline const Cursor& northWestSouthEastResizeCursor() { return cursor(); }
+ inline const Cursor& columnResizeCursor() { return cursor(); }
+ inline const Cursor& rowResizeCursor() { return cursor(); }
+ inline const Cursor& verticalTextCursor() { return cursor(); }
+ inline const Cursor& cellCursor() { return cursor(); }
+ inline const Cursor& contextMenuCursor() { return cursor(); }
+ inline const Cursor& noDropCursor() { return cursor(); }
+ inline const Cursor& notAllowedCursor() { return cursor(); }
+ inline const Cursor& progressCursor() { return cursor(); }
+ inline const Cursor& aliasCursor() { return cursor(); }
+ inline const Cursor& zoomInCursor() { return cursor(); }
+ inline const Cursor& zoomOutCursor() { return cursor(); }
+ inline const Cursor& copyCursor() { return cursor(); }
+ inline const Cursor& noneCursor() { return cursor(); }
+ inline const Cursor& grabCursor() { return cursor(); }
+ inline const Cursor& grabbingCursor() { return cursor(); }
+
+} // namespace WebCore
+
+#endif // Cursor_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef CursorData_h
+#define CursorData_h
+
+#include "CachedImage.h"
+#include "CachedResourceHandle.h"
+#include "IntPoint.h"
+
+namespace WebCore {
+
+struct CursorData {
+ CursorData()
+ : cursorImage(0)
+ {
+ }
+
+ bool operator==(const CursorData& o) const
+ {
+ return hotSpot == o.hotSpot && cursorImage == o.cursorImage;
+ }
+
+ bool operator!=(const CursorData& o) const
+ {
+ return !(*this == o);
+ }
+
+ IntPoint hotSpot; // for CSS3 support
+ CachedResourceHandle<CachedImage> cursorImage;
+};
+
+} // namespace WebCore
+
+#endif // CursorData_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef CursorList_h
+#define CursorList_h
+
+#include "CursorData.h"
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class CursorList : public RefCounted<CursorList> {
+public:
+ static PassRefPtr<CursorList> create()
+ {
+ return adoptRef(new CursorList);
+ }
+
+ const CursorData& operator[](int i) const { return m_vector[i]; }
+
+ bool operator==(const CursorList& o) const { return m_vector == o.m_vector; }
+ bool operator!=(const CursorList& o) const { return m_vector != o.m_vector; }
+
+ size_t size() const { return m_vector.size(); }
+ void append(const CursorData& cursorData) { m_vector.append(cursorData); }
+
+private:
+ CursorList()
+ {
+ }
+
+ Vector<CursorData> m_vector;
+};
+
+} // namespace WebCore
+
+#endif // CursorList_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Collin Jackson <collinj@webkit.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DNS_h
+#define DNS_h
+
+namespace WebCore {
+
+ class String;
+
+ void prefetchDNS(const String& hostname);
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Collin Jackson <collinj@webkit.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DNS.h"
+
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+void prefetchDNS(const String&)
+{
+ notImplemented();
+}
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebCore/DOMCore.h>
+#import <WebCore/DOMCSS.h>
+#import <WebCore/DOMExtensions.h>
+#import <WebCore/DOMEvents.h>
+#import <WebCore/DOMHTML.h>
+#import <WebCore/DOMRanges.h>
+#import <WebCore/DOMStylesheets.h>
+#import <WebCore/DOMTraversal.h>
+#import <WebCore/DOMViews.h>
+#import <WebCore/DOMXPath.h>
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebCore/DOMAbstractView.h>
+
+@interface DOMAbstractView (Frame)
+- (void)_disconnectFrame;
+@end
--- /dev/null
+/*
+ * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebCore/DOMCore.h>
+#import <WebCore/DOMDocument.h>
+#import <WebCore/DOMElement.h>
+#import <WebCore/DOMObject.h>
+#import <WebCore/DOMStylesheets.h>
+
+#import <WebCore/DOMCSSCharsetRule.h>
+#import <WebCore/DOMCSSFontFaceRule.h>
+#import <WebCore/DOMCSSImportRule.h>
+#import <WebCore/DOMCSSMediaRule.h>
+#import <WebCore/DOMCSSPageRule.h>
+#import <WebCore/DOMCSSPrimitiveValue.h>
+#import <WebCore/DOMCSSRule.h>
+#import <WebCore/DOMCSSRuleList.h>
+#import <WebCore/DOMCSSStyleDeclaration.h>
+#import <WebCore/DOMCSSStyleRule.h>
+#import <WebCore/DOMCSSStyleSheet.h>
+#import <WebCore/DOMCSSUnknownRule.h>
+#import <WebCore/DOMCSSValue.h>
+#import <WebCore/DOMCSSValueList.h>
+#import <WebCore/DOMCounter.h>
+#import <WebCore/DOMRGBColor.h>
+#import <WebCore/DOMRect.h>
+
+#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_1_3
+
+@interface DOMCSSStyleDeclaration (DOMCSS2Properties)
+- (NSString *)azimuth;
+- (void)setAzimuth:(NSString *)azimuth;
+- (NSString *)background;
+- (void)setBackground:(NSString *)background;
+- (NSString *)backgroundAttachment;
+- (void)setBackgroundAttachment:(NSString *)backgroundAttachment;
+- (NSString *)backgroundColor;
+- (void)setBackgroundColor:(NSString *)backgroundColor;
+- (NSString *)backgroundImage;
+- (void)setBackgroundImage:(NSString *)backgroundImage;
+- (NSString *)backgroundPosition;
+- (void)setBackgroundPosition:(NSString *)backgroundPosition;
+- (NSString *)backgroundRepeat;
+- (void)setBackgroundRepeat:(NSString *)backgroundRepeat;
+- (NSString *)border;
+- (void)setBorder:(NSString *)border;
+- (NSString *)borderCollapse;
+- (void)setBorderCollapse:(NSString *)borderCollapse;
+- (NSString *)borderColor;
+- (void)setBorderColor:(NSString *)borderColor;
+- (NSString *)borderSpacing;
+- (void)setBorderSpacing:(NSString *)borderSpacing;
+- (NSString *)borderStyle;
+- (void)setBorderStyle:(NSString *)borderStyle;
+- (NSString *)borderTop;
+- (void)setBorderTop:(NSString *)borderTop;
+- (NSString *)borderRight;
+- (void)setBorderRight:(NSString *)borderRight;
+- (NSString *)borderBottom;
+- (void)setBorderBottom:(NSString *)borderBottom;
+- (NSString *)borderLeft;
+- (void)setBorderLeft:(NSString *)borderLeft;
+- (NSString *)borderTopColor;
+- (void)setBorderTopColor:(NSString *)borderTopColor;
+- (NSString *)borderRightColor;
+- (void)setBorderRightColor:(NSString *)borderRightColor;
+- (NSString *)borderBottomColor;
+- (void)setBorderBottomColor:(NSString *)borderBottomColor;
+- (NSString *)borderLeftColor;
+- (void)setBorderLeftColor:(NSString *)borderLeftColor;
+- (NSString *)borderTopStyle;
+- (void)setBorderTopStyle:(NSString *)borderTopStyle;
+- (NSString *)borderRightStyle;
+- (void)setBorderRightStyle:(NSString *)borderRightStyle;
+- (NSString *)borderBottomStyle;
+- (void)setBorderBottomStyle:(NSString *)borderBottomStyle;
+- (NSString *)borderLeftStyle;
+- (void)setBorderLeftStyle:(NSString *)borderLeftStyle;
+- (NSString *)borderTopWidth;
+- (void)setBorderTopWidth:(NSString *)borderTopWidth;
+- (NSString *)borderRightWidth;
+- (void)setBorderRightWidth:(NSString *)borderRightWidth;
+- (NSString *)borderBottomWidth;
+- (void)setBorderBottomWidth:(NSString *)borderBottomWidth;
+- (NSString *)borderLeftWidth;
+- (void)setBorderLeftWidth:(NSString *)borderLeftWidth;
+- (NSString *)borderWidth;
+- (void)setBorderWidth:(NSString *)borderWidth;
+- (NSString *)bottom;
+- (void)setBottom:(NSString *)bottom;
+- (NSString *)captionSide;
+- (void)setCaptionSide:(NSString *)captionSide;
+- (NSString *)clear;
+- (void)setClear:(NSString *)clear;
+- (NSString *)clip;
+- (void)setClip:(NSString *)clip;
+- (NSString *)color;
+- (void)setColor:(NSString *)color;
+- (NSString *)content;
+- (void)setContent:(NSString *)content;
+- (NSString *)counterIncrement;
+- (void)setCounterIncrement:(NSString *)counterIncrement;
+- (NSString *)counterReset;
+- (void)setCounterReset:(NSString *)counterReset;
+- (NSString *)cue;
+- (void)setCue:(NSString *)cue;
+- (NSString *)cueAfter;
+- (void)setCueAfter:(NSString *)cueAfter;
+- (NSString *)cueBefore;
+- (void)setCueBefore:(NSString *)cueBefore;
+- (NSString *)cursor;
+- (void)setCursor:(NSString *)cursor;
+- (NSString *)direction;
+- (void)setDirection:(NSString *)direction;
+- (NSString *)display;
+- (void)setDisplay:(NSString *)display;
+- (NSString *)elevation;
+- (void)setElevation:(NSString *)elevation;
+- (NSString *)emptyCells;
+- (void)setEmptyCells:(NSString *)emptyCells;
+- (NSString *)cssFloat;
+- (void)setCssFloat:(NSString *)cssFloat;
+- (NSString *)font;
+- (void)setFont:(NSString *)font;
+- (NSString *)fontFamily;
+- (void)setFontFamily:(NSString *)fontFamily;
+- (NSString *)fontSize;
+- (void)setFontSize:(NSString *)fontSize;
+- (NSString *)fontSizeAdjust;
+- (void)setFontSizeAdjust:(NSString *)fontSizeAdjust;
+- (NSString *)fontStretch;
+- (void)setFontStretch:(NSString *)fontStretch;
+- (NSString *)fontStyle;
+- (void)setFontStyle:(NSString *)fontStyle;
+- (NSString *)fontVariant;
+- (void)setFontVariant:(NSString *)fontVariant;
+- (NSString *)fontWeight;
+- (void)setFontWeight:(NSString *)fontWeight;
+- (NSString *)height;
+- (void)setHeight:(NSString *)height;
+- (NSString *)left;
+- (void)setLeft:(NSString *)left;
+- (NSString *)letterSpacing;
+- (void)setLetterSpacing:(NSString *)letterSpacing;
+- (NSString *)lineHeight;
+- (void)setLineHeight:(NSString *)lineHeight;
+- (NSString *)listStyle;
+- (void)setListStyle:(NSString *)listStyle;
+- (NSString *)listStyleImage;
+- (void)setListStyleImage:(NSString *)listStyleImage;
+- (NSString *)listStylePosition;
+- (void)setListStylePosition:(NSString *)listStylePosition;
+- (NSString *)listStyleType;
+- (void)setListStyleType:(NSString *)listStyleType;
+- (NSString *)margin;
+- (void)setMargin:(NSString *)margin;
+- (NSString *)marginTop;
+- (void)setMarginTop:(NSString *)marginTop;
+- (NSString *)marginRight;
+- (void)setMarginRight:(NSString *)marginRight;
+- (NSString *)marginBottom;
+- (void)setMarginBottom:(NSString *)marginBottom;
+- (NSString *)marginLeft;
+- (void)setMarginLeft:(NSString *)marginLeft;
+- (NSString *)markerOffset;
+- (void)setMarkerOffset:(NSString *)markerOffset;
+- (NSString *)marks;
+- (void)setMarks:(NSString *)marks;
+- (NSString *)maxHeight;
+- (void)setMaxHeight:(NSString *)maxHeight;
+- (NSString *)maxWidth;
+- (void)setMaxWidth:(NSString *)maxWidth;
+- (NSString *)minHeight;
+- (void)setMinHeight:(NSString *)minHeight;
+- (NSString *)minWidth;
+- (void)setMinWidth:(NSString *)minWidth;
+- (NSString *)orphans;
+- (void)setOrphans:(NSString *)orphans;
+- (NSString *)outline;
+- (void)setOutline:(NSString *)outline;
+- (NSString *)outlineColor;
+- (void)setOutlineColor:(NSString *)outlineColor;
+- (NSString *)outlineStyle;
+- (void)setOutlineStyle:(NSString *)outlineStyle;
+- (NSString *)outlineWidth;
+- (void)setOutlineWidth:(NSString *)outlineWidth;
+- (NSString *)overflow;
+- (void)setOverflow:(NSString *)overflow;
+- (NSString *)padding;
+- (void)setPadding:(NSString *)padding;
+- (NSString *)paddingTop;
+- (void)setPaddingTop:(NSString *)paddingTop;
+- (NSString *)paddingRight;
+- (void)setPaddingRight:(NSString *)paddingRight;
+- (NSString *)paddingBottom;
+- (void)setPaddingBottom:(NSString *)paddingBottom;
+- (NSString *)paddingLeft;
+- (void)setPaddingLeft:(NSString *)paddingLeft;
+- (NSString *)page;
+- (void)setPage:(NSString *)page;
+- (NSString *)pageBreakAfter;
+- (void)setPageBreakAfter:(NSString *)pageBreakAfter;
+- (NSString *)pageBreakBefore;
+- (void)setPageBreakBefore:(NSString *)pageBreakBefore;
+- (NSString *)pageBreakInside;
+- (void)setPageBreakInside:(NSString *)pageBreakInside;
+- (NSString *)pause;
+- (void)setPause:(NSString *)pause;
+- (NSString *)pauseAfter;
+- (void)setPauseAfter:(NSString *)pauseAfter;
+- (NSString *)pauseBefore;
+- (void)setPauseBefore:(NSString *)pauseBefore;
+- (NSString *)pitch;
+- (void)setPitch:(NSString *)pitch;
+- (NSString *)pitchRange;
+- (void)setPitchRange:(NSString *)pitchRange;
+- (NSString *)playDuring;
+- (void)setPlayDuring:(NSString *)playDuring;
+- (NSString *)position;
+- (void)setPosition:(NSString *)position;
+- (NSString *)quotes;
+- (void)setQuotes:(NSString *)quotes;
+- (NSString *)richness;
+- (void)setRichness:(NSString *)richness;
+- (NSString *)right;
+- (void)setRight:(NSString *)right;
+- (NSString *)size;
+- (void)setSize:(NSString *)size;
+- (NSString *)speak;
+- (void)setSpeak:(NSString *)speak;
+- (NSString *)speakHeader;
+- (void)setSpeakHeader:(NSString *)speakHeader;
+- (NSString *)speakNumeral;
+- (void)setSpeakNumeral:(NSString *)speakNumeral;
+- (NSString *)speakPunctuation;
+- (void)setSpeakPunctuation:(NSString *)speakPunctuation;
+- (NSString *)speechRate;
+- (void)setSpeechRate:(NSString *)speechRate;
+- (NSString *)stress;
+- (void)setStress:(NSString *)stress;
+- (NSString *)tableLayout;
+- (void)setTableLayout:(NSString *)tableLayout;
+- (NSString *)textAlign;
+- (void)setTextAlign:(NSString *)textAlign;
+- (NSString *)textDecoration;
+- (void)setTextDecoration:(NSString *)textDecoration;
+- (NSString *)textIndent;
+- (void)setTextIndent:(NSString *)textIndent;
+- (NSString *)textShadow;
+- (void)setTextShadow:(NSString *)textShadow;
+- (NSString *)textTransform;
+- (void)setTextTransform:(NSString *)textTransform;
+- (NSString *)top;
+- (void)setTop:(NSString *)top;
+- (NSString *)unicodeBidi;
+- (void)setUnicodeBidi:(NSString *)unicodeBidi;
+- (NSString *)verticalAlign;
+- (void)setVerticalAlign:(NSString *)verticalAlign;
+- (NSString *)visibility;
+- (void)setVisibility:(NSString *)visibility;
+- (NSString *)voiceFamily;
+- (void)setVoiceFamily:(NSString *)voiceFamily;
+- (NSString *)volume;
+- (void)setVolume:(NSString *)volume;
+- (NSString *)whiteSpace;
+- (void)setWhiteSpace:(NSString *)whiteSpace;
+- (NSString *)widows;
+- (void)setWidows:(NSString *)widows;
+- (NSString *)width;
+- (void)setWidth:(NSString *)width;
+- (NSString *)wordSpacing;
+- (void)setWordSpacing:(NSString *)wordSpacing;
+- (NSString *)zIndex;
+- (void)setZIndex:(NSString *)zIndex;
+@end
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebCore/DOMAttr.h>
+#import <WebCore/DOMCDATASection.h>
+#import <WebCore/DOMCharacterData.h>
+#import <WebCore/DOMComment.h>
+#import <WebCore/DOMDocument.h>
+#import <WebCore/DOMDocumentFragment.h>
+#import <WebCore/DOMDocumentType.h>
+#import <WebCore/DOMElement.h>
+#import <WebCore/DOMEntity.h>
+#import <WebCore/DOMEntityReference.h>
+#import <WebCore/DOMException.h>
+#import <WebCore/DOMDOMImplementation.h>
+#import <WebCore/DOMNamedNodeMap.h>
+#import <WebCore/DOMNode.h>
+#import <WebCore/DOMNodeList.h>
+#import <WebCore/DOMNotation.h>
+#import <WebCore/DOMObject.h>
+#import <WebCore/DOMProcessingInstruction.h>
+#import <WebCore/DOMText.h>
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DOMCoreException_h
+#define DOMCoreException_h
+
+#include "ExceptionBase.h"
+
+namespace WebCore {
+
+ class DOMCoreException : public ExceptionBase {
+ public:
+ static PassRefPtr<DOMCoreException> create(const ExceptionCodeDescription& description)
+ {
+ return adoptRef(new DOMCoreException(description));
+ }
+
+ private:
+ DOMCoreException(const ExceptionCodeDescription& description)
+ : ExceptionBase(description)
+ {
+ }
+ };
+
+} // namespace WebCore
+
+#endif // DOMCoreException_h
--- /dev/null
+/*
+ * Copyright (C) 2007 Alexey Proskuryakov (ap@nypop.com)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DOMCustomXPathNSResolver_h
+#define DOMCustomXPathNSResolver_h
+
+#if ENABLE(XPATH)
+
+#include "XPathNSResolver.h"
+
+#include "DOMXPathNSResolver.h"
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+ class Frame;
+
+ class DOMCustomXPathNSResolver : public XPathNSResolver {
+ public:
+ static PassRefPtr<DOMCustomXPathNSResolver> create(id <DOMXPathNSResolver> customResolver) { return adoptRef(new DOMCustomXPathNSResolver(customResolver)); }
+ virtual ~DOMCustomXPathNSResolver();
+
+ virtual String lookupNamespaceURI(const String& prefix);
+
+ private:
+ DOMCustomXPathNSResolver(id <DOMXPathNSResolver>);
+ id <DOMXPathNSResolver> m_customResolver; // DOMCustomXPathNSResolvers are always temporary, thus no need to GC protect the object.
+ };
+
+} // namespace WebCore
+
+#endif // ENABLE(XPATH)
+
+#endif // DOMCustomXPathNSResolver_h
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <JavaScriptCore/WebKitAvailability.h>
+
+#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_1_3
+
+@class NSString;
+
+extern NSString * const DOMEventException;
+
+enum DOMEventExceptionCode {
+ DOM_UNSPECIFIED_EVENT_TYPE_ERR = 0
+};
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006, 2008 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebCore/DOMDocument.h>
+#import <WebCore/DOMNode.h>
+#import <WebCore/DOMObject.h>
+#import <WebCore/DOMViews.h>
+
+#import <WebCore/DOMEvent.h>
+#import <WebCore/DOMEventException.h>
+#import <WebCore/DOMEventListener.h>
+#import <WebCore/DOMEventTarget.h>
+#import <WebCore/DOMKeyboardEvent.h>
+#import <WebCore/DOMMouseEvent.h>
+#import <WebCore/DOMMutationEvent.h>
+#import <WebCore/DOMOverflowEvent.h>
+#import <WebCore/DOMUIEvent.h>
+#import <WebCore/DOMWheelEvent.h>
+
+#if ENABLE(TOUCH_EVENTS)
+#import <WebCore/DOMTouchEvent.h>
+#import <WebCore/DOMGestureEvent.h>
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <JavaScriptCore/WebKitAvailability.h>
+
+#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_1_3
+
+@class NSString;
+
+extern NSString * const DOMException;
+
+enum DOMExceptionCode {
+ DOM_INDEX_SIZE_ERR = 1,
+ DOM_DOMSTRING_SIZE_ERR = 2,
+ DOM_HIERARCHY_REQUEST_ERR = 3,
+ DOM_WRONG_DOCUMENT_ERR = 4,
+ DOM_INVALID_CHARACTER_ERR = 5,
+ DOM_NO_DATA_ALLOWED_ERR = 6,
+ DOM_NO_MODIFICATION_ALLOWED_ERR = 7,
+ DOM_NOT_FOUND_ERR = 8,
+ DOM_NOT_SUPPORTED_ERR = 9,
+ DOM_INUSE_ATTRIBUTE_ERR = 10,
+ DOM_INVALID_STATE_ERR = 11,
+ DOM_SYNTAX_ERR = 12,
+ DOM_INVALID_MODIFICATION_ERR = 13,
+ DOM_NAMESPACE_ERR = 14,
+ DOM_INVALID_ACCESS_ERR = 15
+};
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2004-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebCore/DOMAttr.h>
+#import <WebCore/DOMCSS.h>
+#import <WebCore/DOMCSSStyleDeclaration.h>
+#import <WebCore/DOMDocument.h>
+#import <WebCore/DOMElement.h>
+#import <WebCore/DOMHTML.h>
+#import <WebCore/DOMHTMLAnchorElement.h>
+#import <WebCore/DOMHTMLAreaElement.h>
+#import <WebCore/DOMHTMLDocument.h>
+#import <WebCore/DOMHTMLElement.h>
+#import <WebCore/DOMHTMLEmbedElement.h>
+#import <WebCore/DOMHTMLImageElement.h>
+#import <WebCore/DOMHTMLInputElement.h>
+#import <WebCore/DOMHTMLLinkElement.h>
+#import <WebCore/DOMHTMLObjectElement.h>
+#import <WebCore/DOMNode.h>
+#import <WebCore/DOMRGBColor.h>
+#import <WebCore/DOMRange.h>
+
+#import <CoreGraphics/CoreGraphics.h>
+
+@class NSArray;
+@class NSImage;
+@class NSURL;
+
+
+@interface DOMHTMLElement (DOMHTMLElementExtensions)
+- (int)scrollXOffset;
+- (int)scrollYOffset;
+- (void)setScrollXOffset:(int)x scrollYOffset:(int)y;
+- (void)setScrollXOffset:(int)x scrollYOffset:(int)y adjustForPurpleCaret:(BOOL)adjustForPurpleCaret;
+- (void)absolutePosition:(int *)x :(int *)y :(int *)w :(int *)h;
+@end
+
+typedef struct _WKQuad {
+ CGPoint p1;
+ CGPoint p2;
+ CGPoint p3;
+ CGPoint p4;
+} WKQuad;
+
+@interface WKQuadObject : NSObject
+{
+ WKQuad _quad;
+}
+
+- (id)initWithQuad:(WKQuad)quad;
+- (WKQuad)quad;
+- (CGRect)boundingBox;
+@end
+
+@interface DOMNode (DOMNodeExtensions)
+- (CGRect)boundingBox;
+- (NSArray *)lineBoxRects WEBKIT_OBJC_METHOD_ANNOTATION(AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER);
+
+- (WKQuad)absoluteQuad;
+- (NSArray *)lineBoxQuads; // returns array of WKQuadObject
+
+- (NSURL *)hrefURL;
+- (CGRect)hrefFrame;
+- (NSString *)hrefTarget;
+- (NSString *)hrefLabel;
+- (NSString *)hrefTitle;
+- (CGRect)boundingFrame;
+- (CGRect)innerFrame;
+- (WKQuad)innerFrameQuad; // takes transforms into account
+- (float)computedFontSize;
+- (DOMNode *)nextFocusNode;
+- (DOMNode *)previousFocusNode;
+@end
+
+@interface DOMElement (DOMElementAppKitExtensions)
+@end
+
+@interface DOMHTMLDocument (DOMHTMLDocumentExtensions)
+- (DOMDocumentFragment *)createDocumentFragmentWithMarkupString:(NSString *)markupString baseURL:(NSURL *)baseURL WEBKIT_OBJC_METHOD_ANNOTATION(AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER);
+- (DOMDocumentFragment *)createDocumentFragmentWithText:(NSString *)text WEBKIT_OBJC_METHOD_ANNOTATION(AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER);
+@end
+
+@interface DOMHTMLAreaElement (DOMHTMLAreaElementExtensions)
+- (CGRect)boundingFrameForOwner:(DOMNode *)anOwner;
+@end
+
+@interface DOMHTMLSelectElement (DOMHTMLSelectElementExtensions)
+- (DOMNode *)listItemAtIndex:(int)anIndex;
+@end
--- /dev/null
+/*
+ * Copyright (C) 2004-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebCore/DOMCore.h>
+
+#import <WebCore/DOMHTMLAnchorElement.h>
+#import <WebCore/DOMHTMLAppletElement.h>
+#import <WebCore/DOMHTMLAreaElement.h>
+#import <WebCore/DOMHTMLBRElement.h>
+#import <WebCore/DOMHTMLBaseElement.h>
+#import <WebCore/DOMHTMLBaseFontElement.h>
+#import <WebCore/DOMHTMLBodyElement.h>
+#import <WebCore/DOMHTMLButtonElement.h>
+#import <WebCore/DOMHTMLCollection.h>
+#import <WebCore/DOMHTMLDListElement.h>
+#import <WebCore/DOMHTMLDirectoryElement.h>
+#import <WebCore/DOMHTMLDivElement.h>
+#import <WebCore/DOMHTMLDocument.h>
+#import <WebCore/DOMHTMLElement.h>
+#import <WebCore/DOMHTMLEmbedElement.h>
+#import <WebCore/DOMHTMLFieldSetElement.h>
+#import <WebCore/DOMHTMLFontElement.h>
+#import <WebCore/DOMHTMLFormElement.h>
+#import <WebCore/DOMHTMLFrameElement.h>
+#import <WebCore/DOMHTMLFrameSetElement.h>
+#import <WebCore/DOMHTMLHRElement.h>
+#import <WebCore/DOMHTMLHeadElement.h>
+#import <WebCore/DOMHTMLHeadingElement.h>
+#import <WebCore/DOMHTMLHtmlElement.h>
+#import <WebCore/DOMHTMLIFrameElement.h>
+#import <WebCore/DOMHTMLImageElement.h>
+#import <WebCore/DOMHTMLInputElement.h>
+#import <WebCore/DOMHTMLIsIndexElement.h>
+#import <WebCore/DOMHTMLLIElement.h>
+#import <WebCore/DOMHTMLLabelElement.h>
+#import <WebCore/DOMHTMLLegendElement.h>
+#import <WebCore/DOMHTMLLinkElement.h>
+#import <WebCore/DOMHTMLMapElement.h>
+#import <WebCore/DOMHTMLMarqueeElement.h>
+#import <WebCore/DOMHTMLMenuElement.h>
+#import <WebCore/DOMHTMLMetaElement.h>
+#import <WebCore/DOMHTMLModElement.h>
+#import <WebCore/DOMHTMLOListElement.h>
+#import <WebCore/DOMHTMLObjectElement.h>
+#import <WebCore/DOMHTMLOptGroupElement.h>
+#import <WebCore/DOMHTMLOptionElement.h>
+#import <WebCore/DOMHTMLOptionsCollection.h>
+#import <WebCore/DOMHTMLParagraphElement.h>
+#import <WebCore/DOMHTMLParamElement.h>
+#import <WebCore/DOMHTMLPreElement.h>
+#import <WebCore/DOMHTMLQuoteElement.h>
+#import <WebCore/DOMHTMLScriptElement.h>
+#import <WebCore/DOMHTMLSelectElement.h>
+#import <WebCore/DOMHTMLStyleElement.h>
+#import <WebCore/DOMHTMLTableCaptionElement.h>
+#import <WebCore/DOMHTMLTableCellElement.h>
+#import <WebCore/DOMHTMLTableColElement.h>
+#import <WebCore/DOMHTMLTableElement.h>
+#import <WebCore/DOMHTMLTableRowElement.h>
+#import <WebCore/DOMHTMLTableSectionElement.h>
+#import <WebCore/DOMHTMLTextAreaElement.h>
+#import <WebCore/DOMHTMLTitleElement.h>
+#import <WebCore/DOMHTMLUListElement.h>
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef DOMImplementation_h
+#define DOMImplementation_h
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class CSSStyleSheet;
+class Document;
+class DocumentType;
+class Frame;
+class HTMLDocument;
+class String;
+
+typedef int ExceptionCode;
+
+class DOMImplementation : public RefCounted<DOMImplementation> {
+public:
+ static PassRefPtr<DOMImplementation> create() { return adoptRef(new DOMImplementation); }
+
+ // DOM methods & attributes for DOMImplementation
+ static bool hasFeature(const String& feature, const String& version);
+ static PassRefPtr<DocumentType> createDocumentType(const String& qualifiedName, const String& publicId, const String &systemId, ExceptionCode&);
+ static PassRefPtr<Document> createDocument(const String& namespaceURI, const String& qualifiedName, DocumentType*, ExceptionCode&);
+
+ DOMImplementation* getInterface(const String& feature);
+
+ // From the DOMImplementationCSS interface
+ static PassRefPtr<CSSStyleSheet> createCSSStyleSheet(const String& title, const String& media, ExceptionCode&);
+
+ // From the HTMLDOMImplementation interface
+ static PassRefPtr<HTMLDocument> createHTMLDocument(const String& title);
+
+ // Other methods (not part of DOM)
+ static PassRefPtr<Document> createDocument(const String& MIMEType, Frame*, bool inViewSourceMode);
+ static PassRefPtr<Document> createDocument(Frame*);
+ static PassRefPtr<HTMLDocument> createHTMLDocument(Frame*);
+
+ static bool isXMLMIMEType(const String& MIMEType);
+ static bool isTextMIMEType(const String& MIMEType);
+
+private:
+ DOMImplementation() { }
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef DOMImplementationFront_h
+#define DOMImplementationFront_h
+
+// FIXME: This source file exists to work around a problem that occurs trying
+// to mix DOMImplementation and WebCore::DOMImplementation in DOM.mm.
+// It seems to affect only older versions of gcc. Once the buildbot is upgraded,
+// we should consider increasing the minimum required version of gcc to build
+// WebCore, and rolling the change that introduced this file back.
+
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+class CSSStyleSheet;
+class Document;
+class DocumentType;
+class HTMLDocument;
+class JSDOMImplementation;
+class String;
+
+typedef int ExceptionCode;
+
+class DOMImplementationFront {
+public:
+ void ref();
+ void deref();
+ bool hasFeature(const String& feature, const String& version) const;
+ PassRefPtr<DocumentType> createDocumentType(const String& qualifiedName, const String& publicId, const String& systemId, ExceptionCode&);
+ PassRefPtr<Document> createDocument(const String& namespaceURI, const String& qualifiedName, DocumentType*, ExceptionCode&);
+ DOMImplementationFront* getInterface(const String& feature);
+ PassRefPtr<CSSStyleSheet> createCSSStyleSheet(const String& title, const String& media, ExceptionCode&);
+ PassRefPtr<HTMLDocument> createHTMLDocument(const String& title);
+};
+
+DOMImplementationFront* implementationFront(Document*);
+DOMImplementationFront* implementationFront(JSDOMImplementation*);
+
+} // namespace WebCore
+
+#endif // DOMImplementationFront_h
--- /dev/null
+/*
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 James G. Speth (speth@end.com)
+ * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// This is lets our internals access DOMObject's _internal field while having
+// it be private for clients outside WebKit.
+#define private public
+#import "DOMObject.h"
+#undef private
+
+#import "DOMNodeFilter.h"
+#import "DOMXPathNSResolver.h"
+#import <wtf/Forward.h>
+
+#import <Foundation/NSMapTable.h>
+
+namespace JSC {
+ class JSObject;
+ namespace Bindings {
+ class RootObject;
+ }
+}
+
+namespace WebCore {
+ class NodeFilter;
+#if ENABLE(XPATH)
+ class XPathNSResolver;
+#endif
+#if ENABLE(TOUCH_EVENTS)
+ class Touch;
+#endif
+}
+
+@interface DOMNodeFilter : DOMObject <DOMNodeFilter>
+@end
+
+#if ENABLE(XPATH)
+@interface DOMNativeXPathNSResolver : DOMObject <DOMXPathNSResolver>
+@end
+#endif // ENABLE(XPATH)
+
+// Helper functions for DOM wrappers and gluing to Objective-C
+
+// Create an NSMapTable mapping from pointers to ObjC objects held with zeroing weak references.
+NSMapTable* createWrapperCache();
+NSMapTable* createWrapperCacheWithIntegerKeys(); // Same, but from integers to ObjC objects.
+
+id createDOMWrapper(JSC::JSObject*, PassRefPtr<JSC::Bindings::RootObject> origin, PassRefPtr<JSC::Bindings::RootObject> current);
+
+NSObject* getDOMWrapper(DOMObjectInternal*);
+void addDOMWrapper(NSObject* wrapper, DOMObjectInternal*);
+void removeDOMWrapper(DOMObjectInternal*);
+
+template <class Source>
+inline id getDOMWrapper(Source impl)
+{
+ return getDOMWrapper(reinterpret_cast<DOMObjectInternal*>(impl));
+}
+
+template <class Source>
+inline void addDOMWrapper(NSObject* wrapper, Source impl)
+{
+ addDOMWrapper(wrapper, reinterpret_cast<DOMObjectInternal*>(impl));
+}
+
+DOMNodeFilter *kit(WebCore::NodeFilter*);
+WebCore::NodeFilter* core(DOMNodeFilter *);
+
+#if ENABLE(XPATH)
+DOMNativeXPathNSResolver *kit(WebCore::XPathNSResolver*);
+WebCore::XPathNSResolver* core(DOMNativeXPathNSResolver *);
+#endif // ENABLE(XPATH)
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebCore/DOMException.h>
+#import <WebCore/WebScriptObject.h>
+
+#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_1_3
+
+@class DOMStyleSheet;
+
+typedef unsigned long long DOMTimeStamp;
+
+typedef struct DOMObjectInternal DOMObjectInternal;
+
+@interface DOMObject : WebScriptObject <NSCopying>
+{
+@private
+ DOMObjectInternal *_internal;
+}
+@end
+
+@interface DOMObject (DOMLinkStyle)
+- (DOMStyleSheet *)sheet;
+@end
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2004-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebCore/DOMCSS.h>
+#import <WebCore/DOMCSSStyleDeclaration.h>
+#import <WebCore/DOMElement.h>
+#import <WebCore/DOMEvents.h>
+#import <WebCore/DOMHTML.h>
+#import <WebCore/DOMHTMLDocument.h>
+#import <WebCore/DOMHTMLInputElement.h>
+#import <WebCore/DOMHTMLSelectElement.h>
+#import <WebCore/DOMNode.h>
+#import <WebCore/DOMRGBColor.h>
+#import <WebCore/DOMRange.h>
+
+#import <WebCore/DOMDocumentPrivate.h>
+#import <WebCore/DOMElementPrivate.h>
+#import <WebCore/DOMHTMLAnchorElementPrivate.h>
+#import <WebCore/DOMHTMLAreaElementPrivate.h>
+#import <WebCore/DOMHTMLBodyElementPrivate.h>
+#import <WebCore/DOMHTMLButtonElementPrivate.h>
+#import <WebCore/DOMHTMLDocumentPrivate.h>
+#import <WebCore/DOMHTMLFormElementPrivate.h>
+#if ENABLE(SVG_DOM_OBJC_BINDINGS)
+#import <WebCore/DOMHTMLFrameElementPrivate.h>
+#endif
+#import <WebCore/DOMHTMLImageElementPrivate.h>
+#import <WebCore/DOMHTMLInputElementPrivate.h>
+#import <WebCore/DOMHTMLLinkElementPrivate.h>
+#import <WebCore/DOMHTMLOptionsCollectionPrivate.h>
+#import <WebCore/DOMHTMLPreElementPrivate.h>
+#import <WebCore/DOMHTMLStyleElementPrivate.h>
+#import <WebCore/DOMHTMLTextAreaElementPrivate.h>
+#import <WebCore/DOMKeyboardEventPrivate.h>
+#import <WebCore/DOMMouseEventPrivate.h>
+#import <WebCore/DOMNodeIteratorPrivate.h>
+#import <WebCore/DOMNodePrivate.h>
+#import <WebCore/DOMProcessingInstructionPrivate.h>
+#import <WebCore/DOMRangePrivate.h>
+#import <WebCore/DOMUIEventPrivate.h>
+#import <WebCore/DOMWheelEventPrivate.h>
+
+#import <GraphicsServices/GSFont.h>
+
+@interface DOMNode (DOMNodeExtensionsPendingPublic)
+@end
+
+// FIXME: this should be removed as soon as all internal Apple uses of it have been replaced with
+// calls to the public method - (NSColor *)color.
+@interface DOMRGBColor (WebPrivate)
+@end
+
+// FIXME: this should be removed as soon as all internal Apple uses of it have been replaced with
+// calls to the public method - (NSString *)text.
+@interface DOMRange (WebPrivate)
+- (NSString *)_text;
+@end
+
+@interface DOMRange (DOMRangeExtensions)
+- (CGRect)boundingBox;
+- (NSArray *)lineBoxRects;
+@end
+
+@interface DOMElement (WebPrivate)
+- (GSFontRef)_font;
+- (NSURL *)_getURLAttribute:(NSString *)name;
+- (CGRect)_windowClipRect; // Clip rect in NSWindow coords (used by plugins)
+- (BOOL)isFocused;
+@end
+
+@interface DOMCSSStyleDeclaration (WebPrivate)
+- (NSString *)_fontSizeDelta;
+- (void)_setFontSizeDelta:(NSString *)fontSizeDelta;
+@end
+
+@interface DOMHTMLDocument (WebPrivate)
+- (DOMDocumentFragment *)_createDocumentFragmentWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString;
+- (DOMDocumentFragment *)_createDocumentFragmentWithText:(NSString *)text;
+@end
+
+// All the methods in this category are used by Safari forms autofill and should not be used for any other purpose.
+// They are stopgap measures until we finish transitioning form controls to not use NSView. Each one should become
+// replaceable by public DOM API, and when that happens Safari will switch to implementations using that public API,
+// and these will be deleted.
+@interface DOMHTMLInputElement (FormsAutoFillTransition)
+- (BOOL)_isTextField;
+- (void)_replaceCharactersInRange:(NSRange)targetRange withString:(NSString *)replacementString selectingFromIndex:(int)index;
+- (NSRange)_selectedRange;
+- (void)_setAutofilled:(BOOL)filled;
+@end
+
+// These changes are necessary to detect whether a form input was modified by a user
+// or javascript
+@interface DOMHTMLInputElement (FormPromptAdditions)
+- (BOOL)_isEdited;
+@end
+
+@interface DOMHTMLTextAreaElement (FormPromptAdditions)
+- (BOOL)_isEdited;
+@end
+
+// All the methods in this category are used by Safari forms autofill and should not be used for any other purpose.
+// They are stopgap measures until we finish transitioning form controls to not use NSView. Each one should become
+// replaceable by public DOM API, and when that happens Safari will switch to implementations using that public API,
+// and these will be deleted.
+@interface DOMHTMLSelectElement (FormsAutoFillTransition)
+- (void)_activateItemAtIndex:(int)index;
+@end
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <JavaScriptCore/WebKitAvailability.h>
+
+#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_1_3
+
+@class NSString;
+
+extern NSString * const DOMRangeException;
+
+enum DOMRangeExceptionCode {
+ DOM_BAD_BOUNDARYPOINTS_ERR = 1,
+ DOM_INVALID_NODE_TYPE_ERR = 2
+};
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebCore/DOMRange.h>
+#import <WebCore/DOMRangeException.h>
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebCore/DOMSVGAElement.h>
+#import <WebCore/DOMSVGAltGlyphElement.h>
+#import <WebCore/DOMSVGAngle.h>
+#import <WebCore/DOMSVGAnimateColorElement.h>
+#import <WebCore/DOMSVGAnimateElement.h>
+#import <WebCore/DOMSVGAnimateTransformElement.h>
+#import <WebCore/DOMSVGAnimatedAngle.h>
+#import <WebCore/DOMSVGAnimatedBoolean.h>
+#import <WebCore/DOMSVGAnimatedEnumeration.h>
+#import <WebCore/DOMSVGAnimatedInteger.h>
+#import <WebCore/DOMSVGAnimatedLength.h>
+#import <WebCore/DOMSVGAnimatedLengthList.h>
+#import <WebCore/DOMSVGAnimatedNumber.h>
+#import <WebCore/DOMSVGAnimatedNumberList.h>
+#import <WebCore/DOMSVGAnimatedPathData.h>
+#import <WebCore/DOMSVGAnimatedPoints.h>
+#import <WebCore/DOMSVGAnimatedPreserveAspectRatio.h>
+#import <WebCore/DOMSVGAnimatedRect.h>
+#import <WebCore/DOMSVGAnimatedString.h>
+#import <WebCore/DOMSVGAnimatedTransformList.h>
+#import <WebCore/DOMSVGAnimationElement.h>
+#import <WebCore/DOMSVGCircleElement.h>
+#import <WebCore/DOMSVGClipPathElement.h>
+#import <WebCore/DOMSVGColor.h>
+#import <WebCore/DOMSVGComponentTransferFunctionElement.h>
+#import <WebCore/DOMSVGCursorElement.h>
+#import <WebCore/DOMSVGDefinitionSrcElement.h>
+#import <WebCore/DOMSVGDefsElement.h>
+#import <WebCore/DOMSVGDescElement.h>
+#import <WebCore/DOMSVGDocument.h>
+#import <WebCore/DOMSVGElement.h>
+#import <WebCore/DOMSVGElementInstance.h>
+#import <WebCore/DOMSVGElementInstanceList.h>
+#import <WebCore/DOMSVGEllipseElement.h>
+#import <WebCore/DOMSVGException.h>
+#import <WebCore/DOMSVGExternalResourcesRequired.h>
+#import <WebCore/DOMSVGFEBlendElement.h>
+#import <WebCore/DOMSVGFEColorMatrixElement.h>
+#import <WebCore/DOMSVGFEComponentTransferElement.h>
+#import <WebCore/DOMSVGFECompositeElement.h>
+#import <WebCore/DOMSVGFEDiffuseLightingElement.h>
+#import <WebCore/DOMSVGFEDisplacementMapElement.h>
+#import <WebCore/DOMSVGFEDistantLightElement.h>
+#import <WebCore/DOMSVGFEFloodElement.h>
+#import <WebCore/DOMSVGFEFuncAElement.h>
+#import <WebCore/DOMSVGFEFuncBElement.h>
+#import <WebCore/DOMSVGFEFuncGElement.h>
+#import <WebCore/DOMSVGFEFuncRElement.h>
+#import <WebCore/DOMSVGFEGaussianBlurElement.h>
+#import <WebCore/DOMSVGFEImageElement.h>
+#import <WebCore/DOMSVGFEMergeElement.h>
+#import <WebCore/DOMSVGFEMergeNodeElement.h>
+#import <WebCore/DOMSVGFEOffsetElement.h>
+#import <WebCore/DOMSVGFEPointLightElement.h>
+#import <WebCore/DOMSVGFESpecularLightingElement.h>
+#import <WebCore/DOMSVGFESpotLightElement.h>
+#import <WebCore/DOMSVGFETileElement.h>
+#import <WebCore/DOMSVGFETurbulenceElement.h>
+#import <WebCore/DOMSVGFilterElement.h>
+#import <WebCore/DOMSVGFilterPrimitiveStandardAttributes.h>
+#import <WebCore/DOMSVGFitToViewBox.h>
+#import <WebCore/DOMSVGFontElement.h>
+#import <WebCore/DOMSVGFontFaceElement.h>
+#import <WebCore/DOMSVGFontFaceFormatElement.h>
+#import <WebCore/DOMSVGFontFaceNameElement.h>
+#import <WebCore/DOMSVGFontFaceSrcElement.h>
+#import <WebCore/DOMSVGFontFaceUriElement.h>
+#import <WebCore/DOMSVGForeignObjectElement.h>
+#import <WebCore/DOMSVGGElement.h>
+#import <WebCore/DOMSVGGlyphElement.h>
+#import <WebCore/DOMSVGGradientElement.h>
+#import <WebCore/DOMSVGImageElement.h>
+#import <WebCore/DOMSVGLangSpace.h>
+#import <WebCore/DOMSVGLength.h>
+#import <WebCore/DOMSVGLengthList.h>
+#import <WebCore/DOMSVGLineElement.h>
+#import <WebCore/DOMSVGLinearGradientElement.h>
+#import <WebCore/DOMSVGLocatable.h>
+#import <WebCore/DOMSVGMarkerElement.h>
+#import <WebCore/DOMSVGMaskElement.h>
+#import <WebCore/DOMSVGMatrix.h>
+#import <WebCore/DOMSVGMetadataElement.h>
+#import <WebCore/DOMSVGMissingGlyphElement.h>
+#import <WebCore/DOMSVGNumber.h>
+#import <WebCore/DOMSVGNumberList.h>
+#import <WebCore/DOMSVGPaint.h>
+#import <WebCore/DOMSVGPathElement.h>
+#import <WebCore/DOMSVGPathSeg.h>
+#import <WebCore/DOMSVGPathSegArcAbs.h>
+#import <WebCore/DOMSVGPathSegArcRel.h>
+#import <WebCore/DOMSVGPathSegClosePath.h>
+#import <WebCore/DOMSVGPathSegCurvetoCubicAbs.h>
+#import <WebCore/DOMSVGPathSegCurvetoCubicRel.h>
+#import <WebCore/DOMSVGPathSegCurvetoCubicSmoothAbs.h>
+#import <WebCore/DOMSVGPathSegCurvetoCubicSmoothRel.h>
+#import <WebCore/DOMSVGPathSegCurvetoQuadraticAbs.h>
+#import <WebCore/DOMSVGPathSegCurvetoQuadraticRel.h>
+#import <WebCore/DOMSVGPathSegCurvetoQuadraticSmoothAbs.h>
+#import <WebCore/DOMSVGPathSegCurvetoQuadraticSmoothRel.h>
+#import <WebCore/DOMSVGPathSegLinetoAbs.h>
+#import <WebCore/DOMSVGPathSegLinetoHorizontalAbs.h>
+#import <WebCore/DOMSVGPathSegLinetoHorizontalRel.h>
+#import <WebCore/DOMSVGPathSegLinetoRel.h>
+#import <WebCore/DOMSVGPathSegLinetoVerticalAbs.h>
+#import <WebCore/DOMSVGPathSegLinetoVerticalRel.h>
+#import <WebCore/DOMSVGPathSegList.h>
+#import <WebCore/DOMSVGPathSegMovetoAbs.h>
+#import <WebCore/DOMSVGPathSegMovetoRel.h>
+#import <WebCore/DOMSVGPatternElement.h>
+#import <WebCore/DOMSVGPoint.h>
+#import <WebCore/DOMSVGPointList.h>
+#import <WebCore/DOMSVGPolygonElement.h>
+#import <WebCore/DOMSVGPolylineElement.h>
+#import <WebCore/DOMSVGPreserveAspectRatio.h>
+#import <WebCore/DOMSVGRadialGradientElement.h>
+#import <WebCore/DOMSVGRect.h>
+#import <WebCore/DOMSVGRectElement.h>
+#import <WebCore/DOMSVGRenderingIntent.h>
+#import <WebCore/DOMSVGSVGElement.h>
+#import <WebCore/DOMSVGScriptElement.h>
+#import <WebCore/DOMSVGSetElement.h>
+#import <WebCore/DOMSVGStopElement.h>
+#import <WebCore/DOMSVGStringList.h>
+#import <WebCore/DOMSVGStylable.h>
+#import <WebCore/DOMSVGStyleElement.h>
+#import <WebCore/DOMSVGSwitchElement.h>
+#import <WebCore/DOMSVGSymbolElement.h>
+#import <WebCore/DOMSVGTRefElement.h>
+#import <WebCore/DOMSVGTSpanElement.h>
+#import <WebCore/DOMSVGTests.h>
+#import <WebCore/DOMSVGTextContentElement.h>
+#import <WebCore/DOMSVGTextElement.h>
+#import <WebCore/DOMSVGTextPathElement.h>
+#import <WebCore/DOMSVGTextPositioningElement.h>
+#import <WebCore/DOMSVGTitleElement.h>
+#import <WebCore/DOMSVGTransform.h>
+#import <WebCore/DOMSVGTransformList.h>
+#import <WebCore/DOMSVGTransformable.h>
+#import <WebCore/DOMSVGURIReference.h>
+#import <WebCore/DOMSVGUnitTypes.h>
+#import <WebCore/DOMSVGUseElement.h>
+#import <WebCore/DOMSVGViewElement.h>
+#import <WebCore/DOMSVGZoomAndPan.h>
+#import <WebCore/DOMSVGZoomEvent.h>
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <JavaScriptCore/WebKitAvailability.h>
+
+#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_LATEST
+
+@class NSString;
+
+extern NSString * const DOMSVGException;
+
+enum DOMSVGException {
+ DOM_SVG_WRONG_TYPE_ERR = 0,
+ DOM_SVG_INVALID_VALUE_ERR = 1,
+ DOM_SVG_MATRIX_NOT_INVERTABLE = 2
+};
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#ifndef DOMSelection_h
+#define DOMSelection_h
+
+#include <wtf/RefCounted.h>
+#include <wtf/Forward.h>
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+ class Frame;
+ class Range;
+ class Node;
+ class String;
+
+ typedef int ExceptionCode;
+
+ class DOMSelection : public RefCounted<DOMSelection> {
+ public:
+ static PassRefPtr<DOMSelection> create(Frame* frame) { return adoptRef(new DOMSelection(frame)); }
+
+ Frame* frame() const;
+ void disconnectFrame();
+
+ // Safari Selection Object API
+ // These methods return the valid equivalents of internal editing positions.
+ Node* baseNode() const;
+ Node* extentNode() const;
+ int baseOffset() const;
+ int extentOffset() const;
+ String type() const;
+ void setBaseAndExtent(Node* baseNode, int baseOffset, Node* extentNode, int extentOffset, ExceptionCode&);
+ void setPosition(Node*, int offset, ExceptionCode&);
+ void modify(const String& alter, const String& direction, const String& granularity);
+
+ // Mozilla Selection Object API
+ // In Firefox, anchor/focus are the equal to the start/end of the selection,
+ // but reflect the direction in which the selection was made by the user. That does
+ // not mean that they are base/extent, since the base/extent don't reflect
+ // expansion.
+ // These methods return the valid equivalents of internal editing positions.
+ Node* anchorNode() const;
+ int anchorOffset() const;
+ Node* focusNode() const;
+ int focusOffset() const;
+ bool isCollapsed() const;
+ int rangeCount() const;
+ void collapse(Node*, int offset, ExceptionCode&);
+ void collapseToEnd();
+ void collapseToStart();
+ void extend(Node*, int offset, ExceptionCode&);
+ PassRefPtr<Range> getRangeAt(int, ExceptionCode&);
+ void removeAllRanges();
+ void addRange(Range*);
+ void deleteFromDocument();
+ bool containsNode(const Node*, bool partlyContained) const;
+ void selectAllChildren(Node*, ExceptionCode&);
+
+ String toString();
+
+ // Microsoft Selection Object API
+ void empty();
+ //void clear();
+ //TextRange *createRange();
+
+ private:
+ DOMSelection(Frame*);
+
+ Frame* m_frame;
+ };
+
+} // namespace WebCore
+
+#endif // DOMSelection_h
--- /dev/null
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef DOMStringList_h
+#define DOMStringList_h
+
+#include "PlatformString.h"
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+ class DOMStringList : public RefCounted<DOMStringList> {
+ public:
+ virtual ~DOMStringList();
+
+ virtual unsigned length() const = 0;
+ virtual String item(unsigned) const = 0;
+ virtual bool contains(const String&) const = 0;
+ };
+
+} // namespace WebCore
+
+#endif // DOMStringList_h
--- /dev/null
+/*
+ * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebCore/DOMCore.h>
+#import <WebCore/DOMDocument.h>
+#import <WebCore/DOMObject.h>
+
+#import <WebCore/DOMStyleSheet.h>
+#import <WebCore/DOMStyleSheetList.h>
+#import <WebCore/DOMMediaList.h>
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef DOMTimer_h
+#define DOMTimer_h
+
+#include "ActiveDOMObject.h"
+#include "Timer.h"
+#include <wtf/OwnPtr.h>
+
+namespace WebCore {
+
+class ScheduledAction;
+
+class DOMTimer : public TimerBase, public ActiveDOMObject {
+public:
+ virtual ~DOMTimer();
+ // Creates a new timer owned by specified ScriptExecutionContext, starts it
+ // and returns its Id.
+ static int install(ScriptExecutionContext*, ScheduledAction*, int timeout, bool singleShot);
+ static void removeById(ScriptExecutionContext*, int timeoutId);
+
+ // ActiveDOMObject
+ virtual bool hasPendingActivity() const;
+ virtual void contextDestroyed();
+ virtual void stop();
+ virtual bool canSuspend() const;
+ virtual void suspend();
+ virtual void resume();
+
+private:
+ DOMTimer(ScriptExecutionContext*, ScheduledAction*, int timeout, bool singleShot);
+ virtual void fired();
+
+ int m_timeoutId;
+ int m_nestingLevel;
+ OwnPtr<ScheduledAction> m_action;
+ double m_nextFireInterval;
+ double m_repeatInterval;
+};
+
+} // namespace WebCore
+
+#endif // DOMTimer_h
+
--- /dev/null
+/*
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebCore/DOMCore.h>
+#import <WebCore/DOMDocument.h>
+#import <WebCore/DOMObject.h>
+
+#import <WebCore/DOMNodeFilter.h>
+#import <WebCore/DOMNodeIterator.h>
+#import <WebCore/DOMTreeWalker.h>
--- /dev/null
+//
+// DOMUIKitExtensions.h
+// WebCore
+//
+// Copyright (C) 2007, 2008, Apple Inc. All rights reserved.
+//
+
+
+@interface DOMNode (UIKitExtensions)
+- (NSArray *)borderRadii;
+- (NSArray *)boundingBoxes;
+- (NSArray *)absoluteQuads; // return array of WKQuadObjects. takes transforms into account
+
+- (BOOL)containsOnlyInlineObjects;
+- (BOOL)isSelectableBlock;
+- (DOMRange *)rangeOfContainingParagraph;
+- (CGFloat)textHeight;
+- (DOMNode *)findExplodedTextNodeAtPoint:(CGPoint)point; // A second-chance pass to look for text nodes missed by the hit test.
+@end
+
+
+@interface DOMHTMLAreaElement (UIKitExtensions)
+- (CGRect)boundingBoxWithOwner:(DOMNode *)anOwner;
+- (WKQuad)absoluteQuadWithOwner:(DOMNode *)anOwner; // takes transforms into account
+- (NSArray *)boundingBoxesWithOwner:(DOMNode *)anOwner;
+- (NSArray *)absoluteQuadsWithOwner:(DOMNode *)anOwner; // return array of WKQuadObjects. takes transforms into account
+@end
+
+@interface DOMHTMLSelectElement (UIKitExtensions)
+- (unsigned)completeLength;
+- (DOMNode *)listItemAtIndex:(int)anIndex;
+@end
+
+@interface DOMHTMLImageElement (WebDOMHTMLImageElementOperationsPrivate)
+- (NSData *)createNSDataRepresentation:(BOOL)rawImageData;
+- (NSString *)mimeType;
+@end
+
+@interface DOMElement (DOMUIKitComplexityExtensions)
+- (int)structuralComplexityContribution; // Does not include children.
+@end
+
--- /dev/null
+/*
+ * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebCore/DOMCore.h>
+#import <WebCore/DOMDocument.h>
+#import <WebCore/DOMObject.h>
+
+#import <WebCore/DOMAbstractView.h>
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DOMWindow_h
+#define DOMWindow_h
+
+#include "KURL.h"
+#include "PlatformString.h"
+#include "SecurityOrigin.h"
+#include <wtf/Forward.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+ class BarInfo;
+ class CSSRuleList;
+ class CSSStyleDeclaration;
+ class Console;
+ class DOMSelection;
+ class Database;
+ class Document;
+ class Element;
+ class EventListener;
+ class FloatRect;
+ class Frame;
+ class History;
+ class Location;
+ class MessagePort;
+ class Navigator;
+ class PostMessageTimer;
+ class Screen;
+ class WebKitPoint;
+ class Node;
+
+#if ENABLE(DOM_STORAGE)
+ class SessionStorage;
+ class Storage;
+#endif
+
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+ class DOMApplicationCache;
+#endif
+
+ typedef int ExceptionCode;
+
+ class DOMWindow : public RefCounted<DOMWindow> {
+ public:
+ static PassRefPtr<DOMWindow> create(Frame* frame) { return adoptRef(new DOMWindow(frame)); }
+ virtual ~DOMWindow();
+
+ Frame* frame() { return m_frame; }
+ void disconnectFrame();
+
+ void clear();
+
+ int orientation() const;
+
+ void setSecurityOrigin(SecurityOrigin* securityOrigin) { m_securityOrigin = securityOrigin; }
+ SecurityOrigin* securityOrigin() const { return m_securityOrigin.get(); }
+
+ void setURL(const KURL& url) { m_url = url; }
+ KURL url() const { return m_url; }
+
+ static void adjustWindowRect(const FloatRect& screen, FloatRect& window, const FloatRect& pendingChanges);
+
+ // DOM Level 0
+ Screen* screen() const;
+ History* history() const;
+ BarInfo* locationbar() const;
+ BarInfo* menubar() const;
+ BarInfo* personalbar() const;
+ BarInfo* scrollbars() const;
+ BarInfo* statusbar() const;
+ BarInfo* toolbar() const;
+ Navigator* navigator() const;
+ Navigator* clientInformation() const { return navigator(); }
+ Location* location() const;
+
+ DOMSelection* getSelection();
+
+ Element* frameElement() const;
+
+ void focus();
+ void blur();
+ void close();
+ void print();
+ void stop();
+
+ void alert(const String& message);
+ bool confirm(const String& message);
+ String prompt(const String& message, const String& defaultValue);
+
+ bool find(const String&, bool caseSensitive, bool backwards, bool wrap, bool wholeWord, bool searchInFrames, bool showDialog) const;
+
+ bool offscreenBuffering() const;
+
+ int outerHeight() const;
+ int outerWidth() const;
+ int innerHeight() const;
+ int innerWidth() const;
+ int screenX() const;
+ int screenY() const;
+ int screenLeft() const { return screenX(); }
+ int screenTop() const { return screenY(); }
+ int scrollX() const;
+ int scrollY() const;
+ int pageXOffset() const { return scrollX(); }
+ int pageYOffset() const { return scrollY(); }
+
+ bool closed() const;
+
+ unsigned length() const;
+
+ String name() const;
+ void setName(const String&);
+
+ String status() const;
+ void setStatus(const String&);
+ String defaultStatus() const;
+ void setDefaultStatus(const String&);
+ // This attribute is an alias of defaultStatus and is necessary for legacy uses.
+ String defaultstatus() const { return defaultStatus(); }
+ void setDefaultstatus(const String& status) { setDefaultStatus(status); }
+
+ // Self referential attributes
+ DOMWindow* self() const;
+ DOMWindow* window() const { return self(); }
+ DOMWindow* frames() const { return self(); }
+
+ DOMWindow* opener() const;
+ DOMWindow* parent() const;
+ DOMWindow* top() const;
+
+ // DOM Level 2 AbstractView Interface
+ Document* document() const;
+
+ // DOM Level 2 Style Interface
+ PassRefPtr<CSSStyleDeclaration> getComputedStyle(Element*, const String& pseudoElt) const;
+
+ // WebKit extensions
+ PassRefPtr<CSSRuleList> getMatchedCSSRules(Element*, const String& pseudoElt, bool authorOnly = true) const;
+ double devicePixelRatio() const;
+
+ PassRefPtr<WebKitPoint> webkitConvertPointFromPageToNode(Node* node, const WebKitPoint* p) const;
+ PassRefPtr<WebKitPoint> webkitConvertPointFromNodeToPage(Node* node, const WebKitPoint* p) const;
+
+#if ENABLE(DATABASE)
+ // HTML 5 client-side database
+ PassRefPtr<Database> openDatabase(const String& name, const String& version, const String& displayName, unsigned long estimatedSize, ExceptionCode&);
+#endif
+
+#if ENABLE(DOM_STORAGE)
+ // HTML 5 key/value storage
+ Storage* sessionStorage() const;
+ Storage* localStorage() const;
+#endif
+
+ Console* console() const;
+
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+ DOMApplicationCache* applicationCache() const;
+#endif
+
+ void postMessage(const String& message, MessagePort*, const String& targetOrigin, DOMWindow* source, ExceptionCode&);
+ void postMessageTimerFired(PostMessageTimer*);
+
+ void scrollBy(int x, int y) const;
+ void scrollTo(int x, int y) const;
+ void scroll(int x, int y) const { scrollTo(x, y); }
+
+ void moveBy(float x, float y) const;
+ void moveTo(float x, float y) const;
+
+ void resizeBy(float x, float y) const;
+ void resizeTo(float width, float height) const;
+
+ EventListener* onabort() const;
+ void setOnabort(PassRefPtr<EventListener>);
+ EventListener* onblur() const;
+ void setOnblur(PassRefPtr<EventListener>);
+ EventListener* onchange() const;
+ void setOnchange(PassRefPtr<EventListener>);
+ EventListener* onclick() const;
+ void setOnclick(PassRefPtr<EventListener>);
+ EventListener* ondblclick() const;
+ void setOndblclick(PassRefPtr<EventListener>);
+ EventListener* onerror() const;
+ void setOnerror(PassRefPtr<EventListener>);
+ EventListener* onfocus() const;
+ void setOnfocus(PassRefPtr<EventListener>);
+ EventListener* onkeydown() const;
+ void setOnkeydown(PassRefPtr<EventListener>);
+ EventListener* onkeypress() const;
+ void setOnkeypress(PassRefPtr<EventListener>);
+ EventListener* onkeyup() const;
+ void setOnkeyup(PassRefPtr<EventListener>);
+ EventListener* onload() const;
+ void setOnload(PassRefPtr<EventListener>);
+ EventListener* onmousedown() const;
+ void setOnmousedown(PassRefPtr<EventListener>);
+ EventListener* onmousemove() const;
+ void setOnmousemove(PassRefPtr<EventListener>);
+ EventListener* onmouseout() const;
+ void setOnmouseout(PassRefPtr<EventListener>);
+ EventListener* onmouseover() const;
+ void setOnmouseover(PassRefPtr<EventListener>);
+ EventListener* onmouseup() const;
+ void setOnmouseup(PassRefPtr<EventListener>);
+ EventListener* onmousewheel() const;
+ void setOnmousewheel(PassRefPtr<EventListener>);
+ EventListener* onreset() const;
+ void setOnreset(PassRefPtr<EventListener>);
+ EventListener* onresize() const;
+ void setOnresize(PassRefPtr<EventListener>);
+ EventListener* onscroll() const;
+ void setOnscroll(PassRefPtr<EventListener>);
+ EventListener* onsearch() const;
+ void setOnsearch(PassRefPtr<EventListener>);
+ EventListener* onselect() const;
+ void setOnselect(PassRefPtr<EventListener>);
+ EventListener* onsubmit() const;
+ void setOnsubmit(PassRefPtr<EventListener>);
+ EventListener* onunload() const;
+ void setOnunload(PassRefPtr<EventListener>);
+ EventListener* onbeforeunload() const;
+ void setOnbeforeunload(PassRefPtr<EventListener>);
+ EventListener* onwebkitanimationstart() const;
+ void setOnwebkitanimationstart(PassRefPtr<EventListener>);
+ EventListener* onwebkitanimationiteration() const;
+ void setOnwebkitanimationiteration(PassRefPtr<EventListener>);
+ EventListener* onwebkitanimationend() const;
+ void setOnwebkitanimationend(PassRefPtr<EventListener>);
+ EventListener* onwebkittransitionend() const;
+ void setOnwebkittransitionend(PassRefPtr<EventListener>);
+ EventListener* onorientationchange() const;
+ void setOnorientationchange(PassRefPtr<EventListener>);
+#if ENABLE(TOUCH_EVENTS)
+ EventListener* ontouchstart() const;
+ void setOntouchstart(PassRefPtr<EventListener>);
+ EventListener* ontouchmove() const;
+ void setOntouchmove(PassRefPtr<EventListener>);
+ EventListener* ontouchend() const;
+ void setOntouchend(PassRefPtr<EventListener>);
+ EventListener* ontouchcancel() const;
+ void setOntouchcancel(PassRefPtr<EventListener>);
+ EventListener* ongesturestart() const;
+ void setOngesturestart(PassRefPtr<EventListener>);
+ EventListener* ongesturechange() const;
+ void setOngesturechange(PassRefPtr<EventListener>);
+ EventListener* ongestureend() const;
+ void setOngestureend(PassRefPtr<EventListener>);
+#endif
+
+ // These methods are used for GC marking. See JSDOMWindow::mark() in
+ // JSDOMWindowCustom.cpp.
+ Screen* optionalScreen() const { return m_screen.get(); }
+ DOMSelection* optionalSelection() const { return m_selection.get(); }
+ History* optionalHistory() const { return m_history.get(); }
+ BarInfo* optionalLocationbar() const { return m_locationbar.get(); }
+ BarInfo* optionalMenubar() const { return m_menubar.get(); }
+ BarInfo* optionalPersonalbar() const { return m_personalbar.get(); }
+ BarInfo* optionalScrollbars() const { return m_scrollbars.get(); }
+ BarInfo* optionalStatusbar() const { return m_statusbar.get(); }
+ BarInfo* optionalToolbar() const { return m_toolbar.get(); }
+ Console* optionalConsole() const { return m_console.get(); }
+ Navigator* optionalNavigator() const { return m_navigator.get(); }
+ Location* optionalLocation() const { return m_location.get(); }
+#if ENABLE(DOM_STORAGE)
+ Storage* optionalSessionStorage() const { return m_sessionStorage.get(); }
+ Storage* optionalLocalStorage() const { return m_localStorage.get(); }
+#endif
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+ DOMApplicationCache* optionalApplicationCache() const { return m_applicationCache.get(); }
+#endif
+
+ private:
+ DOMWindow(Frame*);
+
+ void setInlineEventListenerForType(const AtomicString& eventType, PassRefPtr<EventListener>);
+ EventListener* inlineEventListenerForType(const AtomicString& eventType) const;
+
+ RefPtr<SecurityOrigin> m_securityOrigin;
+ KURL m_url;
+
+ Frame* m_frame;
+ mutable RefPtr<Screen> m_screen;
+ mutable RefPtr<DOMSelection> m_selection;
+ mutable RefPtr<History> m_history;
+ mutable RefPtr<BarInfo> m_locationbar;
+ mutable RefPtr<BarInfo> m_menubar;
+ mutable RefPtr<BarInfo> m_personalbar;
+ mutable RefPtr<BarInfo> m_scrollbars;
+ mutable RefPtr<BarInfo> m_statusbar;
+ mutable RefPtr<BarInfo> m_toolbar;
+ mutable RefPtr<Console> m_console;
+ mutable RefPtr<Navigator> m_navigator;
+ mutable RefPtr<Location> m_location;
+#if ENABLE(DOM_STORAGE)
+ mutable RefPtr<Storage> m_sessionStorage;
+ mutable RefPtr<Storage> m_localStorage;
+#endif
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+ mutable RefPtr<DOMApplicationCache> m_applicationCache;
+#endif
+ };
+
+} // namespace WebCore
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebCore/DOMCore.h>
+#import <WebCore/DOMDocument.h>
+#import <WebCore/DOMObject.h>
+
+#import <WebCore/DOMXPathException.h>
+#import <WebCore/DOMXPathExpression.h>
+#import <WebCore/DOMXPathNSResolver.h>
+#import <WebCore/DOMXPathResult.h>
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <JavaScriptCore/WebKitAvailability.h>
+
+#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_3_0
+
+@class NSString;
+
+extern NSString * const DOMXPathException;
+
+enum DOMXPathExceptionCode {
+ DOM_INVALID_EXPRESSION_ERR = 51,
+ DOM_TYPE_ERR = 52
+};
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Dirk Schulze <vbs85@gmx.de>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DashArray_h
+#define DashArray_h
+
+#include <wtf/Vector.h>
+
+#if PLATFORM(CG)
+typedef Vector<CGFloat> DashArray;
+#elif PLATFORM(CAIRO)
+typedef Vector<double> DashArray;
+#else
+typedef Vector<float> DashArray;
+#endif
+
+#endif // DashArray_h
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef DashboardRegion_h
+#define DashboardRegion_h
+
+#include "Rect.h"
+
+#if ENABLE(DASHBOARD_SUPPORT)
+
+namespace WebCore {
+
+class DashboardRegion : public RectBase, public RefCounted<DashboardRegion> {
+public:
+ static PassRefPtr<DashboardRegion> create() { return adoptRef(new DashboardRegion); }
+
+ RefPtr<DashboardRegion> m_next;
+ String m_label;
+ String m_geometryType;
+ bool m_isCircle : 1;
+ bool m_isRectangle : 1;
+
+private:
+ DashboardRegion() : m_isCircle(false), m_isRectangle(false) { }
+};
+
+} // namespace
+
+#endif
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef DataRef_h
+#define DataRef_h
+
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+template <typename T> class DataRef {
+public:
+ const T* get() const { return m_data.get(); }
+
+ const T& operator*() const { return *get(); }
+ const T* operator->() const { return get(); }
+
+ T* access()
+ {
+ if (!m_data->hasOneRef())
+ m_data = m_data->copy();
+ return m_data.get();
+ }
+
+ void init()
+ {
+ ASSERT(!m_data);
+ m_data = T::create();
+ }
+
+ bool operator==(const DataRef<T>& o) const
+ {
+ ASSERT(m_data);
+ ASSERT(o.m_data);
+ return m_data == o.m_data || *m_data == *o.m_data;
+ }
+
+ bool operator!=(const DataRef<T>& o) const
+ {
+ ASSERT(m_data);
+ ASSERT(o.m_data);
+ return m_data != o.m_data && *m_data != *o.m_data;
+ }
+
+private:
+ RefPtr<T> m_data;
+};
+
+} // namespace WebCore
+
+#endif // DataRef_h
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DeleteButton_h
+#define DeleteButton_h
+
+#include "HTMLImageElement.h"
+
+namespace WebCore {
+
+class DeleteButton : public HTMLImageElement {
+public:
+ DeleteButton(Document*);
+
+ virtual void defaultEventHandler(Event*);
+};
+
+} // namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DeleteButtonController_h
+#define DeleteButtonController_h
+
+#include "DeleteButton.h"
+
+namespace WebCore {
+
+class DeleteButton;
+class Frame;
+class HTMLElement;
+class RenderObject;
+class Selection;
+
+class DeleteButtonController {
+public:
+ DeleteButtonController(Frame*);
+
+ static const char* const containerElementIdentifier;
+
+ HTMLElement* target() const { return m_target.get(); }
+ HTMLElement* containerElement() const { return m_containerElement.get(); }
+
+ void respondToChangedSelection(const Selection& oldSelection);
+
+ void show(HTMLElement*);
+ void hide();
+
+ bool enabled() const { return (m_disableStack == 0); }
+ void enable();
+ void disable();
+
+ void deleteTarget();
+
+private:
+ static const char* const buttonElementIdentifier;
+ static const char* const outlineElementIdentifier;
+
+ void createDeletionUI();
+
+ Frame* m_frame;
+ RefPtr<HTMLElement> m_target;
+ RefPtr<HTMLElement> m_containerElement;
+ RefPtr<HTMLElement> m_outlineElement;
+ RefPtr<DeleteButton> m_buttonElement;
+ bool m_wasStaticPositioned;
+ bool m_wasAutoZIndex;
+ unsigned m_disableStack;
+};
+
+} // namespace WebCore
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DeleteFromTextNodeCommand_h
+#define DeleteFromTextNodeCommand_h
+
+#include "EditCommand.h"
+
+namespace WebCore {
+
+class Text;
+
+class DeleteFromTextNodeCommand : public SimpleEditCommand {
+public:
+ static PassRefPtr<DeleteFromTextNodeCommand> create(PassRefPtr<Text> node, unsigned offset, unsigned count)
+ {
+ return adoptRef(new DeleteFromTextNodeCommand(node, offset, count));
+ }
+
+private:
+ DeleteFromTextNodeCommand(PassRefPtr<Text>, unsigned offset, unsigned count);
+
+ virtual void doApply();
+ virtual void doUnapply();
+
+ RefPtr<Text> m_node;
+ unsigned m_offset;
+ unsigned m_count;
+ String m_text;
+};
+
+} // namespace WebCore
+
+#endif // DeleteFromTextNodeCommand_h
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DeleteSelectionCommand_h
+#define DeleteSelectionCommand_h
+
+#include "CompositeEditCommand.h"
+
+namespace WebCore {
+
+class DeleteSelectionCommand : public CompositeEditCommand {
+public:
+ static PassRefPtr<DeleteSelectionCommand> create(Document* document, bool smartDelete = false, bool mergeBlocksAfterDelete = true, bool replace = false, bool expandForSpecialElements = false)
+ {
+ return adoptRef(new DeleteSelectionCommand(document, smartDelete, mergeBlocksAfterDelete, replace, expandForSpecialElements));
+ }
+ static PassRefPtr<DeleteSelectionCommand> create(const Selection& selection, bool smartDelete = false, bool mergeBlocksAfterDelete = true, bool replace = false, bool expandForSpecialElements = false)
+ {
+ return adoptRef(new DeleteSelectionCommand(selection, smartDelete, mergeBlocksAfterDelete, replace, expandForSpecialElements));
+ }
+
+protected:
+ DeleteSelectionCommand(Document*, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements);
+
+private:
+ DeleteSelectionCommand(const Selection&, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements);
+
+ virtual void doApply();
+ virtual EditAction editingAction() const;
+
+ virtual bool preservesTypingStyle() const;
+
+ void initializeStartEnd(Position&, Position&);
+ void initializePositionData();
+ void saveTypingStyleState();
+ void insertPlaceholderForAncestorBlockContent();
+ bool handleSpecialCaseBRDelete();
+ void handleGeneralDelete();
+ void fixupWhitespace();
+ void mergeParagraphs();
+ void removePreviouslySelectedEmptyTableRows();
+ void calculateEndingPosition();
+ void calculateTypingStyleAfterDelete();
+ void clearTransientState();
+ virtual void removeNode(PassRefPtr<Node>);
+ virtual void deleteTextFromNode(PassRefPtr<Text>, unsigned, unsigned);
+
+ bool m_hasSelectionToDelete;
+ bool m_smartDelete;
+ bool m_mergeBlocksAfterDelete;
+ bool m_needPlaceholder;
+ bool m_replace;
+ bool m_expandForSpecialElements;
+ bool m_pruneStartBlockIfNecessary;
+
+ // This data is transient and should be cleared at the end of the doApply function.
+ Selection m_selectionToDelete;
+ Position m_upstreamStart;
+ Position m_downstreamStart;
+ Position m_upstreamEnd;
+ Position m_downstreamEnd;
+ Position m_endingPosition;
+ Position m_leadingWhitespace;
+ Position m_trailingWhitespace;
+ RefPtr<Node> m_startBlock;
+ RefPtr<Node> m_endBlock;
+ RefPtr<CSSMutableStyleDeclaration> m_typingStyle;
+ RefPtr<CSSMutableStyleDeclaration> m_deleteIntoBlockquoteStyle;
+ RefPtr<Node> m_startRoot;
+ RefPtr<Node> m_endRoot;
+ RefPtr<Node> m_startTableRow;
+ RefPtr<Node> m_endTableRow;
+};
+
+} // namespace WebCore
+
+#endif // DeleteSelectionCommand_h
--- /dev/null
+/*
+ * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DeprecatedPtrList_h
+#define DeprecatedPtrList_h
+
+#include "DeprecatedPtrListImpl.h"
+
+namespace WebCore {
+
+template <class T> class DeprecatedPtrListIterator;
+
+template <class T> class DeprecatedPtrList {
+public:
+ DeprecatedPtrList() : impl(deleteFunc), del_item(false) { }
+ ~DeprecatedPtrList() { impl.clear(del_item); }
+
+ DeprecatedPtrList(const DeprecatedPtrList& l) : impl(l.impl), del_item(false) { }
+ DeprecatedPtrList& operator=(const DeprecatedPtrList &l) { impl.assign(l.impl, del_item); return *this; }
+
+ bool isEmpty() const { return impl.isEmpty(); }
+ unsigned count() const { return impl.count(); }
+ void clear() { impl.clear(del_item); }
+
+ T *at(unsigned n) { return (T *)impl.at(n); }
+
+ bool insert(unsigned n, const T *item) { return impl.insert(n, item); }
+ bool remove() { return impl.remove(del_item); }
+ bool remove(unsigned n) { return impl.remove(n, del_item); }
+ bool remove(const T *item) { return impl.removeRef(item, del_item); }
+ bool removeFirst() { return impl.removeFirst(del_item); }
+ bool removeLast() { return impl.removeLast(del_item); }
+ bool removeRef(const T *item) { return impl.removeRef(item, del_item); }
+
+ T *getFirst() const { return (T *)impl.getFirst(); }
+ T *getLast() const { return (T *)impl.getLast(); }
+ T *getNext() const { return (T *)impl.getNext(); }
+ T *getPrev() const { return (T *)impl.getPrev(); }
+ T *current() const { return (T *)impl.current(); }
+ T *first() { return (T *)impl.first(); }
+ T *last() { return (T *)impl.last(); }
+ T *next() { return (T *)impl.next(); }
+ T *prev() { return (T *)impl.prev(); }
+ T *take(unsigned n) { return (T *)impl.take(n); }
+ T *take() { return (T *)impl.take(); }
+
+ void append(const T *item) { impl.append(item); }
+ void prepend(const T *item) { impl.prepend(item); }
+
+ unsigned containsRef(const T *item) const { return impl.containsRef(item); }
+ int findRef(const T *item) { return impl.findRef(item); }
+
+ typedef DeprecatedPtrListIterator<T> Iterator;
+ typedef DeprecatedPtrListIterator<T> ConstIterator;
+ ConstIterator begin() const { return ConstIterator(*this); }
+ ConstIterator end() const { ConstIterator itr(*this); itr.toLast(); ++itr; return itr; }
+
+ bool autoDelete() const { return del_item; }
+ void setAutoDelete(bool autoDelete) { del_item = autoDelete; }
+
+ private:
+ static void deleteFunc(void *item) { delete (T *)item; }
+
+ friend class DeprecatedPtrListIterator<T>;
+
+ DeprecatedPtrListImpl impl;
+ bool del_item;
+};
+
+template <class T> class DeprecatedPtrListIterator {
+public:
+ DeprecatedPtrListIterator() { }
+ DeprecatedPtrListIterator(const DeprecatedPtrList<T> &l) : impl(l.impl) { }
+
+ unsigned count() const { return impl.count(); }
+ T *toFirst() { return (T *)impl.toFirst(); }
+ T *toLast() { return (T *)impl.toLast(); }
+ T *current() const { return (T *)impl.current(); }
+
+ operator T *() const { return (T *)impl.current(); }
+ T *operator*() const { return (T *)impl.current(); }
+ T *operator--() { return (T *)--impl; }
+ T *operator++() { return (T *)++impl; }
+
+private:
+ DeprecatedPtrListImplIterator impl;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DeprecatedPtrListImpl_h
+#define DeprecatedPtrListImpl_h
+
+namespace WebCore {
+
+class DeprecatedListNode;
+class DeprecatedPtrListImplIterator;
+
+class DeprecatedPtrListImpl
+{
+public:
+
+ DeprecatedPtrListImpl(void (*deleteFunc)(void *));
+ DeprecatedPtrListImpl(const DeprecatedPtrListImpl &impl);
+ ~DeprecatedPtrListImpl();
+
+ bool isEmpty() const { return nodeCount == 0; }
+ unsigned count() const { return nodeCount; }
+ void clear(bool deleteItems);
+
+ void *at(unsigned n);
+
+ bool insert(unsigned n, const void *item);
+ bool remove(bool deleteItem);
+ bool remove(unsigned n, bool deleteItem);
+ bool removeFirst(bool deleteItem);
+ bool removeLast(bool deleteItem);
+ bool removeRef(const void *item, bool deleteItem);
+
+ void *getFirst() const;
+ void *getLast() const;
+ void *getNext() const;
+ void *getPrev() const;
+ void *current() const;
+ void *first();
+ void *last();
+ void *next();
+ void *prev();
+ void *take(unsigned n);
+ void *take();
+
+ void append(const void *item);
+ void prepend(const void *item);
+
+ unsigned containsRef(const void *item) const;
+ int findRef(const void *item);
+
+ DeprecatedPtrListImpl &assign(const DeprecatedPtrListImpl &impl, bool deleteItems);
+
+ private:
+ DeprecatedPtrListImpl &operator =(const DeprecatedPtrListImpl &impl);
+
+ void swap(DeprecatedPtrListImpl &impl);
+
+ void addIterator(DeprecatedPtrListImplIterator *iter) const;
+ void removeIterator(DeprecatedPtrListImplIterator *iter) const;
+
+ DeprecatedListNode *head;
+ DeprecatedListNode *tail;
+ DeprecatedListNode *cur;
+ unsigned nodeCount;
+ void (*deleteItem)(void *);
+ mutable DeprecatedPtrListImplIterator *iterators;
+
+ friend class DeprecatedPtrListImplIterator;
+};
+
+
+class DeprecatedPtrListImplIterator {
+public:
+ DeprecatedPtrListImplIterator();
+ DeprecatedPtrListImplIterator(const DeprecatedPtrListImpl &impl);
+ ~DeprecatedPtrListImplIterator();
+
+ DeprecatedPtrListImplIterator(const DeprecatedPtrListImplIterator &impl);
+ DeprecatedPtrListImplIterator &operator=(const DeprecatedPtrListImplIterator &impl);
+
+ unsigned count() const;
+ void *toFirst();
+ void *toLast();
+ void *current() const;
+
+ void *operator--();
+ void *operator++();
+
+private:
+ const DeprecatedPtrListImpl *list;
+ DeprecatedListNode *node;
+ DeprecatedPtrListImplIterator *next;
+ DeprecatedPtrListImplIterator *prev;
+
+ friend class DeprecatedPtrListImpl;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
+ Copyright (C) 2001 Dirk Mueller <mueller@kde.org>
+ Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+ This class provides all functionality needed for loading images, style sheets and html
+ pages from the web. It has a memory cache for these objects.
+*/
+
+#ifndef DocLoader_h
+#define DocLoader_h
+
+#include "CachedResource.h"
+#include "CachedResourceHandle.h"
+#include "CachePolicy.h"
+#include "StringHash.h"
+#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
+#include <wtf/ListHashSet.h>
+
+namespace WebCore {
+
+class CachedCSSStyleSheet;
+class CachedFont;
+class CachedImage;
+class CachedScript;
+class CachedXSLStyleSheet;
+class Document;
+class Frame;
+class ImageLoader;
+class KURL;
+
+// The DocLoader manages the loading of scripts/images/stylesheets for a single document.
+class DocLoader
+{
+friend class Cache;
+friend class ImageLoader;
+
+public:
+ DocLoader(Document*);
+ ~DocLoader();
+
+ CachedImage* requestImage(const String& url);
+ CachedCSSStyleSheet* requestCSSStyleSheet(const String& url, const String& charset);
+ CachedCSSStyleSheet* requestUserCSSStyleSheet(const String& url, const String& charset);
+ CachedScript* requestScript(const String& url, const String& charset);
+ CachedFont* requestFont(const String& url);
+
+#if ENABLE(XSLT)
+ CachedXSLStyleSheet* requestXSLStyleSheet(const String& url);
+#endif
+#if ENABLE(XBL)
+ CachedXBLDocument* requestXBLDocument(const String &url);
+#endif
+
+ // Logs an access denied message to the console for the specified URL.
+ void printAccessDeniedMessage(const KURL& url) const;
+
+ CachedResource* cachedResource(const String& url) const { return m_documentResources.get(url).get(); }
+
+ typedef HashMap<String, CachedResourceHandle<CachedResource> > DocumentResourceMap;
+ const DocumentResourceMap& allCachedResources() const { return m_documentResources; }
+
+ bool autoLoadImages() const { return m_autoLoadImages; }
+ void setAutoLoadImages(bool);
+
+ CachePolicy cachePolicy() const;
+
+ Frame* frame() const; // Can be NULL
+ Document* doc() const { return m_doc; }
+
+ void removeCachedResource(CachedResource*) const;
+
+ void setLoadInProgress(bool);
+ bool loadInProgress() const { return m_loadInProgress; }
+
+ void setAllowStaleResources(bool allowStaleResources) { m_allowStaleResources = allowStaleResources; }
+
+#if USE(LOW_BANDWIDTH_DISPLAY)
+ void replaceDocument(Document* doc) { m_doc = doc; }
+#endif
+
+ void incrementRequestCount();
+ void decrementRequestCount();
+ int requestCount();
+
+ void clearPreloads();
+ void preload(CachedResource::Type, const String& url, const String& charset, bool referencedFromBody);
+ void checkForPendingPreloads();
+ void printPreloadStats();
+
+private:
+ CachedResource* requestResource(CachedResource::Type, const String& url, const String& charset, bool isPreload = false);
+ void requestPreload(CachedResource::Type, const String& url, const String& charset);
+
+ void checkForReload(const KURL&);
+ void checkCacheObjectStatus(CachedResource*);
+ bool canRequest(CachedResource::Type, const KURL&);
+
+ Cache* m_cache;
+ HashSet<String> m_reloadedURLs;
+ mutable DocumentResourceMap m_documentResources;
+ Document* m_doc;
+
+ int m_requestCount;
+
+ ListHashSet<CachedResource*> m_preloads;
+ struct PendingPreload {
+ CachedResource::Type m_type;
+ String m_url;
+ String m_charset;
+ };
+ Vector<PendingPreload> m_pendingPreloads;
+
+ //29 bits left
+ bool m_autoLoadImages : 1;
+ bool m_loadInProgress : 1;
+ bool m_allowStaleResources : 1;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ * Copyright (C) 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef DocPtr_h
+#define DocPtr_h
+
+namespace WebCore {
+
+template <class T> class DocPtr {
+public:
+ DocPtr() : m_ptr(0) {}
+ DocPtr(T *ptr) : m_ptr(ptr) { if (ptr) ptr->selfOnlyRef(); }
+ DocPtr(const DocPtr &o) : m_ptr(o.m_ptr) { if (T *ptr = m_ptr) ptr->selfOnlyRef(); }
+ ~DocPtr() { if (T *ptr = m_ptr) ptr->selfOnlyDeref(); }
+
+ template <class U> DocPtr(const DocPtr<U> &o) : m_ptr(o.get()) { if (T *ptr = m_ptr) ptr->selfOnlyRef(); }
+
+ void resetSkippingRef(T *o) { m_ptr = o; }
+
+ T *get() const { return m_ptr; }
+
+ T &operator*() const { return *m_ptr; }
+ T *operator->() const { return m_ptr; }
+
+ bool operator!() const { return !m_ptr; }
+
+ // this type conversion operator allows implicit conversion to
+ // bool but not to other integer types
+
+ typedef T * (DocPtr::*UnspecifiedBoolType)() const;
+ operator UnspecifiedBoolType() const
+ {
+ return m_ptr ? &DocPtr::get : 0;
+ }
+
+ DocPtr &operator=(const DocPtr &);
+ DocPtr &operator=(T *);
+
+ private:
+ T *m_ptr;
+};
+
+template <class T> DocPtr<T> &DocPtr<T>::operator=(const DocPtr<T> &o)
+{
+ T *optr = o.m_ptr;
+ if (optr)
+ optr->selfOnlyRef();
+ if (T *ptr = m_ptr)
+ ptr->selfOnlyDeref();
+ m_ptr = optr;
+ return *this;
+}
+
+template <class T> inline DocPtr<T> &DocPtr<T>::operator=(T *optr)
+{
+ if (optr)
+ optr->selfOnlyRef();
+ if (T *ptr = m_ptr)
+ ptr->selfOnlyDeref();
+ m_ptr = optr;
+ return *this;
+}
+
+template <class T> inline bool operator==(const DocPtr<T> &a, const DocPtr<T> &b)
+{
+ return a.get() == b.get();
+}
+
+template <class T> inline bool operator==(const DocPtr<T> &a, const T *b)
+{
+ return a.get() == b;
+}
+
+template <class T> inline bool operator==(const T *a, const DocPtr<T> &b)
+{
+ return a == b.get();
+}
+
+template <class T> inline bool operator!=(const DocPtr<T> &a, const DocPtr<T> &b)
+{
+ return a.get() != b.get();
+}
+
+template <class T> inline bool operator!=(const DocPtr<T> &a, const T *b)
+{
+ return a.get() != b;
+}
+
+template <class T> inline bool operator!=(const T *a, const DocPtr<T> &b)
+{
+ return a != b.get();
+}
+
+} // namespace WebCore
+
+#endif // DocPtr_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Document_h
+#define Document_h
+
+#include "Attr.h"
+#include "Color.h"
+#include "DocumentMarker.h"
+#include "HTMLCollection.h"
+#include "HTMLFormElement.h"
+#include "ScriptExecutionContext.h"
+#include "StringHash.h"
+#include "TextResourceDecoder.h"
+#include "Timer.h"
+#include <wtf/HashCountedSet.h>
+#include <wtf/ListHashSet.h>
+
+#include "RenderStyle.h"
+
+// FIXME: We should move Mac off of the old Frame-based user stylesheet loading
+// code and onto the new code in Page. We can't do that until the code in Page
+// supports non-file: URLs, however.
+#if PLATFORM(MAC) || PLATFORM(QT)
+#define FRAME_LOADS_USER_STYLESHEET 1
+#else
+#define FRAME_LOADS_USER_STYLESHEET 0
+#endif
+
+namespace WebCore {
+
+ class AXObjectCache;
+ class Attr;
+ class Attribute;
+ class CDATASection;
+ class CachedCSSStyleSheet;
+ class CanvasRenderingContext2D;
+ class CharacterData;
+ class CSSStyleDeclaration;
+ class CSSStyleSelector;
+ class CSSStyleSheet;
+ class Comment;
+ class Database;
+ class DOMImplementation;
+ class DOMSelection;
+ class DOMTimer;
+ class DOMWindow;
+ class DatabaseThread;
+ class DocLoader;
+ class DocumentFragment;
+ class DocumentType;
+ class EditingText;
+ class Element;
+ class EntityReference;
+ class Event;
+ class EventListener;
+ class FormControlElementWithState;
+ class Frame;
+ class FrameView;
+ class HTMLCanvasElement;
+ class HTMLDocument;
+ class HTMLElement;
+ class HTMLFormElement;
+ class HTMLHeadElement;
+ class HTMLInputElement;
+ class HTMLMapElement;
+ class ImageLoader;
+ class IntPoint;
+ class JSNode;
+ class MouseEventWithHitTestResults;
+ class NodeFilter;
+ class NodeIterator;
+ class Page;
+ class PlatformMouseEvent;
+ class ProcessingInstruction;
+ class Range;
+ class RegisteredEventListener;
+ class RenderArena;
+ class RenderView;
+ class SecurityOrigin;
+ class Settings;
+ class StyleSheet;
+ class StyleSheetList;
+ class Text;
+ class TextResourceDecoder;
+ class Tokenizer;
+ class TreeWalker;
+ class XMLHttpRequest;
+
+#if ENABLE(SVG)
+ class SVGDocumentExtensions;
+#endif
+
+#if ENABLE(XBL)
+ class XBLBindingManager;
+#endif
+
+#if ENABLE(XPATH)
+ class XPathEvaluator;
+ class XPathExpression;
+ class XPathNSResolver;
+ class XPathResult;
+#endif
+
+#if ENABLE(DASHBOARD_SUPPORT)
+ struct DashboardRegionValue;
+#endif
+ struct HitTestRequest;
+
+#if ENABLE(TOUCH_EVENTS)
+#include "DocumentIPhoneForward.h"
+#endif
+
+ typedef int ExceptionCode;
+
+ class CachedImage;
+ extern const int cLayoutScheduleThreshold;
+
+class FormElementKey {
+public:
+ FormElementKey(AtomicStringImpl* = 0, AtomicStringImpl* = 0);
+ ~FormElementKey();
+ FormElementKey(const FormElementKey&);
+ FormElementKey& operator=(const FormElementKey&);
+
+ AtomicStringImpl* name() const { return m_name; }
+ AtomicStringImpl* type() const { return m_type; }
+
+ // Hash table deleted values, which are only constructed and never copied or destroyed.
+ FormElementKey(WTF::HashTableDeletedValueType) : m_name(hashTableDeletedValue()) { }
+ bool isHashTableDeletedValue() const { return m_name == hashTableDeletedValue(); }
+
+private:
+ void ref() const;
+ void deref() const;
+
+ static AtomicStringImpl* hashTableDeletedValue() { return reinterpret_cast<AtomicStringImpl*>(-1); }
+
+ AtomicStringImpl* m_name;
+ AtomicStringImpl* m_type;
+};
+
+inline bool operator==(const FormElementKey& a, const FormElementKey& b)
+{
+ return a.name() == b.name() && a.type() == b.type();
+}
+
+struct FormElementKeyHash {
+ static unsigned hash(const FormElementKey&);
+ static bool equal(const FormElementKey& a, const FormElementKey& b) { return a == b; }
+ static const bool safeToCompareToEmptyOrDeleted = true;
+};
+
+struct FormElementKeyHashTraits : WTF::GenericHashTraits<FormElementKey> {
+ static void constructDeletedValue(FormElementKey& slot) { new (&slot) FormElementKey(WTF::HashTableDeletedValue); }
+ static bool isDeletedValue(const FormElementKey& value) { return value.isHashTableDeletedValue(); }
+};
+
+class TextAutoSizingKey {
+public:
+ TextAutoSizingKey();
+ TextAutoSizingKey(RenderStyle*, Document*);
+ ~TextAutoSizingKey();
+ TextAutoSizingKey(const TextAutoSizingKey&);
+ TextAutoSizingKey& operator=(const TextAutoSizingKey&);
+ Document* doc() const { return m_doc; }
+ RenderStyle* style() const { return m_style; }
+ inline bool isValidDoc() const { return m_doc && m_doc != deletedKeyDoc(); }
+ inline bool isValidStyle() const { return m_style && m_style != deletedKeyStyle(); }
+ static Document* deletedKeyDoc() { return (Document*) -1; }
+ static RenderStyle* deletedKeyStyle() { return (RenderStyle*) -1; }
+private:
+ void ref() const;
+ void deref() const;
+ RenderStyle *m_style;
+ Document *m_doc;
+};
+
+inline bool operator==(const TextAutoSizingKey& a, const TextAutoSizingKey& b)
+{
+ if (a.isValidStyle() && b.isValidStyle())
+ return a.style()->equalForTextAutosizing(b.style());
+ return a.style() == b.style();
+}
+
+struct TextAutoSizingHash {
+ static unsigned hash(const TextAutoSizingKey&k) { return k.style()->hashForTextAutosizing(); }
+ static bool equal(const TextAutoSizingKey& a, const TextAutoSizingKey& b) { return a == b; }
+ static const bool safeToCompareToEmptyOrDeleted = true;
+};
+
+struct TextAutoSizingTraits : WTF::GenericHashTraits<TextAutoSizingKey> {
+ static const bool emptyValueIsZero = true;
+ static void constructDeletedValue(TextAutoSizingKey& slot);
+ static bool isDeletedValue(const TextAutoSizingKey& value);
+};
+
+class TextAutoSizingValue : public RefCounted<TextAutoSizingValue>{
+public:
+ static PassRefPtr<TextAutoSizingValue> create()
+ {
+ return adoptRef(new TextAutoSizingValue());
+ }
+
+ void addNode(Node *node, float size);
+ bool adjustNodeSizes ();
+ int numNodes () const;
+ void reset();
+
+private:
+ TextAutoSizingValue() { }
+
+ HashSet<RefPtr<Node> > m_autoSizedNodes;
+};
+
+struct ViewportArguments
+{
+ ViewportArguments() :initialScale(-1), minimumScale(-1), maximumScale(-1), width(-1), height(-1), userScalable(-1) { }
+
+ float initialScale;
+ float minimumScale;
+ float maximumScale;
+ float width;
+ float height;
+
+ float userScalable;
+
+ bool hasCustomArgument() const { return initialScale != -1 || minimumScale != -1 || maximumScale != -1 || width != -1 || height != -1 || userScalable != -1; }
+};
+
+class Document : public ContainerNode, public ScriptExecutionContext {
+public:
+ static PassRefPtr<Document> create(Frame* frame)
+ {
+ return new Document(frame, false);
+ }
+ static PassRefPtr<Document> createXHTML(Frame* frame)
+ {
+ return new Document(frame, true);
+ }
+ virtual ~Document();
+
+ virtual bool isDocument() const { return true; }
+
+ using ContainerNode::ref;
+ using ContainerNode::deref;
+ virtual void removedLastRef();
+
+ // Nodes belonging to this document hold "self-only" references -
+ // these are enough to keep the document from being destroyed, but
+ // not enough to keep it from removing its children. This allows a
+ // node that outlives its document to still have a valid document
+ // pointer without introducing reference cycles
+
+ void selfOnlyRef()
+ {
+ ASSERT(!m_deletionHasBegun);
+ ++m_selfOnlyRefCount;
+ }
+ void selfOnlyDeref()
+ {
+ ASSERT(!m_deletionHasBegun);
+ --m_selfOnlyRefCount;
+ if (!m_selfOnlyRefCount && !refCount()) {
+#ifndef NDEBUG
+ m_deletionHasBegun = true;
+#endif
+ delete this;
+ }
+ }
+
+ // DOM methods & attributes for Document
+
+ DocumentType* doctype() const { return m_docType.get(); }
+
+ DOMImplementation* implementation() const;
+ virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
+
+ Element* documentElement() const
+ {
+ if (!m_documentElement)
+ cacheDocumentElement();
+ return m_documentElement.get();
+ }
+
+ virtual PassRefPtr<Element> createElement(const AtomicString& tagName, ExceptionCode&);
+ PassRefPtr<DocumentFragment> createDocumentFragment ();
+ PassRefPtr<Text> createTextNode(const String& data);
+ PassRefPtr<Comment> createComment(const String& data);
+ PassRefPtr<CDATASection> createCDATASection(const String& data, ExceptionCode&);
+ PassRefPtr<ProcessingInstruction> createProcessingInstruction(const String& target, const String& data, ExceptionCode&);
+ PassRefPtr<Attr> createAttribute(const String& name, ExceptionCode& ec) { return createAttributeNS(String(), name, ec, true); }
+ PassRefPtr<Attr> createAttributeNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode&, bool shouldIgnoreNamespaceChecks = false);
+ PassRefPtr<EntityReference> createEntityReference(const String& name, ExceptionCode&);
+ PassRefPtr<Node> importNode(Node* importedNode, bool deep, ExceptionCode&);
+ virtual PassRefPtr<Element> createElementNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode&);
+ PassRefPtr<Element> createElement(const QualifiedName&, bool createdByParser, ExceptionCode& ec);
+ Element* getElementById(const AtomicString&) const;
+ bool hasElementWithId(AtomicStringImpl* id) const;
+ bool containsMultipleElementsWithId(const AtomicString& elementId) { return m_duplicateIds.contains(elementId.impl()); }
+
+ Element* elementFromPoint(int x, int y) const;
+ String readyState() const;
+ String inputEncoding() const;
+ String defaultCharset() const;
+
+ String charset() const { return inputEncoding(); }
+ String characterSet() const { return inputEncoding(); }
+
+ void setCharset(const String&);
+
+ String contentLanguage() const { return m_contentLanguage; }
+ void setContentLanguage(const String& lang) { m_contentLanguage = lang; }
+
+ String xmlEncoding() const { return m_xmlEncoding; }
+ String xmlVersion() const { return m_xmlVersion; }
+ bool xmlStandalone() const { return m_xmlStandalone; }
+
+ void setXMLEncoding(const String& encoding) { m_xmlEncoding = encoding; } // read-only property, only to be set from XMLTokenizer
+ void setXMLVersion(const String&, ExceptionCode&);
+ void setXMLStandalone(bool, ExceptionCode&);
+
+ String documentURI() const { return m_documentURI; }
+ void setDocumentURI(const String&);
+
+ virtual KURL baseURI() const;
+
+ PassRefPtr<Node> adoptNode(PassRefPtr<Node> source, ExceptionCode&);
+
+ PassRefPtr<HTMLCollection> images();
+ PassRefPtr<HTMLCollection> embeds();
+ PassRefPtr<HTMLCollection> plugins(); // an alias for embeds() required for the JS DOM bindings.
+ PassRefPtr<HTMLCollection> applets();
+ PassRefPtr<HTMLCollection> links();
+ PassRefPtr<HTMLCollection> forms();
+ PassRefPtr<HTMLCollection> anchors();
+ PassRefPtr<HTMLCollection> all();
+ PassRefPtr<HTMLCollection> objects();
+ PassRefPtr<HTMLCollection> scripts();
+ PassRefPtr<HTMLCollection> windowNamedItems(const String& name);
+ PassRefPtr<HTMLCollection> documentNamedItems(const String& name);
+
+ // Find first anchor with the given name.
+ // First searches for an element with the given ID, but if that fails, then looks
+ // for an anchor with the given name. ID matching is always case sensitive, but
+ // Anchor name matching is case sensitive in strict mode and not case sensitive in
+ // quirks mode for historical compatibility reasons.
+ Element* findAnchor(const String& name);
+
+ HTMLCollection::CollectionInfo* collectionInfo(HTMLCollection::Type type)
+ {
+ ASSERT(type >= HTMLCollection::FirstUnnamedDocumentCachedType);
+ unsigned index = type - HTMLCollection::FirstUnnamedDocumentCachedType;
+ ASSERT(index < HTMLCollection::NumUnnamedDocumentCachedTypes);
+ return &m_collectionInfo[index];
+ }
+
+ HTMLCollection::CollectionInfo* nameCollectionInfo(HTMLCollection::Type, const AtomicString& name);
+
+ // DOM methods overridden from parent classes
+
+ virtual String nodeName() const;
+ virtual NodeType nodeType() const;
+
+ // Other methods (not part of DOM)
+ virtual bool isHTMLDocument() const { return false; }
+ virtual bool isImageDocument() const { return false; }
+#if ENABLE(SVG)
+ virtual bool isSVGDocument() const { return false; }
+#endif
+ virtual bool isPluginDocument() const { return false; }
+ virtual bool isMediaDocument() const { return false; }
+#if ENABLE(WML)
+ virtual bool isWMLDocument() const { return false; }
+#endif
+
+ CSSStyleSelector* styleSelector() const { return m_styleSelector; }
+
+ Element* getElementByAccessKey(const String& key) const;
+
+ /**
+ * Updates the pending sheet count and then calls updateStyleSelector.
+ */
+ void removePendingSheet();
+
+ /**
+ * This method returns true if all top-level stylesheets have loaded (including
+ * any @imports that they may be loading).
+ */
+ bool haveStylesheetsLoaded() const
+ {
+ return m_pendingStylesheets <= 0 || m_ignorePendingStylesheets
+#if USE(LOW_BANDWIDTH_DISPLAY)
+ || m_inLowBandwidthDisplay
+#endif
+ ;
+ }
+
+ /**
+ * Increments the number of pending sheets. The <link> elements
+ * invoke this to add themselves to the loading list.
+ */
+ void addPendingSheet() { m_pendingStylesheets++; }
+
+ void addStyleSheetCandidateNode(Node*, bool createdByParser);
+ void removeStyleSheetCandidateNode(Node*);
+
+ bool gotoAnchorNeededAfterStylesheetsLoad() { return m_gotoAnchorNeededAfterStylesheetsLoad; }
+ void setGotoAnchorNeededAfterStylesheetsLoad(bool b) { m_gotoAnchorNeededAfterStylesheetsLoad = b; }
+
+ /**
+ * Called when one or more stylesheets in the document may have been added, removed or changed.
+ *
+ * Creates a new style selector and assign it to this document. This is done by iterating through all nodes in
+ * document (or those before <BODY> in a HTML document), searching for stylesheets. Stylesheets can be contained in
+ * <LINK>, <STYLE> or <BODY> elements, as well as processing instructions (XML documents only). A list is
+ * constructed from these which is used to create the a new style selector which collates all of the stylesheets
+ * found and is used to calculate the derived styles for all rendering objects.
+ */
+ void updateStyleSelector();
+
+ void recalcStyleSelector();
+
+ bool usesDescendantRules() const { return m_usesDescendantRules; }
+ void setUsesDescendantRules(bool b) { m_usesDescendantRules = b; }
+ bool usesSiblingRules() const { return m_usesSiblingRules; }
+ void setUsesSiblingRules(bool b) { m_usesSiblingRules = b; }
+ bool usesFirstLineRules() const { return m_usesFirstLineRules; }
+ void setUsesFirstLineRules(bool b) { m_usesFirstLineRules = b; }
+ bool usesFirstLetterRules() const { return m_usesFirstLetterRules; }
+ void setUsesFirstLetterRules(bool b) { m_usesFirstLetterRules = b; }
+ bool usesBeforeAfterRules() const { return m_usesBeforeAfterRules; }
+ void setUsesBeforeAfterRules(bool b) { m_usesBeforeAfterRules = b; }
+
+ // Machinery for saving and restoring state when you leave and then go back to a page.
+ void registerFormElementWithState(FormControlElementWithState* e) { m_formElementsWithState.add(e); }
+ void unregisterFormElementWithState(FormControlElementWithState* e) { m_formElementsWithState.remove(e); }
+ Vector<String> formElementsState() const;
+ unsigned formElementsCharacterCount() const;
+ void addAutoCorrectMarker(const Range *range, const String& word, const String& correction);
+ void setStateForNewFormElements(const Vector<String>&);
+ bool hasStateForNewFormElements() const;
+ bool takeStateForFormElement(AtomicStringImpl* name, AtomicStringImpl* type, String& state);
+
+ FrameView* view() const; // can be NULL
+ Frame* frame() const { return m_frame; } // can be NULL
+ Page* page() const; // can be NULL
+ Settings* settings() const; // can be NULL
+
+ PassRefPtr<Range> createRange();
+
+ PassRefPtr<NodeIterator> createNodeIterator(Node* root, unsigned whatToShow,
+ PassRefPtr<NodeFilter>, bool expandEntityReferences, ExceptionCode&);
+
+ PassRefPtr<TreeWalker> createTreeWalker(Node* root, unsigned whatToShow,
+ PassRefPtr<NodeFilter>, bool expandEntityReferences, ExceptionCode&);
+
+ // Special support for editing
+ PassRefPtr<CSSStyleDeclaration> createCSSStyleDeclaration();
+ PassRefPtr<EditingText> createEditingTextNode(const String&);
+
+ virtual void recalcStyle( StyleChange = NoChange );
+ virtual void updateRendering();
+ void updateLayout();
+ void updateLayoutIgnorePendingStylesheets();
+ static void updateDocumentsRendering();
+ DocLoader* docLoader() { return m_docLoader; }
+
+ virtual void attach();
+ virtual void detach();
+ // Override ScriptExecutionContext methods to do additional work
+ void suspendActiveDOMObjects();
+ void resumeActiveDOMObjects();
+ void stopActiveDOMObjects();
+
+ RenderArena* renderArena() { return m_renderArena; }
+
+ RenderView* renderView() const;
+
+ void clearAXObjectCache();
+ AXObjectCache* axObjectCache() const;
+
+ // to get visually ordered hebrew and arabic pages right
+ void setVisuallyOrdered();
+
+ void open(Document* ownerDocument = 0);
+ void implicitOpen();
+ void close();
+ void implicitClose();
+ void cancelParsing();
+
+ void write(const String& text, Document* ownerDocument = 0);
+ void writeln(const String& text, Document* ownerDocument = 0);
+ void finishParsing();
+ void clear();
+
+ bool wellFormed() const { return m_wellFormed; }
+
+ const KURL& url() const { return m_url; }
+ void setURL(const KURL&);
+
+ const KURL& baseURL() const { return m_baseURL; }
+ // Setting the BaseElementURL will change the baseURL.
+ void setBaseElementURL(const KURL&);
+
+ const String& baseTarget() const { return m_baseTarget; }
+ // Setting the BaseElementTarget will change the baseTarget.
+ void setBaseElementTarget(const String& baseTarget) { m_baseTarget = baseTarget; }
+
+ KURL completeURL(const String&) const;
+
+ // from cachedObjectClient
+ virtual void setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet*);
+
+#if FRAME_LOADS_USER_STYLESHEET
+ void setUserStyleSheet(const String& sheet);
+#endif
+
+ String userStyleSheet() const;
+
+ CSSStyleSheet* elementSheet();
+ CSSStyleSheet* mappedElementSheet();
+ virtual Tokenizer* createTokenizer();
+ Tokenizer* tokenizer() { return m_tokenizer; }
+
+ bool printing() const { return m_printing; }
+ void setPrinting(bool p) { m_printing = p; }
+
+ enum ParseMode { Compat, AlmostStrict, Strict };
+
+private:
+ virtual void determineParseMode() {}
+
+public:
+ void setParseMode(ParseMode m) { m_parseMode = m; }
+ ParseMode parseMode() const { return m_parseMode; }
+
+ bool inCompatMode() const { return m_parseMode == Compat; }
+ bool inAlmostStrictMode() const { return m_parseMode == AlmostStrict; }
+ bool inStrictMode() const { return m_parseMode == Strict; }
+
+ void setParsing(bool);
+ bool parsing() const { return m_bParsing; }
+ int minimumLayoutDelay();
+ bool shouldScheduleLayout();
+ int elapsedTime() const;
+
+ void setTextColor(const Color& color) { m_textColor = color; }
+ Color textColor() const { return m_textColor; }
+
+ const Color& linkColor() const { return m_linkColor; }
+ const Color& visitedLinkColor() const { return m_visitedLinkColor; }
+ const Color& activeLinkColor() const { return m_activeLinkColor; }
+ void setLinkColor(const Color& c) { m_linkColor = c; }
+ void setVisitedLinkColor(const Color& c) { m_visitedLinkColor = c; }
+ void setActiveLinkColor(const Color& c) { m_activeLinkColor = c; }
+ void resetLinkColor();
+ void resetVisitedLinkColor();
+ void resetActiveLinkColor();
+
+ MouseEventWithHitTestResults prepareMouseEvent(const HitTestRequest&, const IntPoint&, const PlatformMouseEvent&);
+
+ virtual bool childTypeAllowed(NodeType);
+ virtual PassRefPtr<Node> cloneNode(bool deep);
+
+ virtual bool canReplaceChild(Node* newChild, Node* oldChild);
+
+ StyleSheetList* styleSheets();
+
+ /* Newly proposed CSS3 mechanism for selecting alternate
+ stylesheets using the DOM. May be subject to change as
+ spec matures. - dwh
+ */
+ String preferredStylesheetSet() const;
+ String selectedStylesheetSet() const;
+ void setSelectedStylesheetSet(const String&);
+
+ bool setFocusedNode(PassRefPtr<Node>);
+ Node* focusedNode() const { return m_focusedNode.get(); }
+
+ // The m_ignoreAutofocus flag specifies whether or not the document has been changed by the user enough
+ // for WebCore to ignore the autofocus attribute on any form controls
+ bool ignoreAutofocus() const { return m_ignoreAutofocus; };
+ void setIgnoreAutofocus(bool shouldIgnore = true) { m_ignoreAutofocus = shouldIgnore; };
+
+ void setHoverNode(PassRefPtr<Node>);
+ Node* hoverNode() const { return m_hoverNode.get(); }
+
+ void setActiveNode(PassRefPtr<Node>);
+ Node* activeNode() const { return m_activeNode.get(); }
+
+ void focusedNodeRemoved();
+ void removeFocusedNodeOfSubtree(Node*, bool amongChildrenOnly = false);
+ void hoveredNodeDetached(Node*);
+ void activeChainNodeDetached(Node*);
+
+ // Updates for :target (CSS3 selector).
+ void setCSSTarget(Node*);
+ Node* getCSSTarget() const;
+
+ void setDocumentChanged(bool);
+
+ void attachNodeIterator(NodeIterator*);
+ void detachNodeIterator(NodeIterator*);
+
+ void attachRange(Range*);
+ void detachRange(Range*);
+
+ void nodeChildrenChanged(ContainerNode*);
+ void nodeWillBeRemoved(Node*);
+
+ void textInserted(Node*, unsigned offset, unsigned length);
+ void textRemoved(Node*, unsigned offset, unsigned length);
+ void textNodesMerged(Text* oldNode, unsigned offset);
+ void textNodeSplit(Text* oldNode);
+
+ DOMWindow* defaultView() const { return domWindow(); }
+ DOMWindow* domWindow() const;
+
+ PassRefPtr<Event> createEvent(const String& eventType, ExceptionCode&);
+
+ // keep track of what types of event listeners are registered, so we don't
+ // dispatch events unnecessarily
+ enum ListenerType {
+ DOMSUBTREEMODIFIED_LISTENER = 0x01,
+ DOMNODEINSERTED_LISTENER = 0x02,
+ DOMNODEREMOVED_LISTENER = 0x04,
+ DOMNODEREMOVEDFROMDOCUMENT_LISTENER = 0x08,
+ DOMNODEINSERTEDINTODOCUMENT_LISTENER = 0x10,
+ DOMATTRMODIFIED_LISTENER = 0x20,
+ DOMCHARACTERDATAMODIFIED_LISTENER = 0x40,
+ OVERFLOWCHANGED_LISTENER = 0x80,
+ ANIMATIONEND_LISTENER = 0x100,
+ ANIMATIONSTART_LISTENER = 0x200,
+ ANIMATIONITERATION_LISTENER = 0x400,
+ TRANSITIONEND_LISTENER = 0x800
+ };
+
+ bool hasListenerType(ListenerType listenerType) const { return (m_listenerTypes & listenerType); }
+ void addListenerType(ListenerType listenerType) { m_listenerTypes = m_listenerTypes | listenerType; }
+ void addListenerTypeIfNeeded(const AtomicString& eventType);
+
+ CSSStyleDeclaration* getOverrideStyle(Element*, const String& pseudoElt);
+
+ void handleWindowEvent(Event*, bool useCapture);
+ void setWindowInlineEventListenerForType(const AtomicString& eventType, PassRefPtr<EventListener>);
+ EventListener* windowInlineEventListenerForType(const AtomicString& eventType);
+ void removeWindowInlineEventListenerForType(const AtomicString& eventType);
+
+ void setWindowInlineEventListenerForTypeAndAttribute(const AtomicString& eventType, Attribute*);
+
+ void addWindowEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture);
+ void removeWindowEventListener(const AtomicString& eventType, EventListener*, bool useCapture);
+ bool hasWindowEventListener(const AtomicString& eventType);
+
+ void addPendingFrameUnloadEventCount();
+ void removePendingFrameUnloadEventCount();
+ void addPendingFrameBeforeUnloadEventCount();
+ void removePendingFrameBeforeUnloadEventCount();
+
+ PassRefPtr<EventListener> createEventListener(const String& functionName, const String& code, Node*);
+
+ /**
+ * Searches through the document, starting from fromNode, for the next selectable element that comes after fromNode.
+ * The order followed is as specified in section 17.11.1 of the HTML4 spec, which is elements with tab indexes
+ * first (from lowest to highest), and then elements without tab indexes (in document order).
+ *
+ * @param fromNode The node from which to start searching. The node after this will be focused. May be null.
+ *
+ * @return The focus node that comes after fromNode
+ *
+ * See http://www.w3.org/TR/html4/interact/forms.html#h-17.11.1
+ */
+ Node* nextFocusableNode(Node* start, KeyboardEvent*);
+
+ /**
+ * Searches through the document, starting from fromNode, for the previous selectable element (that comes _before_)
+ * fromNode. The order followed is as specified in section 17.11.1 of the HTML4 spec, which is elements with tab
+ * indexes first (from lowest to highest), and then elements without tab indexes (in document order).
+ *
+ * @param fromNode The node from which to start searching. The node before this will be focused. May be null.
+ *
+ * @return The focus node that comes before fromNode
+ *
+ * See http://www.w3.org/TR/html4/interact/forms.html#h-17.11.1
+ */
+ Node* previousFocusableNode(Node* start, KeyboardEvent*);
+
+ int nodeAbsIndex(Node*);
+ Node* nodeWithAbsIndex(int absIndex);
+
+ /**
+ * Handles a HTTP header equivalent set by a meta tag using <meta http-equiv="..." content="...">. This is called
+ * when a meta tag is encountered during document parsing, and also when a script dynamically changes or adds a meta
+ * tag. This enables scripts to use meta tags to perform refreshes and set expiry dates in addition to them being
+ * specified in a HTML file.
+ *
+ * @param equiv The http header name (value of the meta tag's "equiv" attribute)
+ * @param content The header value (value of the meta tag's "content" attribute)
+ */
+ void processHttpEquiv(const String& equiv, const String& content);
+ void processArguments(const String & features, void *userData, void (*argumentsCallback)(const String& keyString, const String& valueString, Document * aDocument, void* userData));
+ void processViewport(const String & features);
+ void processFormatDetection(const String & features);
+
+ void dispatchImageLoadEventSoon(ImageLoader*);
+ void dispatchImageLoadEventsNow();
+ void removeImage(ImageLoader*);
+
+ // Returns the owning element in the parent document.
+ // Returns 0 if this is the top level document.
+ Element* ownerElement() const;
+
+ String title() const { return m_title; }
+ void setTitle(const String&, Element* titleElement = 0);
+ void removeTitle(Element* titleElement);
+
+ String cookie() const;
+ void setCookie(const String&);
+
+ String referrer() const;
+
+ String domain() const;
+ void setDomain(const String& newDomain);
+
+ String lastModified() const;
+
+ const KURL& cookieURL() const { return m_cookieURL; }
+
+ const KURL& policyBaseURL() const { return m_policyBaseURL; }
+ void setPolicyBaseURL(const KURL& url) { m_policyBaseURL = url; }
+
+ // The following implements the rule from HTML 4 for what valid names are.
+ // To get this right for all the XML cases, we probably have to improve this or move it
+ // and make it sensitive to the type of document.
+ static bool isValidName(const String&);
+
+ // The following breaks a qualified name into a prefix and a local name.
+ // It also does a validity check, and returns false if the qualified name
+ // is invalid. It also sets ExceptionCode when name is invalid.
+ static bool parseQualifiedName(const String& qualifiedName, String& prefix, String& localName, ExceptionCode&);
+
+ // Checks to make sure prefix and namespace do not conflict (per DOM Core 3)
+ static bool hasPrefixNamespaceMismatch(const QualifiedName&);
+
+ void addElementById(const AtomicString& elementId, Element *element);
+ void removeElementById(const AtomicString& elementId, Element *element);
+
+ void addImageMap(HTMLMapElement*);
+ void removeImageMap(HTMLMapElement*);
+ HTMLMapElement* getImageMap(const String& url) const;
+
+ HTMLElement* body();
+ void setBody(PassRefPtr<HTMLElement>, ExceptionCode&);
+
+ HTMLHeadElement* head();
+
+ bool execCommand(const String& command, bool userInterface = false, const String& value = String());
+ bool queryCommandEnabled(const String& command);
+ bool queryCommandIndeterm(const String& command);
+ bool queryCommandState(const String& command);
+ bool queryCommandSupported(const String& command);
+ String queryCommandValue(const String& command);
+
+ void addMarker(Range*, DocumentMarker::MarkerType, String description = String());
+ void addMarker(Node*, DocumentMarker);
+ void copyMarkers(Node *srcNode, unsigned startOffset, int length, Node *dstNode, int delta, DocumentMarker::MarkerType = DocumentMarker::AllMarkers);
+ void removeMarkers(Range*, DocumentMarker::MarkerType = DocumentMarker::AllMarkers);
+ void removeMarkers(Node*, unsigned startOffset, int length, DocumentMarker::MarkerType = DocumentMarker::AllMarkers);
+ void removeMarkers(DocumentMarker::MarkerType = DocumentMarker::AllMarkers);
+ void removeMarkers(Node*);
+ void repaintMarkers(DocumentMarker::MarkerType = DocumentMarker::AllMarkers);
+ void setRenderedRectForMarker(Node*, DocumentMarker, const IntRect&);
+ void invalidateRenderedRectsForMarkersInRect(const IntRect&);
+ void shiftMarkers(Node*, unsigned startOffset, int delta, DocumentMarker::MarkerType = DocumentMarker::AllMarkers);
+
+ DocumentMarker* markerContainingPoint(const IntPoint&, DocumentMarker::MarkerType = DocumentMarker::AllMarkers);
+ Vector<DocumentMarker> markersForNode(Node*);
+ Vector<IntRect> renderedRectsForMarkers(DocumentMarker::MarkerType = DocumentMarker::AllMarkers);
+
+ // designMode support
+ enum InheritedBool { off = false, on = true, inherit };
+ void setDesignMode(InheritedBool value);
+ InheritedBool getDesignMode() const;
+ bool inDesignMode() const;
+
+ Document* parentDocument() const;
+ Document* topDocument() const;
+
+ int docID() const { return m_docID; }
+
+#if ENABLE(XSLT)
+ void applyXSLTransform(ProcessingInstruction* pi);
+ void setTransformSource(void* doc);
+ const void* transformSource() { return m_transformSource; }
+ PassRefPtr<Document> transformSourceDocument() { return m_transformSourceDocument; }
+ void setTransformSourceDocument(Document* doc) { m_transformSourceDocument = doc; }
+#endif
+
+#if ENABLE(XBL)
+ // XBL methods
+ XBLBindingManager* bindingManager() const { return m_bindingManager; }
+#endif
+
+ void incDOMTreeVersion() { ++m_domtree_version; }
+ unsigned domTreeVersion() const { return m_domtree_version; }
+
+ void setDocType(PassRefPtr<DocumentType>);
+
+ virtual void finishedParsing();
+
+#if ENABLE(XPATH)
+ // XPathEvaluator methods
+ PassRefPtr<XPathExpression> createExpression(const String& expression,
+ XPathNSResolver* resolver,
+ ExceptionCode& ec);
+ PassRefPtr<XPathNSResolver> createNSResolver(Node *nodeResolver);
+ PassRefPtr<XPathResult> evaluate(const String& expression,
+ Node* contextNode,
+ XPathNSResolver* resolver,
+ unsigned short type,
+ XPathResult* result,
+ ExceptionCode& ec);
+#endif // ENABLE(XPATH)
+
+ enum PendingSheetLayout { NoLayoutWithPendingSheets, DidLayoutWithPendingSheets, IgnoreLayoutWithPendingSheets };
+
+ bool didLayoutWithPendingStylesheets() const { return m_pendingSheetLayout == DidLayoutWithPendingSheets; }
+
+ void setHasNodesWithPlaceholderStyle() { m_hasNodesWithPlaceholderStyle = true; }
+
+ const String& iconURL() const { return m_iconURL; }
+ void setIconURL(const String& iconURL, const String& type);
+
+ void setUseSecureKeyboardEntryWhenActive(bool);
+ bool useSecureKeyboardEntryWhenActive() const;
+
+#if USE(LOW_BANDWIDTH_DISPLAY)
+ void setDocLoader(DocLoader* loader) { m_docLoader = loader; }
+ bool inLowBandwidthDisplay() const { return m_inLowBandwidthDisplay; }
+ void setLowBandwidthDisplay(bool lowBandWidth) { m_inLowBandwidthDisplay = lowBandWidth; }
+#endif
+
+ void addNodeListCache() { ++m_numNodeListCaches; }
+ void removeNodeListCache() { ASSERT(m_numNodeListCaches > 0); --m_numNodeListCaches; }
+ bool hasNodeListCaches() const { return m_numNodeListCaches; }
+
+ void updateFocusAppearanceSoon();
+ void cancelFocusAppearanceUpdate();
+
+ // FF method for accessing the selection added for compatability.
+ DOMSelection* getSelection() const;
+
+ // Extension for manipulating canvas drawing contexts for use in CSS
+ CanvasRenderingContext2D* getCSSCanvasContext(const String& type, const String& name, int width, int height);
+ HTMLCanvasElement* getCSSCanvasElement(const String& name);
+
+ bool isDNSPrefetchEnabled() const { return m_isDNSPrefetchEnabled; }
+ void initDNSPrefetch();
+ void parseDNSPrefetchControlHeader(const String&);
+
+ virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL);
+ virtual void addMessage(MessageDestination, MessageSource, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL);
+ virtual void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString);
+ virtual void postTask(PassRefPtr<Task>); // Executes the task on context's thread asynchronously.
+
+ void addTimeout(int timeoutId, DOMTimer*);
+ void removeTimeout(int timeoutId);
+ DOMTimer* findTimeout(int timeoutId);
+
+#if ENABLE(TOUCH_EVENTS)
+#include "DocumentIPhone.h"
+#endif
+
+protected:
+ Document(Frame*, bool isXHTML);
+
+private:
+ virtual void refScriptExecutionContext() { ref(); }
+ virtual void derefScriptExecutionContext() { deref(); }
+
+ virtual const KURL& virtualURL() const; // Same as url(), but needed for ScriptExecutionContext to implement it without a performance loss for direct calls.
+ virtual KURL virtualCompleteURL(const String&) const; // Same as completeURL() for the same reason as above.
+
+ CSSStyleSelector* m_styleSelector;
+ bool m_didCalculateStyleSelector;
+
+ Frame* m_frame;
+ DocLoader* m_docLoader;
+ Tokenizer* m_tokenizer;
+ bool m_wellFormed;
+
+ // Document URLs.
+ KURL m_url; // Document.URL: The URL from which this document was retrieved.
+ KURL m_baseURL; // Node.baseURI: The URL to use when resolving relative URLs.
+ KURL m_baseElementURL; // The URL set by the <base> element.
+ KURL m_cookieURL; // The URL to use for cookie access.
+ KURL m_policyBaseURL; // The policy URL for third-party cookie blocking.
+
+ // Document.documentURI:
+ // Although URL-like, Document.documentURI can actually be set to any
+ // string by content. Document.documentURI affects m_baseURL unless the
+ // document contains a <base> element, in which case the <base> element
+ // takes precedence.
+ String m_documentURI;
+
+ String m_baseTarget;
+
+ RefPtr<DocumentType> m_docType;
+ mutable RefPtr<DOMImplementation> m_implementation;
+
+ RefPtr<StyleSheet> m_sheet;
+#if FRAME_LOADS_USER_STYLESHEET
+ String m_usersheet;
+#endif
+
+ // Track the number of currently loading top-level stylesheets. Sheets
+ // loaded using the @import directive are not included in this count.
+ // We use this count of pending sheets to detect when we can begin attaching
+ // elements.
+ int m_pendingStylesheets;
+
+ // But sometimes you need to ignore pending stylesheet count to
+ // force an immediate layout when requested by JS.
+ bool m_ignorePendingStylesheets;
+
+ // If we do ignore the pending stylesheet count, then we need to add a boolean
+ // to track that this happened so that we can do a full repaint when the stylesheets
+ // do eventually load.
+ PendingSheetLayout m_pendingSheetLayout;
+
+ bool m_hasNodesWithPlaceholderStyle;
+
+ RefPtr<CSSStyleSheet> m_elemSheet;
+ RefPtr<CSSStyleSheet> m_mappedElementSheet;
+
+ bool m_printing;
+
+ bool m_ignoreAutofocus;
+
+ ParseMode m_parseMode;
+
+ Color m_textColor;
+
+ RefPtr<Node> m_focusedNode;
+ RefPtr<Node> m_hoverNode;
+ RefPtr<Node> m_activeNode;
+ mutable RefPtr<Element> m_documentElement;
+
+ unsigned m_domtree_version;
+
+ HashSet<NodeIterator*> m_nodeIterators;
+ HashSet<Range*> m_ranges;
+
+ unsigned short m_listenerTypes;
+
+ RefPtr<StyleSheetList> m_styleSheets; // All of the stylesheets that are currently in effect for our media type and stylesheet set.
+ ListHashSet<Node*> m_styleSheetCandidateNodes; // All of the nodes that could potentially provide stylesheets to the document (<link>, <style>, <?xml-stylesheet>)
+
+ RegisteredEventListenerVector m_windowEventListeners;
+
+ typedef HashMap<FormElementKey, Vector<String>, FormElementKeyHash, FormElementKeyHashTraits> FormElementStateMap;
+ ListHashSet<FormControlElementWithState*> m_formElementsWithState;
+ FormElementStateMap m_stateForNewFormElements;
+
+ Color m_linkColor;
+ Color m_visitedLinkColor;
+ Color m_activeLinkColor;
+
+ String m_preferredStylesheetSet;
+ String m_selectedStylesheetSet;
+
+ bool m_loadingSheet;
+ bool visuallyOrdered;
+ bool m_bParsing;
+ bool m_docChanged;
+ bool m_inStyleRecalc;
+ bool m_closeAfterStyleRecalc;
+ bool m_usesDescendantRules;
+ bool m_usesSiblingRules;
+ bool m_usesFirstLineRules;
+ bool m_usesFirstLetterRules;
+ bool m_usesBeforeAfterRules;
+ bool m_gotoAnchorNeededAfterStylesheetsLoad;
+ bool m_isDNSPrefetchEnabled;
+ bool m_haveExplicitlyDisabledDNSPrefetch;
+ bool m_frameElementsShouldIgnoreScrolling;
+
+ String m_title;
+ bool m_titleSetExplicitly;
+ RefPtr<Element> m_titleElement;
+
+ RenderArena* m_renderArena;
+
+ typedef std::pair<Vector<DocumentMarker>, Vector<IntRect> > MarkerMapVectorPair;
+ typedef HashMap<RefPtr<Node>, MarkerMapVectorPair*> MarkerMap;
+ MarkerMap m_markers;
+
+ mutable AXObjectCache* m_axObjectCache;
+
+ Vector<ImageLoader*> m_imageLoadEventDispatchSoonList;
+ Vector<ImageLoader*> m_imageLoadEventDispatchingList;
+ Timer<Document> m_imageLoadEventTimer;
+
+ Timer<Document> m_updateFocusAppearanceTimer;
+
+ Node* m_cssTarget;
+
+ bool m_processingLoadEvent;
+ double m_startTime;
+ bool m_overMinimumLayoutThreshold;
+
+#if ENABLE(XSLT)
+ void* m_transformSource;
+ RefPtr<Document> m_transformSourceDocument;
+#endif
+
+#if ENABLE(XBL)
+ XBLBindingManager* m_bindingManager; // The access point through which documents and elements communicate with XBL.
+#endif
+
+ typedef HashMap<AtomicStringImpl*, HTMLMapElement*> ImageMapsByName;
+ ImageMapsByName m_imageMapsByName;
+
+ HashSet<Node*> m_disconnectedNodesWithEventListeners;
+
+ int m_docID; // A unique document identifier used for things like document-specific mapped attributes.
+
+ String m_xmlEncoding;
+ String m_xmlVersion;
+ bool m_xmlStandalone;
+
+ String m_contentLanguage;
+
+public:
+ bool inPageCache() const { return m_inPageCache; }
+ void setInPageCache(bool flag);
+
+ // Elements can register themselves for the "documentWillBecomeInactive()" and
+ // "documentDidBecomeActive()" callbacks
+ void registerForDocumentActivationCallbacks(Element*);
+ void unregisterForDocumentActivationCallbacks(Element*);
+ void documentWillBecomeInactive();
+ void documentDidBecomeActive();
+
+ void registerForMediaVolumeCallbacks(Element*);
+ void unregisterForMediaVolumeCallbacks(Element*);
+ void mediaVolumeDidChange();
+
+ void setShouldCreateRenderers(bool);
+ bool shouldCreateRenderers();
+
+ void setDecoder(PassRefPtr<TextResourceDecoder>);
+ TextResourceDecoder* decoder() const { return m_decoder.get(); }
+
+ String displayStringModifiedByEncoding(const String& str) const {
+ if (m_decoder)
+ return m_decoder->encoding().displayString(str.impl());
+ return str;
+ }
+ PassRefPtr<StringImpl> displayStringModifiedByEncoding(PassRefPtr<StringImpl> str) const {
+ if (m_decoder)
+ return m_decoder->encoding().displayString(str);
+ return str;
+ }
+ void displayBufferModifiedByEncoding(UChar* buffer, unsigned len) const {
+ if (m_decoder)
+ m_decoder->encoding().displayBuffer(buffer, len);
+ }
+
+ // Quirk for the benefit of Apple's Dictionary application.
+ void setFrameElementsShouldIgnoreScrolling(bool ignore) { m_frameElementsShouldIgnoreScrolling = ignore; }
+ bool frameElementsShouldIgnoreScrolling() const { return m_frameElementsShouldIgnoreScrolling; }
+
+#if ENABLE(DASHBOARD_SUPPORT)
+ void setDashboardRegionsDirty(bool f) { m_dashboardRegionsDirty = f; }
+ bool dashboardRegionsDirty() const { return m_dashboardRegionsDirty; }
+ bool hasDashboardRegions () const { return m_hasDashboardRegions; }
+ void setHasDashboardRegions (bool f) { m_hasDashboardRegions = f; }
+ const Vector<DashboardRegionValue>& dashboardRegions() const;
+ void setDashboardRegions(const Vector<DashboardRegionValue>&);
+#endif
+
+ void removeAllEventListenersFromAllNodes();
+
+ void registerDisconnectedNodeWithEventListeners(Node*);
+ void unregisterDisconnectedNodeWithEventListeners(Node*);
+
+ HTMLFormElement::CheckedRadioButtons& checkedRadioButtons() { return m_checkedRadioButtons; }
+
+#if ENABLE(SVG)
+ const SVGDocumentExtensions* svgExtensions();
+ SVGDocumentExtensions* accessSVGExtensions();
+#endif
+
+ void initSecurityContext();
+
+ // Explicitly override the security origin for this document.
+ // Note: It is dangerous to change the security origin of a document
+ // that already contains content.
+ void setSecurityOrigin(SecurityOrigin*);
+
+ bool processingLoadEvent() const { return m_processingLoadEvent; }
+
+#if ENABLE(DATABASE)
+ void addOpenDatabase(Database*);
+ void removeOpenDatabase(Database*);
+ DatabaseThread* databaseThread(); // Creates the thread as needed, but not if it has been already terminated.
+ void setHasOpenDatabases() { m_hasOpenDatabases = true; }
+ bool hasOpenDatabases() { return m_hasOpenDatabases; }
+ void stopDatabases();
+#endif
+
+ void setUsingGeolocation(bool f) { m_usingGeolocation = f; }
+ bool usingGeolocation() const { return m_usingGeolocation; };
+
+#if ENABLE(WML)
+ void resetWMLPageState();
+#endif
+
+protected:
+ void clearXMLVersion() { m_xmlVersion = String(); }
+
+private:
+ void updateTitle();
+ void removeAllDisconnectedNodeEventListeners();
+ void imageLoadEventTimerFired(Timer<Document>*);
+ void updateFocusAppearanceTimerFired(Timer<Document>*);
+ void updateBaseURL();
+
+ void cacheDocumentElement() const;
+
+ RenderObject* m_savedRenderer;
+ int m_secureForms;
+
+ RefPtr<TextResourceDecoder> m_decoder;
+
+ // We maintain the invariant that m_duplicateIds is the count of all elements with a given ID
+ // excluding the one referenced in m_elementsById, if any. This means it one less than the total count
+ // when the first node with a given ID is cached, otherwise the same as the total count.
+ mutable HashMap<AtomicStringImpl*, Element*> m_elementsById;
+ mutable HashCountedSet<AtomicStringImpl*> m_duplicateIds;
+
+ mutable HashMap<StringImpl*, Element*, CaseFoldingHash> m_elementsByAccessKey;
+
+ InheritedBool m_designMode;
+
+ int m_selfOnlyRefCount;
+
+ HTMLFormElement::CheckedRadioButtons m_checkedRadioButtons;
+
+ typedef HashMap<AtomicStringImpl*, HTMLCollection::CollectionInfo*> NamedCollectionMap;
+ HTMLCollection::CollectionInfo m_collectionInfo[HTMLCollection::NumUnnamedDocumentCachedTypes];
+ NamedCollectionMap m_nameCollectionInfo[HTMLCollection::NumNamedDocumentCachedTypes];
+
+#if ENABLE(XPATH)
+ RefPtr<XPathEvaluator> m_xpathEvaluator;
+#endif
+
+#if ENABLE(SVG)
+ OwnPtr<SVGDocumentExtensions> m_svgExtensions;
+#endif
+
+#if ENABLE(DASHBOARD_SUPPORT)
+ Vector<DashboardRegionValue> m_dashboardRegions;
+ bool m_hasDashboardRegions;
+ bool m_dashboardRegionsDirty;
+#endif
+
+ HashMap<String, RefPtr<HTMLCanvasElement> > m_cssCanvasElements;
+
+ mutable bool m_accessKeyMapValid;
+ bool m_createRenderers;
+ bool m_inPageCache;
+ String m_iconURL;
+
+ HashSet<Element*> m_documentActivationCallbackElements;
+ HashSet<Element*> m_mediaVolumeCallbackElements;
+
+ bool m_useSecureKeyboardEntryWhenActive;
+
+ bool m_isXHTML;
+
+ unsigned m_numNodeListCaches;
+
+public:
+ typedef HashMap<WebCore::Node*, JSNode*> JSWrapperCache;
+ JSWrapperCache& wrapperCache() { return m_wrapperCache; }
+private:
+ JSWrapperCache m_wrapperCache;
+
+#if ENABLE(DATABASE)
+ RefPtr<DatabaseThread> m_databaseThread;
+ bool m_hasOpenDatabases; // This never changes back to false, even as the database thread is closed.
+ typedef HashSet<Database*> DatabaseSet;
+ OwnPtr<DatabaseSet> m_openDatabaseSet;
+#endif
+
+ bool m_usingGeolocation;
+
+#if USE(LOW_BANDWIDTH_DISPLAY)
+ bool m_inLowBandwidthDisplay;
+#endif
+
+ typedef HashMap<int, DOMTimer*> TimeoutsMap;
+ TimeoutsMap m_timeouts;
+
+public:
+ void addAutoSizingNode (Node *node, float size);
+ void validateAutoSizingNodes ();
+ void resetAutoSizingNodes();
+
+ void incrementScrollEventListenersCount();
+ void decrementScrollEventListenersCount();
+
+ void incrementTotalImageDataSize(CachedImage* image);
+ void decrementTotalImageDataSize(CachedImage* image);
+ unsigned long totalImageDataSize();
+
+ void incrementAnimatedImageDataCount(unsigned count);
+ unsigned long animatedImageDataCount();
+private:
+ typedef HashMap<TextAutoSizingKey, RefPtr<TextAutoSizingValue>, TextAutoSizingHash, TextAutoSizingTraits> TextAutoSizingMap;
+ TextAutoSizingMap m_textAutoSizedNodes;
+
+ unsigned m_scrollEventListenerCount;
+
+ HashCountedSet<CachedImage*> m_documentImages;
+
+ unsigned long m_totalImageDataSize;
+ unsigned long m_animatedImageDataCount;
+};
+
+inline bool Document::hasElementWithId(AtomicStringImpl* id) const
+{
+ ASSERT(id);
+ return m_elementsById.contains(id) || m_duplicateIds.contains(id);
+}
+
+inline bool Node::isDocumentNode() const
+{
+ return this == m_document.get();
+}
+
+} // namespace WebCore
+
+#endif // Document_h
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef DocumentFragment_h
+#define DocumentFragment_h
+
+#include "ContainerNode.h"
+
+namespace WebCore {
+
+class DocumentFragment : public ContainerNode
+{
+public:
+ DocumentFragment(Document*);
+
+ virtual String nodeName() const;
+ virtual NodeType nodeType() const;
+ virtual PassRefPtr<Node> cloneNode(bool deep);
+ virtual bool childTypeAllowed(NodeType);
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008, Apple Inc. All rights reserved.
+ *
+ * No license or rights are granted by Apple expressly or by implication,
+ * estoppel, or otherwise, to Apple copyrights, patents, trademarks, trade
+ * secrets or other rights.
+ */
+
+#if ENABLE(TOUCH_EVENTS)
+public:
+ PassRefPtr<Touch> createTouch(DOMWindow* view, EventTarget* target, long identifier, long pageX, long pageY, long screenX, long screenY, ExceptionCode&);
+ PassRefPtr<TouchList> createTouchList(ExceptionCode&);
+
+ typedef HashMap< RefPtr<Node>, unsigned > TouchListenerMap;
+
+ void setInTouchEventHandling(bool handling);
+
+ void addTouchEventListener(Node*);
+ void removeTouchEventListener(Node*, bool removeAll = false);
+ void setTouchEventListenersDirty(bool);
+ void touchEventsChangedTimerFired(Timer<Document>*);
+ const TouchListenerMap& touchEventListeners() const { return m_touchEventListeners; }
+private:
+ bool m_inTouchEventHandling;
+ bool m_touchEventRegionsDirty;
+ TouchListenerMap m_touchEventListeners;
+ Timer<Document> m_touchEventsChangedTimer;
+public:
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008, Apple Inc. All rights reserved.
+ *
+ * No license or rights are granted by Apple expressly or by implication,
+ * estoppel, or otherwise, to Apple copyrights, patents, trademarks, trade
+ * secrets or other rights.
+ */
+
+#if ENABLE(TOUCH_EVENTS)
+ struct EventRegion;
+ class EventTarget;
+ class Touch;
+ class TouchList;
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DocumentLoader_h
+#define DocumentLoader_h
+
+#include "NavigationAction.h"
+#include "ResourceError.h"
+#include "ResourceRequest.h"
+#include "ResourceResponse.h"
+#include "SubstituteData.h"
+#include "Timer.h"
+
+namespace WebCore {
+
+ class ApplicationCache;
+ class ApplicationCacheGroup;
+ class ApplicationCacheResource;
+ class Archive;
+ class ArchiveResource;
+ class ArchiveResourceCollection;
+ class CachedPage;
+ class Frame;
+ class FrameLoader;
+ class MainResourceLoader;
+ class ResourceLoader;
+ class SchedulePair;
+ class SharedBuffer;
+ class SubstituteResource;
+
+ typedef HashSet<RefPtr<ResourceLoader> > ResourceLoaderSet;
+ typedef Vector<ResourceResponse> ResponseVector;
+
+ class DocumentLoader : public RefCounted<DocumentLoader> {
+ public:
+ static PassRefPtr<DocumentLoader> create(const ResourceRequest& request, const SubstituteData& data)
+ {
+ return adoptRef(new DocumentLoader(request, data));
+ }
+ virtual ~DocumentLoader();
+
+ void setFrame(Frame*);
+ Frame* frame() const { return m_frame; }
+
+ virtual void attachToFrame();
+ virtual void detachFromFrame();
+
+ FrameLoader* frameLoader() const;
+ MainResourceLoader* mainResourceLoader() const { return m_mainResourceLoader.get(); }
+ PassRefPtr<SharedBuffer> mainResourceData() const;
+
+ const ResourceRequest& originalRequest() const;
+ const ResourceRequest& originalRequestCopy() const;
+
+ const ResourceRequest& request() const;
+ ResourceRequest& request();
+ void setRequest(const ResourceRequest&);
+
+ const SubstituteData& substituteData() const { return m_substituteData; }
+
+ const KURL& url() const;
+ const KURL& unreachableURL() const;
+
+ const KURL& originalURL() const;
+ const KURL& requestURL() const;
+ const KURL& responseURL() const;
+ const String& responseMIMEType() const;
+
+ void replaceRequestURLForAnchorScroll(const KURL&);
+ bool isStopping() const { return m_isStopping; }
+ void stopLoading();
+ void setCommitted(bool committed) { m_committed = committed; }
+ bool isCommitted() const { return m_committed; }
+ bool isLoading() const { return m_loading; }
+ void setLoading(bool loading) { m_loading = loading; }
+ void updateLoading();
+ void receivedData(const char*, int);
+ void setupForReplaceByMIMEType(const String& newMIMEType);
+ void finishedLoading();
+ const ResourceResponse& response() const { return m_response; }
+ const ResourceError& mainDocumentError() const { return m_mainDocumentError; }
+ void mainReceivedError(const ResourceError&, bool isComplete);
+ void setResponse(const ResourceResponse& response) { m_response = response; }
+ void prepareForLoadStart();
+ bool isClientRedirect() const { return m_isClientRedirect; }
+ void setIsClientRedirect(bool isClientRedirect) { m_isClientRedirect = isClientRedirect; }
+ bool isLoadingInAPISense() const;
+ void setPrimaryLoadComplete(bool);
+ void setTitle(const String&);
+ const String& overrideEncoding() const { return m_overrideEncoding; }
+
+#if PLATFORM(MAC)
+ void schedule(SchedulePair*);
+ void unschedule(SchedulePair*);
+#endif
+
+ void addAllArchiveResources(Archive*);
+ void addArchiveResource(PassRefPtr<ArchiveResource>);
+
+ // Return an ArchiveResource for the URL, either creating from live data or
+ // pulling from the ArchiveResourceCollection
+ PassRefPtr<ArchiveResource> subresource(const KURL&) const;
+ // Return the ArchiveResource for the URL only when loading an Archive
+ ArchiveResource* archiveResourceForURL(const KURL&) const;
+
+ PassRefPtr<Archive> popArchiveForSubframe(const String& frameName);
+ void clearArchiveResources();
+ void setParsedArchiveData(PassRefPtr<SharedBuffer>);
+ SharedBuffer* parsedArchiveData() const;
+
+ PassRefPtr<ArchiveResource> mainResource() const;
+ void getSubresources(Vector<PassRefPtr<ArchiveResource> >&) const;
+
+ bool scheduleArchiveLoad(ResourceLoader*, const ResourceRequest&, const KURL&);
+#ifndef NDEBUG
+ bool isSubstituteLoadPending(ResourceLoader*) const;
+#endif
+ void cancelPendingSubstituteLoad(ResourceLoader*);
+
+ void addResponse(const ResourceResponse&);
+ const ResponseVector& responses() const { return m_responses; }
+
+ const NavigationAction& triggeringAction() const { return m_triggeringAction; }
+ void setTriggeringAction(const NavigationAction& action) { m_triggeringAction = action; }
+ void setOverrideEncoding(const String& encoding) { m_overrideEncoding = encoding; }
+ void setLastCheckedRequest(const ResourceRequest& request) { m_lastCheckedRequest = request; }
+ const ResourceRequest& lastCheckedRequest() { return m_lastCheckedRequest; }
+
+ void stopRecordingResponses();
+ const String& title() const { return m_pageTitle; }
+
+ KURL urlForHistory() const;
+ bool urlForHistoryReflectsFailure() const;
+ bool urlForHistoryReflectsServerRedirect() const { return urlForHistory() != url(); }
+ bool urlForHistoryReflectsClientRedirect() const { return m_urlForHistoryReflectsClientRedirect; }
+ void setURLForHistoryReflectsClientRedirect(bool b) { m_urlForHistoryReflectsClientRedirect = b; }
+
+ void loadFromCachedPage(PassRefPtr<CachedPage>);
+ void setLoadingFromCachedPage(bool loading) { m_loadingFromCachedPage = loading; }
+ bool isLoadingFromCachedPage() const { return m_loadingFromCachedPage; }
+
+ void setDefersLoading(bool);
+
+ bool startLoadingMainResource(unsigned long identifier);
+ void cancelMainResourceLoad(const ResourceError&);
+
+ void iconLoadDecisionAvailable();
+
+ bool isLoadingMainResource() const;
+ bool isLoadingSubresources() const;
+ bool isLoadingPlugIns() const;
+ bool isLoadingMultipartContent() const;
+
+ void stopLoadingPlugIns();
+ void stopLoadingSubresources();
+
+ void addSubresourceLoader(ResourceLoader*);
+ void removeSubresourceLoader(ResourceLoader*);
+ void addPlugInStreamLoader(ResourceLoader*);
+ void removePlugInStreamLoader(ResourceLoader*);
+
+ void subresourceLoaderFinishedLoadingOnePart(ResourceLoader*);
+
+ void setDeferMainResourceDataLoad(bool defer) { m_deferMainResourceDataLoad = defer; }
+ bool deferMainResourceDataLoad() const { return m_deferMainResourceDataLoad; }
+
+ void didTellClientAboutLoad(const String& url) { m_resourcesClientKnowsAbout.add(url); }
+ bool haveToldClientAboutLoad(const String& url) { return m_resourcesClientKnowsAbout.contains(url); }
+ void recordMemoryCacheLoadForFutureClientNotification(const String& url);
+ void takeMemoryCacheLoadsForClientNotification(Vector<String>& loads);
+
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+ bool scheduleApplicationCacheLoad(ResourceLoader*, const ResourceRequest&, const KURL& originalURL);
+ bool scheduleLoadFallbackResourceFromApplicationCache(ResourceLoader*, const ResourceRequest&, ApplicationCache* = 0);
+ bool shouldLoadResourceFromApplicationCache(const ResourceRequest&, ApplicationCacheResource*&);
+ bool getApplicationCacheFallbackResource(const ResourceRequest&, ApplicationCacheResource*&, ApplicationCache* = 0);
+
+ void setCandidateApplicationCacheGroup(ApplicationCacheGroup* group);
+ ApplicationCacheGroup* candidateApplicationCacheGroup() const { return m_candidateApplicationCacheGroup; }
+
+ void setApplicationCache(PassRefPtr<ApplicationCache> applicationCache);
+ ApplicationCache* applicationCache() const { return m_applicationCache.get(); }
+
+ ApplicationCache* mainResourceApplicationCache() const;
+#endif
+
+ protected:
+ DocumentLoader(const ResourceRequest&, const SubstituteData&);
+
+ bool m_deferMainResourceDataLoad;
+
+ private:
+ void setupForReplace();
+ void commitIfReady();
+ void clearErrors();
+ void setMainDocumentError(const ResourceError&);
+ void commitLoad(const char*, int);
+ bool doesProgressiveLoad(const String& MIMEType) const;
+
+ void deliverSubstituteResourcesAfterDelay();
+ void substituteResourceDeliveryTimerFired(Timer<DocumentLoader>*);
+
+ Frame* m_frame;
+
+ RefPtr<MainResourceLoader> m_mainResourceLoader;
+ ResourceLoaderSet m_subresourceLoaders;
+ ResourceLoaderSet m_multipartSubresourceLoaders;
+ ResourceLoaderSet m_plugInStreamLoaders;
+
+ RefPtr<SharedBuffer> m_mainResourceData;
+
+ // A reference to actual request used to create the data source.
+ // This should only be used by the resourceLoadDelegate's
+ // identifierForInitialRequest:fromDatasource: method. It is
+ // not guaranteed to remain unchanged, as requests are mutable.
+ ResourceRequest m_originalRequest;
+
+ SubstituteData m_substituteData;
+
+ // A copy of the original request used to create the data source.
+ // We have to copy the request because requests are mutable.
+ ResourceRequest m_originalRequestCopy;
+
+ // The 'working' request. It may be mutated
+ // several times from the original request to include additional
+ // headers, cookie information, canonicalization and redirects.
+ ResourceRequest m_request;
+
+ ResourceResponse m_response;
+
+ ResourceError m_mainDocumentError;
+
+ bool m_committed;
+ bool m_isStopping;
+ bool m_loading;
+ bool m_gotFirstByte;
+ bool m_primaryLoadComplete;
+ bool m_isClientRedirect;
+ bool m_loadingFromCachedPage;
+
+ String m_pageTitle;
+
+ String m_overrideEncoding;
+
+ // The action that triggered loading - we keep this around for the
+ // benefit of the various policy handlers.
+ NavigationAction m_triggeringAction;
+
+ // The last request that we checked click policy for - kept around
+ // so we can avoid asking again needlessly.
+ ResourceRequest m_lastCheckedRequest;
+
+ // We retain all the received responses so we can play back the
+ // WebResourceLoadDelegate messages if the item is loaded from the
+ // page cache.
+ ResponseVector m_responses;
+ bool m_stopRecordingResponses;
+
+ typedef HashMap<RefPtr<ResourceLoader>, RefPtr<SubstituteResource> > SubstituteResourceMap;
+ SubstituteResourceMap m_pendingSubstituteResources;
+ Timer<DocumentLoader> m_substituteResourceDeliveryTimer;
+
+ OwnPtr<ArchiveResourceCollection> m_archiveResourceCollection;
+ RefPtr<SharedBuffer> m_parsedArchiveData;
+
+ HashSet<String> m_resourcesClientKnowsAbout;
+ Vector<String> m_resourcesLoadedFromMemoryCacheForClientNotification;
+
+ bool m_urlForHistoryReflectsClientRedirect;
+
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+ // The application cache that the document loader is associated with (if any).
+ RefPtr<ApplicationCache> m_applicationCache;
+
+ // Before an application cache has finished loading, this will be the candidate application
+ // group that the document loader is associated with.
+ ApplicationCacheGroup* m_candidateApplicationCacheGroup;
+
+ // Once the main resource has finished loading, this is the application cache it was loaded from (if any).
+ RefPtr<ApplicationCache> m_mainResourceApplicationCache;
+#endif
+ };
+
+ inline void DocumentLoader::recordMemoryCacheLoadForFutureClientNotification(const String& url)
+ {
+ m_resourcesLoadedFromMemoryCacheForClientNotification.append(url);
+ }
+
+ inline void DocumentLoader::takeMemoryCacheLoadsForClientNotification(Vector<String>& loadsSet)
+ {
+ loadsSet.swap(m_resourcesLoadedFromMemoryCacheForClientNotification);
+ m_resourcesLoadedFromMemoryCacheForClientNotification.clear();
+ }
+
+}
+
+#endif // DocumentLoader_h
--- /dev/null
+/*
+ * This file is part of the DOM implementation for WebCore.
+ *
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef DocumentMarker_h
+#define DocumentMarker_h
+
+#include "PlatformString.h"
+
+namespace WebCore {
+ class String;
+
+// A range of a node within a document that is "marked", such as the range of a misspelled word.
+// It optionally includes a description that could be displayed in the user interface.
+struct DocumentMarker {
+
+ enum MarkerType {
+ AllMarkers = -1,
+ Spelling,
+ Grammar,
+ TextMatch
+ };
+
+ MarkerType type;
+ unsigned startOffset;
+ unsigned endOffset;
+ String description;
+
+ bool operator==(const DocumentMarker& o) const
+ {
+ return type == o.type && startOffset == o.startOffset && endOffset == o.endOffset;
+ }
+
+ bool operator!=(const DocumentMarker& o) const
+ {
+ return !(*this == o);
+ }
+};
+
+} // namespace WebCore
+
+#endif // DocumentMarker_h
--- /dev/null
+/*
+ * Copyright (c) 2009, 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 DocumentThreadableLoader_h
+#define DocumentThreadableLoader_h
+
+#include "SubresourceLoaderClient.h"
+#include "ThreadableLoader.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+ class Document;
+ class ResourceRequest;
+ class ThreadableLoaderClient;
+
+ class DocumentThreadableLoader : public RefCounted<DocumentThreadableLoader>, public ThreadableLoader, private SubresourceLoaderClient {
+ public:
+ static PassRefPtr<DocumentThreadableLoader> create(Document*, ThreadableLoaderClient*, const ResourceRequest&, LoadCallbacks, ContentSniff);
+ virtual ~DocumentThreadableLoader();
+
+ virtual void cancel();
+
+ using RefCounted<DocumentThreadableLoader>::ref;
+ using RefCounted<DocumentThreadableLoader>::deref;
+
+ protected:
+ virtual void refThreadableLoader() { ref(); }
+ virtual void derefThreadableLoader() { deref(); }
+
+ private:
+ DocumentThreadableLoader(Document*, ThreadableLoaderClient*, const ResourceRequest&, LoadCallbacks, ContentSniff);
+ virtual void willSendRequest(SubresourceLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
+ virtual void didSendData(SubresourceLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent);
+
+ virtual void didReceiveResponse(SubresourceLoader*, const ResourceResponse&);
+ virtual void didReceiveData(SubresourceLoader*, const char*, int lengthReceived);
+ virtual void didFinishLoading(SubresourceLoader*);
+ virtual void didFail(SubresourceLoader*, const ResourceError&);
+
+ virtual void receivedCancellation(SubresourceLoader*, const AuthenticationChallenge&);
+
+ RefPtr<SubresourceLoader> m_loader;
+ ThreadableLoaderClient* m_client;
+ Document* m_document;
+ };
+
+} // namespace WebCore
+
+#endif // DocumentThreadableLoader_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef DocumentType_h
+#define DocumentType_h
+
+#include "Node.h"
+
+namespace WebCore {
+
+class NamedNodeMap;
+
+class DocumentType : public Node {
+public:
+ static PassRefPtr<DocumentType> create(Document* document, const String& name, const String& publicId, const String& systemId)
+ {
+ return new DocumentType(document, name, publicId, systemId);
+ }
+
+ NamedNodeMap* entities() const { return m_entities.get(); }
+ NamedNodeMap* notations() const { return m_notations.get(); }
+
+ const String& name() const { return m_name; }
+ const String& publicId() const { return m_publicId; }
+ const String& systemId() const { return m_systemId; }
+ const String& internalSubset() const { return m_subset; }
+
+private:
+ DocumentType(Document*, const String& name, const String& publicId, const String& systemId);
+
+ virtual KURL baseURI() const;
+ virtual String nodeName() const;
+ virtual NodeType nodeType() const;
+ virtual PassRefPtr<Node> cloneNode(bool deep);
+
+ virtual void insertedIntoDocument();
+ virtual void removedFromDocument();
+
+ RefPtr<NamedNodeMap> m_entities;
+ RefPtr<NamedNodeMap> m_notations;
+
+ String m_name;
+ String m_publicId;
+ String m_systemId;
+ String m_subset;
+};
+
+} // namespace WebCore
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DragActions_h
+#define DragActions_h
+
+#include <limits.h>
+
+namespace WebCore {
+
+ // WebCoreDragDestinationAction should be kept in sync with WebDragDestinationAction
+ typedef enum {
+ DragDestinationActionNone = 0,
+ DragDestinationActionDHTML = 1,
+ DragDestinationActionEdit = 2,
+ DragDestinationActionLoad = 4,
+ DragDestinationActionAny = UINT_MAX
+ } DragDestinationAction;
+
+ // WebCoreDragSourceAction should be kept in sync with WebDragSourceAction
+ typedef enum {
+ DragSourceActionNone = 0,
+ DragSourceActionDHTML = 1,
+ DragSourceActionImage = 2,
+ DragSourceActionLink = 4,
+ DragSourceActionSelection = 8,
+ DragSourceActionAny = UINT_MAX
+ } DragSourceAction;
+
+ //matches NSDragOperation
+ typedef enum {
+ DragOperationNone = 0,
+ DragOperationCopy = 1,
+ DragOperationLink = 2,
+ DragOperationGeneric = 4,
+ DragOperationPrivate = 8,
+ DragOperationMove = 16,
+ DragOperationDelete = 32,
+ DragOperationEvery = UINT_MAX
+ } DragOperation;
+
+}
+
+#endif // !DragActions_h
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#ifndef DragClient_h
+#define DragClient_h
+
+#include "DragActions.h"
+#include "DragImage.h"
+#include "IntPoint.h"
+
+#if PLATFORM(MAC)
+#ifdef __OBJC__
+@class DOMElement;
+@class NSURL;
+@class NSString;
+@class NSPasteboard;
+#else
+class DOMElement;
+class NSURL;
+class NSString;
+class NSPasteboard;
+#endif
+#endif
+
+namespace WebCore {
+
+ class Clipboard;
+ class DragData;
+ class Frame;
+ class Image;
+ class HTMLImageElement;
+
+ class DragClient {
+ public:
+ virtual void willPerformDragDestinationAction(DragDestinationAction, DragData*) = 0;
+ virtual void willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard*) = 0;
+ virtual DragDestinationAction actionMaskForDrag(DragData*) = 0;
+ //We work in window rather than view coordinates here
+ virtual DragSourceAction dragSourceActionMaskForPoint(const IntPoint& windowPoint) = 0;
+
+ virtual void startDrag(DragImageRef dragImage, const IntPoint& dragImageOrigin, const IntPoint& eventPos, Clipboard*, Frame*, bool linkDrag = false) = 0;
+ virtual DragImageRef createDragImageForLink(KURL&, const String& label, Frame*) = 0;
+
+ virtual void dragControllerDestroyed() = 0;
+#if PLATFORM(MAC)
+ //Mac specific helper functions to allow access to functionality in webkit -- such as
+ //web archives and NSPasteboard extras
+ //not abstract as that would require another #if PLATFORM(MAC) for the SVGImage client empty impl
+ virtual void declareAndWriteDragImage(NSPasteboard*, DOMElement*, NSURL*, NSString*, Frame*) {};
+#endif
+
+ virtual ~DragClient() {};
+ };
+
+}
+
+#endif // !DragClient_h
+
--- /dev/null
+/*
+ * Copyright (C) 2007, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DragData_h
+#define DragData_h
+
+#include "ClipboardAccessPolicy.h"
+#include "Color.h"
+#include "DragActions.h"
+#include "IntPoint.h"
+
+#include <wtf/Forward.h>
+#include <wtf/Vector.h>
+
+typedef void* DragDataRef;
+
+namespace WebCore {
+
+ class Clipboard;
+ class Document;
+ class DocumentFragment;
+ class KURL;
+
+#if PLATFORM(MAC)
+ class PasteboardHelper;
+#endif
+
+
+ class DragData {
+ public:
+#if PLATFORM(MAC)
+ //FIXME: In the future the WebKit functions provided by the helper class should be moved into WebCore,
+ //after which this constructor should be removed
+ DragData(DragDataRef data, const IntPoint& clientPosition, const IntPoint& globalPosition,
+ DragOperation operation, PasteboardHelper*);
+#else
+ //clientPosition is taken to be the position of the drag event within the target window, with (0,0) at the top left
+ DragData(DragDataRef data, const IntPoint& clientPosition, const IntPoint& globalPosition, DragOperation operation);
+#endif
+ const IntPoint& clientPosition() const { return m_clientPosition; }
+ const IntPoint& globalPosition() const { return m_globalPosition; }
+ DragDataRef platformData() const { return m_platformDragData; }
+ DragOperation draggingSourceOperationMask() const { return m_draggingSourceOperationMask; }
+ PassRefPtr<Clipboard> createClipboard(ClipboardAccessPolicy) const;
+ bool containsURL() const;
+ bool containsPlainText() const;
+ bool containsCompatibleContent() const;
+ String asURL(String* title = 0) const;
+ String asPlainText() const;
+ void asFilenames(Vector<String>&) const;
+ Color asColor() const;
+ PassRefPtr<DocumentFragment> asFragment(Document*) const;
+ bool canSmartReplace() const;
+ bool containsColor() const;
+ bool containsFiles() const;
+ private:
+ IntPoint m_clientPosition;
+ IntPoint m_globalPosition;
+ DragDataRef m_platformDragData;
+ DragOperation m_draggingSourceOperationMask;
+#if PLATFORM(MAC)
+ PasteboardHelper* m_pasteboardHelper;
+#endif
+};
+
+} //namespace WebCore
+
+#endif //!DragData_h
+
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DragImage_h
+#define DragImage_h
+
+#include "IntSize.h"
+#include "FloatSize.h"
+
+#if PLATFORM(MAC)
+#include <wtf/RetainPtr.h>
+#ifdef __OBJC__
+@class NSImage;
+#else
+class NSImage;
+#endif
+#elif PLATFORM(QT)
+QT_BEGIN_NAMESPACE
+class QPixmap;
+QT_END_NAMESPACE
+#elif PLATFORM(WIN)
+typedef struct HBITMAP__* HBITMAP;
+#elif PLATFORM(WX)
+class wxDragImage;
+#elif PLATFORM(CHROMIUM)
+#include "DragImageRef.h"
+#endif
+
+//We need to #define YOffset as it needs to be shared with WebKit
+#define DragLabelBorderYOffset 2
+
+namespace WebCore {
+
+ class CachedImage;
+ class Frame;
+ class Image;
+ class KURL;
+ class Range;
+ class String;
+
+#if PLATFORM(MAC)
+ typedef RetainPtr<NSImage> DragImageRef;
+#elif PLATFORM(QT)
+ typedef QPixmap* DragImageRef;
+#elif PLATFORM(WIN)
+ typedef HBITMAP DragImageRef;
+#elif PLATFORM(WX)
+ typedef wxDragImage* DragImageRef;
+#elif PLATFORM(GTK)
+ typedef void* DragImageRef;
+#endif
+
+ IntSize dragImageSize(DragImageRef);
+
+ //These functions should be memory neutral, eg. if they return a newly allocated image,
+ //they should release the input image. As a corollary these methods don't guarantee
+ //the input image ref will still be valid after they have been called
+ DragImageRef fitDragImageToMaxSize(DragImageRef image, const IntSize& srcSize, const IntSize& size);
+ DragImageRef scaleDragImage(DragImageRef, FloatSize scale);
+ DragImageRef dissolveDragImageToFraction(DragImageRef image, float delta);
+
+ DragImageRef createDragImageFromImage(Image*);
+ DragImageRef createDragImageForSelection(Frame*);
+ DragImageRef createDragImageIconForCachedImage(CachedImage*);
+ void deleteDragImage(DragImageRef);
+}
+
+#endif //!DragImage_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef DynamicNodeList_h
+#define DynamicNodeList_h
+
+#include "NodeList.h"
+#include <wtf/RefCounted.h>
+#include <wtf/Forward.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+ class AtomicString;
+ class Element;
+ class Node;
+
+ class DynamicNodeList : public NodeList {
+ public:
+ struct Caches {
+ Caches();
+ void reset();
+
+ unsigned cachedLength;
+ Node* lastItem;
+ unsigned lastItemOffset;
+ bool isLengthCacheValid : 1;
+ bool isItemCacheValid : 1;
+ unsigned refCount;
+ };
+
+ virtual ~DynamicNodeList();
+
+ bool hasOwnCaches() const { return m_ownsCaches; }
+
+ // DOM methods & attributes for NodeList
+ virtual unsigned length() const;
+ virtual Node* item(unsigned index) const;
+ virtual Node* itemWithName(const AtomicString&) const;
+
+ // Other methods (not part of DOM)
+ void invalidateCache();
+
+ protected:
+ DynamicNodeList(PassRefPtr<Node> rootNode);
+ DynamicNodeList(PassRefPtr<Node> rootNode, Caches*);
+
+ virtual bool nodeMatches(Element*) const = 0;
+
+ RefPtr<Node> m_rootNode;
+ mutable Caches* m_caches;
+ bool m_ownsCaches;
+
+ private:
+ Node* itemForwardsFromCurrent(Node* start, unsigned offset, int remainingOffset) const;
+ Node* itemBackwardsFromCurrent(Node* start, unsigned offset, int remainingOffset) const;
+ };
+
+} // namespace WebCore
+
+#endif // DynamicNodeList_h
--- /dev/null
+/*
+ * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef EditAction_h
+#define EditAction_h
+
+namespace WebCore {
+ typedef enum {
+ EditActionUnspecified,
+ EditActionSetColor,
+ EditActionSetBackgroundColor,
+ EditActionTurnOffKerning,
+ EditActionTightenKerning,
+ EditActionLoosenKerning,
+ EditActionUseStandardKerning,
+ EditActionTurnOffLigatures,
+ EditActionUseStandardLigatures,
+ EditActionUseAllLigatures,
+ EditActionRaiseBaseline,
+ EditActionLowerBaseline,
+ EditActionSetTraditionalCharacterShape,
+ EditActionSetFont,
+ EditActionChangeAttributes,
+ EditActionAlignLeft,
+ EditActionAlignRight,
+ EditActionCenter,
+ EditActionJustify,
+ EditActionSetWritingDirection,
+ EditActionSubscript,
+ EditActionSuperscript,
+ EditActionUnderline,
+ EditActionOutline,
+ EditActionUnscript,
+ EditActionDrag,
+ EditActionCut,
+ EditActionDelete,
+ EditActionPaste,
+ EditActionPasteFont,
+ EditActionPasteRuler,
+ EditActionTyping,
+ EditActionCreateLink,
+ EditActionUnlink,
+ EditActionFormatBlock,
+ EditActionInsertList,
+ EditActionIndent,
+ EditActionOutdent
+ } EditAction;
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef EditCommand_h
+#define EditCommand_h
+
+#include "EditAction.h"
+#include "Element.h"
+#include "Selection.h"
+
+namespace WebCore {
+
+class CompositeEditCommand;
+class CSSMutableStyleDeclaration;
+
+class EditCommand : public RefCounted<EditCommand> {
+public:
+ virtual ~EditCommand();
+
+ void setParent(CompositeEditCommand*);
+
+ void apply();
+ void unapply();
+ void reapply();
+
+ virtual EditAction editingAction() const;
+
+ const Selection& startingSelection() const { return m_startingSelection; }
+ const Selection& endingSelection() const { return m_endingSelection; }
+
+ Element* startingRootEditableElement() const { return m_startingRootEditableElement.get(); }
+ Element* endingRootEditableElement() const { return m_endingRootEditableElement.get(); }
+
+ virtual bool isInsertTextCommand() const;
+ virtual bool isTypingCommand() const;
+
+ virtual bool preservesTypingStyle() const;
+
+ void setStartingSelection(const Selection&);
+ void setEndingSelection(const Selection&);
+
+protected:
+ EditCommand(Document*);
+
+ Document* document() const { return m_document.get(); }
+ PassRefPtr<CSSMutableStyleDeclaration> styleAtPosition(const Position&);
+ void updateLayout() const;
+
+private:
+ virtual void doApply() = 0;
+ virtual void doUnapply() = 0;
+ virtual void doReapply(); // calls doApply()
+
+ RefPtr<Document> m_document;
+ Selection m_startingSelection;
+ Selection m_endingSelection;
+ RefPtr<Element> m_startingRootEditableElement;
+ RefPtr<Element> m_endingRootEditableElement;
+ CompositeEditCommand* m_parent;
+
+ friend void applyCommand(PassRefPtr<EditCommand>);
+};
+
+class SimpleEditCommand : public EditCommand {
+protected:
+ SimpleEditCommand(Document* document) : EditCommand(document) { }
+};
+
+void applyCommand(PassRefPtr<EditCommand>);
+
+} // namespace WebCore
+
+#endif // EditCommand_h
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef EditingText_h
+#define EditingText_h
+
+#include "Text.h"
+
+namespace WebCore {
+
+class EditingText : public Text
+{
+public:
+ EditingText(Document *impl, const String &text);
+ EditingText(Document *impl);
+ virtual ~EditingText();
+
+ virtual bool rendererIsNeeded(RenderStyle *);
+};
+
+} // namespace WebCore
+
+#endif // EditingText_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Editor_h
+#define Editor_h
+
+#include "ClipboardAccessPolicy.h"
+#include "Color.h"
+#include "EditAction.h"
+#include "EditorDeleteAction.h"
+#include "EditorInsertAction.h"
+#include "SelectionController.h"
+
+namespace WebCore {
+
+class CSSStyleDeclaration;
+class Clipboard;
+class DeleteButtonController;
+class EditCommand;
+class EditorClient;
+class EditorInternalCommand;
+class HTMLElement;
+class HitTestResult;
+class Pasteboard;
+class SimpleFontData;
+class Text;
+
+struct CompositionUnderline {
+ CompositionUnderline()
+ : startOffset(0), endOffset(0), thick(false) { }
+ CompositionUnderline(unsigned s, unsigned e, const Color& c, bool t)
+ : startOffset(s), endOffset(e), color(c), thick(t) { }
+ unsigned startOffset;
+ unsigned endOffset;
+ Color color;
+ bool thick;
+};
+
+enum TriState { FalseTriState, TrueTriState, MixedTriState };
+enum EditorCommandSource { CommandFromMenuOrKeyBinding, CommandFromDOM, CommandFromDOMWithUserInterface };
+enum WritingDirection { NaturalWritingDirection, LeftToRightWritingDirection, RightToLeftWritingDirection };
+
+class Editor {
+public:
+ Editor(Frame*);
+ ~Editor();
+
+ EditorClient* client() const;
+ Frame* frame() const { return m_frame; }
+ DeleteButtonController* deleteButtonController() const { return m_deleteButtonController.get(); }
+ EditCommand* lastEditCommand() { return m_lastEditCommand.get(); }
+
+ void handleKeyboardEvent(KeyboardEvent*);
+ void handleInputMethodKeydown(KeyboardEvent*);
+
+ bool canEdit() const;
+ bool canEditRichly() const;
+
+
+ bool canCut() const;
+ bool canCopy() const;
+ bool canPaste() const;
+ bool canDelete() const;
+ bool canSmartCopyOrDelete();
+
+ void cut();
+ void copy();
+ void paste();
+ void pasteAsPlainText();
+ void performDelete();
+
+
+ void indent();
+ void outdent();
+ void transpose();
+
+ bool shouldInsertFragment(PassRefPtr<DocumentFragment>, PassRefPtr<Range>, EditorInsertAction);
+ bool shouldInsertText(const String&, Range*, EditorInsertAction) const;
+ bool shouldShowDeleteInterface(HTMLElement*) const;
+ bool shouldDeleteRange(Range*) const;
+ bool shouldApplyStyle(CSSStyleDeclaration*, Range*);
+
+ void respondToChangedSelection(const Selection& oldSelection);
+ void respondToChangedContents(const Selection& endingSelection);
+
+ TriState selectionHasStyle(CSSStyleDeclaration*) const;
+ const SimpleFontData* fontForSelection(bool&) const;
+ WritingDirection textDirectionForSelection(bool&) const;
+ WritingDirection baseWritingDirectionForSelectionStart() const;
+
+ TriState selectionUnorderedListState() const;
+ TriState selectionOrderedListState() const;
+ PassRefPtr<Node> insertOrderedList();
+ PassRefPtr<Node> insertUnorderedList();
+ bool canIncreaseSelectionListLevel();
+ bool canDecreaseSelectionListLevel();
+ PassRefPtr<Node> increaseSelectionListLevel();
+ PassRefPtr<Node> increaseSelectionListLevelOrdered();
+ PassRefPtr<Node> increaseSelectionListLevelUnordered();
+ void decreaseSelectionListLevel();
+
+ void removeFormattingAndStyle();
+
+ void clearLastEditCommand();
+
+ bool deleteWithDirection(SelectionController::EDirection, TextGranularity, bool killRing, bool isTypingAction);
+ void deleteSelectionWithSmartDelete(bool smartDelete);
+ void clearText();
+
+
+ Node* removedAnchor() const { return m_removedAnchor.get(); }
+ void setRemovedAnchor(PassRefPtr<Node> n) { m_removedAnchor = n; }
+
+ void applyStyle(CSSStyleDeclaration*, EditAction = EditActionUnspecified);
+ void applyParagraphStyle(CSSStyleDeclaration*, EditAction = EditActionUnspecified);
+ void applyStyleToSelection(CSSStyleDeclaration*, EditAction);
+ void applyParagraphStyleToSelection(CSSStyleDeclaration*, EditAction);
+
+ void appliedEditing(PassRefPtr<EditCommand>);
+ void unappliedEditing(PassRefPtr<EditCommand>);
+ void reappliedEditing(PassRefPtr<EditCommand>);
+
+ bool selectionStartHasStyle(CSSStyleDeclaration*) const;
+
+ bool clientIsEditable() const;
+
+ class Command {
+ public:
+ Command();
+ Command(PassRefPtr<Frame>, const EditorInternalCommand*, EditorCommandSource);
+
+ bool execute(const String& parameter = String(), Event* triggeringEvent = 0) const;
+ bool execute(Event* triggeringEvent) const;
+
+ bool isSupported() const;
+ bool isEnabled(Event* triggeringEvent = 0) const;
+
+ TriState state(Event* triggeringEvent = 0) const;
+ String value(Event* triggeringEvent = 0) const;
+
+ bool isTextInsertion() const;
+
+ private:
+ RefPtr<Frame> m_frame;
+ const EditorInternalCommand* m_command;
+ EditorCommandSource m_source;
+ };
+ Command command(const String& commandName); // Default is CommandFromMenuOrKeyBinding.
+ Command command(const String& commandName, EditorCommandSource);
+
+ bool insertText(const String&, Event* triggeringEvent);
+ bool insertTextWithoutSendingTextEvent(const String&, bool selectInsertedText, Event* triggeringEvent);
+ bool insertLineBreak();
+ bool insertParagraphSeparator();
+
+ bool isContinuousSpellCheckingEnabled();
+ void toggleContinuousSpellChecking();
+ bool isGrammarCheckingEnabled();
+ void toggleGrammarChecking();
+ void ignoreSpelling();
+ void learnSpelling();
+ int spellCheckerDocumentTag();
+ bool isSelectionUngrammatical();
+ bool isSelectionMisspelled();
+ Vector<String> guessesForMisspelledSelection();
+ Vector<String> guessesForUngrammaticalSelection();
+ void markMisspellingsAfterTypingToPosition(const VisiblePosition&);
+ void markMisspellings(const Selection&);
+ void markBadGrammar(const Selection&);
+ void showSpellingGuessPanel();
+ bool spellingPanelIsShowing();
+
+ bool shouldBeginEditing(Range*);
+ bool shouldEndEditing(Range*);
+
+ void clearUndoRedoOperations();
+ bool canUndo();
+ void undo();
+ bool canRedo();
+ void redo();
+
+ void didBeginEditing();
+ void didEndEditing();
+ void didWriteSelectionToPasteboard();
+
+ void showFontPanel();
+ void showStylesPanel();
+ void showColorPanel();
+ void toggleBold();
+ void toggleUnderline();
+ void setBaseWritingDirection(WritingDirection);
+
+ // smartInsertDeleteEnabled and selectTrailingWhitespaceEnabled are
+ // mutually exclusive, meaning that enabling one will disable the other.
+ bool smartInsertDeleteEnabled();
+ bool isSelectTrailingWhitespaceEnabled();
+
+ bool hasBidiSelection() const;
+
+ // international text input composition
+ bool hasComposition() const { return m_compositionNode; }
+ void setComposition(const String&, const Vector<CompositionUnderline>&, unsigned selectionStart, unsigned selectionEnd);
+ void confirmComposition();
+ void confirmComposition(const String&); // if no existing composition, replaces selection
+ void confirmCompositionWithoutDisturbingSelection();
+ PassRefPtr<Range> compositionRange() const;
+ bool getCompositionSelection(unsigned& selectionStart, unsigned& selectionEnd) const;
+
+ // getting international text input composition state (for use by InlineTextBox)
+ Text* compositionNode() const { return m_compositionNode.get(); }
+ unsigned compositionStart() const { return m_compositionStart; }
+ unsigned compositionEnd() const { return m_compositionEnd; }
+ bool compositionUsesCustomUnderlines() const { return !m_customCompositionUnderlines.isEmpty(); }
+ const Vector<CompositionUnderline>& customCompositionUnderlines() const { return m_customCompositionUnderlines; }
+
+ bool ignoreCompositionSelectionChange() const { return m_ignoreCompositionSelectionChange; }
+
+ void setStartNewKillRingSequence(bool);
+
+ PassRefPtr<Range> rangeForPoint(const IntPoint& windowPoint);
+
+ void clear();
+
+ Selection selectionForCommand(Event*);
+
+ void appendToKillRing(const String&);
+ void prependToKillRing(const String&);
+ String yankFromKillRing();
+ void startNewKillRingSequence();
+ void setKillRingToYankedState();
+
+ PassRefPtr<Range> selectedRange();
+
+ void confirmMarkedText();
+ void setTextAsChildOfElement(const String&, Element*, bool);
+ void setTextAlignmentForChangedBaseWritingDirection(WritingDirection);
+
+ // We should make these functions private when their callers in Frame are moved over here to Editor
+ bool insideVisibleArea(const IntPoint&) const;
+ bool insideVisibleArea(Range*) const;
+ PassRefPtr<Range> nextVisibleRange(Range*, const String&, bool forward, bool caseFlag, bool wrapFlag);
+
+ void addToKillRing(Range*, bool prepend);
+private:
+ Frame* m_frame;
+ OwnPtr<DeleteButtonController> m_deleteButtonController;
+ RefPtr<EditCommand> m_lastEditCommand;
+ RefPtr<Node> m_removedAnchor;
+
+ RefPtr<Text> m_compositionNode;
+ unsigned m_compositionStart;
+ unsigned m_compositionEnd;
+ Vector<CompositionUnderline> m_customCompositionUnderlines;
+ bool m_ignoreCompositionSelectionChange;
+ bool m_shouldStartNewKillRingSequence;
+
+ bool canDeleteRange(Range*) const;
+ bool canSmartReplaceWithPasteboard(Pasteboard*);
+ void pasteAsPlainTextWithPasteboard(Pasteboard*);
+ void pasteWithPasteboard(Pasteboard*, bool allowPlainText);
+ void replaceSelectionWithFragment(PassRefPtr<DocumentFragment>, bool selectReplacement, bool smartReplace, bool matchStyle);
+ void replaceSelectionWithText(const String&, bool selectReplacement, bool smartReplace);
+ void writeSelectionToPasteboard(Pasteboard*);
+ void revealSelectionAfterEditingOperation();
+
+ void selectComposition();
+ void confirmComposition(const String&, bool preserveSelection);
+ void setIgnoreCompositionSelectionChange(bool ignore);
+
+ PassRefPtr<Range> firstVisibleRange(const String&, bool caseFlag);
+ PassRefPtr<Range> lastVisibleRange(const String&, bool caseFlag);
+
+ void changeSelectionAfterCommand(const Selection& newSelection, bool closeTyping, bool clearTypingStyle, EditCommand*);
+};
+
+inline void Editor::setStartNewKillRingSequence(bool flag)
+{
+ m_shouldStartNewKillRingSequence = flag;
+}
+
+} // namespace WebCore
+
+#endif // Editor_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef EditorClient_h
+#define EditorClient_h
+
+#include "EditorInsertAction.h"
+#include "PlatformString.h"
+#include "TextAffinity.h"
+#include <wtf/Forward.h>
+#include <wtf/Vector.h>
+
+#if PLATFORM(MAC)
+class NSArray;
+class NSData;
+class NSString;
+class NSURL;
+#endif
+
+namespace WebCore {
+
+class CSSStyleDeclaration;
+class EditCommand;
+class Element;
+class Frame;
+class HTMLElement;
+class KeyboardEvent;
+class Node;
+class Range;
+class Selection;
+class String;
+class VisiblePosition;
+
+struct GrammarDetail {
+ int location;
+ int length;
+ Vector<String> guesses;
+ String userDescription;
+};
+
+class EditorClient {
+public:
+ virtual ~EditorClient() { }
+ virtual void pageDestroyed() = 0;
+
+ virtual bool shouldDeleteRange(Range*) = 0;
+ virtual bool shouldShowDeleteInterface(HTMLElement*) = 0;
+ virtual bool smartInsertDeleteEnabled() = 0;
+ virtual bool isSelectTrailingWhitespaceEnabled() = 0;
+ virtual bool isContinuousSpellCheckingEnabled() = 0;
+ virtual void toggleContinuousSpellChecking() = 0;
+ virtual bool isGrammarCheckingEnabled() = 0;
+ virtual void toggleGrammarChecking() = 0;
+ virtual int spellCheckerDocumentTag() = 0;
+
+ virtual bool isEditable() = 0;
+
+ virtual bool shouldBeginEditing(Range*) = 0;
+ virtual bool shouldEndEditing(Range*) = 0;
+ virtual bool shouldInsertNode(Node*, Range*, EditorInsertAction) = 0;
+ virtual bool shouldInsertText(const String&, Range*, EditorInsertAction) = 0;
+ virtual bool shouldChangeSelectedRange(Range* fromRange, Range* toRange, EAffinity, bool stillSelecting) = 0;
+
+ virtual bool shouldApplyStyle(CSSStyleDeclaration*, Range*) = 0;
+// virtual bool shouldChangeTypingStyle(CSSStyleDeclaration* fromStyle, CSSStyleDeclaration* toStyle) = 0;
+// virtual bool doCommandBySelector(SEL selector) = 0;
+ virtual bool shouldMoveRangeAfterDelete(Range*, Range*) = 0;
+
+ virtual void didBeginEditing() = 0;
+ virtual void respondToChangedContents() = 0;
+ virtual void respondToChangedSelection() = 0;
+ virtual void didEndEditing() = 0;
+ virtual void didWriteSelectionToPasteboard() = 0;
+ virtual void didSetSelectionTypesForPasteboard() = 0;
+// virtual void didChangeTypingStyle:(NSNotification *)notification = 0;
+// virtual void didChangeSelection:(NSNotification *)notification = 0;
+// virtual NSUndoManager* undoManager:(WebView *)webView = 0;
+
+ virtual void registerCommandForUndo(PassRefPtr<EditCommand>) = 0;
+ virtual void registerCommandForRedo(PassRefPtr<EditCommand>) = 0;
+ virtual void clearUndoRedoOperations() = 0;
+
+ virtual bool canUndo() const = 0;
+ virtual bool canRedo() const = 0;
+
+ virtual void undo() = 0;
+ virtual void redo() = 0;
+
+ virtual void handleKeyboardEvent(KeyboardEvent*) = 0;
+ virtual void handleInputMethodKeydown(KeyboardEvent*) = 0;
+
+ virtual void textFieldDidBeginEditing(Element*) = 0;
+ virtual void textFieldDidEndEditing(Element*) = 0;
+ virtual void textDidChangeInTextField(Element*) = 0;
+ virtual bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*) = 0;
+ virtual void textWillBeDeletedInTextField(Element*) = 0;
+ virtual void textDidChangeInTextArea(Element*) = 0;
+ virtual void formElementDidSetValue(Element*) = 0;
+ virtual void formElementDidFocus(Element*) = 0;
+ virtual void formElementDidBlur(Element*) = 0;
+ virtual void suppressFormNotifications() = 0;
+ virtual void restoreFormNotifications() = 0;
+ virtual void suppressSelectionNotifications() = 0;
+ virtual void restoreSelectionNotifications() = 0;
+ virtual void startDelayingAndCoalescingContentChangeNotifications() = 0;
+ virtual void stopDelayingAndCoalescingContentChangeNotifications() = 0;
+
+#if PLATFORM(MAC)
+ virtual NSString* userVisibleString(NSURL*) = 0;
+#ifdef BUILDING_ON_TIGER
+ virtual NSArray* pasteboardTypesForSelection(Frame*) = 0;
+#endif
+#endif
+
+ virtual void ignoreWordInSpellDocument(const String&) = 0;
+ virtual void learnWord(const String&) = 0;
+ virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength) = 0;
+ virtual void checkGrammarOfString(const UChar*, int length, Vector<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength) = 0;
+ virtual void updateSpellingUIWithGrammarString(const String&, const GrammarDetail& detail) = 0;
+ virtual void updateSpellingUIWithMisspelledWord(const String&) = 0;
+ virtual void showSpellingUI(bool show) = 0;
+ virtual bool spellingUIIsShowing() = 0;
+ virtual void getGuessesForWord(const String&, Vector<String>& guesses) = 0;
+ virtual void setInputMethodState(bool enabled) = 0;
+};
+
+}
+
+#endif // EditorClient_h
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef EditorDeleteAction_h
+#define EditorDeleteAction_h
+
+namespace WebCore {
+
+enum EditorDeleteAction {
+ deleteSelectionAction,
+ deleteKeyAction,
+ forwardDeleteKeyAction
+};
+
+} // namespace
+
+#endif
+
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef EditorInsertAction_h
+#define EditorInsertAction_h
+
+namespace WebCore {
+
+// This must be kept in sync with WebViewInsertAction defined in WebEditingDelegate.h
+enum EditorInsertAction {
+ EditorInsertActionTyped,
+ EditorInsertActionPasted,
+ EditorInsertActionDropped,
+};
+
+} // namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Peter Kelly (pmk@post.com)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Element_h
+#define Element_h
+
+#include "ContainerNode.h"
+#include "QualifiedName.h"
+#include "ScrollTypes.h"
+
+#include "RenderStyle.h"
+
+namespace WebCore {
+
+class Attr;
+class Attribute;
+class CSSStyleDeclaration;
+class ElementRareData;
+class IntSize;
+
+class Element : public ContainerNode {
+public:
+ Element(const QualifiedName&, Document*);
+ ~Element();
+
+ const AtomicString& getIDAttribute() const;
+ bool hasAttribute(const QualifiedName&) const;
+ const AtomicString& getAttribute(const QualifiedName&) const;
+ void setAttribute(const QualifiedName&, const AtomicString& value, ExceptionCode&);
+ void removeAttribute(const QualifiedName&, ExceptionCode&);
+
+ bool hasAttributes() const;
+
+ bool hasAttribute(const String& name) const;
+ bool hasAttributeNS(const String& namespaceURI, const String& localName) const;
+
+ const AtomicString& getAttribute(const String& name) const;
+ const AtomicString& getAttributeNS(const String& namespaceURI, const String& localName) const;
+
+ void setAttribute(const AtomicString& name, const AtomicString& value, ExceptionCode&);
+ void setAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& value, ExceptionCode&);
+
+ void scrollIntoView (bool alignToTop = true);
+ void scrollIntoViewIfNeeded(bool centerIfNeeded = true);
+
+ void scrollByUnits(int units, ScrollGranularity);
+ void scrollByLines(int lines);
+ void scrollByPages(int pages);
+
+ int offsetLeft();
+ int offsetTop();
+ int offsetWidth();
+ int offsetHeight();
+ Element* offsetParent();
+ int clientLeft();
+ int clientTop();
+ int clientWidth();
+ int clientHeight();
+ int scrollLeft();
+ int scrollTop();
+ void setScrollLeft(int);
+ void setScrollTop(int);
+ int scrollWidth();
+ int scrollHeight();
+
+ void removeAttribute(const String& name, ExceptionCode&);
+ void removeAttributeNS(const String& namespaceURI, const String& localName, ExceptionCode&);
+
+ PassRefPtr<Attr> getAttributeNode(const String& name);
+ PassRefPtr<Attr> getAttributeNodeNS(const String& namespaceURI, const String& localName);
+ PassRefPtr<Attr> setAttributeNode(Attr*, ExceptionCode&);
+ PassRefPtr<Attr> setAttributeNodeNS(Attr*, ExceptionCode&);
+ PassRefPtr<Attr> removeAttributeNode(Attr*, ExceptionCode&);
+
+ virtual CSSStyleDeclaration* style();
+
+ const QualifiedName& tagQName() const { return m_tagName; }
+ String tagName() const { return nodeName(); }
+ bool hasTagName(const QualifiedName& tagName) const { return m_tagName.matches(tagName); }
+
+ // A fast function for checking the local name against another atomic string.
+ bool hasLocalName(const AtomicString& other) const { return m_tagName.localName() == other; }
+ bool hasLocalName(const QualifiedName& other) const { return m_tagName.localName() == other.localName(); }
+
+ const AtomicString& localName() const { return m_tagName.localName(); }
+ const AtomicString& prefix() const { return m_tagName.prefix(); }
+ virtual void setPrefix(const AtomicString&, ExceptionCode&);
+ const AtomicString& namespaceURI() const { return m_tagName.namespaceURI(); }
+
+ virtual KURL baseURI() const;
+
+ // DOM methods overridden from parent classes
+ virtual NodeType nodeType() const;
+ virtual PassRefPtr<Node> cloneNode(bool deep);
+ virtual String nodeName() const;
+ virtual void insertedIntoDocument();
+ virtual void removedFromDocument();
+ virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
+
+ PassRefPtr<Element> cloneElement();
+
+ void normalizeAttributes();
+
+ virtual bool isFormControlElement() const { return false; }
+ virtual bool isFormControlElementWithState() const { return false; }
+ virtual bool isInputTypeHidden() const { return false; }
+ virtual bool isPasswordField() const { return false; }
+
+ String nodeNamePreservingCase() const;
+
+ // convenience methods which ignore exceptions
+ void setAttribute(const QualifiedName&, const AtomicString& value);
+ void setBooleanAttribute(const QualifiedName& name, bool);
+
+ virtual NamedAttrMap* attributes() const;
+ NamedAttrMap* attributes(bool readonly) const;
+
+ // This method is called whenever an attribute is added, changed or removed.
+ virtual void attributeChanged(Attribute*, bool preserveDecls = false);
+
+ // not part of the DOM
+ void setAttributeMap(PassRefPtr<NamedAttrMap>);
+
+ virtual void copyNonAttributeProperties(const Element* /*source*/) { }
+
+ virtual void attach();
+ virtual void detach();
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+ virtual void recalcStyle(StyleChange = NoChange);
+
+ virtual RenderStyle* computedStyle();
+
+ virtual bool childTypeAllowed(NodeType);
+
+ virtual PassRefPtr<Attribute> createAttribute(const QualifiedName&, const AtomicString& value);
+
+ void dispatchAttrRemovalEvent(Attribute*);
+ void dispatchAttrAdditionEvent(Attribute*);
+
+ virtual void accessKeyAction(bool /*sendToAnyEvent*/) { }
+
+ virtual bool isURLAttribute(Attribute*) const;
+ virtual const QualifiedName& imageSourceAttributeName() const;
+ virtual String target() const { return String(); }
+
+ virtual void focus(bool restorePreviousSelection = true);
+ virtual void updateFocusAppearance(bool restorePreviousSelection);
+ void blur();
+
+#ifndef NDEBUG
+ virtual void formatForDebugger(char* buffer, unsigned length) const;
+#endif
+
+ String innerText() const;
+ String outerText() const;
+
+ virtual String title() const;
+
+ EVisibility implicitVisibility();
+
+ String openTagStartToString() const;
+
+ void updateId(const AtomicString& oldId, const AtomicString& newId);
+
+ IntSize minimumSizeForResizing() const;
+ void setMinimumSizeForResizing(const IntSize&);
+
+ // Use Document::registerForDocumentActivationCallbacks() to subscribe to these
+ virtual void documentWillBecomeInactive() { }
+ virtual void documentDidBecomeActive() { }
+
+ // Use Document::registerForMediaVolumeCallbacks() to subscribe to this
+ virtual void mediaVolumeDidChange() { }
+
+ bool isFinishedParsingChildren() const { return m_parsingChildrenFinished; }
+ virtual void finishParsingChildren();
+ virtual void beginParsingChildren() { m_parsingChildrenFinished = false; }
+
+ // ElementTraversal API
+ Element* firstElementChild() const;
+ Element* lastElementChild() const;
+ Element* previousElementSibling() const;
+ Element* nextElementSibling() const;
+ unsigned childElementCount() const;
+
+private:
+ virtual void createAttributeMap() const;
+
+ virtual void updateStyleAttribute() const {}
+
+#if ENABLE(SVG)
+ virtual void updateAnimatedSVGAttribute(const String&) const {}
+#endif
+
+ void updateFocusAppearanceSoonAfterAttach();
+ void cancelFocusAppearanceUpdate();
+
+ virtual const AtomicString& virtualPrefix() const { return prefix(); }
+ virtual const AtomicString& virtualLocalName() const { return localName(); }
+ virtual const AtomicString& virtualNamespaceURI() const { return namespaceURI(); }
+
+ QualifiedName m_tagName;
+ virtual NodeRareData* createRareData();
+
+protected:
+ ElementRareData* rareData() const;
+ ElementRareData* ensureRareData();
+
+ mutable RefPtr<NamedAttrMap> namedAttrMap;
+};
+
+inline bool Node::hasTagName(const QualifiedName& name) const
+{
+ return isElementNode() && static_cast<const Element*>(this)->hasTagName(name);
+}
+
+inline bool Node::hasAttributes() const
+{
+ return isElementNode() && static_cast<const Element*>(this)->hasAttributes();
+}
+
+inline NamedAttrMap* Node::attributes() const
+{
+ return isElementNode() ? static_cast<const Element*>(this)->attributes() : 0;
+}
+
+inline Element* Node::parentElement() const
+{
+ Node* parent = parentNode();
+ return parent && parent->isElementNode() ? static_cast<Element*>(parent) : 0;
+}
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 David Smith <catfish.man@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ElementRareData_h
+#define ElementRareData_h
+
+#include "Element.h"
+#include "NodeRareData.h"
+
+namespace WebCore {
+
+class ElementRareData : public NodeRareData {
+public:
+ ElementRareData();
+
+ void resetComputedStyle();
+
+ using NodeRareData::needsFocusAppearanceUpdateSoonAfterAttach;
+ using NodeRareData::setNeedsFocusAppearanceUpdateSoonAfterAttach;
+
+ IntSize m_minimumSizeForResizing;
+ RefPtr<RenderStyle> m_computedStyle;
+};
+
+inline IntSize defaultMinimumSizeForResizing()
+{
+ return IntSize(INT_MAX, INT_MAX);
+}
+
+inline ElementRareData::ElementRareData()
+ : m_minimumSizeForResizing(defaultMinimumSizeForResizing())
+{
+}
+
+inline void ElementRareData::resetComputedStyle()
+{
+ m_computedStyle.clear();
+}
+
+}
+#endif // ElementRareData_h
--- /dev/null
+/**
+* This file is part of the html renderer for KDE.
+ *
+ * Copyright (C) 2003, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef EllipsisBox_h
+#define EllipsisBox_h
+
+#include "InlineBox.h"
+
+namespace WebCore {
+
+class HitTestResult;
+
+struct HitTestRequest;
+
+class EllipsisBox : public InlineBox {
+public:
+ EllipsisBox(RenderObject* obj, const AtomicString& ellipsisStr, InlineFlowBox* parent,
+ int width, int y, int height, int baseline, bool firstLine, InlineBox* markupBox)
+ : InlineBox(obj, 0, y, width, height, baseline, firstLine, true, false, false, 0, 0, parent)
+ , m_str(ellipsisStr)
+ , m_markupBox(markupBox)
+ {
+ }
+
+ virtual void paint(RenderObject::PaintInfo&, int tx, int ty);
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty);
+
+private:
+ AtomicString m_str;
+ InlineBox* m_markupBox;
+};
+
+} // namespace WebCore
+
+#endif // EllipsisBox_h
--- /dev/null
+/*
+ * Copyright (C) 2006 Eric Seidel (eric@webkit.org)
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef EmptyClients_h
+#define EmptyClients_h
+
+#include "ChromeClient.h"
+#include "ContextMenuClient.h"
+#include "DocumentLoader.h"
+#include "DragClient.h"
+#include "EditCommand.h"
+#include "EditorClient.h"
+#include "FloatRect.h"
+#include "FocusDirection.h"
+#include "FormState.h"
+#include "FrameLoaderClient.h"
+#include "InspectorClient.h"
+#include "ResourceError.h"
+#include "SharedBuffer.h"
+
+/*
+ This file holds empty Client stubs for use by WebCore.
+ Viewless element needs to create a dummy Page->Frame->FrameView tree for use in parsing or executing JavaScript.
+ This tree depends heavily on Clients (usually provided by WebKit classes).
+
+ This file was first created for SVGImage as it had no way to access the current Page (nor should it,
+ since Images are not tied to a page).
+ See http://bugs.webkit.org/show_bug.cgi?id=5971 for the original discussion about this file.
+
+ Ideally, whenever you change a Client class, you should add a stub here.
+ Brittle, yes. Unfortunate, yes. Hopefully temporary.
+*/
+
+namespace WebCore {
+
+class EmptyChromeClient : public ChromeClient {
+public:
+ virtual ~EmptyChromeClient() { }
+ virtual void chromeDestroyed() { }
+
+ virtual void setWindowRect(const FloatRect&) { }
+ virtual FloatRect windowRect() { return FloatRect(); }
+
+ virtual FloatRect pageRect() { return FloatRect(); }
+
+ virtual float scaleFactor() { return 1.f; }
+
+ virtual void focus(bool /*userGesture*/) { }
+ virtual void unfocus() { }
+
+ virtual bool canTakeFocus(FocusDirection) { return false; }
+ virtual void takeFocus(FocusDirection) { }
+
+ virtual Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&, const bool /*userGesture*/) { return 0; }
+ virtual void show() { }
+
+ virtual bool canRunModal() { return false; }
+ virtual void runModal() { }
+
+ virtual void setToolbarsVisible(bool) { }
+ virtual bool toolbarsVisible() { return false; }
+
+ virtual void setStatusbarVisible(bool) { }
+ virtual bool statusbarVisible() { return false; }
+
+ virtual void setScrollbarsVisible(bool) { }
+ virtual bool scrollbarsVisible() { return false; }
+
+ virtual void setMenubarVisible(bool) { }
+ virtual bool menubarVisible() { return false; }
+
+ virtual void setResizable(bool) { }
+
+ virtual void addMessageToConsole(MessageSource, MessageLevel, const String& /*message*/, unsigned /*lineNumber*/, const String& /*sourceID*/) { }
+
+ virtual bool canRunBeforeUnloadConfirmPanel() { return false; }
+ virtual bool runBeforeUnloadConfirmPanel(const String&, Frame*) { return true; }
+
+ virtual void closeWindowSoon() { }
+
+ virtual void runJavaScriptAlert(Frame*, const String&) { }
+ virtual bool runJavaScriptConfirm(Frame*, const String&) { return false; }
+ virtual bool runJavaScriptPrompt(Frame*, const String&, const String&, String&) { return false; }
+ virtual bool shouldInterruptJavaScript() { return false; }
+
+ virtual void setStatusbarText(const String&) { }
+
+ virtual bool tabsToLinks() const { return false; }
+
+ virtual IntRect windowResizerRect() const { return IntRect(); }
+ virtual void addToDirtyRegion(const IntRect&) { }
+ virtual void scrollBackingStore(int, int, const IntRect&, const IntRect&) { }
+ virtual void updateBackingStore() { }
+
+ virtual void repaint(const IntRect&, bool, bool, bool) { }
+ virtual void scroll(const IntSize&, const IntRect&, const IntRect&) { }
+ virtual IntPoint screenToWindow(const IntPoint& p) const { return p; }
+ virtual IntRect windowToScreen(const IntRect& r) const { return r; }
+ virtual PlatformWidget platformWindow() const { return 0; }
+ virtual void contentsSizeChanged(Frame*, const IntSize&) const { }
+
+ virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned) { }
+
+ virtual void setToolTip(const String&) { }
+
+ virtual void print(Frame*) { }
+
+ virtual void exceededDatabaseQuota(Frame*, const String&) { }
+
+ virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>) { }
+
+ virtual void formStateDidChange(const Node*) { }
+
+ virtual HTMLParserQuirks* createHTMLParserQuirks() { return 0; }
+
+#if ENABLE(TOUCH_EVENTS)
+ virtual void eventRegionsChanged(const HashMap< RefPtr<Node>, unsigned>&) const { }
+ virtual void didPreventDefaultForEvent() const { }
+#endif
+ virtual void didReceiveDocType(Frame*) const { }
+ virtual void setNeedsScrollNotifications(Frame*, bool) const { }
+ virtual void observedContentChange(Frame*) const { }
+ virtual void clearContentChangeObservers(Frame*) const { }
+ virtual void didReceiveViewportArguments(Frame*, const ViewportArguments&) const { }
+ virtual void notifyRevealedSelectionByScrollingFrame(Frame*) const { }
+ virtual bool isStopping() const { return false; }
+ virtual void didLayout() const { }
+};
+
+class EmptyFrameLoaderClient : public FrameLoaderClient {
+public:
+ virtual ~EmptyFrameLoaderClient() { }
+ virtual void frameLoaderDestroyed() { }
+
+ virtual bool hasWebView() const { return true; } // mainly for assertions
+
+ virtual void makeRepresentation(DocumentLoader*) { }
+ virtual void forceLayout() { }
+ virtual void forceLayoutForNonHTML() { }
+
+ virtual void setCopiesOnScroll() { }
+
+ virtual void detachedFromParent2() { }
+ virtual void detachedFromParent3() { }
+
+ virtual void download(ResourceHandle*, const ResourceRequest&, const ResourceRequest&, const ResourceResponse&) { }
+
+ virtual void assignIdentifierToInitialRequest(unsigned long, DocumentLoader*, const ResourceRequest&) { }
+ virtual bool shouldUseCredentialStorage(DocumentLoader*, unsigned long) { return false; }
+ virtual void dispatchWillSendRequest(DocumentLoader*, unsigned long, ResourceRequest&, const ResourceResponse&) { }
+ virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge&) { }
+ virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge&) { }
+
+ virtual bool canAuthenticateAgainstProtectionSpace(DocumentLoader*, unsigned long, const ProtectionSpace&) { return false; }
+
+ virtual void dispatchDidReceiveResponse(DocumentLoader*, unsigned long, const ResourceResponse&) { }
+ virtual void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long, int) { }
+ virtual void dispatchDidFinishLoading(DocumentLoader*, unsigned long) { }
+ virtual void dispatchDidFailLoading(DocumentLoader*, unsigned long, const ResourceError&) { }
+ virtual bool dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int) { return false; }
+
+ virtual void dispatchDidHandleOnloadEvents() { }
+ virtual void dispatchDidReceiveServerRedirectForProvisionalLoad() { }
+ virtual void dispatchDidCancelClientRedirect() { }
+ virtual void dispatchWillPerformClientRedirect(const KURL&, double, double) { }
+ virtual void dispatchDidChangeLocationWithinPage() { }
+ virtual void dispatchWillClose() { }
+ virtual void dispatchDidReceiveIcon() { }
+ virtual void dispatchDidStartProvisionalLoad() { }
+ virtual void dispatchDidReceiveTitle(const String&) { }
+ virtual void dispatchDidCommitLoad() { }
+ virtual void dispatchDidFailProvisionalLoad(const ResourceError&) { }
+ virtual void dispatchDidFailLoad(const ResourceError&) { }
+ virtual void dispatchDidFinishDocumentLoad() { }
+ virtual void dispatchDidFinishLoad() { }
+ virtual void dispatchDidFirstLayout() { }
+ virtual void dispatchDidFirstVisuallyNonEmptyLayout() { }
+
+ virtual Frame* dispatchCreatePage() { return 0; }
+ virtual void dispatchShow() { }
+
+ virtual void dispatchDecidePolicyForMIMEType(FramePolicyFunction, const String&, const ResourceRequest&) { }
+ virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction, const NavigationAction&, const ResourceRequest&, PassRefPtr<FormState>, const String&) { }
+ virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction, const NavigationAction&, const ResourceRequest&, PassRefPtr<FormState>) { }
+ virtual void cancelPolicyCheck() { }
+
+ virtual void dispatchUnableToImplementPolicy(const ResourceError&) { }
+
+ virtual void dispatchWillSubmitForm(FramePolicyFunction, PassRefPtr<FormState>) { }
+
+ virtual void dispatchDidLoadMainResource(DocumentLoader*) { }
+ virtual void revertToProvisionalState(DocumentLoader*) { }
+ virtual void setMainDocumentError(DocumentLoader*, const ResourceError&) { }
+
+ virtual void willChangeEstimatedProgress() { }
+ virtual void didChangeEstimatedProgress() { }
+ virtual void postProgressStartedNotification() { }
+ virtual void postProgressEstimateChangedNotification() { }
+ virtual void postProgressFinishedNotification() { }
+
+ virtual void setMainFrameDocumentReady(bool) { }
+
+ virtual void startDownload(const ResourceRequest&) { }
+
+ virtual void willChangeTitle(DocumentLoader*) { }
+ virtual void didChangeTitle(DocumentLoader*) { }
+
+ virtual void committedLoad(DocumentLoader*, const char*, int) { }
+ virtual void finishedLoading(DocumentLoader*) { }
+
+ virtual ResourceError cancelledError(const ResourceRequest&) { ResourceError error("", 0, "", ""); error.setIsCancellation(true); return error; }
+ virtual ResourceError blockedError(const ResourceRequest&) { return ResourceError("", 0, "", ""); }
+ virtual ResourceError cannotShowURLError(const ResourceRequest&) { return ResourceError("", 0, "", ""); }
+ virtual ResourceError interruptForPolicyChangeError(const ResourceRequest&) { return ResourceError("", 0, "", ""); }
+
+ virtual ResourceError cannotShowMIMETypeError(const ResourceResponse&) { return ResourceError("", 0, "", ""); }
+ virtual ResourceError fileDoesNotExistError(const ResourceResponse&) { return ResourceError("", 0, "", ""); }
+ virtual ResourceError pluginWillHandleLoadError(const ResourceResponse&) { return ResourceError("", 0, "", ""); }
+
+ virtual bool shouldFallBack(const ResourceError&) { return false; }
+
+ virtual bool canHandleRequest(const ResourceRequest&) const { return false; }
+ virtual bool canShowMIMEType(const String&) const { return false; }
+ virtual bool representationExistsForURLScheme(const String&) const { return false; }
+ virtual String generatedMIMETypeForURLScheme(const String&) const { return ""; }
+
+ virtual void frameLoadCompleted() { }
+ virtual void restoreViewState() { }
+ virtual void provisionalLoadStarted() { }
+ virtual bool shouldTreatURLAsSameAsCurrent(const KURL&) const { return false; }
+ virtual void didFinishLoad() { }
+ virtual void prepareForDataSourceReplacement() { }
+
+ virtual PassRefPtr<DocumentLoader> createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData) { return DocumentLoader::create(request, substituteData); }
+ virtual void setTitle(const String&, const KURL&) { }
+
+ virtual String userAgent(const KURL&) { return ""; }
+
+ virtual void savePlatformDataToCachedFrame(CachedFrame*) { }
+ virtual void transitionToCommittedFromCachedFrame(CachedFrame*) { }
+ virtual void transitionToCommittedForNewPage() { }
+
+ virtual void updateGlobalHistory() { }
+ virtual void updateGlobalHistoryForRedirectWithoutHistoryItem() { }
+ virtual bool shouldGoToHistoryItem(HistoryItem*) const { return false; }
+ virtual void saveViewStateToItem(HistoryItem*) { }
+ virtual bool canCachePage() const { return false; }
+
+ virtual PassRefPtr<Frame> createFrame(const KURL&, const String&, HTMLFrameOwnerElement*, const String&, bool, int, int) { return 0; }
+ virtual Widget* createPlugin(const IntSize&, Element*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool) { return 0; }
+ virtual Widget* createJavaAppletWidget(const IntSize&, Element*, const KURL&, const Vector<String>&, const Vector<String>&) { return 0; }
+
+ virtual ObjectContentType objectContentType(const KURL&, const String&) { return ObjectContentType(); }
+ virtual String overrideMediaType() const { return String(); }
+
+ virtual void redirectDataToPlugin(Widget*) { }
+ virtual void windowObjectCleared() { }
+ virtual void didPerformFirstNavigation() const { }
+
+ virtual void registerForIconNotification(bool) { }
+
+#if PLATFORM(MAC)
+ virtual NSCachedURLResponse* willCacheResponse(DocumentLoader*, unsigned long, NSCachedURLResponse* response) const { return response; }
+#endif
+
+};
+
+class EmptyEditorClient : public EditorClient {
+public:
+ virtual ~EmptyEditorClient() { }
+ virtual void pageDestroyed() { }
+
+ virtual bool shouldDeleteRange(Range*) { return false; }
+ virtual bool shouldShowDeleteInterface(HTMLElement*) { return false; }
+ virtual bool smartInsertDeleteEnabled() { return false; }
+ virtual bool isSelectTrailingWhitespaceEnabled() { return false; }
+ virtual bool isContinuousSpellCheckingEnabled() { return false; }
+ virtual void toggleContinuousSpellChecking() { }
+ virtual bool isGrammarCheckingEnabled() { return false; }
+ virtual void toggleGrammarChecking() { }
+ virtual int spellCheckerDocumentTag() { return -1; }
+
+ virtual bool selectWordBeforeMenuEvent() { return false; }
+ virtual bool isEditable() { return false; }
+
+ virtual bool shouldBeginEditing(Range*) { return false; }
+ virtual bool shouldEndEditing(Range*) { return false; }
+ virtual bool shouldInsertNode(Node*, Range*, EditorInsertAction) { return false; }
+ // virtual bool shouldInsertNode(Node*, Range* replacingRange, WebViewInsertAction) { return false; }
+ virtual bool shouldInsertText(const String&, Range*, EditorInsertAction) { return false; }
+ virtual bool shouldChangeSelectedRange(Range*, Range*, EAffinity, bool) { return false; }
+
+ virtual bool shouldApplyStyle(CSSStyleDeclaration*, Range*) { return false; }
+ virtual bool shouldMoveRangeAfterDelete(Range*, Range*) { return false; }
+ // virtual bool shouldChangeTypingStyle(CSSStyleDeclaration* fromStyle, CSSStyleDeclaration* toStyle) { return false; }
+ // virtual bool doCommandBySelector(SEL selector) { return false; }
+ //
+ virtual void didBeginEditing() { }
+ virtual void respondToChangedContents() { }
+ virtual void respondToChangedSelection() { }
+ virtual void didEndEditing() { }
+ virtual void didWriteSelectionToPasteboard() { }
+ virtual void didSetSelectionTypesForPasteboard() { }
+ // virtual void webViewDidChangeTypingStyle:(NSNotification *)notification { }
+ // virtual void webViewDidChangeSelection:(NSNotification *)notification { }
+ // virtual NSUndoManager* undoManagerForWebView:(WebView *)webView { return 0; }
+
+ virtual void registerCommandForUndo(PassRefPtr<EditCommand>) { }
+ virtual void registerCommandForRedo(PassRefPtr<EditCommand>) { }
+ virtual void clearUndoRedoOperations() { }
+
+ virtual bool canUndo() const { return false; }
+ virtual bool canRedo() const { return false; }
+
+ virtual void undo() { }
+ virtual void redo() { }
+
+ virtual void handleKeyboardEvent(KeyboardEvent*) { }
+ virtual void handleInputMethodKeydown(KeyboardEvent*) { }
+
+ virtual void textFieldDidBeginEditing(Element*) { }
+ virtual void textFieldDidEndEditing(Element*) { }
+ virtual void textDidChangeInTextField(Element*) { }
+ virtual bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*) { return false; }
+ virtual void textWillBeDeletedInTextField(Element*) { }
+ virtual void textDidChangeInTextArea(Element*) { }
+ virtual void formElementDidSetValue(Element*) { }
+ virtual void formElementDidFocus(Element*) { }
+ virtual void formElementDidBlur(Element*) { }
+ virtual void suppressFormNotifications() { }
+ virtual void restoreFormNotifications() { }
+ virtual void suppressSelectionNotifications() { }
+ virtual void restoreSelectionNotifications() { }
+ virtual void startDelayingAndCoalescingContentChangeNotifications() { }
+ virtual void stopDelayingAndCoalescingContentChangeNotifications() { }
+
+#if PLATFORM(MAC)
+ virtual void markedTextAbandoned(Frame*) { }
+
+ virtual NSString* userVisibleString(NSURL*) { return 0; }
+#ifdef BUILDING_ON_TIGER
+ virtual NSArray* pasteboardTypesForSelection(Frame*) { return 0; }
+#endif
+#endif
+ virtual void ignoreWordInSpellDocument(const String&) { }
+ virtual void learnWord(const String&) { }
+ virtual void checkSpellingOfString(const UChar*, int, int*, int*) { }
+ virtual void checkGrammarOfString(const UChar*, int, Vector<GrammarDetail>&, int*, int*) { }
+ virtual void updateSpellingUIWithGrammarString(const String&, const GrammarDetail&) { }
+ virtual void updateSpellingUIWithMisspelledWord(const String&) { }
+ virtual void showSpellingUI(bool) { }
+ virtual bool spellingUIIsShowing() { return false; }
+ virtual void getGuessesForWord(const String&, Vector<String>&) { }
+ virtual void setInputMethodState(bool) { }
+
+
+};
+
+
+}
+
+#endif // EmptyClients_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Entity_h
+#define Entity_h
+
+#include "ContainerNode.h"
+
+namespace WebCore {
+
+// FIXME: This abstract class is only here so that the JavaScript and Objective-C bindings
+// can continue to be compiled.
+class Entity : public ContainerNode {
+public:
+ String publicId() const { ASSERT_NOT_REACHED(); return String(); }
+ String systemId() const { ASSERT_NOT_REACHED(); return String(); }
+ String notationName() const { ASSERT_NOT_REACHED(); return String(); }
+
+private:
+ Entity() : ContainerNode(0) {}
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2000 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef EntityReference_h
+#define EntityReference_h
+
+#include "ContainerNode.h"
+
+namespace WebCore {
+
+class EntityReference : public ContainerNode {
+public:
+ EntityReference(Document*, const String& entityName);
+
+ virtual String nodeName() const;
+ virtual NodeType nodeType() const;
+ virtual PassRefPtr<Node> cloneNode(bool deep);
+
+private:
+ String m_entityName;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
+ * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Event_h
+#define Event_h
+
+#include "AtomicString.h"
+#include "EventTarget.h"
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+ class Clipboard;
+
+ // FIXME: this should probably defined elsewhere.
+ typedef unsigned long long DOMTimeStamp;
+
+ class Event : public RefCounted<Event> {
+ public:
+ enum PhaseType {
+ CAPTURING_PHASE = 1,
+ AT_TARGET = 2,
+ BUBBLING_PHASE = 3
+ };
+
+ enum EventType {
+ MOUSEDOWN = 1,
+ MOUSEUP = 2,
+ MOUSEOVER = 4,
+ MOUSEOUT = 8,
+ MOUSEMOVE = 16,
+ MOUSEDRAG = 32,
+ CLICK = 64,
+ DBLCLICK = 128,
+ KEYDOWN = 256,
+ KEYUP = 512,
+ KEYPRESS = 1024,
+ DRAGDROP = 2048,
+ FOCUS = 4096,
+ BLUR = 8192,
+ SELECT = 16384,
+ CHANGE = 32768
+ };
+
+ static PassRefPtr<Event> create()
+ {
+ return adoptRef(new Event);
+ }
+ static PassRefPtr<Event> create(const AtomicString& type, bool canBubble, bool cancelable)
+ {
+ return adoptRef(new Event(type, canBubble, cancelable));
+ }
+ virtual ~Event();
+
+ void initEvent(const AtomicString& type, bool canBubble, bool cancelable);
+
+ const AtomicString& type() const { return m_type; }
+
+ EventTarget* target() const { return m_target.get(); }
+ void setTarget(PassRefPtr<EventTarget>);
+
+ EventTarget* currentTarget() const { return m_currentTarget; }
+ void setCurrentTarget(EventTarget* currentTarget) { m_currentTarget = currentTarget; }
+
+ unsigned short eventPhase() const { return m_eventPhase; }
+ void setEventPhase(unsigned short eventPhase) { m_eventPhase = eventPhase; }
+
+ bool bubbles() const { return m_canBubble; }
+ bool cancelable() const { return m_cancelable; }
+ DOMTimeStamp timeStamp() const { return m_createTime; }
+ void stopPropagation() { m_propagationStopped = true; }
+
+ // IE Extensions
+ EventTarget* srcElement() const { return target(); } // MSIE extension - "the object that fired the event"
+
+ bool returnValue() const { return !defaultPrevented(); }
+ void setReturnValue(bool returnValue) { setDefaultPrevented(!returnValue); }
+
+ Clipboard* clipboardData() const { return isClipboardEvent() ? clipboard() : 0; }
+
+ virtual bool isUIEvent() const;
+ virtual bool isMouseEvent() const;
+ virtual bool isMutationEvent() const;
+ virtual bool isKeyboardEvent() const;
+ virtual bool isTextEvent() const;
+ virtual bool isDragEvent() const; // a subset of mouse events
+ virtual bool isClipboardEvent() const;
+ virtual bool isMessageEvent() const;
+ virtual bool isWheelEvent() const;
+ virtual bool isBeforeTextInsertedEvent() const;
+ virtual bool isOverflowEvent() const;
+ virtual bool isProgressEvent() const;
+ virtual bool isXMLHttpRequestProgressEvent() const;
+ virtual bool isWebKitAnimationEvent() const;
+ virtual bool isWebKitTransitionEvent() const;
+#if ENABLE(SVG)
+ virtual bool isSVGZoomEvent() const;
+#endif
+#if ENABLE(DOM_STORAGE)
+ virtual bool isStorageEvent() const;
+#endif
+
+#if ENABLE(TOUCH_EVENTS)
+ virtual bool isTouchEvent() const;
+ virtual bool isGestureEvent() const;
+#endif
+
+ bool propagationStopped() const { return m_propagationStopped; }
+
+ bool defaultPrevented() const { return m_defaultPrevented; }
+ void preventDefault() { if (m_cancelable) m_defaultPrevented = true; }
+ void setDefaultPrevented(bool defaultPrevented) { m_defaultPrevented = defaultPrevented; }
+
+ bool defaultHandled() const { return m_defaultHandled; }
+ void setDefaultHandled() { m_defaultHandled = true; }
+
+ bool cancelBubble() const { return m_cancelBubble; }
+ void setCancelBubble(bool cancel) { m_cancelBubble = cancel; }
+
+ Event* underlyingEvent() const { return m_underlyingEvent.get(); }
+ void setUnderlyingEvent(PassRefPtr<Event>);
+
+ virtual bool storesResultAsString() const;
+ virtual void storeResult(const String&);
+
+ virtual Clipboard* clipboard() const { return 0; }
+
+ protected:
+ Event();
+ Event(const AtomicString& type, bool canBubble, bool cancelable);
+
+ virtual void receivedTarget();
+ bool dispatched() const { return m_target; }
+
+ private:
+ AtomicString m_type;
+ bool m_canBubble;
+ bool m_cancelable;
+
+ bool m_propagationStopped;
+ bool m_defaultPrevented;
+ bool m_defaultHandled;
+ bool m_cancelBubble;
+
+ EventTarget* m_currentTarget;
+ unsigned short m_eventPhase;
+ RefPtr<EventTarget> m_target;
+ DOMTimeStamp m_createTime;
+
+ RefPtr<Event> m_underlyingEvent;
+ };
+
+} // namespace WebCore
+
+#endif // Event_h
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef EventException_h
+#define EventException_h
+
+#include "ExceptionBase.h"
+
+namespace WebCore {
+
+ class EventException : public ExceptionBase {
+ public:
+ static PassRefPtr<EventException> create(const ExceptionCodeDescription& description)
+ {
+ return adoptRef(new EventException(description));
+ }
+
+ static const int EventExceptionOffset = 100;
+ static const int EventExceptionMax = 199;
+
+ enum EventExceptionCode {
+ UNSPECIFIED_EVENT_TYPE_ERR = EventExceptionOffset
+ };
+
+ private:
+ EventException(const ExceptionCodeDescription& description)
+ : ExceptionBase(description)
+ {
+ }
+ };
+
+} // namespace WebCore
+
+#endif // EventException_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef EventHandler_h
+#define EventHandler_h
+
+#include "DragActions.h"
+#include "FocusDirection.h"
+#include "PlatformMouseEvent.h"
+#include "ScrollTypes.h"
+#include "Timer.h"
+#include <wtf/Forward.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/Platform.h>
+#include <wtf/RefPtr.h>
+
+#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
+
+#if PLATFORM(MAC)
+#include "WebCoreKeyboardUIMode.h"
+#ifndef __OBJC__
+class NSEvent;
+class NSView;
+#endif
+#endif
+
+#ifdef __OBJC__
+@class WAKView;
+#endif
+
+namespace WebCore {
+
+class AtomicString;
+class Clipboard;
+class Cursor;
+class EventTargetNode;
+class Event;
+class FloatPoint;
+class FloatRect;
+class Frame;
+class HitTestResult;
+class HTMLFrameSetElement;
+class KeyboardEvent;
+class MouseEventWithHitTestResults;
+class Node;
+class PlatformKeyboardEvent;
+class PlatformWheelEvent;
+class RenderLayer;
+class RenderObject;
+class RenderWidget;
+class Scrollbar;
+class String;
+class SVGElementInstance;
+class TextEvent;
+class VisiblePosition;
+class Widget;
+#if ENABLE(TOUCH_EVENTS)
+class PlatformTouchEvent;
+class Touch;
+class EventTarget;
+#endif
+
+struct HitTestRequest;
+
+extern const int LinkDragHysteresis;
+extern const int ImageDragHysteresis;
+extern const int TextDragHysteresis;
+extern const int GeneralDragHysteresis;
+#if ENABLE(TOUCH_EVENTS)
+extern const float GestureUnknown;
+#endif
+
+class EventHandler : Noncopyable {
+public:
+ EventHandler(Frame*);
+ ~EventHandler();
+
+ void clear();
+
+ void updateSelectionForMouseDrag();
+
+ Node* mousePressNode() const;
+ void setMousePressNode(PassRefPtr<Node>);
+
+ bool panScrollInProgress() { return m_panScrollInProgress; }
+ void setPanScrollInProgress(bool inProgress) { m_panScrollInProgress = inProgress; }
+
+ void stopAutoscrollTimer(bool rendererIsBeingDestroyed = false);
+ RenderObject* autoscrollRenderer() const;
+ void updateAutoscrollRenderer();
+
+ HitTestResult hitTestResultAtPoint(const IntPoint&, bool allowShadowContent);
+
+ bool mousePressed() const { return m_mousePressed; }
+ void setMousePressed(bool pressed) { m_mousePressed = pressed; }
+
+ void setCapturingMouseEventsNode(PassRefPtr<Node>);
+
+ bool updateDragAndDrop(const PlatformMouseEvent&, Clipboard*);
+ void cancelDragAndDrop(const PlatformMouseEvent&, Clipboard*);
+ bool performDragAndDrop(const PlatformMouseEvent&, Clipboard*);
+
+ void scheduleHoverStateUpdate();
+
+ void setResizingFrameSet(HTMLFrameSetElement*);
+
+ void resizeLayerDestroyed();
+
+ IntPoint currentMousePosition() const;
+
+ void setIgnoreWheelEvents(bool);
+
+ bool scrollOverflow(ScrollDirection, ScrollGranularity);
+
+ bool shouldDragAutoNode(Node*, const IntPoint&) const; // -webkit-user-drag == auto
+
+ bool tabsToLinks(KeyboardEvent*) const;
+ bool tabsToAllControls(KeyboardEvent*) const;
+
+ bool mouseDownMayStartSelect() const { return m_mouseDownMayStartSelect; }
+
+ bool mouseMoved(const PlatformMouseEvent&);
+
+ bool handleMousePressEvent(const PlatformMouseEvent&);
+ bool handleMouseMoveEvent(const PlatformMouseEvent&, HitTestResult* hoveredNode = 0);
+ bool handleMouseReleaseEvent(const PlatformMouseEvent&);
+ bool handleWheelEvent(PlatformWheelEvent&);
+
+#if ENABLE(TOUCH_EVENTS)
+ typedef HashSet< RefPtr<Touch> > TouchSet;
+ typedef HashMap< EventTarget*, TouchSet* > EventTargetTouchMap;
+ typedef HashSet< RefPtr<EventTarget> > EventTargetSet;
+
+ void dispatchTouchEvent(const PlatformTouchEvent&, const AtomicString&, const EventTargetTouchMap&, float, float);
+ void dispatchGestureEvent(const PlatformTouchEvent&, const AtomicString&, const EventTargetSet&, float, float);
+ void handleTouchEvent(const PlatformTouchEvent&);
+#endif
+
+ bool sendContextMenuEvent(const PlatformMouseEvent&);
+
+ void setMouseDownMayStartAutoscroll() { m_mouseDownMayStartAutoscroll = true; }
+
+ bool needsKeyboardEventDisambiguationQuirks() const;
+
+ static unsigned accessKeyModifiers();
+ bool handleAccessKey(const PlatformKeyboardEvent&);
+ bool keyEvent(const PlatformKeyboardEvent&);
+ void defaultKeyboardEventHandler(KeyboardEvent*);
+
+ bool handleTextInputEvent(const String& text, Event* underlyingEvent = 0,
+ bool isLineBreak = false, bool isBackTab = false);
+ void defaultTextInputEventHandler(TextEvent*);
+
+
+ void focusDocumentView();
+
+ void capsLockStateMayHaveChanged();
+
+ unsigned pendingFrameUnloadEventCount();
+ void addPendingFrameUnloadEventCount();
+ void removePendingFrameUnloadEventCount();
+ void clearPendingFrameUnloadEventCount();
+ unsigned pendingFrameBeforeUnloadEventCount();
+ void addPendingFrameBeforeUnloadEventCount();
+ void removePendingFrameBeforeUnloadEventCount();
+ void clearPendingFrameBeforeUnloadEventCount();
+
+#if PLATFORM(MAC)
+ PassRefPtr<KeyboardEvent> currentKeyboardEvent() const;
+
+ void mouseDown(GSEventRef);
+ void mouseDragged(GSEventRef);
+ void mouseUp(GSEventRef);
+ void mouseMoved(GSEventRef);
+ bool keyEvent(GSEventRef);
+ bool wheelEvent(GSEventRef);
+
+#if ENABLE(TOUCH_EVENTS)
+ void touchEvent(GSEventRef);
+#endif
+
+ void sendFakeEventsAfterWidgetTracking(GSEventRef initiatingEvent);
+
+#endif
+
+ void invalidateClick();
+
+private:
+ struct EventHandlerDragState {
+ RefPtr<Node> m_dragSrc; // element that may be a drag source, for the current mouse gesture
+ bool m_dragSrcIsLink;
+ bool m_dragSrcIsImage;
+ bool m_dragSrcInSelection;
+ bool m_dragSrcMayBeDHTML;
+ bool m_dragSrcMayBeUA; // Are DHTML and/or the UserAgent allowed to drag out?
+ bool m_dragSrcIsDHTML;
+ };
+ static EventHandlerDragState& dragState();
+ static const double TextDragDelay;
+
+
+ bool eventActivatedView(const PlatformMouseEvent&) const;
+ void selectClosestWordFromMouseEvent(const MouseEventWithHitTestResults& event);
+ void selectClosestWordOrLinkFromMouseEvent(const MouseEventWithHitTestResults& event);
+
+ bool handleMouseDoubleClickEvent(const PlatformMouseEvent&);
+
+ bool handleMousePressEvent(const MouseEventWithHitTestResults&);
+ bool handleMousePressEventSingleClick(const MouseEventWithHitTestResults&);
+ bool handleMousePressEventDoubleClick(const MouseEventWithHitTestResults&);
+ bool handleMousePressEventTripleClick(const MouseEventWithHitTestResults&);
+ bool handleMouseDraggedEvent(const MouseEventWithHitTestResults&);
+ bool handleMouseReleaseEvent(const MouseEventWithHitTestResults&);
+
+ void handleKeyboardSelectionMovement(KeyboardEvent*);
+
+ Cursor selectCursor(const MouseEventWithHitTestResults&, Scrollbar*);
+ void setPanScrollCursor();
+
+ void hoverTimerFired(Timer<EventHandler>*);
+
+ static bool canMouseDownStartSelect(Node*);
+ static bool canMouseDragExtendSelect(Node*);
+
+ void handleAutoscroll(RenderObject*);
+ void startAutoscrollTimer();
+ void setAutoscrollRenderer(RenderObject*);
+ void autoscrollTimerFired(Timer<EventHandler>*);
+
+
+ Node* nodeUnderMouse() const;
+
+ void updateMouseEventTargetNode(Node*, const PlatformMouseEvent&, bool fireMouseOverOut);
+ void fireMouseOverOut(bool fireMouseOver = true, bool fireMouseOut = true, bool updateLastNodeUnderMouse = true);
+
+ MouseEventWithHitTestResults prepareMouseEvent(const HitTestRequest&, const PlatformMouseEvent&);
+
+ bool dispatchMouseEvent(const AtomicString& eventType, Node* target, bool cancelable, int clickCount, const PlatformMouseEvent&, bool setUnder);
+ bool dispatchDragEvent(const AtomicString& eventType, Node* target, const PlatformMouseEvent&, Clipboard*);
+
+
+ bool handleMouseUp(const MouseEventWithHitTestResults&);
+ void clearDragState();
+
+ bool dispatchDragSrcEvent(const AtomicString& eventType, const PlatformMouseEvent&);
+
+ bool dragHysteresisExceeded(const FloatPoint&) const;
+ bool dragHysteresisExceeded(const IntPoint&) const;
+
+ bool passMousePressEventToSubframe(MouseEventWithHitTestResults&, Frame* subframe);
+ bool passMouseMoveEventToSubframe(MouseEventWithHitTestResults&, Frame* subframe, HitTestResult* hoveredNode = 0);
+ bool passMouseReleaseEventToSubframe(MouseEventWithHitTestResults&, Frame* subframe);
+
+ bool passSubframeEventToSubframe(MouseEventWithHitTestResults&, Frame* subframe, HitTestResult* hoveredNode = 0);
+
+ bool passMousePressEventToScrollbar(MouseEventWithHitTestResults&, Scrollbar*);
+
+ bool passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults&);
+ bool passWidgetMouseDownEventToWidget(RenderWidget*);
+
+ bool passMouseDownEventToWidget(Widget*);
+ bool passWheelEventToWidget(PlatformWheelEvent&, Widget*);
+
+ void defaultSpaceEventHandler(KeyboardEvent*);
+ void defaultTabEventHandler(KeyboardEvent*);
+
+ void allowDHTMLDrag(bool& flagDHTML, bool& flagUA) const;
+
+ // The following are called at the beginning of handleMouseUp and handleDrag.
+ // If they return true it indicates that they have consumed the event.
+#if PLATFORM(MAC)
+ bool eventLoopHandleMouseUp(const MouseEventWithHitTestResults&);
+ bool eventLoopHandleMouseDragged(const MouseEventWithHitTestResults&);
+ NSView *mouseDownViewIfStillGood();
+#else
+ bool eventLoopHandleMouseUp(const MouseEventWithHitTestResults&) { return false; }
+ bool eventLoopHandleMouseDragged(const MouseEventWithHitTestResults&) { return false; }
+#endif
+
+ bool invertSenseOfTabsToLinks(KeyboardEvent*) const;
+
+ void updateSelectionForMouseDrag(Node* targetNode, const IntPoint& localPoint);
+
+ Frame* m_frame;
+
+ bool m_mousePressed;
+ RefPtr<Node> m_mousePressNode;
+
+ bool m_mouseDownMayStartSelect;
+ bool m_mouseDownMayStartDrag;
+ bool m_mouseDownWasSingleClickInSelection;
+ bool m_beganSelectingText;
+
+ IntPoint m_dragStartPos;
+
+ IntPoint m_panScrollStartPos;
+ bool m_panScrollInProgress;
+
+ Timer<EventHandler> m_hoverTimer;
+
+ Timer<EventHandler> m_autoscrollTimer;
+ RenderObject* m_autoscrollRenderer;
+ bool m_autoscrollInProgress;
+ bool m_mouseDownMayStartAutoscroll;
+ bool m_mouseDownWasInSubframe;
+#if ENABLE(SVG)
+ bool m_svgPan;
+ RefPtr<SVGElementInstance> m_instanceUnderMouse;
+ RefPtr<SVGElementInstance> m_lastInstanceUnderMouse;
+#endif
+
+ RenderLayer* m_resizeLayer;
+
+ RefPtr<Node> m_capturingMouseEventsNode;
+
+ RefPtr<Node> m_nodeUnderMouse;
+ RefPtr<Node> m_lastNodeUnderMouse;
+ RefPtr<Frame> m_lastMouseMoveEventSubframe;
+ RefPtr<Scrollbar> m_lastScrollbarUnderMouse;
+
+ int m_clickCount;
+ RefPtr<Node> m_clickNode;
+#if ENABLE(TOUCH_EVENTS)
+ float m_gestureInitialDiameter;
+ float m_gestureLastDiameter;
+ float m_gestureInitialRotation;
+ float m_gestureLastRotation;
+ unsigned m_firstTouchID;
+ HashMap< unsigned, RefPtr<Touch> > m_touchesByID;
+ EventTargetSet m_gestureTargets;
+#endif
+
+ RefPtr<Node> m_dragTarget;
+
+ RefPtr<HTMLFrameSetElement> m_frameSetBeingResized;
+
+ IntSize m_offsetFromResizeCorner; // in the coords of m_resizeLayer
+
+ IntPoint m_currentMousePosition;
+ IntPoint m_mouseDownPos; // in our view's coords
+ double m_mouseDownTimestamp;
+ PlatformMouseEvent m_mouseDown;
+
+ unsigned m_pendingFrameUnloadEventCount;
+ unsigned m_pendingFrameBeforeUnloadEventCount;
+
+#if PLATFORM(MAC)
+ NSView *m_mouseDownView;
+ bool m_sendingEventToSubview;
+#endif
+
+};
+
+} // namespace WebCore
+
+#endif // EventHandler_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef EventListener_h
+#define EventListener_h
+
+#include <wtf/RefCounted.h>
+
+namespace JSC {
+ class JSObject;
+}
+
+namespace WebCore {
+
+ class Event;
+
+ class EventListener : public RefCounted<EventListener> {
+ public:
+ virtual ~EventListener() { }
+ virtual void handleEvent(Event*, bool isWindowEvent = false) = 0;
+ virtual bool wasCreatedFromMarkup() const { return false; }
+
+#if USE(JSC)
+ virtual JSC::JSObject* function() const { return 0; }
+ virtual void mark() { }
+#endif
+
+ bool isInline() const { return virtualIsInline(); }
+
+ private:
+ virtual bool virtualIsInline() const { return false; }
+ };
+
+ inline void markIfNotNull(EventListener* listener) { if (listener) listener->mark(); }
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef EventLoop_h
+#define EventLoop_h
+
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+ class EventLoop : Noncopyable {
+ public:
+ EventLoop()
+ : m_ended(false)
+ {
+ }
+
+ void cycle();
+ bool ended() const { return m_ended; }
+
+ private:
+ bool m_ended;
+ };
+
+} // namespace WebCore
+
+#endif // EventLoop_h
--- /dev/null
+/*
+ * Copyright (C) 2005, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Jon Shier (jshier@iastate.edu)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef EventNames_h
+#define EventNames_h
+
+#include "AtomicString.h"
+#include "ThreadGlobalData.h"
+
+namespace WebCore {
+
+// IPHONE: Added orientationchange, touchstart, touchmove, touchend, touchcancel, gesturestart, gesturechange, gestureend to original list
+#define DOM_EVENT_NAMES_FOR_EACH(macro) \
+ \
+ macro(abort) \
+ macro(beforecopy) \
+ macro(beforecut) \
+ macro(beforepaste) \
+ macro(beforeunload) \
+ macro(blur) \
+ macro(cached) \
+ macro(change) \
+ macro(checking) \
+ macro(click) \
+ macro(close) \
+ macro(contextmenu) \
+ macro(copy) \
+ macro(cut) \
+ macro(dblclick) \
+ macro(downloading) \
+ macro(drag) \
+ macro(dragend) \
+ macro(dragenter) \
+ macro(dragleave) \
+ macro(dragover) \
+ macro(dragstart) \
+ macro(drop) \
+ macro(error) \
+ macro(focus) \
+ macro(input) \
+ macro(keydown) \
+ macro(keypress) \
+ macro(keyup) \
+ macro(load) \
+ macro(loadstart) \
+ macro(message) \
+ macro(mousedown) \
+ macro(mousemove) \
+ macro(mouseout) \
+ macro(mouseover) \
+ macro(mouseup) \
+ macro(mousewheel) \
+ macro(noupdate) \
+ macro(obsolete) \
+ macro(offline) \
+ macro(online) \
+ macro(orientationchange) \
+ macro(touchstart) \
+ macro(touchmove) \
+ macro(touchend) \
+ macro(touchcancel) \
+ macro(gesturestart) \
+ macro(gesturechange) \
+ macro(gestureend) \
+ macro(overflowchanged) \
+ macro(paste) \
+ macro(readystatechange) \
+ macro(reset) \
+ macro(resize) \
+ macro(scroll) \
+ macro(search) \
+ macro(select) \
+ macro(selectstart) \
+ macro(storage) \
+ macro(submit) \
+ macro(textInput) \
+ macro(unload) \
+ macro(updateready) \
+ macro(zoom) \
+ \
+ macro(DOMActivate) \
+ macro(DOMAttrModified) \
+ macro(DOMCharacterDataModified) \
+ macro(DOMFocusIn) \
+ macro(DOMFocusOut) \
+ macro(DOMNodeInserted) \
+ macro(DOMNodeInsertedIntoDocument) \
+ macro(DOMNodeRemoved) \
+ macro(DOMNodeRemovedFromDocument) \
+ macro(DOMSubtreeModified) \
+ macro(DOMContentLoaded) \
+ \
+ macro(webkitBeforeTextInserted) \
+ macro(webkitEditableContentChanged) \
+ \
+ macro(canplay) \
+ macro(canplaythrough) \
+ macro(durationchange) \
+ macro(emptied) \
+ macro(ended) \
+ macro(loadeddata) \
+ macro(loadedmetadata) \
+ macro(pause) \
+ macro(play) \
+ macro(playing) \
+ macro(ratechange) \
+ macro(seeked) \
+ macro(seeking) \
+ macro(timeupdate) \
+ macro(volumechange) \
+ macro(waiting) \
+ \
+ macro(progress) \
+ macro(stalled) \
+ macro(suspend) \
+ \
+ macro(webkitAnimationEnd) \
+ macro(webkitAnimationStart) \
+ macro(webkitAnimationIteration) \
+ \
+ macro(webkitTransitionEnd) \
+ \
+// end of DOM_EVENT_NAMES_FOR_EACH
+
+
+ class EventNames {
+ int dummy; // Needed to make initialization macro work.
+
+ public:
+ EventNames();
+
+ #define DOM_EVENT_NAMES_DECLARE(name) AtomicString name##Event;
+ DOM_EVENT_NAMES_FOR_EACH(DOM_EVENT_NAMES_DECLARE)
+ #undef DOM_EVENT_NAMES_DECLARE
+ };
+
+ inline EventNames& eventNames()
+ {
+ return threadGlobalData().eventNames();
+ }
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
+ * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef EventTarget_h
+#define EventTarget_h
+
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+ class AtomicString;
+ class DOMApplicationCache;
+ class Event;
+ class EventListener;
+ class EventTargetNode;
+ class MessagePort;
+ class ScriptExecutionContext;
+ class SVGElementInstance;
+ class Worker;
+ class WorkerContext;
+ class XMLHttpRequest;
+ class XMLHttpRequestUpload;
+
+ typedef int ExceptionCode;
+
+ class EventTarget {
+ public:
+ virtual MessagePort* toMessagePort();
+ virtual EventTargetNode* toNode();
+ virtual XMLHttpRequest* toXMLHttpRequest();
+ virtual XMLHttpRequestUpload* toXMLHttpRequestUpload();
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+ virtual DOMApplicationCache* toDOMApplicationCache();
+#endif
+#if ENABLE(SVG)
+ virtual SVGElementInstance* toSVGElementInstance();
+#endif
+#if ENABLE(WORKERS)
+ virtual Worker* toWorker();
+ virtual WorkerContext* toWorkerContext();
+#endif
+
+ virtual ScriptExecutionContext* scriptExecutionContext() const = 0;
+
+ virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture) = 0;
+ virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture) = 0;
+ virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&) = 0;
+
+ void ref() { refEventTarget(); }
+ void deref() { derefEventTarget(); }
+
+ // Handlers to do/undo actions on the target node before an event is dispatched to it and after the event
+ // has been dispatched. The data pointer is handed back by the preDispatch and passed to postDispatch.
+ virtual void* preDispatchEventHandler(Event*) { return 0; }
+ virtual void postDispatchEventHandler(Event*, void* /*dataFromPreDispatch*/) { }
+
+ protected:
+ virtual ~EventTarget();
+
+ private:
+ virtual void refEventTarget() = 0;
+ virtual void derefEventTarget() = 0;
+ };
+
+ void forbidEventDispatch();
+ void allowEventDispatch();
+
+#ifndef NDEBUG
+ bool eventDispatchForbidden();
+#else
+ inline void forbidEventDispatch() { }
+ inline void allowEventDispatch() { }
+#endif
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef EventTargetNode_h
+#define EventTargetNode_h
+
+#include "EventTarget.h"
+#include "Node.h"
+
+namespace WebCore {
+
+class Attribute;
+class Frame;
+class RegisteredEventListener;
+
+typedef Vector<RefPtr<RegisteredEventListener> > RegisteredEventListenerVector;
+
+class EventTargetNode : public Node, public EventTarget {
+public:
+ EventTargetNode(Document*, bool isElement = false, bool isContainer = false, bool isText = false);
+ virtual ~EventTargetNode();
+
+ virtual bool isEventTargetNode() const { return true; }
+ virtual EventTargetNode* toNode() { return this; }
+
+ virtual ScriptExecutionContext* scriptExecutionContext() const;
+
+ virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture);
+ virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture);
+ virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&);
+ void removeAllEventListeners();
+
+ void setInlineEventListenerForType(const AtomicString& eventType, PassRefPtr<EventListener>);
+ void setInlineEventListenerForTypeAndAttribute(const AtomicString& eventType, Attribute*);
+ void removeInlineEventListenerForType(const AtomicString& eventType);
+ bool dispatchEventForType(const AtomicString& eventType, bool canBubble, bool cancelable);
+ EventListener* inlineEventListenerForType(const AtomicString& eventType) const;
+
+ bool dispatchSubtreeModifiedEvent();
+ void dispatchWindowEvent(PassRefPtr<Event>);
+ void dispatchWindowEvent(const AtomicString& eventType, bool canBubble, bool cancelable);
+ bool dispatchUIEvent(const AtomicString& eventType, int detail = 0, PassRefPtr<Event> underlyingEvent = 0);
+ bool dispatchKeyEvent(const PlatformKeyboardEvent&);
+ void dispatchWheelEvent(PlatformWheelEvent&);
+ bool dispatchMouseEvent(const PlatformMouseEvent&, const AtomicString& eventType,
+ int clickCount = 0, Node* relatedTarget = 0);
+ bool dispatchMouseEvent(const AtomicString& eventType, int button, int clickCount,
+ int pageX, int pageY, int screenX, int screenY,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
+ bool isSimulated = false, Node* relatedTarget = 0, PassRefPtr<Event> underlyingEvent = 0);
+ void dispatchSimulatedMouseEvent(const AtomicString& eventType, PassRefPtr<Event> underlyingEvent = 0);
+ void dispatchSimulatedClick(PassRefPtr<Event> underlyingEvent, bool sendMouseEvents = false, bool showPressedLook = true);
+ bool dispatchProgressEvent(const AtomicString &eventType, bool lengthComputableArg, unsigned loadedArg, unsigned totalArg);
+ void dispatchStorageEvent(const AtomicString &eventType, const String& key, const String& oldValue, const String& newValue, Frame* source);
+ bool dispatchWebKitAnimationEvent(const AtomicString& eventType, const String& animationName, double elapsedTime);
+ bool dispatchWebKitTransitionEvent(const AtomicString& eventType, const String& propertyName, double elapsedTime);
+ bool dispatchGenericEvent(PassRefPtr<Event>);
+
+ virtual void handleLocalEvents(Event*, bool useCapture);
+
+ virtual void dispatchFocusEvent();
+ virtual void dispatchBlurEvent();
+
+ virtual void insertedIntoDocument();
+ virtual void removedFromDocument();
+ virtual void willMoveToNewOwnerDocument();
+ virtual void didMoveToNewOwnerDocument();
+
+ /**
+ * Perform the default action for an event e.g. submitting a form
+ */
+ virtual void defaultEventHandler(Event*);
+
+ /**
+ * Used for disabled form elements; if true, prevents mouse events from being dispatched
+ * to event listeners, and prevents DOMActivate events from being sent at all.
+ */
+ virtual bool disabled() const;
+
+ virtual bool willRespondToMouseMoveEvents();
+ virtual bool willRespondToMouseWheelEvents();
+ virtual bool willRespondToMouseClickEvents();
+
+ const RegisteredEventListenerVector& eventListeners() const;
+
+ EventListener* onabort() const;
+ void setOnabort(PassRefPtr<EventListener>);
+ EventListener* onblur() const;
+ void setOnblur(PassRefPtr<EventListener>);
+ EventListener* onchange() const;
+ void setOnchange(PassRefPtr<EventListener>);
+ EventListener* onclick() const;
+ void setOnclick(PassRefPtr<EventListener>);
+ EventListener* oncontextmenu() const;
+ void setOncontextmenu(PassRefPtr<EventListener>);
+ EventListener* ondblclick() const;
+ void setOndblclick(PassRefPtr<EventListener>);
+ EventListener* onerror() const;
+ void setOnerror(PassRefPtr<EventListener>);
+ EventListener* onfocus() const;
+ void setOnfocus(PassRefPtr<EventListener>);
+ EventListener* oninput() const;
+ void setOninput(PassRefPtr<EventListener>);
+ EventListener* onkeydown() const;
+ void setOnkeydown(PassRefPtr<EventListener>);
+ EventListener* onkeypress() const;
+ void setOnkeypress(PassRefPtr<EventListener>);
+ EventListener* onkeyup() const;
+ void setOnkeyup(PassRefPtr<EventListener>);
+ EventListener* onload() const;
+ void setOnload(PassRefPtr<EventListener>);
+ EventListener* onmousedown() const;
+ void setOnmousedown(PassRefPtr<EventListener>);
+ EventListener* onmousemove() const;
+ void setOnmousemove(PassRefPtr<EventListener>);
+ EventListener* onmouseout() const;
+ void setOnmouseout(PassRefPtr<EventListener>);
+ EventListener* onmouseover() const;
+ void setOnmouseover(PassRefPtr<EventListener>);
+ EventListener* onmouseup() const;
+ void setOnmouseup(PassRefPtr<EventListener>);
+ EventListener* onmousewheel() const;
+ void setOnmousewheel(PassRefPtr<EventListener>);
+ EventListener* onbeforecut() const;
+ void setOnbeforecut(PassRefPtr<EventListener>);
+ EventListener* oncut() const;
+ void setOncut(PassRefPtr<EventListener>);
+ EventListener* onbeforecopy() const;
+ void setOnbeforecopy(PassRefPtr<EventListener>);
+ EventListener* oncopy() const;
+ void setOncopy(PassRefPtr<EventListener>);
+ EventListener* onbeforepaste() const;
+ void setOnbeforepaste(PassRefPtr<EventListener>);
+ EventListener* onpaste() const;
+ void setOnpaste(PassRefPtr<EventListener>);
+ EventListener* ondragenter() const;
+ void setOndragenter(PassRefPtr<EventListener>);
+ EventListener* ondragover() const;
+ void setOndragover(PassRefPtr<EventListener>);
+ EventListener* ondragleave() const;
+ void setOndragleave(PassRefPtr<EventListener>);
+ EventListener* ondrop() const;
+ void setOndrop(PassRefPtr<EventListener>);
+ EventListener* ondragstart() const;
+ void setOndragstart(PassRefPtr<EventListener>);
+ EventListener* ondrag() const;
+ void setOndrag(PassRefPtr<EventListener>);
+ EventListener* ondragend() const;
+ void setOndragend(PassRefPtr<EventListener>);
+ EventListener* onreset() const;
+ void setOnreset(PassRefPtr<EventListener>);
+ EventListener* onresize() const;
+ void setOnresize(PassRefPtr<EventListener>);
+ EventListener* onscroll() const;
+ void setOnscroll(PassRefPtr<EventListener>);
+ EventListener* onsearch() const;
+ void setOnsearch(PassRefPtr<EventListener>);
+ EventListener* onselect() const;
+ void setOnselect(PassRefPtr<EventListener>);
+ EventListener* onselectstart() const;
+ void setOnselectstart(PassRefPtr<EventListener>);
+ EventListener* onsubmit() const;
+ void setOnsubmit(PassRefPtr<EventListener>);
+ EventListener* onunload() const;
+ void setOnunload(PassRefPtr<EventListener>);
+ EventListener* onorientationchange() const;
+ void setOnorientationchange(PassRefPtr<EventListener>);
+#if ENABLE(TOUCH_EVENTS)
+ EventListener* ontouchstart() const;
+ void setOntouchstart(PassRefPtr<EventListener>);
+ EventListener* ontouchmove() const;
+ void setOntouchmove(PassRefPtr<EventListener>);
+ EventListener* ontouchend() const;
+ void setOntouchend(PassRefPtr<EventListener>);
+ EventListener* ontouchcancel() const;
+ void setOntouchcancel(PassRefPtr<EventListener>);
+ EventListener* ongesturestart() const;
+ void setOngesturestart(PassRefPtr<EventListener>);
+ EventListener* ongesturechange() const;
+ void setOngesturechange(PassRefPtr<EventListener>);
+ EventListener* ongestureend() const;
+ void setOngestureend(PassRefPtr<EventListener>);
+#endif
+
+ using Node::ref;
+ using Node::deref;
+
+private:
+ virtual void refEventTarget() { ref(); }
+ virtual void derefEventTarget() { deref(); }
+};
+
+inline EventTargetNode* EventTargetNodeCast(Node* n)
+{
+ ASSERT(n->isEventTargetNode());
+ return static_cast<EventTargetNode*>(n);
+}
+
+inline const EventTargetNode* EventTargetNodeCast(const Node* n)
+{
+ ASSERT(n->isEventTargetNode());
+ return static_cast<const EventTargetNode*>(n);
+}
+
+} // namespace WebCore
+
+#endif // EventTargetNode_h
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ExceptionBase_h
+#define ExceptionBase_h
+
+#include "ExceptionCode.h"
+#include "PlatformString.h"
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+ class ExceptionBase : public RefCounted<ExceptionBase> {
+ public:
+ unsigned short code() const { return m_code; }
+ String name() const { return m_name; }
+ String message() const { return m_message; }
+
+ String toString() const;
+
+ protected:
+ ExceptionBase(const ExceptionCodeDescription&);
+
+ private:
+ unsigned short m_code;
+ String m_name;
+ String m_message;
+ };
+
+} // namespace WebCore
+
+#endif // ExceptionBase_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef ExceptionCode_h
+#define ExceptionCode_h
+
+namespace WebCore {
+
+ // The DOM standards use unsigned short for exception codes.
+ // In our DOM implementation we use int instead, and use different
+ // numerical ranges for different types of DOM exception, so that
+ // an exception of any type can be expressed with a single integer.
+ typedef int ExceptionCode;
+
+ enum {
+ INDEX_SIZE_ERR = 1,
+ DOMSTRING_SIZE_ERR = 2,
+ HIERARCHY_REQUEST_ERR = 3,
+ WRONG_DOCUMENT_ERR = 4,
+ INVALID_CHARACTER_ERR = 5,
+ NO_DATA_ALLOWED_ERR = 6,
+ NO_MODIFICATION_ALLOWED_ERR = 7,
+ NOT_FOUND_ERR = 8,
+ NOT_SUPPORTED_ERR = 9,
+ INUSE_ATTRIBUTE_ERR = 10,
+
+ // Introduced in DOM Level 2:
+ INVALID_STATE_ERR = 11,
+ SYNTAX_ERR = 12,
+ INVALID_MODIFICATION_ERR = 13,
+ NAMESPACE_ERR = 14,
+ INVALID_ACCESS_ERR = 15,
+
+ // Introduced in DOM Level 3:
+ VALIDATION_ERR = 16,
+ TYPE_MISMATCH_ERR = 17,
+
+ // XMLHttpRequest extension:
+ SECURITY_ERR = 18,
+
+ // Introduced in HTML5:
+ NETWORK_ERR = 19,
+ ABORT_ERR = 20,
+ URL_MISMATCH_ERR = 21,
+ QUOTA_EXCEEDED_ERR = 22
+ };
+
+ enum ExceptionType {
+ DOMExceptionType,
+ RangeExceptionType,
+ EventExceptionType,
+ XMLHttpRequestExceptionType
+#if ENABLE(XPATH)
+ , XPathExceptionType
+#endif
+#if ENABLE(SVG)
+ , SVGExceptionType
+#endif
+ };
+
+
+ struct ExceptionCodeDescription {
+ const char* typeName; // has spaces and is suitable for use in exception description strings; maximum length is 10 characters
+ const char* name; // exception name, also intended for use in exception description strings; 0 if name not known; maximum length is 27 characters
+ int code; // numeric value of the exception within a particular type
+ ExceptionType type;
+ };
+ void getExceptionCodeDescription(ExceptionCode, ExceptionCodeDescription&);
+
+} // namespace WebCore
+
+#endif // ExceptionCode_h
--- /dev/null
+/*
+ * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ExceptionHandlers_h
+#define ExceptionHandlers_h
+
+#include <wtf/Assertions.h>
+
+#if !defined(NDEBUG) && !defined(DISABLE_THREAD_CHECK)
+#define DOM_ASSERT_MAIN_THREAD() do \
+ if (!pthread_main_np()) { \
+ WTFReportAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, "DOM access on non-main thread -- you will probably crash soon!"); \
+ } \
+while (0)
+#else
+#define DOM_ASSERT_MAIN_THREAD() ((void)0)
+#endif
+
+namespace WebCore {
+
+ typedef int ExceptionCode;
+
+ class SelectionController;
+ class Range;
+
+ void raiseDOMException(ExceptionCode);
+
+ inline void raiseOnDOMError(ExceptionCode ec)
+ {
+ if (ec)
+ raiseDOMException(ec);
+ }
+
+} // namespace WebCore
+
+#endif // ExceptionHandlers_h
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * 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 FTPDirectoryDocument_h
+#define FTPDirectoryDocument_h
+
+#include "HTMLDocument.h"
+
+namespace WebCore {
+
+class DOMImplementation;
+
+class FTPDirectoryDocument : public HTMLDocument {
+public:
+ static PassRefPtr<FTPDirectoryDocument> create(Frame* frame)
+ {
+ return new FTPDirectoryDocument(frame);
+ }
+
+private:
+ FTPDirectoryDocument(Frame*);
+ virtual Tokenizer* createTokenizer();
+};
+
+} // namespace WebCore
+
+#endif // FTPDirectoryDocument_h
--- /dev/null
+/*
+ * Copyright (C) 2002 Cyrus Patel <cyp@fb14.uni-mainz.de>
+ * (C) 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/* ParseFTPList() parses lines from an FTP LIST command.
+**
+** Written July 2002 by Cyrus Patel <cyp@fb14.uni-mainz.de>
+** with acknowledgements to squid, lynx, wget and ftpmirror.
+**
+** Arguments:
+** 'line': line of FTP data connection output. The line is assumed
+** to end at the first '\0' or '\n' or '\r\n'.
+** 'state': a structure used internally to track state between
+** lines. Needs to be bzero()'d at LIST begin.
+** 'result': where ParseFTPList will store the results of the parse
+** if 'line' is not a comment and is not junk.
+**
+** Returns one of the following:
+** 'd' - LIST line is a directory entry ('result' is valid)
+** 'f' - LIST line is a file's entry ('result' is valid)
+** 'l' - LIST line is a symlink's entry ('result' is valid)
+** '?' - LIST line is junk. (cwd, non-file/dir/link, etc)
+** '"' - its not a LIST line (its a "comment")
+**
+** It may be advisable to let the end-user see "comments" (particularly when
+** the listing results in ONLY such lines) because such a listing may be:
+** - an unknown LIST format (NLST or "custom" format for example)
+** - an error msg (EPERM,ENOENT,ENFILE,EMFILE,ENOTDIR,ENOTBLK,EEXDEV etc).
+** - an empty directory and the 'comment' is a "total 0" line or similar.
+** (warning: a "total 0" can also mean the total size is unknown).
+**
+** ParseFTPList() supports all known FTP LISTing formats:
+** - '/bin/ls -l' and all variants (including Hellsoft FTP for NetWare);
+** - EPLF (Easily Parsable List Format);
+** - Windows NT's default "DOS-dirstyle";
+** - OS/2 basic server format LIST format;
+** - VMS (MultiNet, UCX, and CMU) LIST format (including multi-line format);
+** - IBM VM/CMS, VM/ESA LIST format (two known variants);
+** - SuperTCP FTP Server for Win16 LIST format;
+** - NetManage Chameleon (NEWT) for Win16 LIST format;
+** - '/bin/dls' (two known variants, plus multi-line) LIST format;
+** If there are others, then I'd like to hear about them (send me a sample).
+**
+** NLSTings are not supported explicitely because they cannot be machine
+** parsed consistantly: NLSTings do not have unique characteristics - even
+** the assumption that there won't be whitespace on the line does not hold
+** because some nlistings have more than one filename per line and/or
+** may have filenames that have spaces in them. Moreover, distinguishing
+** between an error message and an NLST line would require ParseList() to
+** recognize all the possible strerror() messages in the world.
+*/
+
+// This was originally Mozilla code, titled ParseFTPList.h
+// Original version of this file can currently be found at: http://mxr.mozilla.org/mozilla1.8/source/netwerk/streamconv/converters/ParseFTPList.h
+
+#ifndef FTPDirectoryParser_h
+#define FTPDirectoryParser_h
+
+#include "PlatformString.h"
+
+#include <time.h>
+
+#define SUPPORT_LSL /* Support for /bin/ls -l and dozens of variations therof */
+#define SUPPORT_DLS /* Support for /bin/dls format (very, Very, VERY rare) */
+#define SUPPORT_EPLF /* Support for Extraordinarily Pathetic List Format */
+#define SUPPORT_DOS /* Support for WinNT server in 'site dirstyle' dos */
+#define SUPPORT_VMS /* Support for VMS (all: MultiNet, UCX, CMU-IP) */
+#define SUPPORT_CMS /* Support for IBM VM/CMS,VM/ESA (z/VM and LISTING forms) */
+#define SUPPORT_OS2 /* Support for IBM TCP/IP for OS/2 - FTP Server */
+#define SUPPORT_W16 /* Support for win16 hosts: SuperTCP or NetManage Chameleon */
+
+namespace WebCore {
+
+typedef struct tm FTPTime;
+
+struct ListState {
+ ListState()
+ : now(0)
+ , listStyle(0)
+ , parsedOne(false)
+ , carryBufferLength(0)
+ , numLines(0)
+ {
+ memset(&nowFTPTime, 0, sizeof(FTPTime));
+ }
+
+ double now; /* needed for year determination */
+ FTPTime nowFTPTime;
+ char listStyle; /* LISTing style */
+ bool parsedOne; /* returned anything yet? */
+ char carryBuffer[84]; /* for VMS multiline */
+ int carryBufferLength; /* length of name in carry_buf */
+ int64_t numLines; /* number of lines seen */
+};
+
+enum FTPEntryType {
+ FTPDirectoryEntry,
+ FTPFileEntry,
+ FTPLinkEntry,
+ FTPMiscEntry,
+ FTPJunkEntry
+};
+
+struct ListResult
+{
+ ListResult()
+ {
+ clear();
+ }
+
+ void clear()
+ {
+ valid = false;
+ type = FTPJunkEntry;
+ filename = 0;
+ filenameLength = 0;
+ linkname = 0;
+ linknameLength = 0;
+ fileSize.truncate(0);
+ caseSensitive = false;
+ memset(&modifiedTime, 0, sizeof(FTPTime));
+ }
+
+ bool valid;
+ FTPEntryType type;
+
+ const char* filename;
+ uint32_t filenameLength;
+
+ const char* linkname;
+ uint32_t linknameLength;
+
+ String fileSize;
+ FTPTime modifiedTime;
+ bool caseSensitive; // file system is definitely case insensitive
+};
+
+FTPEntryType parseOneFTPLine(const char* inputLine, ListState&, ListResult&);
+
+} // namespace WebCore
+
+#endif // FTPDirectoryParser_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef File_h
+#define File_h
+
+#include "PlatformString.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+ class File : public RefCounted<File> {
+ public:
+ static PassRefPtr<File> create(const String& path)
+ {
+ return adoptRef(new File(path));
+ }
+
+ const String& fileName() const { return m_fileName; }
+ unsigned long long fileSize();
+
+ const String& path() const { return m_path; }
+
+ private:
+ File(const String& path);
+
+ String m_path;
+ String m_fileName;
+ };
+
+} // namespace WebCore
+
+#endif // FileList_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef FileChooser_h
+#define FileChooser_h
+
+#include "PlatformString.h"
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class Font;
+class Icon;
+
+class FileChooserClient {
+public:
+ virtual void valueChanged() = 0;
+ virtual bool allowsMultipleFiles() = 0;
+ virtual ~FileChooserClient();
+};
+
+class FileChooser : public RefCounted<FileChooser> {
+public:
+ static PassRefPtr<FileChooser> create(FileChooserClient*, const String& initialFilename);
+ ~FileChooser();
+
+ void disconnectClient() { m_client = 0; }
+ bool disconnected() { return !m_client; }
+
+ const Vector<String>& filenames() const { return m_filenames; }
+ String basenameForWidth(const Font&, int width) const;
+
+ Icon* icon() const { return m_icon.get(); }
+
+ void clear(); // for use by client; does not call valueChanged
+
+ void chooseFile(const String& path);
+ void chooseFiles(const Vector<String>& paths);
+
+ bool allowsMultipleFiles() const { return m_client ? m_client->allowsMultipleFiles() : false; }
+
+private:
+ FileChooser(FileChooserClient*, const String& initialfilename);
+ static PassRefPtr<Icon> chooseIcon(const String& filename);
+ static PassRefPtr<Icon> chooseIcon(Vector<String> filenames);
+
+ FileChooserClient* m_client;
+ Vector<String> m_filenames;
+ RefPtr<Icon> m_icon;
+};
+
+} // namespace WebCore
+
+#endif // FileChooser_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FileList_h
+#define FileList_h
+
+#include "File.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+ class FileList : public RefCounted<FileList> {
+ public:
+ static PassRefPtr<FileList> create()
+ {
+ return adoptRef(new FileList);
+ }
+
+ unsigned length() const { return m_files.size(); }
+ File* item(unsigned index) const;
+
+ bool isEmpty() const { return m_files.isEmpty(); }
+ void clear() { m_files.clear(); }
+ void append(PassRefPtr<File> file) { m_files.append(file); }
+
+ private:
+ FileList();
+
+ Vector<RefPtr<File> > m_files;
+ };
+
+} // namespace WebCore
+
+#endif // FileList_h
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Collabora, Ltd. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FileSystem_h
+#define FileSystem_h
+
+#if PLATFORM(GTK)
+#include <gmodule.h>
+#endif
+#if PLATFORM(QT)
+#include <QFile>
+#include <QLibrary>
+#if defined(Q_OS_WIN32)
+#include <windows.h>
+#endif
+#endif
+
+#if PLATFORM(DARWIN)
+#include <CoreFoundation/CFBundle.h>
+#endif
+
+#include <time.h>
+
+#include <wtf/Platform.h>
+#include <wtf/Vector.h>
+
+#include "PlatformString.h"
+
+typedef const struct __CFData* CFDataRef;
+
+#if PLATFORM(WIN)
+// These are to avoid including <winbase.h> in a header for Chromium
+typedef void *HANDLE;
+// Assuming STRICT
+typedef struct HINSTANCE__* HINSTANCE;
+typedef HINSTANCE HMODULE;
+#endif
+
+namespace WebCore {
+
+class CString;
+
+#if PLATFORM(WIN)
+typedef HANDLE PlatformFileHandle;
+typedef HMODULE PlatformModule;
+// FIXME: -1 is INVALID_HANDLE_VALUE, defined in <winbase.h>. Chromium tries to
+// avoid using Windows headers in headers. We'd rather move this into the .cpp.
+const PlatformFileHandle invalidPlatformFileHandle = reinterpret_cast<HANDLE>(-1);
+
+struct PlatformModuleVersion {
+ unsigned leastSig;
+ unsigned mostSig;
+
+ PlatformModuleVersion(unsigned)
+ : leastSig(0)
+ , mostSig(0)
+ {
+ }
+
+ PlatformModuleVersion(unsigned lsb, unsigned msb)
+ : leastSig(lsb)
+ , mostSig(msb)
+ {
+ }
+
+};
+#elif PLATFORM(QT)
+
+typedef QFile* PlatformFileHandle;
+const PlatformFileHandle invalidPlatformFileHandle = 0;
+#if defined(Q_WS_MAC)
+typedef CFBundleRef PlatformModule;
+typedef unsigned PlatformModuleVersion;
+#elif defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_S60)
+typedef QLibrary* PlatformModule;
+typedef unsigned PlatformModuleVersion;
+#elif defined(Q_OS_WIN)
+typedef HMODULE PlatformModule;
+struct PlatformModuleVersion {
+ unsigned leastSig;
+ unsigned mostSig;
+
+ PlatformModuleVersion(unsigned)
+ : leastSig(0)
+ , mostSig(0)
+ {
+ }
+
+ PlatformModuleVersion(unsigned lsb, unsigned msb)
+ : leastSig(lsb)
+ , mostSig(msb)
+ {
+ }
+
+};
+#endif
+
+#else
+typedef int PlatformFileHandle;
+#if PLATFORM(GTK)
+typedef GModule* PlatformModule;
+#else
+typedef void* PlatformModule;
+#endif
+const PlatformFileHandle invalidPlatformFileHandle = -1;
+
+typedef unsigned PlatformModuleVersion;
+#endif
+
+bool fileExists(const String&);
+bool deleteFile(const String&);
+bool deleteEmptyDirectory(const String&);
+bool getFileSize(const String&, long long& result);
+bool getFileModificationTime(const String&, time_t& result);
+String pathByAppendingComponent(const String& path, const String& component);
+bool makeAllDirectories(const String& path);
+String homeDirectoryPath();
+String pathGetFileName(const String&);
+String directoryName(const String&);
+
+Vector<String> listDirectory(const String& path, const String& filter = String());
+
+CString fileSystemRepresentation(const String&);
+
+inline bool isHandleValid(const PlatformFileHandle& handle) { return handle != invalidPlatformFileHandle; }
+
+// Prefix is what the filename should be prefixed with, not the full path.
+CString openTemporaryFile(const char* prefix, PlatformFileHandle&);
+void closeFile(PlatformFileHandle&);
+int writeToFile(PlatformFileHandle, const char* data, int length);
+
+// Methods for dealing with loadable modules
+bool unloadModule(PlatformModule);
+
+#if PLATFORM(WIN)
+String localUserSpecificStorageDirectory();
+String roamingUserSpecificStorageDirectory();
+
+bool safeCreateFile(const String&, CFDataRef);
+#endif
+
+#if PLATFORM(GTK)
+String filenameToString(const char*);
+char* filenameFromString(const String&);
+String filenameForDisplay(const String&);
+#endif
+
+} // namespace WebCore
+
+#endif // FileSystem_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef FillLayer_h
+#define FillLayer_h
+
+#include "GraphicsTypes.h"
+#include "Length.h"
+#include "LengthSize.h"
+#include "RenderStyleConstants.h"
+#include "StyleImage.h"
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+struct FillLayer {
+public:
+ FillLayer(EFillLayerType);
+ ~FillLayer();
+
+ StyleImage* image() const { return m_image.get(); }
+ Length xPosition() const { return m_xPosition; }
+ Length yPosition() const { return m_yPosition; }
+ bool attachment() const { return m_attachment; }
+ EFillBox clip() const { return static_cast<EFillBox>(m_clip); }
+ EFillBox origin() const { return static_cast<EFillBox>(m_origin); }
+ EFillRepeat repeat() const { return static_cast<EFillRepeat>(m_repeat); }
+ CompositeOperator composite() const { return static_cast<CompositeOperator>(m_composite); }
+ LengthSize size() const { return m_size; }
+
+ const FillLayer* next() const { return m_next; }
+ FillLayer* next() { return m_next; }
+
+ bool isImageSet() const { return m_imageSet; }
+ bool isXPositionSet() const { return m_xPosSet; }
+ bool isYPositionSet() const { return m_yPosSet; }
+ bool isAttachmentSet() const { return m_attachmentSet; }
+ bool isClipSet() const { return m_clipSet; }
+ bool isOriginSet() const { return m_originSet; }
+ bool isRepeatSet() const { return m_repeatSet; }
+ bool isCompositeSet() const { return m_compositeSet; }
+ bool isSizeSet() const { return m_sizeSet; }
+
+ void setImage(StyleImage* i) { m_image = i; m_imageSet = true; }
+ void setXPosition(const Length& l) { m_xPosition = l; m_xPosSet = true; }
+ void setYPosition(const Length& l) { m_yPosition = l; m_yPosSet = true; }
+ void setAttachment(bool b) { m_attachment = b; m_attachmentSet = true; }
+ void setClip(EFillBox b) { m_clip = b; m_clipSet = true; }
+ void setOrigin(EFillBox b) { m_origin = b; m_originSet = true; }
+ void setRepeat(EFillRepeat r) { m_repeat = r; m_repeatSet = true; }
+ void setComposite(CompositeOperator c) { m_composite = c; m_compositeSet = true; }
+ void setSize(const LengthSize& b) { m_size = b; m_sizeSet = true; }
+
+ void clearImage() { m_imageSet = false; }
+ void clearXPosition() { m_xPosSet = false; }
+ void clearYPosition() { m_yPosSet = false; }
+ void clearAttachment() { m_attachmentSet = false; }
+ void clearClip() { m_clipSet = false; }
+ void clearOrigin() { m_originSet = false; }
+ void clearRepeat() { m_repeatSet = false; }
+ void clearComposite() { m_compositeSet = false; }
+ void clearSize() { m_sizeSet = false; }
+
+ void setNext(FillLayer* n) { if (m_next != n) { delete m_next; m_next = n; } }
+
+ FillLayer& operator=(const FillLayer& o);
+ FillLayer(const FillLayer& o);
+
+ bool operator==(const FillLayer& o) const;
+ bool operator!=(const FillLayer& o) const
+ {
+ return !(*this == o);
+ }
+
+ bool containsImage(StyleImage*) const;
+
+ bool hasImage() const
+ {
+ if (m_image)
+ return true;
+ return m_next ? m_next->hasImage() : false;
+ }
+
+ bool hasFixedImage() const
+ {
+ if (m_image && !m_attachment)
+ return true;
+ return m_next ? m_next->hasFixedImage() : false;
+ }
+
+ EFillLayerType type() const { return static_cast<EFillLayerType>(m_type); }
+
+ void fillUnsetProperties();
+ void cullEmptyLayers();
+
+ static bool initialFillAttachment(EFillLayerType) { return true; }
+ static EFillBox initialFillClip(EFillLayerType) { return BorderFillBox; }
+ static EFillBox initialFillOrigin(EFillLayerType type) { return type == BackgroundFillLayer ? PaddingFillBox : BorderFillBox; }
+ static EFillRepeat initialFillRepeat(EFillLayerType) { return RepeatFill; }
+ static CompositeOperator initialFillComposite(EFillLayerType) { return CompositeSourceOver; }
+ static LengthSize initialFillSize(EFillLayerType) { return LengthSize(); }
+ static Length initialFillXPosition(EFillLayerType) { return Length(0.0, Percent); }
+ static Length initialFillYPosition(EFillLayerType) { return Length(0.0, Percent); }
+ static StyleImage* initialFillImage(EFillLayerType) { return 0; }
+
+private:
+ FillLayer() { }
+
+public:
+ RefPtr<StyleImage> m_image;
+
+ Length m_xPosition;
+ Length m_yPosition;
+
+ bool m_attachment : 1;
+ unsigned m_clip : 2; // EFillBox
+ unsigned m_origin : 2; // EFillBox
+ unsigned m_repeat : 2; // EFillRepeat
+ unsigned m_composite : 4; // CompositeOperator
+
+ LengthSize m_size;
+
+ bool m_imageSet : 1;
+ bool m_attachmentSet : 1;
+ bool m_clipSet : 1;
+ bool m_originSet : 1;
+ bool m_repeatSet : 1;
+ bool m_xPosSet : 1;
+ bool m_yPosSet : 1;
+ bool m_compositeSet : 1;
+ bool m_sizeSet : 1;
+
+ unsigned m_type : 1; // EFillLayerType
+
+ FillLayer* m_next;
+};
+
+} // namespace WebCore
+
+#endif // FillLayer_h
--- /dev/null
+/*
+ * This file is part of the HTML rendering engine for KDE.
+ *
+ * Copyright (C) 2002 Lars Knoll (knoll@kde.org)
+ * (C) 2002 Dirk Mueller (mueller@kde.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef FixedTableLayout_h
+#define FixedTableLayout_h
+
+#include "Length.h"
+#include "TableLayout.h"
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class RenderTable;
+
+class FixedTableLayout : public TableLayout {
+public:
+ FixedTableLayout(RenderTable*);
+
+ virtual void calcPrefWidths(int& minWidth, int& maxWidth);
+ virtual void layout();
+
+protected:
+ int calcWidthArray(int tableWidth);
+
+ Vector<Length> m_width;
+};
+
+} // namespace WebCore
+
+#endif // FixedTableLayout_h
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FloatConversion_h
+#define FloatConversion_h
+
+#include <wtf/Platform.h>
+#if PLATFORM(CG)
+#include <CoreGraphics/CGBase.h>
+#endif
+
+namespace WebCore {
+
+ template<typename T>
+ float narrowPrecisionToFloat(T);
+
+ template<>
+ inline float narrowPrecisionToFloat(double number)
+ {
+ return static_cast<float>(number);
+ }
+
+#if PLATFORM(CG)
+ template<typename T>
+ CGFloat narrowPrecisionToCGFloat(T);
+
+ template<>
+ inline CGFloat narrowPrecisionToCGFloat(double number)
+ {
+ return static_cast<CGFloat>(number);
+ }
+#endif
+
+} // namespace WebCore
+
+#endif // FloatConversion_h
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2005 Nokia. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FloatPoint_h
+#define FloatPoint_h
+
+#include "FloatSize.h"
+#include "IntPoint.h"
+#include <wtf/MathExtras.h>
+#include <wtf/Platform.h>
+
+#if PLATFORM(CG)
+typedef struct CGPoint CGPoint;
+#endif
+
+
+#if PLATFORM(QT)
+#include "qglobal.h"
+QT_BEGIN_NAMESPACE
+class QPointF;
+QT_END_NAMESPACE
+#endif
+
+#if PLATFORM(SYMBIAN)
+class TPoint;
+#endif
+
+#if PLATFORM(SKIA)
+struct SkPoint;
+#endif
+
+namespace WebCore {
+
+class TransformationMatrix;
+class IntPoint;
+
+class FloatPoint {
+public:
+ FloatPoint() : m_x(0), m_y(0) { }
+ FloatPoint(float x, float y) : m_x(x), m_y(y) { }
+ FloatPoint(const IntPoint&);
+
+ static FloatPoint narrowPrecision(double x, double y);
+
+ float x() const { return m_x; }
+ float y() const { return m_y; }
+
+ void setX(float x) { m_x = x; }
+ void setY(float y) { m_y = y; }
+ void move(float dx, float dy) { m_x += dx; m_y += dy; }
+
+#if PLATFORM(CG)
+ FloatPoint(const CGPoint&);
+ operator CGPoint() const;
+#endif
+
+
+#if PLATFORM(QT)
+ FloatPoint(const QPointF&);
+ operator QPointF() const;
+#endif
+
+#if PLATFORM(SYMBIAN)
+ operator TPoint() const;
+ FloatPoint(const TPoint&);
+#endif
+
+#if PLATFORM(SKIA)
+ operator SkPoint() const;
+ FloatPoint(const SkPoint&);
+#endif
+
+ FloatPoint matrixTransform(const TransformationMatrix&) const;
+
+private:
+ float m_x, m_y;
+};
+
+
+inline FloatPoint& operator+=(FloatPoint& a, const FloatSize& b)
+{
+ a.move(b.width(), b.height());
+ return a;
+}
+
+inline FloatPoint& operator-=(FloatPoint& a, const FloatSize& b)
+{
+ a.move(-b.width(), -b.height());
+ return a;
+}
+
+inline FloatPoint operator+(const FloatPoint& a, const FloatSize& b)
+{
+ return FloatPoint(a.x() + b.width(), a.y() + b.height());
+}
+
+inline FloatSize operator-(const FloatPoint& a, const FloatPoint& b)
+{
+ return FloatSize(a.x() - b.x(), a.y() - b.y());
+}
+
+inline FloatPoint operator-(const FloatPoint& a, const FloatSize& b)
+{
+ return FloatPoint(a.x() - b.width(), a.y() - b.height());
+}
+
+inline bool operator==(const FloatPoint& a, const FloatPoint& b)
+{
+ return a.x() == b.x() && a.y() == b.y();
+}
+
+inline bool operator!=(const FloatPoint& a, const FloatPoint& b)
+{
+ return a.x() != b.x() || a.y() != b.y();
+}
+
+inline IntPoint roundedIntPoint(const FloatPoint& p)
+{
+ return IntPoint(static_cast<int>(roundf(p.x())), static_cast<int>(roundf(p.y())));
+}
+
+}
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org>
+ 2004, 2005 Rob Buis <buis@kde.org>
+ 2005 Eric Seidel <eric@webkit.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ aint with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef FloatPoint3D_h
+#define FloatPoint3D_h
+
+#if ENABLE(SVG) || USE(ACCELERATED_COMPOSITING)
+
+namespace WebCore {
+
+class FloatPoint;
+
+class FloatPoint3D {
+public:
+ FloatPoint3D();
+ FloatPoint3D(float x, float y, float z);
+ FloatPoint3D(const FloatPoint&);
+
+ float x() const { return m_x; }
+ void setX(float x) { m_x = x; }
+
+ float y() const { return m_y; }
+ void setY(float y) { m_y = y; }
+
+ float z() const { return m_z; }
+ void setZ(float z) { m_z = z; }
+
+ void normalize();
+
+private:
+ float m_x;
+ float m_y;
+ float m_z;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG) || USE(ACCELERATED_COMPOSITING)
+
+#endif // FloatPoint3D_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FloatQuad_h
+#define FloatQuad_h
+
+#include "FloatPoint.h"
+#include "FloatRect.h"
+#include "IntRect.h"
+
+namespace WebCore {
+
+// A FloatQuad is a collection of 4 points, often representing the result of
+// mapping a rectangle through transforms. When initialized from a rect, the
+// points are in clockwise order from top left.
+class FloatQuad {
+public:
+ FloatQuad()
+ {
+ }
+
+ FloatQuad(const FloatPoint& p1, const FloatPoint& p2, const FloatPoint& p3, const FloatPoint& p4)
+ : m_p1(p1)
+ , m_p2(p2)
+ , m_p3(p3)
+ , m_p4(p4)
+ {
+ }
+
+ FloatQuad(const FloatRect& inRect)
+ : m_p1(inRect.location())
+ , m_p2(inRect.right(), inRect.y())
+ , m_p3(inRect.right(), inRect.bottom())
+ , m_p4(inRect.x(), inRect.bottom())
+ {
+ }
+
+ FloatPoint p1() const { return m_p1; }
+ FloatPoint p2() const { return m_p2; }
+ FloatPoint p3() const { return m_p3; }
+ FloatPoint p4() const { return m_p4; }
+
+ void setP1(const FloatPoint& p) { m_p1 = p; }
+ void setP2(const FloatPoint& p) { m_p2 = p; }
+ void setP3(const FloatPoint& p) { m_p3 = p; }
+ void setP4(const FloatPoint& p) { m_p4 = p; }
+
+ // isEmpty tests that the bounding box is empty. This will not identify
+ // "slanted" empty quads.
+ bool isEmpty() const { return boundingBox().isEmpty(); }
+
+ // Tests whether the given point is inside, or on an edge or corner of this quad.
+ bool containsPoint(const FloatPoint&) const;
+
+ // Tests whether the four corners of other are inside, or coincident with the sides of this quad.
+ // Note that this only works for convex quads, but that includes all quads that originate
+ // from transformed rects.
+ bool containsQuad(const FloatQuad&) const;
+
+ FloatRect boundingBox() const;
+ IntRect enclosingBoundingBox() const
+ {
+ return enclosingIntRect(boundingBox());
+ }
+
+ void move(const FloatSize& offset)
+ {
+ m_p1 += offset;
+ m_p2 += offset;
+ m_p3 += offset;
+ m_p4 += offset;
+ }
+
+ void move(float dx, float dy)
+ {
+ m_p1.move(dx, dy);
+ m_p2.move(dx, dy);
+ m_p3.move(dx, dy);
+ m_p4.move(dx, dy);
+ }
+
+private:
+ FloatPoint m_p1;
+ FloatPoint m_p2;
+ FloatPoint m_p3;
+ FloatPoint m_p4;
+};
+
+inline FloatQuad& operator+=(FloatQuad& a, const FloatSize& b)
+{
+ a.move(b);
+ return a;
+}
+
+inline FloatQuad& operator-=(FloatQuad& a, const FloatSize& b)
+{
+ a.move(-b.width(), -b.height());
+ return a;
+}
+
+inline bool operator==(const FloatQuad& a, const FloatQuad& b)
+{
+ return a.p1() == b.p1() &&
+ a.p2() == b.p2() &&
+ a.p3() == b.p3() &&
+ a.p4() == b.p4();
+}
+
+inline bool operator!=(const FloatQuad& a, const FloatQuad& b)
+{
+ return a.p1() != b.p1() ||
+ a.p2() != b.p2() ||
+ a.p3() != b.p3() ||
+ a.p4() != b.p4();
+}
+
+} // namespace WebCore
+
+
+#endif // FloatQuad_h
+
--- /dev/null
+/*
+ * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2005 Nokia. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FloatRect_h
+#define FloatRect_h
+
+#include "FloatPoint.h"
+
+#include <CoreGraphics/CGGeometry.h>
+
+#if PLATFORM(CG)
+typedef struct CGRect CGRect;
+#endif
+
+
+#ifndef NSRect
+#define NSRect CGRect
+#endif
+
+
+#if PLATFORM(QT)
+QT_BEGIN_NAMESPACE
+class QRectF;
+QT_END_NAMESPACE
+#endif
+
+#if PLATFORM(WX) && USE(WXGC)
+class wxRect2DDouble;
+#endif
+
+#if PLATFORM(SKIA)
+struct SkRect;
+#endif
+
+namespace WebCore {
+
+class IntRect;
+
+class FloatRect {
+public:
+ FloatRect() { }
+ FloatRect(const FloatPoint& location, const FloatSize& size)
+ : m_location(location), m_size(size) { }
+ FloatRect(float x, float y, float width, float height)
+ : m_location(FloatPoint(x, y)), m_size(FloatSize(width, height)) { }
+ FloatRect(const IntRect&);
+
+ static FloatRect narrowPrecision(double x, double y, double width, double height);
+
+ FloatPoint location() const { return m_location; }
+ FloatSize size() const { return m_size; }
+
+ void setLocation(const FloatPoint& location) { m_location = location; }
+ void setSize(const FloatSize& size) { m_size = size; }
+
+ float x() const { return m_location.x(); }
+ float y() const { return m_location.y(); }
+ float width() const { return m_size.width(); }
+ float height() const { return m_size.height(); }
+
+ void setX(float x) { m_location.setX(x); }
+ void setY(float y) { m_location.setY(y); }
+ void setWidth(float width) { m_size.setWidth(width); }
+ void setHeight(float height) { m_size.setHeight(height); }
+
+ bool isEmpty() const { return m_size.isEmpty(); }
+
+ float right() const { return x() + width(); }
+ float bottom() const { return y() + height(); }
+
+ void move(const FloatSize& delta) { m_location += delta; }
+ void move(float dx, float dy) { m_location.move(dx, dy); }
+
+ bool intersects(const FloatRect&) const;
+ bool contains(const FloatRect&) const;
+
+ void intersect(const FloatRect&);
+ void unite(const FloatRect&);
+
+ // Note, this doesn't match what IntRect::contains(IntPoint&) does; the int version
+ // is really checking for containment of 1x1 rect, but that doesn't make sense with floats.
+ bool contains(float px, float py) const
+ { return px >= x() && px <= right() && py >= y() && py <= bottom(); }
+ bool contains(const FloatPoint& point) const { return contains(point.x(), point.y()); }
+
+
+ void inflateX(float dx) {
+ m_location.setX(m_location.x() - dx);
+ m_size.setWidth(m_size.width() + dx + dx);
+ }
+ void inflateY(float dy) {
+ m_location.setY(m_location.y() - dy);
+ m_size.setHeight(m_size.height() + dy + dy);
+ }
+ void inflate(float d) { inflateX(d); inflateY(d); }
+ void scale(float s);
+
+#if PLATFORM(CG)
+ FloatRect(const CGRect&);
+ operator CGRect() const;
+#endif
+
+
+#if PLATFORM(QT)
+ FloatRect(const QRectF&);
+ operator QRectF() const;
+#endif
+#if PLATFORM(SYMBIAN)
+ FloatRect(const TRect&);
+ operator TRect() const;
+ TRect rect() const;
+#endif
+
+#if PLATFORM(WX) && USE(WXGC)
+ FloatRect(const wxRect2DDouble&);
+ operator wxRect2DDouble() const;
+#endif
+
+#if PLATFORM(SKIA)
+ FloatRect(const SkRect&);
+ operator SkRect() const;
+#endif
+
+private:
+ FloatPoint m_location;
+ FloatSize m_size;
+};
+
+inline FloatRect intersection(const FloatRect& a, const FloatRect& b)
+{
+ FloatRect c = a;
+ c.intersect(b);
+ return c;
+}
+
+inline FloatRect unionRect(const FloatRect& a, const FloatRect& b)
+{
+ FloatRect c = a;
+ c.unite(b);
+ return c;
+}
+
+
+inline bool operator==(const FloatRect& a, const FloatRect& b)
+{
+ return a.location() == b.location() && a.size() == b.size();
+}
+
+inline bool operator!=(const FloatRect& a, const FloatRect& b)
+{
+ return a.location() != b.location() || a.size() != b.size();
+}
+
+IntRect enclosingIntRect(const FloatRect&);
+
+// Map rect r from srcRect to an equivalent rect in destRect.
+FloatRect mapRect(const FloatRect& r, const FloatRect& srcRect, const FloatRect& destRect);
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2005 Nokia. All rights reserved.
+ * 2008 Eric Seidel <eric@webkit.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FloatSize_h
+#define FloatSize_h
+
+#include <wtf/Platform.h>
+
+#include <CoreGraphics/CoreGraphics.h>
+
+#if PLATFORM(CG)
+typedef struct CGSize CGSize;
+#endif
+
+
+#ifndef NSSize
+#define NSSize CGSize
+#endif
+
+
+namespace WebCore {
+
+class IntSize;
+
+class FloatSize {
+public:
+ FloatSize() : m_width(0), m_height(0) { }
+ FloatSize(float width, float height) : m_width(width), m_height(height) { }
+ FloatSize(const IntSize&);
+
+ static FloatSize narrowPrecision(double width, double height);
+
+ float width() const { return m_width; }
+ float height() const { return m_height; }
+
+ void setWidth(float width) { m_width = width; }
+ void setHeight(float height) { m_height = height; }
+
+ bool isEmpty() const { return m_width <= 0 || m_height <= 0; }
+
+ FloatSize expandedTo(const FloatSize& other) const
+ {
+ return FloatSize(m_width > other.m_width ? m_width : other.m_width,
+ m_height > other.m_height ? m_height : other.m_height);
+ }
+
+ FloatSize shrunkTo(const FloatSize& other) const
+ {
+ return FloatSize(m_width < other.m_width ? m_width : other.m_width,
+ m_height < other.m_height ? m_height : other.m_height);
+ }
+
+#if PLATFORM(CG)
+ explicit FloatSize(const CGSize&); // don't do this implicitly since it's lossy
+ operator CGSize() const;
+#endif
+
+
+private:
+ float m_width, m_height;
+};
+
+inline FloatSize& operator+=(FloatSize& a, const FloatSize& b)
+{
+ a.setWidth(a.width() + b.width());
+ a.setHeight(a.height() + b.height());
+ return a;
+}
+
+inline FloatSize& operator-=(FloatSize& a, const FloatSize& b)
+{
+ a.setWidth(a.width() - b.width());
+ a.setHeight(a.height() - b.height());
+ return a;
+}
+
+inline FloatSize operator+(const FloatSize& a, const FloatSize& b)
+{
+ return FloatSize(a.width() + b.width(), a.height() + b.height());
+}
+
+inline FloatSize operator-(const FloatSize& a, const FloatSize& b)
+{
+ return FloatSize(a.width() - b.width(), a.height() - b.height());
+}
+
+inline FloatSize operator-(const FloatSize& size)
+{
+ return FloatSize(-size.width(), -size.height());
+}
+
+inline bool operator==(const FloatSize& a, const FloatSize& b)
+{
+ return a.width() == b.width() && a.height() == b.height();
+}
+
+inline bool operator!=(const FloatSize& a, const FloatSize& b)
+{
+ return a.width() != b.width() || a.height() != b.height();
+}
+
+} // namespace WebCore
+
+#endif // FloatSize_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FocusController_h
+#define FocusController_h
+
+#include "FocusDirection.h"
+#include <wtf/Forward.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+ class Frame;
+ class KeyboardEvent;
+ class Node;
+ class Page;
+
+ class FocusController {
+ public:
+ FocusController(Page*);
+
+ void setFocusedFrame(PassRefPtr<Frame>);
+ Frame* focusedFrame() const { return m_focusedFrame.get(); }
+ Frame* focusedOrMainFrame();
+
+ bool setInitialFocus(FocusDirection, KeyboardEvent*);
+ bool advanceFocus(FocusDirection, KeyboardEvent*, bool initialFocus = false);
+
+ bool setFocusedNode(Node*, PassRefPtr<Frame>);
+
+ void setActive(bool);
+ bool isActive() const { return m_isActive; }
+
+ private:
+ Page* m_page;
+ RefPtr<Frame> m_focusedFrame;
+ bool m_isActive;
+ };
+
+} // namespace WebCore
+
+#endif // FocusController_h
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FocusDirection_h
+#define FocusDirection_h
+
+namespace WebCore {
+ enum FocusDirection {
+ FocusDirectionForward = 0,
+ FocusDirectionBackward
+ };
+}
+
+#endif // FocusDirection_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2006, 2007 Apple Computer, Inc.
+ * Copyright (C) 2008 Holger Hans Peter Freyther
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Font_h
+#define Font_h
+
+#include "TextRun.h"
+#include "FontDescription.h"
+#include "SimpleFontData.h"
+#include <wtf/HashMap.h>
+#include <wtf/MathExtras.h>
+
+#if PLATFORM(QT)
+#include <QFont>
+#endif
+
+namespace WebCore {
+
+class FloatPoint;
+class FloatRect;
+class FontData;
+class FontFallbackList;
+class FontPlatformData;
+class FontSelector;
+class GlyphBuffer;
+class GlyphPageTreeNode;
+class GraphicsContext;
+class IntPoint;
+class SVGFontElement;
+
+struct GlyphData;
+
+const unsigned defaultUnitsPerEm = 1000;
+
+class Font {
+public:
+ Font();
+ Font(const FontDescription&, float letterSpacing, float wordSpacing);
+ // This constructor is only used if the platform wants to start with a native font.
+ Font(const FontPlatformData&, bool isPrinting);
+ ~Font();
+
+ Font(const Font&);
+ Font& operator=(const Font&);
+
+ bool operator==(const Font& other) const;
+ bool operator!=(const Font& other) const {
+ return !(*this == other);
+ }
+
+ const FontDescription& fontDescription() const { return m_fontDescription; }
+
+ int pixelSize() const { return fontDescription().computedPixelSize(); }
+ float size() const { return fontDescription().computedSize(); }
+
+ void update(PassRefPtr<FontSelector>) const;
+
+ float drawText(GraphicsContext*, const TextRun&, const FloatPoint&, int from = 0, int to = -1) const;
+
+ int width(const TextRun& run) const { return lroundf(floatWidth(run)); }
+ float floatWidth(const TextRun&) const;
+ float floatWidth(const TextRun& run, int extraCharsAvailable, int& charsConsumed, String& glyphName) const;
+
+ int offsetForPosition(const TextRun&, int position, bool includePartialGlyphs) const;
+ FloatRect selectionRectForText(const TextRun&, const IntPoint&, int h, int from = 0, int to = -1) const;
+
+ bool isSmallCaps() const { return m_fontDescription.smallCaps(); }
+
+ float wordSpacing() const { return m_wordSpacing; }
+ float letterSpacing() const { return m_letterSpacing; }
+ void setWordSpacing(float s) { m_wordSpacing = s; }
+ void setLetterSpacing(float s) { m_letterSpacing = s; }
+ bool isFixedPitch() const;
+ bool isPrinterFont() const { return m_fontDescription.usePrinterFont(); }
+
+ FontRenderingMode renderingMode() const { return m_fontDescription.renderingMode(); }
+
+ FontFamily& firstFamily() { return m_fontDescription.firstFamily(); }
+ const FontFamily& family() const { return m_fontDescription.family(); }
+
+ bool italic() const { return m_fontDescription.italic(); }
+ FontWeight weight() const { return m_fontDescription.weight(); }
+
+ bool isPlatformFont() const { return m_isPlatformFont; }
+
+ // Metrics that we query the FontFallbackList for.
+ int ascent() const { return primaryFont()->ascent(); }
+ int descent() const { return primaryFont()->descent(); }
+ int height() const { return ascent() + descent(); }
+ int lineSpacing() const { return primaryFont()->lineSpacing(); }
+ int lineGap() const { return primaryFont()->lineGap(); }
+ float xHeight() const { return primaryFont()->xHeight(); }
+ unsigned unitsPerEm() const { return primaryFont()->unitsPerEm(); }
+ int spaceWidth() const { return (int)ceilf(primaryFont()->m_adjustedSpaceWidth + m_letterSpacing); }
+ int tabWidth() const { return 8 * spaceWidth(); }
+
+ const SimpleFontData* primaryFont() const {
+ if (!m_cachedPrimaryFont)
+ cachePrimaryFont();
+ return m_cachedPrimaryFont;
+ }
+
+ const FontData* fontDataAt(unsigned) const;
+ const GlyphData& glyphDataForCharacter(UChar32, bool mirror, bool forceSmallCaps = false) const;
+ // Used for complex text, and does not utilize the glyph map cache.
+ const FontData* fontDataForCharacters(const UChar*, int length) const;
+
+#if PLATFORM(QT)
+ QFont font() const;
+#endif
+
+private:
+#if ENABLE(SVG_FONTS)
+ void drawTextUsingSVGFont(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const;
+ float floatWidthUsingSVGFont(const TextRun&) const;
+ float floatWidthUsingSVGFont(const TextRun&, int extraCharsAvailable, int& charsConsumed, String& glyphName) const;
+ FloatRect selectionRectForTextUsingSVGFont(const TextRun&, const IntPoint&, int h, int from, int to) const;
+ int offsetForPositionForTextUsingSVGFont(const TextRun&, int position, bool includePartialGlyphs) const;
+#endif
+
+#if USE(FONT_FAST_PATH)
+ bool canUseGlyphCache(const TextRun&) const;
+ float drawSimpleText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const;
+ void drawGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&, int from, int to, const FloatPoint&, bool setColor = true) const;
+ void drawGlyphBuffer(GraphicsContext*, const GlyphBuffer&, const TextRun&, FloatPoint&) const;
+ float floatWidthForSimpleText(const TextRun&, GlyphBuffer*) const;
+ int offsetForPositionForSimpleText(const TextRun&, int position, bool includePartialGlyphs) const;
+ FloatRect selectionRectForSimpleText(const TextRun&, const IntPoint&, int h, int from, int to) const;
+#endif
+
+ float drawComplexText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const;
+ float floatWidthForComplexText(const TextRun&) const;
+ int offsetForPositionForComplexText(const TextRun&, int position, bool includePartialGlyphs) const;
+ FloatRect selectionRectForComplexText(const TextRun&, const IntPoint&, int h, int from, int to) const;
+ void cachePrimaryFont() const;
+
+ friend struct WidthIterator;
+
+public:
+ bool equalForTextAutoSizing (const Font &other) const {
+ return (m_fontDescription.equalForTextAutoSizing(other.m_fontDescription) &&
+ m_letterSpacing == other.m_letterSpacing &&
+ m_wordSpacing == other.m_wordSpacing);
+ }
+
+ // Useful for debugging the different font rendering code paths.
+#if USE(FONT_FAST_PATH)
+ enum CodePath { Auto, Simple, Complex };
+ static void setCodePath(CodePath);
+ static CodePath codePath();
+ static CodePath s_codePath;
+
+ static const uint8_t gRoundingHackCharacterTable[256];
+ static bool isRoundingHackCharacter(UChar32 c)
+ {
+ return (((c & ~0xFF) == 0 && gRoundingHackCharacterTable[c]) || c == 0x200e || c == 0x200f);
+ }
+#endif
+
+ FontSelector* fontSelector() const;
+ static bool treatAsSpace(UChar c) { return c == ' ' || c == '\t' || c == '\n' || c == 0x00A0; }
+ static bool treatAsZeroWidthSpace(UChar c) { return c < 0x20 || (c >= 0x7F && c < 0xA0) || c == 0x200e || c == 0x200f || (c >= 0x202a && c <= 0x202e) || c == 0xFFFC; }
+
+#if ENABLE(SVG_FONTS)
+ bool isSVGFont() const;
+ SVGFontElement* svgFont() const;
+#endif
+
+private:
+ FontDescription m_fontDescription;
+ mutable RefPtr<FontFallbackList> m_fontList;
+ mutable HashMap<int, GlyphPageTreeNode*> m_pages;
+ mutable GlyphPageTreeNode* m_pageZero;
+ mutable const SimpleFontData* m_cachedPrimaryFont;
+ float m_letterSpacing;
+ float m_wordSpacing;
+ bool m_isPlatformFont;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006, 2008 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FontCache_h
+#define FontCache_h
+
+#include <limits.h>
+#include <wtf/Vector.h>
+#include <wtf/unicode/Unicode.h>
+
+#if PLATFORM(WIN)
+#include <objidl.h>
+#include <mlang.h>
+#endif
+
+namespace WebCore
+{
+
+class AtomicString;
+class Font;
+class FontPlatformData;
+class FontData;
+class FontDescription;
+class FontSelector;
+class SimpleFontData;
+
+class FontCache {
+public:
+ friend FontCache* fontCache();
+
+ const FontData* getFontData(const Font&, int& familyIndex, FontSelector*);
+ void releaseFontData(const SimpleFontData*);
+
+ // This method is implemented by the platform.
+ // FIXME: Font data returned by this method never go inactive because callers don't track and release them.
+ const SimpleFontData* getFontDataForCharacters(const Font&, const UChar* characters, int length);
+
+ // Also implemented by the platform.
+ void platformInit();
+
+#if PLATFORM(WIN)
+ IMLangFontLink2* getFontLinkInterface();
+#endif
+
+ void getTraitsInFamily(const AtomicString&, Vector<unsigned>&);
+
+ FontPlatformData* getCachedFontPlatformData(const FontDescription&, const AtomicString& family, bool checkingAlternateName = false);
+ SimpleFontData* getCachedFontData(const FontPlatformData*);
+ FontPlatformData* getLastResortFallbackFont(const FontDescription&);
+
+ void addClient(FontSelector*);
+ void removeClient(FontSelector*);
+
+ unsigned generation();
+ void invalidate();
+
+ size_t fontDataCount();
+ size_t inactiveFontDataCount();
+ void purgeInactiveFontData(int count = INT_MAX);
+
+private:
+ FontCache();
+
+ // These methods are implemented by each platform.
+ FontPlatformData* getSimilarFontPlatformData(const Font&);
+ FontPlatformData* getCustomFallbackFont(const UInt32 c, const Font&);
+ bool requiresCustomFallbackFont(const UInt32 c);
+ FontPlatformData* createFontPlatformData(const FontDescription&, const AtomicString& family);
+
+ friend class SimpleFontData;
+ friend class FontFallbackList;
+};
+
+// Get the global fontCache.
+FontCache* fontCache();
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef FontCustomPlatformData_h
+#define FontCustomPlatformData_h
+
+#include "FontRenderingMode.h"
+#include <wtf/Noncopyable.h>
+
+#include <GraphicsServices/GSFont.h>
+
+
+namespace WebCore {
+
+class FontPlatformData;
+class SharedBuffer;
+
+struct FontCustomPlatformData : Noncopyable {
+ FontCustomPlatformData(GSFontRef gsFont)
+ : m_gsFont(gsFont)
+ {}
+ ~FontCustomPlatformData();
+
+ FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode);
+
+ GSFontRef m_gsFont;
+};
+
+FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer);
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FontData_h
+#define FontData_h
+
+#include <wtf/Noncopyable.h>
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+class SimpleFontData;
+
+class FontData : Noncopyable {
+public:
+ FontData()
+ : m_maxGlyphPageTreeLevel(0)
+ {
+ }
+
+ virtual ~FontData();
+
+ virtual const SimpleFontData* fontDataForCharacter(UChar32) const = 0;
+ virtual bool containsCharacters(const UChar*, int length) const = 0;
+ virtual bool isCustomFont() const = 0;
+ virtual bool isLoading() const = 0;
+ virtual bool isSegmented() const = 0;
+
+ void setMaxGlyphPageTreeLevel(unsigned level) const { m_maxGlyphPageTreeLevel = level; }
+ unsigned maxGlyphPageTreeLevel() const { return m_maxGlyphPageTreeLevel; }
+
+private:
+ mutable unsigned m_maxGlyphPageTreeLevel;
+};
+
+} // namespace WebCore
+
+#endif // FontData_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIother.m_ If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USm_
+ *
+ */
+
+#ifndef FontDescription_h
+#define FontDescription_h
+
+#include "FontFamily.h"
+#include "FontRenderingMode.h"
+#include "FontTraitsMask.h"
+
+namespace WebCore {
+
+enum FontWeight {
+ FontWeight100,
+ FontWeight200,
+ FontWeight300,
+ FontWeight400,
+ FontWeight500,
+ FontWeight600,
+ FontWeight700,
+ FontWeight800,
+ FontWeight900,
+ FontWeightNormal = FontWeight400,
+ FontWeightBold = FontWeight700
+};
+
+class FontDescription {
+public:
+ enum GenericFamilyType { NoFamily, StandardFamily, SerifFamily, SansSerifFamily,
+ MonospaceFamily, CursiveFamily, FantasyFamily };
+
+ FontDescription()
+ : m_specifiedSize(0)
+ , m_computedSize(0)
+ , m_italic(false)
+ , m_smallCaps(false)
+ , m_isAbsoluteSize(false)
+ , m_weight(FontWeightNormal)
+ , m_genericFamily(NoFamily)
+ , m_usePrinterFont(false)
+ , m_renderingMode(NormalRenderingMode)
+ , m_keywordSize(0)
+ {
+ }
+
+ bool operator==(const FontDescription&) const;
+ bool operator!=(const FontDescription& other) const { return !(*this == other); }
+
+ const FontFamily& family() const { return m_familyList; }
+ FontFamily& firstFamily() { return m_familyList; }
+ float specifiedSize() const { return m_specifiedSize; }
+ float computedSize() const { return m_computedSize; }
+ bool italic() const { return m_italic; }
+ int computedPixelSize() const { return int(m_computedSize + 0.5f); }
+ bool smallCaps() const { return m_smallCaps; }
+ bool isAbsoluteSize() const { return m_isAbsoluteSize; }
+ FontWeight weight() const { return static_cast<FontWeight>(m_weight); }
+ FontWeight lighterWeight() const;
+ FontWeight bolderWeight() const;
+ GenericFamilyType genericFamily() const { return static_cast<GenericFamilyType>(m_genericFamily); }
+ bool usePrinterFont() const { return m_usePrinterFont; }
+ FontRenderingMode renderingMode() const { return static_cast<FontRenderingMode>(m_renderingMode); }
+ int keywordSize() const { return m_keywordSize; }
+
+ FontTraitsMask traitsMask() const;
+
+ void setFamily(const FontFamily& family) { m_familyList = family; }
+ void setComputedSize(float s) { m_computedSize = s; }
+ void setSpecifiedSize(float s) { m_specifiedSize = s; }
+ void setItalic(bool i) { m_italic = i; }
+ void setSmallCaps(bool c) { m_smallCaps = c; }
+ void setIsAbsoluteSize(bool s) { m_isAbsoluteSize = s; }
+ void setWeight(FontWeight w) { m_weight = w; }
+ void setGenericFamily(GenericFamilyType genericFamily) { m_genericFamily = genericFamily; }
+ void setUsePrinterFont(bool p) { m_usePrinterFont = p; }
+ void setRenderingMode(FontRenderingMode mode) { m_renderingMode = mode; }
+ void setKeywordSize(int s) { m_keywordSize = s; }
+
+ bool equalForTextAutoSizing (const FontDescription& other) const {
+ return m_familyList == other.m_familyList
+ && m_specifiedSize == other.m_specifiedSize
+ && m_smallCaps == other.m_smallCaps
+ && m_isAbsoluteSize == other.m_isAbsoluteSize
+ && m_genericFamily == other.m_genericFamily
+ && m_usePrinterFont == other.m_usePrinterFont;
+ }
+
+private:
+ FontFamily m_familyList; // The list of font families to be used.
+
+ float m_specifiedSize; // Specified CSS value. Independent of rendering issues such as integer
+ // rounding, minimum font sizes, and zooming.
+ float m_computedSize; // Computed size adjusted for the minimum font size and the zoom factor.
+
+ bool m_italic : 1;
+ bool m_smallCaps : 1;
+ bool m_isAbsoluteSize : 1; // Whether or not CSS specified an explicit size
+ // (logical sizes like "medium" don't count).
+ unsigned m_weight : 8; // FontWeight
+ unsigned m_genericFamily : 3; // GenericFamilyType
+ bool m_usePrinterFont : 1;
+
+ unsigned m_renderingMode : 1; // Used to switch between CG and GDI text on Windows.
+
+ int m_keywordSize : 4; // We cache whether or not a font is currently represented by a CSS keyword (e.g., medium). If so,
+ // then we can accurately translate across different generic families to adjust for different preference settings
+ // (e.g., 13px monospace vs. 16px everything else). Sizes are 1-8 (like the HTML size values for <font>).
+};
+
+inline bool FontDescription::operator==(const FontDescription& other) const
+{
+ return m_familyList == other.m_familyList
+ && m_specifiedSize == other.m_specifiedSize
+ && m_computedSize == other.m_computedSize
+ && m_italic == other.m_italic
+ && m_smallCaps == other.m_smallCaps
+ && m_isAbsoluteSize == other.m_isAbsoluteSize
+ && m_weight == other.m_weight
+ && m_genericFamily == other.m_genericFamily
+ && m_usePrinterFont == other.m_usePrinterFont
+ && m_renderingMode == other.m_renderingMode
+ && m_keywordSize == other.m_keywordSize;
+}
+
+}
+
+#endif
--- /dev/null
+/*
+ * This file is part of the internal font implementation. It should not be included by anyone other than
+ * FontMac.cpp, FontWin.cpp and Font.cpp.
+ *
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+// This file has no guards on purpose in order to detect redundant includes. This is a private header
+// and so this may catch someone trying to include this file in public cpp files.
+
+#include "FontSelector.h"
+#include "SimpleFontData.h"
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+class Font;
+class GraphicsContext;
+class IntRect;
+class FontDescription;
+class FontPlatformData;
+class FontSelector;
+
+const int cAllFamiliesScanned = -1;
+
+class FontFallbackList : public RefCounted<FontFallbackList> {
+public:
+ static PassRefPtr<FontFallbackList> create() { return adoptRef(new FontFallbackList()); }
+
+ ~FontFallbackList() { releaseFontData(); }
+ void invalidate(PassRefPtr<FontSelector>);
+
+ bool isFixedPitch(const Font* f) const { if (m_pitch == UnknownPitch) determinePitch(f); return m_pitch == FixedPitch; };
+ void determinePitch(const Font*) const;
+
+ bool loadingCustomFonts() const { return m_loadingCustomFonts; }
+
+ FontSelector* fontSelector() const { return m_fontSelector.get(); }
+ unsigned generation() const { return m_generation; }
+
+private:
+ FontFallbackList();
+
+ const FontData* primaryFont(const Font* f) const { return fontDataAt(f, 0); }
+ const FontData* fontDataAt(const Font*, unsigned index) const;
+ const FontData* fontDataForCharacters(const Font*, const UChar*, int length) const;
+
+ void setPlatformFont(const FontPlatformData&);
+
+ void releaseFontData();
+
+ mutable Vector<pair<const FontData*, bool>, 1> m_fontList;
+ mutable int m_familyIndex;
+ mutable Pitch m_pitch;
+ mutable bool m_loadingCustomFonts;
+ RefPtr<FontSelector> m_fontSelector;
+ unsigned m_generation;
+
+ friend class Font;
+};
+
+}
+
--- /dev/null
+/*
+ * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FontFamily_h
+#define FontFamily_h
+
+#include "AtomicString.h"
+#include <wtf/RefCounted.h>
+#include <wtf/ListRefPtr.h>
+
+namespace WebCore {
+
+class SharedFontFamily;
+
+class FontFamily {
+public:
+ FontFamily() { }
+ FontFamily(const FontFamily&);
+ FontFamily& operator=(const FontFamily&);
+
+ void setFamily(const AtomicString& family) { m_family = family; }
+ const AtomicString& family() const { return m_family; }
+ bool familyIsEmpty() const { return m_family.isEmpty(); }
+
+ const FontFamily* next() const;
+
+ void appendFamily(PassRefPtr<SharedFontFamily>);
+ PassRefPtr<SharedFontFamily> releaseNext();
+
+private:
+ AtomicString m_family;
+ ListRefPtr<SharedFontFamily> m_next;
+};
+
+class SharedFontFamily : public FontFamily, public RefCounted<SharedFontFamily> {
+public:
+ static PassRefPtr<SharedFontFamily> create()
+ {
+ return adoptRef(new SharedFontFamily);
+ }
+
+private:
+ SharedFontFamily() { }
+};
+
+bool operator==(const FontFamily&, const FontFamily&);
+inline bool operator!=(const FontFamily& a, const FontFamily& b) { return !(a == b); }
+
+inline const FontFamily* FontFamily::next() const
+{
+ return m_next.get();
+}
+
+inline void FontFamily::appendFamily(PassRefPtr<SharedFontFamily> family)
+{
+ m_next = family;
+}
+
+inline PassRefPtr<SharedFontFamily> FontFamily::releaseNext()
+{
+ return m_next.release();
+}
+
+}
+
+#endif
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef FontFamilyValue_h
+#define FontFamilyValue_h
+
+#include "CSSPrimitiveValue.h"
+#include "PlatformString.h"
+
+namespace WebCore {
+
+class FontFamilyValue : public CSSPrimitiveValue {
+public:
+ static PassRefPtr<FontFamilyValue> create(const String& familyName)
+ {
+ return adoptRef(new FontFamilyValue(familyName));
+ }
+
+ void appendSpaceSeparated(const UChar* characters, unsigned length);
+
+ const String& familyName() const { return m_familyName; }
+
+ virtual String cssText() const;
+
+private:
+ FontFamilyValue(const String& familyName);
+
+ String m_familyName;
+};
+
+} // namespace
+
+#endif
--- /dev/null
+/*
+ * This file is part of the internal font implementation.
+ * It should not be included by source files outside it.
+ *
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef FontPlatformData_h
+#define FontPlatformData_h
+
+#include "StringImpl.h"
+
+#ifdef __OBJC__
+@class NSFont;
+#else
+class NSFont;
+#endif
+
+#import <GraphicsServices/GSFont.h>
+
+typedef struct CGFont* CGFontRef;
+typedef UInt32 ATSUFontID;
+#ifndef BUILDING_ON_TIGER
+typedef const struct __CTFont* CTFontRef;
+#endif
+
+#include <CoreFoundation/CFBase.h>
+#include <objc/objc-auto.h>
+#include <wtf/RetainPtr.h>
+
+namespace WebCore {
+
+
+struct FontPlatformData {
+ FontPlatformData(float size, bool syntheticBold, bool syntheticOblique)
+ : m_syntheticBold(syntheticBold)
+ , m_syntheticOblique(syntheticOblique)
+ , m_gsFont(0)
+ , m_isImageFont(false)
+ , m_size(size)
+ , m_font(0)
+ {
+ }
+
+ FontPlatformData(GSFontRef = 0, bool syntheticBold = false, bool syntheticOblique = false);
+
+ FontPlatformData(GSFontRef f, float s, bool b , bool o)
+ : m_syntheticBold(b), m_syntheticOblique(o), m_gsFont(f), m_isImageFont(false), m_size(s), m_font(0)
+ {
+ }
+
+ FontPlatformData(const FontPlatformData&);
+
+ ~FontPlatformData();
+
+ FontPlatformData(WTF::HashTableDeletedValueType) : m_font(hashTableDeletedFontValue()) { }
+ bool isHashTableDeletedValue() const { return m_font == hashTableDeletedFontValue(); }
+
+ float size() const { return m_size; }
+
+ bool m_syntheticBold;
+ bool m_syntheticOblique;
+
+ GSFontRef m_gsFont;
+ bool m_isImageFont;
+ float m_size;
+
+ unsigned hash() const
+ {
+ ASSERT(m_font != 0 || m_gsFont == 0 || m_isImageFont != 0);
+ uintptr_t hashCodes[2] = { (uintptr_t)m_font, m_isImageFont << 2 | m_syntheticBold << 1 | m_syntheticOblique };
+ return StringImpl::computeHash(reinterpret_cast<UChar*>(hashCodes), sizeof(hashCodes) / sizeof(UChar));
+ }
+
+ const FontPlatformData& operator=(const FontPlatformData& f);
+
+ bool operator==(const FontPlatformData& other) const
+ {
+ return m_font == other.m_font && m_syntheticBold == other.m_syntheticBold && m_syntheticOblique == other.m_syntheticOblique &&
+ m_gsFont == other.m_gsFont && m_size == other.m_size && m_isImageFont == other.m_isImageFont;
+ }
+
+ GSFontRef font() const { return m_font; }
+ void setFont(GSFontRef font);
+
+ bool roundsGlyphAdvances() const { return false; }
+#if USE(CORE_TEXT)
+ bool allowsLigatures() const;
+#else
+ bool allowsLigatures() const { return false; }
+#endif
+
+
+private:
+ static GSFontRef hashTableDeletedFontValue() { return reinterpret_cast<GSFontRef>(-1); }
+
+ GSFontRef m_font;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FontRenderingMode_h
+#define FontRenderingMode_h
+
+namespace WebCore {
+
+// This setting is used to provide ways of switching between multiple rendering modes that may have different
+// metrics. It is used to switch between CG and GDI text on Windows.
+enum FontRenderingMode { NormalRenderingMode, AlternateRenderingMode };
+
+} // namespace WebCore
+
+#endif // FontRenderingMode_h
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FontSelector_h
+#define FontSelector_h
+
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class AtomicString;
+class FontData;
+class FontDescription;
+
+class FontSelector : public RefCounted<FontSelector> {
+public:
+ virtual ~FontSelector() { }
+ virtual FontData* getFontData(const FontDescription&, const AtomicString& familyName) = 0;
+
+ virtual void fontCacheInvalidated() { }
+};
+
+} // namespace WebCore
+
+#endif // FontSelector_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FontTraitsMask_h
+#define FontTraitsMask_h
+
+namespace WebCore {
+
+ enum {
+ FontStyleNormalBit = 0,
+ FontStyleItalicBit,
+ FontVariantNormalBit,
+ FontVariantSmallCapsBit,
+ FontWeight100Bit,
+ FontWeight200Bit,
+ FontWeight300Bit,
+ FontWeight400Bit,
+ FontWeight500Bit,
+ FontWeight600Bit,
+ FontWeight700Bit,
+ FontWeight800Bit,
+ FontWeight900Bit,
+ FontTraitsMaskWidth
+ };
+
+ enum FontTraitsMask {
+ FontStyleNormalMask = 1 << FontStyleNormalBit,
+ FontStyleItalicMask = 1 << FontStyleItalicBit,
+ FontStyleMask = FontStyleNormalMask | FontStyleItalicMask,
+
+ FontVariantNormalMask = 1 << FontVariantNormalBit,
+ FontVariantSmallCapsMask = 1 << FontVariantSmallCapsBit,
+ FontVariantMask = FontVariantNormalMask | FontVariantSmallCapsMask,
+
+ FontWeight100Mask = 1 << FontWeight100Bit,
+ FontWeight200Mask = 1 << FontWeight200Bit,
+ FontWeight300Mask = 1 << FontWeight300Bit,
+ FontWeight400Mask = 1 << FontWeight400Bit,
+ FontWeight500Mask = 1 << FontWeight500Bit,
+ FontWeight600Mask = 1 << FontWeight600Bit,
+ FontWeight700Mask = 1 << FontWeight700Bit,
+ FontWeight800Mask = 1 << FontWeight800Bit,
+ FontWeight900Mask = 1 << FontWeight900Bit,
+ FontWeightMask = FontWeight100Mask | FontWeight200Mask | FontWeight300Mask | FontWeight400Mask | FontWeight500Mask | FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask
+ };
+
+} // namespace WebCore
+#endif // FontTraitsMask_h
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef FontValue_h
+#define FontValue_h
+
+#include "CSSValue.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class CSSPrimitiveValue;
+class CSSValueList;
+
+class FontValue : public CSSValue {
+public:
+ static PassRefPtr<FontValue> create()
+ {
+ return adoptRef(new FontValue);
+ }
+
+ virtual String cssText() const;
+
+ RefPtr<CSSPrimitiveValue> style;
+ RefPtr<CSSPrimitiveValue> variant;
+ RefPtr<CSSPrimitiveValue> weight;
+ RefPtr<CSSPrimitiveValue> size;
+ RefPtr<CSSPrimitiveValue> lineHeight;
+ RefPtr<CSSValueList> family;
+
+private:
+ FontValue() { }
+
+ virtual bool isFontValue() const { return true; }
+};
+
+} // namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef FormControlElement_h
+#define FormControlElement_h
+
+namespace WebCore {
+
+class AtomicString;
+class Element;
+
+class FormControlElement {
+public:
+ virtual ~FormControlElement() { }
+
+ virtual bool valueMatchesRenderer() const = 0;
+ virtual void setValueMatchesRenderer(bool value = true) = 0;
+
+ virtual const AtomicString& name() const = 0;
+ virtual const AtomicString& type() const = 0;
+
+protected:
+ FormControlElement() { }
+};
+
+FormControlElement* toFormControlElement(Element*);
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef FormControlElementWithState_h
+#define FormControlElementWithState_h
+
+namespace WebCore {
+
+class Document;
+class Element;
+class FormControlElement;
+class String;
+
+class FormControlElementWithState {
+public:
+ virtual ~FormControlElementWithState() { }
+
+ virtual bool saveState(String& value) const = 0;
+ virtual void restoreState(const String& value) = 0;
+
+ // Every FormControlElementWithState class, is also a FormControlElement class by definition.
+ virtual FormControlElement* toFormControlElement() = 0;
+
+protected:
+ FormControlElementWithState() { }
+
+ static void registerFormControlElementWithState(FormControlElementWithState*, Document*);
+ static void unregisterFormControlElementWithState(FormControlElementWithState*, Document*);
+ static void finishParsingChildren(FormControlElementWithState*, Document*);
+};
+
+FormControlElementWithState* toFormControlElementWithState(Element*);
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef FormData_h
+#define FormData_h
+
+#include "PlatformString.h"
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class ChromeClient;
+
+class FormDataElement {
+public:
+ FormDataElement() : m_type(data) { }
+ FormDataElement(const Vector<char>& array) : m_type(data), m_data(array) { }
+ FormDataElement(const String& filename, bool shouldGenerateFile) : m_type(encodedFile), m_filename(filename), m_shouldGenerateFile(shouldGenerateFile) { }
+
+ enum { data, encodedFile } m_type;
+ Vector<char> m_data;
+ String m_filename;
+ String m_generatedFilename;
+ bool m_shouldGenerateFile;
+};
+
+inline bool operator==(const FormDataElement& a, const FormDataElement& b)
+{
+ if (&a == &b)
+ return true;
+
+ if (a.m_type != b.m_type)
+ return false;
+ if (a.m_data != b.m_data)
+ return false;
+ if (a.m_filename != b.m_filename)
+ return false;
+
+ return true;
+}
+
+inline bool operator!=(const FormDataElement& a, const FormDataElement& b)
+{
+ return !(a == b);
+}
+
+class FormData : public RefCounted<FormData> {
+public:
+ static PassRefPtr<FormData> create();
+ static PassRefPtr<FormData> create(const void*, size_t);
+ static PassRefPtr<FormData> create(const CString&);
+ static PassRefPtr<FormData> create(const Vector<char>&);
+ PassRefPtr<FormData> copy() const;
+ PassRefPtr<FormData> deepCopy() const;
+ ~FormData();
+
+ void appendData(const void* data, size_t);
+ void appendFile(const String& filename, bool shouldGenerateFile = false);
+
+ void flatten(Vector<char>&) const; // omits files
+ String flattenToString() const; // omits files
+
+ bool isEmpty() const { return m_elements.isEmpty(); }
+ const Vector<FormDataElement>& elements() const { return m_elements; }
+
+ void generateFiles(ChromeClient*);
+ void removeGeneratedFilesIfNeeded();
+
+ bool alwaysStream() const { return m_alwaysStream; }
+ void setAlwaysStream(bool alwaysStream) { m_alwaysStream = alwaysStream; }
+
+private:
+ FormData();
+ FormData(const FormData&);
+
+ Vector<FormDataElement> m_elements;
+ bool m_hasGeneratedFiles;
+ bool m_alwaysStream;
+};
+
+inline bool operator==(const FormData& a, const FormData& b)
+{
+ return a.elements() == b.elements();
+}
+
+inline bool operator!=(const FormData& a, const FormData& b)
+{
+ return a.elements() != b.elements();
+}
+
+} // namespace WebCore
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef FormDataBuilder_h
+#define FormDataBuilder_h
+
+#include "PlatformString.h"
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+class CString;
+class Document;
+class TextEncoding;
+
+class FormDataBuilder : Noncopyable {
+public:
+ FormDataBuilder();
+ ~FormDataBuilder();
+
+ bool isPostMethod() const { return m_isPostMethod; }
+ void setIsPostMethod(bool value) { m_isPostMethod = value; }
+
+ bool isMultiPartForm() const { return m_isMultiPartForm; }
+ void setIsMultiPartForm(bool value) { m_isMultiPartForm = value; }
+
+ String encodingType() const { return m_encodingType; }
+ void setEncodingType(const String& value) { m_encodingType = value; }
+
+ String acceptCharset() const { return m_acceptCharset; }
+ void setAcceptCharset(const String& value) { m_acceptCharset = value; }
+
+ void parseEncodingType(const String&);
+ void parseMethodType(const String&);
+
+ TextEncoding dataEncoding(Document*) const;
+
+ // Helper functions used by HTMLFormElement/WMLGoElement for multi-part form data
+ static Vector<char> generateUniqueBoundaryString();
+ static void beginMultiPartHeader(Vector<char>&, const CString& boundary, const CString& name);
+ static void addBoundaryToMultiPartHeader(Vector<char>&, const CString& boundary, bool isLastBoundary = false);
+ static void addFilenameToMultiPartHeader(Vector<char>&, const TextEncoding&, const String& filename);
+ static void addContentTypeToMultiPartHeader(Vector<char>&, const CString& mimeType);
+ static void finishMultiPartHeader(Vector<char>&);
+
+ // Helper functions used by HTMLFormElement/WMLGoElement for non multi-part form data
+ static void addKeyValuePairAsFormData(Vector<char>&, const CString& key, const CString& value);
+ static void encodeStringAsFormData(Vector<char>&, const CString&);
+
+private:
+ bool m_isPostMethod;
+ bool m_isMultiPartForm;
+
+ String m_encodingType;
+ String m_acceptCharset;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef FormDataList_h
+#define FormDataList_h
+
+#include "CString.h"
+#include "File.h"
+#include "TextEncoding.h"
+
+namespace WebCore {
+
+class FormDataList {
+public:
+ FormDataList(const TextEncoding&);
+
+ void appendData(const String& key, const String& value)
+ { appendString(key); appendString(value); }
+ void appendData(const String& key, const CString& value)
+ { appendString(key); appendString(value); }
+ void appendData(const String& key, int value)
+ { appendString(key); appendString(String::number(value)); }
+ void appendFile(const String& key, PassRefPtr<File> file)
+ { appendString(key); m_list.append(file); }
+
+ class Item {
+ public:
+ Item() { }
+ Item(const CString& data) : m_data(data) { }
+ Item(PassRefPtr<File> file) : m_file(file) { }
+
+ const CString& data() const { return m_data; }
+ File* file() const { return m_file.get(); }
+
+ private:
+ CString m_data;
+ RefPtr<File> m_file;
+ };
+
+ const Vector<Item>& list() const { return m_list; }
+
+private:
+ void appendString(const CString&);
+ void appendString(const String&);
+
+ TextEncoding m_encoding;
+ Vector<Item> m_list;
+};
+
+} // namespace WebCore
+
+#endif // FormDataList_h
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* originally written by Becky Willrich, additional code by Darin Adler */
+
+#include "config.h"
+#include "FormDataStreamCFNet.h"
+
+#include "CString.h"
+#include "FileSystem.h"
+#include "FormData.h"
+#include <CFNetwork/CFURLRequestPriv.h>
+#include <CoreFoundation/CFStreamAbstract.h>
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
+#include <sys/types.h>
+#include <wtf/Assertions.h>
+#include <wtf/HashMap.h>
+#include <wtf/RetainPtr.h>
+
+#define USE_V1_CFSTREAM_CALLBACKS
+#ifdef USE_V1_CFSTREAM_CALLBACKS
+typedef CFReadStreamCallBacksV1 WCReadStreamCallBacks;
+#else
+typedef CFReadStreamCallBacks WCReadStreamCallBacks;
+#endif
+
+namespace WebCore {
+
+static HashMap<CFReadStreamRef, RefPtr<FormData> >& getStreamFormDatas()
+{
+ static HashMap<CFReadStreamRef, RefPtr<FormData> > streamFormDatas;
+ return streamFormDatas;
+}
+
+static void formEventCallback(CFReadStreamRef stream, CFStreamEventType type, void* context);
+
+struct FormStreamFields {
+ CFMutableSetRef scheduledRunLoopPairs;
+ Vector<FormDataElement> remainingElements; // in reverse order
+ CFReadStreamRef currentStream;
+ char* currentData;
+ CFReadStreamRef formStream;
+};
+
+struct SchedulePair {
+ CFRunLoopRef runLoop;
+ CFStringRef mode;
+};
+
+static const void* pairRetain(CFAllocatorRef alloc, const void* value)
+{
+ const SchedulePair* pair = static_cast<const SchedulePair*>(value);
+
+ SchedulePair* result = new SchedulePair;
+ CFRetain(pair->runLoop);
+ result->runLoop = pair->runLoop;
+ result->mode = CFStringCreateCopy(alloc, pair->mode);
+ return result;
+}
+
+static void pairRelease(CFAllocatorRef alloc, const void* value)
+{
+ const SchedulePair* pair = static_cast<const SchedulePair*>(value);
+
+ CFRelease(pair->runLoop);
+ CFRelease(pair->mode);
+ delete pair;
+}
+
+static Boolean pairEqual(const void* a, const void* b)
+{
+ const SchedulePair* pairA = static_cast<const SchedulePair*>(a);
+ const SchedulePair* pairB = static_cast<const SchedulePair*>(b);
+
+ return pairA->runLoop == pairB->runLoop && CFEqual(pairA->mode, pairB->mode);
+}
+
+static CFHashCode pairHash(const void* value)
+{
+ const SchedulePair* pair = static_cast<const SchedulePair*>(value);
+
+ return (CFHashCode)pair->runLoop ^ CFHash(pair->mode);
+}
+
+static void closeCurrentStream(FormStreamFields *form)
+{
+ if (form->currentStream) {
+ CFReadStreamClose(form->currentStream);
+ CFReadStreamSetClient(form->currentStream, kCFStreamEventNone, NULL, NULL);
+ CFRelease(form->currentStream);
+ form->currentStream = NULL;
+ }
+ if (form->currentData) {
+ fastFree(form->currentData);
+ form->currentData = 0;
+ }
+}
+
+static void scheduleWithPair(const void* value, void* context)
+{
+ const SchedulePair* pair = static_cast<const SchedulePair*>(value);
+ CFReadStreamRef stream = (CFReadStreamRef)context;
+
+ CFReadStreamScheduleWithRunLoop(stream, pair->runLoop, pair->mode);
+}
+
+static void advanceCurrentStream(FormStreamFields *form)
+{
+ closeCurrentStream(form);
+
+ if (form->remainingElements.isEmpty())
+ return;
+
+ // Create the new stream.
+ FormDataElement& nextInput = form->remainingElements.last();
+ if (nextInput.m_type == FormDataElement::data) {
+ size_t size = nextInput.m_data.size();
+ char* data = nextInput.m_data.releaseBuffer();
+ form->currentStream = CFReadStreamCreateWithBytesNoCopy(0, reinterpret_cast<const UInt8*>(data), size, kCFAllocatorNull);
+ form->currentData = data;
+ } else {
+ CFStringRef filename = nextInput.m_filename.createCFString();
+#if PLATFORM(WIN)
+ CFURLRef fileURL = CFURLCreateWithFileSystemPath(0, filename, kCFURLWindowsPathStyle, FALSE);
+#else
+ CFURLRef fileURL = CFURLCreateWithFileSystemPath(0, filename, kCFURLPOSIXPathStyle, FALSE);
+#endif
+ CFRelease(filename);
+ form->currentStream = CFReadStreamCreateWithFile(0, fileURL);
+ CFRelease(fileURL);
+ }
+ form->remainingElements.removeLast();
+
+ // Set up the callback.
+ CFStreamClientContext context = { 0, form, NULL, NULL, NULL };
+ CFReadStreamSetClient(form->currentStream, kCFStreamEventHasBytesAvailable | kCFStreamEventErrorOccurred | kCFStreamEventEndEncountered,
+ formEventCallback, &context);
+
+ // Schedule with the current set of run loops.
+ CFSetApplyFunction(form->scheduledRunLoopPairs, scheduleWithPair, form->currentStream);
+}
+
+static void openNextStream(FormStreamFields* form)
+{
+ // Skip over any streams we can't open.
+ // For some purposes we might want to return an error, but the current CFURLConnection
+ // can't really do anything useful with an error at this point, so this is better.
+ advanceCurrentStream(form);
+ while (form->currentStream && !CFReadStreamOpen(form->currentStream))
+ advanceCurrentStream(form);
+}
+
+static void* formCreate(CFReadStreamRef stream, void* context)
+{
+ FormData* formData = static_cast<FormData*>(context);
+
+ CFSetCallBacks runLoopAndModeCallBacks = { 0, pairRetain, pairRelease, NULL, pairEqual, pairHash };
+
+ FormStreamFields* newInfo = new FormStreamFields;
+ newInfo->scheduledRunLoopPairs = CFSetCreateMutable(0, 0, &runLoopAndModeCallBacks);
+ newInfo->currentStream = NULL;
+ newInfo->currentData = 0;
+ newInfo->formStream = stream; // Don't retain. That would create a reference cycle.
+
+ // Append in reverse order since we remove elements from the end.
+ size_t size = formData->elements().size();
+ newInfo->remainingElements.reserveCapacity(size);
+ for (size_t i = 0; i < size; ++i)
+ newInfo->remainingElements.append(formData->elements()[size - i - 1]);
+
+ getStreamFormDatas().set(stream, adoptRef(formData));
+
+ return newInfo;
+}
+
+static void formFinalize(CFReadStreamRef stream, void* context)
+{
+ FormStreamFields* form = static_cast<FormStreamFields*>(context);
+
+ getStreamFormDatas().remove(stream);
+
+ closeCurrentStream(form);
+ CFRelease(form->scheduledRunLoopPairs);
+ delete form;
+}
+
+static Boolean formOpen(CFReadStreamRef stream, CFStreamError* error, Boolean* openComplete, void* context)
+{
+ FormStreamFields* form = static_cast<FormStreamFields*>(context);
+
+ openNextStream(form);
+
+ *openComplete = TRUE;
+ error->error = 0;
+ return TRUE;
+}
+
+static CFIndex formRead(CFReadStreamRef stream, UInt8* buffer, CFIndex bufferLength, CFStreamError* error, Boolean* atEOF, void* context)
+{
+ FormStreamFields* form = static_cast<FormStreamFields*>(context);
+
+ while (form->currentStream) {
+ CFIndex bytesRead = CFReadStreamRead(form->currentStream, buffer, bufferLength);
+ if (bytesRead < 0) {
+ *error = CFReadStreamGetError(form->currentStream);
+ return -1;
+ }
+ if (bytesRead > 0) {
+ error->error = 0;
+ *atEOF = FALSE;
+ return bytesRead;
+ }
+ openNextStream(form);
+ }
+
+ error->error = 0;
+ *atEOF = TRUE;
+ return 0;
+}
+
+static Boolean formCanRead(CFReadStreamRef stream, void* context)
+{
+ FormStreamFields* form = static_cast<FormStreamFields*>(context);
+
+ while (form->currentStream && CFReadStreamGetStatus(form->currentStream) == kCFStreamStatusAtEnd) {
+ openNextStream(form);
+ }
+ if (!form->currentStream) {
+ CFReadStreamSignalEvent(stream, kCFStreamEventEndEncountered, 0);
+ return FALSE;
+ }
+ return CFReadStreamHasBytesAvailable(form->currentStream);
+}
+
+static void formClose(CFReadStreamRef stream, void* context)
+{
+ FormStreamFields* form = static_cast<FormStreamFields*>(context);
+
+ closeCurrentStream(form);
+}
+
+static void formSchedule(CFReadStreamRef stream, CFRunLoopRef runLoop, CFStringRef runLoopMode, void* context)
+{
+ FormStreamFields* form = static_cast<FormStreamFields*>(context);
+
+ if (form->currentStream)
+ CFReadStreamScheduleWithRunLoop(form->currentStream, runLoop, runLoopMode);
+ SchedulePair pair = { runLoop, runLoopMode };
+ CFSetAddValue(form->scheduledRunLoopPairs, &pair);
+}
+
+static void formUnschedule(CFReadStreamRef stream, CFRunLoopRef runLoop, CFStringRef runLoopMode, void* context)
+{
+ FormStreamFields* form = static_cast<FormStreamFields*>(context);
+
+ if (form->currentStream)
+ CFReadStreamUnscheduleFromRunLoop(form->currentStream, runLoop, runLoopMode);
+ SchedulePair pair = { runLoop, runLoopMode };
+ CFSetRemoveValue(form->scheduledRunLoopPairs, &pair);
+}
+
+static void formEventCallback(CFReadStreamRef stream, CFStreamEventType type, void* context)
+{
+ FormStreamFields* form = static_cast<FormStreamFields*>(context);
+
+ switch (type) {
+ case kCFStreamEventHasBytesAvailable:
+ CFReadStreamSignalEvent(form->formStream, kCFStreamEventHasBytesAvailable, 0);
+ break;
+ case kCFStreamEventErrorOccurred: {
+ CFStreamError readStreamError = CFReadStreamGetError(stream);
+ CFReadStreamSignalEvent(form->formStream, kCFStreamEventErrorOccurred, &readStreamError);
+ break;
+ }
+ case kCFStreamEventEndEncountered:
+ openNextStream(form);
+ if (!form->currentStream)
+ CFReadStreamSignalEvent(form->formStream, kCFStreamEventEndEncountered, 0);
+ break;
+ case kCFStreamEventNone:
+ LOG_ERROR("unexpected kCFStreamEventNone");
+ break;
+ case kCFStreamEventOpenCompleted:
+ LOG_ERROR("unexpected kCFStreamEventOpenCompleted");
+ break;
+ case kCFStreamEventCanAcceptBytes:
+ LOG_ERROR("unexpected kCFStreamEventCanAcceptBytes");
+ break;
+ }
+}
+
+void setHTTPBody(CFMutableURLRequestRef request, PassRefPtr<FormData> formData)
+{
+ if (!formData) {
+ if (wkCanAccessCFURLRequestHTTPBodyParts())
+ wkCFURLRequestSetHTTPRequestBodyParts(request, 0);
+ return;
+ }
+
+ size_t count = formData->elements().size();
+
+ if (count == 0)
+ return;
+
+ // Handle the common special case of one piece of form data, with no files.
+ if (count == 1) {
+ const FormDataElement& element = formData->elements()[0];
+ if (element.m_type == FormDataElement::data) {
+ CFDataRef data = CFDataCreate(0, reinterpret_cast<const UInt8 *>(element.m_data.data()), element.m_data.size());
+ CFURLRequestSetHTTPRequestBody(request, data);
+ CFRelease(data);
+ return;
+ }
+ }
+
+ if (wkCanAccessCFURLRequestHTTPBodyParts()) {
+ RetainPtr<CFMutableArrayRef> array(AdoptCF, CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks));
+
+ for (size_t i = 0; i < count; ++i) {
+ const FormDataElement& element = formData->elements()[i];
+ if (element.m_type == FormDataElement::data) {
+ RetainPtr<CFDataRef> data(AdoptCF, CFDataCreate(0, reinterpret_cast<const UInt8*>(element.m_data.data()), element.m_data.size()));
+ CFArrayAppendValue(array.get(), data.get());
+ } else {
+ RetainPtr<CFStringRef> filename(AdoptCF, element.m_filename.createCFString());
+ CFArrayAppendValue(array.get(), filename.get());
+ }
+ }
+
+ wkCFURLRequestSetHTTPRequestBodyParts(request, array.get());
+ return;
+ }
+
+ // Precompute the content length so CFURLConnection doesn't use chunked mode.
+ bool haveLength = true;
+ long long length = 0;
+ for (size_t i = 0; i < count; ++i) {
+ const FormDataElement& element = formData->elements()[i];
+ if (element.m_type == FormDataElement::data)
+ length += element.m_data.size();
+ else {
+ long long size;
+ if (getFileSize(element.m_filename, size))
+ length += size;
+ else
+ haveLength = false;
+ }
+ }
+
+ if (haveLength) {
+ CFStringRef lengthStr = CFStringCreateWithFormat(0, 0, CFSTR("%lld"), length);
+ CFURLRequestSetHTTPHeaderFieldValue(request, CFSTR("Content-Length"), lengthStr);
+ CFRelease(lengthStr);
+ }
+
+ static WCReadStreamCallBacks formDataStreamCallbacks =
+ { 1, formCreate, formFinalize, 0, formOpen, 0, formRead, 0, formCanRead, formClose, 0, 0, 0, formSchedule, formUnschedule };
+
+ CFReadStreamRef stream = CFReadStreamCreate(0, (CFReadStreamCallBacks *)&formDataStreamCallbacks, formData.releaseRef());
+ CFURLRequestSetHTTPRequestBodyStream(request, stream);
+ CFRelease(stream);
+}
+
+PassRefPtr<FormData> httpBodyFromRequest(CFURLRequestRef request)
+{
+ if (RetainPtr<CFDataRef> bodyData = CFURLRequestCopyHTTPRequestBody(request))
+ return FormData::create(CFDataGetBytePtr(bodyData.get()), CFDataGetLength(bodyData.get()));
+
+ if (wkCanAccessCFURLRequestHTTPBodyParts()) {
+ if (RetainPtr<CFArrayRef> bodyParts = wkCFURLRequestCopyHTTPRequestBodyParts(request)) {
+ RefPtr<FormData> formData = FormData::create();
+
+ CFIndex count = CFArrayGetCount(bodyParts.get());
+ for (CFIndex i = 0; i < count; i++) {
+ CFTypeRef bodyPart = CFArrayGetValueAtIndex(bodyParts.get(), i);
+ CFTypeID typeID = CFGetTypeID(bodyPart);
+ if (typeID == CFStringGetTypeID()) {
+ String filename = (CFStringRef)bodyPart;
+ formData->appendFile(filename);
+ } else if (typeID == CFDataGetTypeID()) {
+ CFDataRef data = (CFDataRef)bodyPart;
+ formData->appendData(CFDataGetBytePtr(data), CFDataGetLength(data));
+ } else
+ ASSERT_NOT_REACHED();
+ }
+ return formData.release();
+ }
+ } else {
+ if (RetainPtr<CFReadStreamRef> bodyStream = CFURLRequestCopyHTTPRequestBodyStream(request))
+ return getStreamFormDatas().get(bodyStream.get());
+ }
+
+ // FIXME: what to do about arbitrary body streams?
+ return 0;
+}
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FormDataStreamCFNet_h_
+#define FormDataStreamCFNet_h_
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <wtf/Forward.h>
+
+typedef struct _CFURLRequest* CFMutableURLRequestRef;
+typedef const struct _CFURLRequest* CFURLRequestRef;
+
+namespace WebCore {
+ class FormData;
+ void setHTTPBody(CFMutableURLRequestRef, PassRefPtr<FormData>);
+ PassRefPtr<FormData> httpBodyFromRequest(CFURLRequestRef);
+}
+
+#endif FormDataStreamCFNet_h_
--- /dev/null
+/*
+ * Copyright (C) 2006, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FormState_h
+#define FormState_h
+
+#include "PlatformString.h"
+
+namespace WebCore {
+
+ class Frame;
+ class HTMLFormElement;
+
+ typedef Vector<std::pair<String, String> > StringPairVector;
+
+ class FormState : public RefCounted<FormState> {
+ public:
+ static PassRefPtr<FormState> create(PassRefPtr<HTMLFormElement>, StringPairVector& textFieldValuesToAdopt, PassRefPtr<Frame>);
+
+ HTMLFormElement* form() const { return m_form.get(); }
+ const StringPairVector& textFieldValues() const { return m_textFieldValues; }
+ Frame* sourceFrame() const { return m_sourceFrame.get(); }
+
+ private:
+ FormState(PassRefPtr<HTMLFormElement>, StringPairVector& textFieldValuesToAdopt, PassRefPtr<Frame>);
+
+ RefPtr<HTMLFormElement> m_form;
+ StringPairVector m_textFieldValues;
+ RefPtr<Frame> m_sourceFrame;
+ };
+
+}
+
+#endif // FormState_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FormatBlockCommand_h
+#define FormatBlockCommand_h
+
+#include "CompositeEditCommand.h"
+
+namespace WebCore {
+
+class FormatBlockCommand : public CompositeEditCommand {
+public:
+ static PassRefPtr<FormatBlockCommand> create(Document* document, const AtomicString& tagName)
+ {
+ return adoptRef(new FormatBlockCommand(document, tagName));
+ }
+
+private:
+ FormatBlockCommand(Document*, const AtomicString& tagName);
+
+ virtual void doApply();
+ virtual EditAction editingAction() const { return EditActionFormatBlock; }
+
+ bool modifyRange();
+ AtomicString m_tagName;
+};
+
+} // namespace WebCore
+
+#endif // FormatBlockCommand_h
--- /dev/null
+/*
+ * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ * 1999-2001 Lars Knoll <knoll@kde.org>
+ * 1999-2001 Antti Koivisto <koivisto@kde.org>
+ * 2000-2001 Simon Hausmann <hausmann@kde.org>
+ * 2000-2001 Dirk Mueller <mueller@kde.org>
+ * 2000 Stefan Schimanski <1Stein@gmx.de>
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef Frame_h
+#define Frame_h
+
+#include "AnimationController.h"
+#include "DragImage.h"
+#include "EditAction.h"
+#include "Editor.h"
+#include "EventHandler.h"
+#include "FrameLoader.h"
+#include "FrameTree.h"
+#include "Range.h"
+#include "RenderLayer.h"
+#include "ScriptController.h"
+#include "SelectionController.h"
+#include "TextGranularity.h"
+
+#include "Frame.h"
+#include "KURL.h"
+#include <GraphicsServices/GSEvent.h>
+
+#if PLATFORM(WIN)
+#include "FrameWin.h"
+#endif
+
+#ifndef __OBJC__
+class NSArray;
+class NSDictionary;
+class NSMutableDictionary;
+class NSString;
+typedef int NSWritingDirection;
+#endif
+
+#ifdef __OBJC__
+@class DOMNode;
+#else
+class DOMNode;
+#endif
+
+#if PLATFORM(WIN)
+typedef struct HBITMAP__* HBITMAP;
+#endif
+
+namespace WebCore {
+
+class Editor;
+class EventHandler;
+class FrameLoader;
+class FrameLoaderClient;
+class FramePrivate;
+class FrameTree;
+class HTMLFrameOwnerElement;
+class HTMLTableCellElement;
+class ScriptController;
+class RegularExpression;
+class RenderLayer;
+class RenderPart;
+class Selection;
+class SelectionController;
+class Widget;
+
+#if FRAME_LOADS_USER_STYLESHEET
+ class UserStyleSheetLoader;
+#endif
+
+template <typename T> class Timer;
+
+enum {
+ OverflowScrollNone = 0x0,
+ OverflowScrollLeft = 0x1,
+ OverflowScrollRight = 0x2,
+ OverflowScrollUp = 0x4,
+ OverflowScrollDown = 0x8
+};
+
+enum OverflowScrollAction { DoNotPerformOverflowScroll, PerformOverflowScroll };
+typedef Node* (*NodeQualifier)(HitTestResult aHitTestResult, Node* terminationNode, IntRect* frame);
+
+
+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(FrameView*);
+ ~Frame();
+
+ void init();
+ // Creates <html (contentEditable="true")><body style="..."></body></html> doing minimal amount of work
+ void initWithSimpleHTMLDocument(const String& style, bool editable, const KURL& url);
+
+ Page* page() const;
+ HTMLFrameOwnerElement* ownerElement() const;
+
+ void pageDestroyed();
+ void disconnectOwnerElement();
+
+ Document* document() const;
+ FrameView* view() const;
+
+ void setDOMWindow(DOMWindow*);
+ DOMWindow* domWindow() const;
+ void clearFormerDOMWindow(DOMWindow*);
+
+ Editor* editor() const;
+ EventHandler* eventHandler() const;
+ FrameLoader* loader() const;
+ SelectionController* selection() const;
+ FrameTree* tree() const;
+ AnimationController* animation() const;
+ ScriptController* script();
+
+ 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);
+
+ friend class FramePrivate;
+
+ float documentScale() const;
+ void setDocumentScale(float);
+
+private:
+ Frame(Page*, HTMLFrameOwnerElement*, FrameLoaderClient*);
+
+// === undecided, would like to consider moving to another class
+
+public:
+ static Frame* frameForWidget(const Widget*);
+
+ Settings* settings() const; // can be NULL
+
+#if FRAME_LOADS_USER_STYLESHEET
+ void setUserStyleSheetLocation(const KURL&);
+ void setUserStyleSheet(const String&, bool saveStyleSheet = false);
+#endif
+
+ void setPrinting(bool printing, float minPageWidth, float maxPageWidth, bool adjustViewSize);
+
+ bool inViewSourceMode() const;
+ void setInViewSourceMode(bool = true);
+
+ void keepAlive(); // Used to keep the frame alive when running a script that might destroy it.
+#ifndef NDEBUG
+ static void cancelAllKeepAlive();
+#endif
+
+#if ENABLE(IPHONE_PPT)
+ void didParse(double);
+ void didLayout(bool, double);
+ void didForcedLayout();
+ void getPPTStats(unsigned& parseCount, unsigned& layoutCount, unsigned& forcedLayoutCount, CFTimeInterval& parseDuration, CFTimeInterval& layoutDuration);
+ void clearPPTStats();
+#endif
+
+ void formElementDidSetValue(Element*);
+ void formElementDidFocus(Element*);
+ void formElementDidBlur(Element*);
+
+ const ViewportArguments& viewportArguments() const;
+ void setViewportArguments(const ViewportArguments&);
+ NSDictionary* dictionaryForViewportArguments(const ViewportArguments& arguments) const;
+
+ inline void betterApproximateNode(int x, int y, NodeQualifier aQualifer, Node* & best, Node* failedNode, IntPoint &bestPoint, IntRect &bestRect, IntRect& testRect);
+ inline Node* qualifyingNodeAtViewportLocation(CGPoint* aViewportLocation, NodeQualifier aQualifer, bool shouldApproximate);
+
+ Node* nodeRespondingToClickEvents(CGPoint* aViewportLocation);
+ Node* nodeRespondingToScrollWheelEvents(CGPoint* aViewportLocation);
+
+ int indexCountOfWordPrecedingSelection(NSString *word);
+ NSArray *wordsInCurrentParagraph();
+ CGRect renderRectForPoint(CGPoint point, bool *isReplaced, float *fontSize);
+
+ void setEmbeddedEditingMode(bool b = true);
+ bool embeddedEditingMode() const;
+
+ void setDocument(PassRefPtr<Document>);
+
+ void sendOrientationChangeEvent(int orientation);
+ int orientation() const;
+
+ 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 --
+ // should move onto ScriptController
+ void clearDOMWindow();
+
+ String displayStringModifiedByEncoding(const String& str) const
+ {
+ return document() ? document()->displayStringModifiedByEncoding(str) : str;
+ }
+
+private:
+ void lifeSupportTimerFired(Timer<Frame>*);
+
+// === to be moved into Document
+
+public:
+ bool isFrameSet() const;
+
+// === to be moved into EventHandler
+
+public:
+ void sendResizeEvent();
+ void sendScrollEvent();
+
+// === to be moved into FrameView
+
+public:
+ void forceLayout(bool allowSubtree = false);
+ void forceLayoutWithPageWidthRange(float minPageWidth, float maxPageWidth, bool adjustViewSize);
+
+ void adjustPageHeight(float* newBottom, float oldTop, float oldBottom, float bottomLimit);
+
+ 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 Chrome
+
+public:
+ void focusWindow();
+ void unfocusWindow();
+ bool shouldClose();
+ void scheduleClose();
+
+ void setJSStatusBarText(const String&);
+ void setJSDefaultStatusBarText(const String&);
+ String jsStatusBarText() const;
+ String jsDefaultStatusBarText() const;
+
+// === to be moved into Editor
+
+public:
+ String selectedText() const;
+ bool findString(const String&, bool forward, bool caseFlag, bool wrapFlag, bool startInSelection);
+
+ const Selection& mark() const; // Mark, to be used as emacs uses it.
+ void setMark(const Selection&);
+
+ /**
+ * Clears the current selection.
+ */
+ void clearSelection();
+
+ void computeAndSetTypingStyle(CSSStyleDeclaration* , EditAction = EditActionUnspecified);
+ String selectionStartStylePropertyValue(int stylePropertyID) const;
+ void applyEditingStyleToBodyElement() const;
+ void removeEditingStyleFromBodyElement() const;
+ void applyEditingStyleToElement(Element*) const;
+ void removeEditingStyleFromElement(Element*) const;
+
+ IntRect firstRectForRange(Range*) const;
+
+ void respondToChangedSelection(const Selection& oldSelection, bool closeTyping);
+ bool shouldChangeSelection(const Selection& oldSelection, const Selection& newSelection, EAffinity, bool stillSelecting) const;
+
+ RenderStyle* styleForSelectionStart(Node*& nodeToRemove) const;
+
+ unsigned markAllMatchesForText(const String&, bool caseFlag, unsigned limit);
+ bool markedTextMatchesAreHighlighted() const;
+ void setMarkedTextMatchesAreHighlighted(bool flag);
+
+ PassRefPtr<CSSComputedStyleDeclaration> selectionComputedStyle(Node*& nodeToRemove) const;
+
+ void textFieldDidBeginEditing(Element*);
+ void textFieldDidEndEditing(Element*);
+ void textDidChangeInTextField(Element*);
+ bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*);
+ void textWillBeDeletedInTextField(Element* input);
+ void textDidChangeInTextArea(Element*);
+
+ DragImageRef dragImageForSelection();
+
+// === to be moved into SelectionController
+
+public:
+ TextGranularity selectionGranularity() const;
+ void setSelectionGranularity(TextGranularity);
+
+ bool shouldChangeSelection(const Selection&) const;
+ bool shouldDeleteSelection(const Selection&) const;
+ void clearCaretRectIfNeeded();
+ void setFocusedNodeIfNeeded();
+ void selectionLayoutChanged();
+ void notifyRendererOfSelectionChange(bool userTriggered);
+
+ void setSingleLineSelectionBehavior(bool b);
+ bool singleLineSelectionBehavior() const;
+
+ void invalidateSelection();
+
+ 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 setCaretColor(const Color &color);
+
+ /**
+ * Scroll the selection in an overflow layer on iPhone.
+ */
+ void scrollOverflowLayer(RenderLayer *, const IntRect &visibleRect, const IntRect &exposeRect);
+
+ void invalidateOwnerRendererLayoutIfNeeded();
+
+ bool isContentEditable() const; // if true, everything in frame is editable
+
+ void updateSecureKeyboardEntryIfActive();
+
+ CSSMutableStyleDeclaration* typingStyle() const;
+ void setTypingStyle(CSSMutableStyleDeclaration*);
+ void clearTypingStyle();
+
+ FloatRect selectionBounds(bool clipToVisibleContent = true) const;
+ void selectionTextRects(Vector<FloatRect>&, bool clipToVisibleContent = true) const;
+
+ HTMLFormElement* currentForm() const;
+
+ void revealSelection(const RenderLayer::ScrollAlignment& = RenderLayer::gAlignCenterIfNeeded, bool revealExtent = false);
+ void setSelectionFromNone();
+ void setCaretBlinks(bool flag = true);
+
+ void setUseSecureKeyboardEntry(bool);
+
+private:
+ void caretBlinkTimerFired(Timer<Frame>*);
+
+ void overflowAutoScrollTimerFired(Timer<Frame>*);
+ void startOverflowAutoScroll(const IntPoint &);
+ void stopOverflowAutoScroll();
+ int checkOverflowScroll(OverflowScrollAction);
+
+public:
+ SelectionController* dragCaretController() 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);
+
+#if PLATFORM(MAC)
+
+// === undecided, would like to consider moving to another class
+
+public:
+ NSString* searchForNSLabelsAboveCell(RegularExpression*, HTMLTableCellElement*);
+ NSString* searchForLabelsBeforeElement(NSArray* labels, Element*);
+ NSString* matchLabelsAgainstElement(NSArray* labels, Element*);
+
+#if ENABLE(DASHBOARD_SUPPORT)
+ NSMutableDictionary* dashboardRegionsDictionary();
+#endif
+
+
+private:
+
+// === to be moved into Editor
+
+public:
+ NSDictionary* fontAttributesForSelectionStart() const;
+ NSWritingDirection baseWritingDirectionForSelectionStart() const;
+
+#endif
+
+ // Used to be in WebCoreFrameBridge
+public:
+ int preferredHeight() const;
+ int innerLineHeight(DOMNode *node) const;
+ void updateLayout() const;
+ NSRect caretRect() const;
+ NSRect rectForScrollToVisible() const;
+ void createDefaultFieldEditorDocumentStructure() const;
+ void moveSelectionToStartOrEndOfCurrentWord();
+ unsigned formElementsCharacterCount() const;
+ void setTimersPaused(bool);
+ bool timersPaused() const { return m_timersPausedCount; }
+ const FloatSize& visibleSize() const;
+ void setVisibleSize(const FloatSize& size);
+ void setRangedSelectionBaseToCurrentSelection();
+ void setRangedSelectionBaseToCurrentSelectionStart();
+ void setRangedSelectionBaseToCurrentSelectionEnd();
+ void clearRangedSelectionInitialExtent();
+ void setRangedSelectionInitialExtentToCurrentSelectionStart();
+ void setRangedSelectionInitialExtentToCurrentSelectionEnd();
+ Selection rangedSelectionBase() const;
+ Selection rangedSelectionInitialExtent() const;
+
+#if PLATFORM(WIN)
+
+public:
+ // FIXME - We should have a single version of nodeImage instead of using platform types.
+ HBITMAP nodeImage(Node*) const;
+
+#endif
+
+private:
+ Page* m_page;
+ mutable FrameTree m_treeNode;
+ mutable FrameLoader m_loader;
+
+ mutable RefPtr<DOMWindow> m_domWindow;
+ HashSet<DOMWindow*> m_liveFormerWindows;
+
+ HTMLFrameOwnerElement* m_ownerElement;
+ RefPtr<FrameView> m_view;
+ RefPtr<Document> m_doc;
+
+ ScriptController m_script;
+
+ String m_kjsStatusBarText;
+ String m_kjsDefaultStatusBarText;
+
+ float m_zoomFactor;
+
+ TextGranularity m_selectionGranularity;
+
+ mutable SelectionController m_selectionController;
+ mutable Selection m_mark;
+ Timer<Frame> m_caretBlinkTimer;
+ mutable Editor m_editor;
+ mutable EventHandler m_eventHandler;
+ mutable AnimationController m_animationController;
+
+ RefPtr<CSSMutableStyleDeclaration> m_typingStyle;
+
+ Color m_caretColor;
+ Timer<Frame> m_overflowAutoScrollTimer;
+ float m_overflowAutoScrollDelta;
+ IntPoint m_overflowAutoScrollPos;
+ ViewportArguments m_viewportArguments;
+ bool m_embeddedEditingMode;
+ FloatSize m_visibleSize;
+ int m_orientation;
+ Selection m_rangedSelectionBase;
+ Selection m_rangedSelectionInitialExtent;
+
+#if ENABLE(IPHONE_PPT)
+ unsigned m_parseCount;
+ unsigned m_layoutCount;
+ unsigned m_forcedLayoutCount;
+ CFTimeInterval m_parseDuration;
+ CFTimeInterval m_layoutDuration;
+#endif
+
+ Timer<Frame> m_lifeSupportTimer;
+
+ String m_userStyleSheet;
+
+ bool m_caretVisible;
+ bool m_caretBlinks;
+ bool m_caretPaint;
+
+ bool m_highlightTextMatches;
+ bool m_inViewSourceMode;
+ bool m_needsReapplyStyles;
+ bool m_isDisconnected;
+ bool m_excludeFromTextSearch;
+
+ bool m_singleLineSelectionBehavior;
+ int m_timersPausedCount;
+ float m_documentScale;
+
+#if FRAME_LOADS_USER_STYLESHEET
+ UserStyleSheetLoader* m_userStyleSheetLoader;
+#endif
+
+};
+
+} // namespace WebCore
+
+#endif // Frame_h
--- /dev/null
+/*
+ * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FrameLoadRequest_h
+#define FrameLoadRequest_h
+
+#include "ResourceRequest.h"
+
+namespace WebCore {
+
+ struct FrameLoadRequest {
+ public:
+ FrameLoadRequest()
+ {
+ }
+
+ FrameLoadRequest(const ResourceRequest& resourceRequest)
+ : m_resourceRequest(resourceRequest)
+ {
+ }
+
+ FrameLoadRequest(const ResourceRequest& resourceRequest, const String& frameName)
+ : m_resourceRequest(resourceRequest)
+ , m_frameName(frameName)
+ {
+ }
+
+ bool isEmpty() const { return m_resourceRequest.isEmpty(); }
+
+ ResourceRequest& resourceRequest() { return m_resourceRequest; }
+ const ResourceRequest& resourceRequest() const { return m_resourceRequest; }
+
+ const String& frameName() const { return m_frameName; }
+ void setFrameName(const String& frameName) { m_frameName = frameName; }
+
+ private:
+ ResourceRequest m_resourceRequest;
+ String m_frameName;
+ };
+
+}
+
+#endif // FrameLoadRequest_h
+
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FrameLoader_h
+#define FrameLoader_h
+
+#include "CachePolicy.h"
+#include "FrameLoaderTypes.h"
+#include "ResourceRequest.h"
+#include "Timer.h"
+
+#if USE(LOW_BANDWIDTH_DISPLAY)
+#include "CachedResourceClient.h"
+#endif
+
+namespace WebCore {
+
+ class Archive;
+ class AuthenticationChallenge;
+ class CachedPage;
+ class CachedResource;
+ class Document;
+ class DocumentLoader;
+ class Element;
+ class Event;
+ class FormData;
+ class FormState;
+ class Frame;
+ class FrameLoaderClient;
+ class HistoryItem;
+ class HTMLFormElement;
+ class HTMLFrameOwnerElement;
+ class IconLoader;
+ class IntSize;
+ class NavigationAction;
+ class ProtectionSpace;
+ class RenderPart;
+ class ResourceError;
+ class ResourceLoader;
+ class ResourceResponse;
+ class ScriptSourceCode;
+ class ScriptValue;
+ class SecurityOrigin;
+ class SharedBuffer;
+ class SubstituteData;
+ class TextResourceDecoder;
+ class Widget;
+
+ struct FrameLoadRequest;
+ struct ScheduledRedirection;
+ struct WindowFeatures;
+
+ bool isBackForwardLoadType(FrameLoadType);
+
+ typedef void (*NavigationPolicyDecisionFunction)(void* argument,
+ const ResourceRequest&, PassRefPtr<FormState>, bool shouldContinue);
+ typedef void (*NewWindowPolicyDecisionFunction)(void* argument,
+ const ResourceRequest&, PassRefPtr<FormState>, const String& frameName, bool shouldContinue);
+ typedef void (*ContentPolicyDecisionFunction)(void* argument, PolicyAction);
+
+ class PolicyCheck {
+ public:
+ PolicyCheck();
+
+ void clear();
+ void set(const ResourceRequest&, PassRefPtr<FormState>,
+ NavigationPolicyDecisionFunction, void* argument);
+ void set(const ResourceRequest&, PassRefPtr<FormState>, const String& frameName,
+ NewWindowPolicyDecisionFunction, void* argument);
+ void set(ContentPolicyDecisionFunction, void* argument);
+
+ const ResourceRequest& request() const { return m_request; }
+ void clearRequest();
+
+ void call(bool shouldContinue);
+ void call(PolicyAction);
+ void cancel();
+
+ private:
+ ResourceRequest m_request;
+ RefPtr<FormState> m_formState;
+ String m_frameName;
+
+ NavigationPolicyDecisionFunction m_navigationFunction;
+ NewWindowPolicyDecisionFunction m_newWindowFunction;
+ ContentPolicyDecisionFunction m_contentFunction;
+ void* m_argument;
+ };
+
+ class FrameLoader : Noncopyable
+#if USE(LOW_BANDWIDTH_DISPLAY)
+ , private CachedResourceClient
+#endif
+ {
+ public:
+ FrameLoader(Frame*, FrameLoaderClient*);
+ virtual ~FrameLoader();
+
+ void init();
+ void initForSynthesizedDocument(const KURL& url);
+
+ Frame* frame() const { return m_frame; }
+
+ // FIXME: This is not cool, people. There are too many different functions that all start loads.
+ // We should aim to consolidate these into a smaller set of functions, and try to reuse more of
+ // the logic by extracting common code paths.
+
+ void prepareForLoadStart();
+ void setupForReplace();
+ void setupForReplaceByMIMEType(const String& newMIMEType);
+
+ void loadURLIntoChildFrame(const KURL&, const String& referer, Frame*);
+
+ void loadFrameRequest(const FrameLoadRequest&, bool lockHistory, bool lockBackForwardList, // Called by submitForm, calls loadPostRequest()
+ bool userGesture, PassRefPtr<Event>, PassRefPtr<FormState>);
+
+ void load(const ResourceRequest&, bool lockHistory); // Called by WebFrame, calls load(ResourceRequest, SubstituteData).
+ void load(const ResourceRequest&, const SubstituteData&, bool lockHistory); // Called both by WebFrame and internally, calls load(DocumentLoader*).
+ void load(const ResourceRequest&, const String& frameName, bool lockHistory); // Called by WebPluginController.
+
+ void loadArchive(PassRefPtr<Archive>);
+
+ // Returns true for any non-local URL. If document parameter is supplied, its local load policy dictates,
+ // otherwise if referrer is non-empty and represents a local file, then the local load is allowed.
+ static bool canLoad(const KURL&, const String& referrer, const Document* = 0);
+ static void reportLocalLoadFailed(Frame*, const String& url);
+
+ static bool shouldHideReferrer(const KURL&, const String& referrer);
+
+ Frame* createWindow(FrameLoader* frameLoaderForFrameLookup, const FrameLoadRequest&, const WindowFeatures&, bool& created, bool userGesture);
+
+ unsigned long loadResourceSynchronously(const ResourceRequest&, ResourceError&, ResourceResponse&, Vector<char>& data);
+
+ bool canHandleRequest(const ResourceRequest&);
+
+ // Also not cool.
+ void stopAllLoaders();
+ void stopForUserCancel(bool deferCheckLoadComplete = false);
+
+ bool isLoadingMainResource() const { return m_isLoadingMainResource; }
+ bool isLoading() const;
+ bool frameHasLoaded() const;
+
+ int numPendingOrLoadingRequests(bool recurse) const;
+ String referrer() const;
+ String outgoingReferrer() const;
+ String outgoingOrigin() const;
+
+ DocumentLoader* activeDocumentLoader() const;
+ DocumentLoader* documentLoader() const;
+ DocumentLoader* provisionalDocumentLoader() const;
+ FrameState state() const;
+ static double timeOfLastCompletedLoad();
+
+ bool shouldUseCredentialStorage(ResourceLoader*);
+ void didReceiveAuthenticationChallenge(ResourceLoader*, const AuthenticationChallenge&);
+ void didCancelAuthenticationChallenge(ResourceLoader*, const AuthenticationChallenge&);
+
+ bool canAuthenticateAgainstProtectionSpace(ResourceLoader*, const ProtectionSpace&);
+
+ void assignIdentifierToInitialRequest(unsigned long identifier, const ResourceRequest&);
+ void willSendRequest(ResourceLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
+ void didReceiveResponse(ResourceLoader*, const ResourceResponse&);
+ void didReceiveData(ResourceLoader*, const char*, int, int lengthReceived);
+ void didFinishLoad(ResourceLoader*);
+ void didFailToLoad(ResourceLoader*, const ResourceError&);
+ const ResourceRequest& originalRequest() const;
+ const ResourceRequest& initialRequest() const;
+ void receivedMainResourceError(const ResourceError&, bool isComplete);
+ void receivedData(const char*, int);
+
+ void handleFallbackContent();
+ bool isStopping() const;
+
+ void finishedLoading();
+
+ ResourceError cancelledError(const ResourceRequest&) const;
+ ResourceError fileDoesNotExistError(const ResourceResponse&) const;
+ ResourceError blockedError(const ResourceRequest&) const;
+ ResourceError cannotShowURLError(const ResourceRequest&) const;
+
+ void cannotShowMIMEType(const ResourceResponse&);
+ ResourceError interruptionForPolicyChangeError(const ResourceRequest&);
+
+ bool isHostedByObjectElement() const;
+ bool isLoadingMainFrame() const;
+ bool canShowMIMEType(const String& MIMEType) const;
+ bool representationExistsForURLScheme(const String& URLScheme);
+ String generatedMIMETypeForURLScheme(const String& URLScheme);
+
+ void checkNavigationPolicy(const ResourceRequest&, NavigationPolicyDecisionFunction function, void* argument);
+ void checkContentPolicy(const String& MIMEType, ContentPolicyDecisionFunction, void* argument);
+ void cancelContentPolicyCheck();
+
+ void reload(bool endToEndReload = false);
+ void reloadWithOverrideEncoding(const String& overrideEncoding);
+
+ void didReceiveServerRedirectForProvisionalLoadForFrame();
+ void finishedLoadingDocument(DocumentLoader*);
+ void committedLoad(DocumentLoader*, const char*, int);
+ bool isReplacing() const;
+ void setReplacing();
+ void revertToProvisional(DocumentLoader*);
+ void setMainDocumentError(DocumentLoader*, const ResourceError&);
+ void mainReceivedCompleteError(DocumentLoader*, const ResourceError&);
+ bool subframeIsLoading() const;
+ void willChangeTitle(DocumentLoader*);
+ void didChangeTitle(DocumentLoader*);
+
+ FrameLoadType loadType() const;
+ CachePolicy cachePolicy() const;
+
+ void didFirstLayout();
+ bool firstLayoutDone() const;
+
+ void didFirstVisuallyNonEmptyLayout();
+
+#if ENABLE(WML)
+ void setForceReloadWmlDeck(bool);
+#endif
+
+ void loadedResourceFromMemoryCache(const CachedResource*);
+ void tellClientAboutPastMemoryCacheLoads();
+
+ void checkLoadComplete();
+ void detachFromParent();
+
+ void addExtraFieldsToSubresourceRequest(ResourceRequest&);
+ void addExtraFieldsToMainResourceRequest(ResourceRequest&);
+
+ static void addHTTPOriginIfNeeded(ResourceRequest&, String origin);
+
+ FrameLoaderClient* client() const { return m_client; }
+
+ void setDefersLoading(bool);
+
+ void changeLocation(const KURL&, const String& referrer, bool lockHistory = true, bool lockBackForwardList = true, bool userGesture = false, bool refresh = false);
+ void urlSelected(const ResourceRequest&, const String& target, PassRefPtr<Event>, bool lockHistory, bool lockBackForwardList, bool userGesture);
+ bool requestFrame(HTMLFrameOwnerElement*, const String& url, const AtomicString& frameName);
+
+ void submitForm(const char* action, const String& url,
+ PassRefPtr<FormData>, const String& target, const String& contentType, const String& boundary,
+ bool lockHistory, bool lockBackForwardList, PassRefPtr<Event>, PassRefPtr<FormState>);
+
+ void stop();
+ void stopLoading(bool sendUnload);
+
+ void didExplicitOpen();
+
+ KURL iconURL();
+ void commitIconURLToIconDatabase(const KURL&);
+
+ KURL baseURL() const;
+
+ bool isScheduledLocationChangePending() const { return m_scheduledRedirection && isLocationChange(*m_scheduledRedirection); }
+ void scheduleHTTPRedirection(double delay, const String& url);
+ void scheduleLocationChange(const String& url, const String& referrer, bool lockHistory = true, bool lockBackForwardList = true, bool userGesture = false);
+ void scheduleRefresh(bool userGesture = false);
+ void scheduleHistoryNavigation(int steps);
+
+ bool canGoBackOrForward(int distance) const;
+ void goBackOrForward(int distance);
+ int getHistoryLength();
+
+ void begin();
+ void begin(const KURL&, bool dispatchWindowObjectAvailable = true, SecurityOrigin* forcedSecurityOrigin = 0);
+
+ void write(const char* string, int length = -1, bool flush = false);
+ void write(const String&);
+ void end();
+ void endIfNotLoadingMainResource();
+
+ void setEncoding(const String& encoding, bool userChosen);
+ String encoding() const;
+
+ ScriptValue executeScript(const ScriptSourceCode&);
+ ScriptValue executeScript(const String& script, bool forceUserGesture = false);
+
+ void gotoAnchor();
+
+ void tokenizerProcessedData();
+
+ void handledOnloadEvents();
+ String userAgent(const KURL&) const;
+
+ Widget* createJavaAppletWidget(const IntSize&, Element*, const HashMap<String, String>& args);
+
+ void dispatchWindowObjectAvailable();
+ void restoreDocumentState();
+
+ Frame* opener();
+ void setOpener(Frame*);
+ bool openedByDOM() const;
+ void setOpenedByDOM();
+
+ bool userGestureHint();
+
+ void resetMultipleFormSubmissionProtection();
+
+ void addData(const char* bytes, int length);
+
+ void checkCallImplicitClose();
+
+ void frameDetached();
+
+ const KURL& url() const { return m_URL; }
+
+ void setResponseMIMEType(const String&);
+ const String& responseMIMEType() const;
+
+ bool containsPlugins() const;
+
+ void loadDone();
+ void finishedParsing();
+ void checkCompleted();
+
+ bool isComplete() const;
+
+ bool requestObject(RenderPart* frame, const String& url, const AtomicString& frameName,
+ const String& serviceType, const Vector<String>& paramNames, const Vector<String>& paramValues);
+
+ KURL completeURL(const String& url);
+
+ void cancelAndClear();
+
+ void setTitle(const String&);
+
+ void commitProvisionalLoad(PassRefPtr<CachedPage>);
+
+ void goToItem(HistoryItem*, FrameLoadType);
+ void saveDocumentAndScrollState();
+
+ HistoryItem* currentHistoryItem();
+ HistoryItem* previousHistoryItem();
+ HistoryItem* provisionalHistoryItem();
+ void setPreviousHistoryItem(PassRefPtr<HistoryItem>);
+
+ enum LocalLoadPolicy {
+ AllowLocalLoadsForAll, // No restriction on local loads.
+ AllowLocalLoadsForLocalAndSubstituteData,
+ AllowLocalLoadsForLocalOnly,
+ };
+ static void setLocalLoadPolicy(LocalLoadPolicy);
+ static bool restrictAccessToLocal();
+ static bool allowSubstituteDataAccessToLocal();
+
+ static void registerURLSchemeAsLocal(const String& scheme);
+ static bool shouldTreatURLAsLocal(const String&);
+ static bool shouldTreatSchemeAsLocal(const String&);
+
+#if USE(LOW_BANDWIDTH_DISPLAY)
+ bool addLowBandwidthDisplayRequest(CachedResource*);
+ void needToSwitchOutLowBandwidthDisplay() { m_needToSwitchOutLowBandwidthDisplay = true; }
+
+ // Client can control whether to use low bandwidth display on a per frame basis.
+ // However, this should only be used for the top frame, not sub-frame.
+ void setUseLowBandwidthDisplay(bool lowBandwidth) { m_useLowBandwidthDisplay = lowBandwidth; }
+ bool useLowBandwidthDisplay() const { return m_useLowBandwidthDisplay; }
+#endif
+ void setLoadsSynchronously(bool loadsSynchronously) { m_loadsSynchronously = loadsSynchronously; }
+ bool loadsSynchronously() { return m_loadsSynchronously; }
+
+ bool committingFirstRealLoad() const { return !m_creatingInitialEmptyDocument && !m_committedFirstRealDocumentLoad; }
+
+ void iconLoadDecisionAvailable();
+
+ bool shouldAllowNavigation(Frame* targetFrame) const;
+ Frame* findFrameForNavigation(const AtomicString& name);
+
+ void startIconLoader();
+
+ void applyUserAgent(ResourceRequest& request);
+
+ bool shouldInterruptLoadForXFrameOptions(const String&, const KURL&);
+
+ private:
+ PassRefPtr<HistoryItem> createHistoryItem(bool useOriginal);
+ PassRefPtr<HistoryItem> createHistoryItemTree(Frame* targetFrame, bool clipAtTarget);
+
+ bool canCachePageContainingThisFrame();
+#ifndef NDEBUG
+ void logCanCachePageDecision();
+ bool logCanCacheFrameDecision(int indentLevel);
+#endif
+
+ void addBackForwardItemClippedAtTarget(bool doClip);
+ void restoreScrollPositionAndViewState();
+ void saveDocumentState();
+ void loadItem(HistoryItem*, FrameLoadType);
+ bool urlsMatchItem(HistoryItem*) const;
+ void invalidateCurrentItemCachedPage();
+ void recursiveGoToItem(HistoryItem*, HistoryItem*, FrameLoadType);
+ bool childFramesMatchItem(HistoryItem*) const;
+
+ void updateHistoryForBackForwardNavigation();
+ void updateHistoryForReload();
+ void updateHistoryForStandardLoad();
+ void updateHistoryForRedirectWithLockedBackForwardList();
+ void updateHistoryForClientRedirect();
+ void updateHistoryForCommit();
+ void updateHistoryForAnchorScroll();
+
+ void redirectionTimerFired(Timer<FrameLoader>*);
+ void checkCompletedTimerFired(Timer<FrameLoader>*);
+ void checkLoadCompleteTimerFired(Timer<FrameLoader>*);
+
+ void cancelRedirection(bool newLoadInProgress = false);
+
+ void started();
+
+ void completed();
+ void parentCompleted();
+
+ bool shouldUsePlugin(const KURL&, const String& mimeType, bool hasFallback, bool& useFallback);
+ bool loadPlugin(RenderPart*, const KURL&, const String& mimeType,
+ const Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallback);
+
+ bool loadProvisionalItemFromCachedPage();
+ void cachePageForHistoryItem(HistoryItem*);
+
+ void receivedFirstData();
+
+ void updatePolicyBaseURL();
+ void setPolicyBaseURL(const KURL&);
+
+ void addExtraFieldsToRequest(ResourceRequest&, FrameLoadType loadType, bool isMainResource, bool cookiePolicyURLFromRequest);
+
+ // Also not cool.
+ void stopLoadingSubframes();
+
+ void clearProvisionalLoad();
+ void markLoadComplete();
+ void transitionToCommitted(PassRefPtr<CachedPage>);
+ void frameLoadCompleted();
+
+ void mainReceivedError(const ResourceError&, bool isComplete);
+
+ void setLoadType(FrameLoadType);
+
+ void checkNavigationPolicy(const ResourceRequest&, DocumentLoader*, PassRefPtr<FormState>, NavigationPolicyDecisionFunction, void* argument);
+ void checkNewWindowPolicy(const NavigationAction&, const ResourceRequest&, PassRefPtr<FormState>, const String& frameName);
+
+ void continueAfterNavigationPolicy(PolicyAction);
+ void continueAfterNewWindowPolicy(PolicyAction);
+ void continueAfterContentPolicy(PolicyAction);
+ void continueLoadAfterWillSubmitForm(PolicyAction = PolicyUse);
+
+ static void callContinueLoadAfterNavigationPolicy(void*, const ResourceRequest&, PassRefPtr<FormState>, bool shouldContinue);
+ void continueLoadAfterNavigationPolicy(const ResourceRequest&, PassRefPtr<FormState>, bool shouldContinue);
+ static void callContinueLoadAfterNewWindowPolicy(void*, const ResourceRequest&, PassRefPtr<FormState>, const String& frameName, bool shouldContinue);
+ void continueLoadAfterNewWindowPolicy(const ResourceRequest&, PassRefPtr<FormState>, const String& frameName, bool shouldContinue);
+ static void callContinueFragmentScrollAfterNavigationPolicy(void*, const ResourceRequest&, PassRefPtr<FormState>, bool shouldContinue);
+ void continueFragmentScrollAfterNavigationPolicy(const ResourceRequest&, bool shouldContinue);
+ bool shouldScrollToAnchor(bool isFormSubmission, FrameLoadType, const KURL&);
+ void addHistoryItemForFragmentScroll();
+
+ void stopPolicyCheck();
+
+ void checkLoadCompleteForThisFrame();
+
+ void setDocumentLoader(DocumentLoader*);
+ void setPolicyDocumentLoader(DocumentLoader*);
+ void setProvisionalDocumentLoader(DocumentLoader*);
+
+ void setState(FrameState);
+
+ void closeOldDataSources();
+ void open(CachedPage&);
+ void opened();
+ void updateHistoryAfterClientRedirect();
+
+ void clear(bool clearWindowProperties = true, bool clearScriptObjects = true);
+
+ bool shouldReloadToHandleUnreachableURL(DocumentLoader*);
+ void handleUnimplementablePolicy(const ResourceError&);
+
+ void scheduleRedirection(ScheduledRedirection*);
+ void startRedirectionTimer();
+ void stopRedirectionTimer();
+
+#if USE(LOW_BANDWIDTH_DISPLAY)
+ // implementation of CachedResourceClient
+ virtual void notifyFinished(CachedResource*);
+
+ void removeAllLowBandwidthDisplayRequests();
+ void switchOutLowBandwidthDisplayIfReady();
+#endif
+
+ void dispatchDidCommitLoad();
+ void dispatchAssignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest&);
+ void dispatchWillSendRequest(DocumentLoader*, unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse);
+ void dispatchDidReceiveResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse&);
+ void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long identifier, int length);
+ void dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier);
+
+ static bool isLocationChange(const ScheduledRedirection&);
+ void scheduleFormSubmission(const FrameLoadRequest&, bool lockHistory, bool lockBackForwardList, PassRefPtr<Event>, PassRefPtr<FormState>);
+
+ void loadWithDocumentLoader(DocumentLoader*, FrameLoadType, PassRefPtr<FormState>); // Calls continueLoadAfterNavigationPolicy
+ void load(DocumentLoader*); // Calls loadWithDocumentLoader
+
+ void loadWithNavigationAction(const ResourceRequest&, const NavigationAction&, // Calls loadWithDocumentLoader
+ bool lockHistory, FrameLoadType, PassRefPtr<FormState>);
+
+ void loadPostRequest(const ResourceRequest&, const String& referrer, // Called by loadFrameRequest, calls loadWithNavigationAction
+ const String& frameName, bool lockHistory, FrameLoadType, PassRefPtr<Event>, PassRefPtr<FormState>);
+ void loadURL(const KURL&, const String& referrer, const String& frameName, // Called by loadFrameRequest, calls loadWithNavigationAction or dispatches to navigation policy delegate
+ bool lockHistory, FrameLoadType, PassRefPtr<Event>, PassRefPtr<FormState>);
+
+ void clientRedirectCancelledOrFinished(bool cancelWithLoadInProgress);
+ void clientRedirected(const KURL&, double delay, double fireDate, bool lockBackForwardList);
+ bool shouldReload(const KURL& currentURL, const KURL& destinationURL);
+
+ void sendRemainingDelegateMessages(unsigned long identifier, const ResourceResponse&, int length, const ResourceError&);
+ void requestFromDelegate(ResourceRequest&, unsigned long& identifier, ResourceError&);
+
+ void recursiveCheckLoadComplete();
+
+ void detachChildren();
+
+ Frame* loadSubframe(HTMLFrameOwnerElement*, const KURL&, const String& name, const String& referrer);
+
+ bool closeURL();
+
+ KURL historyURL(int distance);
+
+ // Returns true if argument is a JavaScript URL.
+ bool executeIfJavaScriptURL(const KURL&, bool userGesture = false, bool replaceDocument = true);
+
+ bool gotoAnchor(const String& name); // returns true if the anchor was found
+ void scrollToAnchor(const KURL&);
+
+ void provisionalLoadStarted();
+
+ bool canCachePage();
+
+ bool didOpenURL(const KURL&);
+
+ void scheduleCheckCompleted();
+ void scheduleCheckLoadComplete();
+
+ KURL originalRequestURL() const;
+
+ bool shouldTreatURLAsSameAsCurrent(const KURL&) const;
+
+ void saveScrollPositionAndViewStateToItem(HistoryItem*);
+
+ Frame* m_frame;
+ FrameLoaderClient* m_client;
+
+ FrameState m_state;
+ FrameLoadType m_loadType;
+
+ // Document loaders for the three phases of frame loading. Note that while
+ // a new request is being loaded, the old document loader may still be referenced.
+ // E.g. while a new request is in the "policy" state, the old document loader may
+ // be consulted in particular as it makes sense to imply certain settings on the new loader.
+ RefPtr<DocumentLoader> m_documentLoader;
+ RefPtr<DocumentLoader> m_provisionalDocumentLoader;
+ RefPtr<DocumentLoader> m_policyDocumentLoader;
+
+ // This identifies the type of navigation action which prompted this load. Note
+ // that WebKit conveys this value as the WebActionNavigationTypeKey value
+ // on navigation action delegate callbacks.
+ FrameLoadType m_policyLoadType;
+ PolicyCheck m_policyCheck;
+
+ bool m_delegateIsHandlingProvisionalLoadError;
+ bool m_delegateIsDecidingNavigationPolicy;
+ bool m_delegateIsHandlingUnimplementablePolicy;
+
+ bool m_firstLayoutDone;
+ bool m_quickRedirectComing;
+ bool m_sentRedirectNotification;
+ bool m_inStopAllLoaders;
+
+ String m_outgoingReferrer;
+
+ bool m_isExecutingJavaScriptFormAction;
+ bool m_isRunningScript;
+
+ String m_responseMIMEType;
+
+ bool m_didCallImplicitClose;
+ bool m_wasUnloadEventEmitted;
+ bool m_unloadEventBeingDispatched;
+ bool m_isComplete;
+ bool m_isLoadingMainResource;
+
+ KURL m_URL;
+ KURL m_workingURL;
+
+ OwnPtr<IconLoader> m_iconLoader;
+ bool m_mayLoadIconLater;
+
+ bool m_cancellingWithLoadInProgress;
+
+ OwnPtr<ScheduledRedirection> m_scheduledRedirection;
+
+ bool m_needsClear;
+ bool m_receivedData;
+
+ bool m_encodingWasChosenByUser;
+ String m_encoding;
+ RefPtr<TextResourceDecoder> m_decoder;
+
+ bool m_containsPlugIns;
+
+ KURL m_submittedFormURL;
+
+ Timer<FrameLoader> m_redirectionTimer;
+ Timer<FrameLoader> m_checkCompletedTimer;
+ Timer<FrameLoader> m_checkLoadCompleteTimer;
+
+ Frame* m_opener;
+ HashSet<Frame*> m_openedFrames;
+
+ bool m_openedByDOM;
+
+ bool m_creatingInitialEmptyDocument;
+ bool m_isDisplayingInitialEmptyDocument;
+ bool m_committedFirstRealDocumentLoad;
+
+ RefPtr<HistoryItem> m_currentHistoryItem;
+ RefPtr<HistoryItem> m_previousHistoryItem;
+ RefPtr<HistoryItem> m_provisionalHistoryItem;
+
+ bool m_didPerformFirstNavigation;
+
+#ifndef NDEBUG
+ bool m_didDispatchDidCommitLoad;
+#endif
+
+#if USE(LOW_BANDWIDTH_DISPLAY)
+ // whether to use low bandwidth dislay, set by client
+ bool m_useLowBandwidthDisplay;
+
+ // whether to call finishParsing() in switchOutLowBandwidthDisplayIfReady()
+ bool m_finishedParsingDuringLowBandwidthDisplay;
+
+ // whether to call switchOutLowBandwidthDisplayIfReady;
+ // true if there is external css, javascript, or subframe/plugin
+ bool m_needToSwitchOutLowBandwidthDisplay;
+
+ String m_pendingSourceInLowBandwidthDisplay;
+ HashSet<CachedResource*> m_externalRequestsInLowBandwidthDisplay;
+#endif
+ bool m_loadsSynchronously;
+
+#if ENABLE(WML)
+ bool m_forceReloadWmlDeck;
+#endif
+ };
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FrameLoaderClient_h
+#define FrameLoaderClient_h
+
+#include "FrameLoaderTypes.h"
+#include "ScrollTypes.h"
+#include <wtf/Forward.h>
+#include <wtf/Platform.h>
+#include <wtf/Vector.h>
+
+typedef class _jobject* jobject;
+
+#if PLATFORM(MAC) && !defined(__OBJC__)
+class NSCachedURLResponse;
+class NSView;
+#endif
+
+namespace WebCore {
+
+ class AuthenticationChallenge;
+ class CachedFrame;
+ class Color;
+ class DocumentLoader;
+ class Element;
+ class FormState;
+ class Frame;
+ class FrameLoader;
+ class HistoryItem;
+ class HTMLFrameOwnerElement;
+ class IntSize;
+ class KURL;
+ class NavigationAction;
+ class ProtectionSpace;
+ class ResourceError;
+ class ResourceHandle;
+ class ResourceLoader;
+ class ResourceResponse;
+ class SharedBuffer;
+ class SubstituteData;
+ class String;
+ class Widget;
+
+ class ResourceRequest;
+
+ typedef void (FrameLoader::*FramePolicyFunction)(PolicyAction);
+
+ class FrameLoaderClient {
+ public:
+ virtual ~FrameLoaderClient();
+ virtual void frameLoaderDestroyed() = 0;
+
+ virtual bool hasWebView() const = 0; // mainly for assertions
+
+ virtual bool hasHTMLView() const { return true; }
+
+ virtual void makeRepresentation(DocumentLoader*) = 0;
+ virtual void forceLayout() = 0;
+ virtual void forceLayoutForNonHTML() = 0;
+
+ virtual void setCopiesOnScroll() = 0;
+
+ virtual void detachedFromParent2() = 0;
+ virtual void detachedFromParent3() = 0;
+
+ virtual void assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest&) = 0;
+
+ virtual void dispatchWillSendRequest(DocumentLoader*, unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse) = 0;
+ virtual bool shouldUseCredentialStorage(DocumentLoader*, unsigned long identifier) = 0;
+ virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&) = 0;
+ virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&) = 0;
+
+ virtual bool canAuthenticateAgainstProtectionSpace(DocumentLoader*, unsigned long identifier, const ProtectionSpace&) = 0;
+
+ virtual void dispatchDidReceiveResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse&) = 0;
+ virtual void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long identifier, int lengthReceived) = 0;
+ virtual void dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier) = 0;
+ virtual void dispatchDidFailLoading(DocumentLoader*, unsigned long identifier, const ResourceError&) = 0;
+ virtual bool dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int length) = 0;
+
+ virtual void dispatchDidHandleOnloadEvents() = 0;
+ virtual void dispatchDidReceiveServerRedirectForProvisionalLoad() = 0;
+ virtual void dispatchDidCancelClientRedirect() = 0;
+ virtual void dispatchWillPerformClientRedirect(const KURL&, double interval, double fireDate) = 0;
+ virtual void dispatchDidChangeLocationWithinPage() = 0;
+ virtual void dispatchWillClose() = 0;
+ virtual void dispatchDidReceiveIcon() = 0;
+ virtual void dispatchDidStartProvisionalLoad() = 0;
+ virtual void dispatchDidReceiveTitle(const String& title) = 0;
+ virtual void dispatchDidCommitLoad() = 0;
+ virtual void dispatchDidFailProvisionalLoad(const ResourceError&) = 0;
+ virtual void dispatchDidFailLoad(const ResourceError&) = 0;
+ virtual void dispatchDidFinishDocumentLoad() = 0;
+ virtual void dispatchDidFinishLoad() = 0;
+ virtual void dispatchDidFirstLayout() = 0;
+ virtual void dispatchDidFirstVisuallyNonEmptyLayout() = 0;
+
+ virtual Frame* dispatchCreatePage() = 0;
+ virtual void dispatchShow() = 0;
+
+ virtual void dispatchDecidePolicyForMIMEType(FramePolicyFunction, const String& MIMEType, const ResourceRequest&) = 0;
+ virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction, const NavigationAction&, const ResourceRequest&, PassRefPtr<FormState>, const String& frameName) = 0;
+ virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction, const NavigationAction&, const ResourceRequest&, PassRefPtr<FormState>) = 0;
+ virtual void cancelPolicyCheck() = 0;
+
+ virtual void dispatchUnableToImplementPolicy(const ResourceError&) = 0;
+
+ virtual void dispatchWillSubmitForm(FramePolicyFunction, PassRefPtr<FormState>) = 0;
+
+ virtual void dispatchDidLoadMainResource(DocumentLoader*) = 0;
+ virtual void revertToProvisionalState(DocumentLoader*) = 0;
+ virtual void setMainDocumentError(DocumentLoader*, const ResourceError&) = 0;
+
+ // Maybe these should go into a ProgressTrackerClient some day
+ virtual void willChangeEstimatedProgress() { }
+ virtual void didChangeEstimatedProgress() { }
+ virtual void postProgressStartedNotification() = 0;
+ virtual void postProgressEstimateChangedNotification() = 0;
+ virtual void postProgressFinishedNotification() = 0;
+
+ virtual void setMainFrameDocumentReady(bool) = 0;
+
+ virtual void startDownload(const ResourceRequest&) = 0;
+
+ virtual void willChangeTitle(DocumentLoader*) = 0;
+ virtual void didChangeTitle(DocumentLoader*) = 0;
+
+ virtual void committedLoad(DocumentLoader*, const char*, int) = 0;
+ virtual void finishedLoading(DocumentLoader*) = 0;
+
+ virtual void updateGlobalHistory() = 0;
+ virtual void updateGlobalHistoryForRedirectWithoutHistoryItem() = 0;
+
+ virtual bool shouldGoToHistoryItem(HistoryItem*) const = 0;
+
+ virtual ResourceError cancelledError(const ResourceRequest&) = 0;
+ virtual ResourceError blockedError(const ResourceRequest&) = 0;
+ virtual ResourceError cannotShowURLError(const ResourceRequest&) = 0;
+ virtual ResourceError interruptForPolicyChangeError(const ResourceRequest&) = 0;
+
+ virtual ResourceError cannotShowMIMETypeError(const ResourceResponse&) = 0;
+ virtual ResourceError fileDoesNotExistError(const ResourceResponse&) = 0;
+ virtual ResourceError pluginWillHandleLoadError(const ResourceResponse&) = 0;
+
+ virtual bool shouldFallBack(const ResourceError&) = 0;
+
+ virtual bool canHandleRequest(const ResourceRequest&) const = 0;
+ virtual bool canShowMIMEType(const String& MIMEType) const = 0;
+ virtual bool representationExistsForURLScheme(const String& URLScheme) const = 0;
+ virtual String generatedMIMETypeForURLScheme(const String& URLScheme) const = 0;
+
+ virtual void frameLoadCompleted() = 0;
+ virtual void saveViewStateToItem(HistoryItem*) = 0;
+ virtual void restoreViewState() = 0;
+ virtual void provisionalLoadStarted() = 0;
+ virtual void didFinishLoad() = 0;
+ virtual void prepareForDataSourceReplacement() = 0;
+
+ virtual PassRefPtr<DocumentLoader> createDocumentLoader(const ResourceRequest&, const SubstituteData&) = 0;
+ virtual void setTitle(const String& title, const KURL&) = 0;
+
+ virtual String userAgent(const KURL&) = 0;
+
+ virtual void savePlatformDataToCachedFrame(CachedFrame*) = 0;
+ virtual void transitionToCommittedFromCachedFrame(CachedFrame*) = 0;
+ virtual void transitionToCommittedForNewPage() = 0;
+
+ virtual bool canCachePage() const = 0;
+ virtual void download(ResourceHandle*, const ResourceRequest&, const ResourceRequest&, const ResourceResponse&) = 0;
+
+ virtual PassRefPtr<Frame> createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
+ const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) = 0;
+ virtual Widget* createPlugin(const IntSize&, Element*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually) = 0;
+ virtual void redirectDataToPlugin(Widget* pluginWidget) = 0;
+
+ virtual Widget* createJavaAppletWidget(const IntSize&, Element*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues) = 0;
+
+ virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType) = 0;
+ virtual String overrideMediaType() const = 0;
+
+ virtual void windowObjectCleared() = 0;
+ virtual void didPerformFirstNavigation() const = 0; // "Navigation" here means a transition from one page to another that ends up in the back/forward list.
+
+ virtual void registerForIconNotification(bool listen = true) = 0;
+
+#if ENABLE(MAC_JAVA_BRIDGE)
+ virtual jobject javaApplet(NSView*) { return 0; }
+#endif
+ virtual NSCachedURLResponse* willCacheResponse(DocumentLoader*, unsigned long identifier, NSCachedURLResponse*) const = 0;
+
+ virtual bool shouldUsePluginDocument(const String& /*mimeType*/) const { return false; }
+
+ protected:
+ static void transitionToCommittedForNewPage(Frame*, const IntSize&, const Color&, bool, const IntSize &, bool,
+ ScrollbarMode = ScrollbarAuto, ScrollbarMode = ScrollbarAuto);
+ };
+
+} // namespace WebCore
+
+#endif // FrameLoaderClient_h
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FrameLoaderTypes_h
+#define FrameLoaderTypes_h
+
+namespace WebCore {
+
+ enum FrameState {
+ FrameStateProvisional,
+ // This state indicates we are ready to commit to a page,
+ // which means the view will transition to use the new data source.
+ FrameStateCommittedPage,
+ FrameStateComplete
+ };
+
+ enum PolicyAction {
+ PolicyUse,
+ PolicyDownload,
+ PolicyIgnore,
+ };
+
+ enum FrameLoadType {
+ FrameLoadTypeStandard,
+ FrameLoadTypeBack,
+ FrameLoadTypeForward,
+ FrameLoadTypeIndexedBackForward, // a multi-item hop in the backforward list
+ FrameLoadTypeReload,
+ FrameLoadTypeSame, // user loads same URL again (but not reload button)
+ FrameLoadTypeRedirectWithLockedBackForwardList, // FIXME: Merge "lockBackForwardList", "lockHistory", "quickRedirect" and "clientRedirect" into a single concept of redirect.
+ FrameLoadTypeReplace,
+ FrameLoadTypeReloadFromOrigin
+ };
+
+ enum NavigationType {
+ NavigationTypeLinkClicked,
+ NavigationTypeFormSubmitted,
+ NavigationTypeBackForward,
+ NavigationTypeReload,
+ NavigationTypeFormResubmitted,
+ NavigationTypeOther
+ };
+
+ enum ObjectContentType {
+ ObjectContentNone,
+ ObjectContentImage,
+ ObjectContentFrame,
+ ObjectContentNetscapePlugin,
+ ObjectContentOtherPlugin
+ };
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef FrameTree_h
+#define FrameTree_h
+
+#include "AtomicString.h"
+
+namespace WebCore {
+
+ class Frame;
+
+ class FrameTree : Noncopyable {
+ public:
+ FrameTree(Frame* thisFrame, Frame* parentFrame)
+ : m_thisFrame(thisFrame)
+ , m_parent(parentFrame)
+ , m_previousSibling(0)
+ , m_lastChild(0)
+ , m_childCount(0)
+ {
+ }
+ ~FrameTree();
+
+ const AtomicString& name() const { return m_name; }
+ void setName(const AtomicString&);
+ void clearName();
+ Frame* parent(bool checkForDisconnectedFrame = false) const;
+ void setParent(Frame* parent) { m_parent = parent; }
+
+ Frame* nextSibling() const { return m_nextSibling.get(); }
+ Frame* previousSibling() const { return m_previousSibling; }
+ Frame* firstChild() const { return m_firstChild.get(); }
+ Frame* lastChild() const { return m_lastChild; }
+ unsigned childCount() const { return m_childCount; }
+
+ bool isDescendantOf(const Frame* ancestor) const;
+ Frame* traverseNext(const Frame* stayWithin = 0) const;
+ Frame* traverseNextWithWrap(bool) const;
+ Frame* traversePreviousWithWrap(bool) const;
+
+ void appendChild(PassRefPtr<Frame>);
+ void removeChild(Frame*);
+
+ Frame* child(unsigned index) const;
+ Frame* child(const AtomicString& name) const;
+ Frame* find(const AtomicString& name) const;
+
+ AtomicString uniqueChildName(const AtomicString& requestedName) const;
+
+ Frame* top(bool checkForDisconnectedFrame = false) const;
+
+ private:
+ Frame* deepLastChild() const;
+
+ Frame* m_thisFrame;
+
+ Frame* m_parent;
+ AtomicString m_name;
+
+ // FIXME: use ListRefPtr?
+ RefPtr<Frame> m_nextSibling;
+ Frame* m_previousSibling;
+ RefPtr<Frame> m_firstChild;
+ Frame* m_lastChild;
+ unsigned m_childCount;
+ };
+
+} // namespace WebCore
+
+#endif // FrameTree_h
--- /dev/null
+/*
+ Copyright (C) 1997 Martin Jones (mjones@kde.org)
+ (C) 1998 Waldo Bastian (bastian@kde.org)
+ (C) 1998, 1999 Torben Weis (weis@kde.org)
+ (C) 1999 Lars Knoll (knoll@kde.org)
+ (C) 1999 Antti Koivisto (koivisto@kde.org)
+ Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef FrameView_h
+#define FrameView_h
+
+#include "IntSize.h"
+#include "RenderLayer.h"
+#include "ScrollView.h"
+#include <wtf/Forward.h>
+#include <wtf/OwnPtr.h>
+
+namespace WebCore {
+
+class Color;
+class Event;
+class EventTargetNode;
+class Frame;
+class FrameViewPrivate;
+class IntRect;
+class Node;
+class PlatformMouseEvent;
+class RenderLayer;
+class RenderObject;
+class RenderPartObject;
+class ScheduledEvent;
+class String;
+
+template <typename T> class Timer;
+
+class FrameView : public ScrollView {
+public:
+ friend class RenderView;
+
+ FrameView(Frame*);
+ FrameView(Frame*, const IntSize& initialSize);
+
+ virtual ~FrameView();
+
+ virtual HostWindow* hostWindow() const;
+
+ virtual void invalidateRect(const IntRect&);
+
+ Frame* frame() const { return m_frame.get(); }
+ void clearFrame();
+
+ void ref() { ++m_refCount; }
+ void deref() { if (!--m_refCount) delete this; }
+ bool hasOneRef() { return m_refCount == 1; }
+
+ int marginWidth() const { return m_margins.width(); } // -1 means default
+ int marginHeight() const { return m_margins.height(); } // -1 means default
+ void setMarginWidth(int);
+ void setMarginHeight(int);
+
+ virtual void setCanHaveScrollbars(bool);
+
+ virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation);
+
+ virtual void setContentsSize(const IntSize&);
+
+ void layout(bool allowSubtree = true);
+ bool didFirstLayout() const;
+ void layoutTimerFired(Timer<FrameView>*);
+ void scheduleRelayout();
+ void scheduleRelayoutOfSubtree(RenderObject*);
+ void unscheduleRelayout();
+ bool layoutPending() const;
+
+ RenderObject* layoutRoot(bool onlyDuringLayout = false) const;
+ int layoutCount() const { return m_layoutCount; }
+
+ // These two helper functions just pass through to the RenderView.
+ bool needsLayout() const;
+ void setNeedsLayout();
+
+ bool needsFullRepaint() const { return m_doFullRepaint; }
+ IntSize offsetInWindow() const;
+ void setFrameRect(const IntRect &rect);
+
+#if USE(ACCELERATED_COMPOSITING)
+ enum CompositingUpdate { NormalCompositingUpdate, ForcedCompositingUpdate };
+ void updateCompositingLayers(CompositingUpdate updateType = NormalCompositingUpdate);
+
+ // Called when changes to the GraphicsLayer hierarchy have to be synchronized with
+ // content rendered via the normal painting path.
+ void setNeedsOneShotDrawingSynchronization();
+#endif
+
+ void didMoveOnscreen();
+ void willMoveOffscreen();
+
+ void resetScrollbars();
+
+ void clear();
+
+ bool isTransparent() const;
+ void setTransparent(bool isTransparent);
+
+ Color baseBackgroundColor() const;
+ void setBaseBackgroundColor(Color);
+ void updateBackgroundRecursively(const Color&, bool);
+
+ bool shouldUpdateWhileOffscreen() const;
+ void setShouldUpdateWhileOffscreen(bool);
+
+ void adjustViewSize();
+ void initScrollbars();
+ void updateDefaultScrollbarState();
+
+ virtual IntRect windowClipRect(bool clipToContents = true) const;
+ IntRect windowClipRectForLayer(const RenderLayer*, bool clipToLayerContents) const;
+
+ virtual bool isActive() const;
+ virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&);
+ virtual void valueChanged(Scrollbar*);
+ virtual void getTickmarks(Vector<IntRect>&) const;
+
+ virtual IntRect windowResizerRect() const;
+
+ virtual void scrollRectIntoViewRecursively(const IntRect&);
+ virtual void setScrollPosition(const IntPoint&);
+
+ String mediaType() const;
+ void setMediaType(const String&);
+
+ void setUseSlowRepaints();
+
+ void addSlowRepaintObject();
+ void removeSlowRepaintObject();
+
+ void beginDeferredRepaints();
+ void endDeferredRepaints();
+ void checkStopDelayingDeferredRepaints();
+ void resetDeferredRepaintDelay();
+
+#if ENABLE(DASHBOARD_SUPPORT)
+ void updateDashboardRegions();
+#endif
+ void updateControlTints();
+
+ void restoreScrollbar();
+
+ void scheduleEvent(PassRefPtr<Event>, PassRefPtr<EventTargetNode>);
+ void pauseScheduledEvents();
+ void resumeScheduledEvents();
+ void postLayoutTimerFired(Timer<FrameView>*);
+
+ bool wasScrolledByUser() const;
+ void setWasScrolledByUser(bool);
+
+ void addWidgetToUpdate(RenderPartObject*);
+ void removeWidgetToUpdate(RenderPartObject*);
+
+ virtual void paintContents(GraphicsContext*, const IntRect& damageRect);
+ void setPaintRestriction(PaintRestriction);
+ bool isPainting() const;
+ void setNodeToDraw(Node*);
+
+ static double currentPaintTimeStamp() { return sCurrentPaintTimeStamp; } // returns 0 if not painting
+
+ void layoutIfNeededRecursive();
+
+ void setIsVisuallyNonEmpty() { m_isVisuallyNonEmpty = true; }
+
+private:
+ void reset();
+ void init();
+
+ virtual bool isFrameView() const;
+
+ bool useSlowRepaints() const;
+
+ void applyOverflowToViewport(RenderObject*, ScrollbarMode& hMode, ScrollbarMode& vMode);
+
+ void updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow);
+
+ void dispatchScheduledEvents();
+ void performPostLayoutTasks();
+
+ virtual void repaintContentRectangle(const IntRect&, bool immediate);
+ virtual void contentsResized() { setNeedsLayout(); }
+ virtual void visibleContentsResized() { layout(); }
+
+ void deferredRepaintTimerFired(Timer<FrameView>*);
+ void doDeferredRepaints();
+ void updateDeferredRepaintDelay();
+ double adjustedDeferredRepaintDelay() const;
+
+ static double sCurrentPaintTimeStamp; // used for detecting decoded resource thrash in the cache
+
+ unsigned m_refCount;
+ IntSize m_size;
+ IntSize m_margins;
+ OwnPtr<HashSet<RenderPartObject*> > m_widgetUpdateSet;
+ RefPtr<Frame> m_frame;
+
+ bool m_doFullRepaint;
+
+ ScrollbarMode m_vmode;
+ ScrollbarMode m_hmode;
+ bool m_useSlowRepaints;
+ unsigned m_slowRepaintObjectCount;
+
+ int m_borderX, m_borderY;
+
+ Timer<FrameView> m_layoutTimer;
+ bool m_delayedLayout;
+ RenderObject* m_layoutRoot;
+
+ bool m_layoutSchedulingEnabled;
+ bool m_midLayout;
+ int m_layoutCount;
+
+ unsigned m_nestedLayoutCount;
+ Timer<FrameView> m_postLayoutTasksTimer;
+ bool m_firstLayoutCallbackPending;
+
+ bool m_firstLayout;
+ bool m_needToInitScrollbars;
+ bool m_isTransparent;
+ Color m_baseBackgroundColor;
+ IntSize m_lastLayoutSize;
+ float m_lastZoomFactor;
+
+ String m_mediaType;
+
+ unsigned m_enqueueEvents;
+ Vector<ScheduledEvent*> m_scheduledEvents;
+
+ bool m_overflowStatusDirty;
+ bool m_horizontalOverflow;
+ bool m_verticalOverflow;
+ RenderObject* m_viewportRenderer;
+
+ bool m_wasScrolledByUser;
+ bool m_inProgrammaticScroll;
+
+ unsigned m_deferringRepaints;
+ unsigned m_repaintCount;
+ Vector<IntRect> m_repaintRects;
+ Timer<FrameView> m_deferredRepaintTimer;
+ double m_deferredRepaintDelay;
+ double m_lastPaintTime;
+
+ bool m_shouldUpdateWhileOffscreen;
+
+ RefPtr<Node> m_nodeToDraw;
+ PaintRestriction m_paintRestriction;
+ bool m_isPainting;
+
+ bool m_isVisuallyNonEmpty;
+ bool m_firstVisuallyNonEmptyLayoutCallbackPending;
+};
+
+} // namespace WebCore
+
+#endif // FrameView_h
--- /dev/null
+/*
+ Copyright (C) 2005, 2006 Apple Inc. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+
+ Some useful definitions needed for laying out elements
+*/
+
+#ifndef GapRects_h
+#define GapRects_h
+
+#include "IntRect.h"
+
+namespace WebCore {
+
+ struct GapRects {
+ const IntRect& left() const { return m_left; }
+ const IntRect& center() const { return m_center; }
+ const IntRect& right() const { return m_right; }
+
+ void uniteLeft(const IntRect& r) { m_left.unite(r); }
+ void uniteCenter(const IntRect& r) { m_center.unite(r); }
+ void uniteRight(const IntRect& r) { m_right.unite(r); }
+ void unite(const GapRects& o) { uniteLeft(o.left()); uniteCenter(o.center()); uniteRight(o.right()); }
+
+ operator IntRect() const
+ {
+ IntRect result = m_left;
+ result.unite(m_center);
+ result.unite(m_right);
+ return result;
+ }
+
+ bool operator==(const GapRects& other)
+ {
+ return m_left == other.left() && m_center == other.center() && m_right == other.right();
+ }
+ bool operator!=(const GapRects& other) { return !(*this == other); }
+
+ private:
+ IntRect m_left;
+ IntRect m_center;
+ IntRect m_right;
+ };
+
+} // namespace WebCore
+
+#endif // GapRects_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GeneratedImage_h
+#define GeneratedImage_h
+
+#include "Image.h"
+
+#include "Generator.h"
+#include "IntSize.h"
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class GeneratedImage : public Image {
+public:
+ static PassRefPtr<GeneratedImage> create(PassRefPtr<Generator> generator, const IntSize& size)
+ {
+ return adoptRef(new GeneratedImage(generator, size));
+ }
+ virtual ~GeneratedImage() {}
+
+ virtual bool hasSingleSecurityOrigin() const { return true; }
+
+ // These are only used for SVGGeneratedImage right now
+ virtual void setContainerSize(const IntSize& size) { m_size = size; }
+ virtual bool usesContainerSize() const { return true; }
+ virtual bool hasRelativeWidth() const { return true; }
+ virtual bool hasRelativeHeight() const { return true; }
+
+ virtual IntSize size() const { return m_size; }
+
+ // Assume that generated content has no decoded data we need to worry about
+ virtual void destroyDecodedData(bool /*destroyAll*/ = true) { }
+ virtual unsigned decodedSize() const { return 0; }
+
+protected:
+ virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator);
+ virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const TransformationMatrix& patternTransform,
+ const FloatPoint& phase, CompositeOperator, const FloatRect& destRect);
+
+ GeneratedImage(PassRefPtr<Generator> generator, const IntSize& size)
+ : m_generator(generator)
+ , m_size(size)
+ {
+ }
+
+ RefPtr<Generator> m_generator;
+ IntSize m_size;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Generator_h
+#define Generator_h
+
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class FloatRect;
+class GraphicsContext;
+
+class Generator : public RefCounted<Generator> {
+public:
+ virtual ~Generator() {};
+
+ virtual void fill(GraphicsContext*, const FloatRect&) = 0;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (c) 2009, 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 GenericWorkerTask_h
+#define GenericWorkerTask_h
+
+#if ENABLE(WORKERS)
+
+#include "WorkerMessagingProxy.h"
+#include "ScriptExecutionContext.h"
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+ class GenericWorkerTaskBase : public ScriptExecutionContext::Task {
+ protected:
+ GenericWorkerTaskBase(WorkerMessagingProxy* messagingProxy) : m_messagingProxy(messagingProxy)
+ {
+ }
+
+ bool canPerformTask()
+ {
+ return !m_messagingProxy->askedToTerminate();
+ }
+
+ WorkerMessagingProxy* m_messagingProxy;
+ };
+
+ template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6>
+ class GenericWorkerTask6 : public GenericWorkerTaskBase {
+ public:
+ typedef void (*Method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6);
+ typedef GenericWorkerTask6<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5, P6, MP6> GenericWorkerTask;
+
+ static PassRefPtr<GenericWorkerTask> create(WorkerMessagingProxy* messagingProxy, Method method, const P1& parameter1, const P2& parameter2, const P3& parameter3, const P4& parameter4, const P5& parameter5, const P6& parameter6)
+ {
+ return adoptRef(new GenericWorkerTask(messagingProxy, method, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6));
+ }
+
+ private:
+ GenericWorkerTask6(WorkerMessagingProxy* messagingProxy, Method method, const P1& parameter1, const P2& parameter2, const P3& parameter3, const P4& parameter4, const P5& parameter5, const P6& parameter6)
+ : GenericWorkerTaskBase(messagingProxy)
+ , m_method(method)
+ , m_parameter1(parameter1)
+ , m_parameter2(parameter2)
+ , m_parameter3(parameter3)
+ , m_parameter4(parameter4)
+ , m_parameter5(parameter5)
+ , m_parameter6(parameter6)
+ {
+ }
+
+ virtual void performTask(ScriptExecutionContext* context)
+ {
+ if (!canPerformTask())
+ return;
+ (*m_method)(context, m_parameter1, m_parameter2, m_parameter3, m_parameter4, m_parameter5, m_parameter6);
+ }
+
+ private:
+ Method m_method;
+ P1 m_parameter1;
+ P2 m_parameter2;
+ P3 m_parameter3;
+ P4 m_parameter4;
+ P5 m_parameter5;
+ P6 m_parameter6;
+ };
+
+ template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6>
+ PassRefPtr<GenericWorkerTask6<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5, P6, MP6> > createCallbackTask(
+ WorkerMessagingProxy* messagingProxy,
+ void (*method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6),
+ const P1& parameter1, const P2& parameter2, const P3& parameter3, const P4& parameter4, const P5& parameter5, const P6& parameter6)
+ {
+ return GenericWorkerTask6<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5, P6, MP6>::create(messagingProxy, method, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6);
+ }
+
+} // namespace WebCore
+
+#endif // ENABLE(WORKERS)
+
+#endif // GenericWorkerTask_h
--- /dev/null
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Geolocation_h
+#define Geolocation_h
+
+#include "GeolocationService.h"
+#include "PositionCallback.h"
+#include "PositionErrorCallback.h"
+#include "PositionOptions.h"
+#include "Timer.h"
+#include <wtf/Platform.h>
+#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class Frame;
+class Geoposition;
+
+class Geolocation : public RefCounted<Geolocation>, public GeolocationServiceClient {
+public:
+ static PassRefPtr<Geolocation> create(Frame* frame) { return adoptRef(new Geolocation(frame)); }
+
+ virtual ~Geolocation() {}
+
+ void disconnectFrame();
+
+ Geoposition* lastPosition() const { return m_service->lastPosition(); }
+
+ void getCurrentPosition(PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PassRefPtr<PositionOptions>);
+ int watchPosition(PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PassRefPtr<PositionOptions>);
+ void clearWatch(int watchId);
+
+ void suspend();
+ void resume();
+
+ void setIsAllowed(bool);
+ bool isAllowed() const { return m_allowGeolocation == Yes; }
+
+ void setShouldClearCache(bool shouldClearCache) { m_shouldClearCache = shouldClearCache; }
+ bool shouldClearCache() const { return m_shouldClearCache; }
+
+private:
+ Geolocation(Frame*);
+
+ class GeoNotifier : public RefCounted<GeoNotifier> {
+ public:
+ static PassRefPtr<GeoNotifier> create(PassRefPtr<PositionCallback> positionCallback, PassRefPtr<PositionErrorCallback> positionErrorCallback, PassRefPtr<PositionOptions> options) { return adoptRef(new GeoNotifier(positionCallback, positionErrorCallback, options)); }
+
+ void startTimer();
+ void timerFired(Timer<GeoNotifier>*);
+
+ RefPtr<PositionCallback> m_successCallback;
+ RefPtr<PositionErrorCallback> m_errorCallback;
+ RefPtr<PositionOptions> m_options;
+ Timer<GeoNotifier> m_timer;
+
+ private:
+ GeoNotifier(PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PassRefPtr<PositionOptions>);
+ };
+
+ bool hasListeners() const { return !m_oneShots.isEmpty() || !m_watchers.isEmpty(); }
+
+ void sendError(Vector<RefPtr<GeoNotifier> >&, PositionError*);
+ void sendErrorToOneShots(PositionError*);
+ void sendErrorToWatchers(PositionError*);
+
+ void sendPosition(Vector<RefPtr<GeoNotifier> >&, Geoposition*);
+ void sendPositionToOneShots(Geoposition*);
+ void sendPositionToWatchers(Geoposition*);
+
+ static void startTimer(Vector<RefPtr<GeoNotifier> >&);
+ void startTimersForOneShots();
+ void startTimersForWatchers();
+ void startTimers();
+
+ void handleError(PositionError*);
+
+ void requestPermission();
+
+ virtual void geolocationServicePositionChanged(GeolocationService*);
+ virtual void geolocationServiceErrorOccurred(GeolocationService*);
+ virtual void geolocationServiceCachePolicyChanged(GeolocationService*);
+
+ typedef HashSet<RefPtr<GeoNotifier> > GeoNotifierSet;
+ typedef HashMap<int, RefPtr<GeoNotifier> > GeoNotifierMap;
+
+ GeoNotifierSet m_oneShots;
+ GeoNotifierMap m_watchers;
+ Frame* m_frame;
+ OwnPtr<GeolocationService> m_service;
+
+ enum {
+ Unknown,
+ Yes,
+ No
+ } m_allowGeolocation;
+ bool m_shouldClearCache;
+};
+
+} // namespace WebCore
+
+#endif // Geolocation_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GeolocationService_h
+#define GeolocationService_h
+
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+class GeolocationService;
+class Geoposition;
+class PositionError;
+class PositionOptions;
+
+class GeolocationServiceClient {
+public:
+ virtual ~GeolocationServiceClient() { }
+ virtual void geolocationServicePositionChanged(GeolocationService*) { }
+ virtual void geolocationServiceErrorOccurred(GeolocationService*) { }
+ virtual void geolocationServiceCachePolicyChanged(GeolocationService*) { }
+};
+
+class GeolocationService : public Noncopyable {
+public:
+ static GeolocationService* create(GeolocationServiceClient*);
+ virtual ~GeolocationService() {}
+
+ virtual bool startUpdating(PositionOptions*) { return false; }
+ virtual void stopUpdating() {}
+
+ virtual void suspend() { }
+ virtual void resume() { }
+
+ virtual Geoposition* lastPosition() const { return 0; }
+ virtual PositionError* lastError() const { return 0; }
+
+ virtual void setShouldClearCache(bool) { }
+ virtual bool shouldClearCache() const { return false; }
+
+ void positionChanged();
+ void errorOccurred();
+ void cachePolicyChanged();
+
+protected:
+ GeolocationService(GeolocationServiceClient*);
+
+private:
+ GeolocationServiceClient* m_geolocationServiceClient;
+};
+
+} // namespace WebCore
+
+#endif // GeolocationService_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Geoposition_h
+#define Geoposition_h
+
+#include "Coordinates.h"
+#include "Event.h"
+#include "PlatformString.h"
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+typedef int ExceptionCode;
+
+class Geoposition : public RefCounted<Geoposition> {
+public:
+ static PassRefPtr<Geoposition> create(PassRefPtr<Coordinates> coordinates, DOMTimeStamp timestamp) { return adoptRef(new Geoposition(coordinates, timestamp)); }
+
+ DOMTimeStamp timestamp() const { return m_timestamp; }
+ Coordinates* coords() const { return m_coordinates.get(); }
+
+ String toString() const;
+
+private:
+ Geoposition(PassRefPtr<Coordinates> coordinates, DOMTimeStamp timestamp)
+ : m_coordinates(coordinates)
+ , m_timestamp(timestamp)
+ {
+ }
+
+ RefPtr<Coordinates> m_coordinates;
+ DOMTimeStamp m_timestamp;
+};
+
+} // namespace WebCore
+
+#endif // Geoposition_h
--- /dev/null
+/*
+ * Copyright (C) 2008, Apple Inc. All rights reserved.
+ *
+ * No license or rights are granted by Apple expressly or by implication,
+ * estoppel, or otherwise, to Apple copyrights, patents, trademarks, trade
+ * secrets or other rights.
+ */
+
+#ifndef GestureEvent_h
+#define GestureEvent_h
+
+#include <wtf/Platform.h>
+
+#if ENABLE(TOUCH_EVENTS)
+
+#include <wtf/RefPtr.h>
+#include "MouseRelatedEvent.h"
+#include "EventTarget.h"
+
+namespace WebCore {
+
+ class GestureEvent : public MouseRelatedEvent {
+ public:
+ static PassRefPtr<GestureEvent> create()
+ {
+ return adoptRef(new GestureEvent);
+ }
+ static PassRefPtr<GestureEvent> create(
+ const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view, int detail,
+ int screenX, int screenY, int pageX, int pageY,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
+ EventTarget* target, float scale, float rotation, bool isSimulated = false)
+ {
+ return adoptRef(new GestureEvent(
+ type, canBubble, cancelable, view, detail,
+ screenX, screenY, pageX, pageY,
+ ctrlKey, altKey, shiftKey, metaKey,
+ target, scale, rotation, isSimulated));
+ }
+ virtual ~GestureEvent() {}
+
+ void initGestureEvent(const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view, int detail,
+ int screenX, int screenY, int clientX, int clientY,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
+ EventTarget* target, float scale, float rotation);
+
+ virtual bool isGestureEvent() const { return true; }
+
+ float scale() const { return m_scale; }
+ float rotation() const { return m_rotation; }
+
+ private:
+ GestureEvent() { }
+ GestureEvent(const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view, int detail,
+ int screenX, int screenY, int pageX, int pageY,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
+ EventTarget* target, float scale, float rotation, bool isSimulated = false);
+
+ float m_scale;
+ float m_rotation;
+ };
+
+} // namespace WebCore
+
+#endif // ENABLE(TOUCH_EVENTS)
+
+#endif // GestureEvent_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GlyphBuffer_h
+#define GlyphBuffer_h
+
+#include "FloatSize.h"
+#include <wtf/UnusedParam.h>
+#include <wtf/Vector.h>
+
+#if PLATFORM(CG)
+#if USE(CORE_TEXT)
+#include <CoreText/CoreText.h>
+#endif
+#include <CoreGraphics/CoreGraphics.h>
+#endif
+
+#if PLATFORM(CAIRO)
+#include <cairo.h>
+#endif
+
+namespace WebCore {
+
+typedef unsigned short Glyph;
+class SimpleFontData;
+
+#if PLATFORM(CAIRO)
+// FIXME: Why does Cairo use such a huge struct instead of just an offset into an array?
+typedef cairo_glyph_t GlyphBufferGlyph;
+#else
+typedef Glyph GlyphBufferGlyph;
+#endif
+
+// CG uses CGSize instead of FloatSize so that the result of advances()
+// can be passed directly to CGContextShowGlyphsWithAdvances in FontMac.mm
+#if PLATFORM(CG)
+typedef CGSize GlyphBufferAdvance;
+#else
+typedef FloatSize GlyphBufferAdvance;
+#endif
+
+class GlyphBuffer {
+public:
+ bool isEmpty() const { return m_fontData.isEmpty(); }
+ int size() const { return m_fontData.size(); }
+
+ void clear()
+ {
+ m_fontData.clear();
+ m_glyphs.clear();
+ m_advances.clear();
+#if PLATFORM(WIN)
+ m_offsets.clear();
+#endif
+ }
+
+ GlyphBufferGlyph* glyphs(int from) { return m_glyphs.data() + from; }
+ GlyphBufferAdvance* advances(int from) { return m_advances.data() + from; }
+ const GlyphBufferGlyph* glyphs(int from) const { return m_glyphs.data() + from; }
+ const GlyphBufferAdvance* advances(int from) const { return m_advances.data() + from; }
+
+ const SimpleFontData* fontDataAt(int index) const { return m_fontData[index]; }
+
+ void swap(int index1, int index2)
+ {
+ const SimpleFontData* f = m_fontData[index1];
+ m_fontData[index1] = m_fontData[index2];
+ m_fontData[index2] = f;
+
+ GlyphBufferGlyph g = m_glyphs[index1];
+ m_glyphs[index1] = m_glyphs[index2];
+ m_glyphs[index2] = g;
+
+ GlyphBufferAdvance s = m_advances[index1];
+ m_advances[index1] = m_advances[index2];
+ m_advances[index2] = s;
+
+#if PLATFORM(WIN)
+ FloatSize offset = m_offsets[index1];
+ m_offsets[index1] = m_offsets[index2];
+ m_offsets[index2] = offset;
+#endif
+ }
+
+ Glyph glyphAt(int index) const
+ {
+#if PLATFORM(CAIRO)
+ return m_glyphs[index].index;
+#else
+ return m_glyphs[index];
+#endif
+ }
+
+ float advanceAt(int index) const
+ {
+#if PLATFORM(CG)
+ return m_advances[index].width;
+#else
+ return m_advances[index].width();
+#endif
+ }
+
+ FloatSize offsetAt(int index) const
+ {
+#if PLATFORM(WIN)
+ return m_offsets[index];
+#else
+ UNUSED_PARAM(index);
+ return FloatSize();
+#endif
+ }
+
+ void add(Glyph glyph, const SimpleFontData* font, float width, const FloatSize* offset = 0)
+ {
+ m_fontData.append(font);
+
+#if PLATFORM(CAIRO)
+ cairo_glyph_t cairoGlyph;
+ cairoGlyph.index = glyph;
+ m_glyphs.append(cairoGlyph);
+#else
+ m_glyphs.append(glyph);
+#endif
+
+#if PLATFORM(CG)
+ CGSize advance = { width, 0 };
+ m_advances.append(advance);
+#else
+ m_advances.append(FloatSize(width, 0));
+#endif
+
+#if PLATFORM(WIN)
+ if (offset)
+ m_offsets.append(*offset);
+ else
+ m_offsets.append(FloatSize());
+#else
+ UNUSED_PARAM(offset);
+#endif
+ }
+
+ void add(Glyph glyph, const SimpleFontData* font, GlyphBufferAdvance advance)
+ {
+ m_fontData.append(font);
+#if PLATFORM(CAIRO)
+ cairo_glyph_t cairoGlyph;
+ cairoGlyph.index = glyph;
+ m_glyphs.append(cairoGlyph);
+#else
+ m_glyphs.append(glyph);
+#endif
+
+ m_advances.append(advance);
+ }
+
+private:
+ Vector<const SimpleFontData*, 2048> m_fontData;
+ Vector<GlyphBufferGlyph, 2048> m_glyphs;
+ Vector<GlyphBufferAdvance, 2048> m_advances;
+#if PLATFORM(WIN)
+ Vector<FloatSize, 2048> m_offsets;
+#endif
+};
+
+}
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GlyphPageTreeNode_h
+#define GlyphPageTreeNode_h
+
+#include <wtf/HashMap.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+class FontData;
+class GlyphPageTreeNode;
+class SimpleFontData;
+
+typedef unsigned short Glyph;
+
+// Holds the glyph index and the corresponding SimpleFontData information for a given
+// character.
+struct GlyphData {
+ Glyph glyph;
+ const SimpleFontData* fontData;
+};
+
+// A GlyphPage contains a fixed-size set of GlyphData mappings for a contiguous
+// range of characters in the Unicode code space. GlyphPages are indexed
+// starting from 0 and incrementing for each 256 glyphs.
+//
+// One page may actually include glyphs from other fonts if the characters are
+// missing in the parimary font. It is owned by exactly one GlyphPageTreeNode,
+// although multiple nodes may reference it as their "page" if they are supposed
+// to be overriding the parent's node, but provide no additional information.
+struct GlyphPage : public RefCounted<GlyphPage> {
+ static PassRefPtr<GlyphPage> create(GlyphPageTreeNode* owner)
+ {
+ return adoptRef(new GlyphPage(owner));
+ }
+
+ static const size_t size = 256; // Covers Latin-1 in a single page.
+ GlyphData m_glyphs[size];
+ GlyphPageTreeNode* m_owner;
+
+ const GlyphData& glyphDataForCharacter(UChar32 c) const { return m_glyphs[c % size]; }
+ void setGlyphDataForCharacter(UChar32 c, Glyph g, const SimpleFontData* f)
+ {
+ setGlyphDataForIndex(c % size, g, f);
+ }
+ void setGlyphDataForIndex(unsigned index, Glyph g, const SimpleFontData* f)
+ {
+ ASSERT(index < size);
+ m_glyphs[index].glyph = g;
+ m_glyphs[index].fontData = f;
+ }
+ GlyphPageTreeNode* owner() const { return m_owner; }
+
+ // Implemented by the platform.
+ bool fill(unsigned offset, unsigned length, UChar* characterBuffer, unsigned bufferLength, const SimpleFontData*);
+
+private:
+ GlyphPage(GlyphPageTreeNode* owner)
+ : m_owner(owner)
+ {
+ }
+};
+
+// The glyph page tree is a data structure that maps (FontData, glyph page number)
+// to a GlyphPage. Level 0 (the "root") is special. There is one root
+// GlyphPageTreeNode for each glyph page number. The roots do not have a
+// GlyphPage associated with them, and their initializePage() function is never
+// called to fill the glyphs.
+//
+// Each root node maps a FontData pointer to another GlyphPageTreeNode at
+// level 1 (the "root child") that stores the actual glyphs for a specific font data.
+// These nodes will only have a GlyphPage if they have glyphs for that range.
+//
+// Levels greater than one correspond to subsequent levels of the fallback list
+// for that font. These levels override their parent's page of glyphs by
+// filling in holes with the new font (thus making a more complete page).
+//
+// A NULL FontData pointer corresponds to the system fallback
+// font. It is tracked separately from the regular pages and overrides so that
+// the glyph pages do not get polluted with these last-resort glyphs. The
+// system fallback page is not populated at construction like the other pages,
+// but on demand for each glyph, because the system may need to use different
+// fallback fonts for each. This lazy population is done by the Font.
+class GlyphPageTreeNode {
+public:
+ GlyphPageTreeNode()
+ : m_parent(0)
+ , m_level(0)
+ , m_isSystemFallback(false)
+ , m_systemFallbackChild(0)
+ , m_customFontCount(0)
+#ifndef NDEBUG
+ , m_pageNumber(0)
+#endif
+ {
+ }
+
+ ~GlyphPageTreeNode();
+
+ static HashMap<int, GlyphPageTreeNode*>* roots;
+ static GlyphPageTreeNode* pageZeroRoot;
+
+ static GlyphPageTreeNode* getRootChild(const FontData* fontData, unsigned pageNumber)
+ {
+ return getRoot(pageNumber)->getChild(fontData, pageNumber);
+ }
+
+ static void pruneTreeCustomFontData(const FontData*);
+ static void pruneTreeFontData(const SimpleFontData*);
+
+ void pruneCustomFontData(const FontData*);
+ void pruneFontData(const SimpleFontData*, unsigned level = 0);
+
+ GlyphPageTreeNode* parent() const { return m_parent; }
+ GlyphPageTreeNode* getChild(const FontData*, unsigned pageNumber);
+
+ // Returns a page of glyphs (or NULL if there are no glyphs in this page's character range).
+ GlyphPage* page() const { return m_page.get(); }
+
+ // Returns the level of this node. See class-level comment.
+ unsigned level() const { return m_level; }
+
+ // The system fallback font has special rules (see above).
+ bool isSystemFallback() const { return m_isSystemFallback; }
+
+ static size_t treeGlyphPageCount();
+ size_t pageCount() const;
+
+private:
+ static GlyphPageTreeNode* getRoot(unsigned pageNumber);
+ void initializePage(const FontData*, unsigned pageNumber);
+
+ GlyphPageTreeNode* m_parent;
+ RefPtr<GlyphPage> m_page;
+ unsigned m_level;
+ bool m_isSystemFallback;
+ HashMap<const FontData*, GlyphPageTreeNode*> m_children;
+ GlyphPageTreeNode* m_systemFallbackChild;
+ unsigned m_customFontCount;
+
+#ifndef NDEBUG
+ unsigned m_pageNumber;
+#endif
+};
+
+} // namespace WebCore
+
+#endif // GlyphPageTreeNode_h
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GlyphWidthMap_h
+#define GlyphWidthMap_h
+
+#include <wtf/unicode/Unicode.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/HashMap.h>
+
+namespace WebCore {
+
+typedef unsigned short Glyph;
+
+const float cGlyphWidthUnknown = -1;
+
+class GlyphWidthMap : Noncopyable {
+public:
+ GlyphWidthMap() : m_filledPrimaryPage(false), m_pages(0) {}
+ ~GlyphWidthMap() { if (m_pages) { deleteAllValues(*m_pages); delete m_pages; } }
+
+ float widthForGlyph(Glyph);
+ void setWidthForGlyph(Glyph, float);
+
+private:
+ struct GlyphWidthPage {
+ static const size_t size = 256; // Usually covers Latin-1 in a single page.
+ float m_widths[size];
+
+ float widthForGlyph(Glyph g) const { return m_widths[g % size]; }
+ void setWidthForGlyph(Glyph g, float w)
+ {
+ setWidthForIndex(g % size, w);
+ }
+ void setWidthForIndex(unsigned index, float w)
+ {
+ m_widths[index] = w;
+ }
+ };
+
+ GlyphWidthPage* locatePage(unsigned page);
+
+ bool m_filledPrimaryPage;
+ GlyphWidthPage m_primaryPage; // We optimize for the page that contains glyph indices 0-255.
+ HashMap<int, GlyphWidthPage*>* m_pages;
+};
+
+}
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Alp Toker <alp@atoker.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Gradient_h
+#define Gradient_h
+
+#include "FloatPoint.h"
+#include "Generator.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/Vector.h>
+
+#if PLATFORM(CG)
+typedef struct CGShading* CGShadingRef;
+typedef CGShadingRef PlatformGradient;
+#elif PLATFORM(QT)
+QT_BEGIN_NAMESPACE
+class QGradient;
+QT_END_NAMESPACE
+typedef QGradient* PlatformGradient;
+#elif PLATFORM(CAIRO)
+typedef struct _cairo_pattern cairo_pattern_t;
+typedef cairo_pattern_t* PlatformGradient;
+#elif PLATFORM(SKIA)
+class SkShader;
+typedef class SkShader* PlatformGradient;
+typedef class SkShader* PlatformPattern;
+#else
+typedef void* PlatformGradient;
+#endif
+
+namespace WebCore {
+
+ class Color;
+
+ class Gradient : public Generator {
+ public:
+ static PassRefPtr<Gradient> create(const FloatPoint& p0, const FloatPoint& p1)
+ {
+ return adoptRef(new Gradient(p0, p1));
+ }
+ static PassRefPtr<Gradient> create(const FloatPoint& p0, float r0, const FloatPoint& p1, float r1)
+ {
+ return adoptRef(new Gradient(p0, r0, p1, r1));
+ }
+ virtual ~Gradient();
+
+ void addColorStop(float, const Color&);
+
+ void getColor(float value, float* r, float* g, float* b, float* a) const;
+
+ PlatformGradient platformGradient();
+
+ struct ColorStop {
+ float stop;
+ float red;
+ float green;
+ float blue;
+ float alpha;
+
+ ColorStop() : stop(0), red(0), green(0), blue(0), alpha(0) { }
+ ColorStop(float s, float r, float g, float b, float a) : stop(s), red(r), green(g), blue(b), alpha(a) { }
+ };
+
+ void setStopsSorted(bool s) { m_stopsSorted = s; }
+
+ virtual void fill(GraphicsContext*, const FloatRect&);
+
+ private:
+ Gradient(const FloatPoint& p0, const FloatPoint& p1);
+ Gradient(const FloatPoint& p0, float r0, const FloatPoint& p1, float r1);
+
+ void platformInit() { m_gradient = 0; }
+ void platformDestroy();
+
+ int findStop(float value) const;
+
+ bool m_radial;
+ FloatPoint m_p0;
+ FloatPoint m_p1;
+ float m_r0;
+ float m_r1;
+ mutable Vector<ColorStop> m_stops;
+ mutable bool m_stopsSorted;
+ mutable int m_lastStop;
+
+ PlatformGradient m_gradient;
+ };
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GraphicsContext_h
+#define GraphicsContext_h
+
+#include "DashArray.h"
+#include "FloatRect.h"
+#include "Image.h"
+#include "IntRect.h"
+#include "Path.h"
+#include "TextDirection.h"
+#include <wtf/Noncopyable.h>
+#include <wtf/Platform.h>
+
+#if PLATFORM(CG)
+typedef struct CGContext PlatformGraphicsContext;
+#elif PLATFORM(CAIRO)
+typedef struct _cairo PlatformGraphicsContext;
+#elif PLATFORM(QT)
+QT_BEGIN_NAMESPACE
+class QPainter;
+QT_END_NAMESPACE
+typedef QPainter PlatformGraphicsContext;
+#elif PLATFORM(WX)
+class wxGCDC;
+class wxWindowDC;
+
+// wxGraphicsContext allows us to support Path, etc.
+// but on some platforms, e.g. Linux, it requires fairly
+// new software.
+#if USE(WXGC)
+// On OS X, wxGCDC is just a typedef for wxDC, so use wxDC explicitly to make
+// the linker happy.
+#ifdef __APPLE__
+ class wxDC;
+ typedef wxDC PlatformGraphicsContext;
+#else
+ typedef wxGCDC PlatformGraphicsContext;
+#endif
+#else
+ typedef wxWindowDC PlatformGraphicsContext;
+#endif
+#elif PLATFORM(SKIA)
+typedef class PlatformContextSkia PlatformGraphicsContext;
+#else
+typedef void PlatformGraphicsContext;
+#endif
+
+#if PLATFORM(GTK)
+typedef struct _GdkDrawable GdkDrawable;
+typedef struct _GdkEventExpose GdkEventExpose;
+#endif
+
+#if PLATFORM(WIN)
+typedef struct HDC__* HDC;
+#if !PLATFORM(CG)
+// UInt8 is defined in CoreFoundation/CFBase.h
+typedef unsigned char UInt8;
+#endif
+#endif
+
+#if PLATFORM(QT) && defined(Q_WS_WIN)
+#include <windows.h>
+#endif
+
+namespace WebCore {
+
+ const int cMisspellingLineThickness = 3;
+ const int cMisspellingLinePatternWidth = 4;
+ const int cMisspellingLinePatternGapWidth = 1;
+
+ class TransformationMatrix;
+ class Font;
+ class Generator;
+ class Gradient;
+ class GraphicsContextPrivate;
+ class GraphicsContextPlatformPrivate;
+ class ImageBuffer;
+ class KURL;
+ class Path;
+ class Pattern;
+ class TextRun;
+ class BidiStatus;
+
+ // These bits can be ORed together for a total of 8 possible text drawing modes.
+ const int cTextInvisible = 0;
+ const int cTextFill = 1;
+ const int cTextStroke = 2;
+ const int cTextClip = 4;
+
+ enum StrokeStyle {
+ NoStroke,
+ SolidStroke,
+ DottedStroke,
+ DashedStroke
+ };
+
+ enum InterpolationQuality {
+ InterpolationDefault,
+ InterpolationNone,
+ InterpolationLow,
+ InterpolationMedium,
+ InterpolationHigh
+ };
+
+ // FIXME: Currently these constants have to match the values used in the SVG
+ // DOM API. That's a mistake. We need to make cut that dependency.
+ enum GradientSpreadMethod {
+ SpreadMethodPad = 1,
+ SpreadMethodReflect = 2,
+ SpreadMethodRepeat = 3
+ };
+
+ struct IPhoneGradient
+ {
+ float * start;
+ float * end;
+ IPhoneGradient(float* aStart = NULL, float* anEnd = NULL) : start(aStart), end(anEnd) { }
+ };
+
+ typedef IPhoneGradient* IPhoneGradientRef;
+
+ enum Interpolation
+ {
+ LinearInterpolation,
+ ExponentialInterpolation
+ };
+
+ class GraphicsContext : Noncopyable {
+ public:
+ GraphicsContext(PlatformGraphicsContext*, bool setContextColors = true);
+ ~GraphicsContext();
+
+ PlatformGraphicsContext* platformContext() const;
+
+ float strokeThickness() const;
+ void setStrokeThickness(float);
+ StrokeStyle strokeStyle() const;
+ void setStrokeStyle(const StrokeStyle& style);
+ Color strokeColor() const;
+ void setStrokeColor(const Color&);
+ void setStrokePattern(PassRefPtr<Pattern>);
+ void setStrokeGradient(PassRefPtr<Gradient>);
+
+ WindRule fillRule() const;
+ void setFillRule(WindRule);
+ GradientSpreadMethod spreadMethod() const;
+ void setSpreadMethod(GradientSpreadMethod);
+ Color fillColor() const;
+ void setFillColor(const Color&);
+ void setFillPattern(PassRefPtr<Pattern>);
+ void setFillGradient(PassRefPtr<Gradient>);
+ void setShadowsIgnoreTransforms(bool);
+
+ void setShouldAntialias(bool);
+ bool shouldAntialias() const;
+
+#if PLATFORM(CG)
+ void applyStrokePattern();
+ void applyFillPattern();
+#endif
+
+ void save();
+ void restore();
+
+ // These draw methods will do both stroking and filling.
+ void drawRect(const IntRect&);
+ void drawLine(const IntPoint&, const IntPoint&, bool antialias = false);
+
+ void drawJoinedLines(CGPoint points [], unsigned count, bool antialias, CGLineCap lineCap = kCGLineCapButt);
+
+ void drawEllipse(const IntRect&);
+ void drawEllipse(const FloatRect&);
+ void drawRaisedEllipse(const FloatRect&, Color ellipseColor, Color shadowColor);
+ void drawConvexPolygon(size_t numPoints, const FloatPoint*, bool shouldAntialias = false);
+
+ void drawPath();
+ void fillPath();
+ void strokePath();
+
+ // Arc drawing (used by border-radius in CSS) just supports stroking at the moment.
+ void strokeArc(const IntRect&, int startAngle, int angleSpan);
+
+ void fillRect(const FloatRect&);
+ void fillRect(const FloatRect&, const Color&);
+ void fillRect(const FloatRect&, Generator&);
+ void fillRoundedRect(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const Color&);
+
+ void clearRect(const FloatRect&);
+
+ void strokeRect(const FloatRect&);
+ void strokeRect(const FloatRect&, float lineWidth);
+
+ void drawImage(Image*, const IntPoint&, CompositeOperator = CompositeSourceOver);
+ void drawImage(Image*, const IntRect&, CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false);
+ void drawImage(Image*, const IntPoint& destPoint, const IntRect& srcRect, CompositeOperator = CompositeSourceOver);
+ void drawImage(Image*, const IntRect& destRect, const IntRect& srcRect, CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false);
+ void drawImage(Image*, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1),
+ CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false);
+ void drawTiledImage(Image*, const IntRect& destRect, const IntPoint& srcPoint, const IntSize& tileSize,
+ CompositeOperator = CompositeSourceOver);
+ void drawTiledImage(Image*, const IntRect& destRect, const IntRect& srcRect,
+ Image::TileRule hRule = Image::StretchTile, Image::TileRule vRule = Image::StretchTile,
+ CompositeOperator = CompositeSourceOver);
+
+ void setImageInterpolationQuality(InterpolationQuality);
+ InterpolationQuality imageInterpolationQuality() const;
+
+ void clip(const FloatRect&);
+ void addRoundedRectClip(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight);
+ void addRoundedRectClip(const FloatRect&, const FloatSize& topLeft, const FloatSize& topRight, const FloatSize& bottomLeft, const FloatSize& bottomRight);
+ void addInnerRoundedRectClip(const IntRect&, int thickness);
+ void clipOut(const IntRect&);
+ void clipOutEllipseInRect(const IntRect&);
+ void clipOutRoundedRect(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight);
+ void clipPath(WindRule);
+ void clipToImageBuffer(const FloatRect&, const ImageBuffer*);
+
+ int textDrawingMode();
+ void setTextDrawingMode(int);
+
+ bool emojiDrawingEnabled();
+ void setEmojiDrawingEnabled(bool emojiDrawingEnabled);
+
+ float drawText(const Font&, const TextRun&, const IntPoint&, int from = 0, int to = -1);
+ float drawBidiText(const Font&, const TextRun&, const FloatPoint&, BidiStatus* = 0, int length = -1);
+ void drawHighlightForText(const Font&, const TextRun&, const IntPoint&, int h, const Color& backgroundColor, int from = 0, int to = -1);
+
+ FloatRect roundToDevicePixels(const FloatRect&);
+
+ void drawLineForText(const IntPoint&, int width, bool printing);
+ void drawLineForMisspellingOrBadGrammar(const IntPoint&, int width, bool grammar);
+
+ bool paintingDisabled() const;
+ void setPaintingDisabled(bool);
+
+ bool updatingControlTints() const;
+ void setUpdatingControlTints(bool);
+
+ void beginTransparencyLayer(float opacity);
+ void endTransparencyLayer();
+
+ void setShadow(const IntSize&, int blur, const Color&);
+ bool getShadow(IntSize&, int&, Color&) const;
+ void clearShadow();
+
+ void initFocusRing(int width, int offset);
+ void addFocusRingRect(const IntRect&);
+ void drawFocusRing(const Color&);
+ void clearFocusRing();
+ IntRect focusRingBoundingRect();
+
+ void setLineCap(LineCap);
+ void setLineDash(const DashArray&, float dashOffset);
+ void setLineJoin(LineJoin);
+ void setMiterLimit(float);
+
+ void setAlpha(float);
+#if PLATFORM(CAIRO)
+ float getAlpha();
+#endif
+
+ void setCompositeOperation(CompositeOperator);
+
+ void beginPath();
+ void addPath(const Path&);
+
+ void clip(const Path&);
+ void clipOut(const Path&);
+
+ void scale(const FloatSize&);
+ void rotate(float angleInRadians);
+ void translate(float x, float y);
+ IntPoint origin();
+
+ void setURLForRect(const KURL&, const IntRect&);
+
+ void concatCTM(const TransformationMatrix&);
+ TransformationMatrix getCTM() const;
+
+#if PLATFORM(WIN)
+ GraphicsContext(HDC, bool hasAlpha = false); // FIXME: To be removed.
+ bool inTransparencyLayer() const;
+ HDC getWindowsContext(const IntRect&, bool supportAlphaBlend = true, bool mayCreateBitmap = true); // The passed in rect is used to create a bitmap for compositing inside transparency layers.
+ void releaseWindowsContext(HDC, const IntRect&, bool supportAlphaBlend = true, bool mayCreateBitmap = true); // The passed in HDC should be the one handed back by getWindowsContext.
+
+ // When set to true, child windows should be rendered into this context
+ // rather than allowing them just to render to the screen. Defaults to
+ // false.
+ // FIXME: This is a layering violation. GraphicsContext shouldn't know
+ // what a "window" is. It would be much more appropriate for this flag
+ // to be passed as a parameter alongside the GraphicsContext, but doing
+ // that would require lots of changes in cross-platform code that we
+ // aren't sure we want to make.
+ void setShouldIncludeChildWindows(bool);
+ bool shouldIncludeChildWindows() const;
+
+ class WindowsBitmap : public Noncopyable {
+ public:
+ WindowsBitmap(HDC, IntSize);
+ ~WindowsBitmap();
+
+ HDC hdc() const { return m_hdc; }
+ UInt8* buffer() const { return m_bitmapBuffer; }
+ unsigned bufferLength() const { return m_bitmapBufferLength; }
+ IntSize size() const { return m_size; }
+ unsigned bytesPerRow() const { return m_bytesPerRow; }
+
+ private:
+ HDC m_hdc;
+ HBITMAP m_bitmap;
+ UInt8* m_bitmapBuffer;
+ unsigned m_bitmapBufferLength;
+ IntSize m_size;
+ unsigned m_bytesPerRow;
+ };
+
+ WindowsBitmap* createWindowsBitmap(IntSize);
+ // The bitmap should be non-premultiplied.
+ void drawWindowsBitmap(WindowsBitmap*, const IntPoint&);
+#endif
+
+#if PLATFORM(QT) && defined(Q_WS_WIN)
+ HDC getWindowsContext(const IntRect&, bool supportAlphaBlend = true, bool mayCreateBitmap = true);
+ void releaseWindowsContext(HDC, const IntRect&, bool supportAlphaBlend = true, bool mayCreateBitmap = true);
+#endif
+
+#if PLATFORM(QT)
+ bool inTransparencyLayer() const;
+ PlatformPath* currentPath();
+ QPen pen();
+#endif
+
+ void setPenFromCGColor (CGColorRef color);
+ void drawAxialGradient(IPhoneGradientRef aGradient, FloatPoint startPoint, FloatPoint stopPoint, Interpolation anInterpolation);
+ void drawRadialGradient(IPhoneGradientRef aGradient, FloatPoint startPoint, float startRadius, FloatPoint stopPoint, float stopRadius, Interpolation anInterpolation);
+
+#if PLATFORM(GTK)
+ void setGdkExposeEvent(GdkEventExpose*);
+ GdkDrawable* gdkDrawable() const;
+ GdkEventExpose* gdkExposeEvent() const;
+#endif
+
+ private:
+ void savePlatformState();
+ void restorePlatformState();
+
+ void setPlatformTextDrawingMode(int);
+ void setPlatformFont(const Font& font);
+
+ void setPlatformStrokeColor(const Color&);
+ void setPlatformStrokeStyle(const StrokeStyle&);
+ void setPlatformStrokeThickness(float);
+
+ void setPlatformFillColor(const Color&);
+
+ void setPlatformShouldAntialias(bool b);
+
+ void setPlatformShadow(const IntSize&, int blur, const Color&);
+ void clearPlatformShadow();
+
+ int focusRingWidth() const;
+ int focusRingOffset() const;
+ const Vector<IntRect>& focusRingRects() const;
+
+ static GraphicsContextPrivate* createGraphicsContextPrivate();
+ static void destroyGraphicsContextPrivate(GraphicsContextPrivate*);
+
+ GraphicsContextPrivate* m_common;
+ GraphicsContextPlatformPrivate* m_data; // Deprecated; m_commmon can just be downcasted. To be removed.
+ };
+
+} // namespace WebCore
+
+#endif // GraphicsContext_h
--- /dev/null
+/*
+ * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GraphicsContextPrivate_h
+#define GraphicsContextPrivate_h
+
+#include "TransformationMatrix.h"
+#include "Gradient.h"
+#include "GraphicsContext.h"
+#include "Pattern.h"
+
+namespace WebCore {
+
+// FIXME: This is a place-holder until we decide to add
+// real color space support to WebCore. At that time, ColorSpace will be a
+// class and instances will be held off of Colors. There will be
+// special singleton Gradient and Pattern color spaces to mark when
+// a fill or stroke is using a gradient or pattern instead of a solid color.
+// https://bugs.webkit.org/show_bug.cgi?id=20558
+ enum ColorSpace {
+ SolidColorSpace,
+ PatternColorSpace,
+ GradientColorSpace
+ };
+
+ struct GraphicsContextState {
+ GraphicsContextState()
+ : textDrawingMode(cTextFill)
+ , strokeStyle(SolidStroke)
+ , strokeThickness(0)
+#if PLATFORM(CAIRO)
+ , globalAlpha(1.0f)
+#endif
+ , strokeColorSpace(SolidColorSpace)
+ , strokeColor(Color::black)
+ , fillRule(RULE_NONZERO)
+ , fillColorSpace(SolidColorSpace)
+ , fillColor(Color::black)
+ , shouldAntialias(true)
+ , paintingDisabled(false)
+ , shadowBlur(0)
+ , shadowsIgnoreTransforms(false)
+ , emojiDrawingEnabled(true)
+ {
+ }
+
+ int textDrawingMode;
+
+ StrokeStyle strokeStyle;
+ float strokeThickness;
+#if PLATFORM(CAIRO)
+ float globalAlpha;
+#elif PLATFORM(QT)
+ TransformationMatrix pathTransform;
+#endif
+ ColorSpace strokeColorSpace;
+ Color strokeColor;
+ RefPtr<Gradient> strokeGradient;
+ RefPtr<Pattern> strokePattern;
+
+ WindRule fillRule;
+ GradientSpreadMethod spreadMethod;
+ ColorSpace fillColorSpace;
+ Color fillColor;
+ RefPtr<Gradient> fillGradient;
+ RefPtr<Pattern> fillPattern;
+
+ bool shouldAntialias;
+
+ bool paintingDisabled;
+
+ IntSize shadowSize;
+ unsigned shadowBlur;
+ Color shadowColor;
+
+ bool shadowsIgnoreTransforms;
+
+ bool emojiDrawingEnabled;
+ };
+
+ class GraphicsContextPrivate {
+ public:
+ GraphicsContextPrivate()
+ : m_focusRingWidth(0)
+ , m_focusRingOffset(0)
+ , m_updatingControlTints(false)
+ {
+ }
+
+ GraphicsContextState state;
+ Vector<GraphicsContextState> stack;
+ Vector<IntRect> m_focusRingRects;
+ int m_focusRingWidth;
+ int m_focusRingOffset;
+ bool m_updatingControlTints;
+ };
+
+} // namespace WebCore
+
+#endif // GraphicsContextPrivate_h
--- /dev/null
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GraphicsLayer_h
+#define GraphicsLayer_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "Animation.h"
+#include "Color.h"
+#include "FloatPoint.h"
+#include "FloatPoint3D.h"
+#include "FloatSize.h"
+#include "GraphicsLayerClient.h"
+#include "TransformationMatrix.h"
+#include "TransformOperations.h"
+#include <wtf/OwnPtr.h>
+
+#if PLATFORM(MAC)
+#ifdef __OBJC__
+@class WebLayer;
+@class CALayer;
+typedef WebLayer PlatformLayer;
+typedef CALayer* NativeLayer;
+#else
+typedef void* PlatformLayer;
+typedef void* NativeLayer;
+#endif
+#else
+typedef void* PlatformLayer;
+typedef void* NativeLayer;
+#endif
+
+#if PLATFORM(IPHONE_SIMULATOR) || !defined(NDEBUG)
+#define SUPPORT_DEBUG_INDICATORS 1
+#endif
+
+namespace WebCore {
+
+class FloatPoint3D;
+class GraphicsContext;
+class Image;
+class TextStream;
+class TimingFunction;
+
+// GraphicsLayer is an abstraction for a rendering surface with backing store,
+// which may have associated transformation and animations.
+
+class GraphicsLayer {
+public:
+ // Used to store one float value of a keyframe animation.
+ class FloatValue {
+ public:
+ FloatValue(float key, float value, const TimingFunction* timingFunction = 0)
+ : m_key(key), m_value(value), m_timingFunction(0)
+ {
+ if (timingFunction)
+ m_timingFunction.set(new TimingFunction(*timingFunction));
+ }
+
+ FloatValue(const FloatValue& other)
+ : m_key(other.key()), m_value(other.value()), m_timingFunction(0)
+ {
+ if (other.timingFunction())
+ m_timingFunction.set(new TimingFunction(*other.timingFunction()));
+ }
+
+ const FloatValue& operator=(const FloatValue& other)
+ {
+ if (&other != this)
+ set(other.key(), other.value(), other.timingFunction());
+ return *this;
+ }
+
+ void set(float key, float value, const TimingFunction*);
+
+ float key() const { return m_key; }
+ float value() const { return m_value; }
+ const TimingFunction* timingFunction() const { return m_timingFunction.get(); }
+
+ private:
+ float m_key;
+ float m_value;
+ OwnPtr<TimingFunction> m_timingFunction;
+ };
+
+
+ class FloatValueList {
+ public:
+ void insert(float key, float value, const TimingFunction* timingFunction);
+
+ size_t size() const { return m_values.size(); }
+ const FloatValue& at(size_t i) const { return m_values.at(i); }
+ const Vector<FloatValue>& values() const { return m_values; }
+
+ private:
+ Vector<FloatValue> m_values;
+ };
+
+ // Used to store one transform in a keyframe list.
+ class TransformValue {
+ public:
+ TransformValue(float key = NAN, const TransformOperations* value = 0, const TimingFunction* timingFunction = 0)
+ : m_key(key)
+ {
+ if (value)
+ m_value.set(new TransformOperations(*value));
+ if (timingFunction)
+ m_timingFunction.set(new TimingFunction(*timingFunction));
+ }
+
+ TransformValue(const TransformValue& other)
+ : m_key(other.key())
+ {
+ if (other.value())
+ m_value.set(new TransformOperations(*other.value()));
+ if (other.timingFunction())
+ m_timingFunction.set(new TimingFunction(*other.timingFunction()));
+ }
+
+ const TransformValue& operator=(const TransformValue& other)
+ {
+ if (&other != this)
+ set(other.key(), other.value(), other.timingFunction());
+ return *this;
+ }
+
+ void set(float key, const TransformOperations* value, const TimingFunction* timingFunction);
+
+ float key() const { return m_key; }
+ const TransformOperations* value() const { return m_value.get(); }
+ const TimingFunction* timingFunction() const { return m_timingFunction.get(); }
+
+ private:
+ float m_key;
+ OwnPtr<TransformOperations> m_value;
+ OwnPtr<TimingFunction> m_timingFunction;
+ };
+
+ // Used to store a series of transforms in a keyframe list.
+ class TransformValueList {
+ public:
+ typedef Vector<TransformOperation::OperationType> FunctionList;
+
+ size_t size() const { return m_values.size(); }
+ const TransformValue& at(size_t i) const { return m_values.at(i); }
+ const Vector<TransformValue>& values() const { return m_values; }
+
+ void insert(float key, const TransformOperations* value, const TimingFunction* timingFunction);
+
+ // return a list of the required functions. List is empty if keyframes are not valid
+ // If return value is true, functions contain rotations of >= 180 degrees
+ void makeFunctionList(FunctionList& list, bool& isValid, bool& hasBigRotation) const;
+ private:
+ Vector<TransformValue> m_values;
+ };
+
+ static GraphicsLayer* createGraphicsLayer(GraphicsLayerClient*);
+
+ virtual ~GraphicsLayer();
+
+ GraphicsLayerClient* client() const { return m_client; }
+
+ // Layer name. Only used to identify layers in debug output
+ const String& name() const { return m_name; }
+ virtual void setName(const String& name) { m_name = name; }
+
+ // For hosting this GraphicsLayer in a native layer hierarchy.
+ virtual NativeLayer nativeLayer() const { return 0; }
+
+ GraphicsLayer* parent() const { return m_parent; };
+ void setParent(GraphicsLayer* layer) { m_parent = layer; } // Internal use only.
+
+ const Vector<GraphicsLayer*>& children() const { return m_children; }
+
+ // Add child layers. If the child is already parented, it will be removed from its old parent.
+ virtual void addChild(GraphicsLayer*);
+ virtual void addChildAtIndex(GraphicsLayer*, int index);
+ virtual void addChildAbove(GraphicsLayer* layer, GraphicsLayer* sibling);
+ virtual void addChildBelow(GraphicsLayer* layer, GraphicsLayer* sibling);
+ virtual bool replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild);
+
+ void removeAllChildren();
+ virtual void removeFromParent();
+
+ // Offset is origin of the renderer minus origin of the graphics layer (so either zero or negative).
+ IntSize offsetFromRenderer() const { return m_offsetFromRenderer; }
+ void setOffsetFromRenderer(const IntSize& offset) { m_offsetFromRenderer = offset; }
+
+ // The position of the layer (the location of its top-left corner in its parent)
+ const FloatPoint& position() const { return m_position; }
+ virtual void setPosition(const FloatPoint& p) { m_position = p; }
+
+ // Anchor point: (0, 0) is top left, (1, 1) is bottom right. The anchor point
+ // affects the origin of the transforms.
+ const FloatPoint3D& anchorPoint() const { return m_anchorPoint; }
+ virtual void setAnchorPoint(const FloatPoint3D& p) { m_anchorPoint = p; }
+
+ // The bounds of the layer
+ const FloatSize& size() const { return m_size; }
+ virtual void setSize(const FloatSize& size) { m_size = size; }
+
+ const TransformationMatrix& transform() const { return m_transform; }
+ virtual void setTransform(const TransformationMatrix& t) { m_transform = t; }
+
+ const TransformationMatrix& childrenTransform() const { return m_childrenTransform; }
+ virtual void setChildrenTransform(const TransformationMatrix& t) { m_childrenTransform = t; }
+
+ bool preserves3D() const { return m_preserves3D; }
+ virtual void setPreserves3D(bool b) { m_preserves3D = b; }
+
+ bool masksToBounds() const { return m_masksToBounds; }
+ virtual void setMasksToBounds(bool b) { m_masksToBounds = b; }
+
+ bool drawsContent() const { return m_drawsContent; }
+ virtual void setDrawsContent(bool b) { m_drawsContent = b; }
+
+ // The color used to paint the layer backgrounds
+ const Color& backgroundColor() const { return m_backgroundColor; }
+ virtual void setBackgroundColor(const Color&, const Animation* = 0, double beginTime = 0);
+ virtual void clearBackgroundColor();
+ bool backgroundColorSet() const { return m_backgroundColorSet; }
+
+ // opaque means that we know the layer contents have no alpha
+ bool contentsOpaque() const { return m_contentsOpaque; }
+ virtual void setContentsOpaque(bool b) { m_contentsOpaque = b; }
+
+ bool backfaceVisibility() const { return m_backfaceVisibility; }
+ virtual void setBackfaceVisibility(bool b) { m_backfaceVisibility = b; }
+
+ float opacity() const { return m_opacity; }
+ // return true if we started an animation
+ virtual bool setOpacity(float o, const Animation* = 0, double beginTime = 0);
+
+ // Some GraphicsLayers paint only the foreground or the background content
+ GraphicsLayerPaintingPhase drawingPhase() const { return m_paintingPhase; }
+ void setDrawingPhase(GraphicsLayerPaintingPhase phase) { m_paintingPhase = phase; }
+
+ virtual void setNeedsDisplay() = 0;
+ // mark the given rect (in layer coords) as needing dispay. Never goes deep.
+ virtual void setNeedsDisplayInRect(const FloatRect&) = 0;
+
+ virtual bool animateTransform(const TransformValueList&, const IntSize&, const Animation*, double beginTime, bool isTransition) = 0;
+ virtual bool animateFloat(AnimatedPropertyID, const FloatValueList&, const Animation*, double beginTime) = 0;
+
+ void removeFinishedAnimations(const String& name, int index, bool reset);
+ void removeFinishedTransitions(AnimatedPropertyID);
+ void removeAllAnimations();
+
+ virtual void suspendAnimations();
+ virtual void resumeAnimations();
+
+ // Layer contents
+ virtual void setContentsToImage(Image*) { }
+ virtual void setContentsToVideo(PlatformLayer*) { }
+ virtual void setContentsBackgroundColor(const Color&) { }
+ virtual void clearContents() { }
+
+ virtual void updateContentsRect() { }
+
+ // Callback from the underlying graphics system to draw layer contents.
+ void paintGraphicsLayerContents(GraphicsContext&, const IntRect& clip);
+
+ virtual PlatformLayer* platformLayer() const { return 0; }
+
+ // Change the scale at which the contents are rendered. Note that contentsScale may not return
+ // the same value passed to setContentsScale(), because of clamping and hysteresis.
+ float contentsScale() const { return m_contentsScale; }
+ virtual void setContentsScale(float);
+
+ void dumpLayer(TextStream&, int indent = 0) const;
+
+#ifdef SUPPORT_DEBUG_INDICATORS
+ int repaintCount() const { return m_repaintCount; }
+ int incrementRepaintCount() { return ++m_repaintCount; }
+#endif
+
+ // Platform behaviors
+ static bool graphicsContextsFlipped();
+
+#ifdef SUPPORT_DEBUG_INDICATORS
+ static bool showDebugBorders();
+ static bool showRepaintCounter();
+
+ void updateDebugIndicators();
+
+ virtual void setDebugBackgroundColor(const Color&) { }
+ virtual void setDebugBorder(const Color&, float /*borderWidth*/) { }
+#endif
+ // z-position is the z-equivalent of position(). It's only used for debugging purposes.
+ virtual float zPosition() const { return m_zPosition; }
+ virtual void setZPosition(float);
+
+ static String propertyIdToString(AnimatedPropertyID);
+
+protected:
+ GraphicsLayer(GraphicsLayerClient*);
+
+ void dumpProperties(TextStream&, int indent) const;
+
+ // returns -1 if not found
+ int findAnimationEntry(AnimatedPropertyID, short index) const;
+ void addAnimationEntry(AnimatedPropertyID, short index, bool isTransition, const Animation*);
+
+ virtual void removeAnimation(int /*index*/, bool /*reset*/) {}
+ void removeAllAnimationsForProperty(AnimatedPropertyID);
+
+ float clampedContentsScaleForScale(float scale) const;
+
+ GraphicsLayerClient* m_client;
+ String m_name;
+
+ // Offset from the owning renderer
+ IntSize m_offsetFromRenderer;
+
+ // Position is relative to the parent GraphicsLayer
+ FloatPoint m_position;
+ FloatPoint3D m_anchorPoint;
+ FloatSize m_size;
+ TransformationMatrix m_transform;
+ TransformationMatrix m_childrenTransform;
+
+ Color m_backgroundColor;
+ float m_opacity;
+ float m_zPosition;
+
+ float m_contentsScale;
+
+ bool m_backgroundColorSet : 1;
+ bool m_contentsOpaque : 1;
+ bool m_preserves3D: 1;
+ bool m_backfaceVisibility : 1;
+ bool m_usingTiledLayer : 1;
+ bool m_masksToBounds : 1;
+ bool m_drawsContent : 1;
+
+ GraphicsLayerPaintingPhase m_paintingPhase;
+
+ Vector<GraphicsLayer*> m_children;
+ GraphicsLayer* m_parent;
+
+ // AnimationEntry represents an animation of a property on this layer.
+ // For transform only, there may be more than one, in which case 'index'
+ // is an index into the list of transforms.
+ class AnimationEntry {
+ public:
+ AnimationEntry(const Animation* animation, AnimatedPropertyID property, short index, bool isTransition)
+ : m_animation(const_cast<Animation*>(animation))
+ , m_property(property)
+ , m_index(index)
+ , m_isCurrent(true)
+ , m_isTransition(isTransition)
+ {
+ }
+
+ const Animation* animation() const { return m_animation.get(); }
+ AnimatedPropertyID property() const { return m_property; }
+ int index() const { return m_index; }
+ bool isCurrent() const { return m_isCurrent; }
+ void setIsCurrent(bool b = true) { m_isCurrent = b; }
+ bool isTransition() const { return m_isTransition; }
+
+ bool matches(AnimatedPropertyID property, short index) const
+ {
+ return m_property == property && m_index == index;
+ }
+
+ void reset(const Animation* animation, bool isTransition)
+ {
+ m_animation = const_cast<Animation*>(animation);
+ m_isTransition = isTransition;
+ m_isCurrent = true;
+ }
+
+ private:
+ RefPtr<Animation> m_animation;
+ AnimatedPropertyID m_property : 14;
+ short m_index : 16;
+ bool m_isCurrent : 1;
+ bool m_isTransition : 1;
+ };
+
+ Vector<AnimationEntry> m_animations; // running animations/transitions
+#ifdef SUPPORT_DEBUG_INDICATORS
+ int m_repaintCount;
+#endif
+};
+
+
+} // namespace WebCore
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif // GraphicsLayer_h
+
--- /dev/null
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GraphicsLayerCA_h
+#define GraphicsLayerCA_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "GraphicsLayer.h"
+#include <wtf/RetainPtr.h>
+
+@class WebAnimationDelegate;
+@class WebLayer;
+
+namespace WebCore {
+
+class GraphicsLayerCA : public GraphicsLayer {
+public:
+
+ GraphicsLayerCA(GraphicsLayerClient*);
+ virtual ~GraphicsLayerCA();
+
+ virtual void setName(const String&);
+
+ // for hosting this GraphicsLayer in a native layer hierarchy
+ virtual NativeLayer nativeLayer() const;
+
+ virtual void addChild(GraphicsLayer*);
+ virtual void addChildAtIndex(GraphicsLayer*, int index);
+ virtual void addChildAbove(GraphicsLayer* layer, GraphicsLayer* sibling);
+ virtual void addChildBelow(GraphicsLayer* layer, GraphicsLayer* sibling);
+ virtual bool replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild);
+
+ virtual void removeFromParent();
+
+ virtual void setPosition(const FloatPoint&);
+ virtual void setAnchorPoint(const FloatPoint3D&);
+ virtual void setSize(const FloatSize&);
+
+ virtual void setTransform(const TransformationMatrix&);
+
+ virtual void setChildrenTransform(const TransformationMatrix&);
+
+ virtual void setPreserves3D(bool);
+ virtual void setMasksToBounds(bool);
+ virtual void setDrawsContent(bool);
+
+ virtual void setBackgroundColor(const Color&, const Animation* anim = 0, double beginTime = 0);
+ virtual void clearBackgroundColor();
+
+ virtual void setContentsOpaque(bool);
+ virtual void setBackfaceVisibility(bool);
+
+ // return true if we started an animation
+ virtual bool setOpacity(float, const Animation* anim = 0, double beginTime = 0);
+
+ virtual void setNeedsDisplay();
+ virtual void setNeedsDisplayInRect(const FloatRect&);
+
+ virtual void suspendAnimations();
+ virtual void resumeAnimations();
+
+ virtual bool animateTransform(const TransformValueList&, const IntSize&, const Animation*, double beginTime, bool isTransition);
+ virtual bool animateFloat(AnimatedPropertyID, const FloatValueList&, const Animation*, double beginTime);
+
+ virtual void setContentsToImage(Image*);
+ virtual void setContentsToVideo(PlatformLayer*);
+ virtual void clearContents();
+
+ virtual void updateContentsRect();
+
+ virtual PlatformLayer* platformLayer() const;
+
+ virtual void setContentsScale(float);
+
+ virtual void setDebugBackgroundColor(const Color&);
+ virtual void setDebugBorder(const Color&, float borderWidth);
+ virtual void setZPosition(float);
+
+private:
+ WebLayer* primaryLayer() const { return m_transformLayer.get() ? m_transformLayer.get() : m_layer.get(); }
+ WebLayer* hostLayerForSublayers() const;
+ WebLayer* layerForSuperlayer() const;
+
+ WebLayer* animatedLayer(AnimatedPropertyID property) const
+ {
+ return (property == AnimatedPropertyBackgroundColor) ? m_contentsLayer.get() : primaryLayer();
+ }
+
+ void setBasicAnimation(AnimatedPropertyID, TransformOperation::OperationType, short index, void* fromVal, void* toVal, bool isTransition, const Animation*, double time);
+ void setKeyframeAnimation(AnimatedPropertyID, TransformOperation::OperationType, short index, void* keys, void* values, void* timingFunctions, bool isTransition, const Animation*, double time);
+
+ virtual void removeAnimation(int index, bool reset);
+
+ bool requiresTiledLayer(const FloatSize&) const;
+ void swapFromOrToTiledLayer(bool useTiledLayer);
+
+ void setHasContentsLayer(bool);
+ void setContentsLayer(WebLayer*);
+ void setContentsLayerFlipped(bool);
+
+ RetainPtr<WebLayer> m_layer;
+ RetainPtr<WebLayer> m_transformLayer;
+ RetainPtr<WebLayer> m_contentsLayer;
+
+ RetainPtr<WebAnimationDelegate> m_animationDelegate;
+
+ bool m_contentLayerForImageOrVideo;
+};
+
+} // namespace WebCore
+
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif // GraphicsLayerCA_h
--- /dev/null
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GraphicsLayerClient_h
+#define GraphicsLayerClient_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+namespace WebCore {
+
+class GraphicsContext;
+class GraphicsLayer;
+class IntPoint;
+class IntRect;
+class FloatPoint;
+
+enum GraphicsLayerPaintingPhase {
+ GraphicsLayerPaintBackgroundMask = (1 << 0),
+ GraphicsLayerPaintForegroundMask = (1 << 1),
+ GraphicsLayerPaintAllMask = (GraphicsLayerPaintBackgroundMask | GraphicsLayerPaintForegroundMask)
+};
+
+enum AnimatedPropertyID {
+ AnimatedPropertyInvalid,
+ AnimatedPropertyWebkitTransform,
+ AnimatedPropertyOpacity,
+ AnimatedPropertyBackgroundColor
+};
+
+class GraphicsLayerClient {
+public:
+ virtual ~GraphicsLayerClient() {}
+
+ // Callbacks for when hardware-accelerated transitions and animation started
+ virtual void notifyAnimationStarted(const GraphicsLayer*, double time) = 0;
+
+ virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& inClip) = 0;
+
+ // Return a rect for the "contents" of the graphics layer, i.e. video or image content, in GraphicsLayer coordinates.
+ virtual IntRect contentsBox(const GraphicsLayer*) = 0;
+};
+
+} // namespace WebCore
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif // GraphicsLayerClient_h
--- /dev/null
+/*
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GraphicsTypes_h
+#define GraphicsTypes_h
+
+namespace WebCore {
+
+ class String;
+
+ // Note: These constants exactly match the NSCompositeOperator constants of
+ // AppKit on Mac OS X Tiger. If these ever change, we'll need to change the
+ // Mac OS X Tiger platform code to map one to the other.
+ enum CompositeOperator {
+ CompositeClear,
+ CompositeCopy,
+ CompositeSourceOver,
+ CompositeSourceIn,
+ CompositeSourceOut,
+ CompositeSourceAtop,
+ CompositeDestinationOver,
+ CompositeDestinationIn,
+ CompositeDestinationOut,
+ CompositeDestinationAtop,
+ CompositeXOR,
+ CompositePlusDarker,
+ CompositeHighlight,
+ CompositePlusLighter
+ };
+
+ enum LineCap { ButtCap, RoundCap, SquareCap };
+
+ enum LineJoin { MiterJoin, RoundJoin, BevelJoin };
+
+ enum HorizontalAlignment { AlignLeft, AlignRight, AlignHCenter };
+
+ enum TextBaseline { AlphabeticTextBaseline, TopTextBaseline, MiddleTextBaseline, BottomTextBaseline, IdeographicTextBaseline, HangingTextBaseline };
+
+ enum TextAlign { StartTextAlign, EndTextAlign, LeftTextAlign, CenterTextAlign, RightTextAlign };
+
+ String compositeOperatorName(CompositeOperator);
+ bool parseCompositeOperator(const String&, CompositeOperator&);
+
+ String lineCapName(LineCap);
+ bool parseLineCap(const String&, LineCap&);
+
+ String lineJoinName(LineJoin);
+ bool parseLineJoin(const String&, LineJoin&);
+
+ String textAlignName(TextAlign);
+ bool parseTextAlign(const String&, TextAlign&);
+
+ String textBaselineName(TextBaseline);
+ bool parseTextBaseline(const String&, TextBaseline&);
+
+} // namespace WebCore
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Simon Hausmann <hausmann@kde.org>
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLAnchorElement_h
+#define HTMLAnchorElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLAnchorElement : public HTMLElement {
+public:
+ HTMLAnchorElement(Document*);
+ HTMLAnchorElement(const QualifiedName&, Document*);
+ ~HTMLAnchorElement();
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 1; }
+
+ virtual bool supportsFocus() const;
+ virtual bool isMouseFocusable() const;
+ virtual bool isKeyboardFocusable(KeyboardEvent*) const;
+ virtual bool isFocusable() const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void defaultEventHandler(Event*);
+ virtual void setActive(bool active = true, bool pause = false);
+ virtual void accessKeyAction(bool fullAction);
+ virtual bool isURLAttribute(Attribute*) const;
+
+ virtual bool canStartSelection() const;
+
+ const AtomicString& accessKey() const;
+ void setAccessKey(const AtomicString&);
+
+ const AtomicString& charset() const;
+ void setCharset(const AtomicString&);
+
+ const AtomicString& coords() const;
+ void setCoords(const AtomicString&);
+
+ KURL href() const;
+ void setHref(const AtomicString&);
+
+ const AtomicString& hreflang() const;
+ void setHreflang(const AtomicString&);
+
+ const AtomicString& name() const;
+ void setName(const AtomicString&);
+
+ const AtomicString& rel() const;
+ void setRel(const AtomicString&);
+
+ const AtomicString& rev() const;
+ void setRev(const AtomicString&);
+
+ const AtomicString& shape() const;
+ void setShape(const AtomicString&);
+
+ virtual short tabIndex() const;
+
+ virtual String target() const;
+ void setTarget(const AtomicString&);
+
+ const AtomicString& type() const;
+ void setType(const AtomicString&);
+
+ String hash() const;
+ String host() const;
+ String hostname() const;
+ String pathname() const;
+ String port() const;
+ String protocol() const;
+ String search() const;
+ String text() const;
+
+ String toString() const;
+
+ bool isLiveLink() const;
+ virtual bool willRespondToMouseClickEvents();
+
+private:
+ Element* m_rootEditableElementForSelectionOnMouseDown;
+ bool m_wasShiftKeyDownOnMouseDown;
+};
+
+} // namespace WebCore
+
+#endif // HTMLAnchorElement_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLAppletElement_h
+#define HTMLAppletElement_h
+
+#include "HTMLPlugInElement.h"
+
+namespace WebCore {
+
+class HTMLFormElement;
+class HTMLImageLoader;
+
+class HTMLAppletElement : public HTMLPlugInElement
+{
+public:
+ HTMLAppletElement(const QualifiedName&, Document*);
+ ~HTMLAppletElement();
+
+ virtual int tagPriority() const { return 1; }
+
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ virtual bool rendererIsNeeded(RenderStyle*);
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+ virtual void finishParsingChildren();
+
+ virtual RenderWidget* renderWidgetForJSBindings() const;
+
+ String alt() const;
+ void setAlt(const String&);
+
+ String archive() const;
+ void setArchive(const String&);
+
+ String code() const;
+ void setCode(const String&);
+
+ String codeBase() const;
+ void setCodeBase(const String&);
+
+ String hspace() const;
+ void setHspace(const String&);
+
+ String object() const;
+ void setObject(const String&);
+
+ String vspace() const;
+ void setVspace(const String&);
+
+ void setupApplet() const;
+
+ virtual void insertedIntoDocument();
+ virtual void removedFromDocument();
+
+private:
+ AtomicString m_id;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLAreaElement_h
+#define HTMLAreaElement_h
+
+#include "HTMLAnchorElement.h"
+#include "IntSize.h"
+#include "Path.h"
+
+namespace WebCore {
+
+class HitTestResult;
+
+class HTMLAreaElement : public HTMLAnchorElement {
+public:
+ HTMLAreaElement(const QualifiedName&, Document*);
+ ~HTMLAreaElement();
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
+
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ bool isDefault() const { return m_shape == Default; }
+
+ bool mapMouseEvent(int x, int y, const IntSize&, HitTestResult&);
+
+ virtual IntRect getRect(RenderObject*) const;
+
+ String accessKey() const;
+ void setAccessKey(const String&);
+
+ String alt() const;
+ void setAlt(const String&);
+
+ String coords() const;
+ void setCoords(const String&);
+
+ KURL href() const;
+ void setHref(const String&);
+
+ bool noHref() const;
+ void setNoHref(bool);
+
+ String shape() const;
+ void setShape(const String&);
+
+ virtual bool isFocusable() const;
+
+ virtual String target() const;
+ void setTarget(const String&);
+
+private:
+ enum Shape { Default, Poly, Rect, Circle, Unknown };
+ Path getRegion(const IntSize&) const;
+ Path region;
+ Length* m_coords;
+ int m_coordsLen;
+ IntSize m_lastSize;
+ Shape m_shape;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HTMLAudioElement_h
+#define HTMLAudioElement_h
+
+#if ENABLE(VIDEO)
+
+#include "HTMLMediaElement.h"
+
+namespace WebCore {
+
+class HTMLAudioElement : public HTMLMediaElement
+{
+public:
+ HTMLAudioElement(const QualifiedName&, Document*);
+
+ virtual int tagPriority() const { return 5; }
+};
+
+} //namespace
+
+#endif
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Simon Hausmann <hausmann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef HTMLBRElement_h
+#define HTMLBRElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class String;
+
+class HTMLBRElement : public HTMLElement
+{
+public:
+ HTMLBRElement(const QualifiedName&, Document*);
+ ~HTMLBRElement();
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
+
+ virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
+ virtual void parseMappedAttribute(MappedAttribute *attr);
+
+ virtual RenderObject *createRenderer(RenderArena*, RenderStyle*);
+
+ String clear() const;
+ void setClear(const String&);
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef HTMLBaseElement_h
+#define HTMLBaseElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLBaseElement : public HTMLElement
+{
+public:
+ HTMLBaseElement(const QualifiedName&, Document*);
+ ~HTMLBaseElement();
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
+
+ String href() const { return m_href; }
+ virtual String target() const { return m_target; }
+
+ virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void insertedIntoDocument();
+ virtual void removedFromDocument();
+
+ void process();
+
+ void setHref(const String&);
+ void setTarget(const String&);
+
+protected:
+ String m_href;
+ String m_target;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef HTMLBaseFontElement_h
+#define HTMLBaseFontElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLBaseFontElement : public HTMLElement
+{
+public:
+ HTMLBaseFontElement(const QualifiedName&, Document* doc);
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
+
+ String color() const;
+ void setColor(const String &);
+
+ String face() const;
+ void setFace(const String &);
+
+ int size() const;
+ void setSize(int);
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLBlockquoteElement_h
+#define HTMLBlockquoteElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLBlockquoteElement : public HTMLElement {
+public:
+ HTMLBlockquoteElement(const QualifiedName&, Document*);
+ ~HTMLBlockquoteElement();
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 5; }
+
+ String cite() const;
+ void setCite(const String&);
+};
+
+} // namespace WebCore
+
+#endif // HTMLBlockquoteElement_h
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Simon Hausmann <hausmann@kde.org>
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLBodyElement_h
+#define HTMLBodyElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLBodyElement : public HTMLElement
+{
+public:
+ HTMLBodyElement(const QualifiedName&, Document*);
+ ~HTMLBodyElement();
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 10; }
+
+ virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ virtual void insertedIntoDocument();
+
+ void createLinkDecl();
+
+ virtual bool isURLAttribute(Attribute*) const;
+
+ String aLink() const;
+ void setALink(const String&);
+ String background() const;
+ void setBackground(const String&);
+ String bgColor() const;
+ void setBgColor(const String&);
+ String link() const;
+ void setLink(const String&);
+ String text() const;
+ void setText(const String&);
+ String vLink() const;
+ void setVLink(const String&);
+
+ int scrollLeft() const;
+ void setScrollLeft(int scrollLeft);
+
+ int scrollTop() const;
+ void setScrollTop(int scrollTop);
+
+ int scrollHeight() const;
+ int scrollWidth() const;
+
+ virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
+
+protected:
+ RefPtr<CSSMutableStyleDeclaration> m_linkDecl;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLButtonElement_h
+#define HTMLButtonElement_h
+
+#include "HTMLFormControlElement.h"
+
+namespace WebCore {
+
+class HTMLButtonElement : public HTMLFormControlElement {
+public:
+ HTMLButtonElement(const QualifiedName&, Document*, HTMLFormElement* = 0);
+ virtual ~HTMLButtonElement();
+
+ virtual const AtomicString& type() const;
+
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+
+ virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void defaultEventHandler(Event*);
+ virtual bool appendFormData(FormDataList&, bool);
+
+ virtual bool isEnumeratable() const { return true; }
+
+ virtual bool isSuccessfulSubmitButton() const;
+ virtual bool isActivatedSubmit() const;
+ virtual void setActivatedSubmit(bool flag);
+
+ virtual void accessKeyAction(bool sendToAnyElement);
+
+ virtual bool canStartSelection() const { return false; }
+
+ String accessKey() const;
+ void setAccessKey(const String&);
+
+ String value() const;
+ void setValue(const String&);
+
+ virtual bool willValidate() const { return false; }
+
+ virtual bool willRespondToMouseClickEvents();
+
+private:
+ enum Type { SUBMIT, RESET, BUTTON };
+
+ Type m_type;
+ bool m_activeSubmit;
+};
+
+} // namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2007 Alp Toker <alp@atoker.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HTMLCanvasElement_h
+#define HTMLCanvasElement_h
+
+#include "TransformationMatrix.h"
+#include "FloatRect.h"
+#include "HTMLElement.h"
+#include "IntSize.h"
+
+namespace WebCore {
+
+class CanvasRenderingContext2D;
+typedef CanvasRenderingContext2D CanvasRenderingContext;
+class FloatPoint;
+class FloatRect;
+class FloatSize;
+class GraphicsContext;
+class HTMLCanvasElement;
+class ImageBuffer;
+class IntPoint;
+class IntSize;
+
+class CanvasObserver {
+public:
+ virtual ~CanvasObserver() {};
+
+ virtual void canvasChanged(HTMLCanvasElement* element, const FloatRect& changedRect) = 0;
+ virtual void canvasResized(HTMLCanvasElement* element) = 0;
+};
+
+class HTMLCanvasElement : public HTMLElement {
+public:
+ HTMLCanvasElement(const QualifiedName&, Document*);
+ virtual ~HTMLCanvasElement();
+
+#if ENABLE(DASHBOARD_SUPPORT)
+ virtual HTMLTagStatus endTagRequirement() const;
+ virtual int tagPriority() const;
+#endif
+
+ int width() const { return m_size.width(); }
+ int height() const { return m_size.height(); }
+ void setWidth(int);
+ void setHeight(int);
+
+ String toDataURL(const String& mimeType, ExceptionCode&);
+
+ CanvasRenderingContext* getContext(const String&);
+
+ virtual void parseMappedAttribute(MappedAttribute*);
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+
+ IntSize size() const { return m_size; }
+ void setSize(const IntSize& size)
+ {
+ if (size == m_size)
+ return;
+ m_ignoreReset = true;
+ setWidth(size.width());
+ setHeight(size.height());
+ m_ignoreReset = false;
+ reset();
+ }
+
+ void willDraw(const FloatRect&);
+
+ void paint(GraphicsContext*, const IntRect&);
+
+ GraphicsContext* drawingContext() const;
+
+ ImageBuffer* buffer() const;
+
+ IntRect convertLogicalToDevice(const FloatRect&) const;
+ IntSize convertLogicalToDevice(const FloatSize&) const;
+ IntPoint convertLogicalToDevice(const FloatPoint&) const;
+
+ void setOriginTainted() { m_originClean = false; }
+ bool originClean() const { return m_originClean; }
+
+ static const float MaxCanvasArea;
+
+ void setObserver(CanvasObserver* o) { m_observer = o; }
+
+ TransformationMatrix baseTransform() const;
+private:
+ void createImageBuffer() const;
+ void reset();
+
+ bool m_rendererIsCanvas;
+
+ OwnPtr<CanvasRenderingContext2D> m_2DContext;
+ IntSize m_size;
+ CanvasObserver* m_observer;
+
+ bool m_originClean;
+ bool m_ignoreReset;
+ FloatRect m_dirtyRect;
+
+ // m_createdImageBuffer means we tried to malloc the buffer. We didn't necessarily get it.
+ mutable bool m_createdImageBuffer;
+ mutable OwnPtr<ImageBuffer> m_imageBuffer;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLCollection_h
+#define HTMLCollection_h
+
+#include <wtf/RefCounted.h>
+#include <wtf/Forward.h>
+#include <wtf/HashMap.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class AtomicString;
+class AtomicStringImpl;
+class Element;
+class Node;
+class NodeList;
+class String;
+
+class HTMLCollection : public RefCounted<HTMLCollection> {
+public:
+ enum Type {
+ // unnamed collection types cached in the document
+
+ DocImages, // all <img> elements in the document
+ DocApplets, // all <object> and <applet> elements
+ DocEmbeds, // all <embed> elements
+ DocObjects, // all <object> elements
+ DocForms, // all <form> elements
+ DocLinks, // all <a> _and_ <area> elements with a value for href
+ DocAnchors, // all <a> elements with a value for name
+ DocScripts, // all <script> elements
+
+ DocAll, // "all" elements (IE)
+ NodeChildren, // first-level children (IE)
+
+ // named collection types cached in the document
+
+ WindowNamedItems,
+ DocumentNamedItems,
+
+ // types not cached in the document; these are types that can't be used on a document
+
+ TableTBodies, // all <tbody> elements in this table
+ TSectionRows, // all row elements in this table section
+ TRCells, // all cells in this row
+ SelectOptions,
+ MapAreas,
+
+ Other
+ };
+
+ static const Type FirstUnnamedDocumentCachedType = DocImages;
+ static const unsigned NumUnnamedDocumentCachedTypes = NodeChildren - DocImages + 1;
+
+ static const Type FirstNamedDocumentCachedType = WindowNamedItems;
+ static const unsigned NumNamedDocumentCachedTypes = DocumentNamedItems - WindowNamedItems + 1;
+
+ static PassRefPtr<HTMLCollection> create(PassRefPtr<Node> base, Type);
+ virtual ~HTMLCollection();
+
+ unsigned length() const;
+
+ virtual Node* item(unsigned index) const;
+ virtual Node* nextItem() const;
+
+ virtual Node* namedItem(const AtomicString& name) const;
+ virtual Node* nextNamedItem(const AtomicString& name) const; // In case of multiple items named the same way
+
+ Node* firstItem() const;
+
+ void namedItems(const AtomicString& name, Vector<RefPtr<Node> >&) const;
+
+ PassRefPtr<NodeList> tags(const String&);
+
+ Node* base() const { return m_base.get(); }
+ Type type() const { return m_type; }
+
+ // FIXME: This class name is a bad in two ways. First, "info" is much too vague,
+ // and doesn't convey the job of this class (caching collection state).
+ // Second, since this is a member of HTMLCollection, it doesn't need "collection"
+ // in its name.
+ struct CollectionInfo {
+ CollectionInfo();
+ CollectionInfo(const CollectionInfo&);
+ CollectionInfo& operator=(const CollectionInfo& other)
+ {
+ CollectionInfo tmp(other);
+ swap(tmp);
+ return *this;
+ }
+ ~CollectionInfo();
+
+ void reset();
+ void swap(CollectionInfo&);
+
+ typedef HashMap<AtomicStringImpl*, Vector<Element*>*> NodeCacheMap;
+
+ unsigned version;
+ Element* current;
+ unsigned position;
+ unsigned length;
+ int elementsArrayPosition;
+ NodeCacheMap idCache;
+ NodeCacheMap nameCache;
+ bool hasLength;
+ bool hasNameCache;
+
+ private:
+ static void copyCacheMap(NodeCacheMap&, const NodeCacheMap&);
+ };
+
+protected:
+ HTMLCollection(PassRefPtr<Node> base, Type, CollectionInfo*);
+
+ CollectionInfo* info() const { return m_info; }
+ virtual void resetCollectionInfo() const;
+
+ mutable bool m_idsDone; // for nextNamedItem()
+
+private:
+ HTMLCollection(PassRefPtr<Node> base, Type);
+
+ virtual Element* itemAfter(Element*) const;
+ virtual unsigned calcLength() const;
+ virtual void updateNameCache() const;
+
+ bool checkForNameMatch(Element*, bool checkName, const AtomicString& name) const;
+
+ RefPtr<Node> m_base;
+ Type m_type;
+
+ mutable CollectionInfo* m_info;
+ mutable bool m_ownsInfo;
+};
+
+} // namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLDListElement_h
+#define HTMLDListElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLDListElement : public HTMLElement
+{
+public:
+ HTMLDListElement(const QualifiedName&, Document*);
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 5; }
+
+ bool compact() const;
+ void setCompact(bool);
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLDirectoryElement_h
+#define HTMLDirectoryElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLDirectoryElement : public HTMLElement
+{
+public:
+ HTMLDirectoryElement(const QualifiedName&, Document*);
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 5; }
+
+ bool compact() const;
+ void setCompact(bool);
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLDivElement_h
+#define HTMLDivElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLDivElement : public HTMLElement {
+public:
+ HTMLDivElement(const QualifiedName&, Document*);
+ ~HTMLDivElement();
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 5; }
+
+ virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ String align() const;
+ void setAlign(const String&);
+};
+
+} // namespace WebCore
+
+#endif // HTMLDivElement_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLDocument_h
+#define HTMLDocument_h
+
+#include "CachedResourceClient.h"
+#include "Document.h"
+
+namespace WebCore {
+
+class FrameView;
+class HTMLElement;
+
+class HTMLDocument : public Document, public CachedResourceClient {
+public:
+ static PassRefPtr<HTMLDocument> create(Frame* frame)
+ {
+ return new HTMLDocument(frame);
+ }
+ virtual ~HTMLDocument();
+
+ int width();
+ int height();
+
+ String dir();
+ void setDir(const String&);
+
+ String designMode() const;
+ void setDesignMode(const String&);
+
+ String compatMode() const;
+
+ Element* activeElement();
+ bool hasFocus();
+
+ String bgColor();
+ void setBgColor(const String&);
+ String fgColor();
+ void setFgColor(const String&);
+ String alinkColor();
+ void setAlinkColor(const String&);
+ String linkColor();
+ void setLinkColor(const String&);
+ String vlinkColor();
+ void setVlinkColor(const String&);
+
+ void clear();
+
+ void captureEvents();
+ void releaseEvents();
+
+ virtual bool childAllowed(Node*);
+
+ virtual PassRefPtr<Element> createElement(const AtomicString& tagName, ExceptionCode&);
+
+ void addNamedItem(const AtomicString& name);
+ void removeNamedItem(const AtomicString& name);
+ bool hasNamedItem(AtomicStringImpl* name);
+
+ void addExtraNamedItem(const AtomicString& name);
+ void removeExtraNamedItem(const AtomicString& name);
+ bool hasExtraNamedItem(AtomicStringImpl* name);
+
+ typedef HashMap<AtomicStringImpl*, int> NameCountMap;
+
+protected:
+ HTMLDocument(Frame*);
+
+private:
+ virtual bool isHTMLDocument() const { return true; }
+ virtual Tokenizer* createTokenizer();
+ virtual void determineParseMode();
+
+ NameCountMap m_namedItemCounts;
+ NameCountMap m_extraNamedItemCounts;
+};
+
+inline bool HTMLDocument::hasNamedItem(AtomicStringImpl* name)
+{
+ ASSERT(name);
+ return m_namedItemCounts.contains(name);
+}
+
+inline bool HTMLDocument::hasExtraNamedItem(AtomicStringImpl* name)
+{
+ ASSERT(name);
+ return m_extraNamedItemCounts.contains(name);
+}
+
+} // namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLElement_h
+#define HTMLElement_h
+
+#include "StyledElement.h"
+
+namespace WebCore {
+
+class DocumentFragment;
+class HTMLCollection;
+class HTMLFormElement;
+
+enum HTMLTagStatus { TagStatusOptional, TagStatusRequired, TagStatusForbidden };
+
+class HTMLElement : public StyledElement {
+public:
+ HTMLElement(const QualifiedName& tagName, Document*);
+ virtual ~HTMLElement();
+
+ virtual bool isHTMLElement() const { return true; }
+
+ virtual String nodeName() const;
+
+ virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ virtual PassRefPtr<Node> cloneNode(bool deep);
+
+ PassRefPtr<HTMLCollection> children();
+
+ String id() const;
+ void setId(const String&);
+ virtual String title() const;
+ void setTitle(const String&);
+ String lang() const;
+ void setLang(const String&);
+ String dir() const;
+ void setDir(const String&);
+ String className() const;
+ void setClassName(const String&);
+ virtual short tabIndex() const;
+ void setTabIndex(int);
+
+ String innerHTML() const;
+ String outerHTML() const;
+ PassRefPtr<DocumentFragment> createContextualFragment(const String&);
+ void setInnerHTML(const String&, ExceptionCode&);
+ void setOuterHTML(const String&, ExceptionCode&);
+ void setInnerText(const String&, ExceptionCode&);
+ void setOuterText(const String&, ExceptionCode&);
+
+ Element* insertAdjacentElement(const String& where, Element* newChild, ExceptionCode&);
+ void insertAdjacentHTML(const String& where, const String& html, ExceptionCode&);
+ void insertAdjacentText(const String& where, const String& text, ExceptionCode&);
+
+ virtual bool isFocusable() const;
+ virtual bool isContentEditable() const;
+ virtual bool isContentRichlyEditable() const;
+ virtual String contentEditable() const;
+ virtual void setContentEditable(MappedAttribute*);
+ virtual void setContentEditable(const String&);
+
+ void click();
+
+ virtual void accessKeyAction(bool sendToAnyElement);
+
+ virtual HTMLTagStatus endTagRequirement() const;
+ virtual int tagPriority() const;
+ virtual bool childAllowed(Node* newChild); // Error-checking during parsing that checks the DTD
+
+ // Helper function to check the DTD for a given child node.
+ virtual bool checkDTD(const Node*);
+ static bool inEitherTagList(const Node*);
+ static bool inInlineTagList(const Node*);
+ static bool inBlockTagList(const Node*);
+ static bool isRecognizedTagName(const QualifiedName&);
+
+ virtual bool rendererIsNeeded(RenderStyle*);
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+
+ HTMLFormElement* form() const { return virtualForm(); }
+ HTMLFormElement* findFormAncestor() const;
+
+ static void addHTMLAlignmentToStyledElement(StyledElement*, MappedAttribute*);
+
+ virtual bool willRespondToMouseMoveEvents();
+ virtual bool willRespondToMouseWheelEvents();
+ virtual bool willRespondToMouseClickEvents();
+
+protected:
+ void addHTMLAlignment(MappedAttribute*);
+
+private:
+ virtual HTMLFormElement* virtualForm() const;
+ Node* insertAdjacent(const String& where, Node* newChild, ExceptionCode&);
+};
+
+} // namespace WebCore
+
+#endif // HTMLElement_h
--- /dev/null
+/*
+ * This file is part of the HTML DOM implementation for KDE.
+ *
+ * Copyright (C) 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLElementFactory_h
+#define HTMLElementFactory_h
+
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+class AtomicString;
+class Document;
+class Element;
+class HTMLElement;
+class HTMLFormElement;
+class QualifiedName;
+
+// The idea behind this class is that there will eventually be a mapping from namespace URIs to ElementFactories that can dispense elements.
+// In a compound document world, the generic createElement function (will end up being virtual) will be called.
+class HTMLElementFactory {
+public:
+ PassRefPtr<Element> createElement(const QualifiedName&, Document*, bool createdByParser = true);
+ static PassRefPtr<HTMLElement> createHTMLElement(const QualifiedName& tagName, Document*, HTMLFormElement* = 0, bool createdByParser = true);
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLEmbedElement_h
+#define HTMLEmbedElement_h
+
+#include "HTMLPlugInImageElement.h"
+
+namespace WebCore {
+
+class HTMLEmbedElement : public HTMLPlugInImageElement {
+public:
+ HTMLEmbedElement(const QualifiedName&, Document*);
+ ~HTMLEmbedElement();
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
+
+ virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ virtual void attach();
+ virtual bool canLazyAttach() { return false; }
+ virtual bool rendererIsNeeded(RenderStyle*);
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+ virtual void insertedIntoDocument();
+ virtual void removedFromDocument();
+ virtual void attributeChanged(Attribute*, bool preserveDecls = false);
+
+ virtual bool isURLAttribute(Attribute*) const;
+ virtual const QualifiedName& imageSourceAttributeName() const;
+
+ virtual void updateWidget();
+ void setNeedWidgetUpdate(bool needWidgetUpdate) { m_needWidgetUpdate = needWidgetUpdate; }
+
+ virtual RenderWidget* renderWidgetForJSBindings() const;
+
+ String src() const;
+ void setSrc(const String&);
+
+ String type() const;
+ void setType(const String&);
+
+ virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
+
+private:
+ bool m_needWidgetUpdate;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLFieldSetElement_h
+#define HTMLFieldSetElement_h
+
+#include "HTMLFormControlElement.h"
+
+namespace WebCore {
+ class RenderStyle;
+}
+
+namespace WebCore {
+
+class HTMLFormElement;
+class Document;
+class Node;
+
+class HTMLFieldSetElement : public HTMLFormControlElement {
+public:
+ HTMLFieldSetElement(const QualifiedName&, Document*, HTMLFormElement* = 0);
+ virtual ~HTMLFieldSetElement();
+
+ virtual int tagPriority() const { return 3; }
+ virtual bool checkDTD(const Node* newChild);
+
+ virtual bool isFocusable() const;
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+ virtual const AtomicString& type() const;
+
+ virtual bool willValidate() const { return false; }
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Simon Hausmann <hausmann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef HTMLFontElement_h
+#define HTMLFontElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLFontElement : public HTMLElement {
+public:
+ HTMLFontElement(const QualifiedName&, Document*);
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 1; }
+
+ virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ String color() const;
+ void setColor(const String&);
+
+ String face() const;
+ void setFace(const String&);
+
+ String size() const;
+ void setSize(const String&);
+
+ static bool cssValueFromFontSizeNumber(const String&, int&);
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLFormCollection_h
+#define HTMLFormCollection_h
+
+#include "HTMLCollection.h"
+
+namespace WebCore {
+
+class HTMLFormElement;
+class QualifiedName;
+
+// This class is just a big hack to find form elements even in malformed HTML elements.
+// The famous <table><tr><form><td> problem.
+
+class HTMLFormCollection : public HTMLCollection {
+public:
+ static PassRefPtr<HTMLFormCollection> create(PassRefPtr<HTMLFormElement>);
+
+ virtual ~HTMLFormCollection();
+
+ virtual Node* item(unsigned index) const;
+ virtual Node* nextItem() const;
+
+ virtual Node* namedItem(const AtomicString& name) const;
+ virtual Node* nextNamedItem(const AtomicString& name) const;
+
+private:
+ HTMLFormCollection(PassRefPtr<HTMLFormElement>);
+
+ virtual void updateNameCache() const;
+ virtual unsigned calcLength() const;
+
+ static CollectionInfo* formCollectionInfo(HTMLFormElement*);
+
+ Element* getNamedItem(const QualifiedName& attrName, const AtomicString& name) const;
+ Element* nextNamedItemInternal(const String& name) const;
+
+ Element* getNamedFormItem(const QualifiedName& attrName, const String& name, int duplicateNumber) const;
+
+ mutable int currentPos;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLFormControlElement_h
+#define HTMLFormControlElement_h
+
+#include "FormControlElement.h"
+#include "FormControlElementWithState.h"
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class FormDataList;
+class HTMLFormElement;
+
+class HTMLFormControlElement : public HTMLElement, public FormControlElement {
+public:
+ HTMLFormControlElement(const QualifiedName& tagName, Document*, HTMLFormElement*);
+ virtual ~HTMLFormControlElement();
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 1; }
+
+ HTMLFormElement* form() const { return m_form; }
+
+ virtual const AtomicString& type() const = 0;
+
+ virtual bool isControl() const { return true; }
+ virtual bool isEnabled() const { return !disabled(); }
+
+ virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void attach();
+ virtual void insertedIntoTree(bool deep);
+ virtual void removedFromTree(bool deep);
+
+ virtual void reset() {}
+
+ virtual bool valueMatchesRenderer() const { return m_valueMatchesRenderer; }
+ virtual void setValueMatchesRenderer(bool b = true) { m_valueMatchesRenderer = b; }
+
+ void onChange();
+
+ bool disabled() const;
+ void setDisabled(bool);
+
+ virtual bool supportsFocus() const;
+ virtual bool isFocusable() const;
+ virtual bool isKeyboardFocusable(KeyboardEvent*) const;
+ virtual bool isMouseFocusable() const;
+ virtual bool isEnumeratable() const { return false; }
+
+ virtual bool isReadOnlyControl() const { return m_readOnly; }
+ void setReadOnly(bool);
+
+ // Determines whether or not a control will be automatically focused
+ virtual bool autofocus() const;
+ void setAutofocus(bool);
+
+ virtual void recalcStyle(StyleChange);
+
+ virtual const AtomicString& name() const;
+ void setName(const AtomicString& name);
+
+ virtual bool isFormControlElement() const { return true; }
+ virtual bool isRadioButton() const { return false; }
+
+ /* Override in derived classes to get the encoded name=value pair for submitting.
+ * Return true for a successful control (see HTML4-17.13.2).
+ */
+ virtual bool appendFormData(FormDataList&, bool) { return false; }
+
+ virtual bool isSuccessfulSubmitButton() const { return false; }
+ virtual bool isActivatedSubmit() const { return false; }
+ virtual void setActivatedSubmit(bool) { }
+
+ virtual short tabIndex() const;
+
+ virtual void dispatchFocusEvent();
+ virtual void dispatchBlurEvent();
+
+ bool autocorrect() const;
+ void setAutocorrect(bool);
+
+ bool autocapitalize() const;
+ void setAutocapitalize(bool);
+
+ virtual bool willValidate() const;
+
+ void formDestroyed() { m_form = 0; }
+
+protected:
+ void removeFromForm();
+
+private:
+ virtual HTMLFormElement* virtualForm() const;
+
+ HTMLFormElement* m_form;
+ bool m_disabled;
+ bool m_readOnly;
+ bool m_valueMatchesRenderer;
+};
+
+class HTMLFormControlElementWithState : public HTMLFormControlElement, public FormControlElementWithState {
+public:
+ HTMLFormControlElementWithState(const QualifiedName& tagName, Document*, HTMLFormElement*);
+ virtual ~HTMLFormControlElementWithState();
+
+ virtual bool isFormControlElementWithState() const { return true; }
+
+ virtual FormControlElement* toFormControlElement() { return this; }
+ virtual void finishParsingChildren();
+
+protected:
+ virtual void willMoveToNewOwnerDocument();
+ virtual void didMoveToNewOwnerDocument();
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLFormElement_h
+#define HTMLFormElement_h
+
+#include "FormDataBuilder.h"
+#include "HTMLCollection.h"
+#include "HTMLElement.h"
+
+#include <wtf/OwnPtr.h>
+
+namespace WebCore {
+
+class Event;
+class FormData;
+class HTMLFormControlElement;
+class HTMLImageElement;
+class HTMLInputElement;
+class HTMLFormCollection;
+class TextEncoding;
+
+class HTMLFormElement : public HTMLElement {
+public:
+ HTMLFormElement(const QualifiedName&, Document*);
+ virtual ~HTMLFormElement();
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 3; }
+
+ virtual void attach();
+ virtual void insertedIntoDocument();
+ virtual void removedFromDocument();
+
+ virtual void handleLocalEvents(Event*, bool useCapture);
+
+ PassRefPtr<HTMLCollection> elements();
+ void getNamedElements(const AtomicString&, Vector<RefPtr<Node> >&);
+
+ unsigned length() const;
+ Node* item(unsigned index);
+
+ String enctype() const { return m_formDataBuilder.encodingType(); }
+ void setEnctype(const String&);
+
+ String encoding() const { return m_formDataBuilder.encodingType(); }
+ void setEncoding(const String& value) { setEnctype(value); }
+
+ bool autoComplete() const { return m_autocomplete; }
+
+ bool autocorrect() const;
+ void setAutocorrect(bool);
+
+ bool autocapitalize() const;
+ void setAutocapitalize(bool);
+
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ void registerFormElement(HTMLFormControlElement*);
+ void removeFormElement(HTMLFormControlElement*);
+ void registerImgElement(HTMLImageElement*);
+ void removeImgElement(HTMLImageElement*);
+
+ bool prepareSubmit(Event*);
+ void submit(Event* = 0, bool activateSubmitButton = false, bool lockHistory = false, bool lockBackForwardList = false);
+ void reset();
+
+ // Used to indicate a malformed state to keep from applying the bottom margin of the form.
+ void setMalformed(bool malformed) { m_malformed = malformed; }
+ bool isMalformed() const { return m_malformed; }
+
+ virtual bool isURLAttribute(Attribute*) const;
+
+ void submitClick(Event*);
+ bool formWouldHaveSecureSubmission(const String& url);
+
+ String name() const;
+ void setName(const String&);
+
+ String acceptCharset() const { return m_formDataBuilder.acceptCharset(); }
+ void setAcceptCharset(const String&);
+
+ String action() const;
+ void setAction(const String&);
+
+ String method() const;
+ void setMethod(const String&);
+
+ virtual String target() const;
+ void setTarget(const String&);
+
+ PassRefPtr<HTMLFormControlElement> elementForAlias(const AtomicString&);
+ void addElementAlias(HTMLFormControlElement*, const AtomicString& alias);
+
+ // FIXME: Change this to be private after getting rid of all the clients.
+ Vector<HTMLFormControlElement*> formElements;
+
+ class CheckedRadioButtons {
+ public:
+ void addButton(HTMLFormControlElement*);
+ void removeButton(HTMLFormControlElement*);
+ HTMLInputElement* checkedButtonForGroup(const AtomicString& name) const;
+
+ private:
+ typedef HashMap<AtomicStringImpl*, HTMLInputElement*> NameToInputMap;
+ OwnPtr<NameToInputMap> m_nameToCheckedRadioButtonMap;
+ };
+
+ CheckedRadioButtons& checkedRadioButtons() { return m_checkedRadioButtons; }
+
+ virtual void documentDidBecomeActive();
+
+protected:
+ virtual void willMoveToNewOwnerDocument();
+ virtual void didMoveToNewOwnerDocument();
+
+private:
+ bool isMailtoForm() const;
+ TextEncoding dataEncoding() const;
+ PassRefPtr<FormData> createFormData(const CString& boundary);
+ unsigned formElementIndex(HTMLFormControlElement*);
+
+ friend class HTMLFormCollection;
+
+ typedef HashMap<RefPtr<AtomicStringImpl>, RefPtr<HTMLFormControlElement> > AliasMap;
+
+ FormDataBuilder m_formDataBuilder;
+ AliasMap* m_elementAliases;
+ HTMLCollection::CollectionInfo* collectionInfo;
+
+ CheckedRadioButtons m_checkedRadioButtons;
+
+ Vector<HTMLImageElement*> imgElements;
+ String m_url;
+ String m_target;
+ bool m_autocomplete : 1;
+ bool m_insubmit : 1;
+ bool m_doingsubmit : 1;
+ bool m_inreset : 1;
+ bool m_malformed : 1;
+ AtomicString m_name;
+};
+
+} // namespace WebCore
+
+#endif // HTMLFormElement_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Simon Hausmann <hausmann@kde.org>
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLFrameElement_h
+#define HTMLFrameElement_h
+
+#include "HTMLFrameElementBase.h"
+
+namespace WebCore {
+
+class Document;
+class RenderObject;
+class RenderArena;
+class RenderStyle;
+
+class HTMLFrameElement : public HTMLFrameElementBase
+{
+public:
+ HTMLFrameElement(const QualifiedName&, Document*, bool createdByParser);
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
+
+ virtual void attach();
+
+ virtual bool rendererIsNeeded(RenderStyle*);
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ bool hasFrameBorder() const { return m_frameBorder; }
+
+private:
+ bool m_frameBorder;
+ bool m_frameBorderSet;
+};
+
+} // namespace WebCore
+
+#endif // HTMLFrameElement_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Simon Hausmann <hausmann@kde.org>
+ * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLFrameElementBase_h
+#define HTMLFrameElementBase_h
+
+#include "HTMLFrameOwnerElement.h"
+#include "ScrollTypes.h"
+
+namespace WebCore {
+
+class HTMLFrameElementBase : public HTMLFrameOwnerElement {
+public:
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ virtual void insertedIntoDocument();
+ virtual void removedFromDocument();
+
+ virtual void attach();
+ virtual bool canLazyAttach() { return false; }
+
+ KURL location() const;
+ void setLocation(const String&);
+
+ virtual bool isFocusable() const;
+ virtual void setFocus(bool);
+
+ virtual bool isURLAttribute(Attribute*) const;
+
+ virtual ScrollbarMode scrollingMode() const { return m_scrolling; }
+
+ int getMarginWidth() const { return m_marginWidth; }
+ int getMarginHeight() const { return m_marginHeight; }
+
+ String frameBorder() const;
+ void setFrameBorder(const String&);
+
+ String longDesc() const;
+ void setLongDesc(const String&);
+
+ String marginHeight() const;
+ void setMarginHeight(const String&);
+
+ String marginWidth() const;
+ void setMarginWidth(const String&);
+
+ String name() const;
+ void setName(const String&);
+
+ bool noResize() const { return m_noResize; }
+ void setNoResize(bool);
+
+ String scrolling() const;
+ void setScrolling(const String&);
+
+ KURL src() const;
+ void setSrc(const String&);
+
+ int width() const;
+ int height() const;
+
+ bool viewSourceMode() const { return m_viewSource; }
+
+protected:
+ HTMLFrameElementBase(const QualifiedName&, Document*, bool createdByParser);
+
+ bool isURLAllowed(const AtomicString&) const;
+ void setNameAndOpenURL();
+ void openURL();
+
+ static void setNameAndOpenURLCallback(Node*);
+
+ AtomicString m_URL;
+ AtomicString m_frameName;
+
+ ScrollbarMode m_scrolling;
+
+ int m_marginWidth;
+ int m_marginHeight;
+
+ bool m_noResize;
+ bool m_viewSource;
+
+ bool m_shouldOpenURLAfterAttach;
+};
+
+} // namespace WebCore
+
+#endif // HTMLFrameElementBase_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLFrameOwnerElement_h
+#define HTMLFrameOwnerElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class DOMWindow;
+class Frame;
+class KeyboardEvent;
+
+#if ENABLE(SVG)
+class SVGDocument;
+#endif
+
+class HTMLFrameOwnerElement : public HTMLElement {
+protected:
+ HTMLFrameOwnerElement(const QualifiedName& tagName, Document*, bool createdByParser);
+
+public:
+ virtual ~HTMLFrameOwnerElement();
+
+ virtual void willRemove();
+
+ Frame* contentFrame() const { return m_contentFrame; }
+ DOMWindow* contentWindow() const;
+ Document* contentDocument() const;
+
+ virtual bool isFrameOwnerElement() const { return true; }
+ virtual bool isKeyboardFocusable(KeyboardEvent*) const { return m_contentFrame; }
+
+ bool createdByParser() const { return m_createdByParser; }
+
+ virtual ScrollbarMode scrollingMode() const { return ScrollbarAuto; }
+
+#if ENABLE(SVG)
+ SVGDocument* getSVGDocument(ExceptionCode&) const;
+#endif
+
+private:
+ friend class Frame;
+ Frame* m_contentFrame;
+ bool m_createdByParser;
+};
+
+} // namespace WebCore
+
+#endif // HTMLFrameOwnerElement_h
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Simon Hausmann <hausmann@kde.org>
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLFrameSetElement_h
+#define HTMLFrameSetElement_h
+
+#include "HTMLElement.h"
+#include "Color.h"
+
+namespace WebCore {
+
+
+class HTMLFrameSetElement : public HTMLElement {
+ friend class RenderFrameSet;
+public:
+ HTMLFrameSetElement(const QualifiedName&, Document*);
+ ~HTMLFrameSetElement();
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 10; }
+ virtual bool checkDTD(const Node* newChild);
+
+ virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ virtual void attach();
+ virtual bool rendererIsNeeded(RenderStyle*);
+ virtual RenderObject *createRenderer(RenderArena*, RenderStyle*);
+
+ virtual void defaultEventHandler(Event*);
+
+ bool hasFrameBorder() const { return frameborder; }
+ bool noResize() const { return noresize; }
+
+ int totalRows() const { return m_totalRows; }
+ int totalCols() const { return m_totalCols; }
+ int border() const { return m_border; }
+
+ bool hasBorderColor() const { return m_borderColorSet; }
+
+ virtual void recalcStyle( StyleChange ch );
+
+ String cols() const;
+ void setCols(const String&);
+
+ String rows() const;
+ void setRows(const String&);
+
+ const Length* rowLengths() const { return m_rows; }
+ const Length* colLengths() const { return m_cols; }
+
+private:
+ Length* m_rows;
+ Length* m_cols;
+
+ int m_totalRows;
+ int m_totalCols;
+
+ int m_border;
+ bool m_borderSet;
+
+ bool m_borderColorSet;
+
+ bool frameborder;
+ bool frameBorderSet;
+ bool noresize;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLHRElement_h
+#define HTMLHRElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLHRElement : public HTMLElement {
+public:
+ HTMLHRElement(const QualifiedName&, Document*);
+ ~HTMLHRElement();
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
+
+ virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ String align() const;
+ void setAlign(const String&);
+
+ bool noShade() const;
+ void setNoShade(bool);
+
+ String size() const;
+ void setSize(const String&);
+
+ String width() const;
+ void setWidth(const String&);
+};
+
+} // namespace WebCore
+
+#endif // HTMLHRElement_h
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Simon Hausmann <hausmann@kde.org>
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLHeadElement_h
+#define HTMLHeadElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLHeadElement : public HTMLElement
+{
+public:
+ HTMLHeadElement(const QualifiedName&, Document*);
+ ~HTMLHeadElement();
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
+ virtual int tagPriority() const { return 10; }
+ virtual bool childAllowed(Node* newChild);
+ virtual bool checkDTD(const Node* newChild);
+
+ String profile() const;
+ void setProfile(const String&);
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLHeadingElement_h
+#define HTMLHeadingElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLHeadingElement : public HTMLElement {
+public:
+ HTMLHeadingElement(const QualifiedName&, Document*);
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 5; }
+ virtual bool checkDTD(const Node* newChild);
+
+ String align() const;
+ void setAlign(const String&);
+};
+
+} // namespace WebCore
+
+#endif // HTMLHeadingElement_h
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Simon Hausmann <hausmann@kde.org>
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLHtmlElement_h
+#define HTMLHtmlElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLHtmlElement : public HTMLElement
+{
+public:
+ HTMLHtmlElement(const QualifiedName&, Document*);
+ ~HTMLHtmlElement();
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 11; }
+ virtual bool checkDTD(const Node* newChild);
+
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+ virtual void insertedIntoDocument();
+#endif
+
+ String version() const;
+ void setVersion(const String&);
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Simon Hausmann <hausmann@kde.org>
+ * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLIFrameElement_h
+#define HTMLIFrameElement_h
+
+#include "HTMLFrameElementBase.h"
+
+namespace WebCore {
+
+class HTMLIFrameElement : public HTMLFrameElementBase {
+public:
+ HTMLIFrameElement(const QualifiedName&, Document*, bool createdByParser);
+
+ virtual bool isKeyboardFocusable(KeyboardEvent*) const { return false; }
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 1; }
+
+ virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ virtual void insertedIntoDocument();
+ virtual void removedFromDocument();
+
+ virtual void attach();
+
+ virtual bool rendererIsNeeded(RenderStyle*);
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+
+ virtual bool isURLAttribute(Attribute*) const;
+
+ String align() const;
+ void setAlign(const String&);
+
+ String height() const;
+ void setHeight(const String&);
+
+ String width() const;
+ void setWidth(const String&);
+
+private:
+ AtomicString m_name;
+};
+
+} // namespace WebCore
+
+#endif // HTMLIFrameElement_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLImageElement_h
+#define HTMLImageElement_h
+
+#include "GraphicsTypes.h"
+#include "HTMLElement.h"
+#include "HTMLImageLoader.h"
+
+namespace WebCore {
+
+class HTMLFormElement;
+
+class HTMLImageElement : public HTMLElement {
+ friend class HTMLFormElement;
+public:
+ HTMLImageElement(const QualifiedName&, Document*, HTMLFormElement* = 0);
+ ~HTMLImageElement();
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
+
+ virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ virtual void attach();
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+ virtual void insertedIntoDocument();
+ virtual void removedFromDocument();
+
+ virtual bool canStartSelection() const { return false; }
+
+ int width(bool ignorePendingStylesheets = false) const;
+ int height(bool ignorePendingStylesheets = false) const;
+
+ int naturalWidth() const;
+ int naturalHeight() const;
+
+ bool isServerMap() const { return ismap && usemap.isEmpty(); }
+
+ String altText() const;
+
+ virtual bool isURLAttribute(Attribute*) const;
+
+ CompositeOperator compositeOperator() const { return m_compositeOperator; }
+
+ CachedImage* cachedImage() const { return m_imageLoader.image(); }
+ void setCachedImage(CachedImage* i) { m_imageLoader.setImage(i); };
+
+ void setLoadManually (bool loadManually) { m_imageLoader.setLoadManually(loadManually); }
+
+ String name() const;
+ void setName(const String&);
+
+ String align() const;
+ void setAlign(const String&);
+
+ String alt() const;
+ void setAlt(const String&);
+
+ String border() const;
+ void setBorder(const String&);
+
+ void setHeight(int);
+
+ int hspace() const;
+ void setHspace(int);
+
+ bool isMap() const;
+ void setIsMap(bool);
+
+ KURL longDesc() const;
+ void setLongDesc(const String&);
+
+ KURL lowsrc() const;
+ void setLowsrc(const String&);
+
+ KURL src() const;
+ void setSrc(const String&);
+
+ String useMap() const;
+ void setUseMap(const String&);
+
+ int vspace() const;
+ void setVspace(int);
+
+ void setWidth(int);
+
+ int x() const;
+ int y() const;
+
+ bool complete() const;
+
+ bool haveFiredLoadEvent() const { return m_imageLoader.haveFiredLoadEvent(); }
+
+ virtual bool willRespondToMouseClickEvents();
+
+ virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
+
+private:
+ HTMLImageLoader m_imageLoader;
+ String usemap;
+ bool ismap;
+ HTMLFormElement* m_form;
+ AtomicString m_name;
+ AtomicString m_id;
+ CompositeOperator m_compositeOperator;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2004 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLImageLoader_h
+#define HTMLImageLoader_h
+
+#include "ImageLoader.h"
+
+namespace WebCore {
+
+class HTMLImageLoader : public ImageLoader {
+public:
+ HTMLImageLoader(Element*);
+ virtual ~HTMLImageLoader();
+
+ virtual void dispatchLoadEvent();
+ virtual String sourceURI(const AtomicString&) const;
+
+ virtual void notifyFinished(CachedResource*);
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLInputElement_h
+#define HTMLInputElement_h
+
+#include "HTMLFormControlElement.h"
+#include "InputElement.h"
+#include <wtf/OwnPtr.h>
+
+namespace WebCore {
+
+class FileList;
+class HTMLImageLoader;
+class KURL;
+class Selection;
+
+class HTMLInputElement : public HTMLFormControlElementWithState, public InputElement {
+public:
+ enum InputType {
+ TEXT,
+ PASSWORD,
+ ISINDEX,
+ CHECKBOX,
+ RADIO,
+ SUBMIT,
+ RESET,
+ FILE,
+ HIDDEN,
+ IMAGE,
+ BUTTON,
+ SEARCH,
+ RANGE
+ };
+
+ enum AutoCompleteSetting {
+ Uninitialized,
+ On,
+ Off
+ };
+
+ HTMLInputElement(const QualifiedName&, Document*, HTMLFormElement* = 0);
+ virtual ~HTMLInputElement();
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
+
+ virtual bool isKeyboardFocusable(KeyboardEvent*) const;
+ virtual bool isMouseFocusable() const;
+ virtual bool isEnumeratable() const { return inputType() != IMAGE; }
+ virtual void dispatchFocusEvent();
+ virtual void dispatchBlurEvent();
+ virtual void updateFocusAppearance(bool restorePreviousSelection);
+ virtual void aboutToUnload();
+ virtual bool shouldUseInputMethod() const;
+
+ virtual const AtomicString& name() const;
+
+ bool autoComplete() const;
+
+ // isChecked is used by the rendering tree/CSS while checked() is used by JS to determine checked state
+ virtual bool isChecked() const { return checked() && (inputType() == CHECKBOX || inputType() == RADIO); }
+ virtual bool isIndeterminate() const { return indeterminate(); }
+
+ bool readOnly() const { return isReadOnlyControl(); }
+
+ virtual bool isTextControl() const { return isTextField(); }
+
+ bool isTextButton() const { return m_type == SUBMIT || m_type == RESET || m_type == BUTTON; }
+ virtual bool isRadioButton() const { return m_type == RADIO; }
+ virtual bool isTextField() const { return m_type == TEXT || m_type == PASSWORD || m_type == SEARCH || m_type == ISINDEX; }
+ virtual bool isSearchField() const { return m_type == SEARCH; }
+ virtual bool isInputTypeHidden() const { return m_type == HIDDEN; }
+ virtual bool isPasswordField() const { return m_type == PASSWORD; }
+
+ bool checked() const { return m_checked; }
+ void setChecked(bool, bool sendChangeEvent = false);
+ bool indeterminate() const { return m_indeterminate; }
+ void setIndeterminate(bool);
+ virtual int size() const;
+ virtual const AtomicString& type() const;
+ void setType(const String&);
+
+ virtual String value() const;
+ virtual void setValue(const String&);
+
+ virtual String placeholderValue() const;
+ virtual bool searchEventsShouldBeDispatched() const;
+
+ String valueWithDefault() const;
+
+ virtual void setValueFromRenderer(const String&);
+ void setFileListFromRenderer(const Vector<String>&);
+
+ virtual bool saveState(String& value) const;
+ virtual void restoreState(const String&);
+
+ virtual bool canStartSelection() const;
+
+ bool canHaveSelection() const;
+ int selectionStart() const;
+ int selectionEnd() const;
+ void setSelectionStart(int);
+ void setSelectionEnd(int);
+ virtual void select();
+ void setSelectionRange(int start, int end);
+
+ virtual void accessKeyAction(bool sendToAnyElement);
+
+ virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ virtual void copyNonAttributeProperties(const Element* source);
+
+ virtual void attach();
+ virtual bool rendererIsNeeded(RenderStyle*);
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+ virtual void detach();
+ virtual bool appendFormData(FormDataList&, bool);
+
+ virtual bool isSuccessfulSubmitButton() const;
+ virtual bool isActivatedSubmit() const;
+ virtual void setActivatedSubmit(bool flag);
+
+ InputType inputType() const { return static_cast<InputType>(m_type); }
+ void setInputType(const String&);
+
+ // Report if this input type uses height & width attributes
+ bool respectHeightAndWidthAttrs() const { return inputType() == IMAGE || inputType() == HIDDEN; }
+
+ virtual void reset();
+
+ virtual void* preDispatchEventHandler(Event*);
+ virtual void postDispatchEventHandler(Event*, void* dataFromPreDispatch);
+ virtual void defaultEventHandler(Event*);
+
+ String altText() const;
+
+ virtual bool isURLAttribute(Attribute*) const;
+
+ int maxResults() const { return m_maxResults; }
+
+ String defaultValue() const;
+ void setDefaultValue(const String&);
+
+ bool defaultChecked() const;
+ void setDefaultChecked(bool);
+
+ void setDefaultName(const AtomicString&);
+
+ String accept() const;
+ void setAccept(const String&);
+
+ String accessKey() const;
+ void setAccessKey(const String&);
+
+ String align() const;
+ void setAlign(const String&);
+
+ String alt() const;
+ void setAlt(const String&);
+
+ void setSize(unsigned);
+
+ KURL src() const;
+ void setSrc(const String&);
+
+ int maxLength() const;
+ void setMaxLength(int);
+
+ String useMap() const;
+ void setUseMap(const String&);
+
+ bool isAutofilled() const { return m_autofilled; }
+ void setAutofilled(bool value = true);
+
+ FileList* files();
+
+ virtual void cacheSelection(int start, int end);
+ void addSearchResult();
+ void onSearch();
+
+ Selection selection() const;
+
+ virtual String constrainValue(const String& proposedValue) const;
+
+ virtual void documentDidBecomeActive();
+
+ virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
+
+ virtual bool willRespondToMouseClickEvents();
+ virtual void setDisabled(bool isDisabled) { HTMLFormControlElement::setDisabled(inputType() == FILE || isDisabled); }
+
+ virtual bool willValidate() const;
+
+ virtual bool placeholderShouldBeVisible() const;
+
+protected:
+ virtual void willMoveToNewOwnerDocument();
+ virtual void didMoveToNewOwnerDocument();
+
+private:
+ bool storesValueSeparateFromAttribute() const;
+
+ bool needsActivationCallback();
+ void registerForActivationCallbackIfNeeded();
+ void unregisterForActivationCallbackIfNeeded();
+
+ InputElementData m_data;
+ int m_xPos;
+ int m_yPos;
+ short m_maxResults;
+ OwnPtr<HTMLImageLoader> m_imageLoader;
+ RefPtr<FileList> m_fileList;
+ unsigned m_type : 4; // InputType
+ bool m_checked : 1;
+ bool m_defaultChecked : 1;
+ bool m_useDefaultChecked : 1;
+ bool m_indeterminate : 1;
+ bool m_haveType : 1;
+ bool m_activeSubmit : 1;
+ unsigned m_autocomplete : 2; // AutoCompleteSetting
+ bool m_autofilled : 1;
+ bool m_inited : 1;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HTMLInterchange_h
+#define HTMLInterchange_h
+
+namespace WebCore {
+
+class String;
+class Text;
+
+#define AppleInterchangeNewline "Apple-interchange-newline"
+#define AppleConvertedSpace "Apple-converted-space"
+#define ApplePasteAsQuotation "Apple-paste-as-quotation"
+#define AppleStyleSpanClass "Apple-style-span"
+#define AppleTabSpanClass "Apple-tab-span"
+
+enum EAnnotateForInterchange { DoNotAnnotateForInterchange, AnnotateForInterchange };
+
+String convertHTMLTextToInterchangeFormat(const String&, const Text*);
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef HTMLIsIndexElement_h
+#define HTMLIsIndexElement_h
+
+#include "HTMLInputElement.h"
+
+namespace WebCore {
+
+class HTMLIsIndexElement : public HTMLInputElement
+{
+public:
+ HTMLIsIndexElement(const QualifiedName&, Document *doc, HTMLFormElement *f = 0);
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
+
+ virtual void parseMappedAttribute(MappedAttribute *attr);
+
+ String prompt() const;
+ void setPrompt(const String &);
+
+protected:
+ String m_prompt;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLKeygenElement_h
+#define HTMLKeygenElement_h
+
+#include "HTMLSelectElement.h"
+
+namespace WebCore {
+
+class HTMLKeygenElement : public HTMLSelectElement {
+public:
+ HTMLKeygenElement(const QualifiedName&, Document*, HTMLFormElement* = 0);
+
+ virtual int tagPriority() const { return 0; }
+ virtual const AtomicString& type() const;
+ virtual bool isEnumeratable() const { return false; }
+ virtual void parseMappedAttribute(MappedAttribute*);
+ virtual bool appendFormData(FormDataList&, bool);
+
+private:
+ AtomicString m_challenge;
+ AtomicString m_keyType;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLLIElement_h
+#define HTMLLIElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLLIElement : public HTMLElement {
+public:
+ HTMLLIElement(const QualifiedName&, Document*);
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
+ virtual int tagPriority() const { return 3; }
+
+ virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ virtual void attach();
+
+ String type() const;
+ void setType(const String&);
+
+ int value() const;
+ void setValue(int);
+
+private:
+ int m_requestedValue;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLLabelElement_h
+#define HTMLLabelElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLLabelElement : public HTMLElement {
+public:
+ HTMLLabelElement(const QualifiedName&, Document*);
+ virtual ~HTMLLabelElement();
+
+ virtual int tagPriority() const { return 5; }
+
+ virtual bool isFocusable() const;
+
+ virtual void accessKeyAction(bool sendToAnyElement);
+
+ // Overridden to update the hover/active state of the corresponding control.
+ virtual void setActive(bool = true, bool pause = false);
+ virtual void setHovered(bool = true);
+
+ // Overridden to either click() or focus() the corresponding control.
+ virtual void defaultEventHandler(Event*);
+
+ HTMLElement* correspondingControl();
+
+ String accessKey() const;
+ void setAccessKey(const String&);
+
+ String htmlFor() const;
+ void setHtmlFor(const String&);
+
+ void focus(bool restorePreviousSelection = true);
+
+ private:
+ String m_formElementID;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLLegendElement_h
+#define HTMLLegendElement_h
+
+#include "HTMLFormControlElement.h"
+
+namespace WebCore {
+
+class HTMLLegendElement : public HTMLFormControlElement {
+public:
+ HTMLLegendElement(const QualifiedName&, Document*, HTMLFormElement* = 0);
+ virtual ~HTMLLegendElement();
+
+ virtual bool isFocusable() const;
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+ virtual const AtomicString& type() const;
+ virtual void accessKeyAction(bool sendToAnyElement);
+
+ /**
+ * The first form element in the legend's fieldset
+ */
+ Element* formElement();
+
+ String accessKey() const;
+ void setAccessKey(const String &);
+
+ String align() const;
+ void setAlign(const String &);
+
+ void focus(bool restorePreviousSelection = true);
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLLinkElement_h
+#define HTMLLinkElement_h
+
+#include "CSSStyleSheet.h"
+#include "CachedResourceClient.h"
+#include "CachedResourceHandle.h"
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class CachedCSSStyleSheet;
+class KURL;
+
+class HTMLLinkElement : public HTMLElement, public CachedResourceClient {
+public:
+ HTMLLinkElement(const QualifiedName&, Document*, bool createdByParser);
+ ~HTMLLinkElement();
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
+
+ bool disabled() const;
+ void setDisabled(bool);
+
+ String charset() const;
+ void setCharset(const String&);
+
+ KURL href() const;
+ void setHref(const String&);
+
+ String hreflang() const;
+ void setHreflang(const String&);
+
+ String media() const;
+ void setMedia(const String&);
+
+ String rel() const;
+ void setRel(const String&);
+
+ String rev() const;
+ void setRev(const String&);
+
+ virtual String target() const;
+ void setTarget(const String&);
+
+ String type() const;
+ void setType(const String&);
+
+ StyleSheet* sheet() const;
+
+ // overload from HTMLElement
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ void process();
+
+ virtual void insertedIntoDocument();
+ virtual void removedFromDocument();
+
+ // from CachedResourceClient
+ virtual void setCSSStyleSheet(const String &url, const String& charset, const CachedCSSStyleSheet* sheet);
+ bool isLoading() const;
+ virtual bool sheetLoaded();
+
+ bool isAlternate() const { return m_disabledState == 0 && m_alternate; }
+ bool isDisabled() const { return m_disabledState == 2; }
+ bool isEnabledViaScript() const { return m_disabledState == 1; }
+ bool isIcon() const { return m_isIcon; }
+
+ int disabledState() { return m_disabledState; }
+ void setDisabledState(bool _disabled);
+
+ virtual bool isURLAttribute(Attribute*) const;
+
+ static void tokenizeRelAttribute(const AtomicString& value, bool& stylesheet, bool& alternate, bool& icon, bool& dnsPrefetch);
+
+ virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
+
+ virtual void finishParsingChildren();
+
+protected:
+ CachedResourceHandle<CachedCSSStyleSheet> m_cachedSheet;
+ RefPtr<CSSStyleSheet> m_sheet;
+ KURL m_url;
+ String m_type;
+ String m_media;
+ int m_disabledState; // 0=unset(default), 1=enabled via script, 2=disabled
+ bool m_loading;
+ bool m_alternate;
+ bool m_isStyleSheet;
+ bool m_isIcon;
+ bool m_isDNSPrefetch;
+ bool m_createdByParser;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2004 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLMapElement_h
+#define HTMLMapElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class IntSize;
+class HitTestResult;
+
+class HTMLMapElement : public HTMLElement {
+public:
+ HTMLMapElement(const QualifiedName&, Document*);
+ ~HTMLMapElement();
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 1; }
+ virtual bool checkDTD(const Node*);
+
+ const AtomicString& getName() const { return m_name; }
+
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ bool mapMouseEvent(int x, int y, const IntSize&, HitTestResult&);
+
+ PassRefPtr<HTMLCollection> areas();
+
+ String name() const;
+ void setName(const String&);
+
+private:
+ AtomicString m_name;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLMarqueeElement_h
+#define HTMLMarqueeElement_h
+
+#include "ActiveDOMObject.h"
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLMarqueeElement : public HTMLElement, private ActiveDOMObject {
+public:
+ HTMLMarqueeElement(const QualifiedName&, Document*);
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 3; }
+
+ virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ int minimumDelay() const { return m_minimumDelay; }
+
+ // DOM Functions
+
+ void start();
+ void stop();
+
+private:
+ // ActiveDOMObject
+ virtual bool canSuspend() const;
+ virtual void suspend();
+ virtual void resume();
+
+ int m_minimumDelay;
+};
+
+} // namespace WebCore
+
+#endif // HTMLMarqueeElement_h
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HTMLMediaElement_h
+#define HTMLMediaElement_h
+
+#if ENABLE(VIDEO)
+
+#include "HTMLElement.h"
+#include "MediaPlayer.h"
+#include "Timer.h"
+
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+#include "MediaPlayerProxy.h"
+#endif
+
+namespace WebCore {
+
+class Event;
+class MediaError;
+class KURL;
+class TimeRanges;
+
+class HTMLMediaElement : public HTMLElement, public MediaPlayerClient {
+public:
+ HTMLMediaElement(const QualifiedName&, Document*);
+ virtual ~HTMLMediaElement();
+
+ bool checkDTD(const Node* newChild);
+
+ void attributeChanged(Attribute*, bool preserveDecls);
+ void parseMappedAttribute(MappedAttribute *);
+
+ virtual bool rendererIsNeeded(RenderStyle*);
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+ virtual void insertedIntoDocument();
+ virtual void removedFromDocument();
+ virtual void attach();
+ virtual void recalcStyle(StyleChange);
+
+ MediaPlayer* player() const { return m_player.get(); }
+
+ virtual bool isVideo() const { return false; }
+ virtual bool hasVideo() const { return false; }
+
+ void scheduleLoad();
+
+ virtual void defaultEventHandler(Event*);
+
+ // Pauses playback without changing any states or generating events
+ void setPausedInternal(bool);
+
+ bool inActiveDocument() const { return m_inActiveDocument; }
+
+// DOM API
+// error state
+ PassRefPtr<MediaError> error() const;
+
+// network state
+ KURL src() const;
+ void setSrc(const String&);
+ String currentSrc() const;
+
+ enum NetworkState { NETWORK_EMPTY, NETWORK_IDLE, NETWORK_LOADING, NETWORK_LOADED, NETWORK_NO_SOURCE };
+ NetworkState networkState() const;
+ bool autobuffer() const;
+ void setAutobuffer(bool);
+
+ PassRefPtr<TimeRanges> buffered() const;
+ void load(ExceptionCode&);
+ String canPlayType(const String& mimeType) const;
+
+// ready state
+ enum ReadyState { HAVE_NOTHING, HAVE_METADATA, HAVE_CURRENT_DATA, HAVE_FUTURE_DATA, HAVE_ENOUGH_DATA };
+ ReadyState readyState() const;
+ bool seeking() const;
+
+// playback state
+ float currentTime() const;
+ void setCurrentTime(float, ExceptionCode&);
+ float duration() const;
+ bool paused() const;
+ float defaultPlaybackRate() const;
+ void setDefaultPlaybackRate(float);
+ float playbackRate() const;
+ void setPlaybackRate(float);
+ PassRefPtr<TimeRanges> played() const;
+ PassRefPtr<TimeRanges> seekable() const;
+ bool ended() const;
+ bool autoplay() const;
+ void setAutoplay(bool b);
+ bool loop() const;
+ void setLoop(bool b);
+ void play();
+ void pause();
+
+// controls
+ bool controls() const;
+ void setControls(bool);
+ float volume() const;
+ void setVolume(float, ExceptionCode&);
+ bool muted() const;
+ void setMuted(bool);
+ void togglePlayState();
+ void beginScrubbing();
+ void endScrubbing();
+
+ bool canPlay() const;
+
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+ void setNeedWidgetUpdate(bool needWidgetUpdate) { m_needWidgetUpdate = needWidgetUpdate; }
+ void deliverNotification(MediaPlayerProxyNotificationType notification);
+ void setMediaPlayerProxy(WebMediaPlayerProxy* proxy);
+ String initialURL();
+ virtual void finishParsingChildren();
+#endif
+
+protected:
+ float getTimeOffsetAttribute(const QualifiedName&, float valueOnError) const;
+ void setTimeOffsetAttribute(const QualifiedName&, float value);
+
+ virtual void documentWillBecomeInactive();
+ virtual void documentDidBecomeActive();
+ virtual void mediaVolumeDidChange();
+
+ void setReadyState(MediaPlayer::ReadyState);
+ void setNetworkState(MediaPlayer::NetworkState);
+
+private: // MediaPlayerObserver
+ virtual void mediaPlayerNetworkStateChanged(MediaPlayer*);
+ virtual void mediaPlayerReadyStateChanged(MediaPlayer*);
+ virtual void mediaPlayerTimeChanged(MediaPlayer*);
+ virtual void mediaPlayerRepaint(MediaPlayer*);
+ virtual void mediaPlayerVolumeChanged(MediaPlayer*);
+ virtual void mediaPlayerDurationChanged(MediaPlayer*);
+ virtual void mediaPlayerRateChanged(MediaPlayer*);
+ virtual void mediaPlayerSizeChanged(MediaPlayer*);
+
+private:
+ void loadTimerFired(Timer<HTMLMediaElement>*);
+ void asyncEventTimerFired(Timer<HTMLMediaElement>*);
+ void progressEventTimerFired(Timer<HTMLMediaElement>*);
+ void playbackProgressTimerFired(Timer<HTMLMediaElement>*);
+ void startPlaybackProgressTimer();
+ void startProgressEventTimer();
+ void stopPeriodicTimers();
+
+ void seek(float time, ExceptionCode&);
+ void checkIfSeekNeeded();
+
+ void scheduleTimeupdateEvent(bool periodicEvent);
+ void scheduleProgressEvent(const AtomicString& eventName);
+ void scheduleEvent(const AtomicString& eventName);
+ void enqueueEvent(RefPtr<Event> event);
+
+ // loading
+ void selectMediaResource();
+ void loadResource(String url, ContentType& contentType);
+ void loadNextSourceChild();
+ void userCancelledLoad();
+ String nextSourceChild(ContentType* contentType = 0);
+ bool havePotentialSourceChild();
+ void noneSupported();
+ void mediaEngineError(PassRefPtr<MediaError> err);
+
+ // These "internal" functions do not check user gesture restrictions.
+ void loadInternal();
+ void playInternal();
+ void pauseInternal();
+
+ bool processingUserGesture() const;
+ bool processingMediaPlayerCallback() const { return m_processingMediaPlayerCallback > 0; }
+ void beginProcessingMediaPlayerCallback() { ++m_processingMediaPlayerCallback; }
+ void endProcessingMediaPlayerCallback() { ASSERT(m_processingMediaPlayerCallback); --m_processingMediaPlayerCallback; }
+
+ void updateVolume();
+ void updatePlayState();
+ bool potentiallyPlaying() const;
+ bool endedPlayback() const;
+ bool stoppedDueToErrors() const;
+ bool pausedForUserInteraction() const;
+
+ // Restrictions to change default behaviors. This is a effectively a compile time choice at the moment
+ // because there are no accessor methods.
+ enum BehaviorRestrictions
+ {
+ NoRestrictions = 0,
+ RequireUserGestureForLoadRestriction = 1 << 0,
+ RequireUserGestureForRateChangeRestriction = 1 << 1,
+ };
+
+protected:
+ Timer<HTMLMediaElement> m_loadTimer;
+ Timer<HTMLMediaElement> m_asyncEventTimer;
+ Timer<HTMLMediaElement> m_progressEventTimer;
+ Timer<HTMLMediaElement> m_playbackProgressTimer;
+ Vector<RefPtr<Event> > m_pendingEvents;
+
+ float m_playbackRate;
+ float m_defaultPlaybackRate;
+ NetworkState m_networkState;
+ ReadyState m_readyState;
+ String m_currentSrc;
+
+ RefPtr<MediaError> m_error;
+
+ float m_volume;
+ float m_currentTimeDuringSeek;
+
+ unsigned m_previousProgress;
+ double m_previousProgressTime;
+
+ // the last time a timeupdate event was sent (wall clock)
+ double m_lastTimeUpdateEventWallTime;
+
+ // the last time a timeupdate event was sent in movie time
+ float m_lastTimeUpdateEventMovieTime;
+
+ // loading state
+ enum LoadState { WaitingForSource, LoadingFromSrcAttr, LoadingFromSourceElement };
+ LoadState m_loadState;
+ Node *m_currentSourceNode;
+
+ OwnPtr<MediaPlayer> m_player;
+
+ BehaviorRestrictions m_restrictions;
+
+ // counter incremented while processing a callback from the media player, so we can avoid
+ // calling the media engine recursively
+ int m_processingMediaPlayerCallback;
+
+ bool m_processingLoad : 1;
+ bool m_delayingTheLoadEvent : 1;
+ bool m_haveFiredLoadedData : 1;
+ bool m_inActiveDocument : 1;
+ bool m_autoplaying : 1;
+ bool m_muted : 1;
+ bool m_paused : 1;
+ bool m_seeking : 1;
+
+ // data has not been loaded since sending a "stalled" event
+ bool m_sentStalledEvent : 1;
+
+ // time has not changed since sending an "ended" event
+ bool m_sentEndEvent : 1;
+
+ bool m_pausedInternal : 1;
+
+ // Not all media engines provide enough information about a file to be able to
+ // support progress events so setting m_sendProgressEvents disables them
+ bool m_sendProgressEvents : 1;
+
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+ bool m_needWidgetUpdate : 1;
+#endif
+
+ bool m_inFullScreen : 1;
+ bool m_requestingPlay : 1;
+};
+
+} //namespace
+
+#endif
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLMenuElement_h
+#define HTMLMenuElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLMenuElement : public HTMLElement
+{
+public:
+ HTMLMenuElement(const QualifiedName&, Document*);
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 5; }
+
+ bool compact() const;
+ void setCompact(bool);
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef HTMLMetaElement_h
+#define HTMLMetaElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLMetaElement : public HTMLElement
+{
+public:
+ HTMLMetaElement(const QualifiedName&, Document*);
+ ~HTMLMetaElement();
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
+
+ virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void insertedIntoDocument();
+
+ void process();
+
+ String content() const;
+ void setContent(const String&);
+
+ String httpEquiv() const;
+ void setHttpEquiv(const String&);
+
+ String name() const;
+ void setName(const String&);
+
+ String scheme() const;
+ void setScheme(const String&);
+
+protected:
+ String m_equiv;
+ String m_content;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Simon Hausmann <hausmann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef HTMLModElement_h
+#define HTMLModElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class String;
+
+class HTMLModElement : public HTMLElement
+{
+public:
+ HTMLModElement(const QualifiedName&, Document*);
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 1; }
+
+ String cite() const;
+ void setCite(const String&);
+
+ String dateTime() const;
+ void setDateTime(const String&);
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLNameCollection_h
+#define HTMLNameCollection_h
+
+#include "HTMLCollection.h"
+#include "PlatformString.h"
+
+namespace WebCore {
+
+class Document;
+
+class HTMLNameCollection : public HTMLCollection {
+public:
+ static PassRefPtr<HTMLNameCollection> create(PassRefPtr<Document> document, Type type, const String& name)
+ {
+ return adoptRef(new HTMLNameCollection(document, type, name));
+ }
+
+private:
+ HTMLNameCollection(PassRefPtr<Document>, Type, const String& name);
+
+ virtual Element* itemAfter(Element*) const;
+
+ String m_name;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLOListElement_h
+#define HTMLOListElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLOListElement : public HTMLElement
+{
+public:
+ HTMLOListElement(const QualifiedName&, Document*);
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 5; }
+
+ virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ bool compact() const;
+ void setCompact(bool);
+
+ int start() const { return m_start; }
+ void setStart(int);
+
+ String type() const;
+ void setType(const String&);
+
+private:
+ int m_start;
+};
+
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLObjectElement_h
+#define HTMLObjectElement_h
+
+#include "HTMLPlugInImageElement.h"
+
+namespace WebCore {
+
+class KURL;
+
+class HTMLObjectElement : public HTMLPlugInImageElement {
+public:
+ HTMLObjectElement(const QualifiedName&, Document*, bool createdByParser);
+ ~HTMLObjectElement();
+
+ virtual int tagPriority() const { return 5; }
+
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ virtual void attach();
+ virtual bool canLazyAttach() { return false; }
+ virtual bool rendererIsNeeded(RenderStyle*);
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+ virtual void finishParsingChildren();
+ virtual void detach();
+ virtual void insertedIntoDocument();
+ virtual void removedFromDocument();
+
+ virtual void recalcStyle(StyleChange);
+ virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
+
+ virtual bool isURLAttribute(Attribute*) const;
+ virtual const QualifiedName& imageSourceAttributeName() const;
+
+ virtual void updateWidget();
+ void setNeedWidgetUpdate(bool needWidgetUpdate) { m_needWidgetUpdate = needWidgetUpdate; }
+
+ void renderFallbackContent();
+
+ virtual RenderWidget* renderWidgetForJSBindings() const;
+
+ String archive() const;
+ void setArchive(const String&);
+
+ String border() const;
+ void setBorder(const String&);
+
+ String code() const;
+ void setCode(const String&);
+
+ String codeBase() const;
+ void setCodeBase(const String&);
+
+ String codeType() const;
+ void setCodeType(const String&);
+
+ KURL data() const;
+ void setData(const String&);
+
+ bool declare() const;
+ void setDeclare(bool);
+
+ int hspace() const;
+ void setHspace(int);
+
+ String standby() const;
+ void setStandby(const String&);
+
+ String type() const;
+ void setType(const String&);
+
+ String useMap() const;
+ void setUseMap(const String&);
+
+ int vspace() const;
+ void setVspace(int);
+
+ bool isDocNamedItem() const { return m_docNamedItem; }
+
+ const String& classId() const { return m_classId; }
+
+ bool containsJavaApplet() const;
+
+ virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
+
+private:
+ void updateDocNamedItem();
+
+ AtomicString m_id;
+ String m_classId;
+ bool m_docNamedItem : 1;
+ bool m_needWidgetUpdate : 1;
+ bool m_useFallbackContent : 1;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLOptGroupElement_h
+#define HTMLOptGroupElement_h
+
+#include "HTMLFormControlElement.h"
+#include "OptionGroupElement.h"
+
+namespace WebCore {
+
+class HTMLSelectElement;
+
+class HTMLOptGroupElement : public HTMLFormControlElement, public OptionGroupElement {
+public:
+ HTMLOptGroupElement(const QualifiedName&, Document*, HTMLFormElement* = 0);
+
+ virtual bool checkDTD(const Node*);
+ virtual const AtomicString& type() const;
+ virtual bool isFocusable() const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+ virtual bool rendererIsNeeded(RenderStyle*) { return false; }
+ virtual void attach();
+ virtual void detach();
+ virtual void setRenderStyle(PassRefPtr<RenderStyle>);
+
+ virtual bool insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionCode&, bool shouldLazyAttach = false);
+ virtual bool replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionCode&, bool shouldLazyAttach = false);
+ virtual bool removeChild(Node* child, ExceptionCode&);
+ virtual bool appendChild(PassRefPtr<Node> newChild, ExceptionCode&, bool shouldLazyAttach = false);
+ virtual bool removeChildren();
+ virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
+
+ String label() const;
+ void setLabel(const String&);
+
+ virtual String groupLabelText() const;
+ HTMLSelectElement* ownerSelectElement() const;
+ virtual void accessKeyAction(bool sendToAnyElement);
+
+private:
+ virtual RenderStyle* nonRendererRenderStyle() const;
+
+ void recalcSelectOptions();
+
+ RefPtr<RenderStyle> m_style;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef HTMLOptionElement_h
+#define HTMLOptionElement_h
+
+#include "HTMLFormControlElement.h"
+#include "OptionElement.h"
+
+namespace WebCore {
+
+class HTMLSelectElement;
+class HTMLFormElement;
+class MappedAttribute;
+
+class HTMLOptionElement : public HTMLFormControlElement, public OptionElement {
+ friend class HTMLSelectElement;
+ friend class RenderMenuList;
+
+public:
+ HTMLOptionElement(const QualifiedName&, Document*, HTMLFormElement* = 0);
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
+ virtual int tagPriority() const { return 2; }
+ virtual bool checkDTD(const Node* newChild);
+ virtual bool isFocusable() const;
+ virtual bool rendererIsNeeded(RenderStyle*) { return false; }
+ virtual void attach();
+ virtual void detach();
+ virtual void setRenderStyle(PassRefPtr<RenderStyle>);
+
+ virtual const AtomicString& type() const;
+
+ String text() const;
+ void setText(const String&, ExceptionCode&);
+
+ int index() const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ virtual String value() const;
+ void setValue(const String&);
+
+ virtual bool selected() const;
+ void setSelected(bool);
+ virtual void setSelectedState(bool);
+
+ HTMLSelectElement* ownerSelectElement() const;
+
+ virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
+
+ bool defaultSelected() const;
+ void setDefaultSelected(bool);
+
+ String label() const;
+ void setLabel(const String&);
+
+ virtual String textIndentedToRespectGroupLabel() const;
+
+ virtual bool disabled() const;
+
+ virtual void insertedIntoDocument();
+ virtual void accessKeyAction(bool);
+
+private:
+ virtual RenderStyle* nonRendererRenderStyle() const;
+
+ OptionElementData m_data;
+ RefPtr<RenderStyle> m_style;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLOptionsCollection_h
+#define HTMLOptionsCollection_h
+
+#include "HTMLCollection.h"
+
+namespace WebCore {
+
+class HTMLOptionElement;
+class HTMLSelectElement;
+
+typedef int ExceptionCode;
+
+class HTMLOptionsCollection : public HTMLCollection {
+public:
+ static PassRefPtr<HTMLOptionsCollection> create(PassRefPtr<HTMLSelectElement>);
+
+ void add(PassRefPtr<HTMLOptionElement>, ExceptionCode&);
+ void add(PassRefPtr<HTMLOptionElement>, int index, ExceptionCode&);
+ void remove(int index);
+
+ int selectedIndex() const;
+ void setSelectedIndex(int);
+
+ void setLength(unsigned, ExceptionCode&);
+
+private:
+ HTMLOptionsCollection(PassRefPtr<HTMLSelectElement>);
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLParagraphElement_h
+#define HTMLParagraphElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLParagraphElement : public HTMLElement {
+public:
+ HTMLParagraphElement(const QualifiedName&, Document*);
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 3; }
+ virtual bool checkDTD(const Node* newChild);
+
+ virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ String align() const;
+ void setAlign(const String&);
+};
+
+} // namespace WebCore
+
+#endif // HTMLParagraphElement_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLParamElement_h
+#define HTMLParamElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLParamElement : public HTMLElement
+{
+ friend class HTMLAppletElement;
+public:
+ HTMLParamElement(const QualifiedName&, Document*);
+ ~HTMLParamElement();
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
+
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ virtual bool isURLAttribute(Attribute*) const;
+
+ String name() const { return m_name; }
+ void setName(const String&);
+
+ String type() const;
+ void setType(const String&);
+
+ String value() const { return m_value; }
+ void setValue(const String&);
+
+ String valueType() const;
+ void setValueType(const String&);
+
+ virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
+
+ protected:
+ AtomicString m_name;
+ AtomicString m_value;
+};
+
+
+}
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 1997 Martin Jones (mjones@kde.org)
+ (C) 1997 Torben Weis (weis@kde.org)
+ (C) 1998 Waldo Bastian (bastian@kde.org)
+ (C) 1999 Lars Knoll (knoll@kde.org)
+ Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef HTMLParser_h
+#define HTMLParser_h
+
+#include "QualifiedName.h"
+#include <wtf/Forward.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/RefPtr.h>
+#include "HTMLParserErrorCodes.h"
+#include "Text.h"
+
+namespace WebCore {
+
+class DoctypeToken;
+class Document;
+class DocumentFragment;
+class HTMLDocument;
+class HTMLFormElement;
+class HTMLHeadElement;
+class HTMLMapElement;
+class HTMLParserQuirks;
+class Node;
+
+struct HTMLStackElem;
+struct Token;
+
+/**
+ * The parser for HTML. It receives a stream of tokens from the HTMLTokenizer, and
+ * builds up the Document structure from it.
+ */
+class HTMLParser : Noncopyable {
+public:
+ HTMLParser(HTMLDocument*, bool reportErrors);
+ HTMLParser(DocumentFragment*);
+ virtual ~HTMLParser();
+
+ /**
+ * parses one token delivered by the tokenizer
+ */
+ PassRefPtr<Node> parseToken(Token*);
+
+ // Parses a doctype token.
+ void parseDoctypeToken(DoctypeToken*);
+
+ /**
+ * tokenizer says it's not going to be sending us any more tokens
+ */
+ void finished();
+
+ /**
+ * resets the parser
+ */
+ void reset();
+
+ bool skipMode() const { return !m_skipModeTag.isNull(); }
+ bool isHandlingResidualStyleAcrossBlocks() const { return m_handlingResidualStyleAcrossBlocks; }
+
+private:
+ void setCurrent(Node*);
+ void derefCurrent();
+ void setSkipMode(const QualifiedName& qName) { m_skipModeTag = qName.localName(); }
+
+ PassRefPtr<Node> getNode(Token*);
+ bool bodyCreateErrorCheck(Token*, RefPtr<Node>&);
+ bool canvasCreateErrorCheck(Token*, RefPtr<Node>&);
+ bool commentCreateErrorCheck(Token*, RefPtr<Node>&);
+ bool ddCreateErrorCheck(Token*, RefPtr<Node>&);
+ bool dtCreateErrorCheck(Token*, RefPtr<Node>&);
+ bool formCreateErrorCheck(Token*, RefPtr<Node>&);
+ bool framesetCreateErrorCheck(Token*, RefPtr<Node>&);
+ bool headCreateErrorCheck(Token*, RefPtr<Node>&);
+ bool iframeCreateErrorCheck(Token*, RefPtr<Node>&);
+ bool isindexCreateErrorCheck(Token*, RefPtr<Node>&);
+ bool mapCreateErrorCheck(Token*, RefPtr<Node>&);
+ bool nestedCreateErrorCheck(Token*, RefPtr<Node>&);
+ bool nestedPCloserCreateErrorCheck(Token*, RefPtr<Node>&);
+ bool nestedStyleCreateErrorCheck(Token*, RefPtr<Node>&);
+ bool noembedCreateErrorCheck(Token*, RefPtr<Node>&);
+ bool noframesCreateErrorCheck(Token*, RefPtr<Node>&);
+ bool nolayerCreateErrorCheck(Token*, RefPtr<Node>&);
+ bool noscriptCreateErrorCheck(Token*, RefPtr<Node>&);
+ bool pCloserCreateErrorCheck(Token*, RefPtr<Node>&);
+ bool pCloserStrictCreateErrorCheck(Token*, RefPtr<Node>&);
+ bool selectCreateErrorCheck(Token*, RefPtr<Node>&);
+ bool tableCellCreateErrorCheck(Token*, RefPtr<Node>&);
+ bool tableSectionCreateErrorCheck(Token*, RefPtr<Node>&);
+ bool textCreateErrorCheck(Token*, RefPtr<Node>&);
+
+ void processCloseTag(Token*);
+
+ bool insertNode(Node*, bool flat = false);
+ bool handleError(Node*, bool flat, const AtomicString& localName, int tagPriority);
+
+ void pushBlock(const AtomicString& tagName, int level);
+ void popBlock(const AtomicString& tagName, bool reportErrors = false);
+ void popBlock(const QualifiedName& qName, bool reportErrors = false) { return popBlock(qName.localName(), reportErrors); } // Convenience function for readability.
+ void popOneBlock();
+ void moveOneBlockToStack(HTMLStackElem*& head);
+ inline HTMLStackElem* popOneBlockCommon();
+ void popInlineBlocks();
+
+ void freeBlock();
+
+ void createHead();
+
+ static bool isResidualStyleTag(const AtomicString& tagName);
+ static bool isAffectedByResidualStyle(const AtomicString& tagName);
+ void handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem*);
+ void reopenResidualStyleTags(HTMLStackElem*, Node* malformedTableParent);
+
+ bool allowNestedRedundantTag(const AtomicString& tagName);
+
+ static bool isHeaderTag(const AtomicString& tagName);
+ void popNestedHeaderTag();
+
+ bool isInline(Node*) const;
+
+ void startBody(); // inserts the isindex element
+ PassRefPtr<Node> handleIsindex(Token*);
+
+ PassRefPtr<Node> parseTelephoneNumbers(Node *inputNode);
+ PassRefPtr<Text> parseNextPhoneNumber(Text *inputText);
+
+ void checkIfHasPElementInScope();
+ bool hasPElementInScope()
+ {
+ if (m_hasPElementInScope == Unknown)
+ checkIfHasPElementInScope();
+ return m_hasPElementInScope == InScope;
+ }
+
+ void reportError(HTMLParserErrorCode errorCode, const AtomicString* tagName1 = 0, const AtomicString* tagName2 = 0, bool closeTags = false)
+ { if (!m_reportErrors) return; reportErrorToConsole(errorCode, tagName1, tagName2, closeTags); }
+
+ void reportErrorToConsole(HTMLParserErrorCode, const AtomicString* tagName1, const AtomicString* tagName2, bool closeTags);
+
+ Document* document;
+
+ // The currently active element (the one new elements will be added to). Can be a document fragment, a document or an element.
+ Node* current;
+ // We can't ref a document, but we don't want to constantly check if a node is a document just to decide whether to deref.
+ bool didRefCurrent;
+
+ HTMLStackElem* blockStack;
+
+ // The number of tags with priority minBlockLevelTagPriority or higher
+ // currently in m_blockStack. The parser enforces a cap on this value by
+ // adding such new elements as siblings instead of children once it is reached.
+ size_t m_blocksInStack;
+
+ enum ElementInScopeState { NotInScope, InScope, Unknown };
+ ElementInScopeState m_hasPElementInScope;
+
+ RefPtr<HTMLFormElement> m_currentFormElement; // currently active form
+ RefPtr<HTMLMapElement> m_currentMapElement; // current map
+ RefPtr<HTMLHeadElement> m_head; // head element; needed for HTML which defines <base> after </head>
+ RefPtr<Node> m_isindexElement; // a possible <isindex> element in the head
+
+ bool inBody;
+ bool haveContent;
+ bool haveFrameSet;
+
+ AtomicString m_skipModeTag; // tells the parser to discard all tags until it reaches the one specified
+
+ bool m_isParsingFragment;
+ bool m_reportErrors;
+ bool m_handlingResidualStyleAcrossBlocks;
+ int inStrayTableContent;
+
+ OwnPtr<HTMLParserQuirks> m_parserQuirks;
+};
+
+}
+
+#endif // HTMLParser_h
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HTMLParserErrorCodes_h
+#define HTMLParserErrorCodes_h
+
+#include "Console.h"
+
+namespace WebCore {
+
+enum HTMLParserErrorCode {
+ MisplacedTablePartError,
+ MisplacedHeadError,
+ MisplacedHeadContentError,
+ RedundantHTMLBodyError,
+ MisplacedAreaError,
+ IgnoredContentError,
+ MisplacedFramesetContentError,
+ MisplacedContentRetryError,
+ MisplacedCaptionContentError,
+ MisplacedTableError,
+ StrayTableContentError,
+ TablePartRequiredError,
+ MalformedBRError,
+ IncorrectXMLSelfCloseError,
+ StrayParagraphCloseError,
+ StrayCloseTagError,
+ ResidualStyleError,
+ FormInsideTablePartError,
+ IncorrectXMLCloseScriptWarning
+};
+
+const char* htmlParserErrorMessageTemplate(HTMLParserErrorCode);
+const char* htmlParserDocumentWriteMessage();
+
+bool isWarning(HTMLParserErrorCode);
+
+enum ViewportErrorCode {
+ DeviceWidthShouldBeUsedWarning,
+ DeviceHeightShouldBeUsedWarning,
+ UnrecognizedViewportArgumentError,
+ MaximumScaleTooLargeError
+};
+
+const char* viewportErrorMessageTemplate(ViewportErrorCode);
+MessageLevel viewportErrorMessageLevel(ViewportErrorCode);
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HTMLParserQuirks_h
+#define HTMLParserQuirks_h
+
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+class AtomicString;
+class Node;
+
+class HTMLParserQuirks : Noncopyable {
+public:
+ HTMLParserQuirks() { }
+ virtual ~HTMLParserQuirks() { }
+
+ virtual void reset() = 0;
+
+ virtual bool shouldInsertNode(Node* parent, Node* newNode) = 0;
+ virtual bool shouldPopBlock(const AtomicString& tagNameOnStack, const AtomicString& tagNameToPop) = 0;
+};
+
+} // namespace WebCore
+
+#endif // HTMLParserQuirks_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLPlugInElement_h
+#define HTMLPlugInElement_h
+
+#include "HTMLFrameOwnerElement.h"
+#include "ScriptInstance.h"
+
+#if ENABLE(NETSCAPE_PLUGIN_API)
+struct NPObject;
+#endif
+
+namespace WebCore {
+
+class RenderWidget;
+
+class HTMLPlugInElement : public HTMLFrameOwnerElement {
+public:
+ HTMLPlugInElement(const QualifiedName& tagName, Document*);
+ virtual ~HTMLPlugInElement();
+
+ virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual bool checkDTD(const Node* newChild);
+
+ virtual void updateWidget() { }
+
+ String align() const;
+ void setAlign(const String&);
+
+ String height() const;
+ void setHeight(const String&);
+
+ String name() const;
+ void setName(const String&);
+
+ String width() const;
+ void setWidth(const String&);
+
+ virtual bool willRespondToMouseMoveEvents() { return false; }
+ virtual bool willRespondToMouseClickEvents() { return true; }
+
+ virtual void defaultEventHandler(Event*);
+
+ virtual RenderWidget* renderWidgetForJSBindings() const = 0;
+ virtual void detach();
+ PassScriptInstance getInstance() const;
+
+#if ENABLE(NETSCAPE_PLUGIN_API)
+ virtual NPObject* getNPObject();
+#endif
+
+protected:
+ static void updateWidgetCallback(Node*);
+
+ AtomicString m_name;
+ mutable ScriptInstance m_instance;
+#if ENABLE(NETSCAPE_PLUGIN_API)
+ NPObject* m_NPObject;
+#endif
+};
+
+} // namespace WebCore
+
+#endif // HTMLPlugInElement_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLPlugInImageElement_h
+#define HTMLPlugInImageElement_h
+
+#include "HTMLPlugInElement.h"
+#include <wtf/OwnPtr.h>
+
+namespace WebCore {
+
+class HTMLImageLoader;
+
+class HTMLPlugInImageElement : public HTMLPlugInElement {
+public:
+ HTMLPlugInImageElement(const QualifiedName& tagName, Document*);
+ virtual ~HTMLPlugInImageElement();
+
+ bool isImageType();
+
+ const String& serviceType() const { return m_serviceType; }
+ const String& url() const { return m_url; }
+
+protected:
+ OwnPtr<HTMLImageLoader> m_imageLoader;
+ String m_serviceType;
+ String m_url;
+};
+
+} // namespace WebCore
+
+#endif // HTMLPlugInImageElement_h
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLPreElement_h
+#define HTMLPreElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLPreElement : public HTMLElement {
+public:
+ HTMLPreElement(const QualifiedName&, Document*);
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 5; }
+
+ bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
+ void parseMappedAttribute(MappedAttribute*);
+
+ int width() const;
+ void setWidth(int w);
+
+ bool wrap() const;
+ void setWrap(bool b);
+};
+
+} // namespace WebCore
+
+#endif // HTMLPreElement_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Simon Hausmann <hausmann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef HTMLQuoteElement_h
+#define HTMLQuoteElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class String;
+
+class HTMLQuoteElement : public HTMLElement
+{
+public:
+ HTMLQuoteElement(const QualifiedName&, Document*);
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 1; }
+
+ String cite() const;
+ void setCite(const String&);
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLScriptElement_h
+#define HTMLScriptElement_h
+
+#include "ScriptElement.h"
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLScriptElement : public HTMLElement
+ , public ScriptElement {
+public:
+ HTMLScriptElement(const QualifiedName&, Document*, bool createdByParser);
+ ~HTMLScriptElement();
+
+ bool shouldExecuteAsJavaScript() const;
+ virtual String scriptContent() const;
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 1; }
+ virtual bool checkDTD(const Node* newChild) { return newChild->isTextNode(); }
+
+ virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void insertedIntoDocument();
+ virtual void removedFromDocument();
+ virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
+
+ virtual bool isURLAttribute(Attribute*) const;
+ virtual void finishParsingChildren();
+
+ String text() const;
+ void setText(const String&);
+
+ String htmlFor() const;
+ void setHtmlFor(const String&);
+
+ String event() const;
+ void setEvent(const String&);
+
+ String charset() const;
+ void setCharset(const String&);
+
+ bool defer() const;
+ void setDefer(bool);
+
+ KURL src() const;
+ void setSrc(const String&);
+
+ String type() const;
+ void setType(const String&);
+
+ virtual String scriptCharset() const;
+
+ virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
+
+protected:
+ virtual String sourceAttributeValue() const;
+ virtual String charsetAttributeValue() const;
+ virtual String typeAttributeValue() const;
+ virtual String languageAttributeValue() const;
+
+ virtual void dispatchLoadEvent();
+ virtual void dispatchErrorEvent();
+
+private:
+ ScriptElementData m_data;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLSelectElement_h
+#define HTMLSelectElement_h
+
+#include "Event.h"
+#include "HTMLCollection.h"
+#include "HTMLFormControlElement.h"
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class HTMLOptionElement;
+class HTMLOptionsCollection;
+class KeyboardEvent;
+
+class HTMLSelectElement : public HTMLFormControlElementWithState {
+public:
+ HTMLSelectElement(const QualifiedName&, Document*, HTMLFormElement* = 0);
+
+ virtual int tagPriority() const { return 6; }
+ virtual bool checkDTD(const Node* newChild);
+
+ virtual const AtomicString& type() const;
+
+ virtual bool isKeyboardFocusable(KeyboardEvent*) const;
+ virtual bool isMouseFocusable() const;
+ virtual bool canSelectAll() const;
+ virtual void selectAll();
+
+ virtual void recalcStyle(StyleChange);
+
+ virtual void dispatchFocusEvent();
+ virtual void dispatchBlurEvent();
+
+ virtual bool canStartSelection() const { return false; }
+
+ int selectedIndex() const;
+ void setSelectedIndex(int index, bool deselect = true, bool fireOnChange = false);
+ int lastSelectedListIndex() const;
+
+ virtual bool isEnumeratable() const { return true; }
+
+ unsigned length() const;
+
+ int minWidth() const { return m_minwidth; }
+
+ int size() const { return m_size; }
+
+ bool multiple() const { return m_multiple; }
+
+ void add(HTMLElement* element, HTMLElement* before, ExceptionCode&);
+ void remove(int index);
+
+ String value();
+ void setValue(const String&);
+
+ PassRefPtr<HTMLOptionsCollection> options();
+
+ virtual bool saveState(String& value) const;
+ virtual void restoreState(const String&);
+
+ virtual bool insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionCode&, bool shouldLazyAttach = false);
+ virtual bool replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionCode&, bool shouldLazyAttach = false);
+ virtual bool removeChild(Node* child, ExceptionCode&);
+ virtual bool appendChild(PassRefPtr<Node> newChild, ExceptionCode&, bool shouldLazyAttach = false);
+ virtual bool removeChildren();
+ virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
+
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle *);
+ virtual bool appendFormData(FormDataList&, bool);
+
+ // get the actual listbox index of the optionIndexth option
+ int optionToListIndex(int optionIndex) const;
+ // reverse of optionToListIndex - get optionIndex from listboxIndex
+ int listToOptionIndex(int listIndex) const;
+
+ void setRecalcListItems();
+
+ const Vector<HTMLElement*>& listItems() const
+ {
+ if (m_recalcListItems)
+ recalcListItems();
+ else
+ checkListItems();
+ return m_listItems;
+ }
+ virtual void reset();
+
+ virtual void defaultEventHandler(Event*);
+ virtual void accessKeyAction(bool sendToAnyElement);
+ void accessKeySetSelectedIndex(int);
+
+ void setMultiple(bool);
+
+ void setSize(int);
+
+ void setOption(unsigned index, HTMLOptionElement*, ExceptionCode&);
+ void setLength(unsigned, ExceptionCode&);
+
+ Node* namedItem(const AtomicString& name);
+ Node* item(unsigned index);
+
+ HTMLCollection::CollectionInfo* collectionInfo() { return &m_collectionInfo; }
+
+ void setActiveSelectionAnchorIndex(int index);
+ void setActiveSelectionEndIndex(int index) { m_activeSelectionEndIndex = index; }
+ void updateListBoxSelection(bool deselectOtherOptions);
+ void listBoxOnChange();
+ void menuListOnChange();
+
+ int activeSelectionStartListIndex() const;
+ int activeSelectionEndListIndex() const;
+
+ void scrollToSelection();
+
+ virtual bool willRespondToMouseClickEvents();
+
+private:
+ void recalcListItems(bool updateSelectedStates = true) const;
+ void checkListItems() const;
+
+ void deselectItems(HTMLOptionElement* excludeElement = 0);
+ bool usesMenuList() const { return !m_multiple; }
+ int nextSelectableListIndex(int startIndex);
+ int previousSelectableListIndex(int startIndex);
+ void menuListDefaultEventHandler(Event*);
+ void listBoxDefaultEventHandler(Event*);
+ void typeAheadFind(KeyboardEvent*);
+ void saveLastSelection();
+
+ mutable Vector<HTMLElement*> m_listItems;
+ Vector<bool> m_cachedStateForActiveSelection;
+ Vector<bool> m_lastOnChangeSelection;
+ int m_minwidth;
+ int m_size;
+ bool m_multiple;
+ mutable bool m_recalcListItems;
+ mutable int m_lastOnChangeIndex;
+
+ int m_activeSelectionAnchorIndex;
+ int m_activeSelectionEndIndex;
+ bool m_activeSelectionState;
+
+ // Instance variables for type-ahead find
+ UChar m_repeatingChar;
+ DOMTimeStamp m_lastCharTime;
+ String m_typedString;
+
+ HTMLCollection::CollectionInfo m_collectionInfo;
+};
+
+#ifdef NDEBUG
+
+inline void HTMLSelectElement::checkListItems() const
+{
+}
+
+#endif
+
+} // namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HTMLSourceElement_h
+#define HTMLSourceElement_h
+
+#if ENABLE(VIDEO)
+
+#include "HTMLElement.h"
+#include <limits>
+
+namespace WebCore {
+
+class KURL;
+
+class HTMLSourceElement : public HTMLElement {
+public:
+ HTMLSourceElement(const QualifiedName&, Document*);
+ virtual ~HTMLSourceElement();
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
+
+ virtual void insertedIntoDocument();
+
+ KURL src() const;
+ String media() const;
+ String type() const;
+ void setSrc(const String&);
+ void setMedia(const String&);
+ void setType(const String&);
+};
+
+} //namespace
+
+#endif
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef HTMLStyleElement_h
+#define HTMLStyleElement_h
+
+#include "CSSStyleSheet.h"
+#include "HTMLElement.h"
+#include "StyleElement.h"
+
+namespace WebCore {
+
+class HTMLStyleElement : public HTMLElement, public StyleElement
+{
+public:
+ HTMLStyleElement(const QualifiedName&, Document*, bool createdByParser);
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 1; }
+ virtual bool checkDTD(const Node* newChild) { return newChild->isTextNode(); }
+
+ // overload from HTMLElement
+ virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void insertedIntoDocument();
+ virtual void removedFromDocument();
+ virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
+
+ virtual void finishParsingChildren();
+
+ virtual bool isLoading() const;
+ virtual bool sheetLoaded();
+
+ bool disabled() const;
+ void setDisabled(bool);
+
+ virtual const AtomicString& media() const;
+ void setMedia(const AtomicString&);
+
+ virtual const AtomicString& type() const;
+ void setType(const AtomicString&);
+
+ StyleSheet* sheet();
+
+ virtual void setLoading(bool loading) { m_loading = loading; }
+
+ virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
+
+protected:
+ String m_media;
+ bool m_loading;
+ bool m_createdByParser;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1997 Martin Jones (mjones@kde.org)
+ * (C) 1997 Torben Weis (weis@kde.org)
+ * (C) 1998 Waldo Bastian (bastian@kde.org)
+ * (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLTableCaptionElement_h
+#define HTMLTableCaptionElement_h
+
+#include "HTMLTablePartElement.h"
+
+namespace WebCore {
+
+class HTMLTableCaptionElement : public HTMLTablePartElement
+{
+public:
+ HTMLTableCaptionElement(const QualifiedName&, Document*);
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 5; }
+
+ virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ String align() const;
+ void setAlign(const String&);
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1997 Martin Jones (mjones@kde.org)
+ * (C) 1997 Torben Weis (weis@kde.org)
+ * (C) 1998 Waldo Bastian (bastian@kde.org)
+ * (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLTableCellElement_h
+#define HTMLTableCellElement_h
+
+#include "HTMLTablePartElement.h"
+
+namespace WebCore {
+
+class HTMLTableCellElement : public HTMLTablePartElement
+{
+public:
+ HTMLTableCellElement(const QualifiedName&, Document*);
+ ~HTMLTableCellElement();
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
+ virtual int tagPriority() const { return 6; }
+
+ int cellIndex() const;
+
+ int col() const { return _col; }
+ void setCol(int col) { _col = col; }
+ int row() const { return _row; }
+ void setRow(int r) { _row = r; }
+
+ int colSpan() const { return cSpan; }
+ int rowSpan() const { return rSpan; }
+
+ virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ // used by table cells to share style decls created by the enclosing table.
+ virtual bool canHaveAdditionalAttributeStyleDecls() const { return true; }
+ virtual void additionalAttributeStyleDecls(Vector<CSSMutableStyleDeclaration*>&);
+
+ virtual bool isURLAttribute(Attribute*) const;
+
+ void setCellIndex(int);
+
+ String abbr() const;
+ void setAbbr(const String&);
+
+ String align() const;
+ void setAlign(const String&);
+
+ String axis() const;
+ void setAxis(const String&);
+
+ String bgColor() const;
+ void setBgColor(const String&);
+
+ String ch() const;
+ void setCh(const String&);
+
+ String chOff() const;
+ void setChOff(const String&);
+
+ void setColSpan(int);
+
+ String headers() const;
+ void setHeaders(const String&);
+
+ String height() const;
+ void setHeight(const String&);
+
+ bool noWrap() const;
+ void setNoWrap(bool);
+
+ void setRowSpan(int);
+
+ String scope() const;
+ void setScope(const String&);
+
+ String vAlign() const;
+ void setVAlign(const String&);
+
+ String width() const;
+ void setWidth(const String&);
+
+ virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
+
+protected:
+ int _row;
+ int _col;
+ int rSpan;
+ int cSpan;
+ int rowHeight;
+ bool m_solid;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1997 Martin Jones (mjones@kde.org)
+ * (C) 1997 Torben Weis (weis@kde.org)
+ * (C) 1998 Waldo Bastian (bastian@kde.org)
+ * (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLTableColElement_h
+#define HTMLTableColElement_h
+
+#include "HTMLTablePartElement.h"
+
+namespace WebCore {
+
+class HTMLTableElement;
+
+class HTMLTableColElement : public HTMLTablePartElement
+{
+public:
+ HTMLTableColElement(const QualifiedName& tagName, Document*);
+
+ virtual HTMLTagStatus endTagRequirement() const;
+ virtual int tagPriority() const;
+ virtual bool checkDTD(const Node*);
+
+ // overrides
+ virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+ virtual bool canHaveAdditionalAttributeStyleDecls() const { return true; }
+ virtual void additionalAttributeStyleDecls(Vector<CSSMutableStyleDeclaration*>&);
+
+ int span() const { return _span; }
+
+ String align() const;
+ void setAlign(const String&);
+
+ String ch() const;
+ void setCh(const String&);
+
+ String chOff() const;
+ void setChOff(const String&);
+
+ void setSpan(int);
+
+ String vAlign() const;
+ void setVAlign(const String&);
+
+ String width() const;
+ void setWidth(const String&);
+
+protected:
+ int _span;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1997 Martin Jones (mjones@kde.org)
+ * (C) 1997 Torben Weis (weis@kde.org)
+ * (C) 1998 Waldo Bastian (bastian@kde.org)
+ * (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLTableElement_h
+#define HTMLTableElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLCollection;
+class HTMLTableCaptionElement;
+class HTMLTableSectionElement;
+
+class HTMLTableElement : public HTMLElement {
+public:
+ HTMLTableElement(const QualifiedName&, Document*);
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 9; }
+ virtual bool checkDTD(const Node*);
+
+ HTMLTableCaptionElement* caption() const;
+ void setCaption(PassRefPtr<HTMLTableCaptionElement>, ExceptionCode&);
+
+ HTMLTableSectionElement* tHead() const;
+ void setTHead(PassRefPtr<HTMLTableSectionElement>, ExceptionCode&);
+
+ HTMLTableSectionElement* tFoot() const;
+ void setTFoot(PassRefPtr<HTMLTableSectionElement>, ExceptionCode&);
+
+ PassRefPtr<HTMLElement> createTHead();
+ void deleteTHead();
+ PassRefPtr<HTMLElement> createTFoot();
+ void deleteTFoot();
+ PassRefPtr<HTMLElement> createCaption();
+ void deleteCaption();
+ PassRefPtr<HTMLElement> insertRow(int index, ExceptionCode&);
+ void deleteRow(int index, ExceptionCode&);
+
+ PassRefPtr<HTMLCollection> rows();
+ PassRefPtr<HTMLCollection> tBodies();
+
+ String align() const;
+ void setAlign(const String&);
+
+ String bgColor() const;
+ void setBgColor(const String&);
+
+ String border() const;
+ void setBorder(const String&);
+
+ String cellPadding() const;
+ void setCellPadding(const String&);
+
+ String cellSpacing() const;
+ void setCellSpacing(const String&);
+
+ String frame() const;
+ void setFrame(const String&);
+
+ String rules() const;
+ void setRules(const String&);
+
+ String summary() const;
+ void setSummary(const String&);
+
+ String width() const;
+ void setWidth(const String&);
+
+ virtual ContainerNode* addChild(PassRefPtr<Node>);
+ virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+ virtual void attach();
+ virtual bool isURLAttribute(Attribute*) const;
+
+ // Used to obtain either a solid or outset border decl and to deal with the frame
+ // and rules attributes.
+ virtual bool canHaveAdditionalAttributeStyleDecls() const { return true; }
+ virtual void additionalAttributeStyleDecls(Vector<CSSMutableStyleDeclaration*>&);
+ void addSharedCellDecls(Vector<CSSMutableStyleDeclaration*>&);
+ void addSharedGroupDecls(bool rows, Vector<CSSMutableStyleDeclaration*>&);
+
+ virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
+
+private:
+ void addSharedCellBordersDecl(Vector<CSSMutableStyleDeclaration*>&);
+ void addSharedCellPaddingDecl(Vector<CSSMutableStyleDeclaration*>&);
+
+ enum TableRules { UnsetRules, NoneRules, GroupsRules, RowsRules, ColsRules, AllRules };
+ enum CellBorders { NoBorders, SolidBorders, InsetBorders, SolidBordersColsOnly, SolidBordersRowsOnly };
+
+ CellBorders cellBorders() const;
+
+ HTMLTableSectionElement* lastBody() const;
+
+ bool m_borderAttr; // Sets a precise border width and creates an outset border for the table and for its cells.
+ bool m_borderColorAttr; // Overrides the outset border and makes it solid for the table and cells instead.
+ bool m_frameAttr; // Implies a thin border width if no border is set and then a certain set of solid/hidden borders based off the value.
+ TableRules m_rulesAttr; // Implies a thin border width, a collapsing border model, and all borders on the table becoming set to hidden (if frame/border
+ // are present, to none otherwise).
+
+ unsigned short m_padding;
+ RefPtr<CSSMappedAttributeDeclaration> m_paddingDecl;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1997 Martin Jones (mjones@kde.org)
+ * (C) 1997 Torben Weis (weis@kde.org)
+ * (C) 1998 Waldo Bastian (bastian@kde.org)
+ * (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLTablePartElement_h
+#define HTMLTablePartElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLTablePartElement : public HTMLElement {
+public:
+ HTMLTablePartElement(const QualifiedName& tagName, Document* doc)
+ : HTMLElement(tagName, doc)
+ { }
+
+ virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1997 Martin Jones (mjones@kde.org)
+ * (C) 1997 Torben Weis (weis@kde.org)
+ * (C) 1998 Waldo Bastian (bastian@kde.org)
+ * (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLTableRowElement_h
+#define HTMLTableRowElement_h
+
+#include "HTMLTablePartElement.h"
+
+namespace WebCore {
+
+class HTMLTableRowElement : public HTMLTablePartElement {
+public:
+ HTMLTableRowElement(const QualifiedName&, Document*);
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
+ virtual int tagPriority() const { return 7; }
+ virtual bool checkDTD(const Node*);
+ virtual ContainerNode* addChild(PassRefPtr<Node>);
+
+ int rowIndex() const;
+ void setRowIndex(int);
+
+ int sectionRowIndex() const;
+ void setSectionRowIndex(int);
+
+ PassRefPtr<HTMLElement> insertCell(int index, ExceptionCode&);
+ void deleteCell(int index, ExceptionCode&);
+
+ PassRefPtr<HTMLCollection> cells();
+ void setCells(HTMLCollection *, ExceptionCode&);
+
+ String align() const;
+ void setAlign(const String&);
+
+ String bgColor() const;
+ void setBgColor(const String&);
+
+ String ch() const;
+ void setCh(const String&);
+
+ String chOff() const;
+ void setChOff(const String&);
+
+ String vAlign() const;
+ void setVAlign(const String&);
+};
+
+} // namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HTMLTableRowsCollection_h
+#define HTMLTableRowsCollection_h
+
+#include "HTMLCollection.h"
+
+namespace WebCore {
+
+class HTMLTableElement;
+class HTMLTableRowElement;
+
+class HTMLTableRowsCollection : public HTMLCollection {
+public:
+ static PassRefPtr<HTMLTableRowsCollection> create(PassRefPtr<HTMLTableElement>);
+
+ static HTMLTableRowElement* rowAfter(HTMLTableElement*, HTMLTableRowElement*);
+ static HTMLTableRowElement* lastRow(HTMLTableElement*);
+
+private:
+ HTMLTableRowsCollection(PassRefPtr<HTMLTableElement>);
+
+ virtual Element* itemAfter(Element*) const;
+};
+
+} // namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1997 Martin Jones (mjones@kde.org)
+ * (C) 1997 Torben Weis (weis@kde.org)
+ * (C) 1998 Waldo Bastian (bastian@kde.org)
+ * (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLTableSectionElement_h
+#define HTMLTableSectionElement_h
+
+#include "HTMLTablePartElement.h"
+
+namespace WebCore {
+
+class HTMLTableSectionElement : public HTMLTablePartElement {
+public:
+ HTMLTableSectionElement(const QualifiedName& tagName, Document*);
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
+ virtual int tagPriority() const { return 8; }
+ virtual bool checkDTD(const Node*);
+ virtual ContainerNode* addChild(PassRefPtr<Node>);
+ virtual bool canHaveAdditionalAttributeStyleDecls() const { return true; }
+ virtual void additionalAttributeStyleDecls(Vector<CSSMutableStyleDeclaration*>&);
+
+ PassRefPtr<HTMLElement> insertRow(int index, ExceptionCode&);
+ void deleteRow(int index, ExceptionCode&);
+
+ int numRows() const;
+
+ String align() const;
+ void setAlign(const String&);
+
+ String ch() const;
+ void setCh(const String&);
+
+ String chOff() const;
+ void setChOff(const String&);
+
+ String vAlign() const;
+ void setVAlign(const String&);
+
+ PassRefPtr<HTMLCollection> rows();
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLTextAreaElement_h
+#define HTMLTextAreaElement_h
+
+#include "HTMLFormControlElement.h"
+
+namespace WebCore {
+
+class Selection;
+
+class HTMLTextAreaElement : public HTMLFormControlElementWithState {
+public:
+ HTMLTextAreaElement(const QualifiedName&, Document*, HTMLFormElement* = 0);
+
+ virtual bool checkDTD(const Node* newChild) { return newChild->isTextNode(); }
+
+ int cols() const { return m_cols; }
+ int rows() const { return m_rows; }
+
+ bool shouldWrapText() const { return m_wrap != NoWrap; }
+
+ virtual bool isEnumeratable() const { return true; }
+
+ virtual const AtomicString& type() const;
+
+ virtual bool saveState(String& value) const;
+ virtual void restoreState(const String&);
+
+ bool readOnly() const { return isReadOnlyControl(); }
+
+ virtual bool isTextControl() const { return true; }
+
+ int selectionStart();
+ int selectionEnd();
+
+ void setSelectionStart(int);
+ void setSelectionEnd(int);
+
+ void select();
+ void setSelectionRange(int, int);
+
+ virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
+ virtual void parseMappedAttribute(MappedAttribute*);
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+ virtual bool appendFormData(FormDataList&, bool);
+ virtual void reset();
+ virtual void defaultEventHandler(Event*);
+ virtual bool isMouseFocusable() const;
+ virtual bool isKeyboardFocusable(KeyboardEvent*) const;
+ virtual void updateFocusAppearance(bool restorePreviousSelection);
+
+ String value() const;
+ void setValue(const String&);
+ String defaultValue() const;
+ void setDefaultValue(const String&);
+
+ void rendererWillBeDestroyed();
+
+ virtual void accessKeyAction(bool sendToAnyElement);
+
+ const AtomicString& accessKey() const;
+ void setAccessKey(const String&);
+
+ void setCols(int);
+ void setRows(int);
+
+ void cacheSelection(int s, int e) { m_cachedSelectionStart = s; m_cachedSelectionEnd = e; };
+ Selection selection() const;
+
+ virtual bool willRespondToMouseClickEvents();
+
+ virtual bool shouldUseInputMethod() const;
+
+private:
+ enum WrapMethod { NoWrap, SoftWrap, HardWrap };
+
+ void updateValue() const;
+
+ int m_rows;
+ int m_cols;
+ WrapMethod m_wrap;
+ mutable String m_value;
+ int m_cachedSelectionStart;
+ int m_cachedSelectionEnd;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef HTMLTitleElement_h
+#define HTMLTitleElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLTitleElement : public HTMLElement
+{
+public:
+ HTMLTitleElement(const QualifiedName&, Document*);
+ ~HTMLTitleElement();
+
+ virtual bool checkDTD(const Node* newChild) { return newChild->isTextNode(); }
+
+ virtual void insertedIntoDocument();
+ virtual void removedFromDocument();
+ virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
+
+ String text() const;
+ void setText(const String&);
+
+protected:
+ String m_title;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 1997 Martin Jones (mjones@kde.org)
+ (C) 1997 Torben Weis (weis@kde.org)
+ (C) 1998 Waldo Bastian (bastian@kde.org)
+ (C) 2001 Dirk Mueller (mueller@kde.org)
+ Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef HTMLTokenizer_h
+#define HTMLTokenizer_h
+
+#include "CachedResourceClient.h"
+#include "CachedResourceHandle.h"
+#include "NamedMappedAttrMap.h"
+#include "SegmentedString.h"
+#include "Timer.h"
+#include "Tokenizer.h"
+#include <wtf/Deque.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class CachedScript;
+class DocumentFragment;
+class Document;
+class HTMLDocument;
+class HTMLScriptElement;
+class HTMLViewSourceDocument;
+class FrameView;
+class HTMLParser;
+class Node;
+class PreloadScanner;
+class ScriptSourceCode;
+
+extern const double defaultTokenizerTimeDelay;
+
+/**
+ * @internal
+ * represents one HTML tag. Consists of a numerical id, and the list
+ * of attributes. Can also represent text. In this case the id = 0 and
+ * text contains the text.
+ */
+struct Token {
+ Token()
+ : beginTag(true)
+ , selfClosingTag(false)
+ , brokenXMLStyle(false)
+ , m_sourceInfo(0)
+ { }
+ ~Token() { }
+
+ void addAttribute(AtomicString& attrName, const AtomicString& v, bool viewSourceMode);
+
+ bool isOpenTag(const QualifiedName& fullName) const { return beginTag && fullName.localName() == tagName; }
+ bool isCloseTag(const QualifiedName& fullName) const { return !beginTag && fullName.localName() == tagName; }
+
+ void reset()
+ {
+ attrs = 0;
+ text = 0;
+ tagName = nullAtom;
+ beginTag = true;
+ selfClosingTag = false;
+ brokenXMLStyle = false;
+ if (m_sourceInfo)
+ m_sourceInfo->clear();
+ }
+
+ void addViewSourceChar(UChar c) { if (!m_sourceInfo.get()) m_sourceInfo.set(new Vector<UChar>); m_sourceInfo->append(c); }
+
+ RefPtr<NamedMappedAttrMap> attrs;
+ RefPtr<StringImpl> text;
+ AtomicString tagName;
+ bool beginTag;
+ bool selfClosingTag;
+ bool brokenXMLStyle;
+ OwnPtr<Vector<UChar> > m_sourceInfo;
+};
+
+enum DoctypeState {
+ DoctypeBegin,
+ DoctypeBeforeName,
+ DoctypeName,
+ DoctypeAfterName,
+ DoctypeBeforePublicID,
+ DoctypePublicID,
+ DoctypeAfterPublicID,
+ DoctypeBeforeSystemID,
+ DoctypeSystemID,
+ DoctypeAfterSystemID,
+ DoctypeBogus
+};
+
+class DoctypeToken {
+public:
+ DoctypeToken() {}
+
+ void reset()
+ {
+ m_name.clear();
+ m_publicID.clear();
+ m_systemID.clear();
+ m_state = DoctypeBegin;
+ m_source.clear();
+ }
+
+ DoctypeState state() { return m_state; }
+ void setState(DoctypeState s) { m_state = s; }
+
+ Vector<UChar> m_name;
+ Vector<UChar> m_publicID;
+ Vector<UChar> m_systemID;
+ DoctypeState m_state;
+
+ Vector<UChar> m_source;
+};
+
+//-----------------------------------------------------------------------------
+
+class HTMLTokenizer : public Tokenizer, public CachedResourceClient {
+public:
+ HTMLTokenizer(HTMLDocument*, bool reportErrors);
+ HTMLTokenizer(HTMLViewSourceDocument*);
+ HTMLTokenizer(DocumentFragment*);
+ virtual ~HTMLTokenizer();
+
+ virtual bool write(const SegmentedString&, bool appendData);
+ virtual void finish();
+ virtual void setForceSynchronous(bool force);
+ virtual bool isWaitingForScripts() const;
+ virtual void stopParsing();
+ virtual bool processingData() const;
+ virtual int executingScript() const { return m_executingScript; }
+ virtual void parsePending();
+
+ virtual int lineNumber() const { return m_lineNumber; }
+ virtual int columnNumber() const { return 1; }
+
+ bool processingContentWrittenByScript() const { return m_src.excludeLineNumbers(); }
+
+ virtual void executeScriptsWaitingForStylesheets();
+
+ virtual bool isHTMLTokenizer() const { return true; }
+ HTMLParser* htmlParser() const { return m_parser.get(); }
+
+private:
+ class State;
+
+ // Where we are in parsing a tag
+ void begin();
+ void end();
+
+ void reset();
+
+ PassRefPtr<Node> processToken();
+ void processDoctypeToken();
+
+ State processListing(SegmentedString, State);
+ State parseComment(SegmentedString&, State);
+ State parseDoctype(SegmentedString&, State);
+ State parseServer(SegmentedString&, State);
+ State parseText(SegmentedString&, State);
+ State parseSpecial(SegmentedString&, State);
+ State parseTag(SegmentedString&, State);
+ State parseEntity(SegmentedString&, UChar*& dest, State, unsigned& cBufferPos, bool start, bool parsingTag);
+ State parseProcessingInstruction(SegmentedString&, State);
+ State scriptHandler(State);
+ State scriptExecution(const ScriptSourceCode&, State);
+ void setSrc(const SegmentedString&);
+
+ // check if we have enough space in the buffer.
+ // if not enlarge it
+ inline void checkBuffer(int len = 10)
+ {
+ if ((m_dest - m_buffer) > m_bufferSize - len)
+ enlargeBuffer(len);
+ }
+
+ inline void checkScriptBuffer(int len = 10)
+ {
+ if (m_scriptCodeSize + len >= m_scriptCodeCapacity)
+ enlargeScriptBuffer(len);
+ }
+
+ void enlargeBuffer(int len);
+ void enlargeScriptBuffer(int len);
+
+ bool continueProcessing(int& processedCount, double startTime, State&);
+ void timerFired(Timer<HTMLTokenizer>*);
+ void allDataProcessed();
+
+ // from CachedResourceClient
+ void notifyFinished(CachedResource*);
+
+ // Internal buffers
+ ///////////////////
+ UChar* m_buffer;
+ int m_bufferSize;
+ UChar* m_dest;
+
+ Token m_currentToken;
+
+ // Tokenizer flags
+ //////////////////
+ // are we in quotes within a html tag
+ enum { NoQuote, SingleQuote, DoubleQuote } tquote;
+
+ // Are we in a &... character entity description?
+ enum EntityState {
+ NoEntity = 0,
+ SearchEntity = 1,
+ NumericSearch = 2,
+ Hexadecimal = 3,
+ Decimal = 4,
+ EntityName = 5,
+ SearchSemicolon = 6
+ };
+ unsigned EntityUnicodeValue;
+
+ enum TagState {
+ NoTag = 0,
+ TagName = 1,
+ SearchAttribute = 2,
+ AttributeName = 3,
+ SearchEqual = 4,
+ SearchValue = 5,
+ QuotedValue = 6,
+ Value = 7,
+ SearchEnd = 8
+ };
+
+ class State {
+ public:
+ State() : m_bits(0) { }
+
+ TagState tagState() const { return static_cast<TagState>(m_bits & TagMask); }
+ void setTagState(TagState t) { m_bits = (m_bits & ~TagMask) | t; }
+ EntityState entityState() const { return static_cast<EntityState>((m_bits & EntityMask) >> EntityShift); }
+ void setEntityState(EntityState e) { m_bits = (m_bits & ~EntityMask) | (e << EntityShift); }
+
+ bool inScript() const { return testBit(InScript); }
+ void setInScript(bool v) { setBit(InScript, v); }
+ bool inStyle() const { return testBit(InStyle); }
+ void setInStyle(bool v) { setBit(InStyle, v); }
+ bool inXmp() const { return testBit(InXmp); }
+ void setInXmp(bool v) { setBit(InXmp, v); }
+ bool inTitle() const { return testBit(InTitle); }
+ void setInTitle(bool v) { setBit(InTitle, v); }
+ bool inIFrame() const { return testBit(InIFrame); }
+ void setInIFrame(bool v) { setBit(InIFrame, v); }
+ bool inPlainText() const { return testBit(InPlainText); }
+ void setInPlainText(bool v) { setBit(InPlainText, v); }
+ bool inProcessingInstruction() const { return testBit(InProcessingInstruction); }
+ void setInProcessingInstruction(bool v) { return setBit(InProcessingInstruction, v); }
+ bool inComment() const { return testBit(InComment); }
+ void setInComment(bool v) { setBit(InComment, v); }
+ bool inDoctype() const { return testBit(InDoctype); }
+ void setInDoctype(bool v) { setBit(InDoctype, v); }
+ bool inTextArea() const { return testBit(InTextArea); }
+ void setInTextArea(bool v) { setBit(InTextArea, v); }
+ bool escaped() const { return testBit(Escaped); }
+ void setEscaped(bool v) { setBit(Escaped, v); }
+ bool inServer() const { return testBit(InServer); }
+ void setInServer(bool v) { setBit(InServer, v); }
+ bool skipLF() const { return testBit(SkipLF); }
+ void setSkipLF(bool v) { setBit(SkipLF, v); }
+ bool startTag() const { return testBit(StartTag); }
+ void setStartTag(bool v) { setBit(StartTag, v); }
+ bool discardLF() const { return testBit(DiscardLF); }
+ void setDiscardLF(bool v) { setBit(DiscardLF, v); }
+ bool allowYield() const { return testBit(AllowYield); }
+ void setAllowYield(bool v) { setBit(AllowYield, v); }
+ bool loadingExtScript() const { return testBit(LoadingExtScript); }
+ void setLoadingExtScript(bool v) { setBit(LoadingExtScript, v); }
+ bool forceSynchronous() const { return testBit(ForceSynchronous); }
+ void setForceSynchronous(bool v) { setBit(ForceSynchronous, v); }
+
+ bool inAnySpecial() const { return m_bits & (InScript | InStyle | InXmp | InTextArea | InTitle | InIFrame); }
+ bool hasTagState() const { return m_bits & TagMask; }
+ bool hasEntityState() const { return m_bits & EntityMask; }
+
+ bool needsSpecialWriteHandling() const { return m_bits & (InScript | InStyle | InXmp | InTextArea | InTitle | InIFrame | TagMask | EntityMask | InPlainText | InComment | InDoctype | InServer | InProcessingInstruction | StartTag); }
+
+ private:
+ static const int EntityShift = 4;
+ enum StateBits {
+ TagMask = (1 << 4) - 1,
+ EntityMask = (1 << 7) - (1 << 4),
+ InScript = 1 << 7,
+ InStyle = 1 << 8,
+ // Bit 9 unused
+ InXmp = 1 << 10,
+ InTitle = 1 << 11,
+ InPlainText = 1 << 12,
+ InProcessingInstruction = 1 << 13,
+ InComment = 1 << 14,
+ InTextArea = 1 << 15,
+ Escaped = 1 << 16,
+ InServer = 1 << 17,
+ SkipLF = 1 << 18,
+ StartTag = 1 << 19,
+ DiscardLF = 1 << 20, // FIXME: should clarify difference between skip and discard
+ AllowYield = 1 << 21,
+ LoadingExtScript = 1 << 22,
+ ForceSynchronous = 1 << 23,
+ InIFrame = 1 << 24,
+ InDoctype = 1 << 25
+ };
+
+ void setBit(StateBits bit, bool value)
+ {
+ if (value)
+ m_bits |= bit;
+ else
+ m_bits &= ~bit;
+ }
+ bool testBit(StateBits bit) const { return m_bits & bit; }
+
+ unsigned m_bits;
+ };
+
+ State m_state;
+
+ DoctypeToken m_doctypeToken;
+ int m_doctypeSearchCount;
+ int m_doctypeSecondarySearchCount;
+
+ bool m_brokenServer;
+
+ // Name of an attribute that we just scanned.
+ AtomicString m_attrName;
+
+ // Used to store the code of a scripting sequence
+ UChar* m_scriptCode;
+ // Size of the script sequenze stored in @ref #scriptCode
+ int m_scriptCodeSize;
+ // Maximal size that can be stored in @ref #scriptCode
+ int m_scriptCodeCapacity;
+ // resync point of script code size
+ int m_scriptCodeResync;
+
+ // Stores characters if we are scanning for a string like "</script>"
+ UChar searchBuffer[10];
+
+ // Counts where we are in the string we are scanning for
+ int searchCount;
+ // the stopper string
+ const char* m_searchStopper;
+ int m_searchStopperLength;
+
+ // if no more data is coming, just parse what we have (including ext scripts that
+ // may be still downloading) and finish
+ bool m_noMoreData;
+ // URL to get source code of script from
+ String m_scriptTagSrcAttrValue;
+ String m_scriptTagCharsetAttrValue;
+ // the HTML code we will parse after the external script we are waiting for has loaded
+ SegmentedString m_pendingSrc;
+
+ // the HTML code we will parse after this particular script has
+ // loaded, but before all pending HTML
+ SegmentedString* m_currentPrependingSrc;
+
+ // true if we are executing a script while parsing a document. This causes the parsing of
+ // the output of the script to be postponed until after the script has finished executing
+ int m_executingScript;
+ Deque<CachedResourceHandle<CachedScript> > m_pendingScripts;
+ RefPtr<HTMLScriptElement> m_scriptNode;
+
+ bool m_requestingScript;
+ bool m_hasScriptsWaitingForStylesheets;
+
+ // if we found one broken comment, there are most likely others as well
+ // store a flag to get rid of the O(n^2) behaviour in such a case.
+ bool m_brokenComments;
+ // current line number
+ int m_lineNumber;
+ int m_currentScriptTagStartLineNumber;
+ int m_currentTagStartLineNumber;
+
+ double m_tokenizerTimeDelay;
+ int m_tokenizerChunkSize;
+
+ // The timer for continued processing.
+ Timer<HTMLTokenizer> m_timer;
+
+// This buffer can hold arbitrarily long user-defined attribute names, such as in EMBED tags.
+// So any fixed number might be too small, but rather than rewriting all usage of this buffer
+// we'll just make it large enough to handle all imaginable cases.
+#define CBUFLEN 1024
+ UChar m_cBuffer[CBUFLEN + 2];
+ unsigned int m_cBufferPos;
+
+ SegmentedString m_src;
+ Document* m_doc;
+ OwnPtr<HTMLParser> m_parser;
+ bool m_inWrite;
+ bool m_fragment;
+
+ OwnPtr<PreloadScanner> m_preloadScanner;
+};
+
+void parseHTMLDocumentFragment(const String&, DocumentFragment*);
+
+UChar decodeNamedEntity(const char*);
+
+} // namespace WebCore
+
+#endif // HTMLTokenizer_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLUListElement_h
+#define HTMLUListElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLUListElement : public HTMLElement
+{
+public:
+ HTMLUListElement(const QualifiedName&, Document*);
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 5; }
+
+ virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ bool compact() const;
+ void setCompact(bool);
+
+ String type() const;
+ void setType(const String&);
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HTMLVideoElement_h
+#define HTMLVideoElement_h
+
+#if ENABLE(VIDEO)
+
+#include "HTMLMediaElement.h"
+#include <wtf/OwnPtr.h>
+
+namespace WebCore {
+
+class HTMLImageLoader;
+
+class HTMLVideoElement : public HTMLMediaElement
+{
+public:
+ HTMLVideoElement(const QualifiedName&, Document*);
+
+ virtual int tagPriority() const { return 5; }
+ virtual bool rendererIsNeeded(RenderStyle*);
+#if !ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+#endif
+ virtual void attach();
+ virtual void detach();
+ virtual void parseMappedAttribute(MappedAttribute* attr);
+ virtual bool isVideo() const { return true; }
+ virtual bool hasVideo() const { return player() && player()->hasVideo(); }
+ virtual bool isURLAttribute(Attribute*) const;
+ virtual const QualifiedName& imageSourceAttributeName() const;
+
+ unsigned width() const;
+ void setWidth(unsigned);
+ unsigned height() const;
+ void setHeight(unsigned);
+
+ unsigned videoWidth() const;
+ unsigned videoHeight() const;
+
+ KURL poster() const;
+ void setPoster(const String&);
+
+ void updatePosterImage();
+
+private:
+ OwnPtr<HTMLImageLoader> m_imageLoader;
+ bool m_shouldShowPosterImage;
+};
+
+} //namespace
+
+#endif
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * 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 HTMLViewSourceDocument_h
+#define HTMLViewSourceDocument_h
+
+#include "HTMLDocument.h"
+
+namespace WebCore {
+
+class DoctypeToken;
+struct Token;
+
+class HTMLViewSourceDocument : public HTMLDocument {
+public:
+ static PassRefPtr<HTMLViewSourceDocument> create(Frame* frame, const String& mimeType)
+ {
+ return new HTMLViewSourceDocument(frame, mimeType);
+ }
+
+ virtual Tokenizer* createTokenizer();
+
+ void addViewSourceToken(Token*); // Used by the HTML tokenizer.
+ void addViewSourceText(const String&); // Used by the plaintext tokenizer.
+ void addViewSourceDoctypeToken(DoctypeToken*);
+
+private:
+ HTMLViewSourceDocument(Frame*, const String& mimeType);
+
+ void createContainingTable();
+ Element* addSpanWithClassName(const String&);
+ void addLine(const String& className);
+ void addText(const String& text, const String& className);
+ Element* addLink(const String& url, bool isAnchor);
+
+ String m_type;
+ Element* m_current;
+ Element* m_tbody;
+ Element* m_td;
+};
+
+}
+
+#endif // HTMLViewSourceDocument_h
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HTTPHeaderMap_h
+#define HTTPHeaderMap_h
+
+#include "AtomicString.h"
+#include "AtomicStringHash.h"
+#include "StringHash.h"
+#include <memory>
+#include <utility>
+#include <wtf/HashMap.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+ typedef Vector<std::pair<String, String> > CrossThreadHTTPHeaderMapData;
+
+ class HTTPHeaderMap : public HashMap<AtomicString, String, CaseFoldingHash> {
+ public:
+ // Gets a copy of the data suitable for passing to another thread.
+ std::auto_ptr<CrossThreadHTTPHeaderMapData> copyData() const;
+
+ void adopt(std::auto_ptr<CrossThreadHTTPHeaderMapData>);
+ };
+
+} // namespace WebCore
+
+#endif // HTTPHeaderMap_h
--- /dev/null
+/*
+ * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HTTPParsers_h
+#define HTTPParsers_h
+
+namespace WebCore {
+
+ class String;
+
+ bool parseHTTPRefresh(const String& refresh, bool fromHttpEquivMeta, double& delay, String& url);
+ String filenameFromHTTPContentDisposition(const String&);
+ String extractMIMETypeFromMediaType(const String&);
+ String extractCharsetFromMediaType(const String&);
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef History_h
+#define History_h
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+ class Frame;
+
+ class History : public RefCounted<History> {
+ public:
+ static PassRefPtr<History> create(Frame* frame) { return adoptRef(new History(frame)); }
+
+ Frame* frame() const;
+ void disconnectFrame();
+
+ unsigned length() const;
+ void back();
+ void forward();
+ void go(int distance);
+
+ private:
+ History(Frame*);
+
+ Frame* m_frame;
+ };
+
+} // namespace WebCore
+
+#endif // History_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HistoryItem_h
+#define HistoryItem_h
+
+#include "IntPoint.h"
+#include "PlatformString.h"
+
+#include "Document.h"
+
+#if PLATFORM(MAC)
+#import <wtf/RetainPtr.h>
+typedef struct objc_object* id;
+#endif
+
+#if PLATFORM(QT)
+#include <QVariant>
+#endif
+
+namespace WebCore {
+
+class CachedPage;
+class Document;
+class FormData;
+class HistoryItem;
+class Image;
+class KURL;
+class ResourceRequest;
+
+typedef Vector<RefPtr<HistoryItem> > HistoryItemVector;
+
+extern void (*notifyHistoryItemChanged)();
+
+class HistoryItem : public RefCounted<HistoryItem> {
+ friend class PageCache;
+
+public:
+ static PassRefPtr<HistoryItem> create() { return adoptRef(new HistoryItem); }
+ static PassRefPtr<HistoryItem> create(const String& urlString, const String& title, double lastVisited)
+ {
+ return adoptRef(new HistoryItem(urlString, title, lastVisited));
+ }
+ static PassRefPtr<HistoryItem> create(const String& urlString, const String& title, const String& alternateTitle, double lastVisited)
+ {
+ return adoptRef(new HistoryItem(urlString, title, alternateTitle, lastVisited));
+ }
+ static PassRefPtr<HistoryItem> create(const KURL& url, const String& target, const String& parent, const String& title)
+ {
+ return adoptRef(new HistoryItem(url, target, parent, title));
+ }
+
+ ~HistoryItem();
+
+ PassRefPtr<HistoryItem> copy() const;
+
+ const String& originalURLString() const;
+ const String& urlString() const;
+ const String& title() const;
+
+ void setInPageCache(bool inPageCache) { m_isInPageCache = inPageCache; }
+ bool isInPageCache() const { return m_isInPageCache; }
+
+ double lastVisitedTime() const;
+
+ void setAlternateTitle(const String& alternateTitle);
+ const String& alternateTitle() const;
+
+ Image* icon() const;
+
+ const String& parent() const;
+ KURL url() const;
+ KURL originalURL() const;
+ const String& referrer() const;
+ const String& target() const;
+ bool isTargetItem() const;
+
+ FormData* formData();
+ String formContentType() const;
+
+ int visitCount() const;
+ bool lastVisitWasFailure() const { return m_lastVisitWasFailure; }
+ bool lastVisitWasHTTPNonGet() const { return m_lastVisitWasHTTPNonGet; }
+
+ void mergeAutoCompleteHints(HistoryItem* otherItem);
+
+ const IntPoint& scrollPoint() const;
+ void setScrollPoint(const IntPoint&);
+ void clearScrollPoint();
+ const Vector<String>& documentState() const;
+ void setDocumentState(const Vector<String>&);
+ void clearDocumentState();
+
+ void setURL(const KURL&);
+ void setURLString(const String&);
+ void setOriginalURLString(const String&);
+ void setReferrer(const String&);
+ void setTarget(const String&);
+ void setParent(const String&);
+ void setTitle(const String&);
+ void setIsTargetItem(bool);
+
+ void setFormInfoFromRequest(const ResourceRequest&);
+
+ void recordInitialVisit();
+
+ void setVisitCount(int);
+ void setLastVisitWasFailure(bool wasFailure) { m_lastVisitWasFailure = wasFailure; }
+ void setLastVisitWasHTTPNonGet(bool wasNotGet) { m_lastVisitWasHTTPNonGet = wasNotGet; }
+
+ void addChildItem(PassRefPtr<HistoryItem>);
+ void setChildItem(PassRefPtr<HistoryItem>);
+ HistoryItem* childItemWithTarget(const String&) const;
+ HistoryItem* targetItem();
+ const HistoryItemVector& children() const;
+ bool hasChildren() const;
+
+ // This should not be called directly for HistoryItems that are already included
+ // in GlobalHistory. The WebKit api for this is to use -[WebHistory setLastVisitedTimeInterval:forItem:] instead.
+ void setLastVisitedTime(double);
+ void visited(const String& title, double time);
+
+ void addRedirectURL(const String&);
+ Vector<String>* redirectURLs() const;
+ void setRedirectURLs(std::auto_ptr<Vector<String> >);
+
+ bool isCurrentDocument(Document*) const;
+
+#if PLATFORM(MAC)
+ id viewState() const;
+ void setViewState(id);
+
+ // Transient properties may be of any ObjC type. They are intended to be used to store state per back/forward list entry.
+ // The properties will not be persisted; when the history item is removed, the properties will be lost.
+ id getTransientProperty(const String&) const;
+ void setTransientProperty(const String&, id);
+#endif
+
+#if PLATFORM(QT)
+ QVariant userData() const { return m_userData; }
+ void setUserData(const QVariant& userData) { m_userData = userData; }
+#endif
+
+#ifndef NDEBUG
+ int showTree() const;
+ int showTreeWithIndent(unsigned indentLevel) const;
+#endif
+
+ void adoptVisitCounts(Vector<int>& dailyCounts, Vector<int>& weeklyCounts);
+ const Vector<int>& dailyVisitCounts() { return m_dailyVisitCounts; }
+ const Vector<int>& weeklyVisitCounts() { return m_weeklyVisitCounts; }
+
+ float scale() const { return m_scale; }
+ bool scaleIsInitial() const { return m_scaleIsInitial; }
+ void setScale(float newScale, bool isInitial) { m_scale = newScale; m_scaleIsInitial = isInitial; }
+ const ViewportArguments& viewportArguments() const { return m_viewportArguments; }
+ void setViewportArguments(const ViewportArguments& newArguments) { m_viewportArguments = newArguments; }
+
+private:
+ HistoryItem();
+ HistoryItem(const String& urlString, const String& title, double lastVisited);
+ HistoryItem(const String& urlString, const String& title, const String& alternateTitle, double lastVisited);
+ HistoryItem(const KURL& url, const String& frameName, const String& parent, const String& title);
+
+ HistoryItem(const HistoryItem&);
+
+ void padDailyCountsForNewVisit(double time);
+ void collapseDailyVisitsToWeekly();
+ void recordVisitAtTime(double);
+
+ HistoryItem* findTargetItem();
+
+ String m_urlString;
+ String m_originalURLString;
+ String m_referrer;
+ String m_target;
+ String m_parent;
+ String m_title;
+ String m_displayTitle;
+
+ double m_lastVisitedTime;
+ bool m_lastVisitWasHTTPNonGet;
+
+ IntPoint m_scrollPoint;
+ Vector<String> m_documentState;
+
+ HistoryItemVector m_children;
+
+ bool m_lastVisitWasFailure;
+ bool m_isInPageCache;
+ bool m_isTargetItem;
+ int m_visitCount;
+ Vector<int> m_dailyVisitCounts;
+ Vector<int> m_weeklyVisitCounts;
+
+ OwnPtr<Vector<String> > m_redirectURLs;
+
+ // info used to repost form data
+ RefPtr<FormData> m_formData;
+ String m_formContentType;
+
+ // PageCache controls these fields.
+ HistoryItem* m_next;
+ HistoryItem* m_prev;
+ RefPtr<CachedPage> m_cachedPage;
+
+ float m_scale;
+ bool m_scaleIsInitial;
+ ViewportArguments m_viewportArguments;
+
+#if PLATFORM(MAC)
+ RetainPtr<id> m_viewState;
+ OwnPtr<HashMap<String, RetainPtr<id> > > m_transientProperties;
+#endif
+
+#if PLATFORM(QT)
+ QVariant m_userData;
+#endif
+}; //class HistoryItem
+
+} //namespace WebCore
+
+#ifndef NDEBUG
+// Outside the WebCore namespace for ease of invocation from gdb.
+extern "C" int showTree(const WebCore::HistoryItem*);
+#endif
+
+#endif // HISTORYITEM_H
--- /dev/null
+/*
+ * This file is part of the HTML rendering engine for KDE.
+ *
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+*/
+#ifndef HitTestRequest_h
+#define HitTestRequest_h
+
+namespace WebCore {
+
+struct HitTestRequest {
+ HitTestRequest(bool r, bool a, bool m = false, bool u = false)
+ : readonly(r)
+ , active(a)
+ , mouseMove(m)
+ , mouseUp(u)
+ {
+ }
+
+ bool readonly;
+ bool active;
+ bool mouseMove;
+ bool mouseUp;
+};
+
+} // namespace WebCore
+
+#endif // HitTestRequest_h
--- /dev/null
+/*
+ * This file is part of the HTML rendering engine for KDE.
+ *
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+*/
+#ifndef HitTestResult_h
+#define HitTestResult_h
+
+#include "IntPoint.h"
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class Element;
+class Frame;
+class Image;
+class KURL;
+class IntRect;
+class Node;
+class Scrollbar;
+class String;
+
+class HitTestResult {
+public:
+ HitTestResult(const IntPoint&);
+ HitTestResult(const HitTestResult&);
+ ~HitTestResult();
+ HitTestResult& operator=(const HitTestResult&);
+
+ Node* innerNode() const { return m_innerNode.get(); }
+ Node* innerNonSharedNode() const { return m_innerNonSharedNode.get(); }
+ IntPoint point() const { return m_point; }
+ IntPoint localPoint() const { return m_localPoint; }
+ Element* URLElement() const { return m_innerURLElement.get(); }
+ Scrollbar* scrollbar() const { return m_scrollbar.get(); }
+ bool isOverWidget() const { return m_isOverWidget; }
+
+ void setToNonShadowAncestor();
+
+ void setInnerNode(Node*);
+ void setInnerNonSharedNode(Node*);
+ void setPoint(const IntPoint& p) { m_point = p; }
+ void setLocalPoint(const IntPoint& p) { m_localPoint = p; }
+ void setURLElement(Element*);
+ void setScrollbar(Scrollbar*);
+ void setIsOverWidget(bool b) { m_isOverWidget = b; }
+
+ Frame* targetFrame() const;
+ IntRect boundingBox() const;
+ bool isSelected() const;
+ String spellingToolTip() const;
+ String title() const;
+ String altDisplayString() const;
+ String titleDisplayString() const;
+ Image* image() const;
+ IntRect imageRect() const;
+ KURL absoluteImageURL() const;
+ KURL absoluteLinkURL() const;
+ String textContent() const;
+ bool isLiveLink() const;
+ bool isContentEditable() const;
+
+private:
+ RefPtr<Node> m_innerNode;
+ RefPtr<Node> m_innerNonSharedNode;
+ IntPoint m_point;
+ IntPoint m_localPoint; // A point in the local coordinate space of m_innerNonSharedNode's renderer. Allows us to efficiently
+ // determine where inside the renderer we hit on subsequent operations.
+ RefPtr<Element> m_innerURLElement;
+ RefPtr<Scrollbar> m_scrollbar;
+ bool m_isOverWidget; // Returns true if we are over a widget (and not in the border/padding area of a RenderWidget for example).
+};
+
+String displayString(const String&, const Node*);
+
+} // namespace WebCore
+
+#endif // HitTestResult_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HostWindow_h
+#define HostWindow_h
+
+#include <wtf/Noncopyable.h>
+#include "IntRect.h"
+#include "Widget.h"
+
+namespace WebCore {
+
+class IntPoint;
+class IntRect;
+
+class HostWindow : Noncopyable {
+public:
+ HostWindow() {}
+ virtual ~HostWindow() {}
+
+ // The repaint method asks the host window to repaint a rect in the window's coordinate space. The
+ // contentChanged boolean indicates whether or not the Web page content actually changed (or if a repaint
+ // of unchanged content is being requested).
+ virtual void repaint(const IntRect&, bool contentChanged, bool immediate = false, bool repaintContentOnly = false) = 0;
+ virtual void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) = 0;
+
+ // The paint method just causes a synchronous update of the window to happen for platforms that need it (Windows).
+ void paint() { repaint(IntRect(), false, true); }
+
+ // Methods for doing coordinate conversions to and from screen coordinates.
+ virtual IntPoint screenToWindow(const IntPoint&) const = 0;
+ virtual IntRect windowToScreen(const IntRect&) const = 0;
+
+ // Method for retrieving the native window.
+ virtual PlatformWidget platformWindow() const = 0;
+
+ // For scrolling a rect into view recursively. Useful in the cases where a WebView is embedded inside some containing
+ // platform-specific ScrollView.
+ virtual void scrollRectIntoView(const IntRect&, const ScrollView*) const = 0;
+};
+
+} // namespace WebCore
+
+#endif // HostWindow_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Icon_h
+#define Icon_h
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Forward.h>
+#include <wtf/Vector.h>
+
+#if PLATFORM(MAC)
+#include <wtf/RetainPtr.h>
+#ifdef __OBJC__
+@class NSImage;
+#else
+class NSImage;
+#endif
+#elif PLATFORM(WIN)
+typedef struct HICON__* HICON;
+#elif PLATFORM(QT)
+#include <QIcon>
+#elif PLATFORM(GTK)
+typedef struct _GdkPixbuf GdkPixbuf;
+#elif PLATFORM(CHROMIUM)
+#include "PlatformIcon.h"
+#endif
+
+namespace WebCore {
+
+class GraphicsContext;
+class IntRect;
+class String;
+
+class Icon : public RefCounted<Icon> {
+public:
+ static PassRefPtr<Icon> createIconForFile(const String& filename);
+ static PassRefPtr<Icon> createIconForFiles(const Vector<String>& filenames);
+
+ ~Icon();
+
+ void paint(GraphicsContext*, const IntRect&);
+
+#if PLATFORM(WIN)
+ static PassRefPtr<Icon> create(HICON hIcon) { return adoptRef(new Icon(hIcon)); }
+#endif
+
+private:
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef IdentityTransformOperation_h
+#define IdentityTransformOperation_h
+
+#include "TransformOperation.h"
+
+namespace WebCore {
+
+class IdentityTransformOperation : public TransformOperation {
+public:
+ static PassRefPtr<IdentityTransformOperation> create()
+ {
+ return adoptRef(new IdentityTransformOperation());
+ }
+
+private:
+ virtual bool isIdentity() const { return true; }
+ virtual OperationType getOperationType() const { return IDENTITY; }
+ virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == IDENTITY; }
+
+ virtual bool operator==(const TransformOperation& o) const
+ {
+ return isSameType(o);
+ }
+
+ virtual bool apply(TransformationMatrix&, const IntSize&) const
+ {
+ return false;
+ }
+
+ virtual PassRefPtr<TransformOperation> blend(const TransformOperation*, double, bool = false)
+ {
+ return this;
+ }
+
+ IdentityTransformOperation()
+ {
+ }
+
+};
+
+} // namespace WebCore
+
+#endif // IdentityTransformOperation_h
--- /dev/null
+/*
+ * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Image_h
+#define Image_h
+
+#include "Color.h"
+#include "GraphicsTypes.h"
+#include "ImageSource.h"
+#include "IntRect.h"
+#include <wtf/RefPtr.h>
+#include <wtf/PassRefPtr.h>
+#include "SharedBuffer.h"
+
+#if PLATFORM(MAC)
+#ifdef __OBJC__
+@class NSImage;
+#else
+class NSImage;
+#endif
+#endif
+
+#if PLATFORM(CG)
+struct CGContext;
+#endif
+
+#if PLATFORM(WIN)
+typedef struct tagSIZE SIZE;
+typedef SIZE* LPSIZE;
+typedef struct HBITMAP__ *HBITMAP;
+#endif
+
+#if PLATFORM(SKIA)
+class NativeImageSkia;
+#endif
+
+#if PLATFORM(QT)
+#include <QPixmap>
+#endif
+
+namespace WebCore {
+
+class TransformationMatrix;
+class FloatPoint;
+class FloatRect;
+class FloatSize;
+class GraphicsContext;
+class SharedBuffer;
+class String;
+
+// This class gets notified when an image creates or destroys decoded frames and when it advances animation frames.
+class ImageObserver;
+
+class Image : public RefCounted<Image> {
+ friend class GeneratedImage;
+ friend class GraphicsContext;
+public:
+ virtual ~Image();
+
+ static PassRefPtr<Image> create(ImageObserver* = 0);
+ static PassRefPtr<Image> loadPlatformResource(const char* name);
+ static bool supportsType(const String&);
+
+ virtual bool isBitmapImage() const { return false; }
+
+ // Derived classes should override this if they can assure that
+ // the image contains only resources from its own security origin.
+ virtual bool hasSingleSecurityOrigin() const { return false; }
+
+ static Image* nullImage();
+ bool isNull() const { return size().isEmpty(); }
+
+ // These are only used for SVGImage right now
+ virtual void setContainerSize(const IntSize&) { }
+ virtual bool usesContainerSize() const { return false; }
+ virtual bool hasRelativeWidth() const { return false; }
+ virtual bool hasRelativeHeight() const { return false; }
+
+ virtual IntSize size() const = 0;
+ IntRect rect() const { return IntRect(IntPoint(), size()); }
+ int width() const { return size().width(); }
+ int height() const { return size().height(); }
+
+ bool setData(PassRefPtr<SharedBuffer> data, bool allDataReceived);
+ virtual bool dataChanged(bool /*allDataReceived*/) { return false; }
+
+ virtual String filenameExtension() const { return String(); } // null string if unknown
+
+ virtual void destroyDecodedData(bool destroyAll = true) = 0;
+ virtual unsigned decodedSize() const = 0;
+
+ SharedBuffer* data() { return m_data.get(); }
+
+ // Animation begins whenever someone draws the image, so startAnimation() is not normally called.
+ // It will automatically pause once all observers no longer want to render the image anywhere.
+ virtual void startAnimation(bool /*catchUpIfNecessary*/ = true) { }
+ virtual void stopAnimation() {}
+ virtual void resetAnimation() {}
+
+ // Typically the CachedImage that owns us.
+ ImageObserver* imageObserver() const { return m_imageObserver; }
+
+ enum TileRule { StretchTile, RoundTile, RepeatTile };
+
+ virtual NativeImagePtr nativeImageForCurrentFrame() { return 0; }
+
+#if PLATFORM(MAC)
+ // Accessors for native image formats.
+ virtual NSImage* getNSImage() { return 0; }
+ virtual CFDataRef getTIFFRepresentation() { return 0; }
+#endif
+
+#if PLATFORM(CG)
+ virtual CGImageRef getCGImageRef() { return 0; }
+#endif
+
+#if PLATFORM(WIN)
+ virtual bool getHBITMAP(HBITMAP) { return false; }
+ virtual bool getHBITMAPOfSize(HBITMAP, LPSIZE) { return false; }
+#endif
+
+ virtual unsigned animatedImageSize() { return 0; }
+ virtual void disableImageAnimation() { }
+
+protected:
+ Image(ImageObserver* = 0);
+
+ static void fillWithSolidColor(GraphicsContext* ctxt, const FloatRect& dstRect, const Color& color, CompositeOperator op);
+
+#if PLATFORM(WIN)
+ virtual void drawFrameMatchingSourceSize(GraphicsContext*, const FloatRect& dstRect, const IntSize& srcSize, CompositeOperator) { }
+#endif
+ virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator) = 0;
+ void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatPoint& srcPoint, const FloatSize& tileSize, CompositeOperator);
+ void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, TileRule hRule, TileRule vRule, CompositeOperator);
+
+ // Supporting tiled drawing
+ virtual bool mayFillWithSolidColor() const { return false; }
+ virtual Color solidColor() const { return Color(); }
+
+ virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const TransformationMatrix& patternTransform,
+ const FloatPoint& phase, CompositeOperator, const FloatRect& destRect);
+#if PLATFORM(CG)
+ // These are private to CG. Ideally they would be only in the .cpp file, but the callback requires access
+ // to the private function nativeImageForCurrentFrame()
+ static void drawPatternCallback(void* info, CGContext*);
+#endif
+
+protected:
+ RefPtr<SharedBuffer> m_data; // The encoded raw data for the image.
+ ImageObserver* m_imageObserver;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ImageBuffer_h
+#define ImageBuffer_h
+
+#include "TransformationMatrix.h"
+#include "Image.h"
+#include "IntSize.h"
+#include "ImageBufferData.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/PassRefPtr.h>
+#include <memory>
+
+namespace WebCore {
+
+ class GraphicsContext;
+ class ImageData;
+ class IntPoint;
+ class IntRect;
+ class String;
+
+ class ImageBuffer : Noncopyable {
+ public:
+ // Will return a null pointer on allocation failure.
+ static std::auto_ptr<ImageBuffer> create(const IntSize& size, bool grayScale)
+ {
+ bool success = false;
+ std::auto_ptr<ImageBuffer> buf(new ImageBuffer(size, grayScale, success));
+ if (success)
+ return buf;
+ return std::auto_ptr<ImageBuffer>();
+ }
+
+ ~ImageBuffer();
+
+ const IntSize& size() const { return m_size; }
+ GraphicsContext* context() const;
+
+ Image* image() const;
+
+ void clearImage() { m_image.clear(); }
+
+ PassRefPtr<ImageData> getImageData(const IntRect& rect) const;
+ void putImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint);
+
+ String toDataURL(const String& mimeType) const;
+#if !PLATFORM(CG)
+ TransformationMatrix baseTransform() const { return TransformationMatrix(); }
+#else
+ TransformationMatrix baseTransform() const { return TransformationMatrix(1, 0, 0, -1, 0, m_size.height()); }
+#endif
+ private:
+ ImageBufferData m_data;
+
+ IntSize m_size;
+ OwnPtr<GraphicsContext> m_context;
+ mutable RefPtr<Image> m_image;
+
+ // This constructor will place its succes into the given out-variable
+ // so that create() knows when it should return failure.
+ ImageBuffer(const IntSize&, bool grayScale, bool& success);
+ };
+
+} // namespace WebCore
+
+#endif // ImageBuffer_h
--- /dev/null
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ImageData_h
+#define ImageData_h
+
+#include "CanvasPixelArray.h"
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+ class ImageData : public RefCounted<ImageData> {
+ public:
+ static PassRefPtr<ImageData> create(unsigned width, unsigned height);
+
+ unsigned width() const { return m_width; }
+ unsigned height() const { return m_height; }
+ CanvasPixelArray* data() const { return m_data.get(); }
+
+ private:
+ ImageData(unsigned width, unsigned height);
+ unsigned m_width;
+ unsigned m_height;
+ RefPtr<CanvasPixelArray> m_data;
+ };
+
+} // namespace WebCore
+
+#endif // ImageData_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * 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 ImageDocument_h
+#define ImageDocument_h
+
+#include "HTMLDocument.h"
+
+namespace WebCore {
+
+class ImageDocumentElement;
+
+class ImageDocument : public HTMLDocument {
+public:
+ static PassRefPtr<ImageDocument> create(Frame* frame)
+ {
+ return new ImageDocument(frame);
+ }
+
+ CachedImage* cachedImage();
+ ImageDocumentElement* imageElement() const { return m_imageElement; }
+ void disconnectImageElement() { m_imageElement = 0; }
+
+ void windowSizeChanged();
+ void imageChanged();
+ void imageClicked(int x, int y);
+
+private:
+ ImageDocument(Frame*);
+
+ virtual Tokenizer* createTokenizer();
+ virtual bool isImageDocument() const { return true; }
+
+ void createDocumentStructure();
+ void resizeImageToFit();
+ void restoreImageSize();
+ bool imageFitsInWindow() const;
+ bool shouldShrinkToFit() const;
+ float scale() const;
+
+ ImageDocumentElement* m_imageElement;
+
+ // Whether enough of the image has been loaded to determine its size
+ bool m_imageSizeIsKnown;
+
+ // Whether the image is shrunk to fit or not
+ bool m_didShrinkImage;
+
+ // Whether the image should be shrunk or not
+ bool m_shouldShrinkImage;
+};
+
+}
+
+#endif // ImageDocument_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2004 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ImageLoader_h
+#define ImageLoader_h
+
+#include "AtomicString.h"
+#include "CachedResourceClient.h"
+#include "CachedResourceHandle.h"
+
+namespace WebCore {
+
+class Element;
+
+class ImageLoader : public CachedResourceClient {
+public:
+ ImageLoader(Element*);
+ virtual ~ImageLoader();
+
+ void updateFromElement();
+
+ // This method should be called after the 'src' attribute
+ // is set (even when it is not modified) to force the update
+ // and match Firefox and Opera.
+ void updateFromElementIgnoringPreviousError();
+
+ virtual void dispatchLoadEvent() = 0;
+ virtual String sourceURI(const AtomicString&) const = 0;
+
+ Element* element() const { return m_element; }
+ bool imageComplete() const { return m_imageComplete; }
+
+ CachedImage* image() const { return m_image.get(); }
+ void setImage(CachedImage*);
+
+ void setLoadManually(bool loadManually) { m_loadManually = loadManually; }
+
+ // CachedResourceClient API
+ virtual void notifyFinished(CachedResource*);
+
+ virtual bool memoryLimitReached();
+
+ bool haveFiredLoadEvent() const { return m_firedLoad; }
+protected:
+ void setLoadingImage(CachedImage*);
+
+ void setHaveFiredLoadEvent(bool firedLoad) { m_firedLoad = firedLoad; }
+
+private:
+ Element* m_element;
+ CachedResourceHandle<CachedImage> m_image;
+ AtomicString m_failedLoadURL;
+ bool m_firedLoad : 1;
+ bool m_imageComplete : 1;
+ bool m_loadManually : 1;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ImageObserver_h
+#define ImageObserver_h
+
+namespace WebCore {
+
+class IntSize;
+class Image;
+class IntRect;
+
+// Interface for notification about changes to an image, including decoding,
+// drawing, and animating.
+class ImageObserver {
+protected:
+ virtual ~ImageObserver() {}
+public:
+ virtual void decodedSizeChanged(const Image*, int delta) = 0;
+ virtual void didDraw(const Image*) = 0;
+
+ virtual bool shouldPauseAnimation(const Image*) = 0;
+ virtual void animationAdvanced(const Image*) = 0;
+
+ virtual void changedInRect(const Image*, const IntRect&) = 0;
+
+ virtual bool shouldDecodeFrame(const Image* image, const IntSize& frameSize) = 0;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ImageSource_h
+#define ImageSource_h
+
+#include <wtf/Noncopyable.h>
+#include <wtf/Vector.h>
+
+#if PLATFORM(WX)
+class wxBitmap;
+#elif PLATFORM(CG)
+typedef struct CGImageSource* CGImageSourceRef;
+typedef struct CGImage* CGImageRef;
+typedef const struct __CFData* CFDataRef;
+#elif PLATFORM(QT)
+#include <qglobal.h>
+QT_BEGIN_NAMESPACE
+class QPixmap;
+QT_END_NAMESPACE
+#elif PLATFORM(CAIRO)
+struct _cairo_surface;
+typedef struct _cairo_surface cairo_surface_t;
+#elif PLATFORM(SKIA)
+class NativeImageSkia;
+#endif
+
+namespace WebCore {
+
+class IntSize;
+class SharedBuffer;
+class String;
+
+#if PLATFORM(WX)
+class ImageDecoder;
+typedef ImageDecoder* NativeImageSourcePtr;
+typedef const Vector<char>* NativeBytePtr;
+typedef wxBitmap* NativeImagePtr;
+#elif PLATFORM(CG)
+typedef CGImageSourceRef NativeImageSourcePtr;
+typedef CGImageRef NativeImagePtr;
+#elif PLATFORM(QT)
+class ImageDecoderQt;
+typedef ImageDecoderQt* NativeImageSourcePtr;
+typedef QPixmap* NativeImagePtr;
+#elif PLATFORM(CAIRO)
+class ImageDecoder;
+typedef ImageDecoder* NativeImageSourcePtr;
+typedef cairo_surface_t* NativeImagePtr;
+#elif PLATFORM(SKIA)
+class ImageDecoder;
+typedef ImageDecoder* NativeImageSourcePtr;
+typedef NativeImageSkia* NativeImagePtr;
+#endif
+
+const int cAnimationLoopOnce = -1;
+const int cAnimationNone = -2;
+
+class ImageSource : Noncopyable {
+public:
+ ImageSource();
+ ~ImageSource();
+
+ // Tells the ImageSource that the Image no longer cares about decoded frame
+ // data -- at all (if |destroyAll| is true), or before frame
+ // |clearBeforeFrame| (if |destroyAll| is false). The ImageSource should
+ // delete cached decoded data for these frames where possible to keep memory
+ // usage low. When |destroyAll| is true, the ImageSource should also reset
+ // any local state so that decoding can begin again.
+ //
+ // Implementations that delete less than what's specified above waste
+ // memory. Implementations that delete more may burn CPU re-decoding frames
+ // that could otherwise have been cached, or encounter errors if they're
+ // asked to decode frames they can't decode due to the loss of previous
+ // decoded frames.
+ //
+ // Callers should not call clear(false, n) and subsequently call
+ // createFrameAtIndex(m) with m < n, unless they first call clear(true).
+ // This ensures that stateful ImageSources/decoders will work properly.
+ //
+ // The |data| and |allDataReceived| parameters should be supplied by callers
+ // who set |destroyAll| to true if they wish to be able to continue using
+ // the ImageSource. This way implementations which choose to destroy their
+ // decoders in some cases can reconstruct them correctly.
+ void clear(bool destroyAll,
+ size_t clearBeforeFrame = 0,
+ SharedBuffer* data = NULL,
+ bool allDataReceived = false);
+
+ bool initialized() const;
+
+ void setData(SharedBuffer* data, bool allDataReceived);
+ String filenameExtension() const;
+
+ bool isSizeAvailable();
+ IntSize size() const;
+ IntSize frameSizeAtIndex(size_t) const;
+#if ENABLE(RESPECT_EXIF_ORIENTATION)
+ int orientationAtIndex(size_t) const; // EXIF image orientation
+#endif
+
+ int repetitionCount();
+
+ size_t frameCount() const;
+
+ // Callers should not call this after calling clear() with a higher index;
+ // see comments on clear() above.
+ NativeImagePtr createFrameAtIndex(size_t, float scaleHint, float* actualScaleOut, ssize_t* bytesOut);
+
+ float frameDurationAtIndex(size_t);
+ bool frameHasAlphaAtIndex(size_t); // Whether or not the frame actually used any alpha.
+ bool frameIsCompleteAtIndex(size_t); // Whether or not the frame is completely decoded.
+
+ // FIXME: This is protected only to allow ImageSourceSkia to set ICO decoder
+ // with a preferred size. See ImageSourceSkia.h for discussion.
+protected:
+ NativeImageSourcePtr m_decoder;
+ mutable int m_baseSubsampling;
+ mutable bool m_isProgressive;
+ CFDictionaryRef imageSourceOptions(int subsampling = 0) const;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef IndentOutdentCommand_h
+#define IndentOutdentCommand_h
+
+#include "CompositeEditCommand.h"
+
+namespace WebCore {
+
+class IndentOutdentCommand : public CompositeEditCommand {
+public:
+ enum EIndentType { Indent, Outdent };
+ static PassRefPtr<IndentOutdentCommand> create(Document* document, EIndentType type, int marginInPixels = 0)
+ {
+ return adoptRef(new IndentOutdentCommand(document, type, marginInPixels));
+ }
+
+ virtual bool preservesTypingStyle() const { return true; }
+
+private:
+ IndentOutdentCommand(Document*, EIndentType, int marginInPixels);
+
+ virtual void doApply();
+ virtual EditAction editingAction() const { return m_typeOfAction == Indent ? EditActionIndent : EditActionOutdent; }
+
+ void indentRegion();
+ void outdentRegion();
+ void outdentParagraph();
+ PassRefPtr<Element> prepareBlockquoteLevelForInsertion(VisiblePosition&, RefPtr<Element>&);
+
+ EIndentType m_typeOfAction;
+ int m_marginInPixels;
+};
+
+} // namespace WebCore
+
+#endif // IndentOutdentCommand_h
--- /dev/null
+/*
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef InlineBox_h
+#define InlineBox_h
+
+#include "RenderBox.h"
+#include "TextDirection.h"
+
+namespace WebCore {
+
+class HitTestResult;
+class RootInlineBox;
+
+struct HitTestRequest;
+
+// InlineBox represents a rectangle that occurs on a line. It corresponds to
+// some RenderObject (i.e., it represents a portion of that RenderObject).
+class InlineBox {
+public:
+ InlineBox(RenderObject* obj)
+ : m_object(obj)
+ , m_x(0)
+ , m_y(0)
+ , m_width(0)
+ , m_height(0)
+ , m_baseline(0)
+ , m_next(0)
+ , m_prev(0)
+ , m_parent(0)
+ , m_firstLine(false)
+ , m_constructed(false)
+ , m_bidiEmbeddingLevel(0)
+ , m_dirty(false)
+ , m_extracted(false)
+ , m_includeLeftEdge(false)
+ , m_includeRightEdge(false)
+ , m_hasTextChildren(true)
+ , m_endsWithBreak(false)
+ , m_hasSelectedChildren(false)
+ , m_hasEllipsisBox(false)
+ , m_dirOverride(false)
+ , m_treatAsText(true)
+ , m_determinedIfNextOnLineExists(false)
+ , m_determinedIfPrevOnLineExists(false)
+ , m_nextOnLineExists(false)
+ , m_prevOnLineExists(false)
+ , m_toAdd(0)
+#ifndef NDEBUG
+ , m_hasBadParent(false)
+#endif
+ {
+ }
+
+ InlineBox(RenderObject* obj, int x, int y, int width, int height, int baseline, bool firstLine, bool constructed,
+ bool dirty, bool extracted, InlineBox* next, InlineBox* prev, InlineFlowBox* parent)
+ : m_object(obj)
+ , m_x(x)
+ , m_y(y)
+ , m_width(width)
+ , m_height(height)
+ , m_baseline(baseline)
+ , m_next(next)
+ , m_prev(prev)
+ , m_parent(parent)
+ , m_firstLine(firstLine)
+ , m_constructed(constructed)
+ , m_bidiEmbeddingLevel(0)
+ , m_dirty(dirty)
+ , m_extracted(extracted)
+ , m_includeLeftEdge(false)
+ , m_includeRightEdge(false)
+ , m_hasTextChildren(true)
+ , m_endsWithBreak(false)
+ , m_hasSelectedChildren(false)
+ , m_hasEllipsisBox(false)
+ , m_dirOverride(false)
+ , m_treatAsText(true)
+ , m_determinedIfNextOnLineExists(false)
+ , m_determinedIfPrevOnLineExists(false)
+ , m_nextOnLineExists(false)
+ , m_prevOnLineExists(false)
+ , m_toAdd(0)
+#ifndef NDEBUG
+ , m_hasBadParent(false)
+#endif
+ {
+ }
+
+ virtual ~InlineBox();
+
+ virtual void destroy(RenderArena*);
+
+ virtual void deleteLine(RenderArena*);
+ virtual void extractLine();
+ virtual void attachLine();
+
+ virtual bool isLineBreak() const { return false; }
+
+ virtual void adjustPosition(int dx, int dy);
+
+ virtual void paint(RenderObject::PaintInfo&, int tx, int ty);
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty);
+
+ // Overloaded new operator.
+ void* operator new(size_t, RenderArena*) throw();
+
+ // Overridden to prevent the normal delete from being called.
+ void operator delete(void*, size_t);
+
+private:
+ // The normal operator new is disallowed.
+ void* operator new(size_t) throw();
+
+public:
+#ifndef NDEBUG
+ void showTreeForThis() const;
+#endif
+ virtual bool isInlineBox() { return false; }
+ virtual bool isInlineFlowBox() { return false; }
+ virtual bool isContainer() { return false; }
+ virtual bool isInlineTextBox() { return false; }
+ virtual bool isRootInlineBox() { return false; }
+#if ENABLE(SVG)
+ virtual bool isSVGRootInlineBox() { return false; }
+#endif
+ virtual bool isText() const { return false; }
+
+ bool isConstructed() { return m_constructed; }
+ virtual void setConstructed()
+ {
+ m_constructed = true;
+ if (m_next)
+ m_next->setConstructed();
+ }
+
+ void setExtracted(bool b = true) { m_extracted = b; }
+
+ void setFirstLineStyleBit(bool f) { m_firstLine = f; }
+ bool isFirstLineStyle() const { return m_firstLine; }
+
+ void remove();
+
+ InlineBox* nextOnLine() const { return m_next; }
+ InlineBox* prevOnLine() const { return m_prev; }
+ void setNextOnLine(InlineBox* next)
+ {
+ ASSERT(m_parent || !next);
+ m_next = next;
+ }
+ void setPrevOnLine(InlineBox* prev)
+ {
+ ASSERT(m_parent || !prev);
+ m_prev = prev;
+ }
+ bool nextOnLineExists() const;
+ bool prevOnLineExists() const;
+
+ virtual InlineBox* firstLeafChild();
+ virtual InlineBox* lastLeafChild();
+ InlineBox* nextLeafChild();
+ InlineBox* prevLeafChild();
+
+ RenderObject* object() const { return m_object; }
+
+ InlineFlowBox* parent() const
+ {
+ ASSERT(!m_hasBadParent);
+ return m_parent;
+ }
+ void setParent(InlineFlowBox* par) { m_parent = par; }
+
+ RootInlineBox* root();
+
+ void setWidth(int w) { m_width = w; }
+ int width() const { return m_width; }
+
+ void setXPos(int x) { m_x = x; }
+ int xPos() const { return m_x; }
+
+ void setYPos(int y) { m_y = y; }
+ int yPos() const { return m_y; }
+
+ void setHeight(int h) { m_height = h; }
+ int height() const { return m_height; }
+
+ void setBaseline(int b) { m_baseline = b; }
+ int baseline() const { return m_baseline; }
+
+ bool hasTextChildren() const { return m_hasTextChildren; }
+
+ virtual int topOverflow() { return yPos(); }
+ virtual int bottomOverflow() { return yPos() + height(); }
+ virtual int leftOverflow() { return xPos(); }
+ virtual int rightOverflow() { return xPos() + width(); }
+
+ virtual int caretMinOffset() const;
+ virtual int caretMaxOffset() const;
+ virtual unsigned caretMaxRenderedOffset() const;
+
+ unsigned char bidiLevel() const { return m_bidiEmbeddingLevel; }
+ void setBidiLevel(unsigned char level) { m_bidiEmbeddingLevel = level; }
+ TextDirection direction() const { return m_bidiEmbeddingLevel % 2 ? RTL : LTR; }
+ int caretLeftmostOffset() const { return direction() == LTR ? caretMinOffset() : caretMaxOffset(); }
+ int caretRightmostOffset() const { return direction() == LTR ? caretMaxOffset() : caretMinOffset(); }
+
+ virtual void clearTruncation() { }
+
+ bool isDirty() const { return m_dirty; }
+ void markDirty(bool dirty = true) { m_dirty = dirty; }
+
+ void dirtyLineBoxes();
+
+ virtual RenderObject::SelectionState selectionState();
+
+ virtual bool canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWidth);
+ virtual int placeEllipsisBox(bool ltr, int blockEdge, int ellipsisWidth, bool&);
+
+ void setHasBadParent();
+
+ int toAdd() const { return m_toAdd; }
+
+ bool visibleToHitTesting() const { return object()->style()->visibility() == VISIBLE && object()->style()->pointerEvents() != PE_NONE; }
+
+ // Use with caution! The type is not checked!
+ RenderBox* renderBox() const { return toRenderBox(m_object); }
+
+public:
+ RenderObject* m_object;
+
+ int m_x;
+ int m_y;
+ int m_width;
+ int m_height;
+ int m_baseline;
+
+private:
+ InlineBox* m_next; // The next element on the same line as us.
+ InlineBox* m_prev; // The previous element on the same line as us.
+
+ InlineFlowBox* m_parent; // The box that contains us.
+
+ // Some of these bits are actually for subclasses and moved here to compact the structures.
+
+ // for this class
+protected:
+ bool m_firstLine : 1;
+private:
+ bool m_constructed : 1;
+ unsigned char m_bidiEmbeddingLevel : 6;
+protected:
+ bool m_dirty : 1;
+ bool m_extracted : 1;
+
+ // for InlineFlowBox
+ bool m_includeLeftEdge : 1;
+ bool m_includeRightEdge : 1;
+ bool m_hasTextChildren : 1;
+
+ // for RootInlineBox
+ bool m_endsWithBreak : 1; // Whether the line ends with a <br>.
+ bool m_hasSelectedChildren : 1; // Whether we have any children selected (this bit will also be set if the <br> that terminates our line is selected).
+ bool m_hasEllipsisBox : 1;
+
+ // for InlineTextBox
+public:
+ bool m_dirOverride : 1;
+ bool m_treatAsText : 1; // Whether or not to treat a <br> as text for the purposes of line height.
+protected:
+ mutable bool m_determinedIfNextOnLineExists : 1;
+ mutable bool m_determinedIfPrevOnLineExists : 1;
+ mutable bool m_nextOnLineExists : 1;
+ mutable bool m_prevOnLineExists : 1;
+ int m_toAdd : 13; // for justified text
+
+#ifndef NDEBUG
+private:
+ bool m_hasBadParent;
+#endif
+};
+
+#ifdef NDEBUG
+inline InlineBox::~InlineBox()
+{
+}
+#endif
+
+inline void InlineBox::setHasBadParent()
+{
+#ifndef NDEBUG
+ m_hasBadParent = true;
+#endif
+}
+
+} // namespace WebCore
+
+#ifndef NDEBUG
+// Outside the WebCore namespace for ease of invocation from gdb.
+void showTree(const WebCore::InlineBox*);
+#endif
+
+#endif // InlineBox_h
--- /dev/null
+/*
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef InlineFlowBox_h
+#define InlineFlowBox_h
+
+#include "InlineRunBox.h"
+
+namespace WebCore {
+
+class HitTestResult;
+
+struct HitTestRequest;
+
+class InlineFlowBox : public InlineRunBox {
+public:
+ InlineFlowBox(RenderObject* obj)
+ : InlineRunBox(obj)
+ , m_firstChild(0)
+ , m_lastChild(0)
+ , m_maxHorizontalVisualOverflow(0)
+#ifndef NDEBUG
+ , m_hasBadChildList(false)
+#endif
+ {
+ // Internet Explorer and Firefox always create a marker for list items, even when the list-style-type is none. We do not make a marker
+ // in the list-style-type: none case, since it is wasteful to do so. However, in order to match other browsers we have to pretend like
+ // an invisible marker exists. The side effect of having an invisible marker is that the quirks mode behavior of shrinking lines with no
+ // text children must not apply. This change also means that gaps will exist between image bullet list items. Even when the list bullet
+ // is an image, the line is still considered to be immune from the quirk.
+ m_hasTextChildren = obj->style()->display() == LIST_ITEM;
+ }
+
+#ifndef NDEBUG
+ virtual ~InlineFlowBox();
+#endif
+
+ RenderFlow* flowObject();
+
+ virtual bool isInlineFlowBox() { return true; }
+
+ InlineFlowBox* prevFlowBox() const { return static_cast<InlineFlowBox*>(m_prevLine); }
+ InlineFlowBox* nextFlowBox() const { return static_cast<InlineFlowBox*>(m_nextLine); }
+
+ InlineBox* firstChild() { checkConsistency(); return m_firstChild; }
+ InlineBox* lastChild() { checkConsistency(); return m_lastChild; }
+
+ virtual InlineBox* firstLeafChild();
+ virtual InlineBox* lastLeafChild();
+ InlineBox* firstLeafChildAfterBox(InlineBox* start = 0);
+ InlineBox* lastLeafChildBeforeBox(InlineBox* start = 0);
+
+ virtual void setConstructed()
+ {
+ InlineBox::setConstructed();
+ if (firstChild())
+ firstChild()->setConstructed();
+ }
+
+ void addToLine(InlineBox* child);
+ virtual void deleteLine(RenderArena*);
+ virtual void extractLine();
+ virtual void attachLine();
+ virtual void adjustPosition(int dx, int dy);
+
+ virtual void clearTruncation();
+
+ virtual void paintBoxDecorations(RenderObject::PaintInfo&, int tx, int ty);
+ virtual void paintMask(RenderObject::PaintInfo&, int tx, int ty);
+ void paintFillLayers(const RenderObject::PaintInfo&, const Color&, const FillLayer*,
+ int my, int mh, int tx, int ty, int w, int h, CompositeOperator = CompositeSourceOver);
+ void paintFillLayer(const RenderObject::PaintInfo&, const Color&, const FillLayer*,
+ int my, int mh, int tx, int ty, int w, int h, CompositeOperator = CompositeSourceOver);
+ void paintBoxShadow(GraphicsContext*, RenderStyle*, int tx, int ty, int w, int h);
+ virtual void paintTextDecorations(RenderObject::PaintInfo&, int tx, int ty, bool paintedChildren = false);
+ virtual void paint(RenderObject::PaintInfo&, int tx, int ty);
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty);
+
+ int marginBorderPaddingLeft();
+ int marginBorderPaddingRight();
+ int marginLeft();
+ int marginRight();
+ int borderLeft() { if (includeLeftEdge()) return renderBox()->borderLeft(); return 0; }
+ int borderRight() { if (includeRightEdge()) return renderBox()->borderRight(); return 0; }
+ int paddingLeft() { if (includeLeftEdge()) return renderBox()->paddingLeft(); return 0; }
+ int paddingRight() { if (includeRightEdge()) return renderBox()->paddingRight(); return 0; }
+
+ bool includeLeftEdge() { return m_includeLeftEdge; }
+ bool includeRightEdge() { return m_includeRightEdge; }
+ void setEdges(bool includeLeft, bool includeRight)
+ {
+ m_includeLeftEdge = includeLeft;
+ m_includeRightEdge = includeRight;
+ }
+
+ // Helper functions used during line construction and placement.
+ void determineSpacingForFlowBoxes(bool lastLine, RenderObject* endObject);
+ int getFlowSpacingWidth();
+ bool onEndChain(RenderObject* endObject);
+ virtual int placeBoxesHorizontally(int x, int& leftPosition, int& rightPosition, bool& needsWordSpacing);
+ virtual int verticallyAlignBoxes(int heightOfBlock);
+ void computeLogicalBoxHeights(int& maxPositionTop, int& maxPositionBottom,
+ int& maxAscent, int& maxDescent, bool strictMode);
+ void adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent,
+ int maxPositionTop, int maxPositionBottom);
+ void placeBoxesVertically(int y, int maxHeight, int maxAscent, bool strictMode,
+ int& topPosition, int& bottomPosition, int& selectionTop, int& selectionBottom);
+ void shrinkBoxesWithNoTextChildren(int topPosition, int bottomPosition);
+
+ virtual void setVerticalOverflowPositions(int /*top*/, int /*bottom*/) { }
+ virtual void setVerticalSelectionPositions(int /*top*/, int /*bottom*/) { }
+ int maxHorizontalVisualOverflow() const { return m_maxHorizontalVisualOverflow; }
+
+ void removeChild(InlineBox* child);
+
+ virtual RenderObject::SelectionState selectionState();
+
+ virtual bool canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWidth);
+ virtual int placeEllipsisBox(bool ltr, int blockEdge, int ellipsisWidth, bool&);
+
+ void checkConsistency() const;
+ void setHasBadChildList();
+
+private:
+ InlineBox* m_firstChild;
+ InlineBox* m_lastChild;
+ int m_maxHorizontalVisualOverflow;
+
+#ifndef NDEBUG
+ bool m_hasBadChildList;
+#endif
+};
+
+#ifdef NDEBUG
+inline void InlineFlowBox::checkConsistency() const
+{
+}
+#endif
+
+inline void InlineFlowBox::setHasBadChildList()
+{
+#ifndef NDEBUG
+ m_hasBadChildList = true;
+#endif
+}
+
+} // namespace WebCore
+
+#ifndef NDEBUG
+// Outside the WebCore namespace for ease of invocation from gdb.
+void showTree(const WebCore::InlineFlowBox*);
+#endif
+
+#endif // InlineFlowBox_h
--- /dev/null
+/*
+ * This file is part of the line box implementation for KDE.
+ *
+ * Copyright (C) 2003, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef InlineRunBox_h
+#define InlineRunBox_h
+
+#include "InlineBox.h"
+
+namespace WebCore {
+
+class InlineRunBox : public InlineBox {
+public:
+ InlineRunBox(RenderObject* obj)
+ : InlineBox(obj)
+ , m_prevLine(0)
+ , m_nextLine(0)
+ {
+ }
+
+ InlineRunBox* prevLineBox() const { return m_prevLine; }
+ InlineRunBox* nextLineBox() const { return m_nextLine; }
+ void setNextLineBox(InlineRunBox* n) { m_nextLine = n; }
+ void setPreviousLineBox(InlineRunBox* p) { m_prevLine = p; }
+
+ virtual void paintBoxDecorations(RenderObject::PaintInfo&, int /*tx*/, int /*ty*/) { }
+ virtual void paintTextDecorations(RenderObject::PaintInfo&, int /*tx*/, int /*ty*/, bool /*paintedChildren*/ = false) { }
+
+protected:
+ InlineRunBox* m_prevLine; // The previous box that also uses our RenderObject
+ InlineRunBox* m_nextLine; // The next box that also uses our RenderObject
+};
+
+} // namespace WebCore
+
+#endif // InlineRunBox_h
--- /dev/null
+/*
+ * (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef InlineTextBox_h
+#define InlineTextBox_h
+
+#include "InlineRunBox.h"
+#include "RenderText.h" // so textObject() can be inline
+
+namespace WebCore {
+
+struct CompositionUnderline;
+
+const unsigned short cNoTruncation = USHRT_MAX;
+const unsigned short cFullTruncation = USHRT_MAX - 1;
+
+// Helper functions shared by InlineTextBox / SVGRootInlineBox
+void updateGraphicsContext(GraphicsContext* context, const Color& fillColor, const Color& strokeColor, float strokeThickness);
+Color correctedTextColor(Color textColor, Color backgroundColor);
+
+class InlineTextBox : public InlineRunBox {
+public:
+ InlineTextBox(RenderObject* obj)
+ : InlineRunBox(obj)
+ , m_start(0)
+ , m_len(0)
+ , m_truncation(cNoTruncation)
+ {
+ }
+
+ InlineTextBox* nextTextBox() const { return static_cast<InlineTextBox*>(nextLineBox()); }
+ InlineTextBox* prevTextBox() const { return static_cast<InlineTextBox*>(prevLineBox()); }
+
+ unsigned start() const { return m_start; }
+ unsigned end() const { return m_len ? m_start + m_len - 1 : m_start; }
+ unsigned len() const { return m_len; }
+
+ void setStart(unsigned start) { m_start = start; }
+ void setLen(unsigned len) { m_len = len; }
+
+ void offsetRun(int d) { m_start += d; }
+
+private:
+ virtual int selectionTop();
+ virtual int selectionHeight();
+
+public:
+ virtual IntRect selectionRect(int absx, int absy, int startPos, int endPos);
+ bool isSelected(int startPos, int endPos) const;
+ void selectionStartEnd(int& sPos, int& ePos);
+
+private:
+ virtual void paint(RenderObject::PaintInfo&, int tx, int ty);
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty);
+
+public:
+ RenderText* textObject() const;
+
+private:
+ virtual void deleteLine(RenderArena*);
+ virtual void extractLine();
+ virtual void attachLine();
+
+public:
+ virtual RenderObject::SelectionState selectionState();
+
+private:
+ virtual void clearTruncation() { m_truncation = cNoTruncation; }
+ virtual int placeEllipsisBox(bool ltr, int blockEdge, int ellipsisWidth, bool& foundBox);
+
+public:
+ virtual bool isLineBreak() const;
+
+ void setSpaceAdd(int add) { m_width -= m_toAdd; m_toAdd = add; m_width += m_toAdd; }
+
+private:
+ virtual bool isInlineTextBox() { return true; }
+
+public:
+ virtual bool isText() const { return m_treatAsText; }
+ void setIsText(bool b) { m_treatAsText = b; }
+
+ virtual int caretMinOffset() const;
+ virtual int caretMaxOffset() const;
+
+private:
+ virtual unsigned caretMaxRenderedOffset() const;
+
+ int textPos() const;
+
+public:
+ virtual int offsetForPosition(int x, bool includePartialGlyphs = true) const;
+ virtual int positionForOffset(int offset) const;
+
+ bool containsCaretOffset(int offset) const; // false for offset after line break
+
+private:
+ int m_start;
+ unsigned short m_len;
+
+ unsigned short m_truncation; // Where to truncate when text overflow is applied. We use special constants to
+ // denote no truncation (the whole run paints) and full truncation (nothing paints at all).
+
+protected:
+ void paintCompositionBackground(GraphicsContext*, int tx, int ty, RenderStyle*, const Font&, int startPos, int endPos);
+ void paintDocumentMarkers(GraphicsContext*, int tx, int ty, RenderStyle*, const Font&, bool background);
+ void paintCompositionUnderline(GraphicsContext*, int tx, int ty, const CompositionUnderline&);
+#if PLATFORM(MAC)
+ void paintCustomHighlight(int tx, int ty, const AtomicString& type);
+#endif
+
+private:
+ void paintDecoration(GraphicsContext*, int tx, int ty, int decoration, ShadowData*);
+ void paintSelection(GraphicsContext*, int tx, int ty, RenderStyle*, const Font&);
+ void paintSpellingOrGrammarMarker(GraphicsContext*, int tx, int ty, DocumentMarker, RenderStyle*, const Font&, bool grammar);
+ void paintTextMatchMarker(GraphicsContext*, int tx, int ty, DocumentMarker, RenderStyle*, const Font&);
+};
+
+inline RenderText* InlineTextBox::textObject() const
+{
+ return toRenderText(m_object);
+}
+
+} // namespace WebCore
+
+#endif // InlineTextBox_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef InputElement_h
+#define InputElement_h
+
+#include "AtomicString.h"
+#include "PlatformString.h"
+
+namespace WebCore {
+
+class Document;
+class Element;
+class Event;
+class InputElementData;
+class MappedAttribute;
+
+class InputElement {
+public:
+ virtual ~InputElement() { }
+
+ virtual bool isPasswordField() const = 0;
+ virtual bool isSearchField() const = 0;
+ virtual bool isTextField() const = 0;
+
+ virtual bool placeholderShouldBeVisible() const = 0;
+ virtual bool searchEventsShouldBeDispatched() const = 0;
+
+ virtual int size() const = 0;
+ virtual String value() const = 0;
+ virtual void setValue(const String&) = 0;
+ virtual String placeholderValue() const = 0;
+
+ virtual String constrainValue(const String&) const = 0;
+ virtual void setValueFromRenderer(const String&) = 0;
+
+ virtual void cacheSelection(int start, int end) = 0;
+ virtual void select() = 0;
+
+ static const int s_maximumLength;
+ static const int s_defaultSize;
+
+protected:
+ InputElement() { }
+
+ static void dispatchFocusEvent(InputElementData&, Document*);
+ static void dispatchBlurEvent(InputElementData&, Document*);
+ static void updatePlaceholderVisibility(InputElementData&, Document*, bool placeholderValueChanged = false);
+ static void updateFocusAppearance(InputElementData&, Document*, bool restorePreviousSelection);
+ static void updateSelectionRange(InputElementData&, int start, int end);
+ static void aboutToUnload(InputElementData&, Document*);
+ static void setValueFromRenderer(InputElementData&, Document*, const String&);
+ static String constrainValue(const InputElementData&, const String& proposedValue, int maxLength);
+ static void handleBeforeTextInsertedEvent(InputElementData&, Document*, Event*);
+ static void parseSizeAttribute(InputElementData&, MappedAttribute*);
+ static void parseMaxLengthAttribute(InputElementData&, MappedAttribute*);
+ static void updateValueIfNeeded(InputElementData&);
+ static void notifyFormStateChanged(InputElementData&, Document*);
+};
+
+// HTML/WMLInputElement hold this struct as member variable
+// and pass it to the static helper functions in InputElement
+class InputElementData {
+public:
+ InputElementData(InputElement*, Element*);
+ ~InputElementData();
+
+ InputElement* inputElement() const { return m_inputElement; }
+ Element* element() const { return m_element; }
+
+ bool placeholderShouldBeVisible() const { return m_placeholderShouldBeVisible; }
+ void setPlaceholderShouldBeVisible(bool visible) { m_placeholderShouldBeVisible = visible; }
+
+ const AtomicString& name() const;
+ void setName(const AtomicString& value) { m_name = value; }
+
+ String value() const { return m_value; }
+ void setValue(const String& value) { m_value = value; }
+
+ int size() const { return m_size; }
+ void setSize(int value) { m_size = value; }
+
+ int maxLength() const { return m_maxLength; }
+ void setMaxLength(int value) { m_maxLength = value; }
+
+ int cachedSelectionStart() const { return m_cachedSelectionStart; }
+ void setCachedSelectionStart(int value) { m_cachedSelectionStart = value; }
+
+ int cachedSelectionEnd() const { return m_cachedSelectionEnd; }
+ void setCachedSelectionEnd(int value) { m_cachedSelectionEnd = value; }
+
+private:
+ InputElement* m_inputElement;
+ Element* m_element;
+ bool m_placeholderShouldBeVisible;
+ AtomicString m_name;
+ String m_value;
+ int m_size;
+ int m_maxLength;
+ int m_cachedSelectionStart;
+ int m_cachedSelectionEnd;
+};
+
+InputElement* toInputElement(Element*);
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef InsertIntoTextNodeCommand_h
+#define InsertIntoTextNodeCommand_h
+
+#include "EditCommand.h"
+
+namespace WebCore {
+
+class Text;
+
+class InsertIntoTextNodeCommand : public SimpleEditCommand {
+public:
+ static PassRefPtr<InsertIntoTextNodeCommand> create(PassRefPtr<Text> node, unsigned offset, const String& text)
+ {
+ return adoptRef(new InsertIntoTextNodeCommand(node, offset, text));
+ }
+
+private:
+ InsertIntoTextNodeCommand(PassRefPtr<Text> node, unsigned offset, const String& text);
+
+ virtual void doApply();
+ virtual void doUnapply();
+
+ RefPtr<Text> m_node;
+ unsigned m_offset;
+ String m_text;
+};
+
+} // namespace WebCore
+
+#endif // InsertIntoTextNodeCommand_h
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef InsertLineBreakCommand_h
+#define InsertLineBreakCommand_h
+
+#include "CompositeEditCommand.h"
+
+namespace WebCore {
+
+class InsertLineBreakCommand : public CompositeEditCommand {
+public:
+ static PassRefPtr<InsertLineBreakCommand> create(Document* document)
+ {
+ return adoptRef(new InsertLineBreakCommand(document));
+ }
+
+private:
+ InsertLineBreakCommand(Document*);
+
+ virtual void doApply();
+
+ virtual bool preservesTypingStyle() const;
+
+ void insertNodeAfterPosition(Node*, const Position&);
+ void insertNodeBeforePosition(Node*, const Position&);
+ bool shouldUseBreakElement(const Position&);
+};
+
+} // namespace WebCore
+
+#endif // InsertLineBreakCommand_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef InsertListCommand_h
+#define InsertListCommand_h
+
+#include "CompositeEditCommand.h"
+
+namespace WebCore {
+
+class HTMLElement;
+
+class InsertListCommand : public CompositeEditCommand {
+public:
+ enum Type { OrderedList, UnorderedList };
+
+ static PassRefPtr<InsertListCommand> create(Document* document, Type listType, const String& listID)
+ {
+ return adoptRef(new InsertListCommand(document, listType, listID));
+ }
+
+ static PassRefPtr<HTMLElement> insertList(Document*, Type);
+
+ virtual bool preservesTypingStyle() const { return true; }
+
+private:
+ InsertListCommand(Document*, Type, const String&);
+
+ virtual void doApply();
+ virtual EditAction editingAction() const { return EditActionInsertList; }
+
+ HTMLElement* fixOrphanedListChild(Node*);
+ bool modifyRange();
+ RefPtr<HTMLElement> m_listElement;
+ Type m_type;
+ String m_id;
+ bool m_forceCreateList;
+};
+
+} // namespace WebCore
+
+#endif // InsertListCommand_h
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef InsertNodeBeforeCommand_h
+#define InsertNodeBeforeCommand_h
+
+#include "EditCommand.h"
+
+namespace WebCore {
+
+class InsertNodeBeforeCommand : public SimpleEditCommand {
+public:
+ static PassRefPtr<InsertNodeBeforeCommand> create(PassRefPtr<Node> childToInsert, PassRefPtr<Node> childToInsertBefore)
+ {
+ return adoptRef(new InsertNodeBeforeCommand(childToInsert, childToInsertBefore));
+ }
+
+private:
+ InsertNodeBeforeCommand(PassRefPtr<Node> childToInsert, PassRefPtr<Node> childToInsertBefore);
+
+ virtual void doApply();
+ virtual void doUnapply();
+
+ RefPtr<Node> m_insertChild;
+ RefPtr<Node> m_refChild;
+};
+
+} // namespace WebCore
+
+#endif // InsertNodeBeforeCommand_h
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef InsertParagraphSeparatorCommand_h
+#define InsertParagraphSeparatorCommand_h
+
+#include "CompositeEditCommand.h"
+
+namespace WebCore {
+
+class InsertParagraphSeparatorCommand : public CompositeEditCommand {
+public:
+ static PassRefPtr<InsertParagraphSeparatorCommand> create(Document* document, bool useDefaultParagraphElement = false)
+ {
+ return adoptRef(new InsertParagraphSeparatorCommand(document, useDefaultParagraphElement));
+ }
+
+private:
+ InsertParagraphSeparatorCommand(Document*, bool useDefaultParagraphElement);
+
+ virtual void doApply();
+
+ void calculateStyleBeforeInsertion(const Position&);
+ void applyStyleAfterInsertion(Node* originalEnclosingBlock);
+
+ bool shouldUseDefaultParagraphElement(Node*) const;
+
+ virtual bool preservesTypingStyle() const;
+
+ RefPtr<CSSMutableStyleDeclaration> m_style;
+
+ bool m_mustUseDefaultParagraphElement;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef InsertTextCommand_h
+#define InsertTextCommand_h
+
+#include "CompositeEditCommand.h"
+
+namespace WebCore {
+
+class InsertTextCommand : public CompositeEditCommand {
+public:
+ static PassRefPtr<InsertTextCommand> create(Document* document)
+ {
+ return adoptRef(new InsertTextCommand(document));
+ }
+
+ void input(const String& text, bool selectInsertedText = false);
+
+private:
+ InsertTextCommand(Document*);
+
+ void deleteCharacter();
+ unsigned charactersAdded() const { return m_charactersAdded; }
+
+ virtual void doApply();
+ virtual bool isInsertTextCommand() const;
+
+ Position prepareForTextInsertion(const Position&);
+ Position insertTab(const Position&);
+
+ bool performTrivialReplace(const String&, bool selectInsertedText);
+
+ unsigned m_charactersAdded;
+};
+
+} // namespace WebCore
+
+#endif // InsertTextCommand_h
--- /dev/null
+/*
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef IntPoint_h
+#define IntPoint_h
+
+#include "IntSize.h"
+#include <wtf/Platform.h>
+
+#if PLATFORM(CG)
+typedef struct CGPoint CGPoint;
+#endif
+
+
+#if PLATFORM(WIN)
+typedef struct tagPOINT POINT;
+typedef struct tagPOINTS POINTS;
+#elif PLATFORM(QT)
+QT_BEGIN_NAMESPACE
+class QPoint;
+QT_END_NAMESPACE
+#elif PLATFORM(GTK)
+typedef struct _GdkPoint GdkPoint;
+#endif
+#if PLATFORM(SYMBIAN)
+class TPoint;
+#endif
+
+#if PLATFORM(WX)
+class wxPoint;
+#endif
+
+#if PLATFORM(SKIA)
+struct SkPoint;
+struct SkIPoint;
+#endif
+
+namespace WebCore {
+
+class IntPoint {
+public:
+ IntPoint() : m_x(0), m_y(0) { }
+ IntPoint(int x, int y) : m_x(x), m_y(y) { }
+
+ int x() const { return m_x; }
+ int y() const { return m_y; }
+
+ void setX(int x) { m_x = x; }
+ void setY(int y) { m_y = y; }
+
+ void move(int dx, int dy) { m_x += dx; m_y += dy; }
+
+ IntPoint expandedTo(const IntPoint& other) const
+ {
+ return IntPoint(m_x > other.m_x ? m_x : other.m_x,
+ m_y > other.m_y ? m_y : other.m_y);
+ }
+
+ IntPoint shrunkTo(const IntPoint& other) const
+ {
+ return IntPoint(m_x < other.m_x ? m_x : other.m_x,
+ m_y < other.m_y ? m_y : other.m_y);
+ }
+
+ void clampNegativeToZero()
+ {
+ *this = expandedTo(IntPoint());
+ }
+
+#if PLATFORM(CG)
+ explicit IntPoint(const CGPoint&); // don't do this implicitly since it's lossy
+ operator CGPoint() const;
+#endif
+
+
+#if PLATFORM(WIN)
+ IntPoint(const POINT&);
+ operator POINT() const;
+ IntPoint(const POINTS&);
+ operator POINTS() const;
+#elif PLATFORM(QT)
+ IntPoint(const QPoint&);
+ operator QPoint() const;
+#elif PLATFORM(GTK)
+ IntPoint(const GdkPoint&);
+ operator GdkPoint() const;
+#endif
+#if PLATFORM(SYMBIAN)
+ IntPoint(const TPoint&);
+ operator TPoint() const;
+#endif
+
+#if PLATFORM(WX)
+ IntPoint(const wxPoint&);
+ operator wxPoint() const;
+#endif
+
+#if PLATFORM(SKIA)
+ IntPoint(const SkIPoint&);
+ operator SkIPoint() const;
+ operator SkPoint() const;
+#endif
+
+private:
+ int m_x, m_y;
+};
+
+inline IntPoint& operator+=(IntPoint& a, const IntSize& b)
+{
+ a.move(b.width(), b.height());
+ return a;
+}
+
+inline IntPoint& operator-=(IntPoint& a, const IntSize& b)
+{
+ a.move(-b.width(), -b.height());
+ return a;
+}
+
+inline IntPoint operator+(const IntPoint& a, const IntSize& b)
+{
+ return IntPoint(a.x() + b.width(), a.y() + b.height());
+}
+
+inline IntSize operator-(const IntPoint& a, const IntPoint& b)
+{
+ return IntSize(a.x() - b.x(), a.y() - b.y());
+}
+
+inline IntPoint operator-(const IntPoint& a, const IntSize& b)
+{
+ return IntPoint(a.x() - b.width(), a.y() - b.height());
+}
+
+inline bool operator==(const IntPoint& a, const IntPoint& b)
+{
+ return a.x() == b.x() && a.y() == b.y();
+}
+
+inline bool operator!=(const IntPoint& a, const IntPoint& b)
+{
+ return a.x() != b.x() || a.y() != b.y();
+}
+
+} // namespace WebCore
+
+#endif // IntPoint_h
--- /dev/null
+/*
+ * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef IntRect_h
+#define IntRect_h
+
+#include "IntPoint.h"
+#include <wtf/Platform.h>
+
+#include <CoreGraphics/CGGeometry.h>
+
+#if PLATFORM(CG)
+typedef struct CGRect CGRect;
+#endif
+
+
+#ifndef NSRect
+#define NSRect CGRect
+#endif
+
+
+#if PLATFORM(WIN)
+typedef struct tagRECT RECT;
+#elif PLATFORM(QT)
+QT_BEGIN_NAMESPACE
+class QRect;
+QT_END_NAMESPACE
+#elif PLATFORM(GTK)
+typedef struct _GdkRectangle GdkRectangle;
+#endif
+#if PLATFORM(SYMBIAN)
+class TRect;
+#endif
+
+#if PLATFORM(WX)
+class wxRect;
+#endif
+
+#if PLATFORM(SKIA)
+struct SkRect;
+struct SkIRect;
+#endif
+
+namespace WebCore {
+
+class FloatRect;
+
+class IntRect {
+public:
+ IntRect() { }
+ IntRect(const IntPoint& location, const IntSize& size)
+ : m_location(location), m_size(size) { }
+ IntRect(int x, int y, int width, int height)
+ : m_location(IntPoint(x, y)), m_size(IntSize(width, height)) { }
+
+ explicit IntRect(const FloatRect& rect); // don't do this implicitly since it's lossy
+
+ IntPoint location() const { return m_location; }
+ IntSize size() const { return m_size; }
+
+ void setLocation(const IntPoint& location) { m_location = location; }
+ void setSize(const IntSize& size) { m_size = size; }
+
+ int x() const { return m_location.x(); }
+ int y() const { return m_location.y(); }
+ int width() const { return m_size.width(); }
+ int height() const { return m_size.height(); }
+
+ void setX(int x) { m_location.setX(x); }
+ void setY(int y) { m_location.setY(y); }
+ void setWidth(int width) { m_size.setWidth(width); }
+ void setHeight(int height) { m_size.setHeight(height); }
+
+ // Be careful with these functions. The point is considered to be to the right and below. These are not
+ // substitutes for right() and bottom().
+ IntPoint topLeft() const { return m_location; }
+ IntPoint topRight() const { return IntPoint(right() - 1, y()); }
+ IntPoint bottomLeft() const { return IntPoint(x(), bottom() - 1); }
+ IntPoint bottomRight() const { return IntPoint(right() - 1, bottom() - 1); }
+
+ bool isEmpty() const { return m_size.isEmpty(); }
+
+ int right() const { return x() + width(); }
+ int bottom() const { return y() + height(); }
+
+ void move(const IntSize& s) { m_location += s; }
+ void move(int dx, int dy) { m_location.move(dx, dy); }
+
+ bool intersects(const IntRect&) const;
+ bool contains(const IntRect&) const;
+
+ // This checks to see if the rect contains x,y in the traditional sense.
+ // Equivalent to checking if the rect contains a 1x1 rect below and to the right of (px,py).
+ bool contains(int px, int py) const
+ { return px >= x() && px < right() && py >= y() && py < bottom(); }
+ bool contains(const IntPoint& point) const { return contains(point.x(), point.y()); }
+
+ void intersect(const IntRect&);
+ void unite(const IntRect&);
+
+ void inflateX(int dx)
+ {
+ m_location.setX(m_location.x() - dx);
+ m_size.setWidth(m_size.width() + dx + dx);
+ }
+ void inflateY(int dy)
+ {
+ m_location.setY(m_location.y() - dy);
+ m_size.setHeight(m_size.height() + dy + dy);
+ }
+ void inflate(int d) { inflateX(d); inflateY(d); }
+ void scale(float s);
+
+#if PLATFORM(WX)
+ IntRect(const wxRect&);
+ operator wxRect() const;
+#endif
+
+#if PLATFORM(WIN)
+ IntRect(const RECT&);
+ operator RECT() const;
+#elif PLATFORM(QT)
+ IntRect(const QRect&);
+ operator QRect() const;
+#elif PLATFORM(GTK)
+ IntRect(const GdkRectangle&);
+ operator GdkRectangle() const;
+#endif
+#if PLATFORM(SYMBIAN)
+ IntRect(const TRect&);
+ operator TRect() const;
+ TRect Rect() const;
+#endif
+
+#if PLATFORM(CG)
+ operator CGRect() const;
+#endif
+
+#if PLATFORM(SKIA)
+ IntRect(const SkIRect&);
+ operator SkRect() const;
+ operator SkIRect() const;
+#endif
+
+
+private:
+ IntPoint m_location;
+ IntSize m_size;
+};
+
+inline IntRect intersection(const IntRect& a, const IntRect& b)
+{
+ IntRect c = a;
+ c.intersect(b);
+ return c;
+}
+
+inline IntRect unionRect(const IntRect& a, const IntRect& b)
+{
+ IntRect c = a;
+ c.unite(b);
+ return c;
+}
+
+inline bool operator==(const IntRect& a, const IntRect& b)
+{
+ return a.location() == b.location() && a.size() == b.size();
+}
+
+inline bool operator!=(const IntRect& a, const IntRect& b)
+{
+ return a.location() != b.location() || a.size() != b.size();
+}
+
+#if PLATFORM(CG)
+IntRect enclosingIntRect(const CGRect&);
+#endif
+
+
+} // namespace WebCore
+
+#endif // IntRect_h
--- /dev/null
+/*
+ * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef IntSize_h
+#define IntSize_h
+
+#include <wtf/Platform.h>
+
+#include <CoreGraphics/CoreGraphics.h>
+
+#if PLATFORM(CG)
+typedef struct CGSize CGSize;
+#endif
+
+
+#ifndef NSSize
+#define NSSize CGSize
+#endif
+
+
+#if PLATFORM(WIN)
+typedef struct tagSIZE SIZE;
+#elif PLATFORM(QT)
+#include <qglobal.h>
+QT_BEGIN_NAMESPACE
+class QSize;
+QT_END_NAMESPACE
+#endif
+#if PLATFORM(SYMBIAN)
+class TSize;
+#endif
+
+namespace WebCore {
+
+class IntSize {
+public:
+ IntSize() : m_width(0), m_height(0) { }
+ IntSize(int width, int height) : m_width(width), m_height(height) { }
+
+ int width() const { return m_width; }
+ int height() const { return m_height; }
+
+ void setWidth(int width) { m_width = width; }
+ void setHeight(int height) { m_height = height; }
+
+ bool isEmpty() const { return m_width <= 0 || m_height <= 0; }
+
+ void expand(int width, int height)
+ {
+ m_width += width;
+ m_height += height;
+ }
+
+ IntSize expandedTo(const IntSize& other) const
+ {
+ return IntSize(m_width > other.m_width ? m_width : other.m_width,
+ m_height > other.m_height ? m_height : other.m_height);
+ }
+
+ IntSize shrunkTo(const IntSize& other) const
+ {
+ return IntSize(m_width < other.m_width ? m_width : other.m_width,
+ m_height < other.m_height ? m_height : other.m_height);
+ }
+
+ void clampNegativeToZero()
+ {
+ *this = expandedTo(IntSize());
+ }
+
+#if PLATFORM(CG)
+ explicit IntSize(const CGSize&); // don't do this implicitly since it's lossy
+ operator CGSize() const;
+#endif
+
+
+#if PLATFORM(WIN)
+ IntSize(const SIZE&);
+ operator SIZE() const;
+#endif
+
+#if PLATFORM(QT)
+ IntSize(const QSize&);
+ operator QSize() const;
+#endif
+#if PLATFORM(SYMBIAN)
+ IntSize(const TSize&);
+ operator TSize() const;
+#endif
+
+
+private:
+ int m_width, m_height;
+};
+
+inline IntSize& operator+=(IntSize& a, const IntSize& b)
+{
+ a.setWidth(a.width() + b.width());
+ a.setHeight(a.height() + b.height());
+ return a;
+}
+
+inline IntSize& operator-=(IntSize& a, const IntSize& b)
+{
+ a.setWidth(a.width() - b.width());
+ a.setHeight(a.height() - b.height());
+ return a;
+}
+
+inline IntSize operator+(const IntSize& a, const IntSize& b)
+{
+ return IntSize(a.width() + b.width(), a.height() + b.height());
+}
+
+inline IntSize operator-(const IntSize& a, const IntSize& b)
+{
+ return IntSize(a.width() - b.width(), a.height() - b.height());
+}
+
+inline IntSize operator-(const IntSize& size)
+{
+ return IntSize(-size.width(), -size.height());
+}
+
+inline bool operator==(const IntSize& a, const IntSize& b)
+{
+ return a.width() == b.width() && a.height() == b.height();
+}
+
+inline bool operator!=(const IntSize& a, const IntSize& b)
+{
+ return a.width() != b.width() || a.height() != b.height();
+}
+
+} // namespace WebCore
+
+#endif // IntSize_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef IntSizeHash_h
+#define IntSizeHash_h
+
+#include "IntSize.h"
+#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
+
+using WebCore::IntSize;
+
+namespace WTF {
+
+ template<> struct IntHash<IntSize> {
+ static unsigned hash(const IntSize& key) { return intHash((static_cast<uint64_t>(key.width()) << 32 | key.height())); }
+ static bool equal(const IntSize& a, const IntSize& b) { return a == b; }
+ static const bool safeToCompareToEmptyOrDeleted = true;
+ };
+ template<> struct DefaultHash<IntSize> { typedef IntHash<IntSize> Hash; };
+
+ template<> struct HashTraits<IntSize> : GenericHashTraits<IntSize> {
+ static const bool emptyValueIsZero = true;
+ static const bool needsDestruction = false;
+ static void constructDeletedValue(IntSize& slot) { new (&slot) IntSize(-1, -1); }
+ static bool isDeletedValue(const IntSize& value) { return value.width() == -1 && value.height() == -1; }
+ };
+} // namespace WTF
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JoinTextNodesCommand_h
+#define JoinTextNodesCommand_h
+
+#include "EditCommand.h"
+
+namespace WebCore {
+
+class Text;
+
+class JoinTextNodesCommand : public SimpleEditCommand {
+public:
+ static PassRefPtr<JoinTextNodesCommand> create(PassRefPtr<Text> text1, PassRefPtr<Text> text2)
+ {
+ return adoptRef(new JoinTextNodesCommand(text1, text2));
+ }
+
+private:
+ JoinTextNodesCommand(PassRefPtr<Text>, PassRefPtr<Text>);
+
+ virtual void doApply();
+ virtual void doUnapply();
+
+ RefPtr<Text> m_text1;
+ RefPtr<Text> m_text2;
+};
+
+} // namespace WebCore
+
+#endif // JoinTextNodesCommand_h
--- /dev/null
+/*
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef KURL_h
+#define KURL_h
+
+#include "PlatformString.h"
+
+#if PLATFORM(CF)
+typedef const struct __CFURL* CFURLRef;
+#endif
+
+#if PLATFORM(MAC)
+#ifdef __OBJC__
+@class NSURL;
+#else
+class NSURL;
+#endif
+#endif
+
+#if PLATFORM(QT)
+QT_BEGIN_NAMESPACE
+class QUrl;
+QT_END_NAMESPACE
+#endif
+
+#if USE(GOOGLEURL)
+#include "GoogleURLPrivate.h"
+#endif
+
+namespace WebCore {
+
+class TextEncoding;
+struct KURLHash;
+
+// FIXME: Our terminology here is a bit inconsistent. We refer to the part
+// after the "#" as the "fragment" in some places and the "ref" in others.
+// We should fix the terminology to match the URL and URI RFCs as closely
+// as possible to resolve this.
+
+class KURL {
+public:
+ // Generates a URL which contains a null string.
+ KURL() { invalidate(); }
+
+ // The argument is an absolute URL string. The string is assumed to be
+ // an already encoded (ASCII-only) valid absolute URL.
+ explicit KURL(const char*);
+ explicit KURL(const String&);
+
+ // Resolves the relative URL with the given base URL. If provided, the
+ // TextEncoding is used to encode non-ASCII characers. The base URL can be
+ // null or empty, in which case the relative URL will be interpreted as
+ // absolute.
+ // FIXME: If the base URL is invalid, this always creates an invalid
+ // URL. Instead I think it would be better to treat all invalid base URLs
+ // the same way we treate null and empty base URLs.
+ KURL(const KURL& base, const String& relative);
+ KURL(const KURL& base, const String& relative, const TextEncoding&);
+
+#if USE(GOOGLEURL)
+ // For conversions for other structures that have already parsed and
+ // canonicalized the URL. The input must be exactly what KURL would have
+ // done with the same input.
+ KURL(const char* canonicalSpec, int canonicalSpecLen,
+ const url_parse::Parsed& parsed, bool isValid);
+#endif
+
+ // FIXME: The above functions should be harmonized so that passing a
+ // base of null or the empty string gives the same result as the
+ // standard String constructor.
+
+ // Makes a deep copy. Helpful only if you need to use a KURL on another
+ // thread. Since the underlying StringImpl objects are immutable, there's
+ // no other reason to ever prefer copy() over plain old assignment.
+ KURL copy() const;
+
+ bool isNull() const;
+ bool isEmpty() const;
+ bool isValid() const;
+
+ // Returns true if this URL has a path. Note that "http://foo.com/" has a
+ // path of "/", so this function will return true. Only invalid or
+ // non-hierarchical (like "javascript:") URLs will have no path.
+ bool hasPath() const;
+
+#if USE(GOOGLEURL)
+ const String& string() const { return m_url.string(); }
+#else
+ const String& string() const { return m_string; }
+#endif
+
+ String protocol() const;
+ String host() const;
+ unsigned short port() const;
+ String user() const;
+ String pass() const;
+ String path() const;
+ String lastPathComponent() const;
+ String query() const; // Includes the "?".
+ String ref() const; // Does *not* include the "#".
+ bool hasRef() const;
+
+ String prettyURL() const;
+ String fileSystemPath() const;
+
+ // Returns true if the current URL's protocol is the same as the null-
+ // terminated ASCII argument. The argument must be lower-case.
+ bool protocolIs(const char*) const;
+ bool isLocalFile() const;
+
+ void setProtocol(const String&);
+ void setHost(const String&);
+
+ // Setting the port to 0 will clear any port from the URL.
+ void setPort(unsigned short);
+
+ // Input is like "foo.com" or "foo.com:8000".
+ void setHostAndPort(const String&);
+
+ void setUser(const String&);
+ void setPass(const String&);
+
+ // If you pass an empty path for HTTP or HTTPS URLs, the resulting path
+ // will be "/".
+ void setPath(const String&);
+
+ // The query may begin with a question mark, or, if not, one will be added
+ // for you. Setting the query to the empty string will leave a "?" in the
+ // URL (with nothing after it). To clear the query, pass a null string.
+ void setQuery(const String&);
+
+ void setRef(const String&);
+ void removeRef();
+
+ friend bool equalIgnoringRef(const KURL&, const KURL&);
+
+ friend bool protocolHostAndPortAreEqual(const KURL&, const KURL&);
+
+ unsigned hostStart() const;
+ unsigned hostEnd() const;
+
+ unsigned pathStart() const;
+ unsigned pathEnd() const;
+ unsigned pathAfterLastSlash() const;
+ operator const String&() const { return string(); }
+#if USE(JSC)
+ operator JSC::UString() const { return string(); }
+#endif
+
+#if PLATFORM(CF)
+ KURL(CFURLRef);
+ CFURLRef createCFURL() const;
+#endif
+
+#if PLATFORM(MAC)
+ KURL(NSURL*);
+ operator NSURL*() const;
+#endif
+#ifdef __OBJC__
+ operator NSString*() const { return string(); }
+#endif
+
+#if PLATFORM(QT)
+ KURL(const QUrl&);
+ operator QUrl() const;
+#endif
+
+#if USE(GOOGLEURL)
+ // Getters for the parsed structure and its corresponding 8-bit string.
+ const url_parse::Parsed& parsed() const { return m_url.m_parsed; }
+ const CString& utf8String() const { return m_url.utf8String(); }
+#endif
+
+#ifndef NDEBUG
+ void print() const;
+#endif
+
+private:
+ void invalidate();
+ bool isHierarchical() const;
+ static bool protocolIs(const String&, const char*);
+#if USE(GOOGLEURL)
+ friend class GoogleURLPrivate;
+ void parse(const char* url, const String* originalString); // KURLMac calls this.
+ void copyToBuffer(Vector<char, 512>& buffer) const; // KURLCFNet uses this.
+ GoogleURLPrivate m_url;
+#else // !USE(GOOGLEURL)
+ void init(const KURL&, const String&, const TextEncoding&);
+ void copyToBuffer(Vector<char, 512>& buffer) const;
+
+ // Parses the given URL. The originalString parameter allows for an
+ // optimization: When the source is the same as the fixed-up string,
+ // it will use the passed-in string instead of allocating a new one.
+ void parse(const String&);
+ void parse(const char* url, const String* originalString);
+
+ String m_string;
+ bool m_isValid;
+ int m_schemeEnd;
+ int m_userStart;
+ int m_userEnd;
+ int m_passwordEnd;
+ int m_hostEnd;
+ int m_portEnd;
+ int m_pathAfterLastSlash;
+ int m_pathEnd;
+ int m_queryEnd;
+ int m_fragmentEnd;
+#endif
+};
+
+bool operator==(const KURL&, const KURL&);
+bool operator==(const KURL&, const String&);
+bool operator==(const String&, const KURL&);
+bool operator!=(const KURL&, const KURL&);
+bool operator!=(const KURL&, const String&);
+bool operator!=(const String&, const KURL&);
+
+bool equalIgnoringRef(const KURL&, const KURL&);
+bool protocolHostAndPortAreEqual(const KURL&, const KURL&);
+
+const KURL& blankURL();
+
+// Functions to do URL operations on strings.
+// These are operations that aren't faster on a parsed URL.
+
+bool protocolIs(const String& url, const char* protocol);
+
+String mimeTypeFromDataURL(const String& url);
+
+// Unescapes the given string using URL escaping rules, given an optional
+// encoding (defaulting to UTF-8 otherwise). DANGER: If the URL has "%00"
+// in it, the resulting string will have embedded null characters!
+String decodeURLEscapeSequences(const String&);
+String decodeURLEscapeSequences(const String&, const TextEncoding&);
+
+String encodeWithURLEscapeSequences(const String&);
+
+// Inlines.
+
+inline bool operator==(const KURL& a, const KURL& b)
+{
+ return a.string() == b.string();
+}
+
+inline bool operator==(const KURL& a, const String& b)
+{
+ return a.string() == b;
+}
+
+inline bool operator==(const String& a, const KURL& b)
+{
+ return a == b.string();
+}
+
+inline bool operator!=(const KURL& a, const KURL& b)
+{
+ return a.string() != b.string();
+}
+
+inline bool operator!=(const KURL& a, const String& b)
+{
+ return a.string() != b;
+}
+
+inline bool operator!=(const String& a, const KURL& b)
+{
+ return a != b.string();
+}
+
+#if !USE(GOOGLEURL)
+
+// Inline versions of some non-GoogleURL functions so we can get inlining
+// without having to have a lot of ugly ifdefs in the class definition.
+
+inline bool KURL::isNull() const
+{
+ return m_string.isNull();
+}
+
+inline bool KURL::isEmpty() const
+{
+ return m_string.isEmpty();
+}
+
+inline bool KURL::isValid() const
+{
+ return m_isValid;
+}
+
+inline unsigned KURL::hostStart() const
+{
+ return (m_passwordEnd == m_userStart) ? m_passwordEnd : m_passwordEnd + 1;
+}
+
+inline unsigned KURL::hostEnd() const
+{
+ return m_hostEnd;
+}
+
+inline unsigned KURL::pathStart() const
+{
+ return m_portEnd;
+}
+
+inline unsigned KURL::pathEnd() const
+{
+ return m_pathEnd;
+}
+
+inline unsigned KURL::pathAfterLastSlash() const
+{
+ return m_pathAfterLastSlash;
+}
+
+#endif // !USE(GOOGLEURL)
+
+} // namespace WebCore
+
+namespace WTF {
+
+ // KURLHash is the default hash for String
+ template<typename T> struct DefaultHash;
+ template<> struct DefaultHash<WebCore::KURL> {
+ typedef WebCore::KURLHash Hash;
+ };
+
+} // namespace WTF
+
+#endif // KURL_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef KURLHash_h
+#define KURLHash_h
+
+#include "KURL.h"
+#include "PlatformString.h"
+#include "StringHash.h"
+
+namespace WebCore {
+
+ struct KURLHash {
+ static unsigned hash(const KURL& key)
+ {
+ return key.string().impl()->hash();
+ }
+
+ static bool equal(const KURL& a, const KURL& b)
+ {
+ return StringHash::equal(a.string(), b.string());
+ }
+
+ static const bool safeToCompareToEmptyOrDeleted = false;
+ };
+
+} // namespace WebCore
+
+namespace WTF {
+
+ template<> struct HashTraits<WebCore::KURL> : GenericHashTraits<WebCore::KURL> {
+ static const bool emptyValueIsZero = true;
+ static void constructDeletedValue(WebCore::KURL& slot) { new (&slot) WebCore::KURL(WebCore::String(HashTableDeletedValue)); }
+ static bool isDeletedValue(const WebCore::KURL& slot) { return slot.string().isHashTableDeletedValue(); }
+ };
+
+} // namespace WTF
+
+#endif // KURLHash_h
--- /dev/null
+/*
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
+ * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef KeyboardEvent_h
+#define KeyboardEvent_h
+
+#include "UIEventWithKeyState.h"
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+ class PlatformKeyboardEvent;
+
+#if PLATFORM(MAC)
+ struct KeypressCommand {
+ KeypressCommand(const String& commandName) : commandName(commandName) {}
+ KeypressCommand(const String& commandName, const String& text) : commandName(commandName), text(text) { ASSERT(commandName == "insertText:"); }
+
+ String commandName;
+ String text;
+ };
+#endif
+
+ // Introduced in DOM Level 3
+ class KeyboardEvent : public UIEventWithKeyState {
+ public:
+ enum KeyLocationCode {
+ DOM_KEY_LOCATION_STANDARD = 0x00,
+ DOM_KEY_LOCATION_LEFT = 0x01,
+ DOM_KEY_LOCATION_RIGHT = 0x02,
+ DOM_KEY_LOCATION_NUMPAD = 0x03
+ };
+
+ static PassRefPtr<KeyboardEvent> create()
+ {
+ return adoptRef(new KeyboardEvent);
+ }
+ static PassRefPtr<KeyboardEvent> create(const PlatformKeyboardEvent& platformEvent, AbstractView* view)
+ {
+ return adoptRef(new KeyboardEvent(platformEvent, view));
+ }
+ static PassRefPtr<KeyboardEvent> create(const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view,
+ const String& keyIdentifier, unsigned keyLocation,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey)
+ {
+ return adoptRef(new KeyboardEvent(type, canBubble, cancelable, view, keyIdentifier, keyLocation,
+ ctrlKey, altKey, shiftKey, metaKey, altGraphKey));
+ }
+ virtual ~KeyboardEvent();
+
+ void initKeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, AbstractView*,
+ const String& keyIdentifier, unsigned keyLocation,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey = false);
+
+ String keyIdentifier() const { return m_keyIdentifier; }
+ unsigned keyLocation() const { return m_keyLocation; }
+
+ bool getModifierState(const String& keyIdentifier) const;
+
+ bool altGraphKey() const { return m_altGraphKey; }
+
+ const PlatformKeyboardEvent* keyEvent() const { return m_keyEvent; }
+
+ int keyCode() const; // key code for keydown and keyup, character for keypress
+ int charCode() const; // character code for keypress, 0 for keydown and keyup
+
+ virtual bool isKeyboardEvent() const;
+ virtual int which() const;
+
+#if PLATFORM(MAC)
+ // We only have this need to store keypress command info on the Mac.
+ Vector<KeypressCommand>& keypressCommands() { return m_keypressCommands; }
+#endif
+
+ private:
+ KeyboardEvent();
+ KeyboardEvent(const PlatformKeyboardEvent&, AbstractView*);
+ KeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, AbstractView*,
+ const String& keyIdentifier, unsigned keyLocation,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey);
+
+ PlatformKeyboardEvent* m_keyEvent;
+ String m_keyIdentifier;
+ unsigned m_keyLocation;
+ bool m_altGraphKey : 1;
+
+#if PLATFORM(MAC)
+ Vector<KeypressCommand> m_keypressCommands;
+#endif
+ };
+
+ KeyboardEvent* findKeyboardEvent(Event*);
+
+} // namespace WebCore
+
+#endif // KeyboardEvent_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef KeyframeList_h
+#define KeyframeList_h
+
+#include "AtomicString.h"
+#include <wtf/Vector.h>
+#include <wtf/HashSet.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class RenderObject;
+class RenderStyle;
+
+class KeyframeValue {
+public:
+ KeyframeValue()
+ : m_key(-1)
+ {
+ }
+
+ float key() const { return m_key; }
+ const RenderStyle* style() const { return m_style.get(); }
+
+ float m_key;
+ RefPtr<RenderStyle> m_style;
+};
+
+class KeyframeList {
+public:
+ KeyframeList(RenderObject* renderer, const AtomicString& animationName)
+ : m_animationName(animationName)
+ , m_renderer(renderer)
+ {
+ insert(0, 0);
+ insert(1, 0);
+ }
+ ~KeyframeList();
+
+ bool operator==(const KeyframeList& o) const;
+ bool operator!=(const KeyframeList& o) const { return !(*this == o); }
+
+ const AtomicString& animationName() const { return m_animationName; }
+
+ void insert(float key, PassRefPtr<RenderStyle> style);
+
+ void addProperty(int prop) { m_properties.add(prop); }
+ bool containsProperty(int prop) const { return m_properties.contains(prop); }
+ HashSet<int>::const_iterator beginProperties() const { return m_properties.begin(); }
+ HashSet<int>::const_iterator endProperties() const { return m_properties.end(); }
+
+ void clear();
+ bool isEmpty() const { return m_keyframes.isEmpty(); }
+ size_t size() const { return m_keyframes.size(); }
+ Vector<KeyframeValue>::const_iterator beginKeyframes() const { return m_keyframes.begin(); }
+ Vector<KeyframeValue>::const_iterator endKeyframes() const { return m_keyframes.end(); }
+
+private:
+ AtomicString m_animationName;
+ Vector<KeyframeValue> m_keyframes;
+ HashSet<int> m_properties; // the properties being animated
+ RenderObject* m_renderer;
+};
+
+} // namespace WebCore
+
+#endif // KeyframeList_h
--- /dev/null
+/*
+ * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Language_h
+#define Language_h
+
+namespace WebCore {
+
+ class String;
+
+ String defaultLanguage();
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LayoutState_h
+#define LayoutState_h
+
+#include "IntRect.h"
+#include "IntSize.h"
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+class RenderArena;
+class RenderBox;
+class RenderObject;
+
+class LayoutState : Noncopyable {
+public:
+ LayoutState()
+ : m_clipped(false)
+ , m_next(0)
+#ifndef NDEBUG
+ , m_renderer(0)
+#endif
+ {
+ }
+
+ LayoutState(LayoutState*, RenderBox*, const IntSize& offset);
+ LayoutState(RenderObject*);
+
+ void destroy(RenderArena*);
+
+ // Overloaded new operator.
+ void* operator new(size_t, RenderArena*) throw();
+
+ // Overridden to prevent the normal delete from being called.
+ void operator delete(void*, size_t);
+
+private:
+ // The normal operator new is disallowed.
+ void* operator new(size_t) throw();
+
+public:
+ bool m_clipped;
+ IntRect m_clipRect;
+ IntSize m_offset; // x/y offset from container.
+ IntSize m_layoutDelta; // Transient offset from the final position of the object
+ // used to ensure that repaints happen in the correct place.
+ // This is a total delta accumulated from the root.
+ LayoutState* m_next;
+#ifndef NDEBUG
+ RenderObject* m_renderer;
+#endif
+};
+
+} // namespace WebCore
+
+#endif // LayoutState_h
--- /dev/null
+/*
+ Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef Length_h
+#define Length_h
+
+#include <wtf/Assertions.h>
+#include <wtf/MathExtras.h>
+
+namespace WebCore {
+
+class String;
+
+const int undefinedLength = -1;
+const int percentScaleFactor = 128;
+
+enum LengthType { Auto, Relative, Percent, Fixed, Static, Intrinsic, MinIntrinsic };
+
+struct Length {
+ Length()
+ : m_value(0)
+ {
+ }
+
+ Length(LengthType t)
+ : m_value(t)
+ {
+ }
+
+ Length(int v, LengthType t, bool q = false)
+ : m_value((v * 16) | (q << 3) | t) // FIXME: Doesn't work if the passed-in value is very large!
+ {
+ ASSERT(t != Percent);
+ }
+
+ Length(double v, LengthType t, bool q = false)
+ : m_value(static_cast<int>(v * percentScaleFactor) * 16 | (q << 3) | t)
+ {
+ ASSERT(t == Percent);
+ }
+
+ bool operator==(const Length& o) const { return m_value == o.m_value; }
+ bool operator!=(const Length& o) const { return m_value != o.m_value; }
+
+ int value() const {
+ ASSERT(type() != Percent);
+ return rawValue();
+ }
+
+ int rawValue() const { return (m_value & ~0xF) / 16; }
+
+ double percent() const
+ {
+ ASSERT(type() == Percent);
+ return static_cast<double>(rawValue()) / percentScaleFactor;
+ }
+
+ LengthType type() const { return static_cast<LengthType>(m_value & 7); }
+ bool quirk() const { return (m_value >> 3) & 1; }
+
+ void setValue(LengthType t, int value)
+ {
+ ASSERT(t != Percent);
+ setRawValue(t, value);
+ }
+
+ void setRawValue(LengthType t, int value) { m_value = value * 16 | (m_value & 0x8) | t; }
+
+ void setValue(int value)
+ {
+ ASSERT(!value || type() != Percent);
+ setRawValue(value);
+ }
+
+ void setRawValue(int value) { m_value = value * 16 | (m_value & 0xF); }
+
+ void setValue(LengthType t, double value)
+ {
+ ASSERT(t == Percent);
+ m_value = static_cast<int>(value * percentScaleFactor) * 16 | (m_value & 0x8) | t;
+ }
+
+ void setValue(double value)
+ {
+ ASSERT(type() == Percent);
+ m_value = static_cast<int>(value * percentScaleFactor) * 16 | (m_value & 0xF);
+ }
+
+ // note: works only for certain types, returns undefinedLength otherwise
+ int calcValue(int maxValue, bool roundPercentages = false) const
+ {
+ switch (type()) {
+ case Fixed:
+ return value();
+ case Percent:
+ if (roundPercentages)
+ return static_cast<int>(round(maxValue * percent() / 100.0));
+ return maxValue * rawValue() / (100 * percentScaleFactor);
+ case Auto:
+ return maxValue;
+ default:
+ return undefinedLength;
+ }
+ }
+
+ int calcMinValue(int maxValue, bool roundPercentages = false) const
+ {
+ switch (type()) {
+ case Fixed:
+ return value();
+ case Percent:
+ if (roundPercentages)
+ return static_cast<int>(round(maxValue * percent() / 100.0));
+ return maxValue * rawValue() / (100 * percentScaleFactor);
+ case Auto:
+ default:
+ return 0;
+ }
+ }
+
+ float calcFloatValue(int maxValue) const
+ {
+ switch (type()) {
+ case Fixed:
+ return static_cast<float>(value());
+ case Percent:
+ return static_cast<float>(maxValue * percent() / 100.0);
+ case Auto:
+ return static_cast<float>(maxValue);
+ default:
+ return static_cast<float>(undefinedLength);
+ }
+ }
+
+ bool isUndefined() const { return rawValue() == undefinedLength; }
+ bool isZero() const { return !(m_value & ~0xF); }
+ bool isPositive() const { return rawValue() > 0; }
+ bool isNegative() const { return rawValue() < 0; }
+
+ bool isAuto() const { return type() == Auto; }
+ bool isRelative() const { return type() == Relative; }
+ bool isPercent() const { return type() == Percent; }
+ bool isFixed() const { return type() == Fixed; }
+ bool isStatic() const { return type() == Static; }
+ bool isIntrinsicOrAuto() const { return type() == Auto || type() == MinIntrinsic || type() == Intrinsic; }
+
+ Length blend(const Length& from, double progress) const
+ {
+ // Blend two lengths to produce a new length that is in between them. Used for animation.
+ if (!from.isZero() && !isZero() && from.type() != type())
+ return *this;
+
+ if (from.isZero() && isZero())
+ return *this;
+
+ LengthType resultType = type();
+ if (isZero())
+ resultType = from.type();
+
+ if (resultType == Percent) {
+ double fromPercent = from.isZero() ? 0. : from.percent();
+ double toPercent = isZero() ? 0. : percent();
+ return Length(fromPercent + (toPercent - fromPercent) * progress, Percent);
+ }
+
+ int fromValue = from.isZero() ? 0 : from.value();
+ int toValue = isZero() ? 0 : value();
+ return Length(int(fromValue + (toValue - fromValue) * progress), resultType);
+ }
+
+private:
+ int m_value;
+};
+
+Length* newCoordsArray(const String&, int& len);
+Length* newLengthArray(const String&, int& len);
+
+} // namespace WebCore
+
+#endif // Length_h
--- /dev/null
+/*
+ Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef LengthBox_h
+#define LengthBox_h
+
+#include "Length.h"
+
+namespace WebCore {
+
+struct LengthBox {
+ LengthBox()
+ {
+ }
+
+ LengthBox(LengthType t)
+ : m_left(t)
+ , m_right(t)
+ , m_top(t)
+ , m_bottom(t)
+ {
+ }
+
+ LengthBox(int v)
+ : m_left(Length(v, Fixed))
+ , m_right(Length(v, Fixed))
+ , m_top(Length(v, Fixed))
+ , m_bottom(Length(v, Fixed))
+ {
+ }
+
+ LengthBox(int t, int r, int b, int l)
+ : m_left(Length(l, Fixed))
+ , m_right(Length(r, Fixed))
+ , m_top(Length(t, Fixed))
+ , m_bottom(Length(b, Fixed))
+ {
+ }
+
+ Length left() const { return m_left; }
+ Length right() const { return m_right; }
+ Length top() const { return m_top; }
+ Length bottom() const { return m_bottom; }
+
+ bool operator==(const LengthBox& o) const
+ {
+ return m_left == o.m_left && m_right == o.m_right && m_top == o.m_top && m_bottom == o.m_bottom;
+ }
+
+ bool operator!=(const LengthBox& o) const
+ {
+ return !(*this == o);
+ }
+
+ bool nonZero() const
+ {
+ return !(m_left.isZero() && m_right.isZero() && m_top.isZero() && m_bottom.isZero());
+ }
+
+ Length m_left;
+ Length m_right;
+ Length m_top;
+ Length m_bottom;
+};
+
+} // namespace WebCore
+
+#endif // LengthBox_h
--- /dev/null
+/*
+ Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef LengthSize_h
+#define LengthSize_h
+
+#include "Length.h"
+
+namespace WebCore {
+
+struct LengthSize {
+public:
+ LengthSize()
+ {
+ }
+
+ LengthSize(Length width, Length height)
+ : m_width(width)
+ , m_height(height)
+ {
+ }
+
+ bool operator==(const LengthSize& o) const
+ {
+ return m_width == o.m_width && m_height == o.m_height;
+ }
+
+ void setWidth(Length width) { m_width = width; }
+ Length width() const { return m_width; }
+
+ void setHeight(Length height) { m_height = height; }
+ Length height() const { return m_height; }
+
+private:
+ Length m_width;
+ Length m_height;
+};
+
+} // namespace WebCore
+
+#endif // LengthSize_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LinkHash_h
+#define LinkHash_h
+
+#include "StringHash.h"
+
+namespace WebCore {
+
+class AtomicString;
+class KURL;
+
+typedef uint64_t LinkHash;
+
+// Use the low 32-bits of the 64-bit LinkHash as the key for HashSets.
+struct LinkHashHash {
+ static unsigned hash(LinkHash key) { return static_cast<unsigned>(key); }
+ static bool equal(LinkHash a, LinkHash b) { return a == b; }
+ static const bool safeToCompareToEmptyOrDeleted = true;
+
+ // See AlreadyHashed::avoidDeletedValue.
+ static unsigned avoidDeletedValue(LinkHash hash64)
+ {
+ ASSERT(hash64);
+ unsigned hash = static_cast<unsigned>(hash64);
+ unsigned newHash = hash | (!(hash + 1) << 31);
+ ASSERT(newHash);
+ ASSERT(newHash != 0xFFFFFFFF);
+ return newHash;
+ }
+};
+
+// Returns the has of the string that will be used for visited link coloring.
+LinkHash visitedLinkHash(const UChar* url, unsigned length);
+
+// Resolves the potentially relative URL "attributeURL" relative to the given
+// base URL, and returns the hash of the string that will be used for visited
+// link coloring. It will return the special value of 0 if attributeURL does not
+// look like a relative URL.
+LinkHash visitedLinkHash(const KURL& base, const AtomicString& attributeURL);
+
+} // namespace WebCore
+
+#endif // LinkHash_h
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ListMarkerBox_h
+#define ListMarkerBox_h
+
+#include "InlineBox.h"
+
+namespace WebCore {
+
+class ListMarkerBox : public InlineBox {
+public:
+ ListMarkerBox(RenderObject*);
+
+ virtual bool isText() const;
+};
+
+} // namespace WebCore
+
+#endif // ListMarkerBox_h
--- /dev/null
+/*
+ * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LocalizedStrings_h
+#define LocalizedStrings_h
+
+namespace WebCore {
+
+ class String;
+ class IntSize;
+
+ String inputElementAltText();
+ String resetButtonDefaultLabel();
+ String searchableIndexIntroduction();
+ String submitButtonDefaultLabel();
+ String fileButtonChooseFileLabel();
+ String fileButtonNoFileSelectedLabel();
+ String copyImageUnknownFileLabel();
+
+ String multipleFileUploadText(unsigned numberOfFiles);
+ String unknownFileSizeText();
+
+#if PLATFORM(WIN)
+ String uploadFileText();
+ String allFilesText();
+#endif
+
+ String htmlSelectMultipleItems(int num);
+
+ String imageTitle(const String& filename, const IntSize& size);
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Location_h
+#define Location_h
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+ class Frame;
+ class KURL;
+ class String;
+
+ class Location : public RefCounted<Location> {
+ public:
+ static PassRefPtr<Location> create(Frame* frame) { return adoptRef(new Location(frame)); }
+
+ Frame* frame() const { return m_frame; }
+ void disconnectFrame();
+
+ String href() const;
+
+ // URI decomposition attributes
+ String protocol() const;
+ String host() const;
+ String hostname() const;
+ String port() const;
+ String pathname() const;
+ String search() const;
+ String hash() const;
+
+ String toString() const;
+
+ private:
+ Location(Frame*);
+
+ const KURL& url() const;
+
+ Frame* m_frame;
+ };
+
+} // namespace WebCore
+
+#endif // Location_h
--- /dev/null
+/*
+ * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Logging_h
+#define Logging_h
+
+#include <wtf/Assertions.h>
+
+#ifndef LOG_CHANNEL_PREFIX
+#define LOG_CHANNEL_PREFIX Log
+#endif
+
+namespace WebCore {
+
+ extern WTFLogChannel LogNotYetImplemented;
+ extern WTFLogChannel LogFrames;
+ extern WTFLogChannel LogLoading;
+ extern WTFLogChannel LogPopupBlocking;
+ extern WTFLogChannel LogEvents;
+ extern WTFLogChannel LogEditing;
+ extern WTFLogChannel LogTextConversion;
+ extern WTFLogChannel LogIconDatabase;
+ extern WTFLogChannel LogSQLDatabase;
+ extern WTFLogChannel LogSpellingAndGrammar;
+ extern WTFLogChannel LogBackForward;
+ extern WTFLogChannel LogHistory;
+ extern WTFLogChannel LogPageCache;
+ extern WTFLogChannel LogPlatformLeaks;
+ extern WTFLogChannel LogNetwork;
+ extern WTFLogChannel LogFTP;
+ extern WTFLogChannel LogThreading;
+ extern WTFLogChannel LogStorageAPI;
+ extern WTFLogChannel LogMedia;
+ extern WTFLogChannel LogPlugin;
+ extern WTFLogChannel LogArchives;
+
+ void InitializeLoggingChannelsIfNecessary();
+}
+
+#endif // Logging_h
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MIMETypeRegistry_h
+#define MIMETypeRegistry_h
+
+#include "PlatformString.h"
+#include "StringHash.h"
+#include <wtf/HashSet.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class MIMETypeRegistry {
+public:
+ static String getMIMETypeForExtension(const String& ext);
+ static Vector<String> getExtensionsForMIMEType(const String& type);
+ static String getPreferredExtensionForMIMEType(const String& type);
+
+ static String getMIMETypeForPath(const String& path);
+
+ // Check to see if a mime type is suitable for being loaded inline as an
+ // image (e.g., <img> tags).
+ static bool isSupportedImageMIMEType(const String& mimeType);
+
+ // Check to see if a mime type is suitable for being loaded as an image
+ // document in a frame.
+ static bool isSupportedImageResourceMIMEType(const String& mimeType);
+
+ // Check to see if a mime type is suitable for being encoded.
+ static bool isSupportedImageMIMETypeForEncoding(const String& mimeType);
+
+ // Check to see if a mime type is suitable for being loaded as a JavaScript
+ // resource.
+ static bool isSupportedJavaScriptMIMEType(const String& mimeType);
+
+ // Check to see if a non-image mime type is suitable for being loaded as a
+ // document in a frame. Includes supported JavaScript MIME types.
+ static bool isSupportedNonImageMIMEType(const String& mimeType);
+
+ // Check to see if a mime type is suitable for being loaded using <video> and <audio>
+ static bool isSupportedMediaMIMEType(const String& mimeType);
+
+ // Check to see if a mime type is a valid Java applet mime type
+ static bool isJavaAppletMIMEType(const String& mimeType);
+
+ static HashSet<String>& getSupportedImageMIMETypes();
+ static HashSet<String>& getSupportedImageResourceMIMETypes();
+ static HashSet<String>& getSupportedImageMIMETypesForEncoding();
+ static HashSet<String>& getSupportedNonImageMIMETypes();
+ static HashSet<String>& getSupportedMediaMIMETypes();
+};
+
+} // namespace WebCore
+
+#endif // MIMETypeRegistry_h
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "FrameLoaderTypes.h"
+#include "ResourceLoader.h"
+#include "SubstituteData.h"
+#include "Timer.h"
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+ class ApplicationCache;
+#endif
+ class FormState;
+ class ResourceRequest;
+
+ class MainResourceLoader : public ResourceLoader {
+ public:
+ static PassRefPtr<MainResourceLoader> create(Frame*);
+ virtual ~MainResourceLoader();
+
+ virtual bool load(const ResourceRequest&, const SubstituteData&);
+ virtual void addData(const char*, int, bool allAtOnce);
+
+ virtual void setDefersLoading(bool);
+
+ virtual void willSendRequest(ResourceRequest&, const ResourceResponse& redirectResponse);
+ virtual void didReceiveResponse(const ResourceResponse&);
+ virtual void didReceiveData(const char*, int, long long lengthReceived, bool allAtOnce);
+ virtual void didFinishLoading();
+ virtual void didFail(const ResourceError&);
+
+ void handleDataLoadNow(Timer<MainResourceLoader>*);
+
+ bool isLoadingMultipartContent() const { return m_loadingMultipartContent; }
+
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+ ApplicationCache* applicationCache() const { return m_applicationCache.get(); }
+#endif
+
+ private:
+ MainResourceLoader(Frame*);
+
+ virtual void didCancel(const ResourceError&);
+
+ bool loadNow(ResourceRequest&);
+
+ void handleEmptyLoad(const KURL&, bool forURLScheme);
+ void handleDataLoadSoon(ResourceRequest& r);
+
+ void handleDataLoad(ResourceRequest&);
+
+ void receivedError(const ResourceError&);
+ ResourceError interruptionForPolicyChangeError() const;
+ void stopLoadingForPolicyChange();
+ bool isPostOrRedirectAfterPost(const ResourceRequest& newRequest, const ResourceResponse& redirectResponse);
+
+ static void callContinueAfterNavigationPolicy(void*, const ResourceRequest&, PassRefPtr<FormState>, bool shouldContinue);
+ void continueAfterNavigationPolicy(const ResourceRequest&, bool shouldContinue);
+
+ static void callContinueAfterContentPolicy(void*, PolicyAction);
+ void continueAfterContentPolicy(PolicyAction);
+ void continueAfterContentPolicy(PolicyAction, const ResourceResponse&);
+
+ ResourceRequest m_initialRequest;
+ SubstituteData m_substituteData;
+ Timer<MainResourceLoader> m_dataLoadTimer;
+
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+ // The application cache that the main resource was loaded from (if any).
+ RefPtr<ApplicationCache> m_applicationCache;
+#endif
+
+ bool m_loadingMultipartContent;
+ bool m_waitingForContentPolicy;
+ };
+
+}
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Peter Kelly (pmk@post.com)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef MappedAttribute_h
+#define MappedAttribute_h
+
+#include "Attribute.h"
+#include "CSSMappedAttributeDeclaration.h"
+
+namespace WebCore {
+
+class MappedAttribute : public Attribute {
+public:
+ static PassRefPtr<MappedAttribute> create(const QualifiedName& name, const AtomicString& value)
+ {
+ return adoptRef(new MappedAttribute(name, value, 0));
+ }
+ static PassRefPtr<MappedAttribute> create(const AtomicString& name, const AtomicString& value)
+ {
+ return adoptRef(new MappedAttribute(name, value, 0));
+ }
+
+ virtual PassRefPtr<Attribute> clone() const;
+
+ virtual CSSStyleDeclaration* style() const { return m_styleDecl.get(); }
+
+ virtual bool isMappedAttribute() { return true; }
+
+ CSSMappedAttributeDeclaration* decl() const { return m_styleDecl.get(); }
+ void setDecl(PassRefPtr<CSSMappedAttributeDeclaration> decl) { m_styleDecl = decl; }
+
+private:
+ MappedAttribute(const QualifiedName& name, const AtomicString& value, CSSMappedAttributeDeclaration* declaration)
+ : Attribute(name, value), m_styleDecl(declaration)
+ {
+ }
+ MappedAttribute(const AtomicString& name, const AtomicString& value, CSSMappedAttributeDeclaration* declaration)
+ : Attribute(name, value), m_styleDecl(declaration)
+ {
+ }
+
+ RefPtr<CSSMappedAttributeDeclaration> m_styleDecl;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Peter Kelly (pmk@post.com)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef MappedAttributeEntry_h
+#define MappedAttributeEntry_h
+
+namespace WebCore {
+
+enum MappedAttributeEntry {
+ eNone
+ , eUniversal
+ , ePersistent
+ , eReplaced
+ , eBlock
+ , eHR
+ , eUnorderedList
+ , eListItem
+ , eTable
+ , eCell
+ , eCaption
+ , eBDO
+ , ePre
+#if ENABLE(SVG)
+ , eSVG
+#endif
+// When adding new entries, make sure to keep eLastEntry at the end of the list.
+ , eLastEntry
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Matrix3DTransformOperation_h
+#define Matrix3DTransformOperation_h
+
+#include "TransformOperation.h"
+
+namespace WebCore {
+
+class Matrix3DTransformOperation : public TransformOperation {
+public:
+ static PassRefPtr<Matrix3DTransformOperation> create(const TransformationMatrix& matrix)
+ {
+ return adoptRef(new Matrix3DTransformOperation(matrix));
+ }
+
+private:
+ virtual bool isIdentity() const { return m_matrix.isIdentity(); }
+
+ virtual OperationType getOperationType() const { return MATRIX_3D; }
+ virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == MATRIX_3D; }
+
+ virtual bool operator==(const TransformOperation& o) const
+ {
+ if (!isSameType(o))
+ return false;
+ const Matrix3DTransformOperation* m = static_cast<const Matrix3DTransformOperation*>(&o);
+ return m_matrix == m->m_matrix;
+ }
+
+ virtual bool apply(TransformationMatrix& transform, const IntSize&) const
+ {
+ transform.multLeft(TransformationMatrix(m_matrix));
+ return false;
+ }
+
+ virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
+
+ Matrix3DTransformOperation(const TransformationMatrix& mat)
+ {
+ m_matrix = mat;
+ }
+
+ TransformationMatrix m_matrix;
+};
+
+} // namespace WebCore
+
+#endif // Matrix3DTransformOperation_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef MatrixTransformOperation_h
+#define MatrixTransformOperation_h
+
+#include "TransformOperation.h"
+#include "TransformationMatrix.h"
+
+namespace WebCore {
+
+class MatrixTransformOperation : public TransformOperation {
+public:
+ static PassRefPtr<MatrixTransformOperation> create(double a, double b, double c, double d, double e, double f)
+ {
+ return adoptRef(new MatrixTransformOperation(a, b, c, d, e, f));
+ }
+
+ static PassRefPtr<MatrixTransformOperation> create(const TransformationMatrix& t)
+ {
+ return adoptRef(new MatrixTransformOperation(t));
+ }
+
+private:
+ virtual bool isIdentity() const { return m_a == 1 && m_b == 0 && m_c == 0 && m_d == 1 && m_e == 0 && m_f == 0; }
+
+ virtual OperationType getOperationType() const { return MATRIX; }
+ virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == MATRIX; }
+
+ virtual bool operator==(const TransformOperation& o) const
+ {
+ if (!isSameType(o))
+ return false;
+
+ const MatrixTransformOperation* m = static_cast<const MatrixTransformOperation*>(&o);
+ return m_a == m->m_a && m_b == m->m_b && m_c == m->m_c && m_d == m->m_d && m_e == m->m_e && m_f == m->m_f;
+ }
+
+ virtual bool apply(TransformationMatrix& transform, const IntSize&) const
+ {
+ TransformationMatrix matrix(m_a, m_b, m_c, m_d, m_e, m_f);
+ transform.multLeft(TransformationMatrix(matrix));
+ return false;
+ }
+
+ virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
+
+ MatrixTransformOperation(double a, double b, double c, double d, double e, double f)
+ : m_a(a)
+ , m_b(b)
+ , m_c(c)
+ , m_d(d)
+ , m_e(e)
+ , m_f(f)
+ {
+ }
+
+ MatrixTransformOperation(const TransformationMatrix& t)
+ : m_a(t.a())
+ , m_b(t.b())
+ , m_c(t.c())
+ , m_d(t.d())
+ , m_e(t.e())
+ , m_f(t.f())
+ {
+ }
+
+ double m_a;
+ double m_b;
+ double m_c;
+ double m_d;
+ double m_e;
+ double m_f;
+};
+
+} // namespace WebCore
+
+#endif // MatrixTransformOperation_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MediaControlElements_h
+#define MediaControlElements_h
+
+#if ENABLE(VIDEO)
+
+#include "HTMLDivElement.h"
+#include "HTMLInputElement.h"
+#include "HTMLMediaElement.h"
+#include "RenderBlock.h"
+
+// These are the shadow elements used in RenderMedia
+
+namespace WebCore {
+
+class Event;
+class Frame;
+
+enum MediaControlElements {
+ MediaFullscreenButton, MediaMuteButton, MediaPlayButton,
+ MediaSeekBackButton, MediaSeekForwardButton, MediaSlider, MediaSliderThumb,
+ MediaUnMuteButton, MediaPauseButton, MediaTimelineContainer, MediaCurrentTimeDisplay,
+ MediaTimeRemainingDisplay, MediaControlsPanel
+};
+
+class MediaControlShadowRootElement : public HTMLDivElement {
+public:
+ MediaControlShadowRootElement(Document*, HTMLMediaElement*);
+
+ virtual bool isShadowNode() const { return true; }
+ virtual Node* shadowParentNode() { return m_mediaElement; }
+
+private:
+ HTMLMediaElement* m_mediaElement;
+};
+
+ // ----------------------------
+
+class MediaTextDisplayElement : public HTMLDivElement
+{
+public:
+ MediaTextDisplayElement(Document*, RenderStyle::PseudoId, HTMLMediaElement*);
+ void attachToParent(Element*);
+ void update();
+protected:
+ HTMLMediaElement* m_mediaElement;
+};
+
+// ----------------------------
+
+class MediaTimeDisplayElement : public MediaTextDisplayElement {
+public:
+ MediaTimeDisplayElement(Document*, HTMLMediaElement*, bool currentTime);
+};
+
+// ----------------------------
+
+class MediaControlInputElement : public HTMLInputElement {
+public:
+ MediaControlInputElement(Document*, RenderStyle::PseudoId, const String& type, HTMLMediaElement*);
+ void attachToParent(Element*);
+ void update();
+ bool hitTest(const IntPoint& absPoint);
+protected:
+ HTMLMediaElement* m_mediaElement;
+};
+
+// ----------------------------
+
+class MediaControlMuteButtonElement : public MediaControlInputElement {
+public:
+ MediaControlMuteButtonElement(Document*, HTMLMediaElement*);
+ virtual void defaultEventHandler(Event*);
+};
+
+// ----------------------------
+
+class MediaControlPlayButtonElement : public MediaControlInputElement {
+public:
+ MediaControlPlayButtonElement(Document*, HTMLMediaElement*);
+ virtual void defaultEventHandler(Event*);
+};
+
+// ----------------------------
+
+class MediaControlSeekButtonElement : public MediaControlInputElement {
+public:
+ MediaControlSeekButtonElement(Document*, HTMLMediaElement*, bool forward);
+ virtual void defaultEventHandler(Event*);
+ void seekTimerFired(Timer<MediaControlSeekButtonElement>*);
+
+private:
+ bool m_forward;
+ bool m_seeking;
+ bool m_capturing;
+ Timer<MediaControlSeekButtonElement> m_seekTimer;
+};
+
+// ----------------------------
+
+class MediaControlTimelineElement : public MediaControlInputElement {
+public:
+ MediaControlTimelineElement(Document*, HTMLMediaElement*);
+ virtual void defaultEventHandler(Event*);
+ void update(bool updateDuration = true);
+};
+
+// ----------------------------
+
+class MediaControlFullscreenButtonElement : public MediaControlInputElement {
+public:
+ MediaControlFullscreenButtonElement(Document*, HTMLMediaElement*);
+ virtual void defaultEventHandler(Event*);
+};
+
+// ----------------------------
+
+class RenderMediaControlShadowRoot : public RenderBlock {
+public:
+ RenderMediaControlShadowRoot(Element* e) : RenderBlock(e) { }
+ void setParent(RenderObject* p) { RenderObject::setParent(p); }
+};
+
+// ----------------------------
+
+} //namespace WebCore
+#endif // enable(video)
+#endif // MediaControlElements_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MediaDocument_h
+#define MediaDocument_h
+
+#if ENABLE(VIDEO)
+
+#include "HTMLDocument.h"
+
+namespace WebCore {
+
+class MediaDocument : public HTMLDocument {
+public:
+ static PassRefPtr<MediaDocument> create(Frame* frame)
+ {
+ return new MediaDocument(frame);
+ }
+
+ virtual void defaultEventHandler(Event*);
+
+private:
+ MediaDocument(Frame*);
+
+ virtual bool isMediaDocument() const { return true; }
+ virtual Tokenizer* createTokenizer();
+};
+
+}
+
+#endif
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MediaError_h
+#define MediaError_h
+
+#if ENABLE(VIDEO)
+
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class MediaError : public RefCounted<MediaError> {
+public:
+ enum Code { MEDIA_ERR_ABORTED = 1, MEDIA_ERR_NETWORK, MEDIA_ERR_DECODE, MEDIA_ERR_NONE_SUPPORTED };
+
+ static PassRefPtr<MediaError> create(Code code) { return adoptRef(new MediaError(code)); }
+
+ Code code() const { return m_code; }
+
+private:
+ MediaError(Code code) : m_code(code) { }
+
+ Code m_code;
+};
+
+} // namespace WebCore
+
+#endif
+#endif
--- /dev/null
+/*
+ * This file is part of the CSS implementation for KDE.
+ *
+ * Copyright (C) 2005 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef MediaFeatureNames_h
+#define MediaFeatureNames_h
+
+#include "AtomicString.h"
+
+namespace WebCore {
+ namespace MediaFeatureNames {
+
+#define CSS_MEDIAQUERY_NAMES_FOR_EACH_MEDIAFEATURE(macro) \
+ macro(color, "color") \
+ macro(grid, "grid") \
+ macro(monochrome, "monochrome") \
+ macro(height, "height") \
+ macro(width, "width") \
+ macro(device_aspect_ratio, "device-aspect-ratio") \
+ macro(device_pixel_ratio, "-webkit-device-pixel-ratio") \
+ macro(device_height, "device-height") \
+ macro(device_width, "device-width") \
+ macro(max_color, "max-color") \
+ macro(max_device_aspect_ratio, "max-device-aspect-ratio") \
+ macro(max_device_pixel_ratio, "-webkit-max-device-pixel-ratio") \
+ macro(max_device_height, "max-device-height") \
+ macro(max_device_width, "max-device-width") \
+ macro(max_height, "max-height") \
+ macro(max_monochrome, "max-monochrome") \
+ macro(max_width, "max-width") \
+ macro(min_color, "min-color") \
+ macro(min_device_aspect_ratio, "min-device-aspect-ratio") \
+ macro(min_device_pixel_ratio, "-webkit-min-device-pixel-ratio") \
+ macro(min_device_height, "min-device-height") \
+ macro(min_device_width, "min-device-width") \
+ macro(min_height, "min-height") \
+ macro(min_monochrome, "min-monochrome") \
+ macro(min_width, "min-width") \
+ macro(transform_2d, "-webkit-transform-2d") \
+ macro(transform_3d, "-webkit-transform-3d") \
+ macro(transition, "-webkit-transition") \
+ macro(animation, "-webkit-animation") \
+// end of macro
+
+#ifndef CSS_MEDIAQUERY_NAMES_HIDE_GLOBALS
+ #define CSS_MEDIAQUERY_NAMES_DECLARE(name, str) extern const AtomicString name##MediaFeature;
+ CSS_MEDIAQUERY_NAMES_FOR_EACH_MEDIAFEATURE(CSS_MEDIAQUERY_NAMES_DECLARE)
+ #undef CSS_MEDIAQUERY_NAMES_DECLARE
+#endif
+
+ void init();
+
+ } // namespace MediaFeatureNames
+} // namespace WebCore
+
+#endif // MediaFeatureNames_h
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef MediaList_h
+#define MediaList_h
+
+#include "StyleBase.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class CSSImportRule;
+class CSSStyleSheet;
+class MediaQuery;
+class String;
+
+typedef int ExceptionCode;
+
+class MediaList : public StyleBase {
+public:
+ static PassRefPtr<MediaList> create()
+ {
+ return adoptRef(new MediaList(0, false));
+ }
+ static PassRefPtr<MediaList> create(CSSImportRule* parentRule, const String& media)
+ {
+ return adoptRef(new MediaList(parentRule, media));
+ }
+ static PassRefPtr<MediaList> create(CSSStyleSheet* parentSheet, const String& media)
+ {
+ return adoptRef(new MediaList(parentSheet, media, false));
+ }
+
+ static PassRefPtr<MediaList> createAllowingDescriptionSyntax(const String& mediaQueryOrDescription)
+ {
+ return adoptRef(new MediaList(0, mediaQueryOrDescription, true));
+ }
+ static PassRefPtr<MediaList> createAllowingDescriptionSyntax(CSSStyleSheet* parentSheet, const String& mediaQueryOrDescription)
+ {
+ return adoptRef(new MediaList(parentSheet, mediaQueryOrDescription, true));
+ }
+
+ static PassRefPtr<MediaList> create(const String& media, bool allowDescriptionSyntax)
+ {
+ return adoptRef(new MediaList(0, media, allowDescriptionSyntax));
+ }
+
+ virtual ~MediaList();
+
+ unsigned length() const { return m_queries.size(); }
+ String item(unsigned index) const;
+ void deleteMedium(const String& oldMedium, ExceptionCode&);
+ void appendMedium(const String& newMedium, ExceptionCode&);
+
+ String mediaText() const;
+ void setMediaText(const String&, ExceptionCode&xo);
+
+ void appendMediaQuery(MediaQuery*);
+ const Vector<MediaQuery*>& mediaQueries() const { return m_queries; }
+
+private:
+ MediaList(CSSStyleSheet* parentSheet, bool fallbackToDescription);
+ MediaList(CSSStyleSheet* parentSheet, const String& media, bool fallbackToDescription);
+ MediaList(CSSImportRule* parentRule, const String& media);
+
+ void notifyChanged();
+
+ Vector<MediaQuery*> m_queries;
+ bool m_fallback; // true if failed media query parsing should fallback to media description parsing
+};
+
+} // namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MediaPlayer_h
+#define MediaPlayer_h
+
+#if ENABLE(VIDEO)
+
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+#include "MediaPlayerProxy.h"
+#endif
+
+#include "IntRect.h"
+#include "StringHash.h"
+#include <wtf/HashSet.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+class ContentType;
+class FrameView;
+class GraphicsContext;
+class IntRect;
+class IntSize;
+class MediaPlayer;
+class MediaPlayerPrivateInterface;
+class String;
+
+class MediaPlayerClient {
+public:
+ virtual ~MediaPlayerClient() { }
+
+ // the network state has changed
+ virtual void mediaPlayerNetworkStateChanged(MediaPlayer*) { }
+
+ // the ready state has changed
+ virtual void mediaPlayerReadyStateChanged(MediaPlayer*) { }
+
+ // the volume or muted state has changed
+ virtual void mediaPlayerVolumeChanged(MediaPlayer*) { }
+
+ // time has jumped, eg. not as a result of normal playback
+ virtual void mediaPlayerTimeChanged(MediaPlayer*) { }
+
+ // a new frame of video is available
+ virtual void mediaPlayerRepaint(MediaPlayer*) { }
+
+ // the media file duration has changed, or is now known
+ virtual void mediaPlayerDurationChanged(MediaPlayer*) { }
+
+ // the playback rate has changed
+ virtual void mediaPlayerRateChanged(MediaPlayer*) { }
+
+ // the movie size has changed
+ virtual void mediaPlayerSizeChanged(MediaPlayer*) { }
+};
+
+class MediaPlayer : Noncopyable {
+public:
+ MediaPlayer(MediaPlayerClient*);
+ virtual ~MediaPlayer();
+
+ // media engine support
+ enum SupportsType { IsNotSupported, IsSupported, MayBeSupported };
+ static MediaPlayer::SupportsType supportsType(ContentType contentType);
+ static void getSupportedTypes(HashSet<String>&);
+ static bool isAvailable();
+
+ IntSize naturalSize();
+ bool hasVideo();
+
+ void setFrameView(FrameView* frameView) { m_frameView = frameView; }
+ FrameView* frameView() { return m_frameView; }
+ bool inMediaDocument();
+
+ IntSize size() const { return m_size; }
+ void setSize(const IntSize& size);
+
+ void load(const String& url, const ContentType& contentType);
+ void cancelLoad();
+
+ bool visible() const;
+ void setVisible(bool);
+
+ void play();
+ void pause();
+
+ bool paused() const;
+ bool seeking() const;
+
+ float duration() const;
+ float currentTime() const;
+ void seek(float time);
+
+ void setEndTime(float time);
+
+ float rate() const;
+ void setRate(float);
+
+ float maxTimeBuffered();
+ float maxTimeSeekable();
+
+ unsigned bytesLoaded();
+ bool totalBytesKnown();
+ unsigned totalBytes();
+
+ float volume() const;
+ void setVolume(float);
+
+ int dataRate() const;
+
+ bool autobuffer() const;
+ void setAutobuffer(bool);
+
+ void paint(GraphicsContext*, const IntRect&);
+
+ enum NetworkState { Empty, Idle, Loading, Loaded, FormatError, NetworkError, DecodeError };
+ NetworkState networkState();
+
+ enum ReadyState { HaveNothing, HaveMetadata, HaveCurrentData, HaveFutureData, HaveEnoughData };
+ ReadyState readyState();
+
+ void networkStateChanged();
+ void readyStateChanged();
+ void volumeChanged();
+ void timeChanged();
+ void sizeChanged();
+ void rateChanged();
+ void durationChanged();
+
+ void repaint();
+
+ MediaPlayerClient* mediaPlayerClient() const { return m_mediaPlayerClient; }
+
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+ void setPoster(const String& url);
+ void deliverNotification(MediaPlayerProxyNotificationType notification);
+ void setMediaPlayerProxy(WebMediaPlayerProxy* proxy);
+#endif
+
+private:
+ static void initializeMediaEngines();
+
+ MediaPlayerClient* m_mediaPlayerClient;
+ OwnPtr<MediaPlayerPrivateInterface*> m_private;
+ void* m_currentMediaEngine;
+ FrameView* m_frameView;
+ IntSize m_size;
+ bool m_visible;
+ float m_rate;
+ float m_volume;
+ bool m_autobuffer;
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+ WebMediaPlayerProxy* m_playerProxy; // not owned or used, passed to m_private
+#endif
+};
+
+typedef MediaPlayerPrivateInterface* (*CreateMediaEnginePlayer)(MediaPlayer*);
+typedef void (*MediaEngineSupportedTypes)(HashSet<String>& types);
+typedef MediaPlayer::SupportsType (*MediaEngineSupportsType)(const String& type, const String& codecs);
+
+typedef void (*MediaEngineRegistrar)(CreateMediaEnginePlayer, MediaEngineSupportedTypes, MediaEngineSupportsType);
+
+
+}
+
+#endif // ENABLE(VIDEO)
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MediaPlayerPrivate_h
+#define MediaPlayerPrivate_h
+
+#if ENABLE(VIDEO)
+
+#include "MediaPlayer.h"
+
+namespace WebCore {
+
+class IntRect;
+class IntSize;
+class String;
+
+class MediaPlayerPrivateInterface {
+public:
+ virtual ~MediaPlayerPrivateInterface() { }
+
+ virtual void load(const String& url) = 0;
+ virtual void cancelLoad() = 0;
+
+ virtual void play() = 0;
+ virtual void pause() = 0;
+
+ virtual IntSize naturalSize() const = 0;
+
+ virtual bool hasVideo() const = 0;
+
+ virtual void setVisible(bool) = 0;
+
+ virtual float duration() const = 0;
+
+ virtual float currentTime() const = 0;
+ virtual void seek(float time) = 0;
+ virtual bool seeking() const = 0;
+
+ virtual void setEndTime(float time) = 0;
+
+ virtual void setRate(float) = 0;
+ virtual bool paused() const = 0;
+
+ virtual void setVolume(float) = 0;
+
+ virtual MediaPlayer::NetworkState networkState() const = 0;
+ virtual MediaPlayer::ReadyState readyState() const = 0;
+
+ virtual float maxTimeSeekable() const = 0;
+ virtual float maxTimeBuffered() const = 0;
+
+ virtual int dataRate() const = 0;
+
+ virtual bool totalBytesKnown() const { return totalBytes() > 0; }
+ virtual unsigned totalBytes() const = 0;
+ virtual unsigned bytesLoaded() const = 0;
+
+ virtual void setSize(const IntSize&) = 0;
+
+ virtual void paint(GraphicsContext*, const IntRect&) = 0 ;
+
+ virtual void setAutobuffer(bool) { };
+
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+ virtual void setPoster(const String& url) = 0;
+ virtual void deliverNotification(MediaPlayerProxyNotificationType) = 0;
+ virtual void setMediaPlayerProxy(WebMediaPlayerProxy*) = 0;
+#endif
+};
+
+}
+
+#endif
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MediaPlayerPrivateQTKit_h
+#define MediaPlayerPrivateQTKit_h
+
+#if ENABLE(VIDEO)
+
+#include "MediaPlayerPrivate.h"
+#include "Timer.h"
+#include <wtf/RetainPtr.h>
+
+#ifdef __OBJC__
+#import <QTKit/QTTime.h>
+@class QTMovie;
+@class QTMovieView;
+@class QTVideoRendererWebKitOnly;
+@class WebCoreMovieObserver;
+#else
+class QTMovie;
+class QTMovieView;
+class QTTime;
+class QTVideoRendererWebKitOnly;
+class WebCoreMovieObserver;
+#endif
+
+#ifndef DRAW_FRAME_RATE
+#define DRAW_FRAME_RATE 0
+#endif
+
+namespace WebCore {
+
+class MediaPlayerPrivate : public MediaPlayerPrivateInterface {
+public:
+ static void registerMediaEngine(MediaEngineRegistrar);
+
+ ~MediaPlayerPrivate();
+
+ void repaint();
+ void loadStateChanged();
+ void rateChanged();
+ void sizeChanged();
+ void timeChanged();
+ void didEnd();
+
+private:
+ MediaPlayerPrivate(MediaPlayer*);
+
+ // engine support
+ static MediaPlayerPrivateInterface* MediaPlayerPrivate::create(MediaPlayer* player);
+ static void getSupportedTypes(HashSet<String>& types);
+ static MediaPlayer::SupportsType supportsType(const String& type, const String& codecs);
+ static bool isAvailable();
+
+ IntSize naturalSize() const;
+ bool hasVideo() const;
+
+ void load(const String& url);
+ void cancelLoad();
+
+ void play();
+ void pause();
+
+ bool paused() const;
+ bool seeking() const;
+
+ float duration() const;
+ float currentTime() const;
+ void seek(float time);
+
+ void setRate(float);
+ void setVolume(float);
+
+ void setEndTime(float time);
+
+ int dataRate() const;
+
+ MediaPlayer::NetworkState networkState() const { return m_networkState; }
+ MediaPlayer::ReadyState readyState() const { return m_readyState; }
+
+ float maxTimeBuffered() const;
+ float maxTimeSeekable() const;
+ unsigned bytesLoaded() const;
+ bool totalBytesKnown() const;
+ unsigned totalBytes() const;
+
+ void setVisible(bool);
+ void setSize(const IntSize&);
+
+ void paint(GraphicsContext*, const IntRect&);
+
+ void createQTMovie(const String& url);
+ void setUpVideoRendering();
+ void tearDownVideoRendering();
+ void createQTMovieView();
+ void detachQTMovieView();
+ void createQTVideoRenderer();
+ void destroyQTVideoRenderer();
+ QTTime createQTTime(float time) const;
+
+ void updateStates();
+ void doSeek();
+ void cancelSeek();
+ void seekTimerFired(Timer<MediaPlayerPrivate>*);
+ float maxTimeLoaded() const;
+ void disableUnsupportedTracks();
+
+ bool metaDataAvailable() const { return m_qtMovie && m_readyState >= MediaPlayer::HaveMetadata; }
+
+ MediaPlayer* m_player;
+ RetainPtr<QTMovie> m_qtMovie;
+ RetainPtr<QTMovieView> m_qtMovieView;
+ RetainPtr<QTVideoRendererWebKitOnly> m_qtVideoRenderer;
+ RetainPtr<WebCoreMovieObserver> m_objcObserver;
+ float m_seekTo;
+ Timer<MediaPlayerPrivate> m_seekTimer;
+ MediaPlayer::NetworkState m_networkState;
+ MediaPlayer::ReadyState m_readyState;
+ bool m_startedPlaying;
+ bool m_isStreaming;
+ bool m_visible;
+ IntRect m_rect;
+ unsigned m_enabledTrackCount;
+ float m_duration;
+#if DRAW_FRAME_RATE
+ int m_frameCountWhilePlaying;
+ double m_timeStartedPlaying;
+ double m_timeStoppedPlaying;
+#endif
+};
+
+}
+
+#endif
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MediaPlayerProxy_h
+#define MediaPlayerProxy_h
+
+#ifdef __OBJC__
+@class WebMediaPlayerProxy;
+#else
+class WebMediaPlayerProxy;
+#endif
+
+enum MediaPlayerProxyNotificationType {
+
+ MediaPlayerNotificationMediaValidated = 1,
+ MediaPlayerNotificationMediaFailedToValidate,
+
+ MediaPlayerNotificationStartUsingNetwork,
+ MediaPlayerNotificationStopUsingNetwork,
+
+ MediaPlayerNotificationEnteredFullScreen,
+ MediaPlayerNotificationExitedFullScreen,
+
+ MediaPlayerNotificationReadyForInspection,
+ MediaPlayerNotificationReadyForPlayback,
+ MediaPlayerNotificationDidPlayToTheEnd,
+
+ MediaPlayerNotificationPlaybackFailed,
+
+ MediaPlayerNotificationStreamLikelyToKeepUp,
+ MediaPlayerNotificationStreamUnlikelyToKeepUp,
+ MediaPlayerNotificationStreamBufferFull,
+ MediaPlayerNotificationStreamRanDry,
+ MediaPlayerNotificationFileLoaded,
+
+ MediaPlayerNotificationSizeDidChange,
+ MediaPlayerNotificationVolumeDidChange,
+ MediaPlayerNotificationMutedDidChange,
+ MediaPlayerNotificationTimeJumped,
+
+ MediaPlayerNotificationPlayPauseButtonPressed,
+};
+
+#ifdef __OBJC__
+@interface NSObject (WebMediaPlayerProxy)
+
+- (int)_interfaceVersion;
+
+- (void)_disconnect;
+
+- (void)_load:(NSURL *)url;
+- (void)_cancelLoad;
+
+- (void)_setPoster:(NSURL *)url;
+
+- (void)_play;
+- (void)_pause;
+
+- (NSSize)_naturalSize;
+
+- (BOOL)_hasVideo;
+- (BOOL)_hasAudio;
+
+- (NSTimeInterval)_duration;
+
+- (double)_currentTime;
+- (void)_setCurrentTime:(double)time;
+- (BOOL)_seeking;
+
+- (void)_setEndTime:(double)time;
+
+- (float)_rate;
+- (void)_setRate:(float)rate;
+
+- (float)_volume;
+- (void)_setVolume:(float)newVolume;
+
+- (BOOL)_muted;
+- (void)_setMuted:(BOOL)muted;
+
+- (float)_maxTimeBuffered;
+- (float)_maxTimeSeekable;
+- (NSArray *)_bufferedTimeRanges;
+
+- (int)_dataRate;
+
+- (BOOL)_totalBytesKnown;
+- (unsigned)_totalBytes;
+- (unsigned)_bytesLoaded;
+
+- (NSArray *)_mimeTypes;
+
+@end
+#endif
+
+#endif
--- /dev/null
+/*
+ * CSS Media Query
+ *
+ * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MediaQuery_h
+#define MediaQuery_h
+
+#include "PlatformString.h"
+#include <wtf/Vector.h>
+
+namespace WebCore {
+class MediaQueryExp;
+
+class MediaQuery
+{
+public:
+ enum Restrictor {
+ Only, Not, None
+ };
+
+ MediaQuery(Restrictor r, const String& mediaType, Vector<MediaQueryExp*>* exprs);
+ ~MediaQuery();
+
+ Restrictor restrictor() const { return m_restrictor; }
+ const Vector<MediaQueryExp*>* expressions() const { return m_expressions; }
+ String mediaType() const { return m_mediaType; }
+ bool operator==(const MediaQuery& other) const;
+ void append(MediaQueryExp* newExp) { m_expressions->append(newExp); }
+ String cssText() const;
+
+ private:
+ Restrictor m_restrictor;
+ String m_mediaType;
+ Vector<MediaQueryExp*>* m_expressions;
+};
+
+} // namespace
+
+#endif
--- /dev/null
+/*
+ * CSS Media Query Evaluator
+ *
+ * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MediaQueryEvaluator_h
+#define MediaQueryEvaluator_h
+
+#include "PlatformString.h"
+
+namespace WebCore {
+class CSSStyleSelector;
+class Frame;
+class RenderStyle;
+class MediaList;
+class MediaQueryExp;
+
+/**
+ * Class that evaluates css media queries as defined in
+ * CSS3 Module "Media Queries" (http://www.w3.org/TR/css3-mediaqueries/)
+ * Special constructors are needed, if simple media queries are to be
+ * evaluated without knowledge of the medium features. This can happen
+ * for example when parsing UA stylesheets, if evaluation is done
+ * right after parsing.
+ *
+ * the boolean parameter is used to approximate results of evaluation, if
+ * the device characteristics are not known. This can be used to prune the loading
+ * of stylesheets to only those which are probable to match.
+ */
+class MediaQueryEvaluator
+{
+public:
+ /** Creates evaluator which evaluates only simple media queries
+ * Evaluator returns true for "all", and returns value of \mediaFeatureResult
+ * for any media features
+ */
+ MediaQueryEvaluator(bool mediaFeatureResult = false);
+
+ /** Creates evaluator which evaluates only simple media queries
+ * Evaluator returns true for acceptedMediaType and returns value of \mediafeatureResult
+ * for any media features
+ */
+ MediaQueryEvaluator(const String& acceptedMediaType, bool mediaFeatureResult = false);
+ MediaQueryEvaluator(const char* acceptedMediaType, bool mediaFeatureResult = false);
+
+ /** Creates evaluator which evaluates full media queries
+ */
+ MediaQueryEvaluator(const String& acceptedMediaType, Frame*, RenderStyle*);
+
+ ~MediaQueryEvaluator();
+
+ bool mediaTypeMatch(const String& mediaTypeToMatch) const;
+ bool mediaTypeMatchSpecific(const char* mediaTypeToMatch) const;
+
+ /** Evaluates a list of media queries */
+ bool eval(const MediaList*, CSSStyleSelector* = 0) const;
+
+ /** Evaluates media query subexpression, ie "and (media-feature: value)" part */
+ bool eval(const MediaQueryExp*) const;
+
+private:
+ String m_mediaType;
+ Frame* m_frame; // not owned
+ RenderStyle* m_style; // not owned
+ bool m_expResult;
+};
+
+} // namespace
+#endif
--- /dev/null
+/*
+ * CSS Media Query
+ *
+ * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MediaQueryExp_h
+#define MediaQueryExp_h
+
+#include "AtomicString.h"
+#include "CSSValue.h"
+#include "MediaFeatureNames.h"
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+class CSSParserValueList;
+
+class MediaQueryExp
+{
+public:
+ MediaQueryExp(const AtomicString& mediaFeature, CSSParserValueList* values);
+ ~MediaQueryExp();
+
+ AtomicString mediaFeature() const { return m_mediaFeature; }
+
+ CSSValue* value() const { return m_value.get(); }
+
+ bool operator==(const MediaQueryExp& other) const {
+ return (other.m_mediaFeature == m_mediaFeature)
+ && ((!other.m_value && !m_value)
+ || (other.m_value && m_value && other.m_value->cssText() == m_value->cssText()));
+ }
+
+ bool isViewportDependent() const { return m_mediaFeature == MediaFeatureNames::widthMediaFeature ||
+ m_mediaFeature == MediaFeatureNames::heightMediaFeature ||
+ m_mediaFeature == MediaFeatureNames::min_widthMediaFeature ||
+ m_mediaFeature == MediaFeatureNames::min_heightMediaFeature ||
+ m_mediaFeature == MediaFeatureNames::max_widthMediaFeature ||
+ m_mediaFeature == MediaFeatureNames::max_heightMediaFeature; }
+private:
+ AtomicString m_mediaFeature;
+ RefPtr<CSSValue> m_value;
+};
+
+} // namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MergeIdenticalElementsCommand_h
+#define MergeIdenticalElementsCommand_h
+
+#include "EditCommand.h"
+
+namespace WebCore {
+
+class MergeIdenticalElementsCommand : public SimpleEditCommand {
+public:
+ static PassRefPtr<MergeIdenticalElementsCommand> create(PassRefPtr<Element> element1, PassRefPtr<Element> element2)
+ {
+ return adoptRef(new MergeIdenticalElementsCommand(element1, element2));
+ }
+
+private:
+ MergeIdenticalElementsCommand(PassRefPtr<Element>, PassRefPtr<Element>);
+
+ virtual void doApply();
+ virtual void doUnapply();
+
+ RefPtr<Element> m_element1;
+ RefPtr<Element> m_element2;
+ RefPtr<Node> m_atChild;
+};
+
+} // namespace WebCore
+
+#endif // MergeIdenticalElementsCommand_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef MessageChannel_h
+#define MessageChannel_h
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+ class MessagePort;
+ class ScriptExecutionContext;
+
+ class MessageChannel : public RefCounted<MessageChannel> {
+ public:
+ static PassRefPtr<MessageChannel> create(ScriptExecutionContext* context) { return adoptRef(new MessageChannel(context)); }
+ ~MessageChannel();
+
+ MessagePort* port1() const { return m_port1.get(); }
+ MessagePort* port2() const { return m_port2.get(); }
+
+ private:
+ MessageChannel(ScriptExecutionContext*);
+
+ RefPtr<MessagePort> m_port1;
+ RefPtr<MessagePort> m_port2;
+ };
+
+} // namespace WebCore
+
+#endif // MessageChannel_h
--- /dev/null
+/*
+ * Copyright (C) 2007 Henry Mason (hmason@mac.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef MessageEvent_h
+#define MessageEvent_h
+
+#include "Event.h"
+#include "MessagePort.h"
+
+namespace WebCore {
+
+ class DOMWindow;
+
+ class MessageEvent : public Event {
+ public:
+ static PassRefPtr<MessageEvent> create()
+ {
+ return adoptRef(new MessageEvent);
+ }
+ static PassRefPtr<MessageEvent> create(const String& data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassRefPtr<MessagePort> messagePort)
+ {
+ return adoptRef(new MessageEvent(data, origin, lastEventId, source, messagePort));
+ }
+ virtual ~MessageEvent();
+
+ void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& data, const String& origin, const String& lastEventId, DOMWindow* source, MessagePort*);
+
+ const String& data() const { return m_data; }
+ const String& origin() const { return m_origin; }
+ const String& lastEventId() const { return m_lastEventId; }
+ DOMWindow* source() const { return m_source.get(); }
+ MessagePort* messagePort() const { return m_messagePort.get(); }
+
+ virtual bool isMessageEvent() const;
+
+ private:
+ MessageEvent();
+ MessageEvent(const String& data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassRefPtr<MessagePort> messagePort);
+
+ String m_data;
+ String m_origin;
+ String m_lastEventId;
+ RefPtr<DOMWindow> m_source;
+ RefPtr<MessagePort> m_messagePort;
+ };
+
+} // namespace WebCore
+
+#endif // MessageEvent_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef MessagePort_h
+#define MessagePort_h
+
+#include "AtomicStringHash.h"
+#include "EventListener.h"
+#include "EventTarget.h"
+
+#include <wtf/HashMap.h>
+#include <wtf/MessageQueue.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+ class AtomicStringImpl;
+ class Event;
+ class Frame;
+ class ScriptExecutionContext;
+ class String;
+ class WorkerContext;
+
+ class MessagePort : public RefCounted<MessagePort>, public EventTarget {
+ public:
+ static PassRefPtr<MessagePort> create(ScriptExecutionContext* scriptExecutionContext) { return adoptRef(new MessagePort(scriptExecutionContext)); }
+ ~MessagePort();
+
+ PassRefPtr<MessagePort> clone(ExceptionCode&); // Returns a port that isn't attached to any context.
+
+ bool active() const { return m_entangledPort; }
+ void postMessage(const String& message, ExceptionCode&);
+ void postMessage(const String& message, MessagePort*, ExceptionCode&);
+ PassRefPtr<MessagePort> startConversation(ScriptExecutionContext*, const String& message);
+ void start();
+ void close();
+
+ bool queueIsOpen() const { return m_queueIsOpen; }
+
+ MessagePort* entangledPort() { return m_entangledPort; }
+ static void entangle(MessagePort*, MessagePort*);
+ void unentangle();
+
+ void contextDestroyed();
+ void attachToContext(ScriptExecutionContext*);
+ virtual ScriptExecutionContext* scriptExecutionContext() const;
+
+ virtual MessagePort* toMessagePort() { return this; }
+
+ void queueCloseEvent();
+ void dispatchMessages();
+
+ virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture);
+ virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture);
+ virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&);
+
+ typedef Vector<RefPtr<EventListener> > ListenerVector;
+ typedef HashMap<AtomicString, ListenerVector> EventListenersMap;
+ EventListenersMap& eventListeners() { return m_eventListeners; }
+
+ using RefCounted<MessagePort>::ref;
+ using RefCounted<MessagePort>::deref;
+
+ bool hasPendingActivity();
+
+ // FIXME: Per current spec, setting onmessage should automagically start the port (unlike addEventListener("message", ...)).
+ void setOnmessage(PassRefPtr<EventListener> eventListener) { m_onMessageListener = eventListener; }
+ EventListener* onmessage() const { return m_onMessageListener.get(); }
+
+ void setOnclose(PassRefPtr<EventListener> eventListener) { m_onCloseListener = eventListener; }
+ EventListener* onclose() const { return m_onCloseListener.get(); }
+
+ private:
+ friend class MessagePortCloseEventTask;
+
+ MessagePort(ScriptExecutionContext*);
+
+ virtual void refEventTarget() { ref(); }
+ virtual void derefEventTarget() { deref(); }
+
+ void dispatchCloseEvent();
+
+ MessagePort* m_entangledPort;
+
+ // FIXME: EventData is necessary to pass messages to other threads. In single threaded case, we can just queue a created event.
+ struct EventData : public RefCounted<EventData> {
+ static PassRefPtr<EventData> create(const String& message, PassRefPtr<MessagePort>);
+ ~EventData();
+
+ String message;
+ RefPtr<MessagePort> messagePort;
+
+ private:
+ EventData(const String& message, PassRefPtr<MessagePort>);
+ };
+ MessageQueue<RefPtr<EventData> > m_messageQueue; // FIXME: No need to use MessageQueue in single threaded case.
+ bool m_queueIsOpen;
+
+ ScriptExecutionContext* m_scriptExecutionContext;
+
+ RefPtr<EventListener> m_onMessageListener;
+ RefPtr<EventListener> m_onCloseListener;
+
+ EventListenersMap m_eventListeners;
+
+ bool m_pendingCloseEvent; // The port is GC protected while waiting for a close event to be dispatched.
+ };
+
+} // namespace WebCore
+
+#endif // MessagePort_h
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ModifySelectionListLevel_h
+#define ModifySelectionListLevel_h
+
+#include "CompositeEditCommand.h"
+
+namespace WebCore {
+
+// ModifySelectionListLevelCommand provides functions useful for both increasing and decreasing the list level.
+// It is the base class of IncreaseSelectionListLevelCommand and DecreaseSelectionListLevelCommand.
+// It is not used on its own.
+class ModifySelectionListLevelCommand : public CompositeEditCommand {
+protected:
+ ModifySelectionListLevelCommand(Document*);
+
+ void appendSiblingNodeRange(Node* startNode, Node* endNode, Element* newParent);
+ void insertSiblingNodeRangeBefore(Node* startNode, Node* endNode, Node* refNode);
+ void insertSiblingNodeRangeAfter(Node* startNode, Node* endNode, Node* refNode);
+
+private:
+ virtual bool preservesTypingStyle() const;
+};
+
+// IncreaseSelectionListLevelCommand moves the selected list items one level deeper.
+class IncreaseSelectionListLevelCommand : public ModifySelectionListLevelCommand {
+public:
+ static bool canIncreaseSelectionListLevel(Document*);
+ static PassRefPtr<Node> increaseSelectionListLevel(Document*);
+ static PassRefPtr<Node> increaseSelectionListLevelOrdered(Document*);
+ static PassRefPtr<Node> increaseSelectionListLevelUnordered(Document*);
+
+private:
+ enum Type { InheritedListType, OrderedList, UnorderedList };
+ static PassRefPtr<Node> increaseSelectionListLevelWithType(Document*, Type listType);
+
+ IncreaseSelectionListLevelCommand(Document*, Type);
+ virtual void doApply();
+
+ Type m_listType;
+ RefPtr<Node> m_listElement;
+};
+
+// DecreaseSelectionListLevelCommand moves the selected list items one level shallower.
+class DecreaseSelectionListLevelCommand : public ModifySelectionListLevelCommand {
+public:
+ static bool canDecreaseSelectionListLevel(Document*);
+ static void decreaseSelectionListLevel(Document*);
+
+private:
+ DecreaseSelectionListLevelCommand(Document*);
+ virtual void doApply();
+};
+
+} // namespace WebCore
+
+#endif // ModifySelectionListLevel_h
--- /dev/null
+/*
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
+ * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef MouseEvent_h
+#define MouseEvent_h
+
+#include "Clipboard.h"
+#include "EventTargetNode.h"
+#include "MouseRelatedEvent.h"
+
+namespace WebCore {
+
+ // Introduced in DOM Level 2
+ class MouseEvent : public MouseRelatedEvent {
+ public:
+ static PassRefPtr<MouseEvent> create()
+ {
+ return adoptRef(new MouseEvent);
+ }
+ static PassRefPtr<MouseEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view,
+ int detail, int screenX, int screenY, int pageX, int pageY,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
+ PassRefPtr<EventTargetNode> relatedTarget, PassRefPtr<Clipboard> clipboard = 0, bool isSimulated = false)
+ {
+ return adoptRef(new MouseEvent(type, canBubble, cancelable, view, detail, screenX, screenY, pageX, pageY,
+ ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget, clipboard, isSimulated));
+ }
+ virtual ~MouseEvent();
+
+ void initMouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>,
+ int detail, int screenX, int screenY, int clientX, int clientY,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
+ unsigned short button, PassRefPtr<EventTargetNode> relatedTarget);
+
+ // WinIE uses 1,4,2 for left/middle/right but not for click (just for mousedown/up, maybe others),
+ // but we will match the standard DOM.
+ unsigned short button() const { return m_button; }
+ bool buttonDown() const { return m_buttonDown; }
+ EventTargetNode* relatedTarget() const { return m_relatedTarget.get(); }
+
+ Clipboard* clipboard() const { return m_clipboard.get(); }
+
+ Node* toElement() const;
+ Node* fromElement() const;
+
+ Clipboard* dataTransfer() const { return isDragEvent() ? m_clipboard.get() : 0; }
+
+ virtual bool isMouseEvent() const;
+ virtual bool isDragEvent() const;
+ virtual int which() const;
+
+ private:
+ MouseEvent();
+ MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>,
+ int detail, int screenX, int screenY, int pageX, int pageY,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
+ PassRefPtr<EventTargetNode> relatedTarget, PassRefPtr<Clipboard> clipboard, bool isSimulated);
+
+ unsigned short m_button;
+ bool m_buttonDown;
+ RefPtr<EventTargetNode> m_relatedTarget;
+ RefPtr<Clipboard> m_clipboard;
+ };
+
+} // namespace WebCore
+
+#endif // MouseEvent_h
--- /dev/null
+/* This file is part of the KDE project
+ Copyright (C) 2000 Simon Hausmann <hausmann@kde.org>
+ Copyright (C) 2006 Apple Computer, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef MouseEventWithHitTestResults_h
+#define MouseEventWithHitTestResults_h
+
+#include "HitTestResult.h"
+#include "PlatformMouseEvent.h"
+
+namespace WebCore {
+
+class Scrollbar;
+
+// FIXME: Why doesn't this class just cache a HitTestResult instead of copying all of HitTestResult's fields over?
+class MouseEventWithHitTestResults {
+public:
+ MouseEventWithHitTestResults(const PlatformMouseEvent&, const HitTestResult&);
+
+ const PlatformMouseEvent& event() const { return m_event; }
+ const HitTestResult& hitTestResult() const { return m_hitTestResult; }
+ Node* targetNode() const;
+ const IntPoint localPoint() const;
+ Scrollbar* scrollbar() const;
+ bool isOverLink() const;
+ bool isOverWidget() const { return m_hitTestResult.isOverWidget(); }
+
+private:
+ PlatformMouseEvent m_event;
+ HitTestResult m_hitTestResult;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
+ * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef MouseRelatedEvent_h
+#define MouseRelatedEvent_h
+
+#include "UIEventWithKeyState.h"
+
+namespace WebCore {
+
+ // Internal only: Helper class for what's common between mouse and wheel events.
+ class MouseRelatedEvent : public UIEventWithKeyState {
+ public:
+ int screenX() const { return m_screenX; }
+ int screenY() const { return m_screenY; }
+ int clientX() const { return m_clientX; }
+ int clientY() const { return m_clientY; }
+ int layerX() const { return m_layerX; }
+ int layerY() const { return m_layerY; }
+ int offsetX() const { return m_offsetX; }
+ int offsetY() const { return m_offsetY; }
+ bool isSimulated() const { return m_isSimulated; }
+ virtual int pageX() const;
+ virtual int pageY() const;
+ int x() const;
+ int y() const;
+
+ protected:
+ MouseRelatedEvent();
+ MouseRelatedEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>,
+ int detail, int screenX, int screenY, int pageX, int pageY,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool isSimulated = false);
+
+ void initCoordinates();
+ void initCoordinates(int clientX, int clientY);
+ virtual void receivedTarget();
+
+ // Expose these so MouseEvent::initMouseEvent can set them.
+ int m_screenX;
+ int m_screenY;
+ int m_clientX;
+ int m_clientY;
+
+ private:
+ int m_pageX;
+ int m_pageY;
+ int m_layerX;
+ int m_layerY;
+ int m_offsetX;
+ int m_offsetY;
+ bool m_isSimulated;
+ };
+
+} // namespace WebCore
+
+#endif // MouseRelatedEvent_h
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MoveSelectionCommand_h
+#define MoveSelectionCommand_h
+
+#include "CompositeEditCommand.h"
+
+namespace WebCore {
+
+class DocumentFragment;
+
+class MoveSelectionCommand : public CompositeEditCommand {
+public:
+ static PassRefPtr<MoveSelectionCommand> create(PassRefPtr<DocumentFragment> fragment, const Position& position, bool smartMove = false)
+ {
+ return adoptRef(new MoveSelectionCommand(fragment, position, smartMove));
+ }
+
+private:
+ MoveSelectionCommand(PassRefPtr<DocumentFragment>, const Position&, bool smartMove);
+
+ virtual void doApply();
+ virtual EditAction editingAction() const;
+
+ RefPtr<DocumentFragment> m_fragment;
+ Position m_position;
+ bool m_smartMove;
+};
+
+} // namespace WebCore
+
+#endif // MoveSelectionCommand_h
--- /dev/null
+/*
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
+ * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef MutationEvent_h
+#define MutationEvent_h
+
+#include "Event.h"
+#include "Node.h"
+
+namespace WebCore {
+
+ class MutationEvent : public Event {
+ public:
+ enum attrChangeType {
+ MODIFICATION = 1,
+ ADDITION = 2,
+ REMOVAL = 3
+ };
+
+ static PassRefPtr<MutationEvent> create()
+ {
+ return adoptRef(new MutationEvent);
+ }
+ static PassRefPtr<MutationEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<Node> relatedNode,
+ const String& prevValue, const String& newValue, const String& attrName, unsigned short attrChange)
+ {
+ return adoptRef(new MutationEvent(type, canBubble, cancelable, relatedNode, prevValue, newValue, attrName, attrChange));
+ }
+
+ void initMutationEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<Node> relatedNode,
+ const String& prevValue, const String& newValue,
+ const String& attrName, unsigned short attrChange);
+
+ Node* relatedNode() const { return m_relatedNode.get(); }
+ String prevValue() const { return m_prevValue; }
+ String newValue() const { return m_newValue; }
+ String attrName() const { return m_attrName; }
+ unsigned short attrChange() const { return m_attrChange; }
+
+ virtual bool isMutationEvent() const;
+
+ private:
+ MutationEvent();
+ MutationEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<Node> relatedNode,
+ const String& prevValue, const String& newValue,
+ const String& attrName, unsigned short attrChange);
+
+ RefPtr<Node> m_relatedNode;
+ String m_prevValue;
+ String m_newValue;
+ String m_attrName;
+ unsigned short m_attrChange;
+ };
+
+} // namespace WebCore
+
+#endif // MutationEvent_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2007m 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef NameNodeList_h
+#define NameNodeList_h
+
+#include "AtomicString.h"
+#include "DynamicNodeList.h"
+
+namespace WebCore {
+
+ class String;
+
+ // NodeList which lists all Nodes in a Element with a given "name" attribute
+ class NameNodeList : public DynamicNodeList {
+ public:
+ static PassRefPtr<NameNodeList> create(PassRefPtr<Node> rootNode, const String& name, Caches* caches)
+ {
+ return adoptRef(new NameNodeList(rootNode, name, caches));
+ }
+
+ private:
+ NameNodeList(PassRefPtr<Node> rootNode, const String& name, Caches*);
+
+ virtual bool nodeMatches(Element*) const;
+
+ AtomicString m_nodeName;
+ };
+
+} // namespace WebCore
+
+#endif // NameNodeList_h
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Peter Kelly (pmk@post.com)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef NamedAttrMap_h
+#define NamedAttrMap_h
+
+#include "Attribute.h"
+#include "NamedNodeMap.h"
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+#ifdef __OBJC__
+#define id id_AVOID_KEYWORD
+#endif
+
+namespace WebCore {
+
+// the map of attributes of an element
+class NamedAttrMap : public NamedNodeMap {
+ friend class Element;
+protected:
+ NamedAttrMap(Element* element) : m_element(element) { }
+public:
+ static PassRefPtr<NamedAttrMap> create(Element* element) { return adoptRef(new NamedAttrMap(element)); }
+
+ virtual ~NamedAttrMap();
+
+ void setAttributes(const NamedAttrMap&);
+
+ // DOM methods & attributes for NamedNodeMap
+
+ virtual PassRefPtr<Node> getNamedItem(const String& name) const;
+ virtual PassRefPtr<Node> removeNamedItem(const String& name, ExceptionCode&);
+
+ virtual PassRefPtr<Node> getNamedItemNS(const String& namespaceURI, const String& localName) const;
+ virtual PassRefPtr<Node> removeNamedItemNS(const String& namespaceURI, const String& localName, ExceptionCode&);
+
+ virtual PassRefPtr<Node> getNamedItem(const QualifiedName& name) const;
+ virtual PassRefPtr<Node> removeNamedItem(const QualifiedName& name, ExceptionCode&);
+ virtual PassRefPtr<Node> setNamedItem(Node* arg, ExceptionCode&);
+
+ virtual PassRefPtr<Node> item(unsigned index) const;
+ size_t length() const { return m_attributes.size(); }
+
+ // Other methods (not part of DOM)
+ Attribute* attributeItem(unsigned index) const { return m_attributes[index].get(); }
+ Attribute* getAttributeItem(const QualifiedName& name) const;
+ Attribute* getAttributeItem(const String& name, bool shouldIgnoreAttributeCase) const;
+
+ void shrinkToLength() { m_attributes.shrinkCapacity(length()); }
+ void reserveInitialCapacity(unsigned capacity) { m_attributes.reserveInitialCapacity(capacity); }
+
+ // used during parsing: only inserts if not already there
+ // no error checking!
+ void insertAttribute(PassRefPtr<Attribute> newAttribute, bool allowDuplicates)
+ {
+ ASSERT(!m_element);
+ if (allowDuplicates || !getAttributeItem(newAttribute->name()))
+ addAttribute(newAttribute);
+ }
+
+ virtual bool isMappedAttributeMap() const;
+
+ const AtomicString& id() const { return m_id; }
+ void setID(const AtomicString& _id) { m_id = _id; }
+
+ bool mapsEquivalent(const NamedAttrMap* otherMap) const;
+
+ // These functions are internal, and do no error checking.
+ void addAttribute(PassRefPtr<Attribute>);
+ void removeAttribute(const QualifiedName& name);
+
+protected:
+ virtual void clearAttributes();
+
+ void detachFromElement();
+
+ Element* m_element;
+ Vector<RefPtr<Attribute> > m_attributes;
+ AtomicString m_id;
+};
+
+} //namespace
+
+#undef id
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Peter Kelly (pmk@post.com)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * (C) 2007 David Smith (catfish.man@gmail.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef NamedMappedAttrMap_h
+#define NamedMappedAttrMap_h
+
+#include "ClassNames.h"
+#include "MappedAttribute.h"
+#include "NamedAttrMap.h"
+
+namespace WebCore {
+
+class NamedMappedAttrMap : public NamedAttrMap {
+private:
+ NamedMappedAttrMap(Element* element) : NamedAttrMap(element), m_mappedAttributeCount(0) { }
+public:
+ static PassRefPtr<NamedMappedAttrMap> create(Element* element = 0) { return adoptRef(new NamedMappedAttrMap(element)); }
+
+ virtual void clearAttributes();
+ virtual bool isMappedAttributeMap() const;
+
+ void clearClass() { m_classNames.clear(); }
+ void setClass(const String&);
+ const ClassNames& classNames() const { return m_classNames; }
+
+ virtual bool hasMappedAttributes() const { return m_mappedAttributeCount > 0; }
+ void declRemoved() { m_mappedAttributeCount--; }
+ void declAdded() { m_mappedAttributeCount++; }
+
+ bool mapsEquivalent(const NamedMappedAttrMap*) const;
+ int declCount() const;
+
+private:
+ ClassNames m_classNames;
+ int m_mappedAttributeCount;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef NamedNodeMap_h
+#define NamedNodeMap_h
+
+#include <wtf/RefCounted.h>
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+class Node;
+class QualifiedName;
+class String;
+
+typedef int ExceptionCode;
+
+// Generic NamedNodeMap interface
+// Other classes implement this for more specific situations e.g. attributes of an element.
+class NamedNodeMap : public RefCounted<NamedNodeMap> {
+public:
+ virtual ~NamedNodeMap() { }
+
+ virtual PassRefPtr<Node> getNamedItem(const String& name) const = 0;
+ virtual PassRefPtr<Node> removeNamedItem(const String& name, ExceptionCode&) = 0;
+
+ virtual PassRefPtr<Node> getNamedItemNS(const String& namespaceURI, const String& localName) const = 0;
+ PassRefPtr<Node> setNamedItemNS(Node* arg, ExceptionCode& ec) { return setNamedItem(arg, ec); }
+ virtual PassRefPtr<Node> removeNamedItemNS(const String& namespaceURI, const String& localName, ExceptionCode&) = 0;
+
+ // DOM methods & attributes for NamedNodeMap
+ virtual PassRefPtr<Node> getNamedItem(const QualifiedName& attrName) const = 0;
+ virtual PassRefPtr<Node> removeNamedItem(const QualifiedName& attrName, ExceptionCode&) = 0;
+ virtual PassRefPtr<Node> setNamedItem(Node*, ExceptionCode&) = 0;
+
+ virtual PassRefPtr<Node> item(unsigned index) const = 0;
+ virtual size_t length() const = 0;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef NavigationAction_h
+#define NavigationAction_h
+
+#include "Event.h"
+#include "FrameLoaderTypes.h"
+#include "KURL.h"
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+ class NavigationAction {
+ public:
+ NavigationAction();
+ NavigationAction(const KURL&, NavigationType);
+ NavigationAction(const KURL&, FrameLoadType, bool isFormSubmission);
+ NavigationAction(const KURL&, NavigationType, PassRefPtr<Event>);
+ NavigationAction(const KURL&, FrameLoadType, bool isFormSubmission, PassRefPtr<Event>);
+
+ bool isEmpty() const { return m_URL.isEmpty(); }
+
+ KURL url() const { return m_URL; }
+ NavigationType type() const { return m_type; }
+ const Event* event() const { return m_event.get(); }
+
+ private:
+ KURL m_URL;
+ NavigationType m_type;
+ RefPtr<Event> m_event;
+ };
+
+}
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef Navigator_h
+#define Navigator_h
+
+#include "NavigatorBase.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+ class Frame;
+ class Geolocation;
+ class MimeTypeArray;
+ class PluginData;
+ class PluginArray;
+ class String;
+
+ class Navigator : public NavigatorBase, public RefCounted<Navigator> {
+ public:
+ static PassRefPtr<Navigator> create(Frame* frame) { return adoptRef(new Navigator(frame)); }
+ ~Navigator();
+
+ void disconnectFrame();
+ Frame* frame() const { return m_frame; }
+
+ String appVersion() const;
+ String language() const;
+ PluginArray* plugins() const;
+ MimeTypeArray* mimeTypes() const;
+ bool cookieEnabled() const;
+ bool javaEnabled() const;
+
+ virtual String userAgent() const;
+
+ Geolocation* geolocation() const;
+ // This is used for GC marking.
+ Geolocation* optionalGeolocation() const { return m_geolocation.get(); }
+
+ bool standalone() const;
+
+ private:
+ Navigator(Frame*);
+ Frame* m_frame;
+ mutable RefPtr<PluginArray> m_plugins;
+ mutable RefPtr<MimeTypeArray> m_mimeTypes;
+ mutable RefPtr<Geolocation> m_geolocation;
+ };
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef NavigatorBase_h
+#define NavigatorBase_h
+
+namespace WebCore {
+
+ class String;
+
+ class NavigatorBase {
+ public:
+ String appName() const;
+ String appVersion() const;
+ virtual String userAgent() const = 0;
+ String platform() const;
+
+ String appCodeName() const;
+ String product() const;
+ String productSub() const;
+ String vendor() const;
+ String vendorSub() const;
+
+ bool onLine() const;
+
+ protected:
+ virtual ~NavigatorBase();
+ };
+
+} // namespace WebCore
+
+#endif // NavigatorBase_h
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "ResourceLoader.h"
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+ class NetscapePlugInStreamLoader;
+
+ class NetscapePlugInStreamLoaderClient {
+ public:
+ virtual void didReceiveResponse(NetscapePlugInStreamLoader*, const ResourceResponse&) = 0;
+ virtual void didReceiveData(NetscapePlugInStreamLoader*, const char*, int) = 0;
+ virtual void didFail(NetscapePlugInStreamLoader*, const ResourceError&) = 0;
+ virtual void didFinishLoading(NetscapePlugInStreamLoader*) { }
+ virtual bool wantsAllStreams() const { return false; }
+
+ protected:
+ virtual ~NetscapePlugInStreamLoaderClient() { }
+ };
+
+ class NetscapePlugInStreamLoader : public ResourceLoader {
+ public:
+ static PassRefPtr<NetscapePlugInStreamLoader> create(Frame*, NetscapePlugInStreamLoaderClient*);
+ virtual ~NetscapePlugInStreamLoader();
+
+ bool isDone() const;
+
+ private:
+ virtual void didReceiveResponse(const ResourceResponse&);
+ virtual void didReceiveData(const char*, int, long long lengthReceived, bool allAtOnce);
+ virtual void didFinishLoading();
+ virtual void didFail(const ResourceError&);
+
+ virtual void releaseResources();
+
+ NetscapePlugInStreamLoader(Frame*, NetscapePlugInStreamLoaderClient*);
+
+ virtual void didCancel(const ResourceError& error);
+
+ NetscapePlugInStreamLoaderClient* m_client;
+ };
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef NetworkStateNotifier_h
+#define NetworkStateNotifier_h
+
+
+namespace WebCore {
+
+class NetworkStateNotifier {
+public:
+ NetworkStateNotifier();
+ void setNetworkStateChangedFunction(void (*)());
+
+ bool onLine() const { return m_isOnLine; }
+
+ void setIsOnLine(bool isOnLine);
+
+private:
+ bool m_isOnLine;
+ void (*m_networkStateChangedFunction)();
+
+ void updateState();
+
+};
+
+#if !PLATFORM(MAC) && !PLATFORM(WIN) && !PLATFORM(CHROMIUM)
+
+inline NetworkStateNotifier::NetworkStateNotifier()
+ : m_isOnLine(true)
+ , m_networkStateChangedFunction(0)
+{
+}
+
+inline void NetworkStateNotifier::updateState() { }
+
+#endif
+
+NetworkStateNotifier& networkStateNotifier();
+
+};
+
+#endif // NetworkStateNotifier_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef NinePieceImage_h
+#define NinePieceImage_h
+
+#include "LengthBox.h"
+#include "StyleImage.h"
+
+namespace WebCore {
+
+enum ENinePieceImageRule {
+ StretchImageRule, RoundImageRule, RepeatImageRule
+};
+
+class NinePieceImage {
+public:
+ NinePieceImage()
+ : m_image(0)
+ , m_horizontalRule(StretchImageRule)
+ , m_verticalRule(StretchImageRule)
+ {
+ }
+
+ NinePieceImage(StyleImage* image, LengthBox slices, ENinePieceImageRule h, ENinePieceImageRule v)
+ : m_image(image)
+ , m_slices(slices)
+ , m_horizontalRule(h)
+ , m_verticalRule(v)
+ {
+ }
+
+ bool operator==(const NinePieceImage& o) const;
+ bool operator!=(const NinePieceImage& o) const { return !(*this == o); }
+
+ bool hasImage() const { return m_image != 0; }
+ StyleImage* image() const { return m_image.get(); }
+
+ ENinePieceImageRule horizontalRule() const { return static_cast<ENinePieceImageRule>(m_horizontalRule); }
+ ENinePieceImageRule verticalRule() const { return static_cast<ENinePieceImageRule>(m_verticalRule); }
+
+ RefPtr<StyleImage> m_image;
+ LengthBox m_slices;
+ unsigned m_horizontalRule : 2; // ENinePieceImageRule
+ unsigned m_verticalRule : 2; // ENinePieceImageRule
+};
+
+} // namespace WebCore
+
+#endif // NinePieceImage_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Node_h
+#define Node_h
+
+#include "DocPtr.h"
+#include "KURLHash.h"
+#include "PlatformString.h"
+#include "TreeShared.h"
+#include "FloatPoint.h"
+#include <wtf/Assertions.h>
+#include <wtf/ListHashSet.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+class AtomicString;
+class ContainerNode;
+class Document;
+class DynamicNodeList;
+class Element;
+class Event;
+class EventListener;
+class IntRect;
+class KeyboardEvent;
+class NSResolver;
+class NamedAttrMap;
+class NodeList;
+class PlatformKeyboardEvent;
+class PlatformMouseEvent;
+class PlatformWheelEvent;
+class QualifiedName;
+class RenderArena;
+class RenderBox;
+class RenderObject;
+class RenderStyle;
+class StringBuilder;
+class NodeRareData;
+
+typedef int ExceptionCode;
+
+enum StyleChangeType { NoStyleChange, InlineStyleChange, FullStyleChange, AnimationStyleChange };
+
+const unsigned short DOCUMENT_POSITION_EQUIVALENT = 0x00;
+const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01;
+const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02;
+const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04;
+const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08;
+const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10;
+const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;
+
+// this class implements nodes, which can have a parent but no children:
+class Node : public TreeShared<Node> {
+ friend class Document;
+public:
+ enum NodeType {
+ ELEMENT_NODE = 1,
+ ATTRIBUTE_NODE = 2,
+ TEXT_NODE = 3,
+ CDATA_SECTION_NODE = 4,
+ ENTITY_REFERENCE_NODE = 5,
+ ENTITY_NODE = 6,
+ PROCESSING_INSTRUCTION_NODE = 7,
+ COMMENT_NODE = 8,
+ DOCUMENT_NODE = 9,
+ DOCUMENT_TYPE_NODE = 10,
+ DOCUMENT_FRAGMENT_NODE = 11,
+ NOTATION_NODE = 12,
+ XPATH_NAMESPACE_NODE = 13
+ };
+
+ static bool isSupported(const String& feature, const String& version);
+
+ static void startIgnoringLeaks();
+ static void stopIgnoringLeaks();
+
+ static void dumpStatistics();
+
+ enum StyleChange { NoChange, NoInherit, Inherit, Detach, Force };
+ static StyleChange diff(RenderStyle*, RenderStyle*);
+
+ Node(Document*, bool isElement = false, bool isContainer = false, bool isText = false);
+ virtual ~Node();
+
+ // DOM methods & attributes for Node
+
+ bool hasTagName(const QualifiedName&) const;
+ virtual String nodeName() const = 0;
+ virtual String nodeValue() const;
+ virtual void setNodeValue(const String&, ExceptionCode&);
+ virtual NodeType nodeType() const = 0;
+ Node* parentNode() const { return parent(); }
+ Element* parentElement() const;
+ Node* previousSibling() const { return m_previous; }
+ Node* nextSibling() const { return m_next; }
+ PassRefPtr<NodeList> childNodes();
+ Node* firstChild() const { return isContainerNode() ? containerFirstChild() : 0; }
+ Node* lastChild() const { return isContainerNode() ? containerLastChild() : 0; }
+ bool hasAttributes() const;
+ NamedAttrMap* attributes() const;
+
+ virtual KURL baseURI() const;
+
+ void getSubresourceURLs(ListHashSet<KURL>&) const;
+
+ // These should all actually return a node, but this is only important for language bindings,
+ // which will already know and hold a ref on the right node to return. Returning bool allows
+ // these methods to be more efficient since they don't need to return a ref
+ virtual bool insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionCode&, bool shouldLazyAttach = false);
+ virtual bool replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionCode&, bool shouldLazyAttach = false);
+ virtual bool removeChild(Node* child, ExceptionCode&);
+ virtual bool appendChild(PassRefPtr<Node> newChild, ExceptionCode&, bool shouldLazyAttach = false);
+
+ void remove(ExceptionCode&);
+ bool hasChildNodes() const { return firstChild(); }
+ virtual PassRefPtr<Node> cloneNode(bool deep) = 0;
+ const AtomicString& localName() const { return virtualLocalName(); }
+ const AtomicString& namespaceURI() const { return virtualNamespaceURI(); }
+ const AtomicString& prefix() const { return virtualPrefix(); }
+ virtual void setPrefix(const AtomicString&, ExceptionCode&);
+ void normalize();
+
+ bool isSameNode(Node* other) const { return this == other; }
+ bool isEqualNode(Node*) const;
+ bool isDefaultNamespace(const AtomicString& namespaceURI) const;
+ String lookupPrefix(const AtomicString& namespaceURI) const;
+ String lookupNamespaceURI(const String& prefix) const;
+ String lookupNamespacePrefix(const AtomicString& namespaceURI, const Element* originalElement) const;
+
+ String textContent(bool convertBRsToNewlines = false) const;
+ void setTextContent(const String&, ExceptionCode&);
+
+ Node* lastDescendant() const;
+ Node* firstDescendant() const;
+
+ // Other methods (not part of DOM)
+
+ bool isElementNode() const { return m_isElement; }
+ bool isContainerNode() const { return m_isContainer; }
+ bool isTextNode() const { return m_isText; }
+
+ virtual bool isHTMLElement() const { return false; }
+
+#if ENABLE(SVG)
+ virtual bool isSVGElement() const { return false; }
+#else
+ static bool isSVGElement() { return false; }
+#endif
+
+#if ENABLE(WML)
+ virtual bool isWMLElement() const { return false; }
+#else
+ static bool isWMLElement() { return false; }
+#endif
+
+ virtual bool isStyledElement() const { return false; }
+ virtual bool isFrameOwnerElement() const { return false; }
+ virtual bool isAttributeNode() const { return false; }
+ virtual bool isCommentNode() const { return false; }
+ virtual bool isCharacterDataNode() const { return false; }
+ bool isDocumentNode() const;
+ virtual bool isEventTargetNode() const { return false; }
+ virtual bool isShadowNode() const { return false; }
+ virtual Node* shadowParentNode() { return 0; }
+ Node* shadowAncestorNode();
+ Node* shadowTreeRootNode();
+ bool isInShadowTree();
+
+ // The node's parent for the purpose of event capture and bubbling.
+ virtual ContainerNode* eventParentNode();
+
+ bool isBlockFlow() const;
+ bool isBlockFlowOrBlockTable() const;
+
+ // These low-level calls give the caller responsibility for maintaining the integrity of the tree.
+ void setPreviousSibling(Node* previous) { m_previous = previous; }
+ void setNextSibling(Node* next) { m_next = next; }
+
+ // FIXME: These two functions belong in editing -- "atomic node" is an editing concept.
+ Node* previousNodeConsideringAtomicNodes() const;
+ Node* nextNodeConsideringAtomicNodes() const;
+
+ /** (Not part of the official DOM)
+ * Returns the next leaf node.
+ *
+ * Using this function delivers leaf nodes as if the whole DOM tree were a linear chain of its leaf nodes.
+ * @return next leaf node or 0 if there are no more.
+ */
+ Node* nextLeafNode() const;
+
+ /** (Not part of the official DOM)
+ * Returns the previous leaf node.
+ *
+ * Using this function delivers leaf nodes as if the whole DOM tree were a linear chain of its leaf nodes.
+ * @return previous leaf node or 0 if there are no more.
+ */
+ Node* previousLeafNode() const;
+
+ bool isEditableBlock() const;
+
+ // enclosingBlockFlowElement() is deprecated. Use enclosingBlock instead.
+ Element* enclosingBlockFlowElement() const;
+
+ Element* enclosingInlineElement() const;
+ Element* rootEditableElement() const;
+
+ bool inSameContainingBlockFlowElement(Node*);
+
+ // Used by the parser. Checks against the DTD, unlike DOM operations like appendChild().
+ // Also does not dispatch DOM mutation events.
+ // Returns the appropriate container node for future insertions as you parse, or 0 for failure.
+ virtual ContainerNode* addChild(PassRefPtr<Node>);
+
+ // Called by the parser when this element's close tag is reached,
+ // signalling that all child tags have been parsed and added.
+ // This is needed for <applet> and <object> elements, which can't lay themselves out
+ // until they know all of their nested <param>s. [Radar 3603191, 4040848].
+ // Also used for script elements and some SVG elements for similar purposes,
+ // but making parsing a special case in this respect should be avoided if possible.
+ virtual void finishParsingChildren() { }
+ virtual void beginParsingChildren() { }
+
+ // Called by the frame right before dispatching an unloadEvent. [Radar 4532113]
+ // This is needed for HTMLInputElements to tell the frame that it is done editing
+ // (sends textFieldDidEndEditing notification)
+ virtual void aboutToUnload() { }
+
+ // For <link> and <style> elements.
+ virtual bool sheetLoaded() { return true; }
+
+ bool hasID() const { return m_hasId; }
+ bool hasClass() const { return m_hasClass; }
+ bool active() const { return m_active; }
+ bool inActiveChain() const { return m_inActiveChain; }
+ bool inDetach() const { return m_inDetach; }
+ bool hovered() const { return m_hovered; }
+ bool focused() const { return hasRareData() ? rareDataFocused() : false; }
+ bool attached() const { return m_attached; }
+ void setAttached(bool b = true) { m_attached = b; }
+ bool changed() const { return m_styleChange != NoStyleChange; }
+ StyleChangeType styleChangeType() const { return static_cast<StyleChangeType>(m_styleChange); }
+ bool hasChangedChild() const { return m_hasChangedChild; }
+ bool isLink() const { return m_isLink; }
+ void setHasID(bool b = true) { m_hasId = b; }
+ void setHasClass(bool b = true) { m_hasClass = b; }
+ void setHasChangedChild( bool b = true ) { m_hasChangedChild = b; }
+ void setInDocument(bool b = true) { m_inDocument = b; }
+ void setInActiveChain(bool b = true) { m_inActiveChain = b; }
+ void setChanged(StyleChangeType changeType = FullStyleChange);
+ void setIsLink(bool b = true) { m_isLink = b; }
+
+ bool inSubtreeMark() const { return m_inSubtreeMark; }
+ void setInSubtreeMark(bool b = true) { m_inSubtreeMark = b; }
+
+ void lazyAttach();
+ virtual bool canLazyAttach();
+
+ virtual void setFocus(bool b = true);
+ virtual void setActive(bool b = true, bool /*pause*/ = false) { m_active = b; }
+ virtual void setHovered(bool b = true) { m_hovered = b; }
+
+ virtual short tabIndex() const;
+
+ /**
+ * Whether this node can receive the keyboard focus.
+ */
+ virtual bool supportsFocus() const { return isFocusable(); }
+ virtual bool isFocusable() const;
+ virtual bool isKeyboardFocusable(KeyboardEvent*) const;
+ virtual bool isMouseFocusable() const;
+
+ virtual bool isAutofilled() const { return false; }
+ virtual bool isControl() const { return false; } // Eventually the notion of what is a control will be extensible.
+ virtual bool isEnabled() const { return true; }
+ virtual bool isChecked() const { return false; }
+ virtual bool isIndeterminate() const { return false; }
+ virtual bool isReadOnlyControl() const { return false; }
+ virtual bool isTextControl() const { return false; }
+
+ virtual bool isContentEditable() const;
+ virtual bool isContentRichlyEditable() const;
+ virtual bool shouldUseInputMethod() const;
+ virtual IntRect getRect() const;
+
+ virtual void recalcStyle(StyleChange = NoChange) { }
+
+ unsigned nodeIndex() const;
+
+ // Returns the DOM ownerDocument attribute. This method never returns NULL, except in the case
+ // of (1) a Document node or (2) a DocumentType node that is not used with any Document yet.
+ virtual Document* ownerDocument() const;
+
+ // Returns the document associated with this node. This method never returns NULL, except in the case
+ // of a DocumentType node that is not used with any Document yet. A Document node returns itself.
+ Document* document() const
+ {
+ ASSERT(this);
+ ASSERT(m_document || nodeType() == DOCUMENT_TYPE_NODE && !inDocument());
+ return m_document.get();
+ }
+ void setDocument(Document*);
+
+ // Returns true if this node is associated with a document and is in its associated document's
+ // node tree, false otherwise.
+ bool inDocument() const
+ {
+ ASSERT(m_document || !m_inDocument);
+ return m_inDocument;
+ }
+
+ bool isReadOnlyNode() const { return nodeType() == ENTITY_REFERENCE_NODE; }
+ virtual bool childTypeAllowed(NodeType) { return false; }
+ unsigned childNodeCount() const { return isContainerNode() ? containerChildNodeCount() : 0; }
+ Node* childNode(unsigned index) const { return isContainerNode() ? containerChildNode(index) : 0; }
+
+ /**
+ * Does a pre-order traversal of the tree to find the node next node after this one. This uses the same order that
+ * the tags appear in the source file.
+ *
+ * @param stayWithin If not null, the traversal will stop once the specified node is reached. This can be used to
+ * restrict traversal to a particular sub-tree.
+ *
+ * @return The next node, in document order
+ *
+ * see @ref traversePreviousNode()
+ */
+ Node* traverseNextNode(const Node* stayWithin = 0) const;
+
+ // Like traverseNextNode, but skips children and starts with the next sibling.
+ Node* traverseNextSibling(const Node* stayWithin = 0) const;
+
+ /**
+ * Does a reverse pre-order traversal to find the node that comes before the current one in document order
+ *
+ * see @ref traverseNextNode()
+ */
+ Node* traversePreviousNode(const Node * stayWithin = 0) const;
+
+ // Like traverseNextNode, but visits parents after their children.
+ Node* traverseNextNodePostOrder() const;
+
+ // Like traversePreviousNode, but visits parents before their children.
+ Node* traversePreviousNodePostOrder(const Node *stayWithin = 0) const;
+ Node* traversePreviousSiblingPostOrder(const Node *stayWithin = 0) const;
+
+ /**
+ * Finds previous or next editable leaf node.
+ */
+ Node* previousEditable() const;
+ Node* nextEditable() const;
+
+ RenderObject* renderer() const { return m_renderer; }
+ RenderObject* nextRenderer();
+ RenderObject* previousRenderer();
+ void setRenderer(RenderObject* renderer) { m_renderer = renderer; }
+
+ // Use with caution. Does no type checking. Mostly a convenience method for shadow nodes of form controls, where we know exactly
+ // what kind of renderer we made.
+ RenderBox* renderBox() const;
+
+ void checkSetPrefix(const AtomicString& prefix, ExceptionCode&);
+ bool isDescendantOrShadowDescendantOf(const Node* otherNode);
+ bool isDescendantOf(const Node*) const;
+ bool contains(const Node*) const;
+
+ // These two methods are mutually exclusive. The former is used to do strict error-checking
+ // when adding children via the public DOM API (e.g., appendChild()). The latter is called only when parsing,
+ // to sanity-check against the DTD for error recovery.
+ void checkAddChild(Node* newChild, ExceptionCode&); // Error-checking when adding via the DOM API
+ virtual bool childAllowed(Node* newChild); // Error-checking during parsing that checks the DTD
+
+ void checkReplaceChild(Node* newChild, Node* oldChild, ExceptionCode&);
+ virtual bool canReplaceChild(Node* newChild, Node* oldChild);
+
+ // Used to determine whether range offsets use characters or node indices.
+ virtual bool offsetInCharacters() const;
+ // Number of DOM 16-bit units contained in node. Note that rendered text length can be different - e.g. because of
+ // css-transform:capitalize breaking up precomposed characters and ligatures.
+ virtual int maxCharacterOffset() const;
+
+ // FIXME: We should try to find a better location for these methods.
+ virtual bool canSelectAll() const { return false; }
+ virtual void selectAll() { }
+
+ // Whether or not a selection can be started in this object
+ virtual bool canStartSelection() const;
+
+ // Getting points into and out of screen space
+ FloatPoint convertToPage(const FloatPoint& p) const;
+ FloatPoint convertFromPage(const FloatPoint& p) const;
+
+ // -----------------------------------------------------------------------------
+ // Integration with rendering tree
+
+ /**
+ * Attaches this node to the rendering tree. This calculates the style to be applied to the node and creates an
+ * appropriate RenderObject which will be inserted into the tree (except when the style has display: none). This
+ * makes the node visible in the FrameView.
+ */
+ virtual void attach();
+
+ /**
+ * Detaches the node from the rendering tree, making it invisible in the rendered view. This method will remove
+ * the node's rendering object from the rendering tree and delete it.
+ */
+ virtual void detach();
+
+ virtual void willRemove();
+ void createRendererIfNeeded();
+ PassRefPtr<RenderStyle> styleForRenderer();
+ virtual bool rendererIsNeeded(RenderStyle*);
+#if ENABLE(SVG)
+ virtual bool childShouldCreateRenderer(Node*) const { return true; }
+#endif
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+
+ // Wrapper for nodes that don't have a renderer, but still cache the style (like HTMLOptionElement).
+ RenderStyle* renderStyle() const;
+ virtual void setRenderStyle(PassRefPtr<RenderStyle>);
+
+ virtual RenderStyle* computedStyle();
+
+ // -----------------------------------------------------------------------------
+ // Notification of document structure changes
+
+ /**
+ * Notifies the node that it has been inserted into the document. This is called during document parsing, and also
+ * when a node is added through the DOM methods insertBefore(), appendChild() or replaceChild(). Note that this only
+ * happens when the node becomes part of the document tree, i.e. only when the document is actually an ancestor of
+ * the node. The call happens _after_ the node has been added to the tree.
+ *
+ * This is similar to the DOMNodeInsertedIntoDocument DOM event, but does not require the overhead of event
+ * dispatching.
+ */
+ virtual void insertedIntoDocument();
+
+ /**
+ * Notifies the node that it is no longer part of the document tree, i.e. when the document is no longer an ancestor
+ * node.
+ *
+ * This is similar to the DOMNodeRemovedFromDocument DOM event, but does not require the overhead of event
+ * dispatching, and is called _after_ the node is removed from the tree.
+ */
+ virtual void removedFromDocument();
+
+ // These functions are called whenever you are connected or disconnected from a tree. That tree may be the main
+ // document tree, or it could be another disconnected tree. Override these functions to do any work that depends
+ // on connectedness to some ancestor (e.g., an ancestor <form> for example).
+ virtual void insertedIntoTree(bool /*deep*/) { }
+ virtual void removedFromTree(bool /*deep*/) { }
+
+ /**
+ * Notifies the node that it's list of children have changed (either by adding or removing child nodes), or a child
+ * node that is of the type CDATA_SECTION_NODE, TEXT_NODE or COMMENT_NODE has changed its value.
+ */
+ virtual void childrenChanged(bool /*changedByParser*/ = false, Node* /*beforeChange*/ = 0, Node* /*afterChange*/ = 0, int /*childCountDelta*/ = 0) { }
+
+#ifndef NDEBUG
+ virtual void formatForDebugger(char* buffer, unsigned length) const;
+
+ void showNode(const char* prefix = "") const;
+ void showTreeForThis() const;
+ void showTreeAndMark(const Node* markedNode1, const char* markedLabel1, const Node* markedNode2 = 0, const char* markedLabel2 = 0) const;
+#endif
+
+ void registerDynamicNodeList(DynamicNodeList*);
+ void unregisterDynamicNodeList(DynamicNodeList*);
+ void notifyNodeListsChildrenChanged();
+ void notifyLocalNodeListsChildrenChanged();
+ void notifyNodeListsAttributeChanged();
+ void notifyLocalNodeListsAttributeChanged();
+
+ PassRefPtr<NodeList> getElementsByTagName(const String&);
+ PassRefPtr<NodeList> getElementsByTagNameNS(const AtomicString& namespaceURI, const String& localName);
+ PassRefPtr<NodeList> getElementsByName(const String& elementName);
+ PassRefPtr<NodeList> getElementsByClassName(const String& classNames);
+
+ virtual bool willRespondToMouseMoveEvents();
+ virtual bool willRespondToMouseWheelEvents();
+ virtual bool willRespondToMouseClickEvents();
+
+ PassRefPtr<Element> querySelector(const String& selectors, ExceptionCode&);
+ PassRefPtr<NodeList> querySelectorAll(const String& selectors, ExceptionCode&);
+
+ unsigned short compareDocumentPosition(Node*);
+
+protected:
+ virtual void willMoveToNewOwnerDocument() { }
+ virtual void didMoveToNewOwnerDocument() { }
+
+ virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const { }
+ void setTabIndexExplicitly(short);
+
+ bool hasRareData() const { return m_hasRareData; }
+
+ NodeRareData* rareData() const;
+ NodeRareData* ensureRareData();
+
+private:
+ virtual NodeRareData* createRareData();
+ Node* containerChildNode(unsigned index) const;
+ unsigned containerChildNodeCount() const;
+ Node* containerFirstChild() const;
+ Node* containerLastChild() const;
+ bool rareDataFocused() const;
+
+ virtual RenderStyle* nonRendererRenderStyle() const;
+
+ virtual const AtomicString& virtualPrefix() const;
+ virtual const AtomicString& virtualLocalName() const;
+ virtual const AtomicString& virtualNamespaceURI() const;
+
+ Element* ancestorElement() const;
+
+ void appendTextContent(bool convertBRsToNewlines, StringBuilder&) const;
+
+ DocPtr<Document> m_document;
+ Node* m_previous;
+ Node* m_next;
+ RenderObject* m_renderer;
+
+ unsigned m_styleChange : 2;
+ bool m_hasId : 1;
+ bool m_hasClass : 1;
+ bool m_attached : 1;
+ bool m_hasChangedChild : 1;
+ bool m_inDocument : 1;
+ bool m_isLink : 1;
+ bool m_active : 1;
+ bool m_hovered : 1;
+ bool m_inActiveChain : 1;
+ bool m_inDetach : 1;
+ bool m_inSubtreeMark : 1;
+ bool m_hasRareData : 1;
+ const bool m_isElement : 1;
+ const bool m_isContainer : 1;
+ const bool m_isText : 1;
+
+protected:
+ // These bits are used by the Element derived class, pulled up here so they can
+ // be stored in the same memory word as the Node bits above.
+ bool m_parsingChildrenFinished : 1;
+#if ENABLE(SVG)
+ mutable bool m_areSVGAttributesValid : 1;
+#endif
+
+ // These bits are used by the StyledElement derived class, and live here for the
+ // same reason as above.
+ mutable bool m_isStyleAttributeValid : 1;
+ mutable bool m_synchronizingStyleAttribute : 1;
+
+#if ENABLE(SVG)
+ // This bit is used by the SVGElement derived class, and lives here for the same
+ // reason as above.
+ mutable bool m_synchronizingSVGAttributes : 1;
+#endif
+
+ // 11 bits remaining
+};
+
+// Used in Node::addSubresourceAttributeURLs() and in addSubresourceStyleURLs()
+inline void addSubresourceURL(ListHashSet<KURL>& urls, const KURL& url)
+{
+ if (!url.isNull())
+ urls.add(url);
+}
+
+} //namespace
+
+#ifndef NDEBUG
+// Outside the WebCore namespace for ease of invocation from gdb.
+void showTree(const WebCore::Node*);
+#endif
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2000 Frederik Holljen (frederik.holljen@hig.no)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef NodeFilter_h
+#define NodeFilter_h
+
+#include "JSDOMBinding.h"
+#include "NodeFilterCondition.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+ class NodeFilter : public RefCounted<NodeFilter> {
+ public:
+ /**
+ * The following constants are returned by the acceptNode()
+ * method:
+ */
+ enum {
+ FILTER_ACCEPT = 1,
+ FILTER_REJECT = 2,
+ FILTER_SKIP = 3
+ };
+
+ /**
+ * These are the available values for the whatToShow parameter.
+ * They are the same as the set of possible types for Node, and
+ * their values are derived by using a bit position corresponding
+ * to the value of NodeType for the equivalent node type.
+ */
+ enum {
+ SHOW_ALL = 0xFFFFFFFF,
+ SHOW_ELEMENT = 0x00000001,
+ SHOW_ATTRIBUTE = 0x00000002,
+ SHOW_TEXT = 0x00000004,
+ SHOW_CDATA_SECTION = 0x00000008,
+ SHOW_ENTITY_REFERENCE = 0x00000010,
+ SHOW_ENTITY = 0x00000020,
+ SHOW_PROCESSING_INSTRUCTION = 0x00000040,
+ SHOW_COMMENT = 0x00000080,
+ SHOW_DOCUMENT = 0x00000100,
+ SHOW_DOCUMENT_TYPE = 0x00000200,
+ SHOW_DOCUMENT_FRAGMENT = 0x00000400,
+ SHOW_NOTATION = 0x00000800
+ };
+
+ static PassRefPtr<NodeFilter> create(PassRefPtr<NodeFilterCondition> condition)
+ {
+ return adoptRef(new NodeFilter(condition));
+ }
+
+ short acceptNode(ScriptState*, Node*) const;
+ void mark() { m_condition->mark(); };
+
+ // For non-JS bindings. Silently ignores the JavaScript exception if any.
+ short acceptNode(Node* node) const { return acceptNode(scriptStateFromNode(node), node); }
+
+ private:
+ NodeFilter(PassRefPtr<NodeFilterCondition> condition) : m_condition(condition) { }
+
+ RefPtr<NodeFilterCondition> m_condition;
+ };
+
+} // namespace WebCore
+
+#endif // NodeFilter_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2000 Frederik Holljen (frederik.holljen@hig.no)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef NodeFilterCondition_h
+#define NodeFilterCondition_h
+
+#include "ScriptState.h"
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+ class Node;
+
+ class NodeFilterCondition : public RefCounted<NodeFilterCondition> {
+ public:
+ virtual ~NodeFilterCondition() { }
+ virtual short acceptNode(ScriptState*, Node*) const = 0;
+ virtual void mark() { }
+ };
+
+} // namespace WebCore
+
+#endif // NodeFilterCondition_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2000 Frederik Holljen (frederik.holljen@hig.no)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef NodeIterator_h
+#define NodeIterator_h
+
+#include "JSDOMBinding.h"
+#include "NodeFilter.h"
+#include "Traversal.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+ typedef int ExceptionCode;
+
+ class NodeIterator : public RefCounted<NodeIterator>, public Traversal {
+ public:
+ static PassRefPtr<NodeIterator> create(PassRefPtr<Node> rootNode, unsigned whatToShow, PassRefPtr<NodeFilter> filter, bool expandEntityReferences)
+ {
+ return adoptRef(new NodeIterator(rootNode, whatToShow, filter, expandEntityReferences));
+ }
+ ~NodeIterator();
+
+ PassRefPtr<Node> nextNode(ScriptState*, ExceptionCode&);
+ PassRefPtr<Node> previousNode(ScriptState*, ExceptionCode&);
+ void detach();
+
+ Node* referenceNode() const { return m_referenceNode.node.get(); }
+ bool pointerBeforeReferenceNode() const { return m_referenceNode.isPointerBeforeNode; }
+
+ // This function is called before any node is removed from the document tree.
+ void nodeWillBeRemoved(Node*);
+
+ // For non-JS bindings. Silently ignores the JavaScript exception if any.
+ PassRefPtr<Node> nextNode(ExceptionCode& ec) { return nextNode(scriptStateFromNode(referenceNode()), ec); }
+ PassRefPtr<Node> previousNode(ExceptionCode& ec) { return previousNode(scriptStateFromNode(referenceNode()), ec); }
+
+ private:
+ NodeIterator(PassRefPtr<Node>, unsigned whatToShow, PassRefPtr<NodeFilter>, bool expandEntityReferences);
+
+ struct NodePointer {
+ RefPtr<Node> node;
+ bool isPointerBeforeNode;
+ NodePointer();
+ NodePointer(PassRefPtr<Node>, bool);
+ void clear();
+ bool moveToNext(Node* root);
+ bool moveToPrevious(Node* root);
+ };
+
+ void updateForNodeRemoval(Node* nodeToBeRemoved, NodePointer&) const;
+
+ NodePointer m_referenceNode;
+ NodePointer m_candidateNode;
+ bool m_detached;
+ };
+
+} // namespace WebCore
+
+#endif // NodeIterator_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef NodeList_h
+#define NodeList_h
+
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+ class AtomicString;
+ class Node;
+
+ class NodeList : public RefCounted<NodeList> {
+ public:
+ virtual ~NodeList() { }
+
+ // DOM methods & attributes for NodeList
+ virtual unsigned length() const = 0;
+ virtual Node* item(unsigned index) const = 0;
+ virtual Node* itemWithName(const AtomicString&) const = 0;
+ };
+
+} // namespace WebCore
+
+#endif // NodeList_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 David Smith <catfish.man@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef NodeRareData_h
+#define NodeRareData_h
+
+#include "DynamicNodeList.h"
+#include "EventListener.h"
+#include "RegisteredEventListener.h"
+#include "StringHash.h"
+#include "QualifiedName.h"
+#include <wtf/HashSet.h>
+#include <wtf/OwnPtr.h>
+
+namespace WebCore {
+
+struct NodeListsNodeData {
+ typedef HashSet<DynamicNodeList*> NodeListSet;
+ NodeListSet m_listsWithCaches;
+
+ DynamicNodeList::Caches m_childNodeListCaches;
+
+ typedef HashMap<String, DynamicNodeList::Caches*> CacheMap;
+ CacheMap m_classNodeListCaches;
+ CacheMap m_nameNodeListCaches;
+
+ typedef HashMap<QualifiedName, DynamicNodeList::Caches*> TagCacheMap;
+ TagCacheMap m_tagNodeListCaches;
+
+ ~NodeListsNodeData()
+ {
+ deleteAllValues(m_classNodeListCaches);
+ deleteAllValues(m_nameNodeListCaches);
+ deleteAllValues(m_tagNodeListCaches);
+ }
+
+ void invalidateCaches();
+ void invalidateCachesThatDependOnAttributes();
+ bool isEmpty() const;
+};
+
+class NodeRareData {
+public:
+ NodeRareData()
+ : m_tabIndex(0)
+ , m_tabIndexWasSetExplicitly(false)
+ , m_isFocused(false)
+ , m_needsFocusAppearanceUpdateSoonAfterAttach(false)
+ {
+ }
+
+ typedef HashMap<const Node*, NodeRareData*> NodeRareDataMap;
+
+ static NodeRareDataMap& rareDataMap()
+ {
+ static NodeRareDataMap* dataMap = new NodeRareDataMap;
+ return *dataMap;
+ }
+
+ static NodeRareData* rareDataFromMap(const Node* node)
+ {
+ return rareDataMap().get(node);
+ }
+
+ void clearNodeLists() { m_nodeLists.clear(); }
+ void setNodeLists(std::auto_ptr<NodeListsNodeData> lists) { m_nodeLists.set(lists.release()); }
+ NodeListsNodeData* nodeLists() const { return m_nodeLists.get(); }
+
+ short tabIndex() const { return m_tabIndex; }
+ void setTabIndexExplicitly(short index) { m_tabIndex = index; m_tabIndexWasSetExplicitly = true; }
+ bool tabIndexSetExplicitly() const { return m_tabIndexWasSetExplicitly; }
+
+ RegisteredEventListenerVector* listeners() { return m_eventListeners.get(); }
+ RegisteredEventListenerVector& ensureListeners()
+ {
+ if (!m_eventListeners)
+ m_eventListeners.set(new RegisteredEventListenerVector);
+ return *m_eventListeners;
+ }
+
+ bool isFocused() const { return m_isFocused; }
+ void setFocused(bool focused) { m_isFocused = focused; }
+
+protected:
+ // for ElementRareData
+ bool needsFocusAppearanceUpdateSoonAfterAttach() const { return m_needsFocusAppearanceUpdateSoonAfterAttach; }
+ void setNeedsFocusAppearanceUpdateSoonAfterAttach(bool needs) { m_needsFocusAppearanceUpdateSoonAfterAttach = needs; }
+
+private:
+ OwnPtr<NodeListsNodeData> m_nodeLists;
+ OwnPtr<RegisteredEventListenerVector > m_eventListeners;
+ short m_tabIndex;
+ bool m_tabIndexWasSetExplicitly : 1;
+ bool m_isFocused : 1;
+ bool m_needsFocusAppearanceUpdateSoonAfterAttach : 1;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * (C) 2008 David Smith (catfish.man@gmail.com)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef NodeRenderStyle_h
+#define NodeRenderStyle_h
+
+#include "RenderObject.h"
+#include "RenderStyle.h"
+#include "Node.h"
+
+namespace WebCore {
+
+inline RenderStyle* Node::renderStyle() const
+{
+ return m_renderer ? m_renderer->style() : nonRendererRenderStyle();
+}
+
+}
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef NodeWithIndex_h
+#define NodeWithIndex_h
+
+#include "Node.h"
+
+namespace WebCore {
+
+// For use when you want to get the index for a node repeatedly and
+// only want to walk the child list to figure out the index once.
+class NodeWithIndex {
+public:
+ NodeWithIndex(Node* node)
+ : m_node(node)
+ , m_haveIndex(false)
+ {
+ ASSERT(node);
+ }
+
+ Node* node() const { return m_node; }
+
+ int index() const
+ {
+ if (!m_haveIndex) {
+ m_index = m_node->nodeIndex();
+ m_haveIndex = true;
+ }
+ ASSERT(m_index == static_cast<int>(m_node->nodeIndex()));
+ return m_index;
+ }
+
+private:
+ Node* m_node;
+ mutable bool m_haveIndex;
+ mutable int m_index;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef NotImplemented_h
+#define NotImplemented_h
+
+#include "Logging.h"
+#include <wtf/Assertions.h>
+
+#if PLATFORM(GTK)
+ #define supressNotImplementedWarning() getenv("DISABLE_NI_WARNING")
+#elif PLATFORM(QT)
+ #include <QByteArray>
+ #define supressNotImplementedWarning() !qgetenv("DISABLE_NI_WARNING").isEmpty()
+#else
+ #define supressNotImplementedWarning() false
+#endif
+
+#if defined(NDEBUG)
+ #define notImplemented() ((void)0)
+#else
+
+#define notImplemented() do { \
+ static bool havePrinted = false; \
+ if (!havePrinted && !supressNotImplementedWarning()) { \
+ WTFLogVerbose(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, &::WebCore::LogNotYetImplemented, "UNIMPLEMENTED: "); \
+ havePrinted = true; \
+ } \
+ } while (0)
+
+#endif // NDEBUG
+
+#endif // NotImplemented_h
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 2000 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Notation_h
+#define Notation_h
+
+#include "CachedResourceClient.h"
+#include "ContainerNode.h"
+
+namespace WebCore {
+
+class Notation : public ContainerNode
+{
+public:
+ Notation(Document*);
+ Notation(Document*, const String& name, const String& publicId, const String& systemId);
+
+ // DOM methods & attributes for Notation
+ String publicId() const { return m_publicId; }
+ String systemId() const { return m_systemId; }
+
+ virtual String nodeName() const;
+ virtual NodeType nodeType() const;
+ virtual PassRefPtr<Node> cloneNode(bool deep);
+ virtual bool childTypeAllowed(NodeType);
+
+private:
+ String m_name;
+ String m_publicId;
+ String m_systemId;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006, 2008 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ObjCEventListener_h
+#define ObjCEventListener_h
+
+#include "EventListener.h"
+
+#include <wtf/PassRefPtr.h>
+
+@protocol DOMEventListener;
+
+namespace WebCore {
+
+ class ObjCEventListener : public EventListener {
+ public:
+ static PassRefPtr<ObjCEventListener> wrap(id <DOMEventListener>);
+
+ private:
+ static ObjCEventListener* find(id <DOMEventListener>);
+
+ ObjCEventListener(id <DOMEventListener>);
+ virtual ~ObjCEventListener();
+
+ virtual void handleEvent(Event*, bool isWindowEvent);
+
+ id <DOMEventListener> m_listener;
+ };
+
+} // namespace WebCore
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006, 2008 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ObjCNodeFilterCondition_h
+#define ObjCNodeFilterCondition_h
+
+#include "NodeFilterCondition.h"
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RetainPtr.h>
+
+@protocol DOMNodeFilter;
+
+namespace WebCore {
+ class Node;
+
+ class ObjCNodeFilterCondition : public NodeFilterCondition {
+ public:
+ static PassRefPtr<ObjCNodeFilterCondition> create(id <DOMNodeFilter> filter)
+ {
+ return adoptRef(new ObjCNodeFilterCondition(filter));
+ }
+
+ virtual short acceptNode(JSC::ExecState*, Node*) const;
+
+ private:
+ ObjCNodeFilterCondition(id <DOMNodeFilter> filter)
+ : m_filter(filter)
+ {
+ }
+
+ RetainPtr<id <DOMNodeFilter> > m_filter;
+ };
+
+} // namespace WebCore
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef OptionElement_h
+#define OptionElement_h
+
+#include "PlatformString.h"
+
+namespace WebCore {
+
+class Element;
+class Document;
+class OptionElementData;
+
+class OptionElement {
+public:
+ virtual ~OptionElement() { }
+
+ virtual bool selected() const = 0;
+ virtual void setSelectedState(bool) = 0;
+
+ virtual String textIndentedToRespectGroupLabel() const = 0;
+ virtual String value() const = 0;
+
+protected:
+ OptionElement() { }
+
+ static void setSelectedState(OptionElementData&, bool selected);
+ static String collectOptionText(const OptionElementData&, Document*);
+ static String collectOptionTextRespectingGroupLabel(const OptionElementData&, Document*);
+ static String collectOptionValue(const OptionElementData&, Document*);
+};
+
+// HTML/WMLOptionElement hold this struct as member variable
+// and pass it to the static helper functions in OptionElement
+class OptionElementData {
+public:
+ OptionElementData(Element*);
+ ~OptionElementData();
+
+ Element* element() const { return m_element; }
+
+ String value() const { return m_value; }
+ void setValue(const String& value) { m_value = value; }
+
+ String label() const { return m_label; }
+ void setLabel(const String& label) { m_label = label; }
+
+ bool selected() const { return m_selected; }
+ void setSelected(bool selected) { m_selected = selected; }
+
+private:
+ Element* m_element;
+ String m_value;
+ String m_label;
+ bool m_selected;
+};
+
+OptionElement* toOptionElement(Element*);
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef OptionGroupElement_h
+#define OptionGroupElement_h
+
+namespace WebCore {
+
+class Element;
+class String;
+
+class OptionGroupElement {
+public:
+ virtual ~OptionGroupElement() { }
+
+ virtual String groupLabelText() const = 0;
+
+protected:
+ OptionGroupElement() { }
+};
+
+OptionGroupElement* toOptionGroupElement(Element*);
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef OutlineValue_h
+#define OutlineValue_h
+
+#include "BorderValue.h"
+
+namespace WebCore {
+
+class OutlineValue : public BorderValue {
+public:
+ OutlineValue()
+ : _offset(0)
+ , _auto(false)
+ {
+ }
+
+ bool operator==(const OutlineValue& o) const
+ {
+ return width == o.width && m_style == o.m_style && color == o.color && _offset == o._offset && _auto == o._auto;
+ }
+
+ bool operator!=(const OutlineValue& o) const
+ {
+ return !(*this == o);
+ }
+
+ int _offset;
+ bool _auto;
+};
+
+} // namespace WebCore
+
+#endif // OutlineValue_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef OverflowEvent_h
+#define OverflowEvent_h
+
+#include "Event.h"
+
+namespace WebCore {
+
+ class OverflowEvent : public Event {
+ public:
+ enum orientType {
+ VERTICAL = 0,
+ HORIZONTAL = 1,
+ BOTH = 2
+ };
+
+ static PassRefPtr<OverflowEvent> create()
+ {
+ return adoptRef(new OverflowEvent);
+ }
+ static PassRefPtr<OverflowEvent> create(bool horizontalOverflowChanged, bool horizontalOverflow, bool verticalOverflowChanged, bool verticalOverflow)
+ {
+ return adoptRef(new OverflowEvent(horizontalOverflowChanged, horizontalOverflow, verticalOverflowChanged, verticalOverflow));
+ }
+
+ void initOverflowEvent(unsigned short orient, bool horizontalOverflow, bool verticalOverflow);
+
+ unsigned short orient() const { return m_orient; }
+ bool horizontalOverflow() const { return m_horizontalOverflow; }
+ bool verticalOverflow() const { return m_verticalOverflow; }
+
+ virtual bool isOverflowEvent() const;
+
+ private:
+ OverflowEvent();
+ OverflowEvent(bool horizontalOverflowChanged, bool horizontalOverflow, bool verticalOverflowChanged, bool verticalOverflow);
+
+ unsigned short m_orient;
+ bool m_horizontalOverflow;
+ bool m_verticalOverflow;
+ };
+}
+
+#endif // OverflowEvent_h
+
--- /dev/null
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef Page_h
+#define Page_h
+
+#include "BackForwardList.h"
+#include "Chrome.h"
+#include "ContextMenuController.h"
+#include "FrameLoaderTypes.h"
+#include "LinkHash.h"
+#include "PlatformString.h"
+#include <wtf/HashSet.h>
+#include <wtf/OwnPtr.h>
+
+#if PLATFORM(MAC)
+#include "SchedulePair.h"
+#endif
+
+#include "Settings.h"
+
+#if PLATFORM(WIN) || (PLATFORM(WX) && PLATFORM(WIN_OS)) || (PLATFORM(QT) && defined(Q_WS_WIN))
+typedef struct HINSTANCE__* HINSTANCE;
+#endif
+
+namespace JSC {
+ class Debugger;
+}
+
+namespace WebCore {
+
+ class Chrome;
+ class ChromeClient;
+ class ContextMenuClient;
+ class ContextMenuController;
+ class Document;
+ class DragClient;
+ class DragController;
+ class EditorClient;
+ class FocusController;
+ class Frame;
+ class InspectorClient;
+ class InspectorController;
+ class Node;
+ class PageGroup;
+ class PluginData;
+ class ProgressTracker;
+ class Selection;
+ class SelectionController;
+#if ENABLE(DOM_STORAGE)
+ class SessionStorage;
+#endif
+ class Settings;
+#if ENABLE(WML)
+ class WMLPageState;
+#endif
+
+ enum FindDirection { FindDirectionForward, FindDirectionBackward };
+
+ class Page : Noncopyable {
+ public:
+ static void setNeedsReapplyStyles();
+
+ Page(ChromeClient*, ContextMenuClient*, EditorClient*, DragClient*, InspectorClient*);
+ ~Page();
+
+ static void refreshPlugins(bool reload);
+ PluginData* pluginData() const;
+
+ EditorClient* editorClient() const { return m_editorClient; }
+
+ void setMainFrame(PassRefPtr<Frame>);
+ Frame* mainFrame() const { return m_mainFrame.get(); }
+
+ BackForwardList* backForwardList();
+
+ // FIXME: The following three methods don't fall under the responsibilities of the Page object
+ // They seem to fit a hypothetical Page-controller object that would be akin to the
+ // Frame-FrameLoader relationship. They have to live here now, but should move somewhere that
+ // makes more sense when that class exists.
+ bool goBack();
+ bool goForward();
+ void goToItem(HistoryItem*, FrameLoadType);
+
+ HistoryItem* globalHistoryItem() const { return m_globalHistoryItem.get(); }
+ void setGlobalHistoryItem(HistoryItem*);
+
+ void setGroupName(const String&);
+ const String& groupName() const;
+
+ PageGroup& group() { if (!m_group) initGroup(); return *m_group; }
+ PageGroup* groupPtr() { return m_group; } // can return 0
+
+ void incrementFrameCount() { ++m_frameCount; }
+ void decrementFrameCount() { --m_frameCount; }
+ int frameCount() const { return m_frameCount; }
+
+ Chrome* chrome() const { return m_chrome.get(); }
+ SelectionController* dragCaretController() const { return m_dragCaretController.get(); }
+ FocusController* focusController() const { return m_focusController.get(); }
+ Settings* settings() const { return m_settings.get(); }
+ ProgressTracker* progress() const { return m_progress.get(); }
+
+
+ void setTabKeyCyclesThroughElements(bool b) { m_tabKeyCyclesThroughElements = b; }
+ bool tabKeyCyclesThroughElements() const { return m_tabKeyCyclesThroughElements; }
+
+ bool findString(const String&, TextCaseSensitivity, FindDirection, bool shouldWrap);
+ unsigned int markAllMatchesForText(const String&, TextCaseSensitivity, bool shouldHighlight, unsigned);
+ void unmarkAllTextMatches();
+
+#if PLATFORM(MAC)
+ void addSchedulePair(PassRefPtr<SchedulePair>);
+ void removeSchedulePair(PassRefPtr<SchedulePair>);
+ SchedulePairHashSet* scheduledRunLoopPairs() { return m_scheduledRunLoopPairs.get(); }
+
+ OwnPtr<SchedulePairHashSet> m_scheduledRunLoopPairs;
+#endif
+
+ const Selection& selection() const;
+
+ void setDefersLoading(bool);
+ bool defersLoading() const { return m_defersLoading; }
+
+ void clearUndoRedoOperations();
+
+ bool inLowQualityImageInterpolationMode() const;
+ void setInLowQualityImageInterpolationMode(bool = true);
+
+ bool cookieEnabled() const { return m_cookieEnabled; }
+ void setCookieEnabled(bool enabled) { m_cookieEnabled = enabled; }
+
+ float mediaVolume() const { return m_mediaVolume; }
+ void setMediaVolume(float volume);
+
+ // Notifications when the Page starts and stops being presented via a native window.
+ void didMoveOnscreen();
+ void willMoveOffscreen();
+
+ void userStyleSheetLocationChanged();
+ const String& userStyleSheet() const;
+
+ void changePendingUnloadEventCount(int delta);
+ unsigned pendingUnloadEventCount();
+ void changePendingBeforeUnloadEventCount(int delta);
+ unsigned pendingBeforeUnloadEventCount();
+
+ static void setDebuggerForAllPages(JSC::Debugger*);
+ void setDebugger(JSC::Debugger*);
+ JSC::Debugger* debugger() const { return m_debugger; }
+
+#if PLATFORM(WIN) || (PLATFORM(WX) && PLATFORM(WIN_OS)) || (PLATFORM(QT) && defined(Q_WS_WIN))
+ // The global DLL or application instance used for all windows.
+ static void setInstanceHandle(HINSTANCE instanceHandle) { s_instanceHandle = instanceHandle; }
+ static HINSTANCE instanceHandle() { return s_instanceHandle; }
+#endif
+
+ static void removeAllVisitedLinks();
+
+ static void allVisitedStateChanged(PageGroup*);
+ static void visitedStateChanged(PageGroup*, LinkHash visitedHash);
+
+#if ENABLE(DOM_STORAGE)
+ SessionStorage* sessionStorage(bool optionalCreate = true);
+ void setSessionStorage(PassRefPtr<SessionStorage>);
+#endif
+
+#if ENABLE(WML)
+ WMLPageState* wmlPageState();
+#endif
+
+ void setCustomHTMLTokenizerTimeDelay(double);
+ bool hasCustomHTMLTokenizerTimeDelay() const { return true; }
+ double customHTMLTokenizerTimeDelay() const { return settings()->maxParseDuration(); }
+
+ void setCustomHTMLTokenizerChunkSize(int);
+ bool hasCustomHTMLTokenizerChunkSize() const { return m_customHTMLTokenizerChunkSize != -1; }
+ int customHTMLTokenizerChunkSize() const { ASSERT(m_customHTMLTokenizerChunkSize != -1); return m_customHTMLTokenizerChunkSize; }
+
+ void setMemoryCacheClientCallsEnabled(bool);
+ bool areMemoryCacheClientCallsEnabled() const { return m_areMemoryCacheClientCallsEnabled; }
+
+ void setJavaScriptURLsAreAllowed(bool);
+ bool javaScriptURLsAreAllowed() const;
+
+ private:
+ void initGroup();
+
+ OwnPtr<Chrome> m_chrome;
+ OwnPtr<SelectionController> m_dragCaretController;
+ OwnPtr<FocusController> m_focusController;
+ OwnPtr<Settings> m_settings;
+ OwnPtr<ProgressTracker> m_progress;
+
+ RefPtr<BackForwardList> m_backForwardList;
+ RefPtr<Frame> m_mainFrame;
+
+ RefPtr<HistoryItem> m_globalHistoryItem;
+
+ mutable RefPtr<PluginData> m_pluginData;
+
+ EditorClient* m_editorClient;
+
+ int m_frameCount;
+ String m_groupName;
+
+ bool m_tabKeyCyclesThroughElements;
+ bool m_defersLoading;
+
+ bool m_inLowQualityInterpolationMode;
+ bool m_cookieEnabled;
+ bool m_areMemoryCacheClientCallsEnabled;
+ float m_mediaVolume;
+
+ bool m_javaScriptURLsAreAllowed;
+
+
+ String m_userStyleSheetPath;
+ mutable String m_userStyleSheet;
+ mutable bool m_didLoadUserStyleSheet;
+ mutable time_t m_userStyleSheetModificationTime;
+
+ OwnPtr<PageGroup> m_singlePageGroup;
+ PageGroup* m_group;
+
+ JSC::Debugger* m_debugger;
+
+ unsigned m_pendingUnloadEventCount;
+ unsigned m_pendingBeforeUnloadEventCount;
+
+ double m_customHTMLTokenizerTimeDelay;
+ int m_customHTMLTokenizerChunkSize;
+
+#if ENABLE(DOM_STORAGE)
+ RefPtr<SessionStorage> m_sessionStorage;
+#endif
+
+#if PLATFORM(WIN) || (PLATFORM(WX) && defined(__WXMSW__)) || (PLATFORM(QT) && defined(Q_WS_WIN))
+ static HINSTANCE s_instanceHandle;
+#endif
+
+#if ENABLE(WML)
+ OwnPtr<WMLPageState> m_wmlPageState;
+#endif
+ };
+
+} // namespace WebCore
+
+#endif // Page_h
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PageCache_h
+#define PageCache_h
+
+#include "HistoryItem.h"
+#include "Timer.h"
+#include <wtf/Forward.h>
+#include <wtf/HashSet.h>
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+ class CachedPage;
+ class HistoryItem;
+
+ class PageCache : Noncopyable {
+ public:
+ friend PageCache* pageCache();
+
+ void setCapacity(int); // number of pages to cache
+ int capacity() { return m_capacity; }
+
+ void add(PassRefPtr<HistoryItem>, PassRefPtr<CachedPage>); // Prunes if capacity() is exceeded.
+ void remove(HistoryItem*);
+ CachedPage* get(HistoryItem* item) { return item ? item->m_cachedPage.get() : 0; }
+
+ void releaseAutoreleasedPagesNow();
+
+ private:
+ typedef HashSet<RefPtr<CachedPage> > CachedPageSet;
+
+ PageCache(); // Use pageCache() instead.
+ ~PageCache(); // Not implemented to make sure nobody accidentally calls delete -- WebCore does not delete singletons.
+
+ void addToLRUList(HistoryItem*); // Adds to the head of the list.
+ void removeFromLRUList(HistoryItem*);
+
+ void prune();
+
+ void autorelease(PassRefPtr<CachedPage>);
+ void releaseAutoreleasedPagesNowOrReschedule(Timer<PageCache>*);
+
+ int m_capacity;
+ int m_size;
+
+ // LRU List
+ HistoryItem* m_head;
+ HistoryItem* m_tail;
+
+ Timer<PageCache> m_autoreleaseTimer;
+ CachedPageSet m_autoreleaseSet;
+ };
+
+ // Function to obtain the global page cache.
+ PageCache* pageCache();
+
+} // namespace WebCore
+
+#endif // PageCache_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PageGroup_h
+#define PageGroup_h
+
+#include <wtf/HashSet.h>
+#include <wtf/Noncopyable.h>
+#include "LinkHash.h"
+#include "StringHash.h"
+
+namespace WebCore {
+
+ class KURL;
+ class LocalStorage;
+ class Page;
+
+ class PageGroup : Noncopyable {
+ public:
+ PageGroup(const String& name);
+ PageGroup(Page*);
+
+ static PageGroup* pageGroup(const String& groupName);
+ static void closeLocalStorage();
+
+ const HashSet<Page*>& pages() const { return m_pages; }
+
+ void addPage(Page*);
+ void removePage(Page*);
+
+ bool isLinkVisited(LinkHash);
+
+ void addVisitedLink(const KURL&);
+ void addVisitedLink(const UChar*, size_t);
+ void removeVisitedLinks();
+
+ static void setShouldTrackVisitedLinks(bool);
+ static void removeAllVisitedLinks();
+
+ const String& name() { return m_name; }
+ unsigned identifier() { return m_identifier; }
+
+#if ENABLE(DOM_STORAGE)
+ LocalStorage* localStorage();
+#endif
+
+ private:
+ void addVisitedLink(LinkHash stringHash);
+
+ String m_name;
+
+ HashSet<Page*> m_pages;
+
+ HashSet<LinkHash, LinkHashHash> m_visitedLinkHashes;
+ bool m_visitedLinksPopulated;
+
+ unsigned m_identifier;
+#if ENABLE(DOM_STORAGE)
+ RefPtr<LocalStorage> m_localStorage;
+#endif
+ };
+
+} // namespace WebCore
+
+#endif // PageGroup_h
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef Pair_h
+#define Pair_h
+
+#include <wtf/RefCounted.h>
+#include "CSSPrimitiveValue.h"
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+// A primitive value representing a pair. This is useful for properties like border-radius, background-size/position,
+// and border-spacing (all of which are space-separated sets of two values). At the moment we are only using it for
+// border-radius and background-size, but (FIXME) border-spacing and background-position could be converted over to use
+// it (eliminating some extra -webkit- internal properties).
+class Pair : public RefCounted<Pair> {
+public:
+ static PassRefPtr<Pair> create()
+ {
+ return adoptRef(new Pair);
+ }
+ static PassRefPtr<Pair> create(PassRefPtr<CSSPrimitiveValue> first, PassRefPtr<CSSPrimitiveValue> second)
+ {
+ return adoptRef(new Pair(first, second));
+ }
+ virtual ~Pair() { }
+
+ CSSPrimitiveValue* first() const { return m_first.get(); }
+ CSSPrimitiveValue* second() const { return m_second.get(); }
+
+ void setFirst(PassRefPtr<CSSPrimitiveValue> first) { m_first = first; }
+ void setSecond(PassRefPtr<CSSPrimitiveValue> second) { m_second = second; }
+
+private:
+ Pair() : m_first(0), m_second(0) { }
+ Pair(PassRefPtr<CSSPrimitiveValue> first, PassRefPtr<CSSPrimitiveValue> second)
+ : m_first(first), m_second(second) { }
+
+ RefPtr<CSSPrimitiveValue> m_first;
+ RefPtr<CSSPrimitiveValue> m_second;
+};
+
+} // namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2002, 2003 The Karbon Developers
+ * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef ParserUtilities_h
+#define ParserUtilities_h
+
+#include "PlatformString.h"
+
+namespace WebCore {
+
+ inline bool skipString(const UChar*& ptr, const UChar* end, const UChar* name, int length)
+ {
+ if (end - ptr < length)
+ return false;
+ if (memcmp(name, ptr, sizeof(UChar) * length))
+ return false;
+ ptr += length;
+ return true;
+ }
+
+ inline bool skipString(const UChar*& ptr, const UChar* end, const char* str)
+ {
+ int length = strlen(str);
+ if (end - ptr < length)
+ return false;
+ for (int i = 0; i < length; ++i) {
+ if (ptr[i] != str[i])
+ return false;
+ }
+ ptr += length;
+ return true;
+ }
+
+} // namspace WebCore
+
+#endif // ParserUtilities_h
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Pasteboard_h
+#define Pasteboard_h
+
+#include <wtf/Forward.h>
+#include <wtf/HashSet.h>
+#include <wtf/Noncopyable.h>
+
+#if PLATFORM(MAC)
+#include <wtf/RetainPtr.h>
+#endif
+
+#if PLATFORM(GTK)
+#include <PasteboardHelper.h>
+#endif
+
+// FIXME: This class is too high-level to be in the platform directory, since it
+// uses the DOM and makes calls to Editor. It should either be divested of its
+// knowledge of the frame and editor or moved into the editing directory.
+
+#if PLATFORM(MAC)
+class NSFileWrapper;
+class NSPasteboard;
+class NSArray;
+#endif
+
+#if PLATFORM(WIN)
+#include <windows.h>
+typedef struct HWND__* HWND;
+#endif
+
+#if PLATFORM(CHROMIUM)
+#include "PasteboardPrivate.h"
+#endif
+
+namespace WebCore {
+
+#if PLATFORM(MAC)
+extern NSString *WebArchivePboardType;
+extern NSString *WebSmartPastePboardType;
+extern NSString *WebURLNamePboardType;
+extern NSString *WebURLPboardType;
+extern NSString *WebURLsWithTitlesPboardType;
+#endif
+
+class CString;
+class DocumentFragment;
+class Frame;
+class HitTestResult;
+class KURL;
+class Node;
+class Range;
+class String;
+
+class Pasteboard : Noncopyable {
+public:
+#if PLATFORM(MAC)
+ //Helper functions to allow Clipboard to share code
+ static void writeSelection(NSPasteboard* pasteboard, Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame);
+ static void writeURL(NSPasteboard* pasteboard, NSArray* types, const KURL& url, const String& titleStr, Frame* frame);
+#endif
+
+ static Pasteboard* generalPasteboard();
+ void writeSelection(Range*, bool canSmartCopyOrDelete, Frame*);
+ void writeURL(const KURL&, const String&, Frame* = 0);
+ void writeImage(Node*, const KURL&, const String& title);
+#if PLATFORM(MAC)
+ void writeFileWrapperAsRTFDAttachment(NSFileWrapper*);
+#endif
+ void clear();
+ bool canSmartReplace();
+ PassRefPtr<DocumentFragment> documentFragment(Frame*, PassRefPtr<Range>, bool allowPlainText, bool& chosePlainText);
+ String plainText(Frame* = 0);
+#if PLATFORM(QT)
+ bool isSelectionMode() const;
+ void setSelectionMode(bool selectionMode);
+#endif
+
+#if PLATFORM(GTK)
+ void setHelper(PasteboardHelper*);
+#endif
+
+private:
+ Pasteboard();
+ ~Pasteboard();
+
+#if PLATFORM(MAC)
+ Pasteboard(NSPasteboard *);
+ RetainPtr<NSPasteboard> m_pasteboard;
+#endif
+
+#if PLATFORM(WIN)
+ HWND m_owner;
+#endif
+
+#if PLATFORM(GTK)
+ PasteboardHelper* m_helper;
+#endif
+
+#if PLATFORM(QT)
+ bool m_selectionMode;
+#endif
+
+#if PLATFORM(CHROMIUM)
+ PasteboardPrivate p;
+#endif
+};
+
+} // namespace WebCore
+
+#endif // Pasteboard_h
--- /dev/null
+/*
+ * Copyright (C) 2003, 2006, 2009 Apple Inc. All rights reserved.
+ * 2006 Rob Buis <buis@kde.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Path_h
+#define Path_h
+
+#include <algorithm>
+
+#if PLATFORM(CG)
+typedef struct CGPath PlatformPath;
+#elif PLATFORM(QT)
+#include <qglobal.h>
+QT_BEGIN_NAMESPACE
+class QPainterPath;
+QT_END_NAMESPACE
+typedef QPainterPath PlatformPath;
+#elif PLATFORM(WX) && USE(WXGC)
+class wxGraphicsPath;
+typedef wxGraphicsPath PlatformPath;
+#elif PLATFORM(CAIRO)
+namespace WebCore {
+ struct CairoPath;
+}
+typedef WebCore::CairoPath PlatformPath;
+#elif PLATFORM(SKIA)
+class SkPath;
+typedef SkPath PlatformPath;
+#else
+typedef void PlatformPath;
+#endif
+
+namespace WebCore {
+
+ class FloatPoint;
+ class FloatRect;
+ class FloatSize;
+ class GraphicsContext;
+ class String;
+ class StrokeStyleApplier;
+ class TransformationMatrix;
+
+ enum WindRule {
+ RULE_NONZERO = 0,
+ RULE_EVENODD = 1
+ };
+
+ enum PathElementType {
+ PathElementMoveToPoint,
+ PathElementAddLineToPoint,
+ PathElementAddQuadCurveToPoint,
+ PathElementAddCurveToPoint,
+ PathElementCloseSubpath
+ };
+
+ struct PathElement {
+ PathElementType type;
+ FloatPoint* points;
+ };
+
+ typedef void (*PathApplierFunction)(void* info, const PathElement*);
+
+ class Path {
+ public:
+ Path();
+ ~Path();
+
+ Path(const Path&);
+ Path& operator=(const Path&);
+
+ void swap(Path& other) { std::swap(m_path, other.m_path); }
+
+ bool contains(const FloatPoint&, WindRule rule = RULE_NONZERO) const;
+ bool strokeContains(StrokeStyleApplier*, const FloatPoint&) const;
+ FloatRect boundingRect() const;
+ FloatRect strokeBoundingRect(StrokeStyleApplier* = 0);
+
+ float length();
+ FloatPoint pointAtLength(float length, bool& ok);
+ float normalAngleAtLength(float length, bool& ok);
+
+ void clear();
+ bool isEmpty() const;
+
+ void moveTo(const FloatPoint&);
+ void addLineTo(const FloatPoint&);
+ void addQuadCurveTo(const FloatPoint& controlPoint, const FloatPoint& endPoint);
+ void addBezierCurveTo(const FloatPoint& controlPoint1, const FloatPoint& controlPoint2, const FloatPoint& endPoint);
+ void addArcTo(const FloatPoint&, const FloatPoint&, float radius);
+ void closeSubpath();
+
+ void addArc(const FloatPoint&, float radius, float startAngle, float endAngle, bool anticlockwise);
+ void addRect(const FloatRect&);
+ void addEllipse(const FloatRect&);
+
+ void translate(const FloatSize&);
+
+ String debugString() const;
+
+ PlatformPath* platformPath() const { return m_path; }
+
+ static Path createRoundedRectangle(const FloatRect&, const FloatSize& roundingRadii);
+ static Path createRoundedRectangle(const FloatRect&, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius);
+ static Path createRectangle(const FloatRect&);
+ static Path createEllipse(const FloatPoint& center, float rx, float ry);
+ static Path createCircle(const FloatPoint& center, float r);
+ static Path createLine(const FloatPoint&, const FloatPoint&);
+
+ void apply(void* info, PathApplierFunction) const;
+ void transform(const TransformationMatrix&);
+
+ private:
+ PlatformPath* m_path;
+ };
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007 Eric Seidel <eric@webkit.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PathTraversalState_h
+#define PathTraversalState_h
+
+#include "FloatPoint.h"
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+ class Path;
+
+ class PathTraversalState {
+ public:
+ enum PathTraversalAction {
+ TraversalTotalLength,
+ TraversalPointAtLength,
+ TraversalSegmentAtLength,
+ TraversalNormalAngleAtLength
+ };
+
+ PathTraversalState(PathTraversalAction);
+
+ float closeSubpath();
+ float moveTo(const FloatPoint&);
+ float lineTo(const FloatPoint&);
+ float quadraticBezierTo(const FloatPoint& newControl, const FloatPoint& newEnd);
+ float cubicBezierTo(const FloatPoint& newControl1, const FloatPoint& newControl2, const FloatPoint& newEnd);
+
+ public:
+ PathTraversalAction m_action;
+ bool m_success;
+
+ FloatPoint m_current;
+ FloatPoint m_start;
+ FloatPoint m_control1;
+ FloatPoint m_control2;
+
+ float m_totalLength;
+ unsigned m_segmentIndex;
+ float m_desiredLength;
+
+ // For normal calculations
+ FloatPoint m_previous;
+ float m_normalAngle; // degrees
+ };
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Pattern_h
+#define Pattern_h
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+#if PLATFORM(CG)
+typedef struct CGPattern* CGPatternRef;
+typedef CGPatternRef PlatformPatternPtr;
+#elif PLATFORM(CAIRO)
+#include <cairo.h>
+typedef cairo_pattern_t* PlatformPatternPtr;
+#elif PLATFORM(SKIA)
+class SkShader;
+typedef SkShader* PlatformPatternPtr;
+#elif PLATFORM(QT)
+#include <QBrush>
+typedef QBrush PlatformPatternPtr;
+#elif PLATFORM(WX)
+#if USE(WXGC)
+class wxGraphicsBrush;
+typedef wxGraphicsBrush* PlatformPatternPtr;
+#else
+class wxBrush;
+typedef wxBrush* PlatformPatternPtr;
+#endif // USE(WXGC)
+#endif
+
+namespace WebCore {
+ class TransformationMatrix;
+ class Image;
+
+ class Pattern : public RefCounted<Pattern> {
+ public:
+ static PassRefPtr<Pattern> create(Image* tileImage, bool repeatX, bool repeatY)
+ {
+ return adoptRef(new Pattern(tileImage, repeatX, repeatY));
+ }
+ virtual ~Pattern();
+
+ Image* tileImage() const { return m_tileImage.get(); }
+
+ PlatformPatternPtr createPlatformPattern(const TransformationMatrix& patternTransform) const;
+
+ private:
+ Pattern(Image*, bool repeatX, bool repeatY);
+
+ RefPtr<Image> m_tileImage;
+ bool m_repeatX;
+ bool m_repeatY;
+ };
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2003-6 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Pen_h
+#define Pen_h
+
+#include "Color.h"
+
+#if PLATFORM(WX)
+class wxPen;
+#endif
+
+namespace WebCore {
+
+class Pen {
+public:
+ enum PenStyle {
+ NoPen,
+ SolidLine,
+ DotLine,
+ DashLine
+ };
+
+ Pen(const Color &c = Color::black, unsigned w = 0, PenStyle ps = SolidLine);
+
+ const Color &color() const;
+ unsigned width() const;
+ PenStyle style() const;
+
+ void setColor(const Color &);
+ void setWidth(unsigned);
+ void setStyle(PenStyle);
+
+ bool operator==(const Pen &) const;
+ bool operator!=(const Pen &) const;
+
+#if PLATFORM(WX)
+ Pen(const wxPen&);
+ operator wxPen() const;
+#endif
+
+private:
+ PenStyle m_style;
+ unsigned m_width;
+ Color m_color;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PerspectiveTransformOperation_h
+#define PerspectiveTransformOperation_h
+
+#include "TransformOperation.h"
+
+namespace WebCore {
+
+class PerspectiveTransformOperation : public TransformOperation {
+public:
+ static PassRefPtr<PerspectiveTransformOperation> create(double p)
+ {
+ return adoptRef(new PerspectiveTransformOperation(p));
+ }
+
+private:
+ virtual bool isIdentity() const { return m_p == 0; }
+ virtual OperationType getOperationType() const { return PERSPECTIVE; }
+ virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == PERSPECTIVE; }
+
+ virtual bool operator==(const TransformOperation& o) const
+ {
+ if (!isSameType(o))
+ return false;
+ const PerspectiveTransformOperation* p = static_cast<const PerspectiveTransformOperation*>(&o);
+ return m_p == p->m_p;
+ }
+
+ virtual bool apply(TransformationMatrix& transform, const IntSize&) const
+ {
+ transform.applyPerspective(m_p);
+ return false;
+ }
+
+ virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
+
+ PerspectiveTransformOperation(double p)
+ : m_p(p)
+ {
+ }
+
+ double m_p;
+};
+
+} // namespace WebCore
+
+#endif // PerspectiveTransformOperation_h
--- /dev/null
+/*
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2008 Collabora, Ltd. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PlatformKeyboardEvent_h
+#define PlatformKeyboardEvent_h
+
+#include "PlatformString.h"
+#include <wtf/Platform.h>
+
+#if PLATFORM(MAC)
+#include <wtf/RetainPtr.h>
+#ifdef __OBJC__
+@class NSEvent;
+#else
+class NSEvent;
+#endif
+#endif
+
+#if PLATFORM(WIN)
+typedef struct HWND__ *HWND;
+typedef unsigned WPARAM;
+typedef long LPARAM;
+#endif
+
+#include <GraphicsServices/GSEvent.h>
+
+#if PLATFORM(GTK)
+typedef struct _GdkEventKey GdkEventKey;
+#endif
+
+#if PLATFORM(QT)
+QT_BEGIN_NAMESPACE
+class QKeyEvent;
+QT_END_NAMESPACE
+#endif
+
+#if PLATFORM(WX)
+class wxKeyEvent;
+#endif
+
+namespace WebCore {
+
+ class PlatformKeyboardEvent {
+ public:
+ enum Type {
+ // KeyDown is sent by platforms such as Mac OS X, gtk and Qt, and has information about both physical pressed key, and its translation.
+ // For DOM processing, it needs to be disambiguated as RawKeyDown or Char event.
+ KeyDown,
+
+ // KeyUp is sent by all platforms.
+ KeyUp,
+
+ // These events are sent by platforms such as Windows and wxWidgets. RawKeyDown only has information about a physical key, and Char
+ // only has information about a character it was translated into.
+ RawKeyDown,
+ Char
+ };
+
+ enum ModifierKey {
+ AltKey = 1 << 0,
+ CtrlKey = 1 << 1,
+ MetaKey = 1 << 2,
+ ShiftKey = 1 << 3,
+ };
+
+ Type type() const { return m_type; }
+ void disambiguateKeyDownEvent(Type, bool backwardCompatibilityMode = false); // Only used on platforms that need it, i.e. those that generate KeyDown events.
+
+ // Text as as generated by processing a virtual key code with a keyboard layout
+ // (in most cases, just a character code, but the layout can emit several
+ // characters in a single keypress event on some platforms).
+ // This may bear no resemblance to the ultimately inserted text if an input method
+ // processes the input.
+ // Will be null for KeyUp and RawKeyDown events.
+ String text() const { return m_text; }
+
+ // Text that would have been generated by the keyboard if no modifiers were pressed
+ // (except for Shift); useful for shortcut (accelerator) key handling.
+ // Otherwise, same as text().
+ String unmodifiedText() const { return m_unmodifiedText; }
+
+ // Most compatible Windows virtual key code associated with the event.
+ // Zero for Char events.
+ int windowsVirtualKeyCode() const { return m_windowsVirtualKeyCode; }
+ void setWindowsVirtualKeyCode(int code) { m_windowsVirtualKeyCode = code; }
+
+ int nativeVirtualKeyCode() const { return m_nativeVirtualKeyCode; }
+ void setNativeVirtualKeyCode(int code) { m_nativeVirtualKeyCode = code; }
+
+ String keyIdentifier() const { return m_keyIdentifier; }
+ bool isAutoRepeat() const { return m_autoRepeat; }
+ void setIsAutoRepeat(bool in) { m_autoRepeat = in; }
+ bool isKeypad() const { return m_isKeypad; }
+ bool shiftKey() const { return m_shiftKey; }
+ bool ctrlKey() const { return m_ctrlKey; }
+ bool altKey() const { return m_altKey; }
+ bool metaKey() const { return m_metaKey; }
+ unsigned modifiers() const {
+ return (altKey() ? AltKey : 0)
+ | (ctrlKey() ? CtrlKey : 0)
+ | (metaKey() ? MetaKey : 0)
+ | (shiftKey() ? ShiftKey : 0);
+ }
+
+ static bool currentCapsLockState();
+
+#if PLATFORM(MAC)
+ PlatformKeyboardEvent(GSEventRef);
+ GSEventRef gsEvent() const { return m_gsEvent.get(); }
+#endif
+
+#if PLATFORM(WIN)
+ PlatformKeyboardEvent(HWND, WPARAM, LPARAM, Type, bool);
+#endif
+
+#if PLATFORM(GTK)
+ PlatformKeyboardEvent(GdkEventKey*);
+ GdkEventKey* gdkEventKey() const;
+#endif
+
+#if PLATFORM(QT)
+ PlatformKeyboardEvent(QKeyEvent*);
+ QKeyEvent* qtEvent() const { return m_qtEvent; }
+#endif
+
+#if PLATFORM(WX)
+ PlatformKeyboardEvent(wxKeyEvent&);
+#endif
+
+#if PLATFORM(WIN) || PLATFORM(CHROMIUM)
+ bool isSystemKey() const { return m_isSystemKey; }
+#endif
+
+ protected:
+ Type m_type;
+ String m_text;
+ String m_unmodifiedText;
+ String m_keyIdentifier;
+ bool m_autoRepeat;
+ int m_windowsVirtualKeyCode;
+ int m_nativeVirtualKeyCode;
+ bool m_isKeypad;
+ bool m_shiftKey;
+ bool m_ctrlKey;
+ bool m_altKey;
+ bool m_metaKey;
+
+#if PLATFORM(MAC)
+ RetainPtr<__GSEvent> m_gsEvent;
+#endif
+#if PLATFORM(WIN) || PLATFORM(CHROMIUM)
+ bool m_isSystemKey;
+#endif
+#if PLATFORM(GTK)
+ GdkEventKey* m_gdkEventKey;
+#endif
+#if PLATFORM(QT)
+ QKeyEvent* m_qtEvent;
+#endif
+ };
+
+} // namespace WebCore
+
+#endif // PlatformKeyboardEvent_h
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PlatformMenuDescription_h
+#define PlatformMenuDescription_h
+
+#if PLATFORM(MAC)
+#ifdef __OBJC__
+@class NSMutableArray;
+#else
+class NSMutableArray;
+#endif
+#elif PLATFORM(WIN)
+typedef struct HMENU__* HMENU;
+#elif PLATFORM(QT)
+#include <qlist.h>
+#elif PLATFORM(GTK)
+typedef struct _GtkMenu GtkMenu;
+#elif PLATFORM(WX)
+class wxMenu;
+#endif
+
+namespace WebCore {
+
+#if PLATFORM(MAC)
+ typedef NSMutableArray* PlatformMenuDescription;
+#elif PLATFORM(WIN)
+ typedef HMENU PlatformMenuDescription;
+#elif PLATFORM(QT)
+ class ContextMenuItem;
+ typedef const QList<ContextMenuItem>* PlatformMenuDescription;
+#elif PLATFORM(GTK)
+ typedef GtkMenu* PlatformMenuDescription;
+#elif PLATFORM(WX)
+ typedef wxMenu* PlatformMenuDescription;
+#else
+ typedef void* PlatformMenuDescription;
+#endif
+
+} // namespace
+
+#endif // PlatformMenuDescription_h
--- /dev/null
+/*
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PlatformMouseEvent_h
+#define PlatformMouseEvent_h
+
+#include <GraphicsServices/GSEvent.h>
+
+#include "IntPoint.h"
+#include <wtf/Platform.h>
+
+#if PLATFORM(MAC)
+#ifdef __OBJC__
+@class NSEvent;
+@class NSScreen;
+@class NSWindow;
+#else
+class NSEvent;
+class NSScreen;
+class NSWindow;
+#endif
+#endif
+
+#if PLATFORM(WIN)
+typedef struct HWND__* HWND;
+typedef unsigned UINT;
+typedef unsigned WPARAM;
+typedef long LPARAM;
+#endif
+
+#if PLATFORM(GTK)
+typedef struct _GdkEventButton GdkEventButton;
+typedef struct _GdkEventMotion GdkEventMotion;
+#endif
+
+#if PLATFORM(QT)
+QT_BEGIN_NAMESPACE
+class QInputEvent;
+QT_END_NAMESPACE
+#endif
+
+#if PLATFORM(WX)
+class wxMouseEvent;
+#endif
+
+namespace WebCore {
+
+ // These button numbers match the ones used in the DOM API, 0 through 2, except for NoButton which isn't specified.
+ enum MouseButton { NoButton = -1, LeftButton, MiddleButton, RightButton };
+ enum MouseEventType { MouseEventMoved, MouseEventPressed, MouseEventReleased, MouseEventScroll };
+
+ class PlatformMouseEvent {
+ public:
+ PlatformMouseEvent()
+ : m_button(NoButton)
+ , m_eventType(MouseEventMoved)
+ , m_clickCount(0)
+ , m_shiftKey(false)
+ , m_ctrlKey(false)
+ , m_altKey(false)
+ , m_metaKey(false)
+ , m_timestamp(0)
+ , m_modifierFlags(0)
+ {
+ }
+
+ PlatformMouseEvent(const IntPoint& pos, const IntPoint& globalPos, MouseButton button, MouseEventType eventType,
+ int clickCount, bool shift, bool ctrl, bool alt, bool meta, double timestamp)
+ : m_position(pos), m_globalPosition(globalPos), m_button(button)
+ , m_eventType(eventType)
+ , m_clickCount(clickCount)
+ , m_shiftKey(shift)
+ , m_ctrlKey(ctrl)
+ , m_altKey(alt)
+ , m_metaKey(meta)
+ , m_timestamp(timestamp)
+ , m_modifierFlags(0)
+ {
+ }
+
+ const IntPoint& pos() const { return m_position; }
+ int x() const { return m_position.x(); }
+ int y() const { return m_position.y(); }
+ int globalX() const { return m_globalPosition.x(); }
+ int globalY() const { return m_globalPosition.y(); }
+ MouseButton button() const { return m_button; }
+ MouseEventType eventType() const { return m_eventType; }
+ int clickCount() const { return m_clickCount; }
+ bool shiftKey() const { return m_shiftKey; }
+ bool ctrlKey() const { return m_ctrlKey; }
+ bool altKey() const { return m_altKey; }
+ bool metaKey() const { return m_metaKey; }
+ unsigned modifierFlags() const { return m_modifierFlags; }
+
+ //time in seconds
+ double timestamp() const { return m_timestamp; }
+
+#if PLATFORM(MAC)
+ PlatformMouseEvent(GSEventRef);
+#endif
+#if PLATFORM(WIN)
+ PlatformMouseEvent(HWND, UINT, WPARAM, LPARAM, bool activatedWebView = false);
+ void setClickCount(int count) { m_clickCount = count; }
+ bool activatedWebView() const { return m_activatedWebView; }
+#endif
+#if PLATFORM(GTK)
+ PlatformMouseEvent(GdkEventButton*);
+ PlatformMouseEvent(GdkEventMotion*);
+#endif
+#if PLATFORM(QT)
+ PlatformMouseEvent(QInputEvent*, int clickCount);
+#endif
+
+#if PLATFORM(WX)
+ PlatformMouseEvent(const wxMouseEvent&, const wxPoint& globalPoint);
+#endif
+
+
+ protected:
+ IntPoint m_position;
+ IntPoint m_globalPosition;
+ MouseButton m_button;
+ MouseEventType m_eventType;
+ int m_clickCount;
+ bool m_shiftKey;
+ bool m_ctrlKey;
+ bool m_altKey;
+ bool m_metaKey;
+ double m_timestamp; // unit: seconds
+ unsigned m_modifierFlags;
+#if PLATFORM(WIN)
+ bool m_activatedWebView;
+#endif
+ };
+
+#if PLATFORM(MAC)
+ IntPoint pointForEvent(GSEventRef event);
+ IntPoint globalPointForEvent(GSEventRef event);
+#endif
+
+} // namespace WebCore
+
+#endif // PlatformMouseEvent_h
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PlatformScreen_h
+#define PlatformScreen_h
+
+#include "FloatRect.h"
+#include <wtf/Forward.h>
+#include <wtf/RefPtr.h>
+
+#if PLATFORM(MAC)
+#ifdef __OBJC__
+ @class NSScreen;
+ @class NSWindow;
+#else
+ class NSScreen;
+ class NSWindow;
+#endif
+#endif
+
+namespace WebCore {
+
+ class FloatRect;
+ class Widget;
+
+ int screenDepth(Widget*);
+ int screenDepthPerComponent(Widget*);
+ bool screenIsMonochrome(Widget*);
+
+ FloatRect screenRect(Widget*);
+ FloatRect screenAvailableRect(Widget*);
+
+
+} // namespace WebCore
+
+#endif // PlatformScreen_h
--- /dev/null
+/*
+ * (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PlatformString_h
+#define PlatformString_h
+
+// This file would be called String.h, but that conflicts with <string.h>
+// on systems without case-sensitive file systems.
+
+#include "StringImpl.h"
+
+#include <wtf/PassRefPtr.h>
+
+#if USE(JSC)
+#include <runtime/Identifier.h>
+#else
+// runtime/Identifier.h includes HashMap.h and HashSet.h. We explicitly include
+// them in the case of non-JSC builds to keep things consistent.
+#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
+#endif
+
+#if PLATFORM(CF) || (PLATFORM(QT) && PLATFORM(DARWIN))
+typedef const struct __CFString * CFStringRef;
+#endif
+
+#if PLATFORM(QT)
+QT_BEGIN_NAMESPACE
+class QString;
+QT_END_NAMESPACE
+#endif
+
+#if PLATFORM(WX)
+class wxString;
+#endif
+
+namespace WebCore {
+
+class CString;
+class SharedBuffer;
+struct StringHash;
+
+class String {
+public:
+ String() { } // gives null string, distinguishable from an empty string
+ String(const UChar*, unsigned length);
+ String(const UChar*); // Specifically for null terminated UTF-16
+#if USE(JSC)
+ String(const JSC::Identifier&);
+ String(const JSC::UString&);
+#endif
+ String(const char*);
+ String(const char*, unsigned length);
+ String(StringImpl* i) : m_impl(i) { }
+ String(PassRefPtr<StringImpl> i) : m_impl(i) { }
+ String(RefPtr<StringImpl> i) : m_impl(i) { }
+
+ void swap(String& o) { m_impl.swap(o.m_impl); }
+
+ // Hash table deleted values, which are only constructed and never copied or destroyed.
+ String(WTF::HashTableDeletedValueType) : m_impl(WTF::HashTableDeletedValue) { }
+ bool isHashTableDeletedValue() const { return m_impl.isHashTableDeletedValue(); }
+
+ static String adopt(StringBuffer& buffer) { return StringImpl::adopt(buffer); }
+ static String adopt(Vector<UChar>& vector) { return StringImpl::adopt(vector); }
+
+#if USE(JSC)
+ operator JSC::UString() const;
+#endif
+
+ unsigned length() const;
+ const UChar* characters() const;
+ const UChar* charactersWithNullTermination();
+
+ UChar operator[](unsigned i) const; // if i >= length(), returns 0
+ UChar32 characterStartingAt(unsigned) const; // Ditto.
+
+ bool contains(UChar c) const { return find(c) != -1; }
+ bool contains(const char* str, bool caseSensitive = true) const { return find(str, 0, caseSensitive) != -1; }
+ bool contains(const String& str, bool caseSensitive = true) const { return find(str, 0, caseSensitive) != -1; }
+
+ int find(UChar c, int start = 0) const
+ { return m_impl ? m_impl->find(c, start) : -1; }
+ int find(CharacterMatchFunctionPtr matchFunction, int start = 0) const
+ { return m_impl ? m_impl->find(matchFunction, start) : -1; }
+ int find(const char* str, int start = 0, bool caseSensitive = true) const
+ { return m_impl ? m_impl->find(str, start, caseSensitive) : -1; }
+ int find(const String& str, int start = 0, bool caseSensitive = true) const
+ { return m_impl ? m_impl->find(str.impl(), start, caseSensitive) : -1; }
+
+ int reverseFind(UChar c, int start = -1) const
+ { return m_impl ? m_impl->reverseFind(c, start) : -1; }
+ int reverseFind(const String& str, int start = -1, bool caseSensitive = true) const
+ { return m_impl ? m_impl->reverseFind(str.impl(), start, caseSensitive) : -1; }
+
+ bool startsWith(const String& s, bool caseSensitive = true) const
+ { return m_impl ? m_impl->startsWith(s.impl(), caseSensitive) : s.isEmpty(); }
+ bool endsWith(const String& s, bool caseSensitive = true) const
+ { return m_impl ? m_impl->endsWith(s.impl(), caseSensitive) : s.isEmpty(); }
+
+ void append(const String&);
+ void append(char);
+ void append(UChar);
+ void append(const UChar*, unsigned length);
+ void insert(const String&, unsigned pos);
+ void insert(const UChar*, unsigned length, unsigned pos);
+
+ String& replace(UChar a, UChar b) { if (m_impl) m_impl = m_impl->replace(a, b); return *this; }
+ String& replace(UChar a, const String& b) { if (m_impl) m_impl = m_impl->replace(a, b.impl()); return *this; }
+ String& replace(const String& a, const String& b) { if (m_impl) m_impl = m_impl->replace(a.impl(), b.impl()); return *this; }
+ String& replace(unsigned index, unsigned len, const String& b) { if (m_impl) m_impl = m_impl->replace(index, len, b.impl()); return *this; }
+
+ void truncate(unsigned len);
+ void remove(unsigned pos, int len = 1);
+
+ String substring(unsigned pos, unsigned len = UINT_MAX) const;
+ String left(unsigned len) const { return substring(0, len); }
+ String right(unsigned len) const { return substring(length() - len, len); }
+
+ // Returns a lowercase/uppercase version of the string
+ String lower() const;
+ String upper() const;
+
+ String stripWhiteSpace() const;
+ String simplifyWhiteSpace() const;
+
+ String removeCharacters(CharacterMatchFunctionPtr) const;
+
+ // Return the string with case folded for case insensitive comparison.
+ String foldCase() const;
+
+ static String number(short);
+ static String number(unsigned short);
+ static String number(int);
+ static String number(unsigned);
+ static String number(long);
+ static String number(unsigned long);
+ static String number(long long);
+ static String number(unsigned long long);
+ static String number(double);
+
+ static String format(const char *, ...) WTF_ATTRIBUTE_PRINTF(1, 2);
+
+ void split(const String& separator, Vector<String>& result) const;
+ void split(const String& separator, bool allowEmptyEntries, Vector<String>& result) const;
+ void split(UChar separator, Vector<String>& result) const;
+ void split(UChar separator, bool allowEmptyEntries, Vector<String>& result) const;
+
+ int toIntStrict(bool* ok = 0, int base = 10) const;
+ unsigned toUIntStrict(bool* ok = 0, int base = 10) const;
+ int64_t toInt64Strict(bool* ok = 0, int base = 10) const;
+ uint64_t toUInt64Strict(bool* ok = 0, int base = 10) const;
+
+ int toInt(bool* ok = 0) const;
+ unsigned toUInt(bool* ok = 0) const;
+ int64_t toInt64(bool* ok = 0) const;
+ uint64_t toUInt64(bool* ok = 0) const;
+ double toDouble(bool* ok = 0) const;
+ float toFloat(bool* ok = 0) const;
+
+ bool percentage(int& percentage) const;
+
+ // Makes a deep copy. Helpful only if you need to use a String on another thread.
+ // Since the underlying StringImpl objects are immutable, there's no other reason
+ // to ever prefer copy() over plain old assignment.
+ String copy() const;
+
+ // Makes a deep copy like copy() but only for a substring.
+ // (This ensures that you always get something suitable for a thread while subtring
+ // may not. For example, in the empty string case, StringImpl::substring returns
+ // empty() which is not safe for another thread.)
+ String substringCopy(unsigned pos, unsigned len = UINT_MAX) const;
+
+ bool isNull() const { return !m_impl; }
+ bool isEmpty() const;
+
+ StringImpl* impl() const { return m_impl.get(); }
+
+#if PLATFORM(CF) || (PLATFORM(QT) && PLATFORM(DARWIN))
+ String(CFStringRef);
+ CFStringRef createCFString() const;
+#endif
+
+#ifdef __OBJC__
+ String(NSString*);
+
+ // This conversion maps NULL to "", which loses the meaning of NULL, but we
+ // need this mapping because AppKit crashes when passed nil NSStrings.
+ operator NSString*() const { if (!m_impl) return @""; return *m_impl; }
+#endif
+
+#if PLATFORM(QT)
+ String(const QString&);
+ String(const QStringRef&);
+ operator QString() const;
+#endif
+
+#if PLATFORM(WX)
+ String(const wxString&);
+ operator wxString() const;
+#endif
+
+#ifndef NDEBUG
+ Vector<char> ascii() const;
+#endif
+
+ CString latin1() const;
+ CString utf8() const;
+
+ static String fromUTF8(const char*, size_t);
+ static String fromUTF8(const char*);
+
+ // Determines the writing direction using the Unicode Bidi Algorithm rules P2 and P3.
+ WTF::Unicode::Direction defaultWritingDirection() const { return m_impl ? m_impl->defaultWritingDirection() : WTF::Unicode::LeftToRight; }
+
+private:
+ RefPtr<StringImpl> m_impl;
+};
+
+String operator+(const String&, const String&);
+String operator+(const String&, const char*);
+String operator+(const char*, const String&);
+
+inline String& operator+=(String& a, const String& b) { a.append(b); return a; }
+
+inline bool operator==(const String& a, const String& b) { return equal(a.impl(), b.impl()); }
+inline bool operator==(const String& a, const char* b) { return equal(a.impl(), b); }
+inline bool operator==(const char* a, const String& b) { return equal(a, b.impl()); }
+
+inline bool operator!=(const String& a, const String& b) { return !equal(a.impl(), b.impl()); }
+inline bool operator!=(const String& a, const char* b) { return !equal(a.impl(), b); }
+inline bool operator!=(const char* a, const String& b) { return !equal(a, b.impl()); }
+
+inline bool equalIgnoringCase(const String& a, const String& b) { return equalIgnoringCase(a.impl(), b.impl()); }
+inline bool equalIgnoringCase(const String& a, const char* b) { return equalIgnoringCase(a.impl(), b); }
+inline bool equalIgnoringCase(const char* a, const String& b) { return equalIgnoringCase(a, b.impl()); }
+
+inline bool operator!(const String& str) { return str.isNull(); }
+
+inline void swap(String& a, String& b) { a.swap(b); }
+
+// String Operations
+
+bool charactersAreAllASCII(const UChar*, size_t);
+
+int charactersToIntStrict(const UChar*, size_t, bool* ok = 0, int base = 10);
+unsigned charactersToUIntStrict(const UChar*, size_t, bool* ok = 0, int base = 10);
+int64_t charactersToInt64Strict(const UChar*, size_t, bool* ok = 0, int base = 10);
+uint64_t charactersToUInt64Strict(const UChar*, size_t, bool* ok = 0, int base = 10);
+
+int charactersToInt(const UChar*, size_t, bool* ok = 0); // ignores trailing garbage
+unsigned charactersToUInt(const UChar*, size_t, bool* ok = 0); // ignores trailing garbage
+int64_t charactersToInt64(const UChar*, size_t, bool* ok = 0); // ignores trailing garbage
+uint64_t charactersToUInt64(const UChar*, size_t, bool* ok = 0); // ignores trailing garbage
+
+double charactersToDouble(const UChar*, size_t, bool* ok = 0);
+float charactersToFloat(const UChar*, size_t, bool* ok = 0);
+
+int find(const UChar*, size_t, UChar, int startPosition = 0);
+int reverseFind(const UChar*, size_t, UChar, int startPosition = -1);
+
+#ifdef __OBJC__
+// This is for situations in WebKit where the long standing behavior has been
+// "nil if empty", so we try to maintain longstanding behavior for the sake of
+// entrenched clients
+inline NSString* nsStringNilIfEmpty(const String& str) { return str.isEmpty() ? nil : (NSString*)str; }
+#endif
+
+inline bool charactersAreAllASCII(const UChar* characters, size_t length)
+{
+ UChar ored = 0;
+ for (size_t i = 0; i < length; ++i)
+ ored |= characters[i];
+ return !(ored & 0xFF80);
+}
+
+inline int find(const UChar* characters, size_t length, UChar character, int startPosition)
+{
+ if (startPosition >= static_cast<int>(length))
+ return -1;
+ for (size_t i = startPosition; i < length; ++i) {
+ if (characters[i] == character)
+ return static_cast<int>(i);
+ }
+ return -1;
+}
+
+inline int find(const UChar* characters, size_t length, CharacterMatchFunctionPtr matchFunction, int startPosition)
+{
+ if (startPosition >= static_cast<int>(length))
+ return -1;
+ for (size_t i = startPosition; i < length; ++i) {
+ if (matchFunction(characters[i]))
+ return static_cast<int>(i);
+ }
+ return -1;
+}
+
+inline int reverseFind(const UChar* characters, size_t length, UChar character, int startPosition)
+{
+ if (startPosition >= static_cast<int>(length) || !length)
+ return -1;
+ if (startPosition < 0)
+ startPosition += static_cast<int>(length);
+ while (true) {
+ if (characters[startPosition] == character)
+ return startPosition;
+ if (!startPosition)
+ return -1;
+ startPosition--;
+ }
+ ASSERT_NOT_REACHED();
+ return -1;
+}
+
+inline void append(Vector<UChar>& vector, const String& string)
+{
+ vector.append(string.characters(), string.length());
+}
+
+inline void appendNumber(Vector<UChar>& vector, unsigned char number)
+{
+ int numberLength = number > 99 ? 3 : (number > 9 ? 2 : 1);
+ size_t vectorSize = vector.size();
+ vector.grow(vectorSize + numberLength);
+
+ switch (numberLength) {
+ case 3:
+ vector[vectorSize + 2] = number % 10 + '0';
+ number /= 10;
+
+ case 2:
+ vector[vectorSize + 1] = number % 10 + '0';
+ number /= 10;
+
+ case 1:
+ vector[vectorSize] = number % 10 + '0';
+ }
+}
+
+
+
+PassRefPtr<SharedBuffer> utf8Buffer(const String&);
+
+} // namespace WebCore
+
+namespace WTF {
+
+ // StringHash is the default hash for String
+ template<typename T> struct DefaultHash;
+ template<> struct DefaultHash<WebCore::String> {
+ typedef WebCore::StringHash Hash;
+ };
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008, Apple Inc. All rights reserved.
+ *
+ * No license or rights are granted by Apple expressly or by implication,
+ * estoppel, or otherwise, to Apple copyrights, patents, trademarks, trade
+ * secrets or other rights.
+ */
+
+#ifndef PlatformTouchEvent_h
+#define PlatformTouchEvent_h
+
+#include <JavaScriptCore/Platform.h>
+
+#if ENABLE(TOUCH_EVENTS)
+
+#include <GraphicsServices/GSEvent.h>
+#include <wtf/Vector.h>
+
+#include "IntPoint.h"
+
+namespace WebCore {
+
+ enum TouchEventType { TouchEventBegin, TouchEventChange, TouchEventEnd, TouchEventCancel };
+
+ class PlatformTouchEvent {
+ public:
+ PlatformTouchEvent(GSEventRef);
+
+ TouchEventType eventType() const;
+ double timestamp() const;
+ unsigned touchCount() const;
+ IntPoint touchLocationAtIndex(unsigned) const;
+ IntPoint globalTouchLocationAtIndex(unsigned) const;
+ unsigned touchIdentifierAtIndex(unsigned) const;
+
+ bool gestureChanged() const;
+
+ float scaleAbsolute() const;
+ float rotationAbsolute() const;
+
+ GSEventRef platformEvent() const { return m_gsEvent; }
+ private:
+ GSEventRef m_gsEvent;
+ unsigned m_fingerCount;
+ Vector<GSEventPathInfo> m_pathData;
+ };
+} // namespace WebCore
+
+#endif // ENABLE(TOUCH_EVENTS)
+
+#endif // PlatformTouchEvent_h
--- /dev/null
+/*
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PlatformWheelEvent_h
+#define PlatformWheelEvent_h
+
+#include "IntPoint.h"
+
+#import <GraphicsServices/GSEvent.h>
+
+#if PLATFORM(MAC)
+#endif
+
+#if PLATFORM(WIN)
+typedef struct HWND__* HWND;
+typedef unsigned WPARAM;
+typedef long LPARAM;
+#endif
+
+#if PLATFORM(GTK)
+typedef struct _GdkEventScroll GdkEventScroll;
+#endif
+
+#if PLATFORM(QT)
+QT_BEGIN_NAMESPACE
+class QWheelEvent;
+QT_END_NAMESPACE
+#endif
+
+#if PLATFORM(WX)
+class wxMouseEvent;
+class wxPoint;
+#endif
+
+namespace WebCore {
+
+ // Wheel events come in three flavors:
+ // The ScrollByPixelWheelEvent is a fine-grained event that specifies the precise number of pixels to scroll. It is sent by MacBook touchpads on OS X.
+ // For ScrollByPixelWheelEvents, the delta values contain the precise number of pixels to scroll.
+ // The ScrollByLineWheelEvent (the normal wheel event) sends a delta that can be corrected by a line multiplier to determine how many lines to scroll.
+ // If the platform has configurable line sensitivity (Windows), then the number of lines to scroll is used in order to behave like the platform.
+ // If the platform does not have configurable line sensitivity, then WebCore's default behavior is used (which scrolls 3 * the wheel line delta).
+ // For ScrollByLineWheelEvents, the delta values represent the number of lines to scroll.
+ // The ScrollByPageWheelEvent indicates that the wheel event should scroll an entire page instead. In this case WebCore's built in paging behavior is used to page
+ // up and down (you get the same behavior as if the user was clicking in a scrollbar track to page up or page down). Page scrolling only works in the vertical direction.
+ enum PlatformWheelEventGranularity { ScrollByLineWheelEvent, ScrollByPageWheelEvent, ScrollByPixelWheelEvent };
+
+ // WebCore uses a line multiple of ~3 (40px per line step) when doing arrowing with a scrollbar or line stepping via the arrow keys. The delta for wheeling is expressed
+ // as a # of actual lines (40 / 3 = 1 wheel line). We use the horizontalLineMultiplier and verticalLineMultiplier methods to incorporate the line multiplier into the deltas. On
+ // platforms that do not support wheel sensitivity, we use this hardcoded constant value of 3 to ensure that wheeling by default matches the WebCore multiplier you
+ // get when doing other kinds of line stepping.
+ const int cLineMultiplier = 3;
+
+ class PlatformWheelEvent {
+ public:
+ const IntPoint& pos() const { return m_position; } // PlatformWindow coordinates.
+ const IntPoint& globalPos() const { return m_globalPosition; } // Screen coordinates.
+
+ float deltaX() const { return m_deltaX; }
+ float deltaY() const { return m_deltaY; }
+
+ PlatformWheelEventGranularity granularity() const { return m_granularity; }
+
+ bool isAccepted() const { return m_isAccepted; }
+ bool shiftKey() const { return m_shiftKey; }
+ bool ctrlKey() const { return m_ctrlKey; }
+ bool altKey() const { return m_altKey; }
+ bool metaKey() const { return m_metaKey; }
+
+ int x() const { return m_position.x(); } // PlatformWindow coordinates.
+ int y() const { return m_position.y(); }
+ int globalX() const { return m_globalPosition.x(); } // Screen coordinates.
+ int globalY() const { return m_globalPosition.y(); }
+
+ void accept() { m_isAccepted = true; }
+ void ignore() { m_isAccepted = false; }
+
+#if PLATFORM(MAC)
+ PlatformWheelEvent(GSEventRef);
+#endif
+#if PLATFORM(WIN)
+ PlatformWheelEvent(HWND, WPARAM, LPARAM, bool isHorizontal);
+#endif
+#if PLATFORM(GTK)
+ PlatformWheelEvent(GdkEventScroll*);
+#endif
+#if PLATFORM(QT)
+ PlatformWheelEvent(QWheelEvent*);
+#endif
+#if PLATFORM(WX)
+ PlatformWheelEvent(const wxMouseEvent&, const wxPoint&);
+#endif
+
+ protected:
+#if !PLATFORM(WIN)
+ int horizontalLineMultiplier() const { return cLineMultiplier; }
+ int verticalLineMultiplier() const { return cLineMultiplier; }
+#else
+ int horizontalLineMultiplier() const;
+ int verticalLineMultiplier() const;
+#endif
+
+ IntPoint m_position;
+ IntPoint m_globalPosition;
+ float m_deltaX;
+ float m_deltaY;
+ PlatformWheelEventGranularity m_granularity;
+ bool m_isAccepted;
+ bool m_shiftKey;
+ bool m_ctrlKey;
+ bool m_altKey;
+ bool m_metaKey;
+ };
+
+} // namespace WebCore
+
+#endif // PlatformWheelEvent_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * 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 PluginDocument_h
+#define PluginDocument_h
+
+#include "HTMLDocument.h"
+
+namespace WebCore {
+
+class PluginDocument : public HTMLDocument {
+public:
+ static PassRefPtr<PluginDocument> create(Frame* frame)
+ {
+ return new PluginDocument(frame);
+ }
+
+private:
+ PluginDocument(Frame*);
+
+ virtual bool isPluginDocument() const { return true; }
+ virtual Tokenizer* createTokenizer();
+};
+
+}
+
+#endif // PluginDocument_h
--- /dev/null
+/*
+ Copyright (C) 2007 Rob Buis <buis@kde.org>
+
+ This file is part of the KDE project
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ aint with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef PointerEventsHitRules_h
+#define PointerEventsHitRules_h
+
+#include "RenderStyle.h"
+
+namespace WebCore {
+
+class PointerEventsHitRules {
+public:
+ enum EHitTesting {
+ SVG_IMAGE_HITTESTING,
+ SVG_PATH_HITTESTING,
+ SVG_TEXT_HITTESTING
+ };
+
+ PointerEventsHitRules(EHitTesting, EPointerEvents);
+
+ bool requireVisible;
+ bool requireFill;
+ bool requireStroke;
+ bool canHitStroke;
+ bool canHitFill;
+};
+
+}
+
+#endif
+
+// vim:ts=4:noet
--- /dev/null
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PopupMenu_h
+#define PopupMenu_h
+
+#include "IntRect.h"
+#include "PopupMenuClient.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+#if PLATFORM(MAC)
+#include <wtf/RetainPtr.h>
+#ifdef __OBJC__
+@class NSPopUpButtonCell;
+#else
+class NSPopUpButtonCell;
+#endif
+#elif PLATFORM(WIN)
+#include "Scrollbar.h"
+#include "ScrollbarClient.h"
+#include <wtf/RefPtr.h>
+typedef struct HWND__* HWND;
+typedef struct HDC__* HDC;
+typedef struct HBITMAP__* HBITMAP;
+#elif PLATFORM(QT)
+namespace WebCore {
+ class QWebPopup;
+}
+#elif PLATFORM(GTK)
+typedef struct _GtkMenu GtkMenu;
+typedef struct _GtkMenuItem GtkMenuItem;
+typedef struct _GtkWidget GtkWidget;
+#include <wtf/HashMap.h>
+#include <glib.h>
+#elif PLATFORM(WX)
+#ifdef __WXMSW__
+#include <wx/msw/winundef.h>
+#endif
+class wxMenu;
+#include <wx/defs.h>
+#include <wx/event.h>
+#elif PLATFORM(CHROMIUM)
+#include "PopupMenuPrivate.h"
+#endif
+
+namespace WebCore {
+
+class FrameView;
+class Scrollbar;
+
+class PopupMenu : public RefCounted<PopupMenu>
+#if PLATFORM(WIN)
+ , private ScrollbarClient
+#endif
+#if PLATFORM(WX)
+ , public wxEvtHandler
+#endif
+{
+public:
+ static PassRefPtr<PopupMenu> create(PopupMenuClient* client) { return adoptRef(new PopupMenu(client)); }
+ ~PopupMenu();
+
+ void disconnectClient() { m_popupClient = 0; }
+
+ void show(const IntRect&, FrameView*, int index);
+ void hide();
+
+ void updateFromElement();
+
+ PopupMenuClient* client() const { return m_popupClient; }
+
+ static bool itemWritingDirectionIsNatural();
+
+#if PLATFORM(WIN)
+ Scrollbar* scrollbar() const { return m_scrollbar.get(); }
+
+ bool up(unsigned lines = 1);
+ bool down(unsigned lines = 1);
+
+ int itemHeight() const { return m_itemHeight; }
+ const IntRect& windowRect() const { return m_windowRect; }
+ IntRect clientRect() const;
+
+ int visibleItems() const;
+
+ int listIndexAtPoint(const IntPoint&) const;
+
+ bool setFocusedIndex(int index, bool hotTracking = false);
+ int focusedIndex() const;
+ void focusFirst();
+ void focusLast();
+
+ void paint(const IntRect& damageRect, HDC = 0);
+
+ HWND popupHandle() const { return m_popup; }
+
+ void setWasClicked(bool b = true) { m_wasClicked = b; }
+ bool wasClicked() const { return m_wasClicked; }
+
+ void setScrollOffset(int offset) { m_scrollOffset = offset; }
+ int scrollOffset() const { return m_scrollOffset; }
+
+ bool scrollToRevealSelection();
+
+ void incrementWheelDelta(int delta);
+ void reduceWheelDelta(int delta);
+ int wheelDelta() const { return m_wheelDelta; }
+
+ bool scrollbarCapturingMouse() const { return m_scrollbarCapturingMouse; }
+ void setScrollbarCapturingMouse(bool b) { m_scrollbarCapturingMouse = b; }
+#endif
+
+protected:
+ PopupMenu(PopupMenuClient*);
+
+private:
+ PopupMenuClient* m_popupClient;
+
+#if PLATFORM(MAC)
+ void clear();
+ void populate();
+
+#elif PLATFORM(QT)
+ void clear();
+ void populate(const IntRect&);
+ QWebPopup* m_popup;
+#elif PLATFORM(WIN)
+ // ScrollBarClient
+ virtual void valueChanged(Scrollbar*);
+ virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&);
+ virtual bool isActive() const { return true; }
+ virtual bool scrollbarCornerPresent() const { return false; }
+
+ void calculatePositionAndSize(const IntRect&, FrameView*);
+ void invalidateItem(int index);
+
+ RefPtr<Scrollbar> m_scrollbar;
+ HWND m_popup;
+ HDC m_DC;
+ HBITMAP m_bmp;
+ bool m_wasClicked;
+ IntRect m_windowRect;
+ int m_itemHeight;
+ int m_scrollOffset;
+ int m_wheelDelta;
+ int m_focusedIndex;
+ bool m_scrollbarCapturingMouse;
+#elif PLATFORM(GTK)
+ IntPoint m_menuPosition;
+ GtkMenu* m_popup;
+ HashMap<GtkWidget*, int> m_indexMap;
+ static void menuItemActivated(GtkMenuItem* item, PopupMenu*);
+ static void menuUnmapped(GtkWidget*, PopupMenu*);
+ static void menuPositionFunction(GtkMenu*, gint*, gint*, gboolean*, PopupMenu*);
+ static void menuRemoveItem(GtkWidget*, PopupMenu*);
+#elif PLATFORM(WX)
+ wxMenu* m_menu;
+ void OnMenuItemSelected(wxCommandEvent&);
+#elif PLATFORM(CHROMIUM)
+ PopupMenuPrivate p;
+#endif
+
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PopupMenuClient_h
+#define PopupMenuClient_h
+
+#include "PopupMenuStyle.h"
+#include "ScrollTypes.h"
+
+namespace WebCore {
+
+class Color;
+class FontSelector;
+class HostWindow;
+class Scrollbar;
+class ScrollbarClient;
+class String;
+
+class PopupMenuClient {
+public:
+ virtual ~PopupMenuClient() {}
+ virtual void valueChanged(unsigned listIndex, bool fireEvents = true) = 0;
+
+ virtual String itemText(unsigned listIndex) const = 0;
+ virtual bool itemIsEnabled(unsigned listIndex) const = 0;
+ virtual PopupMenuStyle itemStyle(unsigned listIndex) const = 0;
+ virtual PopupMenuStyle menuStyle() const = 0;
+ virtual int clientInsetLeft() const = 0;
+ virtual int clientInsetRight() const = 0;
+ virtual int clientPaddingLeft() const = 0;
+ virtual int clientPaddingRight() const = 0;
+ virtual int listSize() const = 0;
+ virtual int selectedIndex() const = 0;
+ virtual void hidePopup() = 0;
+ virtual bool itemIsSeparator(unsigned listIndex) const = 0;
+ virtual bool itemIsLabel(unsigned listIndex) const = 0;
+ virtual bool itemIsSelected(unsigned listIndex) const = 0;
+ virtual bool shouldPopOver() const = 0;
+ virtual bool valueShouldChangeOnHotTrack() const = 0;
+ virtual void setTextFromItem(unsigned listIndex) = 0;
+
+ virtual FontSelector* fontSelector() const = 0;
+ virtual HostWindow* hostWindow() const = 0;
+
+ virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize) = 0;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PopupMenuStyle_h
+#define PopupMenuStyle_h
+
+#include "Color.h"
+#include "Font.h"
+
+namespace WebCore {
+
+class PopupMenuStyle {
+public:
+ PopupMenuStyle(const Color& foreground, const Color& background, const Font& font, bool visible)
+ : m_foregroundColor(foreground)
+ , m_backgroundColor(background)
+ , m_font(font)
+ , m_visible(visible)
+ {
+ }
+
+ const Color& foregroundColor() const { return m_foregroundColor; }
+ const Color& backgroundColor() const { return m_backgroundColor; }
+ const Font& font() const { return m_font; }
+ bool isVisible() const { return m_visible; }
+
+private:
+ Color m_foregroundColor;
+ Color m_backgroundColor;
+ Font m_font;
+ bool m_visible;
+};
+
+} // namespace WebCore
+
+#endif // PopupMenuStyle_h
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Position_h
+#define Position_h
+
+#include "TextAffinity.h"
+#include "TextDirection.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class CSSComputedStyleDeclaration;
+class Element;
+class InlineBox;
+class Node;
+class Range;
+class RenderObject;
+
+enum EUsingComposedCharacters { NotUsingComposedCharacters = false, UsingComposedCharacters = true };
+
+// FIXME: Reduce the number of operations we have on a Position.
+// This should be more like a humble struct, without so many different
+// member functions. We should find better homes for these functions.
+
+class Position {
+public:
+ RefPtr<Node> container;
+ int posOffset; // to be renamed to offset when we get rid of offset()
+
+ Position() : posOffset(0) { }
+ Position(PassRefPtr<Node> c, int o) : container(c), posOffset(o) { }
+
+ void clear() { container.clear(); posOffset = 0; }
+
+ Node* node() const { return container.get(); }
+ int offset() const { return posOffset; }
+ Element* documentElement() const;
+
+ bool isNull() const { return !container; }
+ bool isNotNull() const { return container; }
+
+ Element* element() const;
+ PassRefPtr<CSSComputedStyleDeclaration> computedStyle() const;
+
+ // Move up or down the DOM by one position.
+ // Offsets are computed using render text for nodes that have renderers - but note that even when
+ // using composed characters, the result may be inside a single user-visible character if a ligature is formed.
+ Position previous(EUsingComposedCharacters usingComposedCharacters=NotUsingComposedCharacters) const;
+ Position next(EUsingComposedCharacters usingComposedCharacters=NotUsingComposedCharacters) const;
+ static int uncheckedPreviousOffset(const Node*, int current);
+ static int uncheckedNextOffset(const Node*, int current);
+
+ bool atStart() const;
+ bool atEnd() const;
+
+ // FIXME: Make these non-member functions and put them somewhere in the editing directory.
+ // These aren't really basic "position" operations. More high level editing helper functions.
+ Position leadingWhitespacePosition(EAffinity, bool considerNonCollapsibleWhitespace = false) const;
+ Position trailingWhitespacePosition(EAffinity, bool considerNonCollapsibleWhitespace = false) const;
+
+ // These return useful visually equivalent positions.
+ Position upstream() const;
+ Position downstream() const;
+
+ bool isCandidate() const;
+ bool inRenderedText() const;
+ bool isRenderedCharacter() const;
+ bool rendersInDifferentPosition(const Position&) const;
+
+ void getInlineBoxAndOffset(EAffinity, InlineBox*&, int& caretOffset) const;
+ void getInlineBoxAndOffset(EAffinity, TextDirection primaryDirection, InlineBox*&, int& caretOffset) const;
+
+ static bool hasRenderedNonAnonymousDescendantsWithHeight(RenderObject*);
+ static bool nodeIsUserSelectNone(Node*);
+
+ void debugPosition(const char* msg = "") const;
+
+#ifndef NDEBUG
+ void formatForDebugger(char* buffer, unsigned length) const;
+ void showTreeForThis() const;
+#endif
+
+private:
+ int renderedOffset() const;
+
+ Position previousCharacterPosition(EAffinity) const;
+ Position nextCharacterPosition(EAffinity) const;
+};
+
+inline bool operator==(const Position& a, const Position& b)
+{
+ return a.container == b.container && a.posOffset == b.posOffset;
+}
+
+inline bool operator!=(const Position& a, const Position& b)
+{
+ return !(a == b);
+}
+
+Position startPosition(const Range*);
+Position endPosition(const Range*);
+
+} // namespace WebCore
+
+#ifndef NDEBUG
+// Outside the WebCore namespace for ease of invocation from gdb.
+void showTree(const WebCore::Position&);
+void showTree(const WebCore::Position*);
+#endif
+
+#endif // Position_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PositionCallback_h
+#define PositionCallback_h
+
+#include <wtf/Platform.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+ class Geoposition;
+
+ class PositionCallback : public RefCounted<PositionCallback> {
+ public:
+ virtual ~PositionCallback() { }
+ virtual void handleEvent(Geoposition* position, bool& raisedException) = 0;
+ };
+
+} // namespace WebCore
+
+#endif // PositionCallback_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PositionError_h
+#define PositionError_h
+
+#include "PlatformString.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class PositionError : public RefCounted<PositionError> {
+public:
+ enum ErrorCode {
+ UNKNOWN_ERROR = 0,
+ PERMISSION_DENIED = 1,
+ POSITION_UNAVAILABLE = 2,
+ TIMEOUT = 3
+ };
+
+ static PassRefPtr<PositionError> create(ErrorCode code, const String& message) { return adoptRef(new PositionError(code, message)); }
+
+ ErrorCode code() const { return m_code; }
+ const String& message() const { return m_message; }
+
+private:
+ PositionError(ErrorCode code, const String& message)
+ : m_code(code)
+ , m_message(message)
+ {
+ }
+
+ ErrorCode m_code;
+ String m_message;
+};
+
+} // namespace WebCore
+
+#endif // PositionError_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PositionErrorCallback_h
+#define PositionErrorCallback_h
+
+#include <wtf/Platform.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+ class PositionError;
+
+ class PositionErrorCallback : public RefCounted<PositionErrorCallback> {
+ public:
+ virtual ~PositionErrorCallback() { }
+ virtual void handleEvent(PositionError*) = 0;
+ };
+
+} // namespace WebCore
+
+#endif // PositionErrorCallback_h
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PositionIterator_h
+#define PositionIterator_h
+
+#include "Node.h"
+#include "Position.h"
+
+namespace WebCore {
+
+// A Position iterator with constant-time
+// increment, decrement, and several predicates on the Position it is at.
+// Conversion to/from Position is O(n) in the offset.
+class PositionIterator {
+public:
+ PositionIterator()
+ : m_parent(0)
+ , m_child(0)
+ , m_offset(0)
+ {
+ }
+
+ PositionIterator(const Position& pos)
+ : m_parent(pos.node())
+ , m_child(m_parent->childNode(pos.offset()))
+ , m_offset(m_child ? 0 : pos.offset())
+ {
+ }
+ operator Position() const;
+
+ void increment();
+ void decrement();
+
+ Node* node() const { return m_parent; }
+ int offsetInLeafNode() const { return m_offset; }
+
+ bool atStart() const;
+ bool atEnd() const;
+ bool atStartOfNode() const;
+ bool atEndOfNode() const;
+ bool isCandidate() const;
+
+private:
+ Node* m_parent;
+ Node* m_child;
+ int m_offset;
+};
+
+} // namespace WebCore
+
+#endif // PositionIterator_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PositionOptions_h
+#define PositionOptions_h
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class PositionOptions : public RefCounted<PositionOptions> {
+public:
+ static PassRefPtr<PositionOptions> create(bool highAccuracy, unsigned timeout, unsigned maximumAge) { return adoptRef(new PositionOptions(highAccuracy, timeout, maximumAge)); }
+
+ bool enableHighAccuracy() const { return m_highAccuracy; }
+ void setEnableHighAccuracy(bool enable) { m_highAccuracy = enable; }
+ unsigned timeout() const { return m_timeout; }
+ void setTimeout(unsigned t) { m_timeout = t; }
+ unsigned maximumAge() const { return m_maximumAge; }
+ void setMaximumAge(unsigned a) { m_maximumAge = a; }
+
+private:
+ PositionOptions(bool highAccuracy, unsigned timeout, unsigned maximumAge)
+ : m_highAccuracy(highAccuracy)
+ , m_timeout(timeout)
+ , m_maximumAge(maximumAge)
+ {
+ }
+
+ bool m_highAccuracy;
+ unsigned m_timeout;
+ unsigned m_maximumAge;
+};
+
+} // namespace WebCore
+
+#endif // PositionOptions_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PreloadScanner_h
+#define PreloadScanner_h
+
+#include "AtomicString.h"
+#include "SegmentedString.h"
+#include <wtf/Noncopyable.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+ class CachedResource;
+ class CachedResourceClient;
+ class Document;
+
+ class PreloadScanner : Noncopyable {
+ public:
+ PreloadScanner(Document*);
+ ~PreloadScanner();
+ void begin();
+ void write(const SegmentedString&);
+ void end();
+ bool inProgress() const { return m_inProgress; }
+
+ bool scanningBody() const;
+
+ static unsigned consumeEntity(SegmentedString&, bool& notEnoughCharacters);
+
+ private:
+ void tokenize(const SegmentedString&);
+ void reset();
+
+ void emitTag();
+ void emitCharacter(UChar);
+
+ void tokenizeCSS(UChar);
+ void emitCSSRule();
+
+ void processAttribute();
+
+
+ void clearLastCharacters();
+ void rememberCharacter(UChar);
+ bool lastCharactersMatch(const char*, unsigned count) const;
+
+ bool m_inProgress;
+ SegmentedString m_source;
+
+ enum State {
+ Data,
+ EntityData,
+ TagOpen,
+ CloseTagOpen,
+ TagName,
+ BeforeAttributeName,
+ AttributeName,
+ AfterAttributeName,
+ BeforeAttributeValue,
+ AttributeValueDoubleQuoted,
+ AttributeValueSingleQuoted,
+ AttributeValueUnquoted,
+ EntityInAttributeValue,
+ BogusComment,
+ MarkupDeclarationOpen,
+ CommentStart,
+ CommentStartDash,
+ Comment,
+ CommentEndDash,
+ CommentEnd
+ };
+ State m_state;
+ bool m_escape;
+ enum ContentModel {
+ PCDATA,
+ RCDATA,
+ CDATA,
+ PLAINTEXT
+ };
+ ContentModel m_contentModel;
+ unsigned m_commentPos;
+ State m_stateBeforeEntityInAttributeValue;
+
+ static const unsigned lastCharactersBufferSize = 8;
+ UChar m_lastCharacters[lastCharactersBufferSize];
+ unsigned m_lastCharacterIndex;
+
+ bool m_closeTag;
+ Vector<UChar, 32> m_tagName;
+ Vector<UChar, 32> m_attributeName;
+ Vector<UChar> m_attributeValue;
+ AtomicString m_lastStartTag;
+
+ String m_urlToLoad;
+ String m_charset;
+ bool m_linkIsStyleSheet;
+
+ enum CSSState {
+ CSSInitial,
+ CSSMaybeComment,
+ CSSComment,
+ CSSMaybeCommentEnd,
+ CSSRuleStart,
+ CSSRule,
+ CSSAfterRule,
+ CSSRuleValue,
+ CSSAfterRuleValue
+ };
+ CSSState m_cssState;
+ Vector<UChar, 16> m_cssRule;
+ Vector<UChar> m_cssRuleValue;
+
+ double m_timeUsed;
+
+ bool m_bodySeen;
+ Document* m_document;
+ };
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007 Alp Toker <alp@atoker.com>
+ * Copyright (C) 2007 Apple Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef PrintContext_h
+#define PrintContext_h
+
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class Frame;
+class FloatRect;
+class GraphicsContext;
+class IntRect;
+
+class PrintContext {
+public:
+ PrintContext(Frame*);
+ ~PrintContext();
+
+ int pageCount() const;
+
+ void computePageRects(const FloatRect& printRect, float headerHeight, float footerHeight, float userScaleFactor, float& outPageHeight);
+
+ // TODO: eliminate width param
+ void begin(float width);
+
+ // TODO: eliminate width param
+ void spoolPage(GraphicsContext& ctx, int pageNumber, float width);
+
+ void end();
+
+protected:
+ Frame* m_frame;
+ Vector<IntRect> m_pageRects;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 2000 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ProcessingInstruction_h
+#define ProcessingInstruction_h
+
+#include "CachedResourceClient.h"
+#include "CachedResourceHandle.h"
+#include "ContainerNode.h"
+
+namespace WebCore {
+
+class StyleSheet;
+class CSSStyleSheet;
+
+class ProcessingInstruction : public ContainerNode, private CachedResourceClient
+{
+public:
+ ProcessingInstruction(Document*);
+ ProcessingInstruction(Document*, const String& target, const String& data);
+ virtual ~ProcessingInstruction();
+
+ // DOM methods & attributes for Notation
+ String target() const { return m_target; }
+ String data() const { return m_data; }
+ void setData(const String&, ExceptionCode&);
+
+ virtual String nodeName() const;
+ virtual NodeType nodeType() const;
+ virtual String nodeValue() const;
+ virtual void setNodeValue(const String&, ExceptionCode&);
+ virtual PassRefPtr<Node> cloneNode(bool deep);
+ virtual bool childTypeAllowed(NodeType);
+ virtual bool offsetInCharacters() const;
+ virtual int maxCharacterOffset() const;
+
+ virtual void insertedIntoDocument();
+ virtual void removedFromDocument();
+ void setCreatedByParser(bool createdByParser) { m_createdByParser = createdByParser; }
+ virtual void finishParsingChildren();
+
+ // Other methods (not part of DOM)
+ String localHref() const { return m_localHref; }
+ StyleSheet* sheet() const { return m_sheet.get(); }
+ void checkStyleSheet();
+ virtual void setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet*);
+#if ENABLE(XSLT)
+ virtual void setXSLStyleSheet(const String& url, const String& sheet);
+#endif
+ void setCSSStyleSheet(PassRefPtr<CSSStyleSheet>);
+ bool isLoading() const;
+ virtual bool sheetLoaded();
+
+#if ENABLE(XSLT)
+ bool isXSL() const { return m_isXSL; }
+#endif
+
+ virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
+
+private:
+ void parseStyleSheet(const String& sheet);
+
+ String m_target;
+ String m_data;
+ String m_localHref;
+ String m_title;
+ String m_media;
+ CachedResourceHandle<CachedResource> m_cachedSheet;
+ RefPtr<StyleSheet> m_sheet;
+ bool m_loading;
+ bool m_alternate;
+ bool m_createdByParser;
+#if ENABLE(XSLT)
+ bool m_isXSL;
+#endif
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ProgressEvent_h
+#define ProgressEvent_h
+
+#include "Event.h"
+
+namespace WebCore {
+
+ class ProgressEvent : public Event {
+ public:
+ static PassRefPtr<ProgressEvent> create()
+ {
+ return adoptRef(new ProgressEvent);
+ }
+ static PassRefPtr<ProgressEvent> create(const AtomicString& type, bool lengthComputable, unsigned loaded, unsigned total)
+ {
+ return adoptRef(new ProgressEvent(type, lengthComputable, loaded, total));
+ }
+
+ void initProgressEvent(const AtomicString& typeArg,
+ bool canBubbleArg,
+ bool cancelableArg,
+ bool lengthComputableArg,
+ unsigned loadedArg,
+ unsigned totalArg);
+
+ bool lengthComputable() const { return m_lengthComputable; }
+ unsigned loaded() const { return m_loaded; }
+ unsigned total() const { return m_total; }
+
+ virtual bool isProgressEvent() const { return true; }
+
+ protected:
+ ProgressEvent();
+ ProgressEvent(const AtomicString& type, bool lengthComputable, unsigned loaded, unsigned total);
+
+ private:
+ bool m_lengthComputable;
+ unsigned m_loaded;
+ unsigned m_total;
+ };
+}
+
+#endif // ProgressEvent_h
+
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ProgressTracker_h
+#define ProgressTracker_h
+
+#include <wtf/HashMap.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class Frame;
+class ResourceResponse;
+struct ProgressItem;
+
+class ProgressTracker : Noncopyable {
+public:
+ ProgressTracker();
+ ~ProgressTracker();
+
+ unsigned long createUniqueIdentifier();
+
+ double estimatedProgress() const;
+
+ void progressStarted(Frame*);
+ void progressCompleted(Frame*);
+
+ void incrementProgress(unsigned long identifier, const ResourceResponse&);
+ void incrementProgress(unsigned long identifier, const char*, int);
+ void completeProgress(unsigned long identifier);
+
+ long long totalPageAndResourceBytesToLoad() const { return m_totalPageAndResourceBytesToLoad; }
+ long long totalBytesReceived() const { return m_totalBytesReceived; }
+
+private:
+ void reset();
+ void finalProgressComplete();
+
+ unsigned long m_uniqueIdentifier;
+
+ long long m_totalPageAndResourceBytesToLoad;
+ long long m_totalBytesReceived;
+ double m_lastNotifiedProgressValue;
+ double m_lastNotifiedProgressTime;
+ double m_progressNotificationInterval;
+ double m_progressNotificationTimeInterval;
+ bool m_finalProgressChangedSent;
+ double m_progressValue;
+ RefPtr<Frame> m_originatingProgressFrame;
+
+ int m_numProgressTrackedFrames;
+ HashMap<unsigned long, ProgressItem*> m_progressItems;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef ProtectionSpace_h
+#define ProtectionSpace_h
+
+#include "PlatformString.h"
+
+namespace WebCore {
+
+enum ProtectionSpaceServerType {
+ ProtectionSpaceServerHTTP = 1,
+ ProtectionSpaceServerHTTPS = 2,
+ ProtectionSpaceServerFTP = 3,
+ ProtectionSpaceServerFTPS = 4,
+ ProtectionSpaceProxyHTTP = 5,
+ ProtectionSpaceProxyHTTPS = 6,
+ ProtectionSpaceProxyFTP = 7,
+ ProtectionSpaceProxySOCKS = 8
+};
+
+enum ProtectionSpaceAuthenticationScheme {
+ ProtectionSpaceAuthenticationSchemeDefault = 1,
+ ProtectionSpaceAuthenticationSchemeHTTPBasic = 2,
+ ProtectionSpaceAuthenticationSchemeHTTPDigest = 3,
+ ProtectionSpaceAuthenticationSchemeHTMLForm = 4,
+ ProtectionSpaceAuthenticationSchemeNTLM = 5,
+ ProtectionSpaceAuthenticationSchemeNegotiate = 6,
+ ProtectionSpaceAuthenticationSchemeClientCertificateRequested = 7,
+ ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested = 8,
+};
+
+class ProtectionSpace {
+
+public:
+ ProtectionSpace();
+ ProtectionSpace(const String& host, int port, ProtectionSpaceServerType, const String& realm, ProtectionSpaceAuthenticationScheme);
+
+ const String& host() const;
+ int port() const;
+ ProtectionSpaceServerType serverType() const;
+ bool isProxy() const;
+ const String& realm() const;
+ ProtectionSpaceAuthenticationScheme authenticationScheme() const;
+
+ bool receivesCredentialSecurely() const;
+
+private:
+ String m_host;
+ int m_port;
+ ProtectionSpaceServerType m_serverType;
+ String m_realm;
+ ProtectionSpaceAuthenticationScheme m_authenticationScheme;
+};
+
+bool operator==(const ProtectionSpace& a, const ProtectionSpace& b);
+inline bool operator!=(const ProtectionSpace& a, const ProtectionSpace& b) { return !(a == b); }
+
+}
+#endif
--- /dev/null
+// Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+// Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// This file is used by bindings/scripts/CodeGeneratorObjC.pm to determine public API.
+// All public DOM class interfaces, properties and methods need to be in this file.
+// Anything not in the file will be generated into the appropriate private header file.
+
+#include <JavaScriptCore/Platform.h>
+
+#ifndef OBJC_CODE_GENERATION
+#error Do not include this header, instead include the appropriate DOM header.
+#endif
+
+@interface DOMAttr : DOMNode WEBKIT_VERSION_1_3
+@property(readonly, copy) NSString *name;
+@property(readonly) BOOL specified;
+@property(copy) NSString *value;
+@property(readonly, retain) DOMElement *ownerElement;
+@property(readonly, retain) DOMCSSStyleDeclaration *style AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+@end
+
+@interface DOMCDATASection : DOMText WEBKIT_VERSION_1_3
+@end
+
+@interface DOMCharacterData : DOMNode WEBKIT_VERSION_1_3
+@property(copy) NSString *data;
+@property(readonly) unsigned length;
+- (NSString *)substringData:(unsigned)offset :(unsigned)length;
+- (NSString *)substringData:(unsigned)offset length:(unsigned)length AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (void)appendData:(NSString *)data;
+- (void)insertData:(unsigned)offset :(NSString *)data;
+- (void)deleteData:(unsigned)offset :(unsigned)length;
+- (void)replaceData:(unsigned)offset :(unsigned)length :(NSString *)data;
+- (void)insertData:(unsigned)offset data:(NSString *)data AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (void)deleteData:(unsigned)offset length:(unsigned)length AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (void)replaceData:(unsigned)offset length:(unsigned)length data:(NSString *)data AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+@end
+
+@interface DOMComment : DOMCharacterData WEBKIT_VERSION_1_3
+@end
+
+@interface DOMImplementation : DOMObject WEBKIT_VERSION_1_3
+- (BOOL)hasFeature:(NSString *)feature :(NSString *)version;
+- (DOMDocumentType *)createDocumentType:(NSString *)qualifiedName :(NSString *)publicId :(NSString *)systemId;
+- (DOMDocument *)createDocument:(NSString *)namespaceURI :(NSString *)qualifiedName :(DOMDocumentType *)doctype;
+- (DOMCSSStyleSheet *)createCSSStyleSheet:(NSString *)title :(NSString *)media;
+- (BOOL)hasFeature:(NSString *)feature version:(NSString *)version AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (DOMDocumentType *)createDocumentType:(NSString *)qualifiedName publicId:(NSString *)publicId systemId:(NSString *)systemId AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (DOMDocument *)createDocument:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName doctype:(DOMDocumentType *)doctype AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (DOMCSSStyleSheet *)createCSSStyleSheet:(NSString *)title media:(NSString *)media AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (DOMHTMLDocument *)createHTMLDocument:(NSString *)title AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+@end
+
+@interface DOMAbstractView : DOMObject WEBKIT_VERSION_1_3
+@property(readonly, retain) DOMDocument *document;
+@end
+
+@interface DOMDocument : DOMNode WEBKIT_VERSION_1_3
+@property(readonly, retain) DOMDocumentType *doctype;
+@property(readonly, retain) DOMImplementation *implementation;
+@property(readonly, retain) DOMElement *documentElement;
+@property(readonly, retain) DOMAbstractView *defaultView;
+@property(readonly, retain) DOMStyleSheetList *styleSheets;
+@property(readonly, retain) DOMHTMLCollection *images;
+@property(readonly, retain) DOMHTMLCollection *applets;
+@property(readonly, retain) DOMHTMLCollection *links;
+@property(readonly, retain) DOMHTMLCollection *forms;
+@property(readonly, retain) DOMHTMLCollection *anchors;
+@property(copy) NSString *title;
+@property(readonly, copy) NSString *referrer;
+@property(readonly, copy) NSString *domain;
+@property(readonly, copy) NSString *URL;
+@property(retain) DOMHTMLElement *body;
+@property(copy) NSString *cookie;
+- (DOMElement *)createElement:(NSString *)tagName;
+- (DOMDocumentFragment *)createDocumentFragment;
+- (DOMText *)createTextNode:(NSString *)data;
+- (DOMComment *)createComment:(NSString *)data;
+- (DOMCDATASection *)createCDATASection:(NSString *)data;
+- (DOMProcessingInstruction *)createProcessingInstruction:(NSString *)target :(NSString *)data;
+- (DOMProcessingInstruction *)createProcessingInstruction:(NSString *)target data:(NSString *)data AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (DOMAttr *)createAttribute:(NSString *)name;
+- (DOMEntityReference *)createEntityReference:(NSString *)name;
+- (DOMNodeList *)getElementsByTagName:(NSString *)tagname;
+- (DOMNode *)importNode:(DOMNode *)importedNode :(BOOL)deep;
+- (DOMElement *)createElementNS:(NSString *)namespaceURI :(NSString *)qualifiedName;
+- (DOMAttr *)createAttributeNS:(NSString *)namespaceURI :(NSString *)qualifiedName;
+- (DOMNodeList *)getElementsByTagNameNS:(NSString *)namespaceURI :(NSString *)localName;
+- (DOMNode *)importNode:(DOMNode *)importedNode deep:(BOOL)deep AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (DOMNode *)adoptNode:(DOMNode *)source AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (DOMElement *)createElementNS:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (DOMAttr *)createAttributeNS:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (DOMNodeList *)getElementsByTagNameNS:(NSString *)namespaceURI localName:(NSString *)localName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (DOMElement *)getElementById:(NSString *)elementId;
+- (DOMEvent *)createEvent:(NSString *)eventType;
+- (DOMRange *)createRange;
+- (DOMCSSStyleDeclaration *)createCSSStyleDeclaration AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (DOMCSSStyleDeclaration *)getOverrideStyle:(DOMElement *)element :(NSString *)pseudoElement;
+- (DOMCSSStyleDeclaration *)getOverrideStyle:(DOMElement *)element pseudoElement:(NSString *)pseudoElement AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (DOMCSSStyleDeclaration *)getComputedStyle:(DOMElement *)element :(NSString *)pseudoElement;
+- (DOMCSSStyleDeclaration *)getComputedStyle:(DOMElement *)element pseudoElement:(NSString *)pseudoElement AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (DOMCSSRuleList *)getMatchedCSSRules:(DOMElement *)element pseudoElement:(NSString *)pseudoElement AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (DOMCSSRuleList *)getMatchedCSSRules:(DOMElement *)element pseudoElement:(NSString *)pseudoElement authorOnly:(BOOL)authorOnly AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (DOMNodeList *)getElementsByName:(NSString *)elementName;
+- (DOMNodeIterator *)createNodeIterator:(DOMNode *)root whatToShow:(unsigned)whatToShow filter:(id <DOMNodeFilter>)filter expandEntityReferences:(BOOL)expandEntityReferences AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (DOMTreeWalker *)createTreeWalker:(DOMNode *)root whatToShow:(unsigned)whatToShow filter:(id <DOMNodeFilter>)filter expandEntityReferences:(BOOL)expandEntityReferences AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (DOMNodeIterator *)createNodeIterator:(DOMNode *)root :(unsigned)whatToShow :(id <DOMNodeFilter>)filter :(BOOL)expandEntityReferences;
+- (DOMTreeWalker *)createTreeWalker:(DOMNode *)root :(unsigned)whatToShow :(id <DOMNodeFilter>)filter :(BOOL)expandEntityReferences;
+#if ENABLE_XPATH
+- (DOMXPathExpression *)createExpression:(NSString *)expression :(id <DOMXPathNSResolver>)resolver AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED;
+- (DOMXPathExpression *)createExpression:(NSString *)expression resolver:(id <DOMXPathNSResolver>)resolver AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (id <DOMXPathNSResolver>)createNSResolver:(DOMNode *)nodeResolver AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (DOMXPathResult *)evaluate:(NSString *)expression :(DOMNode *)contextNode :(id <DOMXPathNSResolver>)resolver :(unsigned short)type :(DOMXPathResult *)inResult AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED;
+- (DOMXPathResult *)evaluate:(NSString *)expression contextNode:(DOMNode *)contextNode resolver:(id <DOMXPathNSResolver>)resolver type:(unsigned short)type inResult:(DOMXPathResult *)inResult AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+#endif
+@end
+
+@interface DOMDocumentFragment : DOMNode WEBKIT_VERSION_1_3
+@end
+
+@interface DOMDocumentType : DOMNode WEBKIT_VERSION_1_3
+@property(readonly, copy) NSString *name;
+@property(readonly, retain) DOMNamedNodeMap *entities;
+@property(readonly, retain) DOMNamedNodeMap *notations;
+@property(readonly, copy) NSString *publicId;
+@property(readonly, copy) NSString *systemId;
+@property(readonly, copy) NSString *internalSubset;
+@end
+
+@interface DOMElement : DOMNode WEBKIT_VERSION_1_3
+@property(readonly, copy) NSString *tagName;
+@property(readonly, retain) DOMCSSStyleDeclaration *style;
+@property(readonly) int offsetLeft;
+@property(readonly) int offsetTop;
+@property(readonly) int offsetWidth;
+@property(readonly) int offsetHeight;
+@property(readonly, retain) DOMElement *offsetParent;
+@property(readonly) int clientWidth;
+@property(readonly) int clientHeight;
+@property int scrollLeft;
+@property int scrollTop;
+@property(readonly) int scrollWidth;
+@property(readonly) int scrollHeight;
+- (NSString *)getAttribute:(NSString *)name;
+- (void)setAttribute:(NSString *)name :(NSString *)value;
+- (void)setAttribute:(NSString *)name value:(NSString *)value AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (void)removeAttribute:(NSString *)name;
+- (DOMAttr *)getAttributeNode:(NSString *)name;
+- (DOMAttr *)setAttributeNode:(DOMAttr *)newAttr;
+- (DOMAttr *)removeAttributeNode:(DOMAttr *)oldAttr;
+- (DOMNodeList *)getElementsByTagName:(NSString *)name;
+- (NSString *)getAttributeNS:(NSString *)namespaceURI :(NSString *)localName;
+- (void)setAttributeNS:(NSString *)namespaceURI :(NSString *)qualifiedName :(NSString *)value;
+- (void)removeAttributeNS:(NSString *)namespaceURI :(NSString *)localName;
+- (DOMNodeList *)getElementsByTagNameNS:(NSString *)namespaceURI :(NSString *)localName;
+- (DOMAttr *)getAttributeNodeNS:(NSString *)namespaceURI :(NSString *)localName;
+- (NSString *)getAttributeNS:(NSString *)namespaceURI localName:(NSString *)localName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (void)setAttributeNS:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName value:(NSString *)value AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (void)removeAttributeNS:(NSString *)namespaceURI localName:(NSString *)localName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (DOMNodeList *)getElementsByTagNameNS:(NSString *)namespaceURI localName:(NSString *)localName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (DOMAttr *)getAttributeNodeNS:(NSString *)namespaceURI localName:(NSString *)localName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (DOMAttr *)setAttributeNodeNS:(DOMAttr *)newAttr;
+- (BOOL)hasAttribute:(NSString *)name;
+- (BOOL)hasAttributeNS:(NSString *)namespaceURI :(NSString *)localName;
+- (BOOL)hasAttributeNS:(NSString *)namespaceURI localName:(NSString *)localName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (void)scrollIntoView:(BOOL)alignWithTop AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (void)scrollIntoViewIfNeeded:(BOOL)centerIfNeeded AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+@end
+
+@interface DOMEntity : DOMNode WEBKIT_VERSION_1_3
+@property(readonly, copy) NSString *publicId;
+@property(readonly, copy) NSString *systemId;
+@property(readonly, copy) NSString *notationName;
+@end
+
+@interface DOMEntityReference : DOMNode WEBKIT_VERSION_1_3
+@end
+
+@interface DOMNamedNodeMap : DOMObject WEBKIT_VERSION_1_3
+@property(readonly) unsigned length;
+- (DOMNode *)getNamedItem:(NSString *)name;
+- (DOMNode *)setNamedItem:(DOMNode *)node;
+- (DOMNode *)removeNamedItem:(NSString *)name;
+- (DOMNode *)item:(unsigned)index;
+- (DOMNode *)getNamedItemNS:(NSString *)namespaceURI :(NSString *)localName;
+- (DOMNode *)getNamedItemNS:(NSString *)namespaceURI localName:(NSString *)localName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (DOMNode *)setNamedItemNS:(DOMNode *)node;
+- (DOMNode *)removeNamedItemNS:(NSString *)namespaceURI :(NSString *)localName;
+- (DOMNode *)removeNamedItemNS:(NSString *)namespaceURI localName:(NSString *)localName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+@end
+
+@interface DOMNode : DOMObject WEBKIT_VERSION_1_3
+@property(readonly, copy) NSString *nodeName;
+@property(copy) NSString *nodeValue;
+@property(readonly) unsigned short nodeType;
+@property(readonly, retain) DOMNode *parentNode;
+@property(readonly, retain) DOMNodeList *childNodes;
+@property(readonly, retain) DOMNode *firstChild;
+@property(readonly, retain) DOMNode *lastChild;
+@property(readonly, retain) DOMNode *previousSibling;
+@property(readonly, retain) DOMNode *nextSibling;
+@property(readonly, retain) DOMNamedNodeMap *attributes;
+@property(readonly, retain) DOMDocument *ownerDocument;
+@property(readonly, copy) NSString *namespaceURI;
+@property(copy) NSString *prefix;
+@property(readonly, copy) NSString *localName;
+@property(copy) NSString *textContent AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (DOMNode *)insertBefore:(DOMNode *)newChild :(DOMNode *)refChild;
+- (DOMNode *)insertBefore:(DOMNode *)newChild refChild:(DOMNode *)refChild AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (DOMNode *)replaceChild:(DOMNode *)newChild :(DOMNode *)oldChild;
+- (DOMNode *)replaceChild:(DOMNode *)newChild oldChild:(DOMNode *)oldChild AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (DOMNode *)removeChild:(DOMNode *)oldChild;
+- (DOMNode *)appendChild:(DOMNode *)newChild;
+- (BOOL)hasChildNodes;
+- (DOMNode *)cloneNode:(BOOL)deep;
+- (void)normalize;
+- (BOOL)isSupported:(NSString *)feature :(NSString *)version;
+- (BOOL)isSupported:(NSString *)feature version:(NSString *)version AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (BOOL)hasAttributes;
+- (BOOL)isSameNode:(DOMNode *)other AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (BOOL)isEqualNode:(DOMNode *)other AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+@end
+
+@interface DOMNodeList : DOMObject WEBKIT_VERSION_1_3
+@property(readonly) unsigned length;
+- (DOMNode *)item:(unsigned)index;
+@end
+
+@interface DOMNotation : DOMNode WEBKIT_VERSION_1_3
+@property(readonly, copy) NSString *publicId;
+@property(readonly, copy) NSString *systemId;
+@end
+
+@interface DOMProcessingInstruction : DOMNode WEBKIT_VERSION_1_3
+@property(readonly, copy) NSString *target;
+@property(copy) NSString *data;
+@end
+
+@interface DOMText : DOMCharacterData WEBKIT_VERSION_1_3
+- (DOMText *)splitText:(unsigned)offset;
+@end
+
+@interface DOMHTMLAnchorElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *accessKey;
+@property(copy) NSString *charset;
+@property(copy) NSString *coords;
+@property(copy) NSString *href;
+@property(copy) NSString *hreflang;
+@property(copy) NSString *name;
+@property(copy) NSString *rel;
+@property(copy) NSString *rev;
+@property(copy) NSString *shape;
+@property(copy) NSString *target;
+@property(copy) NSString *type;
+@property(readonly, copy) NSURL *absoluteLinkURL AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+@end
+
+@interface DOMHTMLAppletElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *align;
+@property(copy) NSString *alt;
+@property(copy) NSString *archive;
+@property(copy) NSString *code;
+@property(copy) NSString *codeBase;
+@property(copy) NSString *height;
+@property int hspace;
+@property(copy) NSString *name;
+@property(copy) NSString *object;
+@property int vspace;
+@property(copy) NSString *width;
+@end
+
+@interface DOMHTMLAreaElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *accessKey;
+@property(copy) NSString *alt;
+@property(copy) NSString *coords;
+@property(copy) NSString *href;
+@property BOOL noHref;
+@property(copy) NSString *shape;
+@property(copy) NSString *target;
+@property(readonly, copy) NSURL *absoluteLinkURL AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+@end
+
+@interface DOMHTMLBRElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *clear;
+@end
+
+@interface DOMHTMLBaseElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *href;
+@property(copy) NSString *target;
+@end
+
+@interface DOMHTMLBaseFontElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *color;
+@property(copy) NSString *face;
+@property(copy) NSString *size;
+@end
+
+@interface DOMHTMLBodyElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *aLink;
+@property(copy) NSString *background;
+@property(copy) NSString *bgColor;
+@property(copy) NSString *link;
+@property(copy) NSString *text;
+@property(copy) NSString *vLink;
+@end
+
+@interface DOMHTMLButtonElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(readonly, retain) DOMHTMLFormElement *form;
+@property(copy) NSString *accessKey;
+@property BOOL disabled;
+@property(copy) NSString *name;
+@property(readonly, copy) NSString *type;
+@property(copy) NSString *value;
+@end
+
+@interface DOMHTMLCanvasElement : DOMHTMLElement WEBKIT_VERSION_3_0
+@property int height;
+@property int width;
+@end
+
+@interface DOMHTMLCollection : DOMObject WEBKIT_VERSION_1_3
+@property(readonly) unsigned length;
+- (DOMNode *)item:(unsigned)index;
+- (DOMNode *)namedItem:(NSString *)name;
+@end
+
+@interface DOMHTMLDListElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property BOOL compact;
+@end
+
+@interface DOMHTMLDirectoryElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property BOOL compact;
+@end
+
+@interface DOMHTMLDivElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *align;
+@end
+
+@interface DOMHTMLDocument : DOMDocument WEBKIT_VERSION_1_3
+- (void)open;
+- (void)close;
+- (void)write:(NSString *)text;
+- (void)writeln:(NSString *)text;
+@end
+
+@interface DOMHTMLElement : DOMElement WEBKIT_VERSION_1_3
+@property(copy) NSString *title;
+@property(copy) NSString *idName;
+@property(copy) NSString *lang;
+@property(copy) NSString *dir;
+@property(copy) NSString *className;
+@property(copy) NSString *innerHTML;
+@property(copy) NSString *innerText;
+@property(copy) NSString *outerHTML;
+@property(copy) NSString *outerText;
+@property(readonly, retain) DOMHTMLCollection *children;
+@property(copy) NSString *contentEditable;
+@property(readonly) BOOL isContentEditable;
+@property(readonly, copy) NSString *titleDisplayString AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+@property int tabIndex;
+- (void)blur;
+- (void)focus;
+@end
+
+@interface DOMHTMLEmbedElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *align;
+@property int height;
+@property(copy) NSString *name;
+@property(copy) NSString *src;
+@property(copy) NSString *type;
+@property int width;
+@end
+
+@interface DOMHTMLFieldSetElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(readonly, retain) DOMHTMLFormElement *form;
+@end
+
+@interface DOMHTMLFontElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *color;
+@property(copy) NSString *face;
+@property(copy) NSString *size;
+@end
+
+@interface DOMHTMLFormElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(readonly, retain) DOMHTMLCollection *elements;
+@property(readonly) int length;
+@property(copy) NSString *name;
+@property(copy) NSString *acceptCharset;
+@property(copy) NSString *action;
+@property(copy) NSString *enctype;
+@property(copy) NSString *method;
+@property(copy) NSString *target;
+- (void)submit;
+- (void)reset;
+@end
+
+@interface DOMHTMLFrameElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *frameBorder;
+@property(copy) NSString *longDesc;
+@property(copy) NSString *marginHeight;
+@property(copy) NSString *marginWidth;
+@property(copy) NSString *name;
+@property BOOL noResize;
+@property(copy) NSString *scrolling;
+@property(copy) NSString *src;
+@property(readonly, retain) DOMDocument *contentDocument;
+@end
+
+@interface DOMHTMLFrameSetElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *cols;
+@property(copy) NSString *rows;
+@end
+
+@interface DOMHTMLHRElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *align;
+@property BOOL noShade;
+@property(copy) NSString *size;
+@property(copy) NSString *width;
+@end
+
+@interface DOMHTMLHeadElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *profile;
+@end
+
+@interface DOMHTMLHeadingElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *align;
+@end
+
+@interface DOMHTMLHtmlElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *version;
+@end
+
+@interface DOMHTMLIFrameElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *align;
+@property(copy) NSString *frameBorder;
+@property(copy) NSString *height;
+@property(copy) NSString *longDesc;
+@property(copy) NSString *marginHeight;
+@property(copy) NSString *marginWidth;
+@property(copy) NSString *name;
+@property(copy) NSString *scrolling;
+@property(copy) NSString *src;
+@property(copy) NSString *width;
+@property(readonly, retain) DOMDocument *contentDocument;
+@end
+
+@interface DOMHTMLImageElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *name;
+@property(copy) NSString *align;
+@property(copy) NSString *alt;
+@property(copy) NSString *border;
+@property int height;
+@property int hspace;
+@property BOOL isMap;
+@property(copy) NSString *longDesc;
+@property(copy) NSString *src;
+@property(copy) NSString *useMap;
+@property int vspace;
+@property int width;
+@property(readonly, copy) NSString *altDisplayString AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+@property(readonly, copy) NSURL *absoluteImageURL AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+@end
+
+@interface DOMHTMLInputElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *defaultValue;
+@property BOOL defaultChecked;
+@property(readonly, retain) DOMHTMLFormElement *form;
+@property(copy) NSString *accept;
+@property(copy) NSString *accessKey;
+@property(copy) NSString *align;
+@property(copy) NSString *alt;
+@property BOOL checked;
+@property BOOL disabled;
+@property int maxLength;
+@property(copy) NSString *name;
+@property BOOL readOnly;
+@property(copy) NSString *size;
+@property(copy) NSString *src;
+@property(copy) NSString *type;
+@property(copy) NSString *useMap;
+@property(copy) NSString *value;
+@property(readonly, copy) NSString *altDisplayString AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+@property(readonly, copy) NSURL *absoluteImageURL AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (void)select;
+- (void)click;
+@end
+
+@interface DOMHTMLIsIndexElement : DOMHTMLInputElement WEBKIT_VERSION_1_3
+@property(readonly, retain) DOMHTMLFormElement *form;
+@property(copy) NSString *prompt;
+@end
+
+@interface DOMHTMLLIElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *type;
+@property int value;
+@end
+
+@interface DOMHTMLLabelElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(readonly, retain) DOMHTMLFormElement *form;
+@property(copy) NSString *accessKey;
+@property(copy) NSString *htmlFor;
+@end
+
+@interface DOMHTMLLegendElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(readonly, retain) DOMHTMLFormElement *form;
+@property(copy) NSString *accessKey;
+@property(copy) NSString *align;
+@end
+
+@interface DOMHTMLLinkElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property BOOL disabled;
+@property(copy) NSString *charset;
+@property(copy) NSString *href;
+@property(copy) NSString *hreflang;
+@property(copy) NSString *media;
+@property(copy) NSString *rel;
+@property(copy) NSString *rev;
+@property(copy) NSString *target;
+@property(copy) NSString *type;
+@property(readonly, copy) NSURL *absoluteLinkURL AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+@end
+
+@interface DOMHTMLMapElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(readonly, retain) DOMHTMLCollection *areas;
+@property(copy) NSString *name;
+@end
+
+@interface DOMHTMLMarqueeElement : DOMHTMLElement WEBKIT_VERSION_3_0
+- (void)start;
+- (void)stop;
+@end
+
+@interface DOMHTMLMenuElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property BOOL compact;
+@end
+
+@interface DOMHTMLMetaElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *content;
+@property(copy) NSString *httpEquiv;
+@property(copy) NSString *name;
+@property(copy) NSString *scheme;
+@end
+
+@interface DOMHTMLModElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *cite;
+@property(copy) NSString *dateTime;
+@end
+
+@interface DOMHTMLOListElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property BOOL compact;
+@property int start;
+@property(copy) NSString *type;
+@end
+
+@interface DOMHTMLObjectElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(readonly, retain) DOMHTMLFormElement *form;
+@property(copy) NSString *code;
+@property(copy) NSString *align;
+@property(copy) NSString *archive;
+@property(copy) NSString *border;
+@property(copy) NSString *codeBase;
+@property(copy) NSString *codeType;
+@property(copy) NSString *data;
+@property BOOL declare;
+@property(copy) NSString *height;
+@property int hspace;
+@property(copy) NSString *name;
+@property(copy) NSString *standby;
+@property(copy) NSString *type;
+@property(copy) NSString *useMap;
+@property int vspace;
+@property(copy) NSString *width;
+@property(readonly, retain) DOMDocument *contentDocument;
+@property(readonly, copy) NSURL *absoluteImageURL AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+@end
+
+@interface DOMHTMLOptGroupElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property BOOL disabled;
+@property(copy) NSString *label;
+@end
+
+@interface DOMHTMLOptionElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(readonly, retain) DOMHTMLFormElement *form;
+@property BOOL defaultSelected;
+@property(readonly, copy) NSString *text;
+@property(readonly) int index;
+@property BOOL disabled;
+@property(copy) NSString *label;
+@property BOOL selected;
+@property(copy) NSString *value;
+@end
+
+@interface DOMHTMLOptionsCollection : DOMObject WEBKIT_VERSION_1_3
+@property unsigned length;
+- (DOMNode *)item:(unsigned)index;
+- (DOMNode *)namedItem:(NSString *)name;
+@end
+
+@interface DOMHTMLParagraphElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *align;
+@end
+
+@interface DOMHTMLParamElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *name;
+@property(copy) NSString *type;
+@property(copy) NSString *value;
+@property(copy) NSString *valueType;
+@end
+
+@interface DOMHTMLPreElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property int width;
+@end
+
+@interface DOMHTMLQuoteElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *cite;
+@end
+
+@interface DOMHTMLScriptElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *text;
+@property(copy) NSString *htmlFor;
+@property(copy) NSString *event;
+@property(copy) NSString *charset;
+@property BOOL defer;
+@property(copy) NSString *src;
+@property(copy) NSString *type;
+@end
+
+@interface DOMHTMLSelectElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(readonly, copy) NSString *type;
+@property int selectedIndex;
+@property(copy) NSString *value;
+@property(readonly) int length;
+@property(readonly, retain) DOMHTMLFormElement *form;
+@property(readonly, retain) DOMHTMLOptionsCollection *options;
+@property BOOL disabled;
+@property BOOL multiple;
+@property(copy) NSString *name;
+@property int size;
+- (void)add:(DOMHTMLElement *)element :(DOMHTMLElement *)before;
+- (void)add:(DOMHTMLElement *)element before:(DOMHTMLElement *)before AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (void)remove:(int)index;
+@end
+
+@interface DOMHTMLStyleElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property BOOL disabled;
+@property(copy) NSString *media;
+@property(copy) NSString *type;
+@end
+
+@interface DOMHTMLTableCaptionElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *align;
+@end
+
+@interface DOMHTMLTableCellElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(readonly) int cellIndex;
+@property(copy) NSString *abbr;
+@property(copy) NSString *align;
+@property(copy) NSString *axis;
+@property(copy) NSString *bgColor;
+@property(copy) NSString *ch;
+@property(copy) NSString *chOff;
+@property int colSpan;
+@property(copy) NSString *headers;
+@property(copy) NSString *height;
+@property BOOL noWrap;
+@property int rowSpan;
+@property(copy) NSString *scope;
+@property(copy) NSString *vAlign;
+@property(copy) NSString *width;
+@end
+
+@interface DOMHTMLTableColElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *align;
+@property(copy) NSString *ch;
+@property(copy) NSString *chOff;
+@property int span;
+@property(copy) NSString *vAlign;
+@property(copy) NSString *width;
+@end
+
+@interface DOMHTMLTableElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(retain) DOMHTMLTableCaptionElement *caption;
+@property(retain) DOMHTMLTableSectionElement *tHead;
+@property(retain) DOMHTMLTableSectionElement *tFoot;
+@property(readonly, retain) DOMHTMLCollection *rows;
+@property(readonly, retain) DOMHTMLCollection *tBodies;
+@property(copy) NSString *align;
+@property(copy) NSString *bgColor;
+@property(copy) NSString *border;
+@property(copy) NSString *cellPadding;
+@property(copy) NSString *cellSpacing;
+@property(copy) NSString *frameBorders;
+@property(copy) NSString *rules;
+@property(copy) NSString *summary;
+@property(copy) NSString *width;
+- (DOMHTMLElement *)createTHead;
+- (void)deleteTHead;
+- (DOMHTMLElement *)createTFoot;
+- (void)deleteTFoot;
+- (DOMHTMLElement *)createCaption;
+- (void)deleteCaption;
+- (DOMHTMLElement *)insertRow:(int)index;
+- (void)deleteRow:(int)index;
+@end
+
+@interface DOMHTMLTableRowElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(readonly) int rowIndex;
+@property(readonly) int sectionRowIndex;
+@property(readonly, retain) DOMHTMLCollection *cells;
+@property(copy) NSString *align;
+@property(copy) NSString *bgColor;
+@property(copy) NSString *ch;
+@property(copy) NSString *chOff;
+@property(copy) NSString *vAlign;
+- (DOMHTMLElement *)insertCell:(int)index;
+- (void)deleteCell:(int)index;
+@end
+
+@interface DOMHTMLTableSectionElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *align;
+@property(copy) NSString *ch;
+@property(copy) NSString *chOff;
+@property(copy) NSString *vAlign;
+@property(readonly, retain) DOMHTMLCollection *rows;
+- (DOMHTMLElement *)insertRow:(int)index;
+- (void)deleteRow:(int)index;
+@end
+
+@interface DOMHTMLTextAreaElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *defaultValue;
+@property(readonly, retain) DOMHTMLFormElement *form;
+@property(copy) NSString *accessKey;
+@property int cols;
+@property BOOL disabled;
+@property(copy) NSString *name;
+@property BOOL readOnly;
+@property int rows;
+@property(readonly, copy) NSString *type;
+@property(copy) NSString *value;
+- (void)select;
+@end
+
+@interface DOMHTMLTitleElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property(copy) NSString *text;
+@end
+
+@interface DOMHTMLUListElement : DOMHTMLElement WEBKIT_VERSION_1_3
+@property BOOL compact;
+@property(copy) NSString *type;
+@end
+
+@interface DOMStyleSheetList : DOMObject WEBKIT_VERSION_1_3
+@property(readonly) unsigned length;
+- (DOMStyleSheet *)item:(unsigned)index;
+@end
+
+@interface DOMCSSCharsetRule : DOMCSSRule WEBKIT_VERSION_1_3
+@property(readonly, copy) NSString *encoding;
+@end
+
+@interface DOMCSSFontFaceRule : DOMCSSRule WEBKIT_VERSION_1_3
+@property(readonly, retain) DOMCSSStyleDeclaration *style;
+@end
+
+@interface DOMCSSImportRule : DOMCSSRule WEBKIT_VERSION_1_3
+@property(readonly, copy) NSString *href;
+@property(readonly, retain) DOMMediaList *media;
+@property(readonly, retain) DOMCSSStyleSheet *styleSheet;
+@end
+
+@interface DOMCSSMediaRule : DOMCSSRule WEBKIT_VERSION_1_3
+@property(readonly, retain) DOMMediaList *media;
+@property(readonly, retain) DOMCSSRuleList *cssRules;
+- (unsigned)insertRule:(NSString *)rule :(unsigned)index;
+- (unsigned)insertRule:(NSString *)rule index:(unsigned)index AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (void)deleteRule:(unsigned)index;
+@end
+
+@interface DOMCSSPageRule : DOMCSSRule WEBKIT_VERSION_1_3
+@property(copy) NSString *selectorText;
+@property(readonly, retain) DOMCSSStyleDeclaration *style;
+@end
+
+@interface DOMCSSPrimitiveValue : DOMCSSValue WEBKIT_VERSION_1_3
+@property(readonly) unsigned short primitiveType;
+- (void)setFloatValue:(unsigned short)unitType :(float)floatValue;
+- (void)setFloatValue:(unsigned short)unitType floatValue:(float)floatValue AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (float)getFloatValue:(unsigned short)unitType;
+- (void)setStringValue:(unsigned short)stringType :(NSString *)stringValue;
+- (void)setStringValue:(unsigned short)stringType stringValue:(NSString *)stringValue AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (NSString *)getStringValue;
+- (DOMCounter *)getCounterValue;
+- (DOMRect *)getRectValue;
+- (DOMRGBColor *)getRGBColorValue;
+@end
+
+@interface DOMRGBColor : DOMObject WEBKIT_VERSION_1_3
+@property(readonly, retain) DOMCSSPrimitiveValue *red;
+@property(readonly, retain) DOMCSSPrimitiveValue *green;
+@property(readonly, retain) DOMCSSPrimitiveValue *blue;
+@property(readonly, retain) DOMCSSPrimitiveValue *alpha;
+@end
+
+@interface DOMCSSRule : DOMObject WEBKIT_VERSION_1_3
+@property(readonly) unsigned short type;
+@property(copy) NSString *cssText;
+@property(readonly, retain) DOMCSSStyleSheet *parentStyleSheet;
+@property(readonly, retain) DOMCSSRule *parentRule;
+@end
+
+@interface DOMCSSRuleList : DOMObject WEBKIT_VERSION_1_3
+@property(readonly) unsigned length;
+- (DOMCSSRule *)item:(unsigned)index;
+@end
+
+@interface DOMCSSStyleDeclaration : DOMObject WEBKIT_VERSION_1_3
+@property(copy) NSString *cssText;
+@property(readonly) unsigned length;
+@property(readonly, retain) DOMCSSRule *parentRule;
+- (NSString *)getPropertyValue:(NSString *)propertyName;
+- (DOMCSSValue *)getPropertyCSSValue:(NSString *)propertyName;
+- (NSString *)removeProperty:(NSString *)propertyName;
+- (NSString *)getPropertyPriority:(NSString *)propertyName;
+- (void)setProperty:(NSString *)propertyName :(NSString *)value :(NSString *)priority;
+- (void)setProperty:(NSString *)propertyName value:(NSString *)value priority:(NSString *)priority AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (NSString *)item:(unsigned)index;
+- (NSString *)getPropertyShorthand:(NSString *)propertyName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (BOOL)isPropertyImplicit:(NSString *)propertyName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+@end
+
+@interface DOMCSSStyleRule : DOMCSSRule WEBKIT_VERSION_1_3
+@property(copy) NSString *selectorText;
+@property(readonly, retain) DOMCSSStyleDeclaration *style;
+@end
+
+@interface DOMStyleSheet : DOMObject WEBKIT_VERSION_1_3
+@property(readonly, copy) NSString *type;
+@property BOOL disabled;
+@property(readonly, retain) DOMNode *ownerNode;
+@property(readonly, retain) DOMStyleSheet *parentStyleSheet;
+@property(readonly, copy) NSString *href;
+@property(readonly, copy) NSString *title;
+@property(readonly, retain) DOMMediaList *media;
+@end
+
+@interface DOMCSSStyleSheet : DOMStyleSheet WEBKIT_VERSION_1_3
+@property(readonly, retain) DOMCSSRule *ownerRule;
+@property(readonly, retain) DOMCSSRuleList *cssRules;
+- (unsigned)insertRule:(NSString *)rule :(unsigned)index;
+- (unsigned)insertRule:(NSString *)rule index:(unsigned)index AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (void)deleteRule:(unsigned)index;
+@end
+
+@interface DOMCSSValue : DOMObject WEBKIT_VERSION_1_3
+@property(copy) NSString *cssText;
+@property(readonly) unsigned short cssValueType;
+@end
+
+@interface DOMCSSValueList : DOMCSSValue WEBKIT_VERSION_1_3
+@property(readonly) unsigned length;
+- (DOMCSSValue *)item:(unsigned)index;
+@end
+
+@interface DOMCSSUnknownRule : DOMCSSRule WEBKIT_VERSION_1_3
+@end
+
+@interface DOMCounter : DOMObject WEBKIT_VERSION_1_3
+@property(readonly, copy) NSString *identifier;
+@property(readonly, copy) NSString *listStyle;
+@property(readonly, copy) NSString *separator;
+@end
+
+@interface DOMRect : DOMObject WEBKIT_VERSION_1_3
+@property(readonly, retain) DOMCSSPrimitiveValue *top;
+@property(readonly, retain) DOMCSSPrimitiveValue *right;
+@property(readonly, retain) DOMCSSPrimitiveValue *bottom;
+@property(readonly, retain) DOMCSSPrimitiveValue *left;
+@end
+
+@interface DOMEvent : DOMObject WEBKIT_VERSION_1_3
+@property(readonly, copy) NSString *type;
+@property(readonly, retain) id <DOMEventTarget> target;
+@property(readonly, retain) id <DOMEventTarget> currentTarget;
+@property(readonly) unsigned short eventPhase;
+@property(readonly) BOOL bubbles;
+@property(readonly) BOOL cancelable;
+@property(readonly) DOMTimeStamp timeStamp;
+- (void)stopPropagation;
+- (void)preventDefault;
+- (void)initEvent:(NSString *)eventTypeArg canBubbleArg:(BOOL)canBubbleArg cancelableArg:(BOOL)cancelableArg AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (void)initEvent:(NSString *)eventTypeArg :(BOOL)canBubbleArg :(BOOL)cancelableArg;
+@end
+
+@interface DOMUIEvent : DOMEvent WEBKIT_VERSION_1_3
+@property(readonly, retain) DOMAbstractView *view;
+@property(readonly) int detail;
+- (void)initUIEvent:(NSString *)type canBubble:(BOOL)canBubble cancelable:(BOOL)cancelable view:(DOMAbstractView *)view detail:(int)detail AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (void)initUIEvent:(NSString *)type :(BOOL)canBubble :(BOOL)cancelable :(DOMAbstractView *)view :(int)detail;
+@end
+
+@interface DOMMutationEvent : DOMEvent WEBKIT_VERSION_1_3
+@property(readonly, retain) DOMNode *relatedNode;
+@property(readonly, copy) NSString *prevValue;
+@property(readonly, copy) NSString *newValue;
+@property(readonly, copy) NSString *attrName;
+@property(readonly) unsigned short attrChange;
+- (void)initMutationEvent:(NSString *)type canBubble:(BOOL)canBubble cancelable:(BOOL)cancelable relatedNode:(DOMNode *)relatedNode prevValue:(NSString *)prevValue newValue:(NSString *)newValue attrName:(NSString *)attrName attrChange:(unsigned short)attrChange AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (void)initMutationEvent:(NSString *)type :(BOOL)canBubble :(BOOL)cancelable :(DOMNode *)relatedNode :(NSString *)prevValue :(NSString *)newValue :(NSString *)attrName :(unsigned short)attrChange;
+@end
+
+@interface DOMOverflowEvent : DOMEvent WEBKIT_VERSION_3_0
+@property(readonly) unsigned short orient;
+@property(readonly) BOOL horizontalOverflow;
+@property(readonly) BOOL verticalOverflow;
+- (void)initOverflowEvent:(unsigned short)orient horizontalOverflow:(BOOL)horizontalOverflow verticalOverflow:(BOOL)verticalOverflow;
+@end
+
+@interface DOMWheelEvent : DOMUIEvent WEBKIT_VERSION_3_0
+@property(readonly) int screenX;
+@property(readonly) int screenY;
+@property(readonly) int clientX;
+@property(readonly) int clientY;
+@property(readonly) BOOL ctrlKey;
+@property(readonly) BOOL shiftKey;
+@property(readonly) BOOL altKey;
+@property(readonly) BOOL metaKey;
+@property(readonly) BOOL isHorizontal;
+@property(readonly) int wheelDelta;
+@end
+
+@interface DOMKeyboardEvent : DOMUIEvent WEBKIT_VERSION_3_0
+@property(readonly, copy) NSString *keyIdentifier;
+@property(readonly) unsigned keyLocation;
+@property(readonly) BOOL ctrlKey;
+@property(readonly) BOOL shiftKey;
+@property(readonly) BOOL altKey;
+@property(readonly) BOOL metaKey;
+@property(readonly) int keyCode;
+@property(readonly) int charCode;
+- (BOOL)getModifierState:(NSString *)keyIdentifierArg;
+@end
+
+@interface DOMMouseEvent : DOMUIEvent WEBKIT_VERSION_1_3
+@property(readonly) int screenX;
+@property(readonly) int screenY;
+@property(readonly) int clientX;
+@property(readonly) int clientY;
+@property(readonly) BOOL ctrlKey;
+@property(readonly) BOOL shiftKey;
+@property(readonly) BOOL altKey;
+@property(readonly) BOOL metaKey;
+@property(readonly) unsigned short button;
+@property(readonly, retain) id <DOMEventTarget> relatedTarget;
+- (void)initMouseEvent:(NSString *)type canBubble:(BOOL)canBubble cancelable:(BOOL)cancelable view:(DOMAbstractView *)view detail:(int)detail screenX:(int)screenX screenY:(int)screenY clientX:(int)clientX clientY:(int)clientY ctrlKey:(BOOL)ctrlKey altKey:(BOOL)altKey shiftKey:(BOOL)shiftKey metaKey:(BOOL)metaKey button:(unsigned short)button relatedTarget:(id <DOMEventTarget>)relatedTarget AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (void)initMouseEvent:(NSString *)type :(BOOL)canBubble :(BOOL)cancelable :(DOMAbstractView *)view :(int)detail :(int)screenX :(int)screenY :(int)clientX :(int)clientY :(BOOL)ctrlKey :(BOOL)altKey :(BOOL)shiftKey :(BOOL)metaKey :(unsigned short)button :(id <DOMEventTarget>)relatedTarget;
+@end
+
+@interface DOMRange : DOMObject WEBKIT_VERSION_1_3
+@property(readonly, retain) DOMNode *startContainer;
+@property(readonly) int startOffset;
+@property(readonly, retain) DOMNode *endContainer;
+@property(readonly) int endOffset;
+@property(readonly) BOOL collapsed;
+@property(readonly, retain) DOMNode *commonAncestorContainer;
+@property(readonly, copy) NSString *text AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (void)setStart:(DOMNode *)refNode offset:(int)offset AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (void)setStart:(DOMNode *)refNode :(int)offset;
+- (void)setEnd:(DOMNode *)refNode offset:(int)offset AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (void)setEnd:(DOMNode *)refNode :(int)offset;
+- (void)setStartBefore:(DOMNode *)refNode;
+- (void)setStartAfter:(DOMNode *)refNode;
+- (void)setEndBefore:(DOMNode *)refNode;
+- (void)setEndAfter:(DOMNode *)refNode;
+- (void)collapse:(BOOL)toStart;
+- (void)selectNode:(DOMNode *)refNode;
+- (void)selectNodeContents:(DOMNode *)refNode;
+- (short)compareBoundaryPoints:(unsigned short)how sourceRange:(DOMRange *)sourceRange AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (short)compareBoundaryPoints:(unsigned short)how :(DOMRange *)sourceRange;
+- (void)deleteContents;
+- (DOMDocumentFragment *)extractContents;
+- (DOMDocumentFragment *)cloneContents;
+- (void)insertNode:(DOMNode *)newNode;
+- (void)surroundContents:(DOMNode *)newParent;
+- (DOMRange *)cloneRange;
+- (NSString *)toString;
+- (void)detach;
+@end
+
+@interface DOMNodeIterator : DOMObject WEBKIT_VERSION_1_3
+@property(readonly, retain) DOMNode *root;
+@property(readonly) unsigned whatToShow;
+@property(readonly, retain) id <DOMNodeFilter> filter;
+@property(readonly) BOOL expandEntityReferences;
+- (DOMNode *)nextNode;
+- (DOMNode *)previousNode;
+- (void)detach;
+@end
+
+@interface DOMMediaList : DOMObject WEBKIT_VERSION_1_3
+@property(copy) NSString *mediaText;
+@property(readonly) unsigned length;
+- (NSString *)item:(unsigned)index;
+- (void)deleteMedium:(NSString *)oldMedium;
+- (void)appendMedium:(NSString *)newMedium;
+@end
+
+@interface DOMTreeWalker : DOMObject WEBKIT_VERSION_1_3
+@property(readonly, retain) DOMNode *root;
+@property(readonly) unsigned whatToShow;
+@property(readonly, retain) id <DOMNodeFilter> filter;
+@property(readonly) BOOL expandEntityReferences;
+@property(retain) DOMNode *currentNode;
+- (DOMNode *)parentNode;
+- (DOMNode *)firstChild;
+- (DOMNode *)lastChild;
+- (DOMNode *)previousSibling;
+- (DOMNode *)nextSibling;
+- (DOMNode *)previousNode;
+- (DOMNode *)nextNode;
+@end
+
+@interface DOMXPathResult : DOMObject WEBKIT_VERSION_3_0
+@property(readonly) unsigned short resultType;
+@property(readonly) double numberValue;
+@property(readonly, copy) NSString *stringValue;
+@property(readonly) BOOL booleanValue;
+@property(readonly, retain) DOMNode *singleNodeValue;
+@property(readonly) BOOL invalidIteratorState;
+@property(readonly) unsigned snapshotLength;
+- (DOMNode *)iterateNext;
+- (DOMNode *)snapshotItem:(unsigned)index;
+@end
+
+@interface DOMXPathExpression : DOMObject WEBKIT_VERSION_3_0
+- (DOMXPathResult *)evaluate:(DOMNode *)contextNode type:(unsigned short)type inResult:(DOMXPathResult *)inResult AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (DOMXPathResult *)evaluate:(DOMNode *)contextNode :(unsigned short)type :(DOMXPathResult *)inResult AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED;
+@end
+
+// Protocols
+
+@protocol DOMEventListener <NSObject> WEBKIT_VERSION_1_3
+- (void)handleEvent:(DOMEvent *)evt;
+@end
+
+@protocol DOMEventTarget <NSObject, NSCopying> WEBKIT_VERSION_1_3
+- (void)addEventListener:(NSString *)type :(id <DOMEventListener>)listener :(BOOL)useCapture;
+- (void)removeEventListener:(NSString *)type :(id <DOMEventListener>)listener :(BOOL)useCapture;
+- (void)addEventListener:(NSString *)type listener:(id <DOMEventListener>)listener useCapture:(BOOL)useCapture AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (void)removeEventListener:(NSString *)type listener:(id <DOMEventListener>)listener useCapture:(BOOL)useCapture AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+- (BOOL)dispatchEvent:(DOMEvent *)event;
+@end
+
+@protocol DOMNodeFilter <NSObject> WEBKIT_VERSION_1_3
+- (short)acceptNode:(DOMNode *)n;
+@end
+
+@protocol DOMXPathNSResolver <NSObject> WEBKIT_VERSION_3_0
+- (NSString *)lookupNamespaceURI:(NSString *)prefix;
+@end
+
+#include "PublicDOMInterfacesIPhone.h"
--- /dev/null
+/*
+ * Copyright (C) 2008, Apple Inc. All rights reserved.
+ *
+ * No license or rights are granted by Apple expressly or by implication,
+ * estoppel, or otherwise, to Apple copyrights, patents, trademarks, trade
+ * secrets or other rights.
+ */
+
+#if defined(ENABLE_TOUCH_EVENTS)
+@interface DOMTouch : DOMObject
+@property(readonly, retain) id <DOMEventTarget> target;
+@property(readonly) unsigned identifier;
+@property(readonly) int clientX;
+@property(readonly) int clientY;
+@property(readonly) int pageX;
+@property(readonly) int pageY;
+@property(readonly) int screenX;
+@property(readonly) int screenY;
+@end
+
+@interface DOMTouchEvent : DOMUIEvent
+@property(readonly, retain) DOMTouchList *touches;
+@property(readonly, retain) DOMTouchList *targetTouches;
+@property(readonly, retain) DOMTouchList *changedTouches;
+@property(readonly) float scale;
+@property(readonly) float rotation;
+@property(readonly) BOOL ctrlKey;
+@property(readonly) BOOL shiftKey;
+@property(readonly) BOOL altKey;
+@property(readonly) BOOL metaKey;
+
+- (void)initTouchEvent:(NSString *)type canBubble:(BOOL)canBubble cancelable:(BOOL)cancelable view:(DOMAbstractView *)view detail:(int)detail screenX:(int)screenX screenY:(int)screenY clientX:(int)clientX clientY:(int)clientY ctrlKey:(BOOL)ctrlKey altKey:(BOOL)altKey shiftKey:(BOOL)shiftKey metaKey:(BOOL)metaKey touches:(DOMTouchList *)touches targetTouches:(DOMTouchList *)targetTouches changedTouches:(DOMTouchList *)changedTouches scale:(float)scale rotation:(float)rotation;
+@end
+
+@interface DOMGestureEvent : DOMUIEvent
+@property(readonly, retain) id <DOMEventTarget> target;
+@property(readonly) float scale;
+@property(readonly) float rotation;
+@property(readonly) BOOL ctrlKey;
+@property(readonly) BOOL shiftKey;
+@property(readonly) BOOL altKey;
+@property(readonly) BOOL metaKey;
+
+- (void)initGestureEvent:(NSString *)type canBubble:(BOOL)canBubble cancelable:(BOOL)cancelable view:(DOMAbstractView *)view detail:(int)detail screenX:(int)screenX screenY:(int)screenY clientX:(int)clientX clientY:(int)clientY ctrlKey:(BOOL)ctrlKey altKey:(BOOL)altKey shiftKey:(BOOL)shiftKey metaKey:(BOOL)metaKey target:(id <DOMEventTarget>)target scale:(float)scale rotation:(float)rotation;
+@end
+#endif // ENABLE(TOUCH_EVENTS)
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PurgeableBuffer_h
+#define PurgeableBuffer_h
+
+#include <wtf/Noncopyable.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+ class PurgeableBuffer : Noncopyable {
+ public:
+ static PurgeableBuffer* create(const char* data, size_t);
+ static PurgeableBuffer* create(const Vector<char>& v) { return create(v.data(), v.size()); }
+
+ ~PurgeableBuffer();
+
+ // Call makePurgeable(false) and check the return value before accessing the data.
+ const char* data() const;
+ size_t size() const { return m_size; }
+
+ enum PurgePriority { PurgeLast, PurgeMiddle, PurgeFirst, PurgeDefault = PurgeMiddle };
+ PurgePriority purgePriority() const { return m_purgePriority; }
+ void setPurgePriority(PurgePriority);
+
+ bool isPurgeable() const { return m_state != NonVolatile; }
+ bool wasPurged() const;
+
+ bool makePurgeable(bool purgeable);
+
+ private:
+ PurgeableBuffer(char* data, size_t);
+
+ char* m_data;
+ size_t m_size;
+ PurgePriority m_purgePriority;
+
+ enum State { NonVolatile, Volatile, Purged };
+ mutable State m_state;
+ };
+
+#if !PLATFORM(DARWIN) || defined(BUILDING_ON_TIGER) || PLATFORM(QT)
+ inline PurgeableBuffer* PurgeableBuffer::create(const char*, size_t) { return 0; }
+ inline PurgeableBuffer::~PurgeableBuffer() { }
+ inline const char* PurgeableBuffer::data() const { return 0; }
+ inline void PurgeableBuffer::setPurgePriority(PurgePriority) { }
+ inline bool PurgeableBuffer::wasPurged() const { return false; }
+ inline bool PurgeableBuffer::makePurgeable(bool) { return false; }
+#endif
+
+}
+
+#endif
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 2005 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef QualifiedName_h
+#define QualifiedName_h
+
+#include "AtomicString.h"
+#include <wtf/HashFunctions.h>
+
+namespace WebCore {
+
+struct QualifiedNameComponents {
+ StringImpl* m_prefix;
+ StringImpl* m_localName;
+ StringImpl* m_namespace;
+};
+
+class QualifiedName {
+public:
+ class QualifiedNameImpl : public RefCounted<QualifiedNameImpl> {
+ public:
+ static PassRefPtr<QualifiedNameImpl> create(const AtomicString& p, const AtomicString& l, const AtomicString& n)
+ {
+ return adoptRef(new QualifiedNameImpl(p, l, n));
+ }
+
+ AtomicString m_prefix;
+ AtomicString m_localName;
+ AtomicString m_namespace;
+
+ private:
+ QualifiedNameImpl(const AtomicString& p, const AtomicString& l, const AtomicString& n)
+ : m_prefix(p)
+ , m_localName(l)
+ , m_namespace(n)
+ {
+ }
+ };
+
+ QualifiedName(const AtomicString& prefix, const AtomicString& localName, const AtomicString& namespaceURI);
+ ~QualifiedName();
+#ifdef QNAME_DEFAULT_CONSTRUCTOR
+ QualifiedName() : m_impl(0) { }
+#endif
+
+ QualifiedName(const QualifiedName&);
+ const QualifiedName& operator=(const QualifiedName&);
+
+ bool operator==(const QualifiedName& other) const { return m_impl == other.m_impl; }
+ bool operator!=(const QualifiedName& other) const { return !(*this == other); }
+
+ bool matches(const QualifiedName& other) const { return m_impl == other.m_impl || (localName() == other.localName() && namespaceURI() == other.namespaceURI()); }
+
+ bool hasPrefix() const { return m_impl->m_prefix != nullAtom; }
+ void setPrefix(const AtomicString& prefix);
+
+ const AtomicString& prefix() const { return m_impl->m_prefix; }
+ const AtomicString& localName() const { return m_impl->m_localName; }
+ const AtomicString& namespaceURI() const { return m_impl->m_namespace; }
+
+ String toString() const;
+
+ QualifiedNameImpl* impl() const { return m_impl; }
+
+ // Init routine for globals
+ static void init();
+
+private:
+ void ref() { m_impl->ref(); }
+ void deref();
+
+ QualifiedNameImpl* m_impl;
+};
+
+#ifndef WEBCORE_QUALIFIEDNAME_HIDE_GLOBALS
+extern const QualifiedName anyName;
+inline const QualifiedName& anyQName() { return anyName; }
+#endif
+
+inline bool operator==(const AtomicString& a, const QualifiedName& q) { return a == q.localName(); }
+inline bool operator!=(const AtomicString& a, const QualifiedName& q) { return a != q.localName(); }
+inline bool operator==(const QualifiedName& q, const AtomicString& a) { return a == q.localName(); }
+inline bool operator!=(const QualifiedName& q, const AtomicString& a) { return a != q.localName(); }
+
+
+inline unsigned hashComponents(const QualifiedNameComponents& buf)
+{
+ ASSERT(sizeof(QualifiedNameComponents) % (sizeof(uint16_t) * 2) == 0);
+
+ unsigned l = sizeof(QualifiedNameComponents) / (sizeof(uint16_t) * 2);
+ const uint16_t* s = reinterpret_cast<const uint16_t*>(&buf);
+ uint32_t hash = WTF::stringHashingStartValue;
+
+ // Main loop
+ for (; l > 0; l--) {
+ hash += s[0];
+ uint32_t tmp = (s[1] << 11) ^ hash;
+ hash = (hash << 16) ^ tmp;
+ s += 2;
+ hash += hash >> 11;
+ }
+
+ // Force "avalanching" of final 127 bits
+ hash ^= hash << 3;
+ hash += hash >> 5;
+ hash ^= hash << 2;
+ hash += hash >> 15;
+ hash ^= hash << 10;
+
+ // this avoids ever returning a hash code of 0, since that is used to
+ // signal "hash not computed yet", using a value that is likely to be
+ // effectively the same as 0 when the low bits are masked
+ if (hash == 0)
+ hash = 0x80000000;
+
+ return hash;
+}
+
+struct QualifiedNameHash {
+ static unsigned hash(const QualifiedName& name) { return hash(name.impl()); }
+
+ static unsigned hash(const QualifiedName::QualifiedNameImpl* name)
+ {
+ QualifiedNameComponents c = { name->m_prefix.impl(), name->m_localName.impl(), name->m_namespace.impl() };
+ return hashComponents(c);
+ }
+
+ static bool equal(const QualifiedName& a, const QualifiedName& b) { return a == b; }
+ static bool equal(const QualifiedName::QualifiedNameImpl* a, const QualifiedName::QualifiedNameImpl* b) { return a == b; }
+
+ static const bool safeToCompareToEmptyOrDeleted = false;
+};
+
+}
+
+namespace WTF {
+
+ template<typename T> struct DefaultHash;
+ template<> struct DefaultHash<WebCore::QualifiedName> {
+ typedef WebCore::QualifiedNameHash Hash;
+ };
+
+ template<> struct HashTraits<WebCore::QualifiedName> : GenericHashTraits<WebCore::QualifiedName> {
+ static const bool emptyValueIsZero = false;
+ static WebCore::QualifiedName emptyValue() { return WebCore::QualifiedName(WebCore::nullAtom, WebCore::nullAtom, WebCore::nullAtom); }
+ static void constructDeletedValue(WebCore::QualifiedName& slot) { new (&slot) WebCore::QualifiedName(WebCore::nullAtom, WebCore::AtomicString(HashTableDeletedValue), WebCore::nullAtom); }
+ static bool isDeletedValue(const WebCore::QualifiedName& slot) { return slot.localName().isHashTableDeletedValue(); }
+ };
+}
+
+#endif
--- /dev/null
+/*
+ * (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Gunnstein Lye (gunnstein@netcom.no)
+ * (C) 2000 Frederik Holljen (frederik.holljen@hig.no)
+ * (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Range_h
+#define Range_h
+
+#include "RangeBoundaryPoint.h"
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+#include "SelectionRect.h"
+
+namespace WebCore {
+
+class DocumentFragment;
+class NodeWithIndex;
+class Text;
+
+class Range : public RefCounted<Range> {
+public:
+ static PassRefPtr<Range> create(PassRefPtr<Document>);
+ static PassRefPtr<Range> create(PassRefPtr<Document>, PassRefPtr<Node> startContainer, int startOffset, PassRefPtr<Node> endContainer, int endOffset);
+ static PassRefPtr<Range> create(PassRefPtr<Document>, const Position&, const Position&);
+ ~Range();
+
+ Document* ownerDocument() const { return m_ownerDocument.get(); }
+ Node* startContainer() const { return m_start.container(); }
+ int startOffset() const { return m_start.offset(); }
+ Node* endContainer() const { return m_end.container(); }
+ int endOffset() const { return m_end.offset(); }
+
+ Node* startContainer(ExceptionCode&) const;
+ int startOffset(ExceptionCode&) const;
+ Node* endContainer(ExceptionCode&) const;
+ int endOffset(ExceptionCode&) const;
+ bool collapsed(ExceptionCode&) const;
+
+ Node* commonAncestorContainer(ExceptionCode&) const;
+ static Node* commonAncestorContainer(Node* containerA, Node* containerB);
+ void setStart(PassRefPtr<Node> container, int offset, ExceptionCode&);
+ void setEnd(PassRefPtr<Node> container, int offset, ExceptionCode&);
+ void collapse(bool toStart, ExceptionCode&);
+ bool isPointInRange(Node* refNode, int offset, ExceptionCode& ec);
+ short comparePoint(Node* refNode, int offset, ExceptionCode& ec);
+ enum CompareResults { NODE_BEFORE, NODE_AFTER, NODE_BEFORE_AND_AFTER, NODE_INSIDE };
+ CompareResults compareNode(Node* refNode, ExceptionCode&);
+ enum CompareHow { START_TO_START, START_TO_END, END_TO_END, END_TO_START };
+ short compareBoundaryPoints(CompareHow, const Range* sourceRange, ExceptionCode&) const;
+ static short compareBoundaryPoints(Node* containerA, int offsetA, Node* containerB, int offsetB);
+ static short compareBoundaryPoints(const Position&, const Position&);
+ bool boundaryPointsValid() const;
+ bool intersectsNode(Node* refNode, ExceptionCode&);
+ void deleteContents(ExceptionCode&);
+ PassRefPtr<DocumentFragment> extractContents(ExceptionCode&);
+ PassRefPtr<DocumentFragment> cloneContents(ExceptionCode&);
+ void insertNode(PassRefPtr<Node>, ExceptionCode&);
+ String toString(ExceptionCode&) const;
+
+ String toHTML() const;
+ String text() const;
+
+ PassRefPtr<DocumentFragment> createContextualFragment(const String& html, ExceptionCode&) const;
+
+ void detach(ExceptionCode&);
+ PassRefPtr<Range> cloneRange(ExceptionCode&) const;
+
+ void setStartAfter(Node*, ExceptionCode&);
+ void setEndBefore(Node*, ExceptionCode&);
+ void setEndAfter(Node*, ExceptionCode&);
+ void selectNode(Node*, ExceptionCode&);
+ void selectNodeContents(Node*, ExceptionCode&);
+ void surroundContents(PassRefPtr<Node>, ExceptionCode&);
+ void setStartBefore(Node*, ExceptionCode&);
+
+ const Position& startPosition() const { return m_start.position(); }
+ const Position& endPosition() const { return m_end.position(); }
+
+ Node* firstNode() const;
+ Node* pastLastNode() const;
+
+ Position editingStartPosition() const;
+
+ Node* shadowTreeRootNode() const;
+
+ IntRect boundingBox();
+ void addLineBoxRects(Vector<IntRect>&, bool useSelectionHeight = false);
+ void collectSelectionRects(Vector<SelectionRect>&);
+
+ void nodeChildrenChanged(ContainerNode*);
+ void nodeWillBeRemoved(Node*);
+
+ void textInserted(Node*, unsigned offset, unsigned length);
+ void textRemoved(Node*, unsigned offset, unsigned length);
+ void textNodesMerged(NodeWithIndex& oldNode, unsigned offset);
+ void textNodeSplit(Text* oldNode);
+
+#ifndef NDEBUG
+ void formatForDebugger(char* buffer, unsigned length) const;
+#endif
+
+ Document* document() const { return m_ownerDocument.get(); }
+
+private:
+ Range(PassRefPtr<Document>);
+ Range(PassRefPtr<Document>, PassRefPtr<Node> startContainer, int startOffset, PassRefPtr<Node> endContainer, int endOffset);
+
+ Node* checkNodeWOffset(Node*, int offset, ExceptionCode&) const;
+ void checkNodeBA(Node*, ExceptionCode&) const;
+ void checkDeleteExtract(ExceptionCode&);
+ bool containedByReadOnly() const;
+ int maxStartOffset() const;
+ int maxEndOffset() const;
+
+ enum ActionType { DELETE_CONTENTS, EXTRACT_CONTENTS, CLONE_CONTENTS };
+ PassRefPtr<DocumentFragment> processContents(ActionType, ExceptionCode&);
+
+ RefPtr<Document> m_ownerDocument;
+ RangeBoundaryPoint m_start;
+ RangeBoundaryPoint m_end;
+};
+
+PassRefPtr<Range> rangeOfContents(Node*);
+
+bool operator==(const Range&, const Range&);
+inline bool operator!=(const Range& a, const Range& b) { return !(a == b); }
+
+} // namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RangeBoundaryPoint_h
+#define RangeBoundaryPoint_h
+
+#include "Node.h"
+#include "Position.h"
+
+namespace WebCore {
+
+class RangeBoundaryPoint {
+public:
+ RangeBoundaryPoint();
+ explicit RangeBoundaryPoint(PassRefPtr<Node> container);
+
+ const Position& position() const;
+ Node* container() const;
+ int offset() const;
+ Node* childBefore() const;
+
+ void clear();
+
+ void set(PassRefPtr<Node> container, int offset, Node* childBefore);
+ void setOffset(int offset);
+ void setToChild(Node* child);
+ void setToStart(PassRefPtr<Node> container);
+ void setToEnd(PassRefPtr<Node> container);
+
+ void childBeforeWillBeRemoved();
+ void invalidateOffset() const;
+
+private:
+ static const int invalidOffset = -1;
+
+ mutable Position m_position;
+ Node* m_childBefore;
+};
+
+inline RangeBoundaryPoint::RangeBoundaryPoint()
+ : m_childBefore(0)
+{
+}
+
+inline RangeBoundaryPoint::RangeBoundaryPoint(PassRefPtr<Node> container)
+ : m_position(container, 0)
+ , m_childBefore(0)
+{
+}
+
+inline Node* RangeBoundaryPoint::container() const
+{
+ return m_position.container.get();
+}
+
+inline Node* RangeBoundaryPoint::childBefore() const
+{
+ return m_childBefore;
+}
+
+inline const Position& RangeBoundaryPoint::position() const
+{
+ if (m_position.posOffset >= 0)
+ return m_position;
+ ASSERT(m_childBefore);
+ m_position.posOffset = m_childBefore->nodeIndex() + 1;
+ return m_position;
+}
+
+inline int RangeBoundaryPoint::offset() const
+{
+ return position().posOffset;
+}
+
+inline void RangeBoundaryPoint::clear()
+{
+ m_position.clear();
+ m_childBefore = 0;
+}
+
+inline void RangeBoundaryPoint::set(PassRefPtr<Node> container, int offset, Node* childBefore)
+{
+ ASSERT(offset >= 0);
+ ASSERT(childBefore == (offset ? container->childNode(offset - 1) : 0));
+ m_position.container = container;
+ m_position.posOffset = offset;
+ m_childBefore = childBefore;
+}
+
+inline void RangeBoundaryPoint::setOffset(int offset)
+{
+ ASSERT(m_position.container);
+ ASSERT(m_position.container->offsetInCharacters());
+ ASSERT(m_position.posOffset >= 0);
+ ASSERT(!m_childBefore);
+ m_position.posOffset = offset;
+}
+
+inline void RangeBoundaryPoint::setToChild(Node* child)
+{
+ ASSERT(child);
+ ASSERT(child->parentNode());
+ m_position.container = child->parentNode();
+ m_childBefore = child->previousSibling();
+ m_position.posOffset = m_childBefore ? invalidOffset : 0;
+}
+
+inline void RangeBoundaryPoint::setToStart(PassRefPtr<Node> container)
+{
+ ASSERT(container);
+ m_position.container = container;
+ m_position.posOffset = 0;
+ m_childBefore = 0;
+}
+
+inline void RangeBoundaryPoint::setToEnd(PassRefPtr<Node> container)
+{
+ ASSERT(container);
+ m_position.container = container;
+ if (m_position.container->offsetInCharacters()) {
+ m_position.posOffset = m_position.container->maxCharacterOffset();
+ m_childBefore = 0;
+ } else {
+ m_childBefore = m_position.container->lastChild();
+ m_position.posOffset = m_childBefore ? invalidOffset : 0;
+ }
+}
+
+inline void RangeBoundaryPoint::childBeforeWillBeRemoved()
+{
+ ASSERT(m_position.posOffset);
+ m_childBefore = m_childBefore->previousSibling();
+ if (!m_childBefore)
+ m_position.posOffset = 0;
+ else if (m_position.posOffset > 0)
+ --m_position.posOffset;
+}
+
+inline void RangeBoundaryPoint::invalidateOffset() const
+{
+ m_position.posOffset = invalidOffset;
+}
+
+inline bool operator==(const RangeBoundaryPoint& a, const RangeBoundaryPoint& b)
+{
+ if (a.container() != b.container())
+ return false;
+ if (a.childBefore() || b.childBefore()) {
+ if (a.childBefore() != b.childBefore())
+ return false;
+ } else {
+ if (a.offset() != b.offset())
+ return false;
+ }
+ return true;
+}
+
+}
+
+#endif
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Gunnstein Lye (gunnstein@netcom.no)
+ * (C) 2000 Frederik Holljen (frederik.holljen@hig.no)
+ * (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RangeException_h
+#define RangeException_h
+
+#include "ExceptionBase.h"
+
+namespace WebCore {
+
+ class RangeException : public ExceptionBase {
+ public:
+ static PassRefPtr<RangeException> create(const ExceptionCodeDescription& description)
+ {
+ return adoptRef(new RangeException(description));
+ }
+
+ static const int RangeExceptionOffset = 200;
+ static const int RangeExceptionMax = 299;
+
+ enum RangeExceptionCode {
+ BAD_BOUNDARYPOINTS_ERR = RangeExceptionOffset + 1,
+ INVALID_NODE_TYPE_ERR
+ };
+
+ private:
+ RangeException(const ExceptionCodeDescription& description)
+ : ExceptionBase(description)
+ {
+ }
+ };
+
+} // namespace WebCore
+
+#endif // RangeException_h
--- /dev/null
+/*
+ * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef Rect_h
+#define Rect_h
+
+#include "CSSPrimitiveValue.h"
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+ class RectBase {
+ public:
+ CSSPrimitiveValue* top() const { return m_top.get(); }
+ CSSPrimitiveValue* right() const { return m_right.get(); }
+ CSSPrimitiveValue* bottom() const { return m_bottom.get(); }
+ CSSPrimitiveValue* left() const { return m_left.get(); }
+
+ void setTop(PassRefPtr<CSSPrimitiveValue> top) { m_top = top; }
+ void setRight(PassRefPtr<CSSPrimitiveValue> right) { m_right = right; }
+ void setBottom(PassRefPtr<CSSPrimitiveValue> bottom) { m_bottom = bottom; }
+ void setLeft(PassRefPtr<CSSPrimitiveValue> left) { m_left = left; }
+
+ protected:
+ RectBase() { }
+ ~RectBase() { }
+
+ private:
+ RefPtr<CSSPrimitiveValue> m_top;
+ RefPtr<CSSPrimitiveValue> m_right;
+ RefPtr<CSSPrimitiveValue> m_bottom;
+ RefPtr<CSSPrimitiveValue> m_left;
+ };
+
+ class Rect : public RectBase, public RefCounted<Rect> {
+ public:
+ static PassRefPtr<Rect> create() { return adoptRef(new Rect); }
+
+ private:
+ Rect() { }
+ };
+
+} // namespace WebCore
+
+#endif // Rect_h
--- /dev/null
+/*
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
+ * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RegisteredEventListener_h
+#define RegisteredEventListener_h
+
+#include "AtomicString.h"
+
+namespace WebCore {
+
+ class EventListener;
+
+ class RegisteredEventListener : public RefCounted<RegisteredEventListener> {
+ public:
+ static PassRefPtr<RegisteredEventListener> create(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture)
+ {
+ return adoptRef(new RegisteredEventListener(eventType, listener, useCapture));
+ }
+
+ const AtomicString& eventType() const { return m_eventType; }
+ EventListener* listener() const { return m_listener.get(); }
+ bool useCapture() const { return m_useCapture; }
+
+ bool removed() const { return m_removed; }
+ void setRemoved(bool removed) { m_removed = removed; }
+
+ private:
+ RegisteredEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture);
+
+ AtomicString m_eventType;
+ RefPtr<EventListener> m_listener;
+ bool m_useCapture;
+ bool m_removed;
+ };
+
+} // namespace WebCore
+
+#endif // RegisteredEventListener_h
--- /dev/null
+/*
+ * Copyright (C) 2003, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RegularExpression_h
+#define RegularExpression_h
+
+#include "PlatformString.h"
+
+namespace WebCore {
+
+class RegularExpression {
+public:
+ RegularExpression(const String&, TextCaseSensitivity);
+ ~RegularExpression();
+
+ RegularExpression(const RegularExpression&);
+ RegularExpression& operator=(const RegularExpression&);
+
+ int match(const String&, int startFrom = 0, int* matchLength = 0) const;
+ int searchRev(const String&) const;
+
+ int matchedLength() const;
+
+private:
+ class Private;
+ RefPtr<Private> d;
+};
+
+void replace(String&, const RegularExpression&, const String&);
+
+} // namespace WebCore
+
+#endif // RegularExpression_h
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RemoveCSSPropertyCommand_h
+#define RemoveCSSPropertyCommand_h
+
+#include "EditCommand.h"
+#include "CSSPropertyNames.h"
+
+namespace WebCore {
+
+class RemoveCSSPropertyCommand : public SimpleEditCommand {
+public:
+ static PassRefPtr<RemoveCSSPropertyCommand> create(Document* document, PassRefPtr<CSSMutableStyleDeclaration> style, CSSPropertyID property)
+ {
+ return adoptRef(new RemoveCSSPropertyCommand(document, style, property));
+ }
+
+private:
+ RemoveCSSPropertyCommand(Document*, PassRefPtr<CSSMutableStyleDeclaration>, CSSPropertyID property);
+
+ virtual void doApply();
+ virtual void doUnapply();
+
+ RefPtr<CSSMutableStyleDeclaration> m_style;
+ CSSPropertyID m_property;
+ String m_oldValue;
+ bool m_important;
+};
+
+} // namespace WebCore
+
+#endif // RemoveCSSPropertyCommand_h
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RemoveFormatCommand_h
+#define RemoveFormatCommand_h
+
+#include "CompositeEditCommand.h"
+
+namespace WebCore {
+
+class RemoveFormatCommand : public CompositeEditCommand {
+public:
+ static PassRefPtr<RemoveFormatCommand> create(Document* document)
+ {
+ return adoptRef(new RemoveFormatCommand(document));
+ }
+
+private:
+ RemoveFormatCommand(Document*);
+
+ virtual void doApply();
+ virtual EditAction editingAction() const { return EditActionUnspecified; }
+};
+
+} // namespace WebCore
+
+#endif // RemoveFormatCommand_h
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RemoveNodeCommand_h
+#define RemoveNodeCommand_h
+
+#include "EditCommand.h"
+
+namespace WebCore {
+
+class RemoveNodeCommand : public SimpleEditCommand {
+public:
+ static PassRefPtr<RemoveNodeCommand> create(PassRefPtr<Node> node)
+ {
+ return adoptRef(new RemoveNodeCommand(node));
+ }
+
+private:
+ RemoveNodeCommand(PassRefPtr<Node>);
+
+ virtual void doApply();
+ virtual void doUnapply();
+
+ RefPtr<Node> m_node;
+ RefPtr<Node> m_parent;
+ RefPtr<Node> m_refChild;
+};
+
+} // namespace WebCore
+
+#endif // RemoveNodeCommand_h
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RemoveNodePreservingChildrenCommand_h
+#define RemoveNodePreservingChildrenCommand_h
+
+#include "CompositeEditCommand.h"
+
+namespace WebCore {
+
+class RemoveNodePreservingChildrenCommand : public CompositeEditCommand {
+public:
+ static PassRefPtr<RemoveNodePreservingChildrenCommand> create(PassRefPtr<Node> node)
+ {
+ return adoptRef(new RemoveNodePreservingChildrenCommand(node));
+ }
+
+private:
+ RemoveNodePreservingChildrenCommand(PassRefPtr<Node>);
+
+ virtual void doApply();
+
+ RefPtr<Node> m_node;
+};
+
+} // namespace WebCore
+
+#endif // RemoveNodePreservingChildrenCommand_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderApplet_h
+#define RenderApplet_h
+
+#include "RenderWidget.h"
+#include "StringHash.h"
+
+namespace WebCore {
+
+ class HTMLAppletElement;
+
+ class RenderApplet : public RenderWidget {
+ public:
+ RenderApplet(HTMLAppletElement*, const HashMap<String, String>& args);
+ virtual ~RenderApplet();
+
+ virtual const char* renderName() const { return "RenderApplet"; }
+
+ virtual bool isApplet() const { return true; }
+
+ virtual void layout();
+ virtual IntSize intrinsicSize() const;
+
+ void createWidgetIfNecessary();
+
+ private:
+ HashMap<String, String> m_args;
+ };
+
+} // namespace WebCore
+
+#endif // RenderApplet_h
--- /dev/null
+/*
+ * Copyright (C) 2003 Apple Computer, Inc.
+ *
+ * Portions are Copyright (C) 1998 Netscape Communications Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of either the Mozilla Public License Version 1.1, found at
+ * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
+ * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
+ * (the "GPL"), in which case the provisions of the MPL or the GPL are
+ * applicable instead of those above. If you wish to allow use of your
+ * version of this file only under the terms of one of those two
+ * licenses (the MPL or the GPL) and not to allow others to use your
+ * version of this file under the LGPL, indicate your decision by
+ * deletingthe provisions above and replace them with the notice and
+ * other provisions required by the MPL or the GPL, as the case may be.
+ * If you do not delete the provisions above, a recipient may use your
+ * version of this file under any of the LGPL, the MPL or the GPL.
+ */
+
+#ifndef RenderArena_h
+#define RenderArena_h
+
+#include "Arena.h"
+
+namespace WebCore {
+
+static const size_t gMaxRecycledSize = 400;
+
+class RenderArena {
+public:
+ RenderArena(unsigned arenaSize = 4096);
+ ~RenderArena();
+
+ // Memory management functions
+ void* allocate(size_t);
+ void free(size_t, void*);
+
+private:
+ // Underlying arena pool
+ ArenaPool m_pool;
+
+ // The recycler array is sparse with the indices being multiples of 4,
+ // i.e., 0, 4, 8, 12, 16, 20, ...
+ void* m_recyclers[gMaxRecycledSize >> 2];
+};
+
+} // namespace WebCore
+
+#endif // RenderArena_h
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderBR_h
+#define RenderBR_h
+
+#include "RenderText.h"
+
+/*
+ * The whole class here is a hack to get <br> working, as long as we don't have support for
+ * CSS2 :before and :after pseudo elements
+ */
+namespace WebCore {
+
+class Position;
+
+class RenderBR : public RenderText {
+public:
+ RenderBR(Node*);
+ virtual ~RenderBR();
+
+ virtual const char* renderName() const { return "RenderBR"; }
+
+ virtual IntRect selectionRectForRepaint(RenderBox* /*repaintContainer*/, bool /*clipToVisibleContent*/) { return IntRect(); }
+
+ virtual unsigned width(unsigned /*from*/, unsigned /*len*/, const Font&, int /*xpos*/) const { return 0; }
+ virtual unsigned width(unsigned /*from*/, unsigned /*len*/, int /*xpos*/, bool /*firstLine = false*/) const { return 0; }
+
+ virtual int lineHeight(bool firstLine, bool isRootLineBox = false) const;
+ virtual int baselinePosition(bool firstLine, bool isRootLineBox = false) const;
+
+ // overrides
+ virtual InlineBox* createInlineBox(bool, bool, bool isOnlyRun = false);
+
+ virtual bool isBR() const { return true; }
+
+ virtual int caretMinOffset() const;
+ virtual int caretMaxOffset() const;
+ virtual unsigned caretMaxRenderedOffset() const;
+
+ virtual VisiblePosition positionForCoordinates(int x, int y);
+
+protected:
+ virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+
+private:
+ mutable int m_lineHeight;
+};
+
+} // namespace WebCore
+
+#endif // RenderBR_h
--- /dev/null
+/*
+ * This file is part of the render object implementation for KHTML.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2007 David Smith (catfish.man@gmail.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef RenderBlock_h
+#define RenderBlock_h
+
+#include "DeprecatedPtrList.h"
+#include "GapRects.h"
+#include "RenderFlow.h"
+#include "RootInlineBox.h"
+#include <wtf/ListHashSet.h>
+
+namespace WebCore {
+
+class InlineIterator;
+class BidiRun;
+class Position;
+class RootInlineBox;
+
+template <class Iterator, class Run> class BidiResolver;
+typedef BidiResolver<InlineIterator, BidiRun> InlineBidiResolver;
+
+enum CaretType { CursorCaret, DragCaret };
+
+class RenderBlock : public RenderFlow {
+public:
+ RenderBlock(Node*);
+ virtual ~RenderBlock();
+
+ virtual const char* renderName() const;
+
+ // These two functions are overridden for inline-block.
+ virtual int lineHeight(bool firstLine, bool isRootLineBox = false) const;
+ virtual int baselinePosition(bool firstLine, bool isRootLineBox = false) const;
+
+ virtual bool isRenderBlock() const { return true; }
+ virtual bool isBlockFlow() const { return (!isInline() || isReplaced()) && !isTable(); }
+ virtual bool isInlineBlockOrInlineTable() const { return isInline() && isReplaced(); }
+
+ virtual bool childrenInline() const { return m_childrenInline; }
+ virtual void setChildrenInline(bool b) { m_childrenInline = b; }
+ void makeChildrenNonInline(RenderObject* insertionPoint = 0);
+ void deleteLineBoxTree();
+
+ // The height (and width) of a block when you include overflow spillage out of the bottom
+ // of the block (e.g., a <div style="height:25px"> that has a 100px tall image inside
+ // it would have an overflow height of borderTop() + paddingTop() + 100px.
+ virtual int overflowHeight(bool includeInterior = true) const;
+ virtual int overflowWidth(bool includeInterior = true) const;
+ virtual int overflowLeft(bool includeInterior = true) const;
+ virtual int overflowTop(bool includeInterior = true) const;
+ virtual IntRect overflowRect(bool includeInterior = true) const;
+ virtual void setOverflowHeight(int h) { m_overflowHeight = h; }
+ virtual void setOverflowWidth(int w) { m_overflowWidth = w; }
+
+ void addVisualOverflow(const IntRect&);
+
+ virtual bool isSelfCollapsingBlock() const;
+ virtual bool isTopMarginQuirk() const { return m_topMarginQuirk; }
+ virtual bool isBottomMarginQuirk() const { return m_bottomMarginQuirk; }
+
+ virtual int maxTopMargin(bool positive) const { return positive ? maxTopPosMargin() : maxTopNegMargin(); }
+ virtual int maxBottomMargin(bool positive) const { return positive ? maxBottomPosMargin() : maxBottomNegMargin(); }
+
+ int maxTopPosMargin() const { return m_maxMargin ? m_maxMargin->m_topPos : MaxMargin::topPosDefault(this); }
+ int maxTopNegMargin() const { return m_maxMargin ? m_maxMargin->m_topNeg : MaxMargin::topNegDefault(this); }
+ int maxBottomPosMargin() const { return m_maxMargin ? m_maxMargin->m_bottomPos : MaxMargin::bottomPosDefault(this); }
+ int maxBottomNegMargin() const { return m_maxMargin ? m_maxMargin->m_bottomNeg : MaxMargin::bottomNegDefault(this); }
+ void setMaxTopMargins(int pos, int neg);
+ void setMaxBottomMargins(int pos, int neg);
+
+ void initMaxMarginValues()
+ {
+ if (m_maxMargin) {
+ m_maxMargin->m_topPos = MaxMargin::topPosDefault(this);
+ m_maxMargin->m_topNeg = MaxMargin::topNegDefault(this);
+ m_maxMargin->m_bottomPos = MaxMargin::bottomPosDefault(this);
+ m_maxMargin->m_bottomNeg = MaxMargin::bottomNegDefault(this);
+ }
+ }
+
+ virtual void addChildToFlow(RenderObject* newChild, RenderObject* beforeChild);
+ virtual void removeChild(RenderObject*);
+
+ virtual void repaintOverhangingFloats(bool paintAllDescendants);
+
+ virtual void layout();
+ virtual void layoutBlock(bool relayoutChildren);
+ void layoutBlockChildren(bool relayoutChildren, int& maxFloatBottom);
+ void layoutInlineChildren(bool relayoutChildren, int& repaintTop, int& repaintBottom);
+
+ void layoutPositionedObjects(bool relayoutChildren);
+ void insertPositionedObject(RenderBox*);
+ void removePositionedObject(RenderBox*);
+ void removePositionedObjects(RenderBlock*);
+
+ void addPercentHeightDescendant(RenderBox*);
+ static void removePercentHeightDescendant(RenderBox*);
+
+ virtual void positionListMarker() { }
+
+ virtual void borderFitAdjust(int& x, int& w) const; // Shrink the box in which the border paints if border-fit is set.
+
+ // Called to lay out the legend for a fieldset.
+ virtual RenderObject* layoutLegend(bool /*relayoutChildren*/) { return 0; }
+
+ // the implementation of the following functions is in bidi.cpp
+ struct FloatWithRect {
+ FloatWithRect(RenderBox* f)
+ : object(f)
+ , rect(IntRect(f->x() - f->marginLeft(), f->y() - f->marginTop(), f->width() + f->marginLeft() + f->marginRight(), f->height() + f->marginTop() + f->marginBottom()))
+ {
+ }
+
+ RenderBox* object;
+ IntRect rect;
+ };
+
+ void bidiReorderLine(InlineBidiResolver&, const InlineIterator& end);
+ RootInlineBox* determineStartPosition(bool& fullLayout, InlineBidiResolver&, Vector<FloatWithRect>& floats, unsigned& numCleanFloats);
+ RootInlineBox* determineEndPosition(RootInlineBox* startBox, InlineIterator& cleanLineStart,
+ BidiStatus& cleanLineBidiStatus,
+ int& yPos);
+ bool matchedEndLine(const InlineBidiResolver&, const InlineIterator& endLineStart, const BidiStatus& endLineStatus,
+ RootInlineBox*& endLine, int& endYPos, int& repaintBottom, int& repaintTop);
+ bool generatesLineBoxesForInlineChild(RenderObject*);
+ void skipTrailingWhitespace(InlineIterator&);
+ int skipLeadingWhitespace(InlineBidiResolver&);
+ void fitBelowFloats(int widthToFit, int& availableWidth);
+ InlineIterator findNextLineBreak(InlineBidiResolver&, EClear* clear = 0);
+ RootInlineBox* constructLine(unsigned runCount, BidiRun* firstRun, BidiRun* lastRun, bool lastLine, RenderObject* endObject);
+ InlineFlowBox* createLineBoxes(RenderObject*);
+ void computeHorizontalPositionsForLine(RootInlineBox*, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd);
+ void computeVerticalPositionsForLine(RootInlineBox*, BidiRun*);
+ void checkLinesForOverflow();
+ void deleteEllipsisLineBoxes();
+ void checkLinesForTextOverflow();
+ // end bidi.cpp functions
+
+ virtual void paint(PaintInfo&, int tx, int ty);
+ virtual void paintObject(PaintInfo&, int tx, int ty);
+ void paintFloats(PaintInfo&, int tx, int ty, bool preservePhase = false);
+ void paintContents(PaintInfo&, int tx, int ty);
+ void paintColumns(PaintInfo&, int tx, int ty, bool paintFloats = false);
+ void paintChildren(PaintInfo&, int tx, int ty);
+ void paintEllipsisBoxes(PaintInfo&, int tx, int ty);
+ void paintSelection(PaintInfo&, int tx, int ty);
+ void paintCaret(PaintInfo&, int tx, int ty, CaretType);
+
+ void insertFloatingObject(RenderBox*);
+ void removeFloatingObject(RenderBox*);
+
+ // Called from lineWidth, to position the floats added in the last line.
+ // Returns ture if and only if it has positioned any floats.
+ bool positionNewFloats();
+ void clearFloats();
+ int getClearDelta(RenderBox* child);
+ void markAllDescendantsWithFloatsForLayout(RenderBox* floatToRemove = 0, bool inLayout = true);
+ void markPositionedObjectsForLayout();
+
+ virtual bool containsFloats() { return m_floatingObjects && !m_floatingObjects->isEmpty(); }
+ virtual bool containsFloat(RenderObject*);
+
+ virtual bool avoidsFloats() const;
+
+ virtual bool hasOverhangingFloats() { return !hasColumns() && floatBottom() > height(); }
+ void addIntrudingFloats(RenderBlock* prev, int xoffset, int yoffset);
+ int addOverhangingFloats(RenderBlock* child, int xoffset, int yoffset, bool makeChildPaintOtherFloats);
+
+ int nextFloatBottomBelow(int) const;
+ int floatBottom() const;
+ inline int leftBottom();
+ inline int rightBottom();
+ IntRect floatRect() const;
+
+ virtual int lineWidth(int) const;
+ virtual int lowestPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
+ virtual int rightmostPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
+ virtual int leftmostPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
+
+ int rightOffset() const;
+ int rightRelOffset(int y, int fixedOffset, bool applyTextIndent = true, int* heightRemaining = 0) const;
+ int rightOffset(int y) const { return rightRelOffset(y, rightOffset(), true); }
+
+ int leftOffset() const;
+ int leftRelOffset(int y, int fixedOffset, bool applyTextIndent = true, int* heightRemaining = 0) const;
+ int leftOffset(int y) const { return leftRelOffset(y, leftOffset(), true); }
+
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
+ virtual bool hitTestColumns(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
+ virtual bool hitTestContents(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
+
+ virtual bool isPointInOverflowControl(HitTestResult&, int x, int y, int tx, int ty);
+
+ virtual VisiblePosition positionForCoordinates(int x, int y);
+
+ // Block flows subclass availableWidth to handle multi column layout (shrinking the width available to children when laying out.)
+ virtual int availableWidth() const;
+
+ virtual void calcPrefWidths();
+ void calcInlinePrefWidths();
+ void calcBlockPrefWidths();
+
+ virtual int getBaselineOfFirstLineBox() const;
+ virtual int getBaselineOfLastLineBox() const;
+
+ RootInlineBox* firstRootBox() const { return static_cast<RootInlineBox*>(firstLineBox()); }
+ RootInlineBox* lastRootBox() const { return static_cast<RootInlineBox*>(lastLineBox()); }
+
+ bool containsNonZeroBidiLevel() const;
+
+ // Obtains the nearest enclosing block (including this block) that contributes a first-line style to our inline
+ // children.
+ virtual RenderBlock* firstLineBlock() const;
+ virtual void updateFirstLetter();
+
+ bool inRootBlockContext() const;
+
+ void setHasMarkupTruncation(bool b = true) { m_hasMarkupTruncation = b; }
+ bool hasMarkupTruncation() const { return m_hasMarkupTruncation; }
+
+ virtual bool hasSelectedChildren() const { return m_selectionState != SelectionNone; }
+ virtual SelectionState selectionState() const { return static_cast<SelectionState>(m_selectionState); }
+ virtual void setSelectionState(SelectionState s);
+
+ virtual IntRect selectionRectForRepaint(RenderBox* repaintContainer, bool /*clipToVisibleContent*/)
+ {
+ return selectionGapRectsForRepaint(repaintContainer);
+ }
+ GapRects selectionGapRectsForRepaint(RenderBox* repaintContainer);
+ virtual bool shouldPaintSelectionGaps() const;
+ bool isSelectionRoot() const;
+ GapRects fillSelectionGaps(RenderBlock* rootBlock, int blockX, int blockY, int tx, int ty,
+ int& lastTop, int& lastLeft, int& lastRight, const PaintInfo* = 0);
+ GapRects fillInlineSelectionGaps(RenderBlock* rootBlock, int blockX, int blockY, int tx, int ty,
+ int& lastTop, int& lastLeft, int& lastRight, const PaintInfo*);
+ GapRects fillBlockSelectionGaps(RenderBlock* rootBlock, int blockX, int blockY, int tx, int ty,
+ int& lastTop, int& lastLeft, int& lastRight, const PaintInfo*);
+ IntRect fillVerticalSelectionGap(int lastTop, int lastLeft, int lastRight, int bottomY, RenderBlock* rootBlock,
+ int blockX, int blockY, const PaintInfo*);
+ IntRect fillLeftSelectionGap(RenderObject* selObj, int xPos, int yPos, int height, RenderBlock* rootBlock,
+ int blockX, int blockY, int tx, int ty, const PaintInfo*);
+ IntRect fillRightSelectionGap(RenderObject* selObj, int xPos, int yPos, int height, RenderBlock* rootBlock,
+ int blockX, int blockY, int tx, int ty, const PaintInfo*);
+ IntRect fillHorizontalSelectionGap(RenderObject* selObj, int xPos, int yPos, int width, int height, const PaintInfo*);
+
+ void getHorizontalSelectionGapInfo(SelectionState, bool& leftGap, bool& rightGap);
+ int leftSelectionOffset(RenderBlock* rootBlock, int y);
+ int rightSelectionOffset(RenderBlock* rootBlock, int y);
+
+ // Helper methods for computing line counts and heights for line counts.
+ RootInlineBox* lineAtIndex(int);
+ int lineCount();
+ int heightForLineCount(int);
+ void clearTruncation();
+
+ int immediateLineCount();
+ void adjustComputedFontSizes(float size, float visibleWidth);
+ void resetComputedFontSize() {
+ m_widthForTextAutosizing = -1;
+ m_lineCountForTextAutosizing = NOT_SET;
+ }
+
+ int desiredColumnWidth() const;
+ unsigned desiredColumnCount() const;
+ Vector<IntRect>* columnRects() const;
+ void setDesiredColumnCountAndWidth(int count, int width);
+
+ void adjustRectForColumns(IntRect&) const;
+
+ void addContinuationWithOutline(RenderFlow*);
+ void paintContinuationOutlines(PaintInfo&, int tx, int ty);
+
+private:
+ void adjustPointToColumnContents(IntPoint&) const;
+ void adjustForBorderFit(int x, int& left, int& right) const; // Helper function for borderFitAdjust
+
+ void markLinesDirtyInVerticalRange(int top, int bottom);
+
+protected:
+ virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
+ virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+
+ void newLine(EClear);
+ virtual bool hasLineIfEmpty() const;
+ bool layoutOnlyPositionedObjects();
+
+private:
+ Position positionForBox(InlineBox*, bool start = true) const;
+ Position positionForRenderer(RenderObject*, bool start = true) const;
+
+ // Adjust tx and ty from painting offsets to the local coords of this renderer
+ void offsetForContents(int& tx, int& ty) const;
+
+ int columnGap() const;
+ void calcColumnWidth();
+ int layoutColumns(int endOfContent = -1);
+
+ bool expandsToEncloseOverhangingFloats() const;
+
+protected:
+ struct FloatingObject {
+ enum Type {
+ FloatLeft,
+ FloatRight
+ };
+
+ FloatingObject(Type type)
+ : m_renderer(0)
+ , m_top(0)
+ , m_bottom(0)
+ , m_left(0)
+ , m_width(0)
+ , m_type(type)
+ , m_shouldPaint(true)
+ , m_isDescendant(false)
+ {
+ }
+
+ Type type() { return static_cast<Type>(m_type); }
+
+ RenderBox* m_renderer;
+ int m_top;
+ int m_bottom;
+ int m_left;
+ int m_width;
+ unsigned m_type : 1; // Type (left or right aligned)
+ bool m_shouldPaint : 1;
+ bool m_isDescendant : 1;
+ };
+
+ class MarginInfo {
+ // Collapsing flags for whether we can collapse our margins with our children's margins.
+ bool m_canCollapseWithChildren : 1;
+ bool m_canCollapseTopWithChildren : 1;
+ bool m_canCollapseBottomWithChildren : 1;
+
+ // Whether or not we are a quirky container, i.e., do we collapse away top and bottom
+ // margins in our container. Table cells and the body are the common examples. We
+ // also have a custom style property for Safari RSS to deal with TypePad blog articles.
+ bool m_quirkContainer : 1;
+
+ // This flag tracks whether we are still looking at child margins that can all collapse together at the beginning of a block.
+ // They may or may not collapse with the top margin of the block (|m_canCollapseTopWithChildren| tells us that), but they will
+ // always be collapsing with one another. This variable can remain set to true through multiple iterations
+ // as long as we keep encountering self-collapsing blocks.
+ bool m_atTopOfBlock : 1;
+
+ // This flag is set when we know we're examining bottom margins and we know we're at the bottom of the block.
+ bool m_atBottomOfBlock : 1;
+
+ // If our last normal flow child was a self-collapsing block that cleared a float,
+ // we track it in this variable.
+ bool m_selfCollapsingBlockClearedFloat : 1;
+
+ // These variables are used to detect quirky margins that we need to collapse away (in table cells
+ // and in the body element).
+ bool m_topQuirk : 1;
+ bool m_bottomQuirk : 1;
+ bool m_determinedTopQuirk : 1;
+
+ // These flags track the previous maximal positive and negative margins.
+ int m_posMargin;
+ int m_negMargin;
+
+ public:
+ MarginInfo(RenderBlock* b, int top, int bottom);
+
+ void setAtTopOfBlock(bool b) { m_atTopOfBlock = b; }
+ void setAtBottomOfBlock(bool b) { m_atBottomOfBlock = b; }
+ void clearMargin() { m_posMargin = m_negMargin = 0; }
+ void setSelfCollapsingBlockClearedFloat(bool b) { m_selfCollapsingBlockClearedFloat = b; }
+ void setTopQuirk(bool b) { m_topQuirk = b; }
+ void setBottomQuirk(bool b) { m_bottomQuirk = b; }
+ void setDeterminedTopQuirk(bool b) { m_determinedTopQuirk = b; }
+ void setPosMargin(int p) { m_posMargin = p; }
+ void setNegMargin(int n) { m_negMargin = n; }
+ void setPosMarginIfLarger(int p) { if (p > m_posMargin) m_posMargin = p; }
+ void setNegMarginIfLarger(int n) { if (n > m_negMargin) m_negMargin = n; }
+
+ void setMargin(int p, int n) { m_posMargin = p; m_negMargin = n; }
+
+ bool atTopOfBlock() const { return m_atTopOfBlock; }
+ bool canCollapseWithTop() const { return m_atTopOfBlock && m_canCollapseTopWithChildren; }
+ bool canCollapseWithBottom() const { return m_atBottomOfBlock && m_canCollapseBottomWithChildren; }
+ bool canCollapseTopWithChildren() const { return m_canCollapseTopWithChildren; }
+ bool canCollapseBottomWithChildren() const { return m_canCollapseBottomWithChildren; }
+ bool selfCollapsingBlockClearedFloat() const { return m_selfCollapsingBlockClearedFloat; }
+ bool quirkContainer() const { return m_quirkContainer; }
+ bool determinedTopQuirk() const { return m_determinedTopQuirk; }
+ bool topQuirk() const { return m_topQuirk; }
+ bool bottomQuirk() const { return m_bottomQuirk; }
+ int posMargin() const { return m_posMargin; }
+ int negMargin() const { return m_negMargin; }
+ int margin() const { return m_posMargin - m_negMargin; }
+ };
+
+ void adjustPositionedBlock(RenderBox* child, const MarginInfo&);
+ void adjustFloatingBlock(const MarginInfo&);
+ RenderBox* handleSpecialChild(RenderBox* child, const MarginInfo&, bool& handled);
+ RenderBox* handleFloatingChild(RenderBox* child, const MarginInfo&, bool& handled);
+ RenderBox* handlePositionedChild(RenderBox* child, const MarginInfo&, bool& handled);
+ RenderBox* handleRunInChild(RenderBox* child, bool& handled);
+ void collapseMargins(RenderBox* child, MarginInfo&, int yPosEstimate);
+ void clearFloatsIfNeeded(RenderBox* child, MarginInfo&, int oldTopPosMargin, int oldTopNegMargin);
+ int estimateVerticalPosition(RenderBox* child, const MarginInfo&);
+ void determineHorizontalPosition(RenderBox* child);
+ void handleBottomOfBlock(int top, int bottom, MarginInfo&);
+ void setCollapsedBottomMargin(const MarginInfo&);
+ // End helper functions and structs used by layoutBlockChildren.
+
+private:
+ typedef ListHashSet<RenderBox*>::const_iterator Iterator;
+ DeprecatedPtrList<FloatingObject>* m_floatingObjects;
+ ListHashSet<RenderBox*>* m_positionedObjects;
+
+ // Allocated only when some of these fields have non-default values
+ struct MaxMargin {
+ MaxMargin(const RenderBlock* o)
+ : m_topPos(topPosDefault(o))
+ , m_topNeg(topNegDefault(o))
+ , m_bottomPos(bottomPosDefault(o))
+ , m_bottomNeg(bottomNegDefault(o))
+ {
+ }
+
+ static int topPosDefault(const RenderBlock* o) { return o->marginTop() > 0 ? o->marginTop() : 0; }
+ static int topNegDefault(const RenderBlock* o) { return o->marginTop() < 0 ? -o->marginTop() : 0; }
+ static int bottomPosDefault(const RenderBlock* o) { return o->marginBottom() > 0 ? o->marginBottom() : 0; }
+ static int bottomNegDefault(const RenderBlock* o) { return o->marginBottom() < 0 ? -o->marginBottom() : 0; }
+
+ int m_topPos;
+ int m_topNeg;
+ int m_bottomPos;
+ int m_bottomNeg;
+ };
+
+ MaxMargin* m_maxMargin;
+
+protected:
+ // How much content overflows out of our block vertically or horizontally.
+ int m_overflowHeight;
+ int m_overflowWidth;
+ int m_overflowLeft;
+ int m_overflowTop;
+
+ int m_widthForTextAutosizing;
+};
+
+} // namespace WebCore
+
+#endif // RenderBlock_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderBox_h
+#define RenderBox_h
+
+#include "RenderObject.h"
+#include "ScrollTypes.h"
+
+namespace WebCore {
+
+enum WidthType { Width, MinWidth, MaxWidth };
+
+class RenderBox : public RenderObject {
+public:
+ RenderBox(Node*);
+ virtual ~RenderBox();
+
+ virtual const char* renderName() const { return "RenderBox"; }
+
+ int x() const { return m_frameRect.x(); }
+ int y() const { return m_frameRect.y(); }
+
+ int width() const { return m_frameRect.width(); }
+ int height() const { return m_frameRect.height(); }
+
+ void setX(int x) { m_frameRect.setX(x); }
+ void setY(int y) { m_frameRect.setY(y); }
+ void setWidth(int width) { m_frameRect.setWidth(width); }
+ void setHeight(int height) { m_frameRect.setHeight(height); }
+
+ IntPoint location() const { return m_frameRect.location(); }
+ IntSize size() const { return m_frameRect.size(); }
+
+ void setLocation(const IntPoint& location) { m_frameRect.setLocation(location); }
+ void setLocation(int x, int y) { setLocation(IntPoint(x, y)); }
+
+ void setSize(const IntSize& size) { m_frameRect.setSize(size); }
+ void move(int dx, int dy) { m_frameRect.move(dx, dy); }
+
+ IntRect frameRect() const { return m_frameRect; }
+ void setFrameRect(const IntRect& rect) { m_frameRect = rect; }
+
+ IntRect borderBoxRect() const { return IntRect(0, 0, width(), height()); }
+ virtual IntRect borderBoundingBox() const { return borderBoxRect(); } // This will work on inlines to return the bounding box of all of the lines' border boxes.
+
+ // The content area of the box (excludes padding and border).
+ IntRect contentBoxRect() const { return IntRect(borderLeft() + paddingLeft(), borderTop() + paddingTop(), contentWidth(), contentHeight()); }
+ // The content box in absolute coords. Ignores transforms.
+ IntRect absoluteContentBox() const;
+ // The content box converted to absolute coords (taking transforms into account).
+ FloatQuad absoluteContentQuad() const;
+
+ // Bounds of the outline box in absolute coords. Respects transforms
+ virtual IntRect outlineBoundsForRepaint(RenderBox* /*repaintContainer*/) const;
+ virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
+
+ // Use this with caution! No type checking is done!
+ RenderBox* previousSiblingBox() const;
+ RenderBox* nextSiblingBox() const;
+ RenderBox* parentBox() const;
+
+ // The height of a block when you include normal flow overflow spillage out of the bottom
+ // of the block (e.g., a <div style="height:25px"> that has a 100px tall image inside
+ // it would have an overflow height of borderTop() + paddingTop() + 100px.
+ virtual int overflowHeight(bool /*includeInterior*/ = true) const { return height(); }
+ virtual int overflowWidth(bool /*includeInterior*/ = true) const { return width(); }
+ virtual void setOverflowHeight(int) { }
+ virtual void setOverflowWidth(int) { }
+ virtual int overflowLeft(bool /*includeInterior*/ = true) const { return 0; }
+ virtual int overflowTop(bool /*includeInterior*/ = true) const { return 0; }
+ virtual IntRect overflowRect(bool /*includeInterior*/ = true) const { return borderBoxRect(); }
+
+ int contentWidth() const { return clientWidth() - paddingLeft() - paddingRight(); }
+ int contentHeight() const { return clientHeight() - paddingTop() - paddingBottom(); }
+
+ // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlines (RenderFlow)
+ // to return the remaining width on a given line (and the height of a single line).
+ virtual int offsetWidth() const { return width(); }
+ virtual int offsetHeight() const { return height(); }
+ virtual int offsetLeft() const;
+ virtual int offsetTop() const;
+ virtual RenderBox* offsetParent() const;
+
+ // More IE extensions. clientWidth and clientHeight represent the interior of an object
+ // excluding border and scrollbar. clientLeft/Top are just the borderLeftWidth and borderTopWidth.
+ int clientLeft() const { return borderLeft(); }
+ int clientTop() const { return borderTop(); }
+ int clientWidth() const;
+ int clientHeight() const;
+
+ // scrollWidth/scrollHeight will be the same as clientWidth/clientHeight unless the
+ // object has overflow:hidden/scroll/auto specified and also has overflow.
+ // scrollLeft/Top return the current scroll position. These methods are virtual so that objects like
+ // textareas can scroll shadow content (but pretend that they are the objects that are
+ // scrolling).
+ virtual int scrollLeft() const;
+ virtual int scrollTop() const;
+ virtual int scrollWidth() const;
+ virtual int scrollHeight() const;
+ virtual void setScrollLeft(int);
+ virtual void setScrollTop(int);
+
+ bool hasHorizontalBordersPaddingOrMargin() const { return hasHorizontalBordersOrPadding() || marginLeft() != 0 || marginRight() != 0; }
+ bool hasHorizontalBordersOrPadding() const { return borderLeft() != 0 || borderRight() != 0 || paddingLeft() != 0 || paddingRight() != 0; }
+
+ int marginTop() const { return m_marginTop; }
+ int marginBottom() const { return m_marginBottom; }
+ int marginLeft() const { return m_marginLeft; }
+ int marginRight() const { return m_marginRight; }
+
+ // Virtual since table cells override
+ virtual int paddingTop(bool includeIntrinsicPadding = true) const;
+ virtual int paddingBottom(bool includeIntrinsicPadding = true) const;
+ virtual int paddingLeft(bool includeIntrinsicPadding = true) const;
+ virtual int paddingRight(bool includeIntrinsicPadding = true) const;
+
+ virtual int borderTop() const { return style()->borderTopWidth(); }
+ virtual int borderBottom() const { return style()->borderBottomWidth(); }
+ virtual int borderLeft() const { return style()->borderLeftWidth(); }
+ virtual int borderRight() const { return style()->borderRightWidth(); }
+
+ // The following seven functions are used to implement collapsing margins.
+ // All objects know their maximal positive and negative margins. The
+ // formula for computing a collapsed margin is |maxPosMargin| - |maxNegmargin|.
+ // For a non-collapsing box, such as a leaf element, this formula will simply return
+ // the margin of the element. Blocks override the maxTopMargin and maxBottomMargin
+ // methods.
+ virtual bool isSelfCollapsingBlock() const { return false; }
+ int collapsedMarginTop() const { return maxTopMargin(true) - maxTopMargin(false); }
+ int collapsedMarginBottom() const { return maxBottomMargin(true) - maxBottomMargin(false); }
+ virtual bool isTopMarginQuirk() const { return false; }
+ virtual bool isBottomMarginQuirk() const { return false; }
+ virtual int maxTopMargin(bool positive) const { return positive ? std::max(0, marginTop()) : -std::min(0, marginTop()); }
+ virtual int maxBottomMargin(bool positive) const { return positive ? std::max(0, marginBottom()) : -std::min(0, marginBottom()); }
+
+ virtual void absoluteRects(Vector<IntRect>&, int tx, int ty, bool topLevel = true);
+ virtual void absoluteQuads(Vector<FloatQuad>&, bool topLevel = true);
+
+ IntRect reflectionBox() const;
+ int reflectionOffset() const;
+ // Given a rect in the object's coordinate space, returns the corresponding rect in the reflection.
+ IntRect reflectedRect(const IntRect&) const;
+
+ virtual void paint(PaintInfo&, int tx, int ty);
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
+
+ virtual void destroy();
+
+ virtual int minPrefWidth() const;
+ virtual int maxPrefWidth() const;
+
+ virtual int overrideSize() const;
+ virtual int overrideWidth() const;
+ virtual int overrideHeight() const;
+ virtual void setOverrideSize(int);
+
+ virtual IntSize offsetFromContainer(RenderObject*) const;
+
+ int calcBorderBoxWidth(int width) const;
+ int calcBorderBoxHeight(int height) const;
+ int calcContentBoxWidth(int width) const;
+ int calcContentBoxHeight(int height) const;
+
+ virtual void borderFitAdjust(int& /*x*/, int& /*w*/) const { } // Shrink the box in which the border paints if border-fit is set.
+
+ // This method is now public so that centered objects like tables that are
+ // shifted right by left-aligned floats can recompute their left and
+ // right margins (so that they can remain centered after being
+ // shifted. -dwh
+ void calcHorizontalMargins(const Length& marginLeft, const Length& marginRight, int containerWidth);
+
+ virtual void position(InlineBox*);
+
+ virtual void dirtyLineBoxes(bool fullLayout, bool isRootLineBox = false);
+
+ // For inline replaced elements, this function returns the inline box that owns us. Enables
+ // the replaced RenderObject to quickly determine what line it is contained on and to easily
+ // iterate over structures on the line.
+ InlineBox* inlineBoxWrapper() const { return m_inlineBoxWrapper; }
+ void setInlineBoxWrapper(InlineBox* boxWrapper) { m_inlineBoxWrapper = boxWrapper; }
+ void deleteLineBoxWrapper();
+
+ virtual int lowestPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
+ virtual int rightmostPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
+ virtual int leftmostPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
+
+ virtual IntRect clippedOverflowRectForRepaint(RenderBox* repaintContainer);
+ virtual void computeRectForRepaint(RenderBox* repaintContainer, IntRect&, bool fixed = false);
+ IntSize offsetForPositionedInContainer(RenderObject*) const;
+
+ virtual void repaintDuringLayoutIfMoved(const IntRect&);
+
+ virtual int containingBlockWidth() const;
+
+ virtual void calcWidth();
+ virtual void calcHeight();
+
+ bool stretchesToViewHeight() const
+ {
+ return style()->htmlHacks() && style()->height().isAuto() && !isFloatingOrPositioned() && (isRoot() || isBody());
+ }
+
+ virtual IntSize intrinsicSize() const { return IntSize(); }
+
+ // Whether or not the element shrinks to its intrinsic width (rather than filling the width
+ // of a containing block). HTML4 buttons, <select>s, <input>s, legends, and floating/compact elements do this.
+ bool sizesToIntrinsicWidth(WidthType) const;
+ virtual bool stretchesToMinIntrinsicWidth() const { return false; }
+
+ int calcWidthUsing(WidthType, int containerWidth);
+ int calcHeightUsing(const Length& height);
+ int calcReplacedWidthUsing(Length width) const;
+ int calcReplacedHeightUsing(Length height) const;
+
+ virtual int calcReplacedWidth(bool includeMaxWidth = true) const;
+ virtual int calcReplacedHeight() const;
+
+ int calcPercentageHeight(const Length& height);
+
+ // Block flows subclass availableWidth to handle multi column layout (shrinking the width available to children when laying out.)
+ virtual int availableWidth() const { return contentWidth(); }
+ virtual int availableHeight() const;
+ int availableHeightUsing(const Length&) const;
+
+ void calcVerticalMargins();
+
+ int relativePositionOffsetX() const;
+ int relativePositionOffsetY() const;
+ IntSize relativePositionOffset() const { return IntSize(relativePositionOffsetX(), relativePositionOffsetY()); }
+
+ bool hasSelfPaintingLayer() const;
+ RenderLayer* layer() const { return m_layer; }
+ virtual bool requiresLayer() const { return isRoot() || isPositioned() || isRelPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || hasMask() || hasReflection(); }
+
+ virtual int verticalScrollbarWidth() const;
+ int horizontalScrollbarHeight() const;
+ virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1.0f);
+ virtual bool canBeProgramaticallyScrolled(bool) const;
+ virtual void autoscroll();
+ virtual void stopAutoscroll() { }
+ virtual void panScroll(const IntPoint&);
+ bool hasAutoVerticalScrollbar() const { return hasOverflowClip() && (style()->overflowY() == OAUTO || style()->overflowY() == OOVERLAY); }
+ bool hasAutoHorizontalScrollbar() const { return hasOverflowClip() && (style()->overflowX() == OAUTO || style()->overflowX() == OOVERLAY); }
+ bool scrollsOverflow() const { return scrollsOverflowX() || scrollsOverflowY(); }
+ bool scrollsOverflowX() const { return hasOverflowClip() && (style()->overflowX() == OSCROLL || hasAutoHorizontalScrollbar()); }
+ bool scrollsOverflowY() const { return hasOverflowClip() && (style()->overflowY() == OSCROLL || hasAutoVerticalScrollbar()); }
+
+ virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0);
+
+ virtual void paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer*, int clipY, int clipHeight,
+ int tx, int ty, int width, int height, InlineFlowBox* = 0, CompositeOperator = CompositeSourceOver);
+ IntSize calculateBackgroundSize(const FillLayer*, int scaledWidth, int scaledHeight) const;
+
+ virtual int staticX() const;
+ virtual int staticY() const;
+ virtual void setStaticX(int staticX);
+ virtual void setStaticY(int staticY);
+
+ virtual IntRect getOverflowClipRect(int tx, int ty);
+ virtual IntRect getClipRect(int tx, int ty);
+
+ bool pushContentsClip(PaintInfo&, int tx, int ty);
+ void popContentsClip(PaintInfo&, PaintPhase originalPhase, int tx, int ty);
+
+ virtual void paintObject(PaintInfo&, int /*tx*/, int /*ty*/) { ASSERT_NOT_REACHED(); }
+ virtual void paintBoxDecorations(PaintInfo&, int tx, int ty);
+ virtual void paintMask(PaintInfo& paintInfo, int tx, int ty);
+ virtual void imageChanged(WrappedImagePtr, const IntRect* = 0);
+
+ // Called when a positioned object moves but doesn't change size. A simplified layout is done
+ // that just updates the object's position.
+ virtual void tryLayoutDoingPositionedMovementOnly()
+ {
+ int oldWidth = width();
+ calcWidth();
+ // If we shrink to fit our width may have changed, so we still need full layout.
+ if (oldWidth != width())
+ return;
+ calcHeight();
+ setNeedsLayout(false);
+ }
+
+ IntRect maskClipRect();
+
+#if ENABLE(SVG)
+ virtual TransformationMatrix localTransform() const;
+#endif
+
+protected:
+ virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
+ virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+
+ void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, int clipY, int clipHeight, int tx, int ty, int width, int height, CompositeOperator = CompositeSourceOver);
+ void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, int clipY, int clipHeight, int tx, int ty, int width, int height, CompositeOperator = CompositeSourceOver);
+
+ void paintMaskImages(const PaintInfo&, int clipY, int clipHeight, int tx, int ty, int width, int height);
+
+#if PLATFORM(MAC)
+ void paintCustomHighlight(int tx, int ty, const AtomicString& type, bool behindText);
+#endif
+
+ void calcAbsoluteHorizontal();
+
+ virtual bool shouldCalculateSizeAsReplaced() const { return isReplaced() && !isInlineBlockOrInlineTable(); }
+
+ virtual void mapLocalToContainer(RenderBox* repaintContainer, bool useTransforms, bool fixed, TransformState&) const;
+ virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const;
+
+private:
+ bool includeVerticalScrollbarSize() const { return hasOverflowClip() && (style()->overflowY() == OSCROLL || style()->overflowY() == OAUTO); }
+ bool includeHorizontalScrollbarSize() const { return hasOverflowClip() && (style()->overflowX() == OSCROLL || style()->overflowX() == OAUTO); }
+
+ void paintRootBoxDecorations(PaintInfo&, int tx, int ty);
+ // Returns true if we did a full repaint
+ bool repaintLayerRectsForImage(WrappedImagePtr image, const FillLayer* layers, bool drawingBackground);
+
+ void calculateBackgroundImageGeometry(const FillLayer*, int tx, int ty, int w, int h, IntRect& destRect, IntPoint& phase, IntSize& tileSize);
+
+ int containingBlockWidthForPositioned(const RenderObject* containingBlock) const;
+ int containingBlockHeightForPositioned(const RenderObject* containingBlock) const;
+
+ void calcAbsoluteVertical();
+ void calcAbsoluteHorizontalValues(Length width, const RenderBox* cb, TextDirection containerDirection,
+ int containerWidth, int bordersPlusPadding,
+ Length left, Length right, Length marginLeft, Length marginRight,
+ int& widthValue, int& marginLeftValue, int& marginRightValue, int& xPos);
+ void calcAbsoluteVerticalValues(Length height, const RenderBox* cb,
+ int containerHeight, int bordersPlusPadding,
+ Length top, Length bottom, Length marginTop, Length marginBottom,
+ int& heightValue, int& marginTopValue, int& marginBottomValue, int& yPos);
+
+ void calcAbsoluteVerticalReplaced();
+ void calcAbsoluteHorizontalReplaced();
+
+ // This function calculates the minimum and maximum preferred widths for an object.
+ // These values are used in shrink-to-fit layout systems.
+ // These include tables, positioned objects, floats and flexible boxes.
+ virtual void calcPrefWidths() = 0;
+
+private:
+ // The width/height of the contents + borders + padding. The x/y location is relative to our container (which is not always our parent).
+ IntRect m_frameRect;
+
+protected:
+ int m_marginLeft;
+ int m_marginRight;
+ int m_marginTop;
+ int m_marginBottom;
+
+ // The preferred width of the element if it were to break its lines at every possible opportunity.
+ int m_minPrefWidth;
+
+ // The preferred width of the element if it never breaks any lines at all.
+ int m_maxPrefWidth;
+
+ // A pointer to our layer if we have one.
+ RenderLayer* m_layer;
+
+ // For inline replaced elements, the inline box that owns us.
+ InlineBox* m_inlineBoxWrapper;
+
+private:
+ // Used to store state between styleWillChange and styleDidChange
+ static bool s_wasFloating;
+ static bool s_hadOverflowClip;
+};
+
+inline RenderBox* toRenderBox(RenderObject* o)
+{
+ ASSERT(!o || o->isBox());
+ return static_cast<RenderBox*>(o);
+}
+
+inline const RenderBox* toRenderBox(const RenderObject* o)
+{
+ ASSERT(!o || o->isBox());
+ return static_cast<const RenderBox*>(o);
+}
+
+inline RenderBox* RenderBox::previousSiblingBox() const
+{
+ return toRenderBox(previousSibling());
+}
+
+inline RenderBox* RenderBox::nextSiblingBox() const
+{
+ return toRenderBox(nextSibling());
+}
+
+inline RenderBox* RenderBox::parentBox() const
+{
+ return toRenderBox(parent());
+}
+
+} // namespace WebCore
+
+#endif // RenderBox_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2006, 2007, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderBoxModelObject_h
+#define RenderBoxModelObject_h
+
+#include "RenderObject.h"
+
+namespace WebCore {
+
+// Values for vertical alignment.
+const int PositionTop = -0x7fffffff;
+const int PositionBottom = 0x7fffffff;
+const int PositionUndefined = 0x80000000;
+
+// This class is the base for all objects that adhere to the CSS box model as described
+// at http://www.w3.org/TR/CSS21/box.html
+
+class RenderBoxModelObject : public RenderObject {
+public:
+ RenderBoxModelObject(Node*);
+ virtual ~RenderBoxModelObject();
+
+ virtual void destroy();
+
+ int relativePositionOffsetX() const;
+ int relativePositionOffsetY() const;
+ IntSize relativePositionOffset() const { return IntSize(relativePositionOffsetX(), relativePositionOffsetY()); }
+
+ // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlines (RenderFlow)
+ // to return the remaining width on a given line (and the height of a single line).
+ virtual int offsetLeft() const;
+ virtual int offsetTop() const;
+ virtual int offsetWidth() const = 0;
+ virtual int offsetHeight() const = 0;
+
+ virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
+ virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+ virtual void updateBoxModelInfoFromStyle();
+
+ bool hasSelfPaintingLayer() const;
+ RenderLayer* layer() const { return m_layer; }
+ virtual bool requiresLayer() const { return isRoot() || isPositioned() || isRelPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || hasMask() || hasReflection(); }
+
+ // This will work on inlines to return the bounding box of all of the lines' border boxes.
+ virtual IntRect borderBoundingBox() const = 0;
+
+ // Virtual since table cells override
+ virtual int paddingTop(bool includeIntrinsicPadding = true) const;
+ virtual int paddingBottom(bool includeIntrinsicPadding = true) const;
+ virtual int paddingLeft(bool includeIntrinsicPadding = true) const;
+ virtual int paddingRight(bool includeIntrinsicPadding = true) const;
+
+ virtual int borderTop() const { return style()->borderTopWidth(); }
+ virtual int borderBottom() const { return style()->borderBottomWidth(); }
+ virtual int borderLeft() const { return style()->borderLeftWidth(); }
+ virtual int borderRight() const { return style()->borderRightWidth(); }
+
+ virtual int marginTop() const = 0;
+ virtual int marginBottom() const = 0;
+ virtual int marginLeft() const = 0;
+ virtual int marginRight() const = 0;
+
+ bool hasHorizontalBordersPaddingOrMargin() const { return hasHorizontalBordersOrPadding() || marginLeft() != 0 || marginRight() != 0; }
+ bool hasHorizontalBordersOrPadding() const { return borderLeft() != 0 || borderRight() != 0 || paddingLeft() != 0 || paddingRight() != 0; }
+
+ virtual int containingBlockWidthForContent() const;
+
+ virtual void childBecameNonInline(RenderObject* /*child*/) { }
+
+ void paintBorder(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, bool begin = true, bool end = true);
+ bool paintNinePieceImage(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, const NinePieceImage&, CompositeOperator = CompositeSourceOver);
+ void paintBoxShadow(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, bool begin = true, bool end = true);
+ virtual void paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer*, int clipY, int clipHeight,
+ int tx, int ty, int width, int height, InlineFlowBox* = 0, CompositeOperator = CompositeSourceOver);
+
+ // The difference between this inline's baseline position and the line's baseline position.
+ int verticalPosition(bool firstLine) const;
+
+protected:
+ void calculateBackgroundImageGeometry(const FillLayer*, int tx, int ty, int w, int h, IntRect& destRect, IntPoint& phase, IntSize& tileSize);
+ IntSize calculateBackgroundSize(const FillLayer*, int scaledWidth, int scaledHeight) const;
+
+private:
+ virtual bool isBoxModelObject() const { return true; }
+ friend class RenderView;
+
+ RenderLayer* m_layer;
+
+ // Used to store state between styleWillChange and styleDidChange
+ static bool s_wasFloating;
+};
+
+inline RenderBoxModelObject* toRenderBoxModelObject(RenderObject* o)
+{
+ ASSERT(!o || o->isBoxModelObject());
+ return static_cast<RenderBoxModelObject*>(o);
+}
+
+inline const RenderBoxModelObject* toRenderBoxModelObject(const RenderObject* o)
+{
+ ASSERT(!o || o->isBoxModelObject());
+ return static_cast<const RenderBoxModelObject*>(o);
+}
+
+// This will catch anyone doing an unnecessary cast.
+void toRenderBoxModelObject(const RenderBox*);
+
+} // namespace WebCore
+
+#endif // RenderBoxModelObject_h
--- /dev/null
+/*
+ * This file is part of the html renderer for KDE.
+ *
+ * Copyright (C) 2005 Apple Computer
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderButton_h
+#define RenderButton_h
+
+#include "RenderFlexibleBox.h"
+#include "Timer.h"
+#include <wtf/OwnPtr.h>
+
+namespace WebCore {
+
+class RenderTextFragment;
+
+// RenderButtons are just like normal flexboxes except that they will generate an anonymous block child.
+// For inputs, they will also generate an anonymous RenderText and keep its style and content up
+// to date as the button changes.
+class RenderButton : public RenderFlexibleBox {
+public:
+ RenderButton(Node*);
+
+ virtual const char* renderName() const { return "RenderButton"; }
+
+ virtual void addChild(RenderObject* newChild, RenderObject *beforeChild = 0);
+ virtual void removeChild(RenderObject*);
+ virtual void removeLeftoverAnonymousBlock(RenderBlock*) { }
+ virtual bool createsAnonymousWrapper() const { return true; }
+
+ void setupInnerStyle(RenderStyle*);
+ virtual void updateFromElement();
+
+ virtual void updateBeforeAfterContent(RenderStyle::PseudoId);
+
+ virtual bool hasControlClip() const { return true; }
+ virtual IntRect controlClipRect(int /*tx*/, int /*ty*/) const;
+
+ void setText(const String&);
+
+ virtual bool canHaveChildren() const;
+
+ virtual void layout();
+
+protected:
+ virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
+ virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+
+ virtual bool hasLineIfEmpty() const { return true; }
+
+ void timerFired(Timer<RenderButton>*);
+
+ RenderTextFragment* m_buttonText;
+ RenderBlock* m_inner;
+
+ OwnPtr<Timer<RenderButton> > m_timer;
+ bool m_default;
+};
+
+} // namespace WebCore
+
+#endif // RenderButton_h
--- /dev/null
+/*
+ * Copyright (C) 2001 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef RenderContainer_h
+#define RenderContainer_h
+
+#include "RenderBox.h"
+
+#include "SelectionRect.h"
+
+namespace WebCore {
+
+// Base class for rendering objects that can have children.
+class RenderContainer : public RenderBox {
+public:
+ RenderContainer(Node*);
+ virtual ~RenderContainer();
+
+ virtual RenderObject* firstChild() const { return m_firstChild; }
+ virtual RenderObject* lastChild() const { return m_lastChild; }
+
+ // Use this with caution! No type checking is done!
+ RenderBox* firstChildBox() const { ASSERT(!firstChild() || firstChild()->isBox()); return toRenderBox(m_firstChild); }
+ RenderBox* lastChildBox() const { ASSERT(!lastChild() || lastChild()->isBox()); return toRenderBox(m_lastChild); }
+
+ virtual bool canHaveChildren() const;
+ virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0);
+ virtual void removeChild(RenderObject*);
+
+ virtual void destroy();
+ void destroyLeftoverChildren();
+
+ virtual RenderObject* removeChildNode(RenderObject*, bool fullRemove = true);
+ virtual void appendChildNode(RenderObject*, bool fullAppend = true);
+ virtual void insertChildNode(RenderObject* child, RenderObject* before, bool fullInsert = true);
+
+ // Designed for speed. Don't waste time doing a bunch of work like layer updating and repainting when we know that our
+ // change in parentage is not going to affect anything.
+ virtual void moveChildNode(RenderObject* child) { appendChildNode(child->parent()->removeChildNode(child, false), false); }
+
+ virtual void layout();
+ virtual void calcPrefWidths() { setPrefWidthsDirty(false); }
+
+ virtual void removeLeftoverAnonymousBlock(RenderBlock* child);
+
+ RenderObject* beforeAfterContainer(RenderStyle::PseudoId);
+ virtual void updateBeforeAfterContent(RenderStyle::PseudoId);
+ void updateBeforeAfterContentForContainer(RenderStyle::PseudoId, RenderContainer*);
+ bool isAfterContent(RenderObject* child) const;
+ virtual void invalidateCounters();
+
+ virtual VisiblePosition positionForCoordinates(int x, int y);
+
+ virtual void addLineBoxRects(Vector<IntRect>&, unsigned startOffset = 0, unsigned endOffset = UINT_MAX, bool useSelectionHeight = false);
+ virtual void collectAbsoluteLineBoxQuads(Vector<FloatQuad>&, unsigned startOffset = 0, unsigned endOffset = UINT_MAX, bool useSelectionHeight = false);
+ virtual void collectSelectionRects(Vector<SelectionRect>&, unsigned startOffset = 0, unsigned endOffset = UINT_MAX);
+
+protected:
+ RenderObject* m_firstChild;
+ RenderObject* m_lastChild;
+};
+
+} // namespace WebCore
+
+#endif // RenderContainer_h
--- /dev/null
+/*
+ * Copyright (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderCounter_h
+#define RenderCounter_h
+
+#include "CounterContent.h"
+#include "RenderText.h"
+
+namespace WebCore {
+
+class CounterNode;
+
+class RenderCounter : public RenderText {
+public:
+ RenderCounter(Document*, const CounterContent&);
+
+ virtual const char* renderName() const;
+ virtual bool isCounter() const;
+ virtual PassRefPtr<StringImpl> originalText() const;
+
+ virtual void dirtyLineBoxes(bool, bool);
+ virtual void calcPrefWidths(int leadWidth);
+
+ void invalidate();
+
+ static void destroyCounterNodes(RenderObject*);
+
+private:
+ CounterContent m_counter;
+ mutable CounterNode* m_counterNode;
+};
+
+} // namespace WebCore
+
+#endif // RenderCounter_h
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderFieldset_h
+#define RenderFieldset_h
+
+#include "RenderBlock.h"
+
+namespace WebCore {
+
+class RenderFieldset : public RenderBlock {
+public:
+ RenderFieldset(Node*);
+
+ virtual const char* renderName() const { return "RenderFieldSet"; }
+ virtual bool isFieldset() const { return true; }
+
+ virtual RenderObject* layoutLegend(bool relayoutChildren);
+
+ virtual void calcPrefWidths();
+ virtual bool avoidsFloats() const { return true; }
+ virtual bool stretchesToMinIntrinsicWidth() const { return true; }
+
+ RenderBox* findLegend() const;
+
+protected:
+ virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+
+private:
+ virtual void paintBoxDecorations(PaintInfo&, int tx, int ty);
+ virtual void paintMask(PaintInfo& paintInfo, int tx, int ty);
+ void paintBorderMinusLegend(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, int lx, int lw, int lb);
+};
+
+} // namespace WebCore
+
+#endif // RenderFieldset_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007 Apple Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderFileUploadControl_h
+#define RenderFileUploadControl_h
+
+#include "RenderBlock.h"
+
+namespace WebCore {
+
+class HTMLInputElement;
+
+// Each RenderFileUploadControl contains a RenderButton (for opening the file chooser), and
+// sufficient space to draw a file icon and filename. The RenderButton has a shadow node
+// associated with it to receive click/hover events.
+
+class RenderFileUploadControl : public RenderBlock {
+public:
+ RenderFileUploadControl(HTMLInputElement*);
+ ~RenderFileUploadControl();
+
+ virtual const char* renderName() const { return "RenderFileUploadControl"; }
+
+ virtual void updateFromElement();
+ virtual void calcPrefWidths();
+ virtual void paintObject(PaintInfo&, int tx, int ty);
+
+ void click();
+
+ void valueChanged();
+
+
+ String buttonValue();
+ String fileTextValue();
+
+ bool allowsMultipleFiles();
+
+protected:
+ virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+
+private:
+ int maxFilenameWidth() const;
+ PassRefPtr<RenderStyle> createButtonStyle(const RenderStyle* parentStyle) const;
+
+ RefPtr<HTMLInputElement> m_button;
+};
+
+} // namespace WebCore
+
+#endif // RenderFileUploadControl_h
--- /dev/null
+/*
+ * This file is part of the render object implementation for KHTML.
+ *
+ * Copyright (C) 2003 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderFlexibleBox_h
+#define RenderFlexibleBox_h
+
+#include "RenderBlock.h"
+
+namespace WebCore {
+
+class RenderFlexibleBox : public RenderBlock {
+public:
+ RenderFlexibleBox(Node*);
+ virtual ~RenderFlexibleBox();
+
+ virtual const char* renderName() const;
+
+ virtual void calcPrefWidths();
+ void calcHorizontalPrefWidths();
+ void calcVerticalPrefWidths();
+
+ virtual void layoutBlock(bool relayoutChildren);
+ void layoutHorizontalBox(bool relayoutChildren);
+ void layoutVerticalBox(bool relayoutChildren);
+
+ virtual bool avoidsFloats() const { return true; }
+
+ virtual bool isFlexibleBox() const { return true; }
+ virtual bool isFlexingChildren() const { return m_flexingChildren; }
+ virtual bool isStretchingChildren() const { return m_stretchingChildren; }
+
+ void placeChild(RenderBox* child, int x, int y);
+
+protected:
+ int allowedChildFlex(RenderBox* child, bool expanding, unsigned group);
+
+ bool hasMultipleLines() const { return style()->boxLines() == MULTIPLE; }
+ bool isVertical() const { return style()->boxOrient() == VERTICAL; }
+ bool isHorizontal() const { return style()->boxOrient() == HORIZONTAL; }
+
+ bool m_flexingChildren : 1;
+ bool m_stretchingChildren : 1;
+};
+
+} // namespace WebCore
+
+#endif // RenderFlexibleBox_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderFlow_h
+#define RenderFlow_h
+
+#include "RenderContainer.h"
+
+namespace WebCore {
+
+enum LineCount
+{
+ NOT_SET = 0, NO_LINE = 1, ONE_LINE = 2, MULTI_LINE = 3
+};
+
+/**
+ * all geometry managing stuff is only in the block elements.
+ *
+ * Inline elements don't layout themselves, but the whole paragraph
+ * gets flowed by the surrounding block element. This is, because
+ * one needs to know the whole paragraph to calculate bidirectional
+ * behaviour of text, so putting the layouting routines in the inline
+ * elements is impossible.
+ */
+class RenderFlow : public RenderContainer {
+public:
+ RenderFlow(Node* node)
+ : RenderContainer(node)
+ , m_continuation(0)
+ , m_firstLineBox(0)
+ , m_lastLineBox(0)
+ , m_lineHeight(-1)
+ , m_childrenInline(true)
+ , m_firstLine(false)
+ , m_topMarginQuirk(false)
+ , m_bottomMarginQuirk(false)
+ , m_hasMarkupTruncation(false)
+ , m_selectionState(SelectionNone)
+ , m_hasColumns(false)
+ , m_lineCountForTextAutosizing(NOT_SET)
+ , m_isContinuation(false)
+ , m_cellWidthChanged(false)
+ {
+ }
+#ifndef NDEBUG
+ virtual ~RenderFlow();
+#endif
+
+ virtual RenderFlow* virtualContinuation() const { return continuation(); }
+ RenderFlow* continuation() const { return m_continuation; }
+ void setContinuation(RenderFlow* c) { m_continuation = c; }
+ RenderFlow* continuationBefore(RenderObject* beforeChild);
+
+ void addChildWithContinuation(RenderObject* newChild, RenderObject* beforeChild);
+ virtual void addChildToFlow(RenderObject* newChild, RenderObject* beforeChild) = 0;
+ virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0);
+
+ static RenderFlow* createAnonymousFlow(Document*, PassRefPtr<RenderStyle>);
+
+ void extractLineBox(InlineFlowBox*);
+ void attachLineBox(InlineFlowBox*);
+ void removeLineBox(InlineFlowBox*);
+ void deleteLineBoxes();
+ virtual void destroy();
+
+ virtual void dirtyLinesFromChangedChild(RenderObject* child);
+
+ virtual int lineHeight(bool firstLine, bool isRootLineBox = false) const;
+
+ InlineFlowBox* firstLineBox() const { return m_firstLineBox; }
+ InlineFlowBox* lastLineBox() const { return m_lastLineBox; }
+
+ virtual InlineBox* createInlineBox(bool makePlaceHolderBox, bool isRootLineBox, bool isOnlyRun=false);
+ virtual void dirtyLineBoxes(bool fullLayout, bool isRootLineBox = false);
+
+ void paintLines(PaintInfo&, int tx, int ty);
+ bool hitTestLines(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
+
+ virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0);
+
+ virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
+ void paintOutlineForLine(GraphicsContext*, int tx, int ty, const IntRect& prevLine, const IntRect& thisLine, const IntRect& nextLine);
+ void paintOutline(GraphicsContext*, int tx, int ty);
+
+ virtual bool hasColumns() const { return m_hasColumns; }
+
+ void calcMargins(int containerWidth);
+
+ void checkConsistency() const;
+
+private:
+ // An inline can be split with blocks occurring in between the inline content.
+ // When this occurs we need a pointer to our next object. We can basically be
+ // split into a sequence of inlines and blocks. The continuation will either be
+ // an anonymous block (that houses other blocks) or it will be an inline flow.
+ RenderFlow* m_continuation;
+
+protected:
+ // For block flows, each box represents the root inline box for a line in the
+ // paragraph.
+ // For inline flows, each box represents a portion of that inline.
+ InlineFlowBox* m_firstLineBox;
+ InlineFlowBox* m_lastLineBox;
+
+ mutable int m_lineHeight;
+
+ // These bitfields are moved here from subclasses to pack them together
+ // from RenderBlock
+ bool m_childrenInline : 1;
+ bool m_firstLine : 1;
+ bool m_topMarginQuirk : 1;
+ bool m_bottomMarginQuirk : 1;
+ bool m_hasMarkupTruncation : 1;
+ unsigned m_selectionState : 3; // SelectionState
+ bool m_hasColumns : 1;
+ unsigned m_lineCountForTextAutosizing : 2;
+
+ // from RenderInline
+ bool m_isContinuation : 1; // Whether or not we're a continuation of an inline.
+
+ // from RenderTableCell
+ bool m_cellWidthChanged : 1;
+};
+
+#ifdef NDEBUG
+inline void RenderFlow::checkConsistency() const
+{
+}
+#endif
+
+} // namespace WebCore
+
+#endif // RenderFlow_h
--- /dev/null
+/*
+ * This file is part of the WebKit project.
+ *
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderForeignObject_h
+#define RenderForeignObject_h
+#if ENABLE(SVG) && ENABLE(SVG_FOREIGN_OBJECT)
+
+#include "TransformationMatrix.h"
+#include "RenderSVGBlock.h"
+
+namespace WebCore {
+
+class SVGForeignObjectElement;
+
+class RenderForeignObject : public RenderSVGBlock {
+public:
+ RenderForeignObject(SVGForeignObjectElement*);
+
+ virtual const char* renderName() const { return "RenderForeignObject"; }
+
+ virtual void paint(PaintInfo&, int parentX, int parentY);
+
+ virtual TransformationMatrix localTransform() const { return m_localTransform; }
+ virtual bool calculateLocalTransform();
+
+ virtual void computeRectForRepaint(RenderBox* repaintContainer, IntRect&, bool fixed = false);
+ virtual bool requiresLayer() const { return false; }
+ virtual void layout();
+
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
+
+ private:
+ TransformationMatrix translationForAttributes();
+
+ TransformationMatrix m_localTransform;
+ IntRect m_absoluteBounds;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG) && ENABLE(SVG_FOREIGN_OBJECT)
+#endif // RenderForeignObject_h
--- /dev/null
+/*
+ * This file is part of the KDE project.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Simon Hausmann <hausmann@kde.org>
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderFrame_h
+#define RenderFrame_h
+
+#include "HTMLFrameElement.h"
+#include "RenderPart.h"
+#include "RenderFrameSet.h"
+
+namespace WebCore {
+
+class RenderFrame : public RenderPart {
+public:
+ RenderFrame(HTMLFrameElement*);
+
+ virtual const char* renderName() const { return "RenderFrame"; }
+ virtual bool isFrame() const { return true; }
+
+ HTMLFrameElement* element() const { return static_cast<HTMLFrameElement*>(RenderPart::element()); }
+
+ FrameEdgeInfo edgeInfo() const;
+
+ virtual void viewCleared();
+ void layoutWithFlattening(bool flexibleWidth, bool flexibleHeight);
+};
+
+} // namespace WebCore
+
+#endif // RenderFrame_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Simon Hausmann <hausmann@kde.org>
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderFrameSet_h
+#define RenderFrameSet_h
+
+#include "RenderContainer.h"
+
+namespace WebCore {
+
+class HTMLFrameSetElement;
+class MouseEvent;
+
+enum FrameEdge { LeftFrameEdge, RightFrameEdge, TopFrameEdge, BottomFrameEdge };
+
+struct FrameEdgeInfo
+{
+ FrameEdgeInfo(bool preventResize = false, bool allowBorder = true)
+ : m_preventResize(4)
+ , m_allowBorder(4)
+ {
+ m_preventResize.fill(preventResize);
+ m_allowBorder.fill(allowBorder);
+ }
+
+ bool preventResize(FrameEdge edge) const { return m_preventResize[edge]; }
+ bool allowBorder(FrameEdge edge) const { return m_allowBorder[edge]; }
+
+ void setPreventResize(FrameEdge edge, bool preventResize) { m_preventResize[edge] = preventResize; }
+ void setAllowBorder(FrameEdge edge, bool allowBorder) { m_allowBorder[edge] = allowBorder; }
+
+private:
+ Vector<bool> m_preventResize;
+ Vector<bool> m_allowBorder;
+};
+
+class RenderFrameSet : public RenderContainer {
+public:
+ RenderFrameSet(HTMLFrameSetElement*);
+ virtual ~RenderFrameSet();
+
+ virtual const char* renderName() const { return "RenderFrameSet"; }
+ virtual bool isFrameSet() const { return true; }
+
+ virtual void layout();
+ virtual void calcPrefWidths();
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
+ virtual void paint(PaintInfo& paintInfo, int tx, int ty);
+ virtual bool isChildAllowed(RenderObject*, RenderStyle*) const;
+
+ FrameEdgeInfo edgeInfo() const;
+
+ bool userResize(MouseEvent*);
+
+ bool isResizingRow() const;
+ bool isResizingColumn() const;
+
+ bool canResizeRow(const IntPoint&) const;
+ bool canResizeColumn(const IntPoint&) const;
+
+ bool flattenFrameset() const;
+
+private:
+ static const int noSplit = -1;
+
+ class GridAxis : Noncopyable {
+ public:
+ GridAxis();
+ void resize(int);
+ Vector<int> m_sizes;
+ Vector<int> m_deltas;
+ Vector<bool> m_preventResize;
+ Vector<bool> m_allowBorder;
+ int m_splitBeingResized;
+ int m_splitResizeOffset;
+ };
+
+ inline HTMLFrameSetElement* frameSet() const;
+
+ bool canResize(const IntPoint&) const;
+ void setIsResizing(bool);
+
+ void layOutAxis(GridAxis&, const Length*, int availableSpace);
+ void computeEdgeInfo();
+ void fillFromEdgeInfo(const FrameEdgeInfo& edgeInfo, int r, int c);
+ void positionFrames();
+ void positionFramesWithFlattening();
+
+ int splitPosition(const GridAxis&, int split) const;
+ int hitTestSplit(const GridAxis&, int position) const;
+
+ void startResizing(GridAxis&, int position);
+ void continueResizing(GridAxis&, int position);
+
+ void paintRowBorder(const PaintInfo& paintInfo, const IntRect& rect);
+ void paintColumnBorder(const PaintInfo& paintInfo, const IntRect& rect);
+
+ GridAxis m_rows;
+ GridAxis m_cols;
+
+ bool m_isResizing;
+ bool m_isChildResizing;
+};
+
+} // namespace WebCore
+
+#endif // RenderFrameSet_h
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RenderHTMLCanvas_h
+#define RenderHTMLCanvas_h
+
+#include "RenderReplaced.h"
+
+namespace WebCore {
+
+class HTMLCanvasElement;
+
+class RenderHTMLCanvas : public RenderReplaced {
+public:
+ RenderHTMLCanvas(HTMLCanvasElement*);
+
+ virtual const char* renderName() const { return "RenderHTMLCanvas"; }
+
+ virtual void paintReplaced(PaintInfo& paintInfo, int tx, int ty);
+
+ void canvasSizeChanged();
+
+protected:
+ virtual void intrinsicSizeChanged() { canvasSizeChanged(); }
+
+};
+
+} // namespace WebCore
+
+#endif // RenderHTMLCanvas_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2006 Allan Sandfeld Jensen (kde@carewolf.com)
+ * (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderImage_h
+#define RenderImage_h
+
+#include "CachedImage.h"
+#include "CachedResourceHandle.h"
+#include "RenderReplaced.h"
+
+namespace WebCore {
+
+class HTMLMapElement;
+
+class RenderImage : public RenderReplaced {
+public:
+ RenderImage(Node*);
+ virtual ~RenderImage();
+
+ virtual const char* renderName() const { return "RenderImage"; }
+
+ virtual bool isImage() const { return true; }
+ virtual bool isRenderImage() const { return true; }
+
+ virtual void paintReplaced(PaintInfo& paintInfo, int tx, int ty);
+
+ virtual int minimumReplacedHeight() const;
+
+ virtual void imageChanged(WrappedImagePtr, const IntRect* = 0);
+ virtual void notifyFinished(CachedResource*);
+
+ bool setImageSizeForAltText(CachedImage* newImage = 0);
+
+ void updateAltText();
+
+ void setCachedImage(CachedImage*);
+ CachedImage* cachedImage() const { return m_cachedImage.get(); }
+
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
+
+ virtual int calcReplacedWidth(bool includeMaxWidth = true) const;
+ virtual int calcReplacedHeight() const;
+
+ virtual void calcPrefWidths();
+
+ HTMLMapElement* imageMap();
+
+ void resetAnimation();
+
+ virtual bool hasImage() const { return m_cachedImage; }
+
+ void highQualityRepaintTimerFired(Timer<RenderImage>*);
+
+ virtual void collectSelectionRects(Vector<SelectionRect>&, unsigned, unsigned);
+
+protected:
+ virtual Image* image(int /*w*/ = 0, int /*h*/ = 0) { return m_cachedImage ? m_cachedImage->image() : nullImage(); }
+ virtual bool errorOccurred() const { return m_cachedImage && m_cachedImage->errorOccurred(); }
+ virtual bool usesImageContainerSize() const { return m_cachedImage ? m_cachedImage->usesImageContainerSize() : false; }
+ virtual void setImageContainerSize(const IntSize& size) const { if (m_cachedImage) m_cachedImage->setImageContainerSize(size); }
+ virtual bool imageHasRelativeWidth() const { return m_cachedImage ? m_cachedImage->imageHasRelativeWidth() : false; }
+ virtual bool imageHasRelativeHeight() const { return m_cachedImage ? m_cachedImage->imageHasRelativeHeight() : false; }
+ virtual IntSize imageSize(float multiplier) const { return m_cachedImage ? m_cachedImage->imageSize(multiplier) : IntSize(); }
+ virtual WrappedImagePtr imagePtr() const { return m_cachedImage.get(); }
+
+ virtual void intrinsicSizeChanged() { imageChanged(imagePtr()); }
+
+private:
+ int calcAspectRatioWidth() const;
+ int calcAspectRatioHeight() const;
+
+ bool isWidthSpecified() const;
+ bool isHeightSpecified() const;
+
+protected:
+ // The image we are rendering.
+ CachedResourceHandle<CachedImage> m_cachedImage;
+
+ // Text to display as long as the image isn't available.
+ String m_altText;
+
+ static Image* nullImage();
+
+ friend class RenderImageScaleObserver;
+};
+
+} // namespace WebCore
+
+#endif // RenderImage_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RenderImageGeneratedContent_h
+#define RenderImageGeneratedContent_h
+
+#include "RenderImage.h"
+#include <wtf/RefPtr.h>
+
+#include "RenderStyle.h"
+
+namespace WebCore {
+
+class StyleImage;
+
+class RenderImageGeneratedContent : public RenderImage
+{
+public:
+ RenderImageGeneratedContent(Node*);
+ virtual ~RenderImageGeneratedContent();
+
+ void setStyleImage(StyleImage*);
+
+ virtual bool hasImage() const { return true; }
+
+protected:
+ virtual Image* image(int w = 0, int h = 0) { return m_styleImage->image(this, IntSize(w, h)); }
+ virtual bool errorOccurred() const { return m_styleImage->errorOccurred(); }
+ virtual bool usesImageContainerSize() const { return m_styleImage->usesImageContainerSize(); }
+ virtual void setImageContainerSize(const IntSize& size) const { m_styleImage->setImageContainerSize(size); }
+ virtual bool imageHasRelativeWidth() const { return m_styleImage->imageHasRelativeWidth(); }
+ virtual bool imageHasRelativeHeight() const { return m_styleImage->imageHasRelativeHeight(); }
+ virtual IntSize imageSize(float multiplier) const { return m_styleImage->imageSize(this, multiplier); }
+ virtual WrappedImagePtr imagePtr() const { return m_styleImage->data(); }
+
+private:
+ RefPtr<StyleImage> m_styleImage;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * This file is part of the render object implementation for KHTML.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderInline_h
+#define RenderInline_h
+
+#include "RenderFlow.h"
+
+namespace WebCore {
+
+class Position;
+
+class RenderInline : public RenderFlow {
+public:
+ RenderInline(Node*);
+ virtual ~RenderInline();
+
+ virtual const char* renderName() const;
+
+ virtual bool isRenderInline() const { return true; }
+ virtual bool childrenInline() const { return true; }
+
+ virtual bool isInlineContinuation() const;
+
+ virtual void addChildToFlow(RenderObject* newChild, RenderObject* beforeChild);
+ void splitInlines(RenderBlock* fromBlock, RenderBlock* toBlock, RenderBlock* middleBlock,
+ RenderObject* beforeChild, RenderFlow* oldCont);
+ void splitFlow(RenderObject* beforeChild, RenderBlock* newBlockBox,
+ RenderObject* newChild, RenderFlow* oldCont);
+
+ virtual void layout() { } // Do nothing for layout()
+
+ virtual void paint(PaintInfo&, int tx, int ty);
+
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
+
+ virtual bool requiresLayer() const { return isRelPositioned() || isTransparent() || hasMask(); }
+
+ virtual int offsetLeft() const;
+ virtual int offsetTop() const;
+ virtual int offsetWidth() const { return linesBoundingBox().width(); }
+ virtual int offsetHeight() const { return linesBoundingBox().height(); }
+
+ void absoluteRects(Vector<IntRect>&, int tx, int ty, bool topLevel = true);
+ virtual void absoluteQuads(Vector<FloatQuad>&, bool topLevel = true);
+
+ virtual IntRect clippedOverflowRectForRepaint(RenderBox* repaintContainer);
+
+ virtual VisiblePosition positionForCoordinates(int x, int y);
+
+ IntRect linesBoundingBox() const;
+
+ virtual IntRect borderBoundingBox() const
+ {
+ IntRect boundingBox = linesBoundingBox();
+ return IntRect(0, 0, boundingBox.width(), boundingBox.height());
+ }
+
+protected:
+ virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+
+ static RenderInline* cloneInline(RenderFlow* src);
+
+};
+
+} // namespace WebCore
+
+#endif // RenderInline_h
--- /dev/null
+/*
+ * Copyright (C) 2003 Apple Computer, Inc.
+ *
+ * Portions are Copyright (C) 1998 Netscape Communications Corporation.
+ *
+ * Other contributors:
+ * Robert O'Callahan <roc+@cs.cmu.edu>
+ * David Baron <dbaron@fas.harvard.edu>
+ * Christian Biesinger <cbiesinger@web.de>
+ * Randall Jesup <rjesup@wgate.com>
+ * Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
+ * Josh Soref <timeless@mac.com>
+ * Boris Zbarsky <bzbarsky@mit.edu>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of either the Mozilla Public License Version 1.1, found at
+ * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
+ * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
+ * (the "GPL"), in which case the provisions of the MPL or the GPL are
+ * applicable instead of those above. If you wish to allow use of your
+ * version of this file only under the terms of one of those two
+ * licenses (the MPL or the GPL) and not to allow others to use your
+ * version of this file under the LGPL, indicate your decision by
+ * deletingthe provisions above and replace them with the notice and
+ * other provisions required by the MPL or the GPL, as the case may be.
+ * If you do not delete the provisions above, a recipient may use your
+ * version of this file under any of the LGPL, the MPL or the GPL.
+ */
+
+#ifndef RenderLayer_h
+#define RenderLayer_h
+
+#include "ScrollbarClient.h"
+#include "RenderBox.h"
+#include "Timer.h"
+#include <wtf/OwnPtr.h>
+
+namespace WebCore {
+
+class CachedResource;
+class HitTestResult;
+class HitTestingTransformState;
+class RenderFrameSet;
+class RenderMarquee;
+class RenderReplica;
+class RenderScrollbarPart;
+class RenderStyle;
+class RenderTable;
+class RenderText;
+class RenderView;
+class Scrollbar;
+class TransformationMatrix;
+
+#if USE(ACCELERATED_COMPOSITING)
+class RenderLayerBacking;
+class RenderLayerCompositor;
+#endif
+
+struct HitTestRequest;
+
+class ClipRects {
+public:
+ ClipRects()
+ : m_refCnt(0)
+ , m_fixed(false)
+ {
+ }
+
+ ClipRects(const IntRect& r)
+ : m_overflowClipRect(r)
+ , m_fixedClipRect(r)
+ , m_posClipRect(r)
+ , m_refCnt(0)
+ , m_fixed(false)
+ {
+ }
+
+ ClipRects(const ClipRects& other)
+ : m_overflowClipRect(other.overflowClipRect())
+ , m_fixedClipRect(other.fixedClipRect())
+ , m_posClipRect(other.posClipRect())
+ , m_refCnt(0)
+ , m_fixed(other.fixed())
+ {
+ }
+
+ void reset(const IntRect& r)
+ {
+ m_overflowClipRect = r;
+ m_fixedClipRect = r;
+ m_posClipRect = r;
+ m_fixed = false;
+ }
+
+ const IntRect& overflowClipRect() const { return m_overflowClipRect; }
+ void setOverflowClipRect(const IntRect& r) { m_overflowClipRect = r; }
+
+ const IntRect& fixedClipRect() const { return m_fixedClipRect; }
+ void setFixedClipRect(const IntRect&r) { m_fixedClipRect = r; }
+
+ const IntRect& posClipRect() const { return m_posClipRect; }
+ void setPosClipRect(const IntRect& r) { m_posClipRect = r; }
+
+ bool fixed() const { return m_fixed; }
+ void setFixed(bool fixed) { m_fixed = fixed; }
+
+ void ref() { m_refCnt++; }
+ void deref(RenderArena* renderArena) { if (--m_refCnt == 0) destroy(renderArena); }
+
+ void destroy(RenderArena*);
+
+ // Overloaded new operator.
+ void* operator new(size_t, RenderArena*) throw();
+
+ // Overridden to prevent the normal delete from being called.
+ void operator delete(void*, size_t);
+
+ bool operator==(const ClipRects& other) const
+ {
+ return m_overflowClipRect == other.overflowClipRect() &&
+ m_fixedClipRect == other.fixedClipRect() &&
+ m_posClipRect == other.posClipRect() &&
+ m_fixed == other.fixed();
+ }
+
+ ClipRects& operator=(const ClipRects& other)
+ {
+ m_overflowClipRect = other.overflowClipRect();
+ m_fixedClipRect = other.fixedClipRect();
+ m_posClipRect = other.posClipRect();
+ m_fixed = other.fixed();
+ return *this;
+ }
+
+ static IntRect infiniteRect() { return IntRect(INT_MIN/2, INT_MIN/2, INT_MAX, INT_MAX); }
+
+private:
+ // The normal operator new is disallowed on all render objects.
+ void* operator new(size_t) throw();
+
+private:
+ IntRect m_overflowClipRect;
+ IntRect m_fixedClipRect;
+ IntRect m_posClipRect;
+ unsigned m_refCnt : 31;
+ bool m_fixed : 1;
+};
+
+class RenderLayer : public ScrollbarClient {
+public:
+ enum ScrollBehavior {
+ noScroll,
+ alignCenter,
+ alignTop,
+ alignBottom,
+ alignLeft,
+ alignRight,
+ alignToClosestEdge
+ };
+
+ struct ScrollAlignment {
+ ScrollBehavior m_rectVisible;
+ ScrollBehavior m_rectHidden;
+ ScrollBehavior m_rectPartial;
+ };
+
+ friend class RenderReplica;
+
+ static const ScrollAlignment gAlignCenterIfNeeded;
+ static const ScrollAlignment gAlignToEdgeIfNeeded;
+ static const ScrollAlignment gAlignCenterAlways;
+ static const ScrollAlignment gAlignTopAlways;
+ static const ScrollAlignment gAlignBottomAlways;
+
+ static ScrollBehavior getVisibleBehavior(const ScrollAlignment& s) { return s.m_rectVisible; }
+ static ScrollBehavior getPartialBehavior(const ScrollAlignment& s) { return s.m_rectPartial; }
+ static ScrollBehavior getHiddenBehavior(const ScrollAlignment& s) { return s.m_rectHidden; }
+
+ RenderLayer(RenderBox*);
+ ~RenderLayer();
+
+ RenderBox* renderer() const { return m_renderer; }
+ RenderLayer* parent() const { return m_parent; }
+ RenderLayer* previousSibling() const { return m_previous; }
+ RenderLayer* nextSibling() const { return m_next; }
+ RenderLayer* firstChild() const { return m_first; }
+ RenderLayer* lastChild() const { return m_last; }
+
+ void addChild(RenderLayer* newChild, RenderLayer* beforeChild = 0);
+ RenderLayer* removeChild(RenderLayer*);
+
+ void removeOnlyThisLayer();
+ void insertOnlyThisLayer();
+
+ void repaintIncludingDescendants();
+
+#if USE(ACCELERATED_COMPOSITING)
+ // Indicate that the layer contents need to be repainted. Only has an effect
+ // if layer compositing is being used,
+ void setBackingNeedsRepaint();
+ void setBackingNeedsRepaintInRect(const IntRect& r); // r is in the coordinate space of the layer's render object
+ void repaintIncludingNonCompositingDescendants(RenderBox* repaintContainer);
+#endif
+
+ void styleChanged(StyleDifference, const RenderStyle*);
+
+ RenderMarquee* marquee() const { return m_marquee; }
+
+ bool isNormalFlowOnly() const { return m_isNormalFlowOnly; }
+ bool isSelfPaintingLayer() const;
+
+ bool requiresSlowRepaints() const;
+
+ bool isTransparent() const;
+ RenderLayer* transparentPaintingAncestor();
+ void beginTransparencyLayers(GraphicsContext*, const RenderLayer* rootLayer);
+
+ bool hasReflection() const { return renderer()->hasReflection(); }
+ RenderReplica* reflection() const { return m_reflection; }
+ RenderLayer* reflectionLayer() const;
+
+ const RenderLayer* root() const
+ {
+ const RenderLayer* curr = this;
+ while (curr->parent())
+ curr = curr->parent();
+ return curr;
+ }
+
+ int xPos() const { return m_x; }
+ int yPos() const { return m_y; }
+ void setPos(int xPos, int yPos)
+ {
+ m_x = xPos;
+ m_y = yPos;
+ }
+
+ int width() const { return m_width; }
+ int height() const { return m_height; }
+ void setWidth(int w) { m_width = w; }
+ void setHeight(int h) { m_height = h; }
+
+ int scrollWidth();
+ int scrollHeight();
+
+ void panScrollFromPoint(const IntPoint&);
+
+ // Scrolling methods for layers that can scroll their overflow.
+ void scrollByRecursively(int xDelta, int yDelta);
+ void addScrolledContentOffset(int& x, int& y) const;
+ void subtractScrolledContentOffset(int& x, int& y) const;
+ IntSize scrolledContentOffset() const { return IntSize(scrollXOffset() + m_scrollLeftOverflow, scrollYOffset()); }
+
+ int scrollXOffset() const { return m_scrollX + m_scrollOriginX; }
+ int scrollYOffset() const { return m_scrollY; }
+
+ void scrollToOffset(int x, int y, bool updateScrollbars = true, bool repaint = true);
+ void scrollToXOffset(int x) { scrollToOffset(x, m_scrollY); }
+ void scrollToYOffset(int y) { scrollToOffset(m_scrollX + m_scrollOriginX, y); }
+ void scrollRectToVisible(const IntRect&, bool scrollToAnchor = false, const ScrollAlignment& alignX = gAlignCenterIfNeeded, const ScrollAlignment& alignY = gAlignCenterIfNeeded);
+
+ IntRect getRectToExpose(const IntRect& visibleRect, const IntRect& exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& alignY);
+
+ void setHasHorizontalScrollbar(bool);
+ void setHasVerticalScrollbar(bool);
+
+ PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation);
+ void destroyScrollbar(ScrollbarOrientation);
+
+ Scrollbar* horizontalScrollbar() const { return m_hBar.get(); }
+ Scrollbar* verticalScrollbar() const { return m_vBar.get(); }
+
+ int verticalScrollbarWidth() const;
+ int horizontalScrollbarHeight() const;
+
+ void positionOverflowControls(int tx, int ty);
+ bool isPointInResizeControl(const IntPoint& absolutePoint) const;
+ bool hitTestOverflowControls(HitTestResult&);
+ IntSize offsetFromResizeCorner(const IntPoint& absolutePoint) const;
+
+ void paintOverflowControls(GraphicsContext*, int tx, int ty, const IntRect& damageRect);
+ void paintScrollCorner(GraphicsContext*, int tx, int ty, const IntRect& damageRect);
+ void paintResizer(GraphicsContext*, int tx, int ty, const IntRect& damageRect);
+
+ void updateScrollInfoAfterLayout();
+
+ bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1.0f);
+ void autoscroll();
+
+ void resize(const PlatformMouseEvent&, const IntSize&);
+ bool inResizeMode() const { return m_inResizeMode; }
+ void setInResizeMode(bool b) { m_inResizeMode = b; }
+
+ bool isRootLayer() const { return renderer()->isRenderView(); }
+
+#if USE(ACCELERATED_COMPOSITING)
+ RenderLayerCompositor* compositor() const;
+
+ // Notification from the renderer that its content changed (e.g. current frame of image changed).
+ // Allows updates of layer content without repainting.
+ void rendererContentChanged();
+#endif
+
+ void updateLayerPosition();
+ void updateLayerPositions(bool doFullRepaint = false, bool checkForRepaint = true);
+
+ void updateTransform();
+
+ void relativePositionOffset(int& relX, int& relY) const { relX += m_relX; relY += m_relY; }
+ IntSize relativePositionOffset() const { return IntSize(m_relX, m_relY); }
+
+ void clearClipRectsIncludingDescendants();
+ void clearClipRects();
+
+ // Get the enclosing stacking context for this layer. A stacking context is a layer
+ // that has a non-auto z-index.
+ RenderLayer* stackingContext() const;
+ bool isStackingContext() const { return !hasAutoZIndex() || renderer()->isRenderView(); }
+
+ void dirtyZOrderLists();
+ void dirtyStackingContextZOrderLists();
+ void updateZOrderLists();
+ Vector<RenderLayer*>* posZOrderList() const { return m_posZOrderList; }
+ Vector<RenderLayer*>* negZOrderList() const { return m_negZOrderList; }
+
+ void dirtyNormalFlowList();
+ void updateNormalFlowList();
+ Vector<RenderLayer*>* normalFlowList() const { return m_normalFlowList; }
+
+ bool hasVisibleContent() const { return m_hasVisibleContent; }
+ void setHasVisibleContent(bool);
+ void dirtyVisibleContentStatus();
+
+ // Gets the nearest enclosing positioned ancestor layer (also includes
+ // the <html> layer and the root layer).
+ RenderLayer* enclosingPositionedAncestor() const;
+
+#if USE(ACCELERATED_COMPOSITING)
+ // Enclosing compositing layer; if includeSelf is true, may return this.
+ RenderLayer* enclosingCompositingLayer(bool includeSelf = true) const;
+ // Ancestor compositing layer, excluding this.
+ RenderLayer* ancestorCompositingLayer() const { return enclosingCompositingLayer(false); }
+#endif
+
+ void convertToLayerCoords(const RenderLayer* ancestorLayer, int& x, int& y) const;
+
+ bool hasAutoZIndex() const { return renderer()->style()->hasAutoZIndex(); }
+ int zIndex() const { return renderer()->style()->zIndex(); }
+
+ // The two main functions that use the layer system. The paint method
+ // paints the layers that intersect the damage rect from back to
+ // front. The hitTest method looks for mouse events by walking
+ // layers that intersect the point from front to back.
+ void paint(GraphicsContext*, const IntRect& damageRect, PaintRestriction = PaintRestrictionNone, RenderObject* paintingRoot = 0);
+ bool hitTest(const HitTestRequest&, HitTestResult&);
+
+ // This method figures out our layerBounds in coordinates relative to
+ // |rootLayer}. It also computes our background and foreground clip rects
+ // for painting/event handling.
+ void calculateRects(const RenderLayer* rootLayer, const IntRect& paintDirtyRect, IntRect& layerBounds,
+ IntRect& backgroundRect, IntRect& foregroundRect, IntRect& outlineRect, bool temporaryClipRects = false) const;
+
+ // Compute and cache clip rects computed with the given layer as the root
+ void updateClipRects(const RenderLayer* rootLayer);
+ // Compute and return the clip rects. If useCached is true, will used previously computed clip rects on ancestors
+ // (rather than computing them all from scratch up the parent chain).
+ void calculateClipRects(const RenderLayer* rootLayer, ClipRects&, bool useCached = false) const;
+ ClipRects* clipRects() const { return m_clipRects; }
+
+ IntRect childrenClipRect() const; // Returns the foreground clip rect of the layer in the document's coordinate space.
+ IntRect selfClipRect() const; // Returns the background clip rect of the layer in the document's coordinate space.
+
+ bool intersectsDamageRect(const IntRect& layerBounds, const IntRect& damageRect, const RenderLayer* rootLayer) const;
+
+ // Bounding box relative to some ancestor layer.
+ IntRect boundingBox(const RenderLayer* rootLayer) const;
+ // Bounding box in the coordinates of this layer.
+ IntRect localBoundingBox() const;
+ // Bounding box relative to the root.
+ IntRect absoluteBoundingBox() const;
+
+ void updateHoverActiveState(const HitTestRequest&, HitTestResult&);
+
+ // Return a cached repaint rect, computed relative to the layer renderer's containerForRepaint.
+ IntRect repaintRect() const { return m_repaintRect; }
+ void setNeedsFullRepaint(bool f = true) { m_needsFullRepaint = f; }
+
+ int staticX() const { return m_staticX; }
+ int staticY() const { return m_staticY; }
+ void setStaticX(int staticX) { m_staticX = staticX; }
+ void setStaticY(int staticY) { m_staticY = staticY; }
+
+ bool adjustForPurpleCaretWhenScrolling() const { return m_adjustForPurpleCaretWhenScrolling; }
+ void setAdjustForPurpleCaretWhenScrolling(bool b) { m_adjustForPurpleCaretWhenScrolling = b; }
+
+ bool hasTransform() const { return renderer()->hasTransform(); }
+ // Note that this transform has the transform-origin baked in.
+ TransformationMatrix* transform() const { return m_transform.get(); }
+ // currentTransform computes a transform which takes accelerated animations into account. The
+ // resulting transform has transform-origin baked in. If the layer does not have a transform,
+ // returns the identity matrix.
+ TransformationMatrix currentTransform() const;
+
+ // Get the perspective transform, which is applied to transformed sublayers.
+ // Returns true if the layer has a -webkit-perspective.
+ // Note that this transform has the perspective-origin baked in.
+ TransformationMatrix perspectiveTransform() const;
+ FloatPoint perspectiveOrigin() const;
+ bool preserves3D() const { return renderer()->style()->transformStyle3D() == TransformStyle3DPreserve3D; }
+ bool has3DTransform() const { return m_transform && !m_transform->isAffine(); }
+
+ void destroy(RenderArena*);
+
+ // Overloaded new operator. Derived classes must override operator new
+ // in order to allocate out of the RenderArena.
+ void* operator new(size_t, RenderArena*) throw();
+
+ // Overridden to prevent the normal delete from being called.
+ void operator delete(void*, size_t);
+
+#if USE(ACCELERATED_COMPOSITING)
+ bool isComposited() const { return m_backing != 0; }
+ RenderLayerBacking* backing() const { return m_backing.get(); }
+ RenderLayerBacking* ensureBacking();
+ void clearBacking();
+#else
+ bool isComposited() const { return false; }
+#endif
+
+ bool paintsWithTransparency() const
+ {
+ return isTransparent() && !isComposited();
+ }
+
+ bool paintsWithTransform() const
+ {
+ return transform() && !isComposited();
+ }
+
+private:
+ // The normal operator new is disallowed on all render objects.
+ void* operator new(size_t) throw();
+
+private:
+ void setNextSibling(RenderLayer* next) { m_next = next; }
+ void setPreviousSibling(RenderLayer* prev) { m_previous = prev; }
+ void setParent(RenderLayer* parent);
+ void setFirstChild(RenderLayer* first) { m_first = first; }
+ void setLastChild(RenderLayer* last) { m_last = last; }
+
+ void collectLayers(Vector<RenderLayer*>*&, Vector<RenderLayer*>*&);
+
+ void updateLayerListsIfNeeded();
+
+ void paintLayer(RenderLayer* rootLayer, GraphicsContext*, const IntRect& paintDirtyRect,
+ bool haveTransparency, PaintRestriction, RenderObject* paintingRoot,
+ bool appliedTransform = false, bool temporaryClipRects = false);
+
+ RenderLayer* hitTestLayer(RenderLayer* rootLayer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult& result,
+ const IntRect& hitTestRect, const IntPoint& hitTestPoint, bool appliedTransform,
+ const HitTestingTransformState* transformState = 0, double* zOffset = 0);
+
+ PassRefPtr<HitTestingTransformState> createLocalTransformState(RenderLayer* rootLayer, RenderLayer* containerLayer,
+ const IntRect& hitTestRect, const IntPoint& hitTestPoint,
+ const HitTestingTransformState* containerTransformState) const;
+
+ bool hitTestContents(const HitTestRequest&, HitTestResult&, const IntRect& layerBounds, const IntPoint& hitTestPoint, HitTestFilter) const;
+
+ void computeScrollDimensions(bool* needHBar = 0, bool* needVBar = 0);
+
+ bool shouldBeNormalFlowOnly() const;
+
+ virtual void valueChanged(Scrollbar*);
+ virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&);
+ virtual bool isActive() const;
+ virtual bool scrollbarCornerPresent() const;
+
+ void updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow);
+
+ void childVisibilityChanged(bool newVisibility);
+ void dirtyVisibleDescendantStatus();
+ void updateVisibilityStatus();
+
+ // This flag is computed by RenderLayerCompositor, which knows more about 3d hierarchies than we do.
+ void setHas3DTransformedDescendant(bool b) { m_has3DTransformedDescendant = b; }
+ bool has3DTransformedDescendant() const { return m_has3DTransformedDescendant; }
+
+ void dirty3DTransformedDescendantStatus();
+ // Both updates the status, and returns true if descendants of this have 3d.
+ bool update3DTransformedDescendantStatus();
+
+ Node* enclosingElement() const;
+
+ void createReflection();
+ void updateReflectionStyle();
+ bool paintingInsideReflection() const { return m_paintingInsideReflection; }
+
+ void parentClipRects(const RenderLayer* rootLayer, ClipRects&, bool temporaryClipRects = false) const;
+
+ RenderLayer* enclosingTransformedAncestor() const;
+
+ // Convert a point in absolute coords into layer coords, taking transforms into account
+ IntPoint absoluteToContents(const IntPoint&) const;
+
+ void updateScrollCornerStyle();
+ void updateResizerStyle();
+
+#if USE(ACCELERATED_COMPOSITING)
+ bool hasCompositingDescendant() const { return m_hasCompositingDescendant; }
+ void setHasCompositingDescendant(bool b) { m_hasCompositingDescendant = b; }
+
+ bool mustOverlayCompositedLayers() const { return m_mustOverlayCompositedLayers; }
+ void setMustOverlayCompositedLayers(bool b) { m_mustOverlayCompositedLayers = b; }
+#endif
+
+#if USE(ACCELERATED_COMPOSITING)
+ void setDocumentScale(float);
+#endif
+
+private:
+ friend class RenderLayerBacking;
+ friend class RenderLayerCompositor;
+
+protected:
+ RenderBox* m_renderer;
+
+ RenderLayer* m_parent;
+ RenderLayer* m_previous;
+ RenderLayer* m_next;
+ RenderLayer* m_first;
+ RenderLayer* m_last;
+
+ IntRect m_repaintRect; // Cached repaint rects. Used by layout.
+ IntRect m_outlineBox;
+
+ // Our current relative position offset.
+ int m_relX;
+ int m_relY;
+
+ // Our (x,y) coordinates are in our parent layer's coordinate space.
+ int m_x;
+ int m_y;
+
+ // The layer's width/height
+ int m_width;
+ int m_height;
+
+ // Our scroll offsets if the view is scrolled.
+ int m_scrollX;
+ int m_scrollY;
+ int m_scrollOriginX; // only non-zero for rtl content
+ int m_scrollLeftOverflow; // only non-zero for rtl content
+
+ // The width/height of our scrolled area.
+ int m_scrollWidth;
+ int m_scrollHeight;
+
+ // For layers with overflow, we have a pair of scrollbars.
+ RefPtr<Scrollbar> m_hBar;
+ RefPtr<Scrollbar> m_vBar;
+
+ // Keeps track of whether the layer is currently resizing, so events can cause resizing to start and stop.
+ bool m_inResizeMode;
+
+ // For layers that establish stacking contexts, m_posZOrderList holds a sorted list of all the
+ // descendant layers within the stacking context that have z-indices of 0 or greater
+ // (auto will count as 0). m_negZOrderList holds descendants within our stacking context with negative
+ // z-indices.
+ Vector<RenderLayer*>* m_posZOrderList;
+ Vector<RenderLayer*>* m_negZOrderList;
+
+ // This list contains child layers that cannot create stacking contexts. For now it is just
+ // overflow layers, but that may change in the future.
+ Vector<RenderLayer*>* m_normalFlowList;
+
+ ClipRects* m_clipRects; // Cached clip rects used when painting and hit testing.
+#ifndef NDEBUG
+ const RenderLayer* m_clipRectsRoot; // Root layer used to compute clip rects.
+#endif
+
+ bool m_scrollDimensionsDirty : 1;
+ bool m_zOrderListsDirty : 1;
+ bool m_normalFlowListDirty: 1;
+ bool m_isNormalFlowOnly : 1;
+
+ bool m_usedTransparency : 1; // Tracks whether we need to close a transparent layer, i.e., whether
+ // we ended up painting this layer or any descendants (and therefore need to
+ // blend).
+ bool m_paintingInsideReflection : 1; // A state bit tracking if we are painting inside a replica.
+ bool m_inOverflowRelayout : 1;
+ bool m_needsFullRepaint : 1;
+
+ bool m_overflowStatusDirty : 1;
+ bool m_horizontalOverflow : 1;
+ bool m_verticalOverflow : 1;
+ bool m_visibleContentStatusDirty : 1;
+ bool m_hasVisibleContent : 1;
+ bool m_visibleDescendantStatusDirty : 1;
+ bool m_hasVisibleDescendant : 1;
+
+ bool m_3DTransformedDescendantStatusDirty : 1;
+ bool m_has3DTransformedDescendant : 1; // Set on a stacking context layer that has 3D descendants anywhere
+ // in a preserves3D hierarchy. Hint to do 3D-aware hit testing.
+#if USE(ACCELERATED_COMPOSITING)
+ bool m_hasCompositingDescendant : 1;
+ bool m_mustOverlayCompositedLayers : 1;
+#endif
+
+ bool m_adjustForPurpleCaretWhenScrolling : 1;
+
+ RenderMarquee* m_marquee; // Used by layers with overflow:marquee
+
+ // Cached normal flow values for absolute positioned elements with static left/top values.
+ int m_staticX;
+ int m_staticY;
+
+ OwnPtr<TransformationMatrix> m_transform;
+
+ // May ultimately be extended to many replicas (with their own paint order).
+ RenderReplica* m_reflection;
+
+ // Renderers to hold our custom scroll corner and resizer.
+ RenderScrollbarPart* m_scrollCorner;
+ RenderScrollbarPart* m_resizer;
+
+#if USE(ACCELERATED_COMPOSITING)
+ OwnPtr<RenderLayerBacking> m_backing;
+#endif
+};
+
+} // namespace WebCore
+
+#endif // RenderLayer_h
--- /dev/null
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RenderLayerBacking_h
+#define RenderLayerBacking_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "FloatPoint.h"
+#include "FloatPoint3D.h"
+#include "GraphicsLayer.h"
+#include "GraphicsLayerClient.h"
+#include "RenderLayer.h"
+#include "TransformationMatrix.h"
+
+namespace WebCore {
+
+class KeyframeList;
+class RenderLayerCompositor;
+
+// RenderLayerBacking controls the compositing behavior for a single RenderLayer.
+// It holds the various GraphicsLayers, and makes decisions about intra-layer rendering
+// optimizations.
+//
+// There is one RenderLayerBacking for each RenderLayer that is composited.
+
+class RenderLayerBacking : public GraphicsLayerClient {
+public:
+ RenderLayerBacking(RenderLayer*);
+ ~RenderLayerBacking();
+
+ RenderLayer* owningLayer() const { return m_owningLayer; }
+
+ void updateAfterLayout();
+
+ // Returns true if layer configuration changed.
+ bool updateGraphicsLayerConfiguration();
+ void updateGraphicsLayerGeometry();
+ void updateInternalHierarchy();
+
+ GraphicsLayer* graphicsLayer() const { return m_graphicsLayer; }
+
+ // Layer to clip children
+ bool hasClippingLayer() const { return m_clippingLayer != 0; }
+ GraphicsLayer* clippingLayer() const { return m_clippingLayer; }
+
+ // Layer to get clipped by ancestor
+ bool hasAncestorClippingLayer() const { return m_ancestorClippingLayer != 0; }
+ GraphicsLayer* ancestorClippingLayer() const { return m_ancestorClippingLayer; }
+
+ bool hasContentsLayer() const { return m_contentsLayer != 0; }
+ GraphicsLayer* contentsLayer() const { return m_contentsLayer; }
+
+ GraphicsLayer* parentForSublayers() const { return m_clippingLayer ? m_clippingLayer : m_graphicsLayer; }
+ GraphicsLayer* childForSuperlayers() const { return m_ancestorClippingLayer ? m_ancestorClippingLayer : m_graphicsLayer; }
+
+ // RenderLayers with backing normally short-circuit paintLayer() because
+ // their content is rendered via callbacks from GraphicsLayer. However, the document
+ // layer is special, because it has a GraphicsLayer to act as a container for the GraphicsLayers
+ // for descendants, but its contents usually render into the window (in which case this returns true).
+ // This returns false for other layers, and when the document layer actually needs to paint into its backing store
+ // for some reason.
+ bool paintingGoesToWindow() const;
+
+ void setContentsNeedDisplay();
+ // r is in the coordinate space of the layer's render object
+ void setContentsNeedDisplayInRect(const IntRect& r);
+
+ // Notification from the renderer that its content changed; used by RenderImage.
+ void rendererContentChanged();
+
+ // Interface to start, finish, suspend and resume animations and transitions
+ bool startAnimation(double beginTime, const Animation* anim, const KeyframeList& keyframes);
+ bool startTransition(double beginTime, int property, const RenderStyle* fromStyle, const RenderStyle* toStyle);
+ void animationFinished(const String& name, int index, bool reset);
+ void transitionFinished(int property);
+
+ void suspendAnimations();
+ void resumeAnimations();
+
+ FloatPoint graphicsLayerToContentsCoordinates(const GraphicsLayer*, const FloatPoint&);
+ FloatPoint contentsToGraphicsLayerCoordinates(const GraphicsLayer*, const FloatPoint&);
+
+ // GraphicsLayerClient interface
+ virtual void notifyAnimationStarted(const GraphicsLayer*, double startTime);
+
+ virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& clip);
+
+ virtual IntRect contentsBox(const GraphicsLayer*);
+
+ void setDocumentScale(float scale);
+
+private:
+ void createGraphicsLayer();
+ void destroyGraphicsLayer();
+
+ RenderBox* renderer() const { return m_owningLayer->renderer(); }
+ RenderLayerCompositor* compositor() const { return m_owningLayer->compositor(); }
+
+ bool updateClippingLayers(bool needsAncestorClip, bool needsDescendantClip);
+ bool updateContentsLayer(bool needsContentsLayer);
+
+ IntSize contentOffsetInCompostingLayer();
+ // Result is transform origin in pixels.
+ FloatPoint3D computeTransformOrigin(const IntRect& borderBox) const;
+ // Result is perspective origin in pixels.
+ FloatPoint computePerspectiveOrigin(const IntRect& borderBox) const;
+
+ void updateLayerOpacity();
+ void updateLayerTransform();
+
+ // Return the opacity value that this layer should use for compositing.
+ float compositingOpacity(float rendererOpacity) const;
+
+ // Returns true if this RenderLayer only has content that can be rendered directly
+ // by the compositing layer, without drawing (e.g. solid background color).
+ bool isSimpleContainerCompositingLayer() const;
+ // Returns true if we can optimize the RenderLayer to draw the replaced content
+ // directly into a compositing buffer
+ bool canUseDirectCompositing() const;
+ void updateImageContents();
+
+ bool rendererHasBackground() const;
+ const Color& rendererBackgroundColor() const;
+
+ bool hasNonCompositingContent() const;
+
+ void paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*, const IntRect& paintDirtyRect,
+ bool haveTransparency, PaintRestriction paintRestriction, GraphicsLayerPaintingPhase, RenderObject* paintingRoot);
+
+ static int graphicsLayerToCSSProperty(AnimatedPropertyID);
+ static AnimatedPropertyID cssToGraphicsLayerProperty(int);
+
+private:
+ RenderLayer* m_owningLayer;
+
+ GraphicsLayer* m_ancestorClippingLayer; // only used if we are clipped by an ancestor which is not a stacking context
+ GraphicsLayer* m_graphicsLayer;
+ GraphicsLayer* m_contentsLayer; // only used in cases where we need to draw the foreground separately
+ GraphicsLayer* m_clippingLayer; // only used if we have clipping on a stacking context, with compositing children
+
+ IntSize m_compositingContentOffset;
+
+ bool m_hasDirectlyCompositedContent: 1;
+ bool m_compositingContentOffsetDirty: 1;
+};
+
+} // namespace WebCore
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif // RenderLayerBacking_h
--- /dev/null
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RenderLayerCompositor_h
+#define RenderLayerCompositor_h
+
+#include "RenderLayer.h"
+
+namespace WebCore {
+
+#define PROFILE_LAYER_REBUILD 0
+
+class GraphicsLayer;
+
+// RenderLayerCompositor manages the hierarchy of
+// composited RenderLayers. It determines which RenderLayers
+// become compositing, and creates and maintains a hierarchy of
+// GraphicsLayers based on the RenderLayer painting order.
+//
+// There is one RenderLayerCompositor per RenderView.
+
+class RenderLayerCompositor {
+public:
+
+ RenderLayerCompositor(RenderView*);
+ ~RenderLayerCompositor();
+
+ // Return true if this RenderView is in "compositing mode" (i.e. has one or more
+ // composited RenderLayers)
+ bool inCompositingMode() const { return m_compositing; }
+ // This will make a compositing layer at the root automatically, and hook up to
+ // the native view/window system.
+ void enableCompositingMode(bool enable = true);
+
+ void setCompositingLayersNeedUpdate(bool needUpdate = true);
+ bool compositingLayersNeedUpdate() const { return m_compositingLayersNeedUpdate; }
+
+ void scheduleViewUpdate();
+
+ // Rebuild the tree of compositing layers
+ void updateCompositingLayers(RenderLayer* updateRoot = 0);
+
+ // Update the compositing state of the given layer. Returns true if that state changed.
+ enum CompositingChangeRepaint { CompositingChangeRepaintNow, CompositingChangeWillRepaintLater };
+ bool updateLayerCompositingState(RenderLayer*, CompositingChangeRepaint = CompositingChangeRepaintNow);
+
+ // Whether layer's backing needs a graphics layer to do clipping by an ancestor (non-stacking-context parent with overflow).
+ bool clippedByAncestor(RenderLayer*) const;
+ // Whether layer's backing needs a graphics layer to clip z-order children of the given layer.
+ bool clipsCompositingDescendants(const RenderLayer*) const;
+
+ // Whether the given layer needs an extra 'contents' layer.
+ bool needsContentsCompositingLayer(const RenderLayer*) const;
+ // Return the bounding box required for compositing layer and its childern, relative to ancestorLayer.
+ // If layerBoundingBox is not 0, on return it contains the bounding box of this layer only.
+ IntRect calculateCompositedBounds(const RenderLayer* layer, const RenderLayer* ancestorLayer, IntRect* layerBoundingBox = 0);
+
+ // Repaint the appropriate layers when the given RenderLayer starts or stops being composited.
+ void repaintOnCompositingChange(RenderLayer*);
+
+ // Notify us that a layer has been added or removed
+ void layerWasAdded(RenderLayer* parent, RenderLayer* child);
+ void layerWillBeRemoved(RenderLayer* parent, RenderLayer* child);
+
+ // Get the nearest ancestor layer that has overflow or clip, but is not a stacking context
+ RenderLayer* enclosingNonStackingClippingLayer(const RenderLayer* layer) const;
+
+ // Repaint parts of all composited layers that intersect the given absolute rectangle.
+ void repaintCompositedLayersAbsoluteRect(const IntRect&);
+
+ RenderLayer* rootRenderLayer() const;
+ GraphicsLayer* rootPlatformLayer() const;
+
+ void didMoveOnscreen();
+ void willMoveOffscreen();
+
+ void updateRootLayerPosition();
+
+ // Walk the tree looking for layers with 3d transforms. Useful in case you need
+ // to know if there is non-affine content, e.g. for drawing into an image.
+ bool has3DContent() const;
+
+ void setDocumentScale(float, RenderLayer* = 0);
+
+private:
+ // Whether the given RL needs a compositing layer.
+ bool needsToBeComposited(const RenderLayer*) const;
+ // Whether the layer has an intrinsic need for compositing layer.
+ bool requiresCompositingLayer(const RenderLayer*) const;
+
+ // Repaint the given rect (which is layer's coords), and regions of child layers that intersect that rect.
+ void recursiveRepaintLayerRect(RenderLayer* layer, const IntRect& rect);
+
+ void computeCompositingRequirements(RenderLayer*, struct CompositingState&);
+ void rebuildCompositingLayerTree(RenderLayer* layer, struct CompositingState&);
+
+ // Hook compositing layers together
+ void setCompositingParent(RenderLayer* childLayer, RenderLayer* parentLayer);
+ void removeCompositedChildren(RenderLayer*);
+
+ void parentInRootLayer(RenderLayer*);
+
+ bool layerHas3DContent(const RenderLayer*) const;
+
+ void ensureRootPlatformLayer();
+
+ // Whether a running transition or animation enforces the need for a compositing layer.
+ static bool requiresCompositingForAnimation(RenderObject*);
+ static bool requiresCompositingForTransform(RenderObject*);
+
+private:
+ RenderView* m_renderView;
+ GraphicsLayer* m_rootPlatformLayer;
+ bool m_compositing;
+ bool m_rootLayerAttached;
+ bool m_compositingLayersNeedUpdate;
+#if PROFILE_LAYER_REBUILD
+ int m_rootLayerUpdateCount;
+#endif
+};
+
+
+} // namespace WebCore
+
+#endif // RenderLayerCompositor_h
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderLegend_h
+#define RenderLegend_h
+
+#include "RenderBlock.h"
+
+namespace WebCore {
+
+ class RenderLegend : public RenderBlock {
+ public:
+ RenderLegend(Node*);
+
+ virtual const char* renderName() const { return "RenderLegend"; }
+ };
+
+} // namespace WebCore
+
+#endif // RenderLegend_h
--- /dev/null
+/*
+ * This file is part of the select element renderer in WebCore.
+ *
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RenderListBox_h
+#define RenderListBox_h
+
+#include "RenderBlock.h"
+#include "ScrollbarClient.h"
+
+namespace WebCore {
+
+class HTMLSelectElement;
+
+class RenderListBox : public RenderBlock, private ScrollbarClient {
+public:
+ RenderListBox(HTMLSelectElement*);
+ ~RenderListBox();
+
+ virtual const char* renderName() const { return "RenderListBox"; }
+
+ virtual bool isListBox() const { return true; }
+
+ virtual void updateFromElement();
+
+ virtual bool canHaveChildren() const { return false; }
+
+ virtual bool hasControlClip() const { return true; }
+ virtual void paintObject(PaintInfo&, int tx, int ty);
+ virtual IntRect controlClipRect(int tx, int ty) const;
+
+ virtual bool isPointInOverflowControl(HitTestResult&, int x, int y, int tx, int ty);
+
+ virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1.0f);
+
+ virtual void calcPrefWidths();
+ virtual int baselinePosition(bool firstLine, bool isRootLineBox) const;
+ virtual void calcHeight();
+
+ virtual void layout();
+
+ void selectionChanged();
+
+ void setOptionsChanged(bool changed) { m_optionsChanged = changed; }
+
+ int listIndexAtOffset(int x, int y);
+ IntRect itemBoundingBoxRect(int tx, int ty, int index);
+
+ bool scrollToRevealElementAtListIndex(int index);
+ bool listIndexIsVisible(int index);
+
+ virtual bool canBeProgramaticallyScrolled(bool) const { return true; }
+ virtual void autoscroll();
+ virtual void stopAutoscroll();
+
+ virtual bool shouldPanScroll() const { return true; }
+ virtual void panScroll(const IntPoint&);
+
+ int scrollToward(const IntPoint&); // Returns the new index or -1 if no scroll occurred
+
+ virtual int verticalScrollbarWidth() const;
+ virtual int scrollLeft() const;
+ virtual int scrollTop() const;
+ virtual int scrollWidth() const;
+ virtual int scrollHeight() const;
+ virtual void setScrollLeft(int);
+ virtual void setScrollTop(int);
+
+protected:
+ virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+
+private:
+ // ScrollbarClient interface.
+ virtual void valueChanged(Scrollbar*);
+ virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&);
+ virtual bool isActive() const;
+ virtual bool scrollbarCornerPresent() const { return false; } // We don't support resize on list boxes yet. If we did this would have to change.
+
+ void setHasVerticalScrollbar(bool hasScrollbar);
+ PassRefPtr<Scrollbar> createScrollbar();
+ void destroyScrollbar();
+
+ int itemHeight() const;
+ void valueChanged(unsigned listIndex);
+ int size() const;
+ int numVisibleItems() const;
+ int numItems() const;
+ int listHeight() const;
+ void paintScrollbar(PaintInfo&, int tx, int ty);
+ void paintItemForeground(PaintInfo&, int tx, int ty, int listIndex);
+ void paintItemBackground(PaintInfo&, int tx, int ty, int listIndex);
+ void scrollToRevealSelection();
+
+ bool m_optionsChanged;
+ bool m_scrollToRevealSelectionAfterLayout;
+ bool m_inAutoscroll;
+ int m_optionsWidth;
+ int m_indexOffset;
+
+ RefPtr<Scrollbar> m_vBar;
+};
+
+} // namepace WebCore
+
+#endif // RenderListBox_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderListItem_h
+#define RenderListItem_h
+
+#include "RenderBlock.h"
+
+namespace WebCore {
+
+class RenderListMarker;
+
+class RenderListItem : public RenderBlock {
+public:
+ RenderListItem(Node*);
+
+ virtual const char* renderName() const { return "RenderListItem"; }
+
+ virtual bool isListItem() const { return true; }
+
+ virtual void destroy();
+
+ int value() const { if (!m_isValueUpToDate) updateValueNow(); return m_value; }
+ void updateValue();
+
+ bool hasExplicitValue() const { return m_hasExplicitValue; }
+ int explicitValue() const { return m_explicitValue; }
+ void setExplicitValue(int value);
+ void clearExplicitValue();
+
+ virtual bool isEmpty() const;
+ virtual void paint(PaintInfo&, int tx, int ty);
+
+ virtual void layout();
+ virtual void calcPrefWidths();
+
+ virtual void positionListMarker();
+
+ void setNotInList(bool notInList) { m_notInList = notInList; }
+ bool notInList() const { return m_notInList; }
+
+ const String& markerText() const;
+
+protected:
+ virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+
+private:
+ void updateMarkerLocation();
+ inline int calcValue() const;
+ void updateValueNow() const;
+ void explicitValueChanged();
+
+ RenderListMarker* m_marker;
+ int m_explicitValue;
+ mutable int m_value;
+
+ bool m_hasExplicitValue : 1;
+ mutable bool m_isValueUpToDate : 1;
+ bool m_notInList : 1;
+};
+
+} // namespace WebCore
+
+#endif // RenderListItem_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderListMarker_h
+#define RenderListMarker_h
+
+#include "RenderBox.h"
+
+namespace WebCore {
+
+class RenderListItem;
+
+String listMarkerText(EListStyleType, int value);
+
+// Used to render the list item's marker.
+// The RenderListMarker always has to be a child of a RenderListItem.
+class RenderListMarker : public RenderBox {
+public:
+ RenderListMarker(RenderListItem*);
+ ~RenderListMarker();
+
+ virtual const char* renderName() const { return "RenderListMarker"; }
+
+ virtual bool isListMarker() const { return true; }
+
+ virtual void paint(PaintInfo&, int tx, int ty);
+
+ virtual void layout();
+ virtual void calcPrefWidths();
+
+ virtual void imageChanged(WrappedImagePtr, const IntRect* = 0);
+
+ virtual InlineBox* createInlineBox(bool, bool, bool);
+
+ virtual int lineHeight(bool firstLine, bool isRootLineBox = false) const;
+ virtual int baselinePosition(bool firstLine, bool isRootLineBox = false) const;
+
+ bool isImage() const;
+ bool isText() const { return !isImage(); }
+ const String& text() const { return m_text; }
+
+ bool isInside() const;
+
+ virtual SelectionState selectionState() const { return m_selectionState; }
+ virtual void setSelectionState(SelectionState);
+ virtual IntRect selectionRectForRepaint(RenderBox* repaintContainer, bool clipToVisibleContent = true);
+ virtual bool canBeSelectionLeaf() const { return true; }
+
+ void updateMargins();
+
+protected:
+ virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
+ virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+
+private:
+ IntRect getRelativeMarkerRect();
+
+ String m_text;
+ RefPtr<StyleImage> m_image;
+ RenderListItem* m_listItem;
+ SelectionState m_selectionState;
+};
+
+} // namespace WebCore
+
+#endif // RenderListMarker_h
--- /dev/null
+/*
+ * Copyright (C) 2003 Apple Computer, Inc.
+ *
+ * Portions are Copyright (C) 1998 Netscape Communications Corporation.
+ *
+ * Other contributors:
+ * Robert O'Callahan <roc+@cs.cmu.edu>
+ * David Baron <dbaron@fas.harvard.edu>
+ * Christian Biesinger <cbiesinger@web.de>
+ * Randall Jesup <rjesup@wgate.com>
+ * Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
+ * Josh Soref <timeless@mac.com>
+ * Boris Zbarsky <bzbarsky@mit.edu>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of either the Mozilla Public License Version 1.1, found at
+ * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
+ * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
+ * (the "GPL"), in which case the provisions of the MPL or the GPL are
+ * applicable instead of those above. If you wish to allow use of your
+ * version of this file only under the terms of one of those two
+ * licenses (the MPL or the GPL) and not to allow others to use your
+ * version of this file under the LGPL, indicate your decision by
+ * deletingthe provisions above and replace them with the notice and
+ * other provisions required by the MPL or the GPL, as the case may be.
+ * If you do not delete the provisions above, a recipient may use your
+ * version of this file under any of the LGPL, the MPL or the GPL.
+ */
+
+#ifndef RenderMarquee_h
+#define RenderMarquee_h
+
+#include "RenderStyle.h"
+#include "Timer.h"
+
+namespace WebCore {
+
+class RenderLayer;
+
+// This class handles the auto-scrolling of layers with overflow: marquee.
+class RenderMarquee {
+public:
+ RenderMarquee(RenderLayer*);
+
+ int speed() const { return m_speed; }
+ int marqueeSpeed() const;
+
+ EMarqueeDirection reverseDirection() const { return static_cast<EMarqueeDirection>(-direction()); }
+ EMarqueeDirection direction() const;
+
+ bool isHorizontal() const;
+
+ int computePosition(EMarqueeDirection, bool stopAtClientEdge);
+
+ void setEnd(int end) { m_end = end; }
+
+ void start();
+ void suspend();
+ void stop();
+
+ void updateMarqueeStyle();
+ void updateMarqueePosition();
+
+private:
+ void timerFired(Timer<RenderMarquee>*);
+
+ RenderLayer* m_layer;
+ int m_currentLoop;
+ int m_totalLoops;
+ Timer<RenderMarquee> m_timer;
+ int m_start;
+ int m_end;
+ int m_speed;
+ Length m_height;
+ bool m_reset: 1;
+ bool m_suspended : 1;
+ bool m_stopped : 1;
+ EMarqueeDirection m_direction : 4;
+};
+
+} // namespace WebCore
+
+#endif // RenderMarquee_h
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RenderMedia_h
+#define RenderMedia_h
+
+#if ENABLE(VIDEO)
+
+#include "RenderReplaced.h"
+#include "Timer.h"
+
+namespace WebCore {
+
+class HTMLInputElement;
+class HTMLMediaElement;
+class MediaControlMuteButtonElement;
+class MediaControlPlayButtonElement;
+class MediaControlSeekButtonElement;
+class MediaControlTimelineElement;
+class MediaControlFullscreenButtonElement;
+class MediaTimeDisplayElement;
+class MediaPlayer;
+
+class RenderMedia : public RenderReplaced {
+public:
+ RenderMedia(HTMLMediaElement*);
+ RenderMedia(HTMLMediaElement*, const IntSize& intrinsicSize);
+ virtual ~RenderMedia();
+
+ virtual RenderObject* firstChild() const;
+ virtual RenderObject* lastChild() const;
+ virtual void removeChild(RenderObject*);
+ virtual void destroy();
+
+ virtual void layout();
+
+ virtual const char* renderName() const { return "RenderMedia"; }
+ virtual bool isMedia() const { return true; }
+
+ HTMLMediaElement* mediaElement() const;
+ MediaPlayer* player() const;
+
+ static String formatTime(float time);
+
+ void updateFromElement();
+ void updatePlayer();
+ void updateControls();
+ void updateTimeDisplay();
+
+ void forwardEvent(Event*);
+
+ virtual int lowestPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
+ virtual int rightmostPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
+ virtual int leftmostPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
+
+private:
+ void createControlsShadowRoot();
+ void destroyControlsShadowRoot();
+ void createPanel();
+ void createMuteButton();
+ void createPlayButton();
+ void createSeekBackButton();
+ void createSeekForwardButton();
+ void createTimelineContainer();
+ void createTimeline();
+ void createCurrentTimeDisplay();
+ void createTimeRemainingDisplay();
+ void createFullscreenButton();
+
+ void timeUpdateTimerFired(Timer<RenderMedia>*);
+
+ void updateControlVisibility();
+ void changeOpacity(HTMLElement*, float opacity);
+ void opacityAnimationTimerFired(Timer<RenderMedia>*);
+
+ RefPtr<HTMLElement> m_controlsShadowRoot;
+ RefPtr<HTMLElement> m_panel;
+ RefPtr<MediaControlMuteButtonElement> m_muteButton;
+ RefPtr<MediaControlPlayButtonElement> m_playButton;
+ RefPtr<MediaControlSeekButtonElement> m_seekBackButton;
+ RefPtr<MediaControlSeekButtonElement> m_seekForwardButton;
+ RefPtr<MediaControlTimelineElement> m_timeline;
+ RefPtr<MediaControlFullscreenButtonElement> m_fullscreenButton;
+ RefPtr<HTMLElement> m_timelineContainer;
+ RefPtr<MediaTimeDisplayElement> m_currentTimeDisplay;
+ RefPtr<MediaTimeDisplayElement> m_timeRemainingDisplay;
+ EventTargetNode* m_lastUnderNode;
+ EventTargetNode* m_nodeUnderMouse;
+
+ Timer<RenderMedia> m_timeUpdateTimer;
+ Timer<RenderMedia> m_opacityAnimationTimer;
+ bool m_mouseOver;
+ double m_opacityAnimationStartTime;
+ float m_opacityAnimationFrom;
+ float m_opacityAnimationTo;
+ EVisibility m_previousVisible;
+};
+
+} // namespace WebCore
+
+#endif
+#endif // RenderMedia_h
--- /dev/null
+/*
+ * This file is part of the select element renderer in WebCore.
+ *
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderMenuList_h
+#define RenderMenuList_h
+
+#include "PopupMenuClient.h"
+#include "RenderFlexibleBox.h"
+
+#if PLATFORM(MAC)
+#define POPUP_MENU_PULLS_DOWN 0
+#else
+#define POPUP_MENU_PULLS_DOWN 1
+#endif
+
+namespace WebCore {
+
+class HTMLSelectElement;
+class PopupMenu;
+class RenderText;
+
+class RenderMenuList : public RenderFlexibleBox, private PopupMenuClient {
+public:
+ RenderMenuList(HTMLSelectElement*);
+ ~RenderMenuList();
+
+ HTMLSelectElement* selectElement();
+
+private:
+ virtual bool isMenuList() const { return true; }
+
+ virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0);
+ virtual void removeChild(RenderObject*);
+ virtual bool createsAnonymousWrapper() const { return true; }
+ virtual bool canHaveChildren() const { return false; }
+
+ virtual void updateFromElement();
+
+ virtual bool hasControlClip() const { return true; }
+ virtual IntRect controlClipRect(int tx, int ty) const;
+
+ virtual const char* renderName() const { return "RenderMenuList"; }
+
+ virtual void calcPrefWidths();
+
+public:
+ void hidePopup();
+
+ void setOptionsChanged(bool changed) { m_optionsChanged = changed; }
+
+ String text() const;
+
+ bool multiple() const;
+
+private:
+ virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+
+ // PopupMenuClient methods
+ virtual String itemText(unsigned listIndex) const;
+ virtual bool itemIsEnabled(unsigned listIndex) const;
+ virtual PopupMenuStyle itemStyle(unsigned listIndex) const;
+ virtual PopupMenuStyle menuStyle() const;
+ virtual int clientInsetLeft() const;
+ virtual int clientInsetRight() const;
+ virtual int clientPaddingLeft() const;
+ virtual int clientPaddingRight() const;
+ virtual int listSize() const;
+ virtual int selectedIndex() const;
+ virtual bool itemIsSeparator(unsigned listIndex) const;
+ virtual bool itemIsLabel(unsigned listIndex) const;
+ virtual bool itemIsSelected(unsigned listIndex) const;
+ virtual void setTextFromItem(unsigned listIndex);
+ virtual bool valueShouldChangeOnHotTrack() const { return true; }
+ virtual bool shouldPopOver() const { return !POPUP_MENU_PULLS_DOWN; }
+ virtual void valueChanged(unsigned listIndex, bool fireOnChange = true);
+ virtual FontSelector* fontSelector() const;
+ virtual HostWindow* hostWindow() const;
+ virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize);
+
+ virtual bool hasLineIfEmpty() const { return true; }
+
+ Color itemBackgroundColor(unsigned listIndex) const;
+
+ void createInnerBlock();
+ void adjustInnerStyle();
+ void setText(const String&);
+ void setTextFromOption(int optionIndex);
+ void updateOptionsWidth();
+
+ RenderText* m_buttonText;
+ RenderBlock* m_innerBlock;
+
+ bool m_optionsChanged;
+ int m_optionsWidth;
+
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderObject_h
+#define RenderObject_h
+
+#include "CachedResourceClient.h"
+#include "FloatQuad.h"
+#include "Document.h"
+#include "RenderStyle.h"
+#include "TransformationMatrix.h"
+#include <wtf/UnusedParam.h>
+
+#include "SelectionRect.h"
+
+namespace WebCore {
+
+class AnimationController;
+class HitTestResult;
+class InlineBox;
+class InlineFlowBox;
+class RenderBlock;
+class RenderFlow;
+class RenderLayer;
+class TransformState;
+class VisiblePosition;
+
+/*
+ * The painting of a layer occurs in three distinct phases. Each phase involves
+ * a recursive descent into the layer's render objects. The first phase is the background phase.
+ * The backgrounds and borders of all blocks are painted. Inlines are not painted at all.
+ * Floats must paint above block backgrounds but entirely below inline content that can overlap them.
+ * In the foreground phase, all inlines are fully painted. Inline replaced elements will get all
+ * three phases invoked on them during this phase.
+ */
+
+enum PaintPhase {
+ PaintPhaseBlockBackground,
+ PaintPhaseChildBlockBackground,
+ PaintPhaseChildBlockBackgrounds,
+ PaintPhaseFloat,
+ PaintPhaseForeground,
+ PaintPhaseOutline,
+ PaintPhaseChildOutlines,
+ PaintPhaseSelfOutline,
+ PaintPhaseSelection,
+ PaintPhaseCollapsedTableBorders,
+ PaintPhaseTextClip,
+ PaintPhaseMask
+};
+
+enum PaintRestriction {
+ PaintRestrictionNone,
+ PaintRestrictionSelectionOnly,
+ PaintRestrictionSelectionOnlyBlackText
+};
+
+enum HitTestFilter {
+ HitTestAll,
+ HitTestSelf,
+ HitTestDescendants
+};
+
+enum HitTestAction {
+ HitTestBlockBackground,
+ HitTestChildBlockBackground,
+ HitTestChildBlockBackgrounds,
+ HitTestFloat,
+ HitTestForeground
+};
+
+// Values for verticalPosition.
+const int PositionTop = -0x7fffffff;
+const int PositionBottom = 0x7fffffff;
+const int PositionUndefined = 0x80000000;
+
+const int caretWidth = 3;
+
+#if ENABLE(DASHBOARD_SUPPORT)
+struct DashboardRegionValue {
+ bool operator==(const DashboardRegionValue& o) const
+ {
+ return type == o.type && bounds == o.bounds && clip == o.clip && label == o.label;
+ }
+ bool operator!=(const DashboardRegionValue& o) const
+ {
+ return !(*this == o);
+ }
+
+ String label;
+ IntRect bounds;
+ IntRect clip;
+ int type;
+};
+#endif
+
+// Base class for all rendering tree objects.
+class RenderObject : public CachedResourceClient {
+ friend class RenderContainer;
+ friend class RenderLayer;
+ friend class RenderSVGContainer;
+public:
+ // Anonymous objects should pass the document as their node, and they will then automatically be
+ // marked as anonymous in the constructor.
+ RenderObject(Node*);
+ virtual ~RenderObject();
+
+ virtual const char* renderName() const { return "RenderObject"; }
+
+ RenderObject* parent() const { return m_parent; }
+ bool isDescendantOf(const RenderObject*) const;
+
+ RenderObject* previousSibling() const { return m_previous; }
+ RenderObject* nextSibling() const { return m_next; }
+
+ virtual RenderObject* firstChild() const { return 0; }
+ virtual RenderObject* lastChild() const { return 0; }
+
+ RenderObject* nextInPreOrder() const;
+ RenderObject* nextInPreOrder(RenderObject* stayWithin) const;
+ RenderObject* nextInPreOrderAfterChildren() const;
+ RenderObject* nextInPreOrderAfterChildren(RenderObject* stayWithin) const;
+ RenderObject* previousInPreOrder() const;
+ RenderObject* childAt(unsigned) const;
+
+ RenderObject* firstLeafChild() const;
+ RenderObject* lastLeafChild() const;
+
+ RenderObject *traverseNext(const RenderObject *stayWithin) const;
+ typedef bool (*TraverseNextInclusionFunction)(const RenderObject *);
+ RenderObject *traverseNext(const RenderObject *stayWithin, TraverseNextInclusionFunction inclusionFunction) const;
+ void adjustComputedFontSizesOnBlocks(float size, float visibleWidth);
+ void resetTextAutosizing();
+
+ // The following five functions are used when the render tree hierarchy changes to make sure layers get
+ // properly added and removed. Since containership can be implemented by any subclass, and since a hierarchy
+ // can contain a mixture of boxes and other object types, these functions need to be in the base class.
+ RenderLayer* enclosingLayer() const;
+
+ void addLayers(RenderLayer* parentLayer, RenderObject* newObject);
+ void removeLayers(RenderLayer* parentLayer);
+ void moveLayers(RenderLayer* oldParent, RenderLayer* newParent);
+ RenderLayer* findNextLayer(RenderLayer* parentLayer, RenderObject* startPoint, bool checkParent = true);
+
+ // Convenience function for getting to the nearest enclosing box of a RenderObject.
+ RenderBox* enclosingBox() const;
+
+ virtual IntRect getOverflowClipRect(int /*tx*/, int /*ty*/) { return IntRect(0, 0, 0, 0); }
+ virtual IntRect getClipRect(int /*tx*/, int /*ty*/) { return IntRect(0, 0, 0, 0); }
+ bool hasClip() { return isPositioned() && style()->hasClip(); }
+
+ virtual int getBaselineOfFirstLineBox() const { return -1; }
+ virtual int getBaselineOfLastLineBox() const { return -1; }
+
+ virtual bool isEmpty() const { return firstChild() == 0; }
+
+ virtual bool isEdited() const { return false; }
+ virtual void setEdited(bool) { }
+
+#ifndef NDEBUG
+ void setHasAXObject(bool flag) { m_hasAXObject = flag; }
+ bool hasAXObject() const { return m_hasAXObject; }
+ bool isSetNeedsLayoutForbidden() const { return m_setNeedsLayoutForbidden; }
+ void setNeedsLayoutIsForbidden(bool flag) { m_setNeedsLayoutForbidden = flag; }
+#endif
+
+ // Obtains the nearest enclosing block (including this block) that contributes a first-line style to our inline
+ // children.
+ virtual RenderBlock* firstLineBlock() const;
+
+ // Called when an object that was floating or positioned becomes a normal flow object
+ // again. We have to make sure the render tree updates as needed to accommodate the new
+ // normal flow object.
+ void handleDynamicFloatPositionChange();
+
+ // This function is a convenience helper for creating an anonymous block that inherits its
+ // style from this RenderObject.
+ RenderBlock* createAnonymousBlock();
+
+ // Whether or not a positioned element requires normal flow x/y to be computed
+ // to determine its position.
+ bool hasStaticX() const;
+ bool hasStaticY() const;
+ virtual void setStaticX(int /*staticX*/) { }
+ virtual void setStaticY(int /*staticY*/) { }
+ virtual int staticX() const { return 0; }
+ virtual int staticY() const { return 0; }
+
+ // RenderObject tree manipulation
+ //////////////////////////////////////////
+ virtual bool canHaveChildren() const;
+ virtual bool isChildAllowed(RenderObject*, RenderStyle*) const { return true; }
+ virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0);
+ virtual void removeChild(RenderObject*);
+ virtual bool createsAnonymousWrapper() const { return false; }
+
+ // raw tree manipulation
+ virtual RenderObject* removeChildNode(RenderObject*, bool fullRemove = true);
+ virtual void appendChildNode(RenderObject*, bool fullAppend = true);
+ virtual void insertChildNode(RenderObject* child, RenderObject* before, bool fullInsert = true);
+ // Designed for speed. Don't waste time doing a bunch of work like layer updating and repainting when we know that our
+ // change in parentage is not going to affect anything.
+ virtual void moveChildNode(RenderObject*);
+ //////////////////////////////////////////
+
+protected:
+ //////////////////////////////////////////
+ // Helper functions. Dangerous to use!
+ void setPreviousSibling(RenderObject* previous) { m_previous = previous; }
+ void setNextSibling(RenderObject* next) { m_next = next; }
+ void setParent(RenderObject* parent) { m_parent = parent; }
+ //////////////////////////////////////////
+private:
+ void addAbsoluteRectForLayer(IntRect& result);
+
+public:
+#ifndef NDEBUG
+ void showTreeForThis() const;
+#endif
+
+ static RenderObject* createObject(Node*, RenderStyle*);
+
+ // Overloaded new operator. Derived classes must override operator new
+ // in order to allocate out of the RenderArena.
+ void* operator new(size_t, RenderArena*) throw();
+
+ // Overridden to prevent the normal delete from being called.
+ void operator delete(void*, size_t);
+
+private:
+ // The normal operator new is disallowed on all render objects.
+ void* operator new(size_t) throw();
+
+public:
+ RenderArena* renderArena() const { return document()->renderArena(); }
+
+ virtual bool isApplet() const { return false; }
+ virtual bool isBR() const { return false; }
+ virtual bool isBlockFlow() const { return false; }
+ virtual bool isBoxModelObject() const { return false; }
+ virtual bool isCounter() const { return false; }
+ virtual bool isFieldset() const { return false; }
+ virtual bool isFrame() const { return false; }
+ virtual bool isFrameSet() const { return false; }
+ virtual bool isImage() const { return false; }
+ virtual bool isInlineBlockOrInlineTable() const { return false; }
+ virtual bool isInlineContinuation() const;
+ virtual bool isListBox() const { return false; }
+ virtual bool isListItem() const { return false; }
+ virtual bool isListMarker() const { return false; }
+ virtual bool isMedia() const { return false; }
+ virtual bool isMenuList() const { return false; }
+ virtual bool isRenderBlock() const { return false; }
+ virtual bool isRenderImage() const { return false; }
+ virtual bool isRenderInline() const { return false; }
+ virtual bool isRenderPart() const { return false; }
+ virtual bool isRenderView() const { return false; }
+ virtual bool isSlider() const { return false; }
+ virtual bool isTable() const { return false; }
+ virtual bool isTableCell() const { return false; }
+ virtual bool isTableCol() const { return false; }
+ virtual bool isTableRow() const { return false; }
+ virtual bool isTableSection() const { return false; }
+ virtual bool isTextArea() const { return false; }
+ virtual bool isTextField() const { return false; }
+ virtual bool isWidget() const { return false; }
+
+ bool isRoot() const { return document()->documentElement() == node(); }
+ bool isBody() const;
+ bool isHR() const;
+
+ bool isHTMLMarquee() const;
+
+ virtual bool childrenInline() const { return false; }
+ virtual void setChildrenInline(bool) { }
+
+ virtual RenderFlow* virtualContinuation() const { return 0; }
+
+#if ENABLE(SVG)
+ virtual bool isSVGRoot() const { return false; }
+ virtual bool isSVGContainer() const { return false; }
+ virtual bool isSVGHiddenContainer() const { return false; }
+ virtual bool isRenderPath() const { return false; }
+ virtual bool isSVGText() const { return false; }
+
+ virtual FloatRect relativeBBox(bool includeStroke = true) const;
+
+ virtual TransformationMatrix localTransform() const;
+ virtual TransformationMatrix absoluteTransform() const;
+#endif
+
+ virtual bool isEditable() const;
+
+ bool isAnonymous() const { return m_isAnonymous; }
+ void setIsAnonymous(bool b) { m_isAnonymous = b; }
+ bool isAnonymousBlock() const
+ {
+ return m_isAnonymous && style()->display() == BLOCK && style()->styleType() == RenderStyle::NOPSEUDO && !isListMarker();
+ }
+
+ bool isFloating() const { return m_floating; }
+ bool isPositioned() const { return m_positioned; } // absolute or fixed positioning
+ bool isRelPositioned() const { return m_relPositioned; } // relative positioning
+ bool isText() const { return m_isText; }
+ bool isBox() const { return m_isBox; }
+ bool isInline() const { return m_inline; } // inline object
+ bool isRunIn() const { return style()->display() == RUN_IN; } // run-in object
+ bool isDragging() const { return m_isDragging; }
+ bool isReplaced() const { return m_replaced; } // a "replaced" element (see CSS)
+
+ bool hasLayer() const { return m_hasLayer; }
+
+ bool hasBoxDecorations() const { return m_paintBackground; }
+ bool mustRepaintBackgroundOrBorder() const;
+
+ bool needsLayout() const { return m_needsLayout || m_normalChildNeedsLayout || m_posChildNeedsLayout || m_needsPositionedMovementLayout; }
+ bool selfNeedsLayout() const { return m_needsLayout; }
+ bool needsPositionedMovementLayout() const { return m_needsPositionedMovementLayout; }
+ bool needsPositionedMovementLayoutOnly() const { return m_needsPositionedMovementLayout && !m_needsLayout && !m_normalChildNeedsLayout && !m_posChildNeedsLayout; }
+ bool posChildNeedsLayout() const { return m_posChildNeedsLayout; }
+ bool normalChildNeedsLayout() const { return m_normalChildNeedsLayout; }
+
+ bool prefWidthsDirty() const { return m_prefWidthsDirty; }
+
+ bool isSelectionBorder() const;
+
+ bool hasOverflowClip() const { return m_hasOverflowClip; }
+ virtual bool hasControlClip() const { return false; }
+ virtual IntRect controlClipRect(int /*tx*/, int /*ty*/) const { return IntRect(); }
+
+ bool hasTransform() const { return m_hasTransform; }
+ bool hasMask() const { return style() && style()->hasMask(); }
+
+public:
+ // The pseudo element style can be cached or uncached. Use the cached method if the pseudo element doesn't respect
+ // any pseudo classes (and therefore has no concept of changing state).
+ RenderStyle* getCachedPseudoStyle(RenderStyle::PseudoId, RenderStyle* parentStyle = 0) const;
+ PassRefPtr<RenderStyle> getUncachedPseudoStyle(RenderStyle::PseudoId, RenderStyle* parentStyle = 0) const;
+
+ void updateDragState(bool dragOn);
+
+ RenderView* view() const;
+
+ // don't even think about making this method virtual!
+ Node* element() const { return m_isAnonymous ? 0 : m_node; }
+ Document* document() const { return m_node->document(); }
+ void setNode(Node* node) { m_node = node; }
+ Node* node() const { return m_node; }
+
+ bool hasOutlineAnnotation() const;
+ bool hasOutline() const { return style()->hasOutline() || hasOutlineAnnotation(); }
+
+ /**
+ * returns the object containing this one. can be different from parent for
+ * positioned elements
+ */
+ RenderObject* container() const;
+ RenderObject* hoverAncestor() const;
+
+ void markContainingBlocksForLayout(bool scheduleRelayout = true, RenderObject* newRoot = 0);
+ void setNeedsLayout(bool b, bool markParents = true);
+ void setChildNeedsLayout(bool b, bool markParents = true);
+ void setNeedsPositionedMovementLayout();
+ void setPrefWidthsDirty(bool, bool markParents = true);
+ void invalidateContainerPrefWidths();
+ virtual void invalidateCounters() { }
+
+ void setNeedsLayoutAndPrefWidthsRecalc()
+ {
+ setNeedsLayout(true);
+ setPrefWidthsDirty(true);
+ }
+
+ void setPositioned(bool b = true) { m_positioned = b; }
+ void setRelPositioned(bool b = true) { m_relPositioned = b; }
+ void setFloating(bool b = true) { m_floating = b; }
+ void setInline(bool b = true) { m_inline = b; }
+ void setHasBoxDecorations(bool b = true) { m_paintBackground = b; }
+ void setIsText() { m_isText = true; }
+ void setIsBox() { m_isBox = true; }
+ void setReplaced(bool b = true) { m_replaced = b; }
+ void setHasOverflowClip(bool b = true) { m_hasOverflowClip = b; }
+ void setHasLayer(bool b = true) { m_hasLayer = b; }
+ void setHasTransform(bool b = true) { m_hasTransform = b; }
+ void setHasReflection(bool b = true) { m_hasReflection = b; }
+
+ void scheduleRelayout();
+
+ void updateFillImages(const FillLayer*, const FillLayer*);
+ void updateImage(StyleImage*, StyleImage*);
+
+ virtual InlineBox* createInlineBox(bool makePlaceHolderBox, bool isRootLineBox, bool isOnlyRun = false);
+ virtual void dirtyLineBoxes(bool fullLayout, bool isRootLineBox = false);
+
+ // for discussion of lineHeight see CSS2 spec
+ virtual int lineHeight(bool firstLine, bool isRootLineBox = false) const;
+ // for the vertical-align property of inline elements
+ // the difference between this objects baseline position and the lines baseline position.
+ virtual int verticalPositionHint(bool firstLine) const;
+ // the offset of baseline from the top of the object.
+ virtual int baselinePosition(bool firstLine, bool isRootLineBox = false) const;
+
+ // Hook so that RenderTextControl can return the line height of its inner renderer.
+ // For other renderers, the value is the same as lineHeight(false).
+ virtual int innerLineHeight() const;
+
+ /*
+ * Paint the object and its children, clipped by (x|y|w|h).
+ * (tx|ty) is the calculated position of the parent
+ */
+ struct PaintInfo {
+ PaintInfo(GraphicsContext* newContext, const IntRect& newRect, PaintPhase newPhase, bool newForceBlackText,
+ RenderObject* newPaintingRoot, ListHashSet<RenderFlow*>* newOutlineObjects)
+ : context(newContext)
+ , rect(newRect)
+ , phase(newPhase)
+ , forceBlackText(newForceBlackText)
+ , paintingRoot(newPaintingRoot)
+ , outlineObjects(newOutlineObjects)
+ {
+ }
+
+ GraphicsContext* context;
+ IntRect rect;
+ PaintPhase phase;
+ bool forceBlackText;
+ RenderObject* paintingRoot; // used to draw just one element and its visual kids
+ ListHashSet<RenderFlow*>* outlineObjects; // used to list outlines that should be painted by a block with inline children
+ };
+
+ virtual void paint(PaintInfo&, int tx, int ty);
+ void paintBorder(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, bool begin = true, bool end = true);
+ bool paintNinePieceImage(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, const NinePieceImage&, CompositeOperator = CompositeSourceOver);
+ void paintBoxShadow(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, bool begin = true, bool end = true);
+
+ // RenderBox implements this.
+ virtual void paintBoxDecorations(PaintInfo&, int /*tx*/, int /*ty*/) { }
+ virtual void paintMask(PaintInfo&, int /*tx*/, int /*ty*/) { }
+ virtual void paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer*,
+ int /*clipY*/, int /*clipH*/, int /*tx*/, int /*ty*/, int /*width*/, int /*height*/,
+ InlineFlowBox* = 0, CompositeOperator = CompositeSourceOver) { }
+
+ /*
+ * Calculates the actual width of the object (only for non inline
+ * objects)
+ */
+ virtual void calcWidth() { }
+
+ /*
+ * This function should cause the Element to calculate its
+ * width and height and the layout of its content
+ *
+ * when the Element calls setNeedsLayout(false), layout() is no
+ * longer called during relayouts, as long as there is no
+ * style sheet change. When that occurs, m_needsLayout will be
+ * set to true and the Element receives layout() calls
+ * again.
+ */
+ virtual void layout() = 0;
+
+ /* This function performs a layout only if one is needed. */
+ void layoutIfNeeded() { if (needsLayout()) layout(); }
+
+ // Called when a positioned object moves but doesn't necessarily change size. A simplified layout is attempted
+ // that just updates the object's position. If the size does change, the object remains dirty.
+ virtual void tryLayoutDoingPositionedMovementOnly() { }
+
+ // used for element state updates that cannot be fixed with a
+ // repaint and do not need a relayout
+ virtual void updateFromElement() { }
+
+ virtual void updateWidgetPosition();
+
+#if ENABLE(DASHBOARD_SUPPORT)
+ void addDashboardRegions(Vector<DashboardRegionValue>&);
+ void collectDashboardRegions(Vector<DashboardRegionValue>&);
+#endif
+
+ bool hitTest(const HitTestRequest&, HitTestResult&, const IntPoint&, int tx, int ty, HitTestFilter = HitTestAll);
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
+ void updateHitTestResult(HitTestResult&, const IntPoint&);
+
+ virtual VisiblePosition positionForCoordinates(int x, int y);
+ VisiblePosition positionForPoint(const IntPoint&);
+
+ virtual void dirtyLinesFromChangedChild(RenderObject*);
+
+ // Called to update a style that is allowed to trigger animations.
+ // FIXME: Right now this will typically be called only when updating happens from the DOM on explicit elements.
+ // We don't yet handle generated content animation such as first-letter or before/after (we'll worry about this later).
+ void setAnimatableStyle(PassRefPtr<RenderStyle>);
+
+ // Set the style of the object and update the state of the object accordingly.
+ virtual void setStyle(PassRefPtr<RenderStyle>);
+
+ // Updates only the local style ptr of the object. Does not update the state of the object,
+ // and so only should be called when the style is known not to have changed (or from setStyle).
+ void setStyleInternal(PassRefPtr<RenderStyle>);
+
+ // returns the containing block level element for this element.
+ RenderBlock* containingBlock() const;
+
+ // return just the width of the containing block
+ virtual int containingBlockWidth() const;
+ // return just the height of the containing block
+ virtual int containingBlockHeight() const;
+
+ // used by flexible boxes to impose a flexed width/height override
+ virtual int overrideSize() const { return 0; }
+ virtual int overrideWidth() const { return 0; }
+ virtual int overrideHeight() const { return 0; }
+ virtual void setOverrideSize(int /*overrideSize*/) { }
+
+ // Convert the given local point to absolute coordinates
+ // FIXME: Temporary. If useTransforms is true, take transforms into account. Eventually localToAbsolute() will always be transform-aware.
+ FloatPoint localToAbsolute(FloatPoint localPoint = FloatPoint(), bool fixed = false, bool useTransforms = false) const;
+ FloatPoint absoluteToLocal(FloatPoint, bool fixed = false, bool useTransforms = false) const;
+
+ // Convert a local quad to absolute coordinates, taking transforms into account.
+ FloatQuad localToAbsoluteQuad(const FloatQuad& quad, bool fixed = false) const
+ {
+ return localToContainerQuad(quad, 0, fixed);
+ }
+ // Convert a local quad into the coordinate system of container, taking transforms into account.
+ FloatQuad localToContainerQuad(const FloatQuad&, RenderBox* repaintContainer, bool fixed = false) const;
+
+ // Return the offset from the container() renderer (excluding transforms)
+ virtual IntSize offsetFromContainer(RenderObject*) const;
+
+ virtual void addLineBoxRects(Vector<IntRect>&, unsigned startOffset = 0, unsigned endOffset = UINT_MAX, bool useSelectionHeight = false);
+ virtual void collectSelectionRects(Vector<SelectionRect>&, unsigned startOffset = 0, unsigned endOffset = UINT_MAX);
+
+ virtual void absoluteRects(Vector<IntRect>&, int, int, bool = true) { }
+ // FIXME: useTransforms should go away eventually
+ IntRect absoluteBoundingBoxRect(bool useTransforms = false);
+
+ // Build an array of quads in absolute coords for line boxes
+ virtual void collectAbsoluteLineBoxQuads(Vector<FloatQuad>&, unsigned /*startOffset*/ = 0, unsigned /*endOffset*/ = UINT_MAX, bool /*useSelectionHeight*/ = false) { }
+ virtual void absoluteQuads(Vector<FloatQuad>&, bool /*topLevel*/ = true) { }
+
+ // the rect that will be painted if this object is passed as the paintingRoot
+ IntRect paintingRootRect(IntRect& topLevelRect);
+
+ virtual int minPrefWidth() const { return 0; }
+ virtual int maxPrefWidth() const { return 0; }
+
+ RenderStyle* style() const { return m_style.get(); }
+ RenderStyle* firstLineStyle() const;
+ RenderStyle* style(bool firstLine) const { return firstLine ? firstLineStyle() : style(); }
+
+ void getTextDecorationColors(int decorations, Color& underline, Color& overline,
+ Color& linethrough, bool quirksMode = false);
+
+ enum BorderSide {
+ BSTop,
+ BSBottom,
+ BSLeft,
+ BSRight
+ };
+
+ void drawBorderArc(GraphicsContext*, int x, int y, float thickness, IntSize radius, int angleStart,
+ int angleSpan, BorderSide, Color, const Color& textcolor, EBorderStyle, bool firstCorner);
+ void drawBorder(GraphicsContext*, int x1, int y1, int x2, int y2, BorderSide,
+ Color, const Color& textcolor, EBorderStyle, int adjbw1, int adjbw2);
+
+ // Return the RenderBox in the container chain which is responsible for painting this object, or 0
+ // if painting is root-relative. This is the container that should be passed to the 'forRepaint'
+ // methods.
+ RenderBox* containerForRepaint() const;
+ // Actually do the repaint of rect r for this object which has been computed in the coordinate space
+ // of repaintContainer. If repaintContainer is 0, repaint via the view.
+ void repaintUsingContainer(RenderBox* repaintContainer, const IntRect& r, bool immediate = false);
+
+ // Repaint the entire object. Called when, e.g., the color of a border changes, or when a border
+ // style changes.
+ void repaint(bool immediate = false);
+
+ // Repaint a specific subrectangle within a given object. The rect |r| is in the object's coordinate space.
+ void repaintRectangle(const IntRect&, bool immediate = false);
+
+ // Repaint only if our old bounds and new bounds are different.
+ bool repaintAfterLayoutIfNeeded(RenderBox* repaintContainer, const IntRect& oldBounds, const IntRect& oldOutlineBox);
+
+ // Repaint only if the object moved.
+ virtual void repaintDuringLayoutIfMoved(const IntRect& rect);
+
+ // Called to repaint a block's floats.
+ virtual void repaintOverhangingFloats(bool paintAllDescendants = false);
+
+ bool checkForRepaintDuringLayout() const;
+
+ // Returns the rect that should be repainted whenever this object changes. The rect is in the view's
+ // coordinate space. This method deals with outlines and overflow.
+ IntRect absoluteClippedOverflowRect()
+ {
+ return clippedOverflowRectForRepaint(0);
+ }
+ virtual IntRect clippedOverflowRectForRepaint(RenderBox* repaintContainer);
+
+ IntRect rectWithOutlineForRepaint(RenderBox* repaintContainer, int outlineWidth);
+
+ // Given a rect in the object's coordinate space, compute a rect suitable for repainting
+ // that rect in view coordinates.
+ void computeAbsoluteRepaintRect(IntRect& r, bool fixed = false)
+ {
+ return computeRectForRepaint(0, r, fixed);
+ }
+ // Given a rect in the object's coordinate space, compute a rect suitable for repainting
+ // that rect in the coordinate space of repaintContainer.
+ virtual void computeRectForRepaint(RenderBox* repaintContainer, IntRect&, bool fixed = false);
+
+ virtual unsigned int length() const { return 1; }
+
+ bool isFloatingOrPositioned() const { return (isFloating() || isPositioned()); }
+ virtual bool containsFloats() { return false; }
+ virtual bool containsFloat(RenderObject*) { return false; }
+ virtual bool hasOverhangingFloats() { return false; }
+
+ virtual bool avoidsFloats() const;
+ bool shrinkToAvoidFloats() const;
+
+ // positioning of inline children (bidi)
+ virtual void position(InlineBox*) { }
+
+ bool isTransparent() const { return style()->opacity() < 1.0f; }
+ float opacity() const { return style()->opacity(); }
+
+ bool hasReflection() const { return m_hasReflection; }
+
+ // Applied as a "slop" to dirty rect checks during the outline painting phase's dirty-rect checks.
+ int maximalOutlineSize(PaintPhase) const;
+
+ enum SelectionState {
+ SelectionNone, // The object is not selected.
+ SelectionStart, // The object either contains the start of a selection run or is the start of a run
+ SelectionInside, // The object is fully encompassed by a selection run
+ SelectionEnd, // The object either contains the end of a selection run or is the end of a run
+ SelectionBoth // The object contains an entire run or is the sole selected object in that run
+ };
+
+ // The current selection state for an object. For blocks, the state refers to the state of the leaf
+ // descendants (as described above in the SelectionState enum declaration).
+ virtual SelectionState selectionState() const { return SelectionNone; }
+
+ // Sets the selection state for an object.
+ virtual void setSelectionState(SelectionState state) { if (parent()) parent()->setSelectionState(state); }
+
+ // A single rectangle that encompasses all of the selected objects within this object. Used to determine the tightest
+ // possible bounding box for the selection.
+ IntRect selectionRect(bool clipToVisibleContent = true) { return selectionRectForRepaint(0, clipToVisibleContent); }
+ virtual IntRect selectionRectForRepaint(RenderBox* /*repaintContainer*/, bool /*clipToVisibleContent*/ = true) { return IntRect(); }
+
+ // Whether or not an object can be part of the leaf elements of the selection.
+ virtual bool canBeSelectionLeaf() const { return false; }
+
+ // Whether or not a block has selected children.
+ virtual bool hasSelectedChildren() const { return false; }
+
+ // Obtains the selection colors that should be used when painting a selection.
+ Color selectionBackgroundColor() const;
+ Color selectionForegroundColor() const;
+
+ // Whether or not a given block needs to paint selection gaps.
+ virtual bool shouldPaintSelectionGaps() const { return false; }
+
+ Node* draggableNode(bool dhtmlOK, bool uaOK, int x, int y, bool& dhtmlWillDrag) const;
+
+ /**
+ * Returns the local coordinates of the caret within this render object.
+ * @param caretOffset zero-based offset determining position within the render object.
+ * @param extraWidthToEndOfLine optional out arg to give extra width to end of line -
+ * useful for character range rect computations
+ */
+ virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0);
+
+ virtual int lowestPosition(bool /*includeOverflowInterior*/ = true, bool /*includeSelf*/ = true) const { return 0; }
+ virtual int rightmostPosition(bool /*includeOverflowInterior*/ = true, bool /*includeSelf*/ = true) const { return 0; }
+ virtual int leftmostPosition(bool /*includeOverflowInterior*/ = true, bool /*includeSelf*/ = true) const { return 0; }
+
+ virtual void calcVerticalMargins() { }
+ void removeFromObjectLists();
+
+ // When performing a global document tear-down, the renderer of the document is cleared. We use this
+ // as a hook to detect the case of document destruction and don't waste time doing unnecessary work.
+ bool documentBeingDestroyed() const;
+
+ virtual void destroy();
+
+ // Virtual function helpers for CSS3 Flexible Box Layout
+ virtual bool isFlexibleBox() const { return false; }
+ virtual bool isFlexingChildren() const { return false; }
+ virtual bool isStretchingChildren() const { return false; }
+
+ virtual int caretMinOffset() const;
+ virtual int caretMaxOffset() const;
+ virtual unsigned caretMaxRenderedOffset() const;
+
+ virtual int previousOffset(int current) const;
+ virtual int nextOffset(int current) const;
+
+ virtual void imageChanged(CachedImage*, const IntRect* = 0);
+ virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) { }
+ virtual bool willRenderImage(CachedImage*);
+
+ virtual void selectionStartEnd(int& spos, int& epos) const;
+
+ RenderObject* paintingRootForChildren(PaintInfo& paintInfo) const
+ {
+ // if we're the painting root, kids draw normally, and see root of 0
+ return (!paintInfo.paintingRoot || paintInfo.paintingRoot == this) ? 0 : paintInfo.paintingRoot;
+ }
+
+ bool shouldPaintWithinRoot(PaintInfo& paintInfo) const
+ {
+ return !paintInfo.paintingRoot || paintInfo.paintingRoot == this;
+ }
+
+ bool hasOverrideSize() const { return m_hasOverrideSize; }
+ void setHasOverrideSize(bool b) { m_hasOverrideSize = b; }
+
+ void remove() { if (parent()) parent()->removeChild(this); }
+
+ void invalidateVerticalPosition() { m_verticalPosition = PositionUndefined; }
+
+ virtual void removeLeftoverAnonymousBlock(RenderBlock* child);
+
+ virtual void capsLockStateMayHaveChanged() { }
+
+ AnimationController* animation() const;
+
+ bool visibleToHitTesting() const { return style()->visibility() == VISIBLE && style()->pointerEvents() != PE_NONE; }
+
+ // Map points and quads through elements, potentially via 3d transforms. You should never need to call these directly; use
+ // localToAbsolute/absoluteToLocal methods instead.
+ virtual void mapLocalToContainer(RenderBox* repaintContainer, bool useTransforms, bool fixed, TransformState&) const;
+ virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const;
+
+ bool shouldUseTransformFromContainer(const RenderObject* container) const;
+ void getTransformFromContainer(const RenderObject* container, const IntSize& offsetInContainer, TransformationMatrix&) const;
+
+ virtual void addFocusRingRects(GraphicsContext*, int /*tx*/, int /*ty*/) { };
+
+ IntRect absoluteOutlineBounds() const
+ {
+ return outlineBoundsForRepaint(0);
+ }
+
+protected:
+ // Overrides should call the superclass at the end
+ virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
+ // Overrides should call the superclass at the start
+ virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+
+ virtual void printBoxDecorations(GraphicsContext*, int /*x*/, int /*y*/, int /*w*/, int /*h*/, int /*tx*/, int /*ty*/) { }
+
+ void paintOutline(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*);
+ void addPDFURLRect(GraphicsContext*, const IntRect&);
+
+ virtual IntRect viewRect() const;
+
+ int getVerticalPosition(bool firstLine) const;
+
+ void adjustRectForOutlineAndShadow(IntRect&) const;
+
+ void arenaDelete(RenderArena*, void* objectBase);
+
+ virtual IntRect outlineBoundsForRepaint(RenderBox* /*repaintContainer*/) const { return IntRect(); }
+
+ class LayoutRepainter {
+ public:
+ LayoutRepainter(RenderObject& object, bool checkForRepaint, const IntRect* oldBounds = 0)
+ : m_object(object)
+ , m_repaintContainer(0)
+ , m_checkForRepaint(checkForRepaint)
+ {
+ if (m_checkForRepaint) {
+ m_repaintContainer = m_object.containerForRepaint();
+ m_oldBounds = oldBounds ? *oldBounds : m_object.clippedOverflowRectForRepaint(m_repaintContainer);
+ m_oldOutlineBox = m_object.outlineBoundsForRepaint(m_repaintContainer);
+ }
+ }
+
+ // Return true if it repainted.
+ bool repaintAfterLayout()
+ {
+ return m_checkForRepaint ? m_object.repaintAfterLayoutIfNeeded(m_repaintContainer, m_oldBounds, m_oldOutlineBox) : false;
+ }
+
+ bool checkForRepaint() const { return m_checkForRepaint; }
+
+ private:
+ RenderObject& m_object;
+ RenderBox* m_repaintContainer;
+ IntRect m_oldBounds;
+ IntRect m_oldOutlineBox;
+ bool m_checkForRepaint;
+ };
+
+private:
+ StyleDifference adjustStyleDifference(StyleDifference, unsigned contextSensitiveProperties) const;
+
+ RefPtr<RenderStyle> m_style;
+
+ Node* m_node;
+
+ RenderObject* m_parent;
+ RenderObject* m_previous;
+ RenderObject* m_next;
+
+#ifndef NDEBUG
+ bool m_hasAXObject;
+ bool m_setNeedsLayoutForbidden : 1;
+#endif
+ mutable int m_verticalPosition;
+
+ bool m_needsLayout : 1;
+ bool m_needsPositionedMovementLayout :1;
+ bool m_normalChildNeedsLayout : 1;
+ bool m_posChildNeedsLayout : 1;
+ bool m_prefWidthsDirty : 1;
+ bool m_floating : 1;
+
+ bool m_positioned : 1;
+ bool m_relPositioned : 1;
+ bool m_paintBackground : 1; // if the box has something to paint in the
+ // background painting phase (background, border, etc)
+
+ bool m_isAnonymous : 1;
+ bool m_isText : 1;
+ bool m_isBox : 1;
+ bool m_inline : 1;
+ bool m_replaced : 1;
+ bool m_isDragging : 1;
+
+ bool m_hasLayer : 1;
+ bool m_hasOverflowClip : 1;
+ bool m_hasTransform : 1;
+ bool m_hasReflection : 1;
+
+ bool m_hasOverrideSize : 1;
+
+public:
+ bool m_hasCounterNodeMap : 1;
+ bool m_everHadLayout : 1;
+
+private:
+ // Store state between styleWillChange and styleDidChange
+ static bool s_affectsParentBlock;
+};
+
+inline void makeMatrixRenderable(TransformationMatrix& matrix)
+{
+#if !ENABLE(3D_RENDERING)
+ matrix.makeAffine();
+#else
+ UNUSED_PARAM(matrix);
+#endif
+}
+
+} // namespace WebCore
+
+#ifndef NDEBUG
+// Outside the WebCore namespace for ease of invocation from gdb.
+void showTree(const WebCore::RenderObject*);
+#endif
+
+#endif // RenderObject_h
--- /dev/null
+/*
+ * This file is part of the KDE project.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Simon Hausmann <hausmann@kde.org>
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderPart_h
+#define RenderPart_h
+
+#include "RenderWidget.h"
+
+namespace WebCore {
+
+class Frame;
+class HTMLFrameOwnerElement;
+
+class RenderPart : public RenderWidget {
+public:
+ RenderPart(Element*);
+ virtual ~RenderPart();
+
+ virtual bool isRenderPart() const { return true; }
+ virtual const char* renderName() const { return "RenderPart"; }
+
+ virtual void setWidget(Widget*);
+
+ // FIXME: This should not be necessary.
+ // Remove this once WebKit knows to properly schedule layouts using WebCore when objects resize.
+ virtual void updateWidgetPosition();
+
+ bool hasFallbackContent() const { return m_hasFallbackContent; }
+
+ virtual void viewCleared();
+
+protected:
+ bool m_hasFallbackContent;
+
+private:
+ virtual void deleteWidget();
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * This file is part of the KDE project.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Simon Hausmann <hausmann@kde.org>
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderPartObject_h
+#define RenderPartObject_h
+
+#include "RenderPart.h"
+
+namespace WebCore {
+
+class RenderPartObject : public RenderPart {
+public:
+ RenderPartObject(Element*);
+ virtual ~RenderPartObject();
+
+ virtual const char* renderName() const { return "RenderPartObject"; }
+
+ virtual void layout();
+
+ bool shouldResizeFrameToContent() const;
+ virtual void calcWidth();
+ virtual void calcHeight();
+ void setUpdatingWidget(bool updatingWidget) { m_updatingWidget = updatingWidget; }
+ void updateWidget(bool onlyCreateNonNetscapePlugins);
+
+ virtual void viewCleared();
+private:
+ bool m_updatingWidget;
+};
+
+} // namespace WebCore
+
+#endif // RenderPartObject_h
--- /dev/null
+/*
+ Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ 2004, 2005 Rob Buis <buis@kde.org>
+ 2005 Eric Seidel <eric@webkit.org>
+ 2006 Apple Computer, Inc
+
+ This file is part of the KDE project
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ aint with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef RenderPath_h
+#define RenderPath_h
+
+#if ENABLE(SVG)
+
+#include "TransformationMatrix.h"
+#include "FloatRect.h"
+
+#include "RenderObject.h"
+
+namespace WebCore {
+
+class FloatPoint;
+class RenderSVGContainer;
+class SVGStyledTransformableElement;
+
+class RenderPath : public RenderObject {
+public:
+ RenderPath(SVGStyledTransformableElement*);
+
+ // Hit-detection seperated for the fill and the stroke
+ bool fillContains(const FloatPoint&, bool requiresFill = true) const;
+ bool strokeContains(const FloatPoint&, bool requiresStroke = true) const;
+
+ // Returns an unscaled bounding box (not even including localTransform()) for this vector path
+ virtual FloatRect relativeBBox(bool includeStroke = true) const;
+
+ const Path& path() const;
+ void setPath(const Path& newPath);
+
+ virtual bool isRenderPath() const { return true; }
+ virtual const char* renderName() const { return "RenderPath"; }
+
+ bool calculateLocalTransform();
+ virtual TransformationMatrix localTransform() const;
+
+ virtual void layout();
+ virtual IntRect clippedOverflowRectForRepaint(RenderBox* repaintContainer);
+ virtual bool requiresLayer() const { return false; }
+ virtual int lineHeight(bool b, bool isRootLineBox = false) const;
+ virtual int baselinePosition(bool b, bool isRootLineBox = false) const;
+ virtual void paint(PaintInfo&, int parentX, int parentY);
+
+ virtual void absoluteRects(Vector<IntRect>&, int tx, int ty, bool topLevel = true);
+ virtual void absoluteQuads(Vector<FloatQuad>&, bool topLevel = true);
+ virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
+
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
+
+ FloatRect drawMarkersIfNeeded(GraphicsContext*, const FloatRect&, const Path&) const;
+
+private:
+ FloatPoint mapAbsolutePointToLocal(const FloatPoint&) const;
+ virtual IntRect outlineBoundsForRepaint(RenderBox* repaintContainer) const;
+
+ mutable Path m_path;
+ mutable FloatRect m_fillBBox;
+ mutable FloatRect m_strokeBbox;
+ FloatRect m_markerBounds;
+ TransformationMatrix m_localTransform;
+ IntRect m_absoluteBounds;
+};
+
+}
+
+#endif // ENABLE(SVG)
+#endif
+
+// vim:ts=4:noet
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderReplaced_h
+#define RenderReplaced_h
+
+#include "RenderBox.h"
+
+namespace WebCore {
+
+class RenderReplaced : public RenderBox {
+public:
+ RenderReplaced(Node*);
+ RenderReplaced(Node*, const IntSize& intrinsicSize);
+ virtual ~RenderReplaced();
+
+ virtual const char* renderName() const { return "RenderReplaced"; }
+
+ virtual int lineHeight(bool firstLine, bool isRootLineBox = false) const;
+ virtual int baselinePosition(bool firstLine, bool isRootLineBox = false) const;
+
+ virtual void calcPrefWidths();
+
+ virtual void layout();
+ virtual int minimumReplacedHeight() const { return 0; }
+
+ virtual void paint(PaintInfo&, int tx, int ty);
+ virtual void paintReplaced(PaintInfo&, int /*tx*/, int /*ty*/) { }
+
+ virtual IntSize intrinsicSize() const;
+
+ virtual int overflowHeight(bool includeInterior = true) const;
+ virtual int overflowWidth(bool includeInterior = true) const;
+ virtual int overflowLeft(bool includeInterior = true) const;
+ virtual int overflowTop(bool includeInterior = true) const;
+ virtual IntRect overflowRect(bool includeInterior = true) const;
+
+ virtual IntRect clippedOverflowRectForRepaint(RenderBox* repaintContainer);
+
+ virtual unsigned caretMaxRenderedOffset() const;
+ virtual VisiblePosition positionForCoordinates(int x, int y);
+
+ virtual bool canBeSelectionLeaf() const { return true; }
+ virtual SelectionState selectionState() const { return static_cast<SelectionState>(m_selectionState); }
+ virtual void setSelectionState(SelectionState);
+ virtual IntRect selectionRectForRepaint(RenderBox* repaintContainer, bool clipToVisibleContent = true);
+
+ bool isSelected() const;
+
+protected:
+ virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+
+ void setIntrinsicSize(const IntSize&);
+ virtual void intrinsicSizeChanged();
+
+ bool shouldPaint(PaintInfo&, int& tx, int& ty);
+ void adjustOverflowForBoxShadowAndReflect();
+ IntRect localSelectionRect(bool checkWhetherSelected = true) const;
+
+private:
+ IntSize m_intrinsicSize;
+
+ unsigned m_selectionState : 3; // SelectionState
+ bool m_hasOverflow : 1;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RenderReplica_h
+#define RenderReplica_h
+
+#include "RenderBox.h"
+
+namespace WebCore {
+
+class RenderReplica : public RenderBox {
+public:
+ RenderReplica(Node*);
+ virtual ~RenderReplica();
+
+ virtual const char* renderName() const { return "RenderReplica"; }
+
+ virtual bool requiresLayer() const { return true; }
+
+ virtual void layout();
+ virtual void calcPrefWidths();
+
+ virtual void paint(PaintInfo&, int tx, int ty);
+};
+
+} // namespace WebCore
+
+#endif // RenderReplica_h
--- /dev/null
+/*
+ * This file is part of the WebKit project.
+ *
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderSVGBlock_h
+#define RenderSVGBlock_h
+#if ENABLE(SVG)
+
+#include "RenderBlock.h"
+
+namespace WebCore {
+
+class SVGElement;
+
+class RenderSVGBlock : public RenderBlock {
+public:
+ RenderSVGBlock(SVGElement*);
+ virtual void setStyle(PassRefPtr<RenderStyle>);
+};
+
+}
+#endif // ENABLE(SVG)
+#endif // !RenderSVGBlock_h
--- /dev/null
+/*
+ Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ 2004, 2005, 2007 Rob Buis <buis@kde.org>
+
+ This file is part of the KDE project
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ aint with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef RenderSVGContainer_h
+#define RenderSVGContainer_h
+
+#if ENABLE(SVG)
+
+#include "RenderPath.h"
+#include "SVGPreserveAspectRatio.h"
+
+namespace WebCore {
+
+class SVGElement;
+
+class RenderSVGContainer : public RenderObject {
+public:
+ RenderSVGContainer(SVGStyledElement*);
+ ~RenderSVGContainer();
+
+ virtual RenderObject* firstChild() const { return m_firstChild; }
+ virtual RenderObject* lastChild() const { return m_lastChild; }
+
+ int width() const { return m_width; }
+ int height() const { return m_height; }
+
+ virtual bool canHaveChildren() const;
+ virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0);
+ virtual void removeChild(RenderObject*);
+
+ virtual void destroy();
+ void destroyLeftoverChildren();
+
+ virtual RenderObject* removeChildNode(RenderObject*, bool fullRemove = true);
+ virtual void appendChildNode(RenderObject*, bool fullAppend = true);
+ virtual void insertChildNode(RenderObject* child, RenderObject* before, bool fullInsert = true);
+
+ // Designed for speed. Don't waste time doing a bunch of work like layer updating and repainting when we know that our
+ // change in parentage is not going to affect anything.
+ virtual void moveChildNode(RenderObject* child) { appendChildNode(child->parent()->removeChildNode(child, false), false); }
+
+ virtual void calcPrefWidths() { setPrefWidthsDirty(false); }
+
+ // Some containers do not want it's children
+ // to be drawn, because they may be 'referenced'
+ // Example: <marker> children in SVG
+ void setDrawsContents(bool);
+ bool drawsContents() const;
+
+ virtual bool isSVGContainer() const { return true; }
+ virtual const char* renderName() const { return "RenderSVGContainer"; }
+
+ virtual bool requiresLayer() const { return false; }
+ virtual int lineHeight(bool b, bool isRootLineBox = false) const;
+ virtual int baselinePosition(bool b, bool isRootLineBox = false) const;
+
+ virtual void layout();
+ virtual void paint(PaintInfo&, int parentX, int parentY);
+
+ virtual IntRect clippedOverflowRectForRepaint(RenderBox* repaintContainer);
+ virtual void absoluteRects(Vector<IntRect>& rects, int tx, int ty, bool topLevel = true);
+ virtual void absoluteQuads(Vector<FloatQuad>&, bool topLevel = true);
+ virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
+
+ FloatRect relativeBBox(bool includeStroke = true) const;
+
+ virtual bool calculateLocalTransform();
+ virtual TransformationMatrix localTransform() const;
+ virtual TransformationMatrix viewportTransform() const;
+
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
+
+protected:
+ virtual void applyContentTransforms(PaintInfo&);
+ virtual void applyAdditionalTransforms(PaintInfo&);
+
+ void calcBounds();
+
+ virtual IntRect outlineBoundsForRepaint(RenderBox* /*repaintContainer*/) const;
+
+private:
+ int calcReplacedWidth() const;
+ int calcReplacedHeight() const;
+
+ RenderObject* m_firstChild;
+ RenderObject* m_lastChild;
+
+ int m_width;
+ int m_height;
+
+ bool selfWillPaint() const;
+
+ bool m_drawsContents : 1;
+
+protected:
+ IntRect m_absoluteBounds;
+ TransformationMatrix m_localTransform;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif // RenderSVGContainer_h
+
+// vim:ts=4:noet
--- /dev/null
+/*
+ * This file is part of the WebKit project.
+ *
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderSVGGradientStop_h
+#define RenderSVGGradientStop_h
+
+#if ENABLE(SVG)
+#include "RenderObject.h"
+
+namespace WebCore {
+
+ class SVGGradientElement;
+ class SVGStopElement;
+
+ // This class exists mostly so we can hear about gradient stop style changes
+ class RenderSVGGradientStop : public RenderObject {
+ public:
+ RenderSVGGradientStop(SVGStopElement*);
+ virtual ~RenderSVGGradientStop();
+
+ virtual const char* renderName() const { return "RenderSVGGradientStop"; }
+
+ virtual void layout();
+
+ // This override is needed to prevent crashing on <svg><stop /></svg>
+ // RenderObject's default impl asks the parent Object and RenderSVGRoot
+ // asks all child RenderObjects for overflow rects, thus infinite loop.
+ // https://bugs.webkit.org/show_bug.cgi?id=20400
+ virtual IntRect clippedOverflowRectForRepaint(RenderBox*) { return IntRect(); }
+
+ protected:
+ virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+
+ private:
+ SVGGradientElement* gradientElement() const;
+ };
+}
+
+#endif // ENABLE(SVG)
+#endif // RenderSVGGradientStop_h
--- /dev/null
+/*
+ * This file is part of the WebKit project.
+ *
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderSVGHiddenContainer_h
+#define RenderSVGHiddenContainer_h
+
+#if ENABLE(SVG)
+
+#include "RenderSVGContainer.h"
+
+namespace WebCore {
+
+ class SVGStyledElement;
+
+ // This class is for containers which are never drawn, but do need to support style
+ // <defs>, <linearGradient>, <radialGradient> are all good examples
+ class RenderSVGHiddenContainer : public RenderSVGContainer {
+ public:
+ RenderSVGHiddenContainer(SVGStyledElement*);
+ virtual ~RenderSVGHiddenContainer();
+
+ virtual bool isSVGContainer() const { return true; }
+ virtual bool isSVGHiddenContainer() const { return true; }
+
+ virtual const char* renderName() const { return "RenderSVGHiddenContainer"; }
+
+ virtual bool requiresLayer() const { return false; }
+
+ virtual int lineHeight(bool b, bool isRootLineBox = false) const;
+ virtual int baselinePosition(bool b, bool isRootLineBox = false) const;
+
+ virtual void layout();
+ virtual void paint(PaintInfo&, int parentX, int parentY);
+
+ virtual IntRect clippedOverflowRectForRepaint(RenderBox* repaintContainer);
+ virtual void absoluteRects(Vector<IntRect>& rects, int tx, int ty, bool topLevel = true);
+ virtual void absoluteQuads(Vector<FloatQuad>&, bool topLevel = true);
+
+ virtual TransformationMatrix absoluteTransform() const;
+ virtual TransformationMatrix localTransform() const;
+
+ virtual FloatRect relativeBBox(bool includeStroke = true) const;
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
+ };
+}
+
+#endif // ENABLE(SVG)
+#endif // RenderSVGHiddenContainer_h
--- /dev/null
+/*
+ Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
+ Copyright (C) 2006 Apple Computer, Inc.
+ Copyright (C) 2007 Rob Buis <buis@kde.org>
+
+ This file is part of the WebKit project.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef RenderSVGImage_h
+#define RenderSVGImage_h
+
+#if ENABLE(SVG)
+
+#include "TransformationMatrix.h"
+#include "FloatRect.h"
+#include "RenderImage.h"
+
+namespace WebCore {
+
+ class SVGImageElement;
+ class SVGPreserveAspectRatio;
+
+ class RenderSVGImage : public RenderImage {
+ public:
+ RenderSVGImage(SVGImageElement*);
+ virtual ~RenderSVGImage();
+
+ virtual TransformationMatrix localTransform() const { return m_localTransform; }
+
+ virtual FloatRect relativeBBox(bool includeStroke = true) const;
+ virtual IntRect clippedOverflowRectForRepaint(RenderBox* repaintContainer);
+ virtual void absoluteRects(Vector<IntRect>&, int tx, int ty, bool topLevel = true);
+ virtual void absoluteQuads(Vector<FloatQuad>&, bool topLevel = true);
+ virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
+
+ virtual void imageChanged(WrappedImagePtr, const IntRect* = 0);
+ void adjustRectsForAspectRatio(FloatRect& destRect, FloatRect& srcRect, SVGPreserveAspectRatio*);
+
+ virtual void layout();
+ virtual void paint(PaintInfo&, int parentX, int parentY);
+
+ bool requiresLayer() const { return false; }
+
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int _x, int _y, int _tx, int _ty, HitTestAction);
+
+ bool calculateLocalTransform();
+
+ private:
+ void calculateAbsoluteBounds();
+ TransformationMatrix m_localTransform;
+ FloatRect m_localBounds;
+ IntRect m_absoluteBounds;
+ };
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif // RenderSVGImage_h
+
+// vim:ts=4:noet
--- /dev/null
+/*
+ * This file is part of the WebKit project.
+ *
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>
+ * (C) 2006 Apple Computer Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderSVGInline_h
+#define RenderSVGInline_h
+
+#if ENABLE(SVG)
+#include "RenderInline.h"
+
+namespace WebCore {
+class RenderSVGInline : public RenderInline {
+public:
+ RenderSVGInline(Node*);
+ virtual const char* renderName() const { return "RenderSVGInline"; }
+ virtual InlineBox* createInlineBox(bool makePlaceHolderBox, bool isRootLineBox, bool isOnlyRun = false);
+ virtual bool requiresLayer() const { return false; }
+ };
+}
+
+#endif // ENABLE(SVG)
+#endif // !RenderSVGTSpan_H
--- /dev/null
+/*
+ * This file is part of the WebKit project.
+ *
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ * (C) 2008 Rob Buis <buis@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderSVGInlineText_h
+#define RenderSVGInlineText_h
+
+#if ENABLE(SVG)
+
+#include "RenderText.h"
+
+namespace WebCore {
+class RenderSVGInlineText : public RenderText {
+public:
+ RenderSVGInlineText(Node*, PassRefPtr<StringImpl>);
+ virtual const char* renderName() const { return "RenderSVGInlineText"; }
+
+ virtual void styleDidChange(StyleDifference, const RenderStyle*);
+
+ virtual void absoluteRects(Vector<IntRect>& rects, int tx, int ty, bool topLevel = true);
+ virtual void absoluteQuads(Vector<FloatQuad>&, bool topLevel = true);
+
+ virtual bool requiresLayer() const { return false; }
+ virtual IntRect selectionRectForRepaint(RenderBox* repaintContainer, bool clipToVisibleContent = true);
+ virtual bool isSVGText() const { return true; }
+ virtual InlineTextBox* createInlineTextBox();
+
+ virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0);
+ virtual VisiblePosition positionForCoordinates(int x, int y);
+
+ virtual void destroy();
+
+private:
+ IntRect computeRepaintRectForRange(RenderBox* repaintContainer, int startPos, int endPos);
+};
+
+}
+
+#endif // ENABLE(SVG)
+
+#endif // !RenderSVGInlineText_h
--- /dev/null
+/*
+ Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ 2004, 2005, 2007 Rob Buis <buis@kde.org>
+
+ This file is part of the KDE project
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ aint with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef RenderSVGRoot_h
+#define RenderSVGRoot_h
+
+#if ENABLE(SVG)
+#include "RenderContainer.h"
+#include "FloatRect.h"
+
+namespace WebCore {
+
+class SVGStyledElement;
+class TransformationMatrix;
+
+class RenderSVGRoot : public RenderContainer {
+public:
+ RenderSVGRoot(SVGStyledElement*);
+ ~RenderSVGRoot();
+
+ virtual bool isSVGRoot() const { return true; }
+ virtual const char* renderName() const { return "RenderSVGRoot"; }
+
+ virtual int lineHeight(bool b, bool isRootLineBox = false) const;
+ virtual int baselinePosition(bool b, bool isRootLineBox = false) const;
+ virtual void calcPrefWidths();
+
+ virtual void layout();
+ virtual void paint(PaintInfo&, int parentX, int parentY);
+
+ virtual IntRect clippedOverflowRectForRepaint(RenderBox* repaintContainer);
+ virtual void absoluteRects(Vector<IntRect>& rects, int tx, int ty);
+ virtual void absoluteQuads(Vector<FloatQuad>&, bool topLevel = true);
+ virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
+
+ virtual TransformationMatrix absoluteTransform() const;
+
+ bool fillContains(const FloatPoint&) const;
+ bool strokeContains(const FloatPoint&) const;
+ FloatRect relativeBBox(bool includeStroke = true) const;
+
+ virtual TransformationMatrix localTransform() const;
+
+ FloatRect viewport() const;
+
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
+
+ virtual void position(InlineBox*);
+
+private:
+ void calcViewport();
+ void applyContentTransforms(PaintInfo&, int parentX, int parentY);
+
+ FloatRect m_viewport;
+ IntRect m_absoluteBounds;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif // RenderSVGRoot_h
+
+// vim:ts=4:noet
--- /dev/null
+/*
+ * This file is part of the WebKit project.
+ *
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>
+ * (C) 2006 Apple Computer Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderSVGTSpan_h
+#define RenderSVGTSpan_h
+
+#if ENABLE(SVG)
+#include "RenderSVGInline.h"
+
+namespace WebCore {
+class RenderSVGTSpan : public RenderSVGInline {
+public:
+ RenderSVGTSpan(Node*);
+ virtual const char* renderName() const { return "RenderSVGTSpan"; }
+ virtual void absoluteRects(Vector<IntRect>& rects, int tx, int ty, bool topLevel = true);
+ virtual void absoluteQuads(Vector<FloatQuad>&, bool topLevel = true);
+};
+}
+
+#endif // ENABLE(SVG)
+#endif // !RenderSVGTSpan_h
--- /dev/null
+/*
+ * This file is part of the WebKit project.
+ *
+ * Copyright (C) 2006 Apple Computer, Inc.
+ * (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderSVGText_h
+#define RenderSVGText_h
+
+#if ENABLE(SVG)
+
+#include "TransformationMatrix.h"
+#include "RenderSVGBlock.h"
+
+namespace WebCore {
+
+class SVGTextElement;
+
+class RenderSVGText : public RenderSVGBlock {
+public:
+ RenderSVGText(SVGTextElement* node);
+
+ virtual const char* renderName() const { return "RenderSVGText"; }
+
+ virtual bool isSVGText() const { return true; }
+
+ bool calculateLocalTransform();
+ virtual TransformationMatrix localTransform() const { return m_localTransform; }
+
+ virtual void paint(PaintInfo&, int tx, int ty);
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
+
+ virtual bool requiresLayer() const { return false; }
+ virtual void layout();
+
+ virtual void absoluteRects(Vector<IntRect>&, int tx, int ty, bool topLevel = true);
+ virtual void absoluteQuads(Vector<FloatQuad>&, bool topLevel = true);
+
+ virtual IntRect clippedOverflowRectForRepaint(RenderBox* repaintContainer);
+ virtual FloatRect relativeBBox(bool includeStroke = true) const;
+
+ virtual InlineBox* createInlineBox(bool makePlaceHolderBox, bool isRootLineBox, bool isOnlyRun = false);
+
+private:
+ TransformationMatrix m_localTransform;
+ IntRect m_absoluteBounds;
+};
+
+}
+
+#endif // ENABLE(SVG)
+#endif
+
+// vim:ts=4:noet
--- /dev/null
+/*
+ * This file is part of the WebKit project.
+ *
+ * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderSVGTextPath_h
+#define RenderSVGTextPath_h
+
+#if ENABLE(SVG)
+#include "RenderSVGInline.h"
+
+namespace WebCore {
+
+ class RenderSVGTextPath : public RenderSVGInline {
+ public:
+ RenderSVGTextPath(Node*);
+
+ Path layoutPath() const;
+ float startOffset() const;
+ bool exactAlignment() const;
+ bool stretchMethod() const;
+
+ virtual const char* renderName() const { return "RenderSVGTextPath"; }
+ virtual void absoluteRects(Vector<IntRect>& rects, int tx, int ty);
+ virtual void absoluteQuads(Vector<FloatQuad>&, bool topLevel = true);
+
+ private:
+ float m_startOffset;
+
+ bool m_exactAlignment : 1;
+ bool m_stretchMethod : 1;
+
+ Path m_layoutPath;
+ };
+}
+
+#endif // ENABLE(SVG)
+#endif // RenderSVGTextPath_h
--- /dev/null
+/*
+ Copyright (C) 2007 Eric Seidel <eric@webkit.org
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ aint with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef RenderSVGTransformableContainer_h
+#define RenderSVGTransformableContainer_h
+
+#if ENABLE(SVG)
+#include "RenderSVGContainer.h"
+
+namespace WebCore {
+
+ class SVGStyledTransformableElement;
+ class RenderSVGTransformableContainer : public RenderSVGContainer {
+ public:
+ RenderSVGTransformableContainer(SVGStyledTransformableElement*);
+
+ virtual bool calculateLocalTransform();
+ };
+}
+
+#endif // ENABLE(SVG)
+#endif // RenderSVGTransformableContainer_h
--- /dev/null
+/*
+ Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ 2004, 2005, 2007 Rob Buis <buis@kde.org>
+
+ This file is part of the KDE project
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ aint with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef RenderSVGViewportContainer_h
+#define RenderSVGViewportContainer_h
+
+#if ENABLE(SVG)
+
+#include "RenderSVGContainer.h"
+
+namespace WebCore {
+
+class RenderSVGViewportContainer : public RenderSVGContainer {
+public:
+ RenderSVGViewportContainer(SVGStyledElement*);
+ ~RenderSVGViewportContainer();
+
+ virtual bool isSVGContainer() const { return true; }
+ virtual const char* renderName() const { return "RenderSVGViewportContainer"; }
+
+ virtual void layout();
+ virtual void paint(PaintInfo&, int parentX, int parentY);
+
+ virtual TransformationMatrix absoluteTransform() const;
+ virtual TransformationMatrix viewportTransform() const;
+
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
+
+ FloatRect viewport() const;
+
+private:
+ void calcViewport();
+
+ virtual void applyContentTransforms(PaintInfo&);
+ virtual void applyAdditionalTransforms(PaintInfo&);
+
+ FloatRect m_viewport;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif // RenderSVGViewportContainer_h
+
+// vim:ts=4:noet
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RenderScrollbar_h
+#define RenderScrollbar_h
+
+#include "Scrollbar.h"
+#include "RenderStyle.h"
+#include <wtf/HashMap.h>
+
+namespace WebCore {
+
+class RenderBox;
+class RenderScrollbarPart;
+class RenderStyle;
+
+class RenderScrollbar : public Scrollbar {
+protected:
+ RenderScrollbar(ScrollbarClient*, ScrollbarOrientation, RenderBox*);
+
+public:
+ friend class Scrollbar;
+ static PassRefPtr<Scrollbar> createCustomScrollbar(ScrollbarClient*, ScrollbarOrientation, RenderBox*);
+ virtual ~RenderScrollbar();
+
+ virtual void setParent(ScrollView*);
+ virtual void setEnabled(bool);
+
+ virtual void paint(GraphicsContext*, const IntRect& damageRect);
+
+ virtual void setHoveredPart(ScrollbarPart);
+ virtual void setPressedPart(ScrollbarPart);
+
+ void updateScrollbarParts(bool destroy = false);
+
+ static ScrollbarPart partForStyleResolve();
+ static RenderScrollbar* scrollbarForStyleResolve();
+
+ virtual void styleChanged();
+
+ RenderBox* owningRenderer() const { return m_owner; }
+
+ void paintPart(GraphicsContext*, ScrollbarPart, const IntRect&);
+
+ IntRect buttonRect(ScrollbarPart);
+ IntRect trackRect(int startLength, int endLength);
+ IntRect trackPieceRectWithMargins(ScrollbarPart, const IntRect&);
+
+ int minimumThumbLength();
+
+private:
+ PassRefPtr<RenderStyle> getScrollbarPseudoStyle(ScrollbarPart, RenderStyle::PseudoId);
+ void updateScrollbarPart(ScrollbarPart, bool destroy = false);
+
+ RenderBox* m_owner;
+ HashMap<unsigned, RenderScrollbarPart*> m_parts;
+};
+
+} // namespace WebCore
+
+#endif // RenderScrollbar_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RenderScrollbarPart_h
+#define RenderScrollbarPart_h
+
+#include "RenderBlock.h"
+#include "ScrollTypes.h"
+
+namespace WebCore {
+
+class RenderScrollbar;
+
+class RenderScrollbarPart : public RenderBlock {
+public:
+ RenderScrollbarPart(Node*, RenderScrollbar* = 0, ScrollbarPart = NoPart);
+ virtual ~RenderScrollbarPart();
+
+ virtual const char* renderName() const { return "RenderScrollbarPart"; }
+
+ virtual bool requiresLayer() const { return false; }
+
+ virtual void layout();
+ virtual void calcPrefWidths();
+
+ void paintIntoRect(GraphicsContext*, int tx, int ty, const IntRect&);
+
+protected:
+ virtual void styleWillChange(StyleDifference diff, const RenderStyle* newStyle);
+ virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+ virtual void imageChanged(WrappedImagePtr, const IntRect* = 0);
+
+private:
+ void layoutHorizontalPart();
+ void layoutVerticalPart();
+
+ void computeScrollbarWidth();
+ void computeScrollbarHeight();
+
+ RenderScrollbar* m_scrollbar;
+ ScrollbarPart m_part;
+};
+
+} // namespace WebCore
+
+#endif // RenderScrollbarPart_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RenderScrollbarTheme_h
+#define RenderScrollbarTheme_h
+
+#include "ScrollbarThemeComposite.h"
+
+namespace WebCore {
+
+class PlatformMouseEvent;
+class Scrollbar;
+class ScrollView;
+
+class RenderScrollbarTheme : public ScrollbarThemeComposite {
+public:
+ virtual ~RenderScrollbarTheme() {};
+
+ virtual int scrollbarThickness(ScrollbarControlSize controlSize) { return ScrollbarTheme::nativeTheme()->scrollbarThickness(controlSize); }
+
+ virtual ScrollbarButtonsPlacement buttonsPlacement() const { return ScrollbarTheme::nativeTheme()->buttonsPlacement(); }
+
+ virtual bool supportsControlTints() const { return true; }
+
+ virtual void paintScrollCorner(ScrollView*, GraphicsContext* context, const IntRect& cornerRect);
+
+ virtual bool shouldCenterOnThumb(Scrollbar* scrollbar, const PlatformMouseEvent& event) { return ScrollbarTheme::nativeTheme()->shouldCenterOnThumb(scrollbar, event); }
+
+ virtual double initialAutoscrollTimerDelay() { return ScrollbarTheme::nativeTheme()->initialAutoscrollTimerDelay(); }
+ virtual double autoscrollTimerDelay() { return ScrollbarTheme::nativeTheme()->autoscrollTimerDelay(); }
+
+ virtual void registerScrollbar(Scrollbar* scrollbar) { return ScrollbarTheme::nativeTheme()->registerScrollbar(scrollbar); }
+ virtual void unregisterScrollbar(Scrollbar* scrollbar) { return ScrollbarTheme::nativeTheme()->unregisterScrollbar(scrollbar); }
+
+ virtual int minimumThumbLength(Scrollbar*);
+
+ void buttonSizesAlongTrackAxis(Scrollbar* scrollbar, int& beforeSize, int& afterSize);
+
+ static RenderScrollbarTheme* renderScrollbarTheme();
+
+protected:
+ virtual bool hasButtons(Scrollbar*);
+ virtual bool hasThumb(Scrollbar*);
+
+ virtual IntRect backButtonRect(Scrollbar*, ScrollbarPart, bool painting = false);
+ virtual IntRect forwardButtonRect(Scrollbar*, ScrollbarPart, bool painting = false);
+ virtual IntRect trackRect(Scrollbar*, bool painting = false);
+
+ virtual void paintScrollbarBackground(GraphicsContext*, Scrollbar*);
+ virtual void paintTrackBackground(GraphicsContext*, Scrollbar*, const IntRect&);
+ virtual void paintTrackPiece(GraphicsContext*, Scrollbar*, const IntRect&, ScrollbarPart);
+ virtual void paintButton(GraphicsContext*, Scrollbar*, const IntRect&, ScrollbarPart);
+ virtual void paintThumb(GraphicsContext*, Scrollbar*, const IntRect&);
+
+ virtual IntRect constrainTrackRectToTrackPieces(Scrollbar*, const IntRect&);
+};
+
+} // namespace WebCore
+
+#endif // RenderScrollbarTheme_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef SelectionInfo_h
+#define SelectionInfo_h
+
+#include "IntRect.h"
+#include "RenderBox.h"
+
+namespace WebCore {
+
+class RenderSelectionInfoBase {
+public:
+ RenderSelectionInfoBase()
+ : m_object(0)
+ , m_repaintContainer(0)
+ , m_state(RenderObject::SelectionNone)
+ {
+ }
+
+ RenderSelectionInfoBase(RenderObject* o)
+ : m_object(o)
+ , m_repaintContainer(o->containerForRepaint())
+ , m_state(o->selectionState())
+ {
+ }
+
+ RenderObject* object() const { return m_object; }
+ RenderBox* repaintContainer() const { return m_repaintContainer; }
+ RenderObject::SelectionState state() const { return m_state; }
+
+protected:
+ RenderObject* m_object;
+ RenderBox* m_repaintContainer;
+ RenderObject::SelectionState m_state;
+};
+
+// This struct is used when the selection changes to cache the old and new state of the selection for each RenderObject.
+class RenderSelectionInfo : public RenderSelectionInfoBase {
+public:
+ RenderSelectionInfo(RenderObject* o, bool clipToVisibleContent)
+ : RenderSelectionInfoBase(o)
+ , m_rect(o->needsLayout() ? IntRect() : o->selectionRectForRepaint(m_repaintContainer, clipToVisibleContent))
+ {
+ }
+
+ void repaint()
+ {
+ m_object->repaintUsingContainer(m_repaintContainer, m_rect);
+ }
+
+ IntRect rect() const { return m_rect; }
+
+private:
+ IntRect m_rect; // relative to repaint container
+};
+
+
+// This struct is used when the selection changes to cache the old and new state of the selection for each RenderBlock.
+class RenderBlockSelectionInfo : public RenderSelectionInfoBase {
+public:
+ RenderBlockSelectionInfo(RenderBlock* b)
+ : RenderSelectionInfoBase(b)
+ , m_rects(b->needsLayout() ? GapRects() : block()->selectionGapRectsForRepaint(m_repaintContainer))
+ {
+ }
+
+ void repaint()
+ {
+ m_object->repaintUsingContainer(m_repaintContainer, m_rects);
+ }
+
+ RenderBlock* block() const { ASSERT(m_object->isRenderBlock()); return static_cast<RenderBlock*>(m_object); }
+ GapRects rects() const { return m_rects; }
+
+private:
+ GapRects m_rects; // relative to repaint container
+};
+
+} // namespace WebCore
+
+
+#endif // SelectionInfo_h
--- /dev/null
+/**
+ *
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderSlider_h
+#define RenderSlider_h
+
+#include "RenderBlock.h"
+
+namespace WebCore {
+
+ class HTMLDivElement;
+ class HTMLInputElement;
+ class HTMLSliderThumbElement;
+ class MouseEvent;
+
+ class RenderSlider : public RenderBlock {
+ public:
+ RenderSlider(HTMLInputElement*);
+ ~RenderSlider();
+
+ virtual const char* renderName() const { return "RenderSlider"; }
+ virtual bool isSlider() const { return true; }
+
+ virtual int baselinePosition( bool, bool ) const;
+ virtual void calcPrefWidths();
+ virtual void layout();
+ virtual void updateFromElement();
+
+ virtual bool mouseEventIsInThumb(MouseEvent*);
+
+ void setValueForPosition(int position);
+ double setPositionFromValue(bool inLayout = false);
+ int positionForOffset(const IntPoint&);
+
+ void valueChanged();
+
+ int currentPosition();
+ void setCurrentPosition(int pos);
+
+ void forwardEvent(Event*);
+ bool inDragMode() const;
+
+ protected:
+ virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+
+ private:
+ PassRefPtr<RenderStyle> createThumbStyle(const RenderStyle* parentStyle, const RenderStyle* oldStyle = 0);
+ int trackSize();
+
+ RefPtr<HTMLSliderThumbElement> m_thumb;
+};
+
+} // namespace WebCore
+
+#endif // RenderSlider_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderStyle_h
+#define RenderStyle_h
+
+#include "TransformationMatrix.h"
+#include "AnimationList.h"
+#include "BorderData.h"
+#include "BorderValue.h"
+#include "CSSHelper.h"
+#include "CSSImageGeneratorValue.h"
+#include "CSSPrimitiveValue.h"
+#include "CSSReflectionDirection.h"
+#include "CSSValueList.h"
+#include "CachedImage.h"
+#include "CollapsedBorderValue.h"
+#include "Color.h"
+#include "ContentData.h"
+#include "CounterDirectives.h"
+#include "CursorList.h"
+#include "DataRef.h"
+#include "FillLayer.h"
+#include "FloatPoint.h"
+#include "Font.h"
+#include "GraphicsTypes.h"
+#include "IntRect.h"
+#include "Length.h"
+#include "LengthBox.h"
+#include "LengthSize.h"
+#include "NinePieceImage.h"
+#include "OutlineValue.h"
+#include "Pair.h"
+#include "RenderStyleConstants.h"
+#include "ShadowData.h"
+#include "StyleBackgroundData.h"
+#include "StyleBoxData.h"
+#include "StyleFlexibleBoxData.h"
+#include "StyleInheritedData.h"
+#include "StyleMarqueeData.h"
+#include "StyleMultiColData.h"
+#include "StyleRareInheritedData.h"
+#include "StyleRareNonInheritedData.h"
+#include "StyleReflection.h"
+#include "StyleSurroundData.h"
+#include "StyleTransformData.h"
+#include "StyleVisualData.h"
+#include "TextDirection.h"
+#include "ThemeTypes.h"
+#include "TimingFunction.h"
+#include "TransformOperations.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/StdLibExtras.h>
+#include <wtf/Vector.h>
+
+#if ENABLE(DASHBOARD_SUPPORT)
+#include "StyleDashboardRegion.h"
+#endif
+
+#include "TextSizeAdjustment.h"
+
+#if ENABLE(SVG)
+#include "SVGRenderStyle.h"
+#endif
+
+#if ENABLE(XBL)
+#include "BindingURI.h"
+#endif
+
+template<typename T, typename U> inline bool compareEqual(const T& t, const U& u) { return t == static_cast<T>(u); }
+
+#define SET_VAR(group, variable, value) \
+ if (!compareEqual(group->variable, value)) \
+ group.access()->variable = value;
+
+namespace WebCore {
+
+using std::max;
+
+class CSSStyleSelector;
+class CSSValueList;
+class CachedImage;
+class Pair;
+class StringImpl;
+class StyleImage;
+
+class RenderStyle: public RefCounted<RenderStyle> {
+ friend class CSSStyleSelector;
+
+public:
+ // static pseudo styles. Dynamic ones are produced on the fly.
+ enum PseudoId { NOPSEUDO, FIRST_LINE, FIRST_LETTER, BEFORE, AFTER, SELECTION, FIRST_LINE_INHERITED, SCROLLBAR, FILE_UPLOAD_BUTTON, INPUT_PLACEHOLDER,
+ SLIDER_THUMB, SEARCH_CANCEL_BUTTON, SEARCH_DECORATION, SEARCH_RESULTS_DECORATION, SEARCH_RESULTS_BUTTON, MEDIA_CONTROLS_PANEL,
+ MEDIA_CONTROLS_PLAY_BUTTON, MEDIA_CONTROLS_MUTE_BUTTON, MEDIA_CONTROLS_TIMELINE, MEDIA_CONTROLS_TIMELINE_CONTAINER,
+ MEDIA_CONTROLS_CURRENT_TIME_DISPLAY, MEDIA_CONTROLS_TIME_REMAINING_DISPLAY, MEDIA_CONTROLS_SEEK_BACK_BUTTON,
+ MEDIA_CONTROLS_SEEK_FORWARD_BUTTON, MEDIA_CONTROLS_FULLSCREEN_BUTTON,
+ SCROLLBAR_THUMB, SCROLLBAR_BUTTON, SCROLLBAR_TRACK, SCROLLBAR_TRACK_PIECE, SCROLLBAR_CORNER, RESIZER };
+ static const int FIRST_INTERNAL_PSEUDOID = FILE_UPLOAD_BUTTON;
+
+protected:
+
+// !START SYNC!: Keep this in sync with the copy constructor in RenderStyle.cpp
+
+ // inherit
+ struct InheritedFlags {
+ bool operator==(const InheritedFlags& other) const
+ {
+ return (_empty_cells == other._empty_cells) &&
+ (_caption_side == other._caption_side) &&
+ (_list_style_type == other._list_style_type) &&
+ (_list_style_position == other._list_style_position) &&
+ (_visibility == other._visibility) &&
+ (_text_align == other._text_align) &&
+ (_text_transform == other._text_transform) &&
+ (_text_decorations == other._text_decorations) &&
+ (_text_transform == other._text_transform) &&
+ (_cursor_style == other._cursor_style) &&
+ (_direction == other._direction) &&
+ (_border_collapse == other._border_collapse) &&
+ (_white_space == other._white_space) &&
+ (_box_direction == other._box_direction) &&
+ (_visuallyOrdered == other._visuallyOrdered) &&
+ (_htmlHacks == other._htmlHacks) &&
+ (_force_backgrounds_to_white == other._force_backgrounds_to_white) &&
+ (_pointerEvents == other._pointerEvents);
+ }
+
+ bool operator!=(const InheritedFlags& other) const { return !(*this == other); }
+
+ unsigned _empty_cells : 1; // EEmptyCell
+ unsigned _caption_side : 2; // ECaptionSide
+ unsigned _list_style_type : 5 ; // EListStyleType
+ unsigned _list_style_position : 1; // EListStylePosition
+ unsigned _visibility : 2; // EVisibility
+ unsigned _text_align : 3; // ETextAlign
+ unsigned _text_transform : 2; // ETextTransform
+ unsigned _text_decorations : 4;
+ unsigned _cursor_style : 6; // ECursor
+ unsigned _direction : 1; // TextDirection
+ bool _border_collapse : 1 ;
+ unsigned _white_space : 3; // EWhiteSpace
+ unsigned _box_direction : 1; // EBoxDirection (CSS3 box_direction property, flexible box layout module)
+
+ // non CSS2 inherited
+ bool _visuallyOrdered : 1;
+ bool _htmlHacks :1;
+ bool _force_backgrounds_to_white : 1;
+ unsigned _pointerEvents : 4; // EPointerEvents
+ } inherited_flags;
+
+// don't inherit
+ struct NonInheritedFlags {
+ bool operator==(const NonInheritedFlags& other) const
+ {
+ return (_effectiveDisplay == other._effectiveDisplay) &&
+ (_originalDisplay == other._originalDisplay) &&
+ (_overflowX == other._overflowX) &&
+ (_overflowY == other._overflowY) &&
+ (_vertical_align == other._vertical_align) &&
+ (_clear == other._clear) &&
+ (_position == other._position) &&
+ (_floating == other._floating) &&
+ (_table_layout == other._table_layout) &&
+ (_page_break_before == other._page_break_before) &&
+ (_page_break_after == other._page_break_after) &&
+ (_styleType == other._styleType) &&
+ (_affectedByHover == other._affectedByHover) &&
+ (_affectedByActive == other._affectedByActive) &&
+ (_affectedByDrag == other._affectedByDrag) &&
+ (_pseudoBits == other._pseudoBits) &&
+ (_unicodeBidi == other._unicodeBidi);
+ }
+
+ bool operator!=(const NonInheritedFlags& other) const { return !(*this == other); }
+
+ unsigned _effectiveDisplay : 5; // EDisplay
+ unsigned _originalDisplay : 5; // EDisplay
+ unsigned _overflowX : 3; // EOverflow
+ unsigned _overflowY : 3; // EOverflow
+ unsigned _vertical_align : 4; // EVerticalAlign
+ unsigned _clear : 2; // EClear
+ unsigned _position : 2; // EPosition
+ unsigned _floating : 2; // EFloat
+ unsigned _table_layout : 1; // ETableLayout
+
+ unsigned _page_break_before : 2; // EPageBreak
+ unsigned _page_break_after : 2; // EPageBreak
+
+ unsigned _styleType : 5; // PseudoId
+ bool _affectedByHover : 1;
+ bool _affectedByActive : 1;
+ bool _affectedByDrag : 1;
+ unsigned _pseudoBits : 7;
+ unsigned _unicodeBidi : 2; // EUnicodeBidi
+ } noninherited_flags;
+
+ // non-inherited attributes
+ DataRef<StyleBoxData> box;
+ DataRef<StyleVisualData> visual;
+ DataRef<StyleBackgroundData> background;
+ DataRef<StyleSurroundData> surround;
+ DataRef<StyleRareNonInheritedData> rareNonInheritedData;
+
+ // inherited attributes
+ DataRef<StyleRareInheritedData> rareInheritedData;
+ DataRef<StyleInheritedData> inherited;
+
+ // list of associated pseudo styles
+ RefPtr<RenderStyle> m_cachedPseudoStyle;
+
+ unsigned m_pseudoState : 3; // PseudoState
+ bool m_affectedByAttributeSelectors : 1;
+ bool m_unique : 1;
+
+ // Bits for dynamic child matching.
+ bool m_affectedByEmpty : 1;
+ bool m_emptyState : 1;
+
+ // We optimize for :first-child and :last-child. The other positional child selectors like nth-child or
+ // *-child-of-type, we will just give up and re-evaluate whenever children change at all.
+ bool m_childrenAffectedByFirstChildRules : 1;
+ bool m_childrenAffectedByLastChildRules : 1;
+ bool m_childrenAffectedByDirectAdjacentRules : 1;
+ bool m_childrenAffectedByForwardPositionalRules : 1;
+ bool m_childrenAffectedByBackwardPositionalRules : 1;
+ bool m_firstChildState : 1;
+ bool m_lastChildState : 1;
+ unsigned m_childIndex : 18; // Plenty of bits to cache an index.
+
+#if ENABLE(SVG)
+ DataRef<SVGRenderStyle> m_svgStyle;
+#endif
+
+// !END SYNC!
+
+protected:
+ void setBitDefaults()
+ {
+ inherited_flags._empty_cells = initialEmptyCells();
+ inherited_flags._caption_side = initialCaptionSide();
+ inherited_flags._list_style_type = initialListStyleType();
+ inherited_flags._list_style_position = initialListStylePosition();
+ inherited_flags._visibility = initialVisibility();
+ inherited_flags._text_align = initialTextAlign();
+ inherited_flags._text_transform = initialTextTransform();
+ inherited_flags._text_decorations = initialTextDecoration();
+ inherited_flags._cursor_style = initialCursor();
+ inherited_flags._direction = initialDirection();
+ inherited_flags._border_collapse = initialBorderCollapse();
+ inherited_flags._white_space = initialWhiteSpace();
+ inherited_flags._visuallyOrdered = initialVisuallyOrdered();
+ inherited_flags._htmlHacks=false;
+ inherited_flags._box_direction = initialBoxDirection();
+ inherited_flags._force_backgrounds_to_white = false;
+ inherited_flags._pointerEvents = initialPointerEvents();
+
+ noninherited_flags._effectiveDisplay = noninherited_flags._originalDisplay = initialDisplay();
+ noninherited_flags._overflowX = initialOverflowX();
+ noninherited_flags._overflowY = initialOverflowY();
+ noninherited_flags._vertical_align = initialVerticalAlign();
+ noninherited_flags._clear = initialClear();
+ noninherited_flags._position = initialPosition();
+ noninherited_flags._floating = initialFloating();
+ noninherited_flags._table_layout = initialTableLayout();
+ noninherited_flags._page_break_before = initialPageBreak();
+ noninherited_flags._page_break_after = initialPageBreak();
+ noninherited_flags._styleType = NOPSEUDO;
+ noninherited_flags._affectedByHover = false;
+ noninherited_flags._affectedByActive = false;
+ noninherited_flags._affectedByDrag = false;
+ noninherited_flags._pseudoBits = 0;
+ noninherited_flags._unicodeBidi = initialUnicodeBidi();
+ }
+
+protected:
+ RenderStyle();
+ // used to create the default style.
+ RenderStyle(bool);
+ RenderStyle(const RenderStyle&);
+
+public:
+ static PassRefPtr<RenderStyle> create();
+ static PassRefPtr<RenderStyle> createDefaultStyle();
+ static PassRefPtr<RenderStyle> clone(const RenderStyle*);
+
+ ~RenderStyle();
+
+ void inheritFrom(const RenderStyle* inheritParent);
+
+ PseudoId styleType() { return static_cast<PseudoId>(noninherited_flags._styleType); }
+ void setStyleType(PseudoId styleType) { noninherited_flags._styleType = styleType; }
+
+ RenderStyle* getCachedPseudoStyle(PseudoId);
+ RenderStyle* addCachedPseudoStyle(PassRefPtr<RenderStyle>);
+
+ bool affectedByHoverRules() const { return noninherited_flags._affectedByHover; }
+ bool affectedByActiveRules() const { return noninherited_flags._affectedByActive; }
+ bool affectedByDragRules() const { return noninherited_flags._affectedByDrag; }
+
+ void setAffectedByHoverRules(bool b) { noninherited_flags._affectedByHover = b; }
+ void setAffectedByActiveRules(bool b) { noninherited_flags._affectedByActive = b; }
+ void setAffectedByDragRules(bool b) { noninherited_flags._affectedByDrag = b; }
+
+ bool operator==(const RenderStyle& other) const;
+ bool operator!=(const RenderStyle& other) const { return !(*this == other); }
+ bool isFloating() const { return !(noninherited_flags._floating == FNONE); }
+ bool hasMargin() const { return surround->margin.nonZero(); }
+ bool hasBorder() const { return surround->border.hasBorder(); }
+ bool hasPadding() const { return surround->padding.nonZero(); }
+ bool hasOffset() const { return surround->offset.nonZero(); }
+
+ bool hasBackground() const
+ {
+ if (backgroundColor().isValid() && backgroundColor().alpha() > 0)
+ return true;
+ return background->m_background.hasImage();
+ }
+ bool hasBackgroundImage() const { return background->m_background.hasImage(); }
+ bool hasFixedBackgroundImage() const { return background->m_background.hasFixedImage(); }
+ bool hasAppearance() const { return appearance() != NoControlPart; }
+
+ bool visuallyOrdered() const { return inherited_flags._visuallyOrdered; }
+ void setVisuallyOrdered(bool b) { inherited_flags._visuallyOrdered = b; }
+
+ bool isStyleAvailable() const;
+
+ bool hasPseudoStyle(PseudoId pseudo) const;
+ void setHasPseudoStyle(PseudoId pseudo);
+
+ // attribute getter methods
+
+ EDisplay display() const { return static_cast<EDisplay>(noninherited_flags._effectiveDisplay); }
+ EDisplay originalDisplay() const { return static_cast<EDisplay>(noninherited_flags._originalDisplay); }
+
+ Length left() const { return surround->offset.left(); }
+ Length right() const { return surround->offset.right(); }
+ Length top() const { return surround->offset.top(); }
+ Length bottom() const { return surround->offset.bottom(); }
+
+ EPosition position() const { return static_cast<EPosition>(noninherited_flags._position); }
+ EFloat floating() const { return static_cast<EFloat>(noninherited_flags._floating); }
+
+ Length width() const { return box->width; }
+ Length height() const { return box->height; }
+ Length minWidth() const { return box->min_width; }
+ Length maxWidth() const { return box->max_width; }
+ Length minHeight() const { return box->min_height; }
+ Length maxHeight() const { return box->max_height; }
+
+ const BorderData& border() const { return surround->border; }
+ const BorderValue& borderLeft() const { return surround->border.left; }
+ const BorderValue& borderRight() const { return surround->border.right; }
+ const BorderValue& borderTop() const { return surround->border.top; }
+ const BorderValue& borderBottom() const { return surround->border.bottom; }
+
+ const NinePieceImage& borderImage() const { return surround->border.image; }
+
+ const IntSize& borderTopLeftRadius() const { return surround->border.topLeft; }
+ const IntSize& borderTopRightRadius() const { return surround->border.topRight; }
+ const IntSize& borderBottomLeftRadius() const { return surround->border.bottomLeft; }
+ const IntSize& borderBottomRightRadius() const { return surround->border.bottomRight; }
+ bool hasBorderRadius() const { return surround->border.hasBorderRadius(); }
+
+ unsigned short borderLeftWidth() const { return surround->border.borderLeftWidth(); }
+ EBorderStyle borderLeftStyle() const { return surround->border.left.style(); }
+ const Color& borderLeftColor() const { return surround->border.left.color; }
+ bool borderLeftIsTransparent() const { return surround->border.left.isTransparent(); }
+ unsigned short borderRightWidth() const { return surround->border.borderRightWidth(); }
+ EBorderStyle borderRightStyle() const { return surround->border.right.style(); }
+ const Color& borderRightColor() const { return surround->border.right.color; }
+ bool borderRightIsTransparent() const { return surround->border.right.isTransparent(); }
+ unsigned short borderTopWidth() const { return surround->border.borderTopWidth(); }
+ EBorderStyle borderTopStyle() const { return surround->border.top.style(); }
+ const Color& borderTopColor() const { return surround->border.top.color; }
+ bool borderTopIsTransparent() const { return surround->border.top.isTransparent(); }
+ unsigned short borderBottomWidth() const { return surround->border.borderBottomWidth(); }
+ EBorderStyle borderBottomStyle() const { return surround->border.bottom.style(); }
+ const Color& borderBottomColor() const { return surround->border.bottom.color; }
+ bool borderBottomIsTransparent() const { return surround->border.bottom.isTransparent(); }
+
+ unsigned short outlineSize() const { return max(0, outlineWidth() + outlineOffset()); }
+ unsigned short outlineWidth() const
+ {
+ if (background->m_outline.style() == BNONE)
+ return 0;
+ return background->m_outline.width;
+ }
+ bool hasOutline() const { return outlineWidth() > 0 && outlineStyle() > BHIDDEN; }
+ EBorderStyle outlineStyle() const { return background->m_outline.style(); }
+ bool outlineStyleIsAuto() const { return background->m_outline._auto; }
+ const Color& outlineColor() const { return background->m_outline.color; }
+
+ EOverflow overflowX() const { return static_cast<EOverflow>(noninherited_flags._overflowX); }
+ EOverflow overflowY() const { return static_cast<EOverflow>(noninherited_flags._overflowY); }
+
+ EVisibility visibility() const { return static_cast<EVisibility>(inherited_flags._visibility); }
+ EVerticalAlign verticalAlign() const { return static_cast<EVerticalAlign>(noninherited_flags._vertical_align); }
+ Length verticalAlignLength() const { return box->vertical_align; }
+
+ Length clipLeft() const { return visual->clip.left(); }
+ Length clipRight() const { return visual->clip.right(); }
+ Length clipTop() const { return visual->clip.top(); }
+ Length clipBottom() const { return visual->clip.bottom(); }
+ LengthBox clip() const { return visual->clip; }
+ bool hasClip() const { return visual->hasClip; }
+
+ EUnicodeBidi unicodeBidi() const { return static_cast<EUnicodeBidi>(noninherited_flags._unicodeBidi); }
+
+ EClear clear() const { return static_cast<EClear>(noninherited_flags._clear); }
+ ETableLayout tableLayout() const { return static_cast<ETableLayout>(noninherited_flags._table_layout); }
+
+ const Font& font() const { return inherited->font; }
+ const FontDescription& fontDescription() const { return inherited->font.fontDescription(); }
+ int fontSize() const { return inherited->font.pixelSize(); }
+
+ const Color& color() const { return inherited->color; }
+ Length textIndent() const { return inherited->indent; }
+ ETextAlign textAlign() const { return static_cast<ETextAlign>(inherited_flags._text_align); }
+ ETextTransform textTransform() const { return static_cast<ETextTransform>(inherited_flags._text_transform); }
+ int textDecorationsInEffect() const { return inherited_flags._text_decorations; }
+ int textDecoration() const { return visual->textDecoration; }
+ int wordSpacing() const { return inherited->font.wordSpacing(); }
+ float letterSpacing() const { return inherited->font.letterSpacing(); }
+
+ float zoom() const { return visual->m_zoom; }
+ float effectiveZoom() const { return inherited->m_effectiveZoom; }
+
+ TextDirection direction() const { return static_cast<TextDirection>(inherited_flags._direction); }
+ Length lineHeight() const { return inherited->line_height; }
+
+ Length specifiedLineHeight() const { return inherited->specified_line_height; }
+ EWhiteSpace whiteSpace() const { return static_cast<EWhiteSpace>(inherited_flags._white_space); }
+ static bool autoWrap(EWhiteSpace ws)
+ {
+ // Nowrap and pre don't automatically wrap.
+ return ws != NOWRAP && ws != PRE;
+ }
+
+ bool autoWrap() const
+ {
+ return autoWrap(whiteSpace());
+ }
+
+ static bool preserveNewline(EWhiteSpace ws)
+ {
+ // Normal and nowrap do not preserve newlines.
+ return ws != NORMAL && ws != NOWRAP;
+ }
+
+ bool preserveNewline() const
+ {
+ return preserveNewline(whiteSpace());
+ }
+
+ static bool collapseWhiteSpace(EWhiteSpace ws)
+ {
+ // Pre and prewrap do not collapse whitespace.
+ return ws != PRE && ws != PRE_WRAP;
+ }
+
+ bool collapseWhiteSpace() const
+ {
+ return collapseWhiteSpace(whiteSpace());
+ }
+
+ bool isCollapsibleWhiteSpace(UChar c) const
+ {
+ switch (c) {
+ case ' ':
+ case '\t':
+ return collapseWhiteSpace();
+ case '\n':
+ return !preserveNewline();
+ }
+ return false;
+ }
+
+ bool breakOnlyAfterWhiteSpace() const
+ {
+ return whiteSpace() == PRE_WRAP || khtmlLineBreak() == AFTER_WHITE_SPACE;
+ }
+
+ bool breakWords() const
+ {
+ return wordBreak() == BreakWordBreak || wordWrap() == BreakWordWrap;
+ }
+
+ const Color& backgroundColor() const { return background->m_color; }
+ StyleImage* backgroundImage() const { return background->m_background.m_image.get(); }
+ EFillRepeat backgroundRepeat() const { return static_cast<EFillRepeat>(background->m_background.m_repeat); }
+ CompositeOperator backgroundComposite() const { return static_cast<CompositeOperator>(background->m_background.m_composite); }
+ bool backgroundAttachment() const { return background->m_background.m_attachment; }
+ EFillBox backgroundClip() const { return static_cast<EFillBox>(background->m_background.m_clip); }
+ EFillBox backgroundOrigin() const { return static_cast<EFillBox>(background->m_background.m_origin); }
+ Length backgroundXPosition() const { return background->m_background.m_xPosition; }
+ Length backgroundYPosition() const { return background->m_background.m_yPosition; }
+ LengthSize backgroundSize() const { return background->m_background.m_size; }
+ FillLayer* accessBackgroundLayers() { return &(background.access()->m_background); }
+ const FillLayer* backgroundLayers() const { return &(background->m_background); }
+
+ StyleImage* maskImage() const { return rareNonInheritedData->m_mask.m_image.get(); }
+ EFillRepeat maskRepeat() const { return static_cast<EFillRepeat>(rareNonInheritedData->m_mask.m_repeat); }
+ CompositeOperator maskComposite() const { return static_cast<CompositeOperator>(rareNonInheritedData->m_mask.m_composite); }
+ bool maskAttachment() const { return rareNonInheritedData->m_mask.m_attachment; }
+ EFillBox maskClip() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.m_clip); }
+ EFillBox maskOrigin() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.m_origin); }
+ Length maskXPosition() const { return rareNonInheritedData->m_mask.m_xPosition; }
+ Length maskYPosition() const { return rareNonInheritedData->m_mask.m_yPosition; }
+ LengthSize maskSize() const { return rareNonInheritedData->m_mask.m_size; }
+ FillLayer* accessMaskLayers() { return &(rareNonInheritedData.access()->m_mask); }
+ const FillLayer* maskLayers() const { return &(rareNonInheritedData->m_mask); }
+ const NinePieceImage& maskBoxImage() const { return rareNonInheritedData->m_maskBoxImage; }
+
+ // returns true for collapsing borders, false for separate borders
+ bool borderCollapse() const { return inherited_flags._border_collapse; }
+ short horizontalBorderSpacing() const { return inherited->horizontal_border_spacing; }
+ short verticalBorderSpacing() const { return inherited->vertical_border_spacing; }
+ EEmptyCell emptyCells() const { return static_cast<EEmptyCell>(inherited_flags._empty_cells); }
+ ECaptionSide captionSide() const { return static_cast<ECaptionSide>(inherited_flags._caption_side); }
+
+ short counterIncrement() const { return visual->counterIncrement; }
+ short counterReset() const { return visual->counterReset; }
+
+ EListStyleType listStyleType() const { return static_cast<EListStyleType>(inherited_flags._list_style_type); }
+ StyleImage* listStyleImage() const { return inherited->list_style_image.get(); }
+ EListStylePosition listStylePosition() const { return static_cast<EListStylePosition>(inherited_flags._list_style_position); }
+
+ Length marginTop() const { return surround->margin.top(); }
+ Length marginBottom() const { return surround->margin.bottom(); }
+ Length marginLeft() const { return surround->margin.left(); }
+ Length marginRight() const { return surround->margin.right(); }
+
+ LengthBox paddingBox() const { return surround->padding; }
+ Length paddingTop() const { return surround->padding.top(); }
+ Length paddingBottom() const { return surround->padding.bottom(); }
+ Length paddingLeft() const { return surround->padding.left(); }
+ Length paddingRight() const { return surround->padding.right(); }
+
+ ECursor cursor() const { return static_cast<ECursor>(inherited_flags._cursor_style); }
+
+ CursorList* cursors() const { return inherited->cursorData.get(); }
+
+ short widows() const { return inherited->widows; }
+ short orphans() const { return inherited->orphans; }
+ EPageBreak pageBreakInside() const { return static_cast<EPageBreak>(inherited->page_break_inside); }
+ EPageBreak pageBreakBefore() const { return static_cast<EPageBreak>(noninherited_flags._page_break_before); }
+ EPageBreak pageBreakAfter() const { return static_cast<EPageBreak>(noninherited_flags._page_break_after); }
+
+ // CSS3 Getter Methods
+#if ENABLE(XBL)
+ BindingURI* bindingURIs() const { return rareNonInheritedData->bindingURI; }
+#endif
+
+ int outlineOffset() const
+ {
+ if (background->m_outline.style() == BNONE)
+ return 0;
+ return background->m_outline._offset;
+ }
+
+ ShadowData* textShadow() const { return rareInheritedData->textShadow; }
+ const Color& textStrokeColor() const { return rareInheritedData->textStrokeColor; }
+ float textStrokeWidth() const { return rareInheritedData->textStrokeWidth; }
+ const Color& textFillColor() const { return rareInheritedData->textFillColor; }
+ float opacity() const { return rareNonInheritedData->opacity; }
+ ControlPart appearance() const { return static_cast<ControlPart>(rareNonInheritedData->m_appearance); }
+ EImageLoadingBorder imageLoadingBorder() { return static_cast<EImageLoadingBorder>(rareNonInheritedData->m_imageLoadingBorder); }
+ EBoxAlignment boxAlign() const { return static_cast<EBoxAlignment>(rareNonInheritedData->flexibleBox->align); }
+ EBoxDirection boxDirection() const { return static_cast<EBoxDirection>(inherited_flags._box_direction); }
+ float boxFlex() { return rareNonInheritedData->flexibleBox->flex; }
+ unsigned int boxFlexGroup() const { return rareNonInheritedData->flexibleBox->flex_group; }
+ EBoxLines boxLines() { return static_cast<EBoxLines>(rareNonInheritedData->flexibleBox->lines); }
+ unsigned int boxOrdinalGroup() const { return rareNonInheritedData->flexibleBox->ordinal_group; }
+ EBoxOrient boxOrient() const { return static_cast<EBoxOrient>(rareNonInheritedData->flexibleBox->orient); }
+ EBoxAlignment boxPack() const { return static_cast<EBoxAlignment>(rareNonInheritedData->flexibleBox->pack); }
+ ShadowData* boxShadow() const { return rareNonInheritedData->m_boxShadow.get(); }
+ StyleReflection* boxReflect() const { return rareNonInheritedData->m_boxReflect.get(); }
+ EBoxSizing boxSizing() const { return static_cast<EBoxSizing>(box->boxSizing); }
+ Length marqueeIncrement() const { return rareNonInheritedData->marquee->increment; }
+ int marqueeSpeed() const { return rareNonInheritedData->marquee->speed; }
+ int marqueeLoopCount() const { return rareNonInheritedData->marquee->loops; }
+ EMarqueeBehavior marqueeBehavior() const { return static_cast<EMarqueeBehavior>(rareNonInheritedData->marquee->behavior); }
+ EMarqueeDirection marqueeDirection() const { return static_cast<EMarqueeDirection>(rareNonInheritedData->marquee->direction); }
+ EUserModify userModify() const { return static_cast<EUserModify>(rareInheritedData->userModify); }
+ EUserDrag userDrag() const { return static_cast<EUserDrag>(rareNonInheritedData->userDrag); }
+ EUserSelect userSelect() const { return static_cast<EUserSelect>(rareInheritedData->userSelect); }
+ bool textOverflow() const { return rareNonInheritedData->textOverflow; }
+ EMarginCollapse marginTopCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginTopCollapse); }
+ EMarginCollapse marginBottomCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginBottomCollapse); }
+ EWordBreak wordBreak() const { return static_cast<EWordBreak>(rareInheritedData->wordBreak); }
+ EWordWrap wordWrap() const { return static_cast<EWordWrap>(rareInheritedData->wordWrap); }
+ ENBSPMode nbspMode() const { return static_cast<ENBSPMode>(rareInheritedData->nbspMode); }
+ EKHTMLLineBreak khtmlLineBreak() const { return static_cast<EKHTMLLineBreak>(rareInheritedData->khtmlLineBreak); }
+ EMatchNearestMailBlockquoteColor matchNearestMailBlockquoteColor() const { return static_cast<EMatchNearestMailBlockquoteColor>(rareNonInheritedData->matchNearestMailBlockquoteColor); }
+ const AtomicString& highlight() const { return rareInheritedData->highlight; }
+ EBorderFit borderFit() const { return static_cast<EBorderFit>(rareNonInheritedData->m_borderFit); }
+ EResize resize() const { return static_cast<EResize>(rareInheritedData->resize); }
+ float columnWidth() const { return rareNonInheritedData->m_multiCol->m_width; }
+ bool hasAutoColumnWidth() const { return rareNonInheritedData->m_multiCol->m_autoWidth; }
+ unsigned short columnCount() const { return rareNonInheritedData->m_multiCol->m_count; }
+ bool hasAutoColumnCount() const { return rareNonInheritedData->m_multiCol->m_autoCount; }
+ float columnGap() const { return rareNonInheritedData->m_multiCol->m_gap; }
+ bool hasNormalColumnGap() const { return rareNonInheritedData->m_multiCol->m_normalGap; }
+ const Color& columnRuleColor() const { return rareNonInheritedData->m_multiCol->m_rule.color; }
+ EBorderStyle columnRuleStyle() const { return rareNonInheritedData->m_multiCol->m_rule.style(); }
+ unsigned short columnRuleWidth() const { return rareNonInheritedData->m_multiCol->ruleWidth(); }
+ bool columnRuleIsTransparent() const { return rareNonInheritedData->m_multiCol->m_rule.isTransparent(); }
+ EPageBreak columnBreakBefore() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakBefore); }
+ EPageBreak columnBreakInside() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakInside); }
+ EPageBreak columnBreakAfter() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakAfter); }
+ const TransformOperations& transform() const { return rareNonInheritedData->m_transform->m_operations; }
+ Length transformOriginX() const { return rareNonInheritedData->m_transform->m_x; }
+ Length transformOriginY() const { return rareNonInheritedData->m_transform->m_y; }
+ float transformOriginZ() const { return rareNonInheritedData->m_transform->m_z; }
+ bool hasTransform() const { return !rareNonInheritedData->m_transform->m_operations.operations().isEmpty(); }
+
+ // Return true if any transform related property (currently transform, transformStyle3D or perspective)
+ // indicates that we are transforming
+ bool hasTransformRelatedProperty() const { return hasTransform() || preserves3D() || hasPerspective(); }
+
+ enum ApplyTransformOrigin { IncludeTransformOrigin, ExcludeTransformOrigin };
+ void applyTransform(TransformationMatrix&, const IntSize& borderBoxSize, ApplyTransformOrigin = IncludeTransformOrigin) const;
+
+ bool hasMask() const { return rareNonInheritedData->m_mask.hasImage() || rareNonInheritedData->m_maskBoxImage.hasImage(); }
+ // End CSS3 Getters
+
+ // Apple-specific property getter methods
+ EPointerEvents pointerEvents() const { return static_cast<EPointerEvents>(inherited_flags._pointerEvents); }
+ const AnimationList* animations() const { return rareNonInheritedData->m_animations.get(); }
+ const AnimationList* transitions() const { return rareNonInheritedData->m_transitions.get(); }
+
+ AnimationList* accessAnimations();
+ AnimationList* accessTransitions();
+
+ bool hasAnimations() const { return rareNonInheritedData->m_animations && rareNonInheritedData->m_animations->size() > 0; }
+ bool hasTransitions() const { return rareNonInheritedData->m_transitions && rareNonInheritedData->m_transitions->size() > 0; }
+
+ // return the first found Animation (including 'all' transitions)
+ const Animation* transitionForProperty(int property) const;
+
+ ETransformStyle3D transformStyle3D() const { return rareNonInheritedData->m_transformStyle3D; }
+ bool preserves3D() const { return rareNonInheritedData->m_transformStyle3D == TransformStyle3DPreserve3D; }
+
+ EBackfaceVisibility backfaceVisibility() const { return rareNonInheritedData->m_backfaceVisibility; }
+ float perspective() const { return rareNonInheritedData->m_perspective; }
+ bool hasPerspective() const { return rareNonInheritedData->m_perspective > 0; }
+ Length perspectiveOriginX() const { return rareNonInheritedData->m_perspectiveOriginX; }
+ Length perspectiveOriginY() const { return rareNonInheritedData->m_perspectiveOriginY; }
+
+#if USE(ACCELERATED_COMPOSITING)
+ // When set, this ensures that styles compare as different. Used during accelerated animations.
+ bool isRunningAcceleratedAnimation() const { return rareNonInheritedData->m_runningAcceleratedAnimation; }
+#endif
+
+ int lineClamp() const { return rareNonInheritedData->lineClamp; }
+ TextSizeAdjustment textSizeAdjust() const { return rareInheritedData->textSizeAdjust; }
+ Color tapHighlightColor() const { return rareInheritedData->tapHighlightColor; }
+ bool touchCalloutEnabled() const { return rareInheritedData->touchCalloutEnabled; }
+ Color compositionFillColor() const { return rareInheritedData->compositionFillColor; }
+ Color compositionFrameColor() const { return rareInheritedData->compositionFrameColor; }
+ ETextSecurity textSecurity() const { return static_cast<ETextSecurity>(rareInheritedData->textSecurity); }
+
+// attribute setter methods
+
+ void setDisplay(EDisplay v) { noninherited_flags._effectiveDisplay = v; }
+ void setOriginalDisplay(EDisplay v) { noninherited_flags._originalDisplay = v; }
+ void setPosition(EPosition v) { noninherited_flags._position = v; }
+ void setFloating(EFloat v) { noninherited_flags._floating = v; }
+
+ void setLeft(Length v) { SET_VAR(surround, offset.m_left, v) }
+ void setRight(Length v) { SET_VAR(surround, offset.m_right, v) }
+ void setTop(Length v) { SET_VAR(surround, offset.m_top, v) }
+ void setBottom(Length v) { SET_VAR(surround, offset.m_bottom, v) }
+
+ void setWidth(Length v) { SET_VAR(box, width, v) }
+ void setHeight(Length v) { SET_VAR(box, height, v) }
+
+ void setMinWidth(Length v) { SET_VAR(box, min_width, v) }
+ void setMaxWidth(Length v) { SET_VAR(box, max_width, v) }
+ void setMinHeight(Length v) { SET_VAR(box, min_height, v) }
+ void setMaxHeight(Length v) { SET_VAR(box, max_height, v) }
+
+#if ENABLE(DASHBOARD_SUPPORT)
+ Vector<StyleDashboardRegion> dashboardRegions() const { return rareNonInheritedData->m_dashboardRegions; }
+ void setDashboardRegions(Vector<StyleDashboardRegion> regions) { SET_VAR(rareNonInheritedData, m_dashboardRegions, regions); }
+
+ void setDashboardRegion(int type, const String& label, Length t, Length r, Length b, Length l, bool append)
+ {
+ StyleDashboardRegion region;
+ region.label = label;
+ region.offset.m_top = t;
+ region.offset.m_right = r;
+ region.offset.m_bottom = b;
+ region.offset.m_left = l;
+ region.type = type;
+ if (!append)
+ rareNonInheritedData.access()->m_dashboardRegions.clear();
+ rareNonInheritedData.access()->m_dashboardRegions.append(region);
+ }
+#endif
+
+ void resetBorder() { resetBorderImage(); resetBorderTop(); resetBorderRight(); resetBorderBottom(); resetBorderLeft(); resetBorderRadius(); }
+ void resetBorderTop() { SET_VAR(surround, border.top, BorderValue()) }
+ void resetBorderRight() { SET_VAR(surround, border.right, BorderValue()) }
+ void resetBorderBottom() { SET_VAR(surround, border.bottom, BorderValue()) }
+ void resetBorderLeft() { SET_VAR(surround, border.left, BorderValue()) }
+ void resetBorderImage() { SET_VAR(surround, border.image, NinePieceImage()) }
+ void resetBorderRadius() { resetBorderTopLeftRadius(); resetBorderTopRightRadius(); resetBorderBottomLeftRadius(); resetBorderBottomRightRadius(); }
+ void resetBorderTopLeftRadius() { SET_VAR(surround, border.topLeft, initialBorderRadius()) }
+ void resetBorderTopRightRadius() { SET_VAR(surround, border.topRight, initialBorderRadius()) }
+ void resetBorderBottomLeftRadius() { SET_VAR(surround, border.bottomLeft, initialBorderRadius()) }
+ void resetBorderBottomRightRadius() { SET_VAR(surround, border.bottomRight, initialBorderRadius()) }
+
+ void resetOutline() { SET_VAR(background, m_outline, OutlineValue()) }
+
+ void setBackgroundColor(const Color& v) { SET_VAR(background, m_color, v) }
+
+ void setBorderImage(const NinePieceImage& b) { SET_VAR(surround, border.image, b) }
+
+ void setBorderTopLeftRadius(const IntSize& s) { SET_VAR(surround, border.topLeft, s) }
+ void setBorderTopRightRadius(const IntSize& s) { SET_VAR(surround, border.topRight, s) }
+ void setBorderBottomLeftRadius(const IntSize& s) { SET_VAR(surround, border.bottomLeft, s) }
+ void setBorderBottomRightRadius(const IntSize& s) { SET_VAR(surround, border.bottomRight, s) }
+
+ void setBorderRadius(const IntSize& s)
+ {
+ setBorderTopLeftRadius(s);
+ setBorderTopRightRadius(s);
+ setBorderBottomLeftRadius(s);
+ setBorderBottomRightRadius(s);
+ }
+
+ void setBorderLeftWidth(unsigned short v) { SET_VAR(surround, border.left.width, v) }
+ void setBorderLeftStyle(EBorderStyle v) { SET_VAR(surround, border.left.m_style, v) }
+ void setBorderLeftColor(const Color& v) { SET_VAR(surround, border.left.color, v) }
+ void setBorderRightWidth(unsigned short v) { SET_VAR(surround, border.right.width, v) }
+ void setBorderRightStyle(EBorderStyle v) { SET_VAR(surround, border.right.m_style, v) }
+ void setBorderRightColor(const Color& v) { SET_VAR(surround, border.right.color, v) }
+ void setBorderTopWidth(unsigned short v) { SET_VAR(surround, border.top.width, v) }
+ void setBorderTopStyle(EBorderStyle v) { SET_VAR(surround, border.top.m_style, v) }
+ void setBorderTopColor(const Color& v) { SET_VAR(surround, border.top.color, v) }
+ void setBorderBottomWidth(unsigned short v) { SET_VAR(surround, border.bottom.width, v) }
+ void setBorderBottomStyle(EBorderStyle v) { SET_VAR(surround, border.bottom.m_style, v) }
+ void setBorderBottomColor(const Color& v) { SET_VAR(surround, border.bottom.color, v) }
+ void setOutlineWidth(unsigned short v) { SET_VAR(background, m_outline.width, v) }
+
+ void setOutlineStyle(EBorderStyle v, bool isAuto = false)
+ {
+ SET_VAR(background, m_outline.m_style, v)
+ SET_VAR(background, m_outline._auto, isAuto)
+ }
+
+ void setOutlineColor(const Color& v) { SET_VAR(background, m_outline.color, v) }
+
+ void setOverflowX(EOverflow v) { noninherited_flags._overflowX = v; }
+ void setOverflowY(EOverflow v) { noninherited_flags._overflowY = v; }
+ void setVisibility(EVisibility v) { inherited_flags._visibility = v; }
+ void setVerticalAlign(EVerticalAlign v) { noninherited_flags._vertical_align = v; }
+ void setVerticalAlignLength(Length l) { SET_VAR(box, vertical_align, l ) }
+
+ void setHasClip(bool b = true) { SET_VAR(visual, hasClip, b) }
+ void setClipLeft(Length v) { SET_VAR(visual, clip.m_left, v) }
+ void setClipRight(Length v) { SET_VAR(visual, clip.m_right, v) }
+ void setClipTop(Length v) { SET_VAR(visual, clip.m_top, v) }
+ void setClipBottom(Length v) { SET_VAR(visual, clip.m_bottom, v) }
+ void setClip(Length top, Length right, Length bottom, Length left);
+
+ void setUnicodeBidi( EUnicodeBidi b ) { noninherited_flags._unicodeBidi = b; }
+
+ void setClear(EClear v) { noninherited_flags._clear = v; }
+ void setTableLayout(ETableLayout v) { noninherited_flags._table_layout = v; }
+
+ bool setFontDescription(const FontDescription& v)
+ {
+ if (inherited->font.fontDescription() != v) {
+ inherited.access()->font = Font(v, inherited->font.letterSpacing(), inherited->font.wordSpacing());
+ return true;
+ }
+ return false;
+ }
+
+ // Only used for blending font sizes when animating.
+ void setBlendedFontSize(int);
+
+ void setColor(const Color& v) { SET_VAR(inherited, color, v) }
+ void setTextIndent(Length v) { SET_VAR(inherited, indent, v) }
+ void setTextAlign(ETextAlign v) { inherited_flags._text_align = v; }
+ void setTextTransform(ETextTransform v) { inherited_flags._text_transform = v; }
+ void addToTextDecorationsInEffect(int v) { inherited_flags._text_decorations |= v; }
+ void setTextDecorationsInEffect(int v) { inherited_flags._text_decorations = v; }
+ void setTextDecoration(int v) { SET_VAR(visual, textDecoration, v); }
+ void setDirection(TextDirection v) { inherited_flags._direction = v; }
+ void setLineHeight(Length v) { SET_VAR(inherited, line_height, v) }
+ void setSpecifiedLineHeight(Length v) { SET_VAR(inherited, specified_line_height, v) }
+ void setZoom(float f) { SET_VAR(visual, m_zoom, f); setEffectiveZoom(effectiveZoom() * zoom()); }
+ void setEffectiveZoom(float f) { SET_VAR(inherited, m_effectiveZoom, f) }
+
+ void setWhiteSpace(EWhiteSpace v) { inherited_flags._white_space = v; }
+
+ void setWordSpacing(int v) { inherited.access()->font.setWordSpacing(v); }
+ void setLetterSpacing(float v) { inherited.access()->font.setLetterSpacing(v); }
+
+ void clearBackgroundLayers() { background.access()->m_background = FillLayer(BackgroundFillLayer); }
+ void inheritBackgroundLayers(const FillLayer& parent) { background.access()->m_background = parent; }
+
+ void adjustBackgroundLayers()
+ {
+ if (backgroundLayers()->next()) {
+ accessBackgroundLayers()->cullEmptyLayers();
+ accessBackgroundLayers()->fillUnsetProperties();
+ }
+ }
+
+ void clearMaskLayers() { rareNonInheritedData.access()->m_mask = FillLayer(MaskFillLayer); }
+ void inheritMaskLayers(const FillLayer& parent) { rareNonInheritedData.access()->m_mask = parent; }
+
+ void adjustMaskLayers()
+ {
+ if (maskLayers()->next()) {
+ accessMaskLayers()->cullEmptyLayers();
+ accessMaskLayers()->fillUnsetProperties();
+ }
+ }
+
+ void setMaskBoxImage(const NinePieceImage& b) { SET_VAR(rareNonInheritedData, m_maskBoxImage, b) }
+
+ void setBorderCollapse(bool collapse) { inherited_flags._border_collapse = collapse; }
+ void setHorizontalBorderSpacing(short v) { SET_VAR(inherited, horizontal_border_spacing, v) }
+ void setVerticalBorderSpacing(short v) { SET_VAR(inherited, vertical_border_spacing, v) }
+ void setEmptyCells(EEmptyCell v) { inherited_flags._empty_cells = v; }
+ void setCaptionSide(ECaptionSide v) { inherited_flags._caption_side = v; }
+
+ void setCounterIncrement(short v) { SET_VAR(visual, counterIncrement, v) }
+ void setCounterReset(short v) { SET_VAR(visual, counterReset, v) }
+
+ void setListStyleType(EListStyleType v) { inherited_flags._list_style_type = v; }
+ void setListStyleImage(StyleImage* v) { if (inherited->list_style_image != v) inherited.access()->list_style_image = v; }
+ void setListStylePosition(EListStylePosition v) { inherited_flags._list_style_position = v; }
+
+ void resetMargin() { SET_VAR(surround, margin, LengthBox(Fixed)) }
+ void setMarginTop(Length v) { SET_VAR(surround, margin.m_top, v) }
+ void setMarginBottom(Length v) { SET_VAR(surround, margin.m_bottom, v) }
+ void setMarginLeft(Length v) { SET_VAR(surround, margin.m_left, v) }
+ void setMarginRight(Length v) { SET_VAR(surround, margin.m_right, v) }
+
+ void resetPadding() { SET_VAR(surround, padding, LengthBox(Auto)) }
+ void setPaddingBox(const LengthBox& b) { SET_VAR(surround, padding, b) }
+ void setPaddingTop(Length v) { SET_VAR(surround, padding.m_top, v) }
+ void setPaddingBottom(Length v) { SET_VAR(surround, padding.m_bottom, v) }
+ void setPaddingLeft(Length v) { SET_VAR(surround, padding.m_left, v) }
+ void setPaddingRight(Length v) { SET_VAR(surround, padding.m_right, v) }
+
+ void setCursor( ECursor c ) { inherited_flags._cursor_style = c; }
+ void addCursor(CachedImage*, const IntPoint& = IntPoint());
+ void setCursorList(PassRefPtr<CursorList>);
+ void clearCursorList();
+
+ bool forceBackgroundsToWhite() const { return inherited_flags._force_backgrounds_to_white; }
+ void setForceBackgroundsToWhite(bool b=true) { inherited_flags._force_backgrounds_to_white = b; }
+
+ bool htmlHacks() const { return inherited_flags._htmlHacks; }
+ void setHtmlHacks(bool b=true) { inherited_flags._htmlHacks = b; }
+
+ bool hasAutoZIndex() const { return box->z_auto; }
+ void setHasAutoZIndex() { SET_VAR(box, z_auto, true); SET_VAR(box, z_index, 0) }
+ int zIndex() const { return box->z_index; }
+ void setZIndex(int v) { SET_VAR(box, z_auto, false); SET_VAR(box, z_index, v) }
+
+ void setWidows(short w) { SET_VAR(inherited, widows, w); }
+ void setOrphans(short o) { SET_VAR(inherited, orphans, o); }
+ void setPageBreakInside(EPageBreak b) { SET_VAR(inherited, page_break_inside, b); }
+ void setPageBreakBefore(EPageBreak b) { noninherited_flags._page_break_before = b; }
+ void setPageBreakAfter(EPageBreak b) { noninherited_flags._page_break_after = b; }
+
+ // CSS3 Setters
+#if ENABLE(XBL)
+ void deleteBindingURIs() { SET_VAR(rareNonInheritedData, bindingURI, static_cast<BindingURI*>(0)); }
+ void inheritBindingURIs(BindingURI* other) { SET_VAR(rareNonInheritedData, bindingURI, other->copy()); }
+ void addBindingURI(StringImpl* uri);
+#endif
+
+ void setOutlineOffset(int v) { SET_VAR(background, m_outline._offset, v) }
+ void setTextShadow(ShadowData* val, bool add=false);
+ void setTextStrokeColor(const Color& c) { SET_VAR(rareInheritedData, textStrokeColor, c) }
+ void setTextStrokeWidth(float w) { SET_VAR(rareInheritedData, textStrokeWidth, w) }
+ void setTextFillColor(const Color& c) { SET_VAR(rareInheritedData, textFillColor, c) }
+ void setOpacity(float f) { SET_VAR(rareNonInheritedData, opacity, f); }
+ void setAppearance(ControlPart a) { SET_VAR(rareNonInheritedData, m_appearance, a); }
+ void setImageLoadingBorder(EImageLoadingBorder anImageLoadingBorder) { SET_VAR(rareNonInheritedData, m_imageLoadingBorder, anImageLoadingBorder); }
+ void setBoxAlign(EBoxAlignment a) { SET_VAR(rareNonInheritedData.access()->flexibleBox, align, a); }
+ void setBoxDirection(EBoxDirection d) { inherited_flags._box_direction = d; }
+ void setBoxFlex(float f) { SET_VAR(rareNonInheritedData.access()->flexibleBox, flex, f); }
+ void setBoxFlexGroup(unsigned int fg) { SET_VAR(rareNonInheritedData.access()->flexibleBox, flex_group, fg); }
+ void setBoxLines(EBoxLines l) { SET_VAR(rareNonInheritedData.access()->flexibleBox, lines, l); }
+ void setBoxOrdinalGroup(unsigned int og) { SET_VAR(rareNonInheritedData.access()->flexibleBox, ordinal_group, og); }
+ void setBoxOrient(EBoxOrient o) { SET_VAR(rareNonInheritedData.access()->flexibleBox, orient, o); }
+ void setBoxPack(EBoxAlignment p) { SET_VAR(rareNonInheritedData.access()->flexibleBox, pack, p); }
+ void setBoxShadow(ShadowData* val, bool add=false);
+ void setBoxReflect(PassRefPtr<StyleReflection> reflect) { if (rareNonInheritedData->m_boxReflect != reflect) rareNonInheritedData.access()->m_boxReflect = reflect; }
+ void setBoxSizing(EBoxSizing s) { SET_VAR(box, boxSizing, s); }
+ void setMarqueeIncrement(const Length& f) { SET_VAR(rareNonInheritedData.access()->marquee, increment, f); }
+ void setMarqueeSpeed(int f) { SET_VAR(rareNonInheritedData.access()->marquee, speed, f); }
+ void setMarqueeDirection(EMarqueeDirection d) { SET_VAR(rareNonInheritedData.access()->marquee, direction, d); }
+ void setMarqueeBehavior(EMarqueeBehavior b) { SET_VAR(rareNonInheritedData.access()->marquee, behavior, b); }
+ void setMarqueeLoopCount(int i) { SET_VAR(rareNonInheritedData.access()->marquee, loops, i); }
+ void setUserModify(EUserModify u) { SET_VAR(rareInheritedData, userModify, u); }
+ void setUserDrag(EUserDrag d) { SET_VAR(rareNonInheritedData, userDrag, d); }
+ void setUserSelect(EUserSelect s) { SET_VAR(rareInheritedData, userSelect, s); }
+ void setTextOverflow(bool b) { SET_VAR(rareNonInheritedData, textOverflow, b); }
+ void setMarginTopCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginTopCollapse, c); }
+ void setMarginBottomCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginBottomCollapse, c); }
+ void setWordBreak(EWordBreak b) { SET_VAR(rareInheritedData, wordBreak, b); }
+ void setWordWrap(EWordWrap b) { SET_VAR(rareInheritedData, wordWrap, b); }
+ void setNBSPMode(ENBSPMode b) { SET_VAR(rareInheritedData, nbspMode, b); }
+ void setKHTMLLineBreak(EKHTMLLineBreak b) { SET_VAR(rareInheritedData, khtmlLineBreak, b); }
+ void setMatchNearestMailBlockquoteColor(EMatchNearestMailBlockquoteColor c) { SET_VAR(rareNonInheritedData, matchNearestMailBlockquoteColor, c); }
+ void setHighlight(const AtomicString& h) { SET_VAR(rareInheritedData, highlight, h); }
+ void setBorderFit(EBorderFit b) { SET_VAR(rareNonInheritedData, m_borderFit, b); }
+ void setResize(EResize r) { SET_VAR(rareInheritedData, resize, r); }
+ void setColumnWidth(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoWidth, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_width, f); }
+ void setHasAutoColumnWidth() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoWidth, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_width, 0); }
+ void setColumnCount(unsigned short c) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoCount, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_count, c); }
+ void setHasAutoColumnCount() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoCount, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_count, 0); }
+ void setColumnGap(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_normalGap, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_gap, f); }
+ void setHasNormalColumnGap() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_normalGap, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_gap, 0); }
+ void setColumnRuleColor(const Color& c) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.color, c); }
+ void setColumnRuleStyle(EBorderStyle b) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_style, b); }
+ void setColumnRuleWidth(unsigned short w) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.width, w); }
+ void resetColumnRule() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule, BorderValue()) }
+ void setColumnBreakBefore(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakBefore, p); }
+ void setColumnBreakInside(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakInside, p); }
+ void setColumnBreakAfter(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakAfter, p); }
+ void setTransform(const TransformOperations& ops) { SET_VAR(rareNonInheritedData.access()->m_transform, m_operations, ops); }
+ void setTransformOriginX(Length l) { SET_VAR(rareNonInheritedData.access()->m_transform, m_x, l); }
+ void setTransformOriginY(Length l) { SET_VAR(rareNonInheritedData.access()->m_transform, m_y, l); }
+ void setTransformOriginZ(float f) { SET_VAR(rareNonInheritedData.access()->m_transform, m_z, f); }
+ // End CSS3 Setters
+
+ // Apple-specific property setters
+ void setPointerEvents(EPointerEvents p) { inherited_flags._pointerEvents = p; }
+
+ void clearAnimations()
+ {
+ rareNonInheritedData.access()->m_animations.clear();
+ }
+
+ void clearTransitions()
+ {
+ rareNonInheritedData.access()->m_transitions.clear();
+ }
+
+ void inheritAnimations(const AnimationList* parent) { rareNonInheritedData.access()->m_animations.set(parent ? new AnimationList(*parent) : 0); }
+ void inheritTransitions(const AnimationList* parent) { rareNonInheritedData.access()->m_transitions.set(parent ? new AnimationList(*parent) : 0); }
+ void adjustAnimations();
+ void adjustTransitions();
+
+ void setTransformStyle3D(ETransformStyle3D b) { SET_VAR(rareNonInheritedData, m_transformStyle3D, b); }
+ void setBackfaceVisibility(EBackfaceVisibility b) { SET_VAR(rareNonInheritedData, m_backfaceVisibility, b); }
+ void setPerspective(float p) { SET_VAR(rareNonInheritedData, m_perspective, p); }
+ void setPerspectiveOriginX(Length l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginX, l); }
+ void setPerspectiveOriginY(Length l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginY, l); }
+
+#if USE(ACCELERATED_COMPOSITING)
+ void setIsRunningAcceleratedAnimation(bool b = true) { SET_VAR(rareNonInheritedData, m_runningAcceleratedAnimation, b); }
+#endif
+
+ void setLineClamp(int c) { SET_VAR(rareNonInheritedData, lineClamp, c); }
+ void setTextSizeAdjust(TextSizeAdjustment anAdjustment) { SET_VAR(rareInheritedData, textSizeAdjust, anAdjustment); }
+ void setTapHighlightColor(const Color & v) { SET_VAR(rareInheritedData, tapHighlightColor, v); }
+ void setTouchCalloutEnabled(bool v) { SET_VAR(rareInheritedData, touchCalloutEnabled, v); }
+ void setCompositionFillColor(const Color & v) { SET_VAR(rareInheritedData, compositionFillColor, v); }
+ void setCompositionFrameColor(const Color & v) { SET_VAR(rareInheritedData, compositionFrameColor, v); }
+ void setTextSecurity(ETextSecurity aTextSecurity) { SET_VAR(rareInheritedData, textSecurity, aTextSecurity); }
+
+#if ENABLE(SVG)
+ const SVGRenderStyle* svgStyle() const { return m_svgStyle.get(); }
+ SVGRenderStyle* accessSVGStyle() { return m_svgStyle.access(); }
+
+ float fillOpacity() const { return svgStyle()->fillOpacity(); }
+ void setFillOpacity(float f) { accessSVGStyle()->setFillOpacity(f); }
+
+ float strokeOpacity() const { return svgStyle()->strokeOpacity(); }
+ void setStrokeOpacity(float f) { accessSVGStyle()->setStrokeOpacity(f); }
+
+ float floodOpacity() const { return svgStyle()->floodOpacity(); }
+ void setFloodOpacity(float f) { accessSVGStyle()->setFloodOpacity(f); }
+#endif
+
+ const ContentData* contentData() const { return rareNonInheritedData->m_content.get(); }
+ bool contentDataEquivalent(const RenderStyle* otherStyle) const;
+ void clearContent();
+ void setContent(StringImpl*, bool add = false);
+ void setContent(PassRefPtr<StyleImage>, bool add = false);
+ void setContent(CounterContent*, bool add = false);
+
+ const CounterDirectiveMap* counterDirectives() const;
+ CounterDirectiveMap& accessCounterDirectives();
+
+ bool inheritedNotEqual(RenderStyle*) const;
+
+ uint32_t hashForTextAutosizing() const;
+ bool equalForTextAutosizing(const RenderStyle *other) const;
+
+ StyleDifference diff(const RenderStyle*, unsigned& changedContextSensitiveProperties) const;
+
+ bool isDisplayReplacedType() const
+ {
+ return display() == INLINE_BLOCK || display() == INLINE_BOX || display() == INLINE_TABLE;
+ }
+
+ bool isDisplayInlineType() const
+ {
+ return display() == INLINE || isDisplayReplacedType();
+ }
+
+ bool isOriginalDisplayInlineType() const
+ {
+ return originalDisplay() == INLINE || originalDisplay() == INLINE_BLOCK ||
+ originalDisplay() == INLINE_BOX || originalDisplay() == INLINE_TABLE;
+ }
+
+ // To obtain at any time the pseudo state for a given link.
+ PseudoState pseudoState() const { return static_cast<PseudoState>(m_pseudoState); }
+ void setPseudoState(PseudoState s) { m_pseudoState = s; }
+
+ // To tell if this style matched attribute selectors. This makes it impossible to share.
+ bool affectedByAttributeSelectors() const { return m_affectedByAttributeSelectors; }
+ void setAffectedByAttributeSelectors() { m_affectedByAttributeSelectors = true; }
+
+ bool unique() const { return m_unique; }
+ void setUnique() { m_unique = true; }
+
+ // Methods for indicating the style is affected by dynamic updates (e.g., children changing, our position changing in our sibling list, etc.)
+ bool affectedByEmpty() const { return m_affectedByEmpty; }
+ bool emptyState() const { return m_emptyState; }
+ void setEmptyState(bool b) { m_affectedByEmpty = true; m_unique = true; m_emptyState = b; }
+ bool childrenAffectedByPositionalRules() const { return childrenAffectedByForwardPositionalRules() || childrenAffectedByBackwardPositionalRules(); }
+ bool childrenAffectedByFirstChildRules() const { return m_childrenAffectedByFirstChildRules; }
+ void setChildrenAffectedByFirstChildRules() { m_childrenAffectedByFirstChildRules = true; }
+ bool childrenAffectedByLastChildRules() const { return m_childrenAffectedByLastChildRules; }
+ void setChildrenAffectedByLastChildRules() { m_childrenAffectedByLastChildRules = true; }
+ bool childrenAffectedByDirectAdjacentRules() const { return m_childrenAffectedByDirectAdjacentRules; }
+ void setChildrenAffectedByDirectAdjacentRules() { m_childrenAffectedByDirectAdjacentRules = true; }
+ bool childrenAffectedByForwardPositionalRules() const { return m_childrenAffectedByForwardPositionalRules; }
+ void setChildrenAffectedByForwardPositionalRules() { m_childrenAffectedByForwardPositionalRules = true; }
+ bool childrenAffectedByBackwardPositionalRules() const { return m_childrenAffectedByBackwardPositionalRules; }
+ void setChildrenAffectedByBackwardPositionalRules() { m_childrenAffectedByBackwardPositionalRules = true; }
+ bool firstChildState() const { return m_firstChildState; }
+ void setFirstChildState() { m_firstChildState = true; }
+ bool lastChildState() const { return m_lastChildState; }
+ void setLastChildState() { m_lastChildState = true; }
+ unsigned childIndex() const { return m_childIndex; }
+ void setChildIndex(unsigned index) { m_childIndex = index; }
+
+ // Initial values for all the properties
+ static bool initialBorderCollapse() { return false; }
+ static EBorderStyle initialBorderStyle() { return BNONE; }
+ static NinePieceImage initialNinePieceImage() { return NinePieceImage(); }
+ static IntSize initialBorderRadius() { return IntSize(0, 0); }
+ static ECaptionSide initialCaptionSide() { return CAPTOP; }
+ static EClear initialClear() { return CNONE; }
+ static TextDirection initialDirection() { return LTR; }
+ static EDisplay initialDisplay() { return INLINE; }
+ static EEmptyCell initialEmptyCells() { return SHOW; }
+ static EFloat initialFloating() { return FNONE; }
+ static EListStylePosition initialListStylePosition() { return OUTSIDE; }
+ static EListStyleType initialListStyleType() { return DISC; }
+ static EOverflow initialOverflowX() { return OVISIBLE; }
+ static EOverflow initialOverflowY() { return OVISIBLE; }
+ static EPageBreak initialPageBreak() { return PBAUTO; }
+ static EPosition initialPosition() { return StaticPosition; }
+ static ETableLayout initialTableLayout() { return TAUTO; }
+ static EUnicodeBidi initialUnicodeBidi() { return UBNormal; }
+ static ETextTransform initialTextTransform() { return TTNONE; }
+ static EVisibility initialVisibility() { return VISIBLE; }
+ static EWhiteSpace initialWhiteSpace() { return NORMAL; }
+ static short initialHorizontalBorderSpacing() { return 0; }
+ static short initialVerticalBorderSpacing() { return 0; }
+ static ECursor initialCursor() { return CURSOR_AUTO; }
+ static Color initialColor() { return Color::black; }
+ static StyleImage* initialListStyleImage() { return 0; }
+ static unsigned short initialBorderWidth() { return 3; }
+ static int initialLetterWordSpacing() { return 0; }
+ static Length initialSize() { return Length(); }
+ static Length initialMinSize() { return Length(0, Fixed); }
+ static Length initialMaxSize() { return Length(undefinedLength, Fixed); }
+ static Length initialOffset() { return Length(); }
+ static Length initialMargin() { return Length(Fixed); }
+ static Length initialPadding() { return Length(Fixed); }
+ static Length initialTextIndent() { return Length(Fixed); }
+ static EVerticalAlign initialVerticalAlign() { return BASELINE; }
+ static int initialWidows() { return 2; }
+ static int initialOrphans() { return 2; }
+ static Length initialLineHeight() { return Length(-100.0, Percent); }
+ static Length initialSpecifiedLineHeight() { return Length(-100, Percent); }
+ static ETextAlign initialTextAlign() { return TAAUTO; }
+ static ETextDecoration initialTextDecoration() { return TDNONE; }
+ static float initialZoom() { return 1.0f; }
+ static int initialOutlineOffset() { return 0; }
+ static float initialOpacity() { return 1.0f; }
+ static EBoxAlignment initialBoxAlign() { return BSTRETCH; }
+ static EBoxDirection initialBoxDirection() { return BNORMAL; }
+ static EBoxLines initialBoxLines() { return SINGLE; }
+ static EBoxOrient initialBoxOrient() { return HORIZONTAL; }
+ static EBoxAlignment initialBoxPack() { return BSTART; }
+ static float initialBoxFlex() { return 0.0f; }
+ static int initialBoxFlexGroup() { return 1; }
+ static int initialBoxOrdinalGroup() { return 1; }
+ static EBoxSizing initialBoxSizing() { return CONTENT_BOX; }
+ static StyleReflection* initialBoxReflect() { return 0; }
+ static int initialMarqueeLoopCount() { return -1; }
+ static int initialMarqueeSpeed() { return 85; }
+ static Length initialMarqueeIncrement() { return Length(6, Fixed); }
+ static EMarqueeBehavior initialMarqueeBehavior() { return MSCROLL; }
+ static EMarqueeDirection initialMarqueeDirection() { return MAUTO; }
+ static EUserModify initialUserModify() { return READ_ONLY; }
+ static EUserDrag initialUserDrag() { return DRAG_AUTO; }
+ static EUserSelect initialUserSelect() { return SELECT_TEXT; }
+ static bool initialTextOverflow() { return false; }
+ static EMarginCollapse initialMarginTopCollapse() { return MCOLLAPSE; }
+ static EMarginCollapse initialMarginBottomCollapse() { return MCOLLAPSE; }
+ static EWordBreak initialWordBreak() { return NormalWordBreak; }
+ static EWordWrap initialWordWrap() { return NormalWordWrap; }
+ static ENBSPMode initialNBSPMode() { return NBNORMAL; }
+ static EKHTMLLineBreak initialKHTMLLineBreak() { return LBNORMAL; }
+ static EMatchNearestMailBlockquoteColor initialMatchNearestMailBlockquoteColor() { return BCNORMAL; }
+ static const AtomicString& initialHighlight() { return nullAtom; }
+ static EBorderFit initialBorderFit() { return BorderFitBorder; }
+ static EResize initialResize() { return RESIZE_NONE; }
+ static ControlPart initialAppearance() { return NoControlPart; }
+ static EImageLoadingBorder initialImageLoadingBorder() { return IMAGE_LOADING_BORDER_OUTLINE; }
+ static bool initialVisuallyOrdered() { return false; }
+ static float initialTextStrokeWidth() { return 0; }
+ static unsigned short initialColumnCount() { return 1; }
+ static const TransformOperations& initialTransform() { DEFINE_STATIC_LOCAL(TransformOperations, ops, ()); return ops; }
+ static Length initialTransformOriginX() { return Length(50.0, Percent); }
+ static Length initialTransformOriginY() { return Length(50.0, Percent); }
+ static EPointerEvents initialPointerEvents() { return PE_AUTO; }
+ static float initialTransformOriginZ() { return 0; }
+ static ETransformStyle3D initialTransformStyle3D() { return TransformStyle3DFlat; }
+ static EBackfaceVisibility initialBackfaceVisibility() { return BackfaceVisibilityVisible; }
+ static float initialPerspective() { return 0; }
+ static Length initialPerspectiveOriginX() { return Length(50.0, Percent); }
+ static Length initialPerspectiveOriginY() { return Length(50.0, Percent); }
+
+ // Keep these at the end.
+ static int initialLineClamp() { return -1; }
+ static TextSizeAdjustment initialTextSizeAdjust() { return TextSizeAdjustment(); }
+ static Color initialTapHighlightColor() { return Color::tap; }
+ static bool initialTouchCalloutEnabled() { return true; }
+ static Color initialCompositionFillColor() { return Color::compositionFill; }
+ static Color initialCompositionFrameColor() { return Color::compositionFrame; }
+ static ETextSecurity initialTextSecurity() { return TSNONE; }
+#if ENABLE(DASHBOARD_SUPPORT)
+ static const Vector<StyleDashboardRegion>& initialDashboardRegions();
+ static const Vector<StyleDashboardRegion>& noneDashboardRegions();
+#endif
+};
+
+} // namespace WebCore
+
+#endif // RenderStyle_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderStyleConstants_h
+#define RenderStyleConstants_h
+
+namespace WebCore {
+
+/*
+ * WARNING:
+ * --------
+ *
+ * The order of the values in the enums have to agree with the order specified
+ * in CSSValueKeywords.in, otherwise some optimizations in the parser will fail,
+ * and produce invalid results.
+ */
+
+// The difference between two styles. The following values are used:
+// (1) StyleDifferenceEqual - The two styles are identical
+// (2) StyleDifferenceRecompositeLayer - The layer needs its position and transform updated, but no repaint
+// (3) StyleDifferenceRepaint - The object just needs to be repainted.
+// (4) StyleDifferenceRepaintLayer - The layer and its descendant layers needs to be repainted.
+// (5) StyleDifferenceLayout - A layout is required.
+enum StyleDifference {
+ StyleDifferenceEqual,
+#if USE(ACCELERATED_COMPOSITING)
+ StyleDifferenceRecompositeLayer,
+#endif
+ StyleDifferenceRepaint,
+ StyleDifferenceRepaintLayer,
+ StyleDifferenceLayoutPositionedMovementOnly,
+ StyleDifferenceLayout
+};
+
+// When some style properties change, different amounts of work have to be done depending on
+// context (e.g. whether the property is changing on an element which has a compositing layer).
+// A simple StyleDifference does not provide enough information so we return a bit mask of
+// StyleDifferenceContextSensitiveProperties from RenderStyle::diff() too.
+enum StyleDifferenceContextSensitiveProperty {
+ ContextSensitivePropertyNone = 0,
+ ContextSensitivePropertyTransform = (1 << 0),
+ ContextSensitivePropertyOpacity = (1 << 1)
+};
+
+// Static pseudo styles. Dynamic ones are produced on the fly.
+enum PseudoId {
+ NOPSEUDO, FIRST_LINE, FIRST_LETTER, BEFORE, AFTER, SELECTION, FIRST_LINE_INHERITED, SCROLLBAR, FILE_UPLOAD_BUTTON, INPUT_PLACEHOLDER,
+ SLIDER_THUMB, SEARCH_CANCEL_BUTTON, SEARCH_DECORATION, SEARCH_RESULTS_DECORATION, SEARCH_RESULTS_BUTTON, MEDIA_CONTROLS_PANEL,
+ MEDIA_CONTROLS_PLAY_BUTTON, MEDIA_CONTROLS_MUTE_BUTTON, MEDIA_CONTROLS_TIMELINE, MEDIA_CONTROLS_TIMELINE_CONTAINER,
+ MEDIA_CONTROLS_CURRENT_TIME_DISPLAY, MEDIA_CONTROLS_TIME_REMAINING_DISPLAY, MEDIA_CONTROLS_SEEK_BACK_BUTTON,
+ MEDIA_CONTROLS_SEEK_FORWARD_BUTTON, MEDIA_CONTROLS_FULLSCREEN_BUTTON,
+ SCROLLBAR_THUMB, SCROLLBAR_BUTTON, SCROLLBAR_TRACK, SCROLLBAR_TRACK_PIECE, SCROLLBAR_CORNER, RESIZER,
+
+ FIRST_INTERNAL_PSEUDOID = FILE_UPLOAD_BUTTON
+};
+
+// These have been defined in the order of their precedence for border-collapsing. Do
+// not change this order!
+enum EBorderStyle { BNONE, BHIDDEN, INSET, GROOVE, RIDGE, OUTSET, DOTTED, DASHED, SOLID, DOUBLE };
+
+enum EBorderPrecedence { BOFF, BTABLE, BCOLGROUP, BCOL, BROWGROUP, BROW, BCELL };
+
+enum PseudoState { PseudoUnknown, PseudoNone, PseudoAnyLink, PseudoLink, PseudoVisited};
+
+enum EPosition {
+ StaticPosition, RelativePosition, AbsolutePosition, FixedPosition
+};
+
+enum EFloat {
+ FNONE = 0, FLEFT, FRIGHT
+};
+
+
+enum EMarginCollapse { MCOLLAPSE, MSEPARATE, MDISCARD };
+
+// Box attributes. Not inherited.
+
+enum EBoxSizing { CONTENT_BOX, BORDER_BOX };
+
+// Random visual rendering model attributes. Not inherited.
+
+enum EOverflow {
+ OVISIBLE, OHIDDEN, OSCROLL, OAUTO, OOVERLAY, OMARQUEE
+};
+
+enum EVerticalAlign {
+ BASELINE, MIDDLE, SUB, SUPER, TEXT_TOP,
+ TEXT_BOTTOM, TOP, BOTTOM, BASELINE_MIDDLE, LENGTH
+};
+
+enum EClear{
+ CNONE = 0, CLEFT = 1, CRIGHT = 2, CBOTH = 3
+};
+
+enum ETableLayout {
+ TAUTO, TFIXED
+};
+
+enum EUnicodeBidi {
+ UBNormal, Embed, Override
+};
+
+enum EFillBox {
+ BorderFillBox, PaddingFillBox, ContentFillBox, TextFillBox
+};
+
+enum EFillRepeat {
+ RepeatFill, RepeatXFill, RepeatYFill, NoRepeatFill
+};
+
+enum EFillLayerType {
+ BackgroundFillLayer, MaskFillLayer
+};
+
+// CSS3 Marquee Properties
+
+enum EMarqueeBehavior { MNONE, MSCROLL, MSLIDE, MALTERNATE };
+enum EMarqueeDirection { MAUTO = 0, MLEFT = 1, MRIGHT = -1, MUP = 2, MDOWN = -2, MFORWARD = 3, MBACKWARD = -3 };
+
+// CSS3 Flexible Box Properties
+
+enum EBoxAlignment { BSTRETCH, BSTART, BCENTER, BEND, BJUSTIFY, BBASELINE };
+enum EBoxOrient { HORIZONTAL, VERTICAL };
+enum EBoxLines { SINGLE, MULTIPLE };
+enum EBoxDirection { BNORMAL, BREVERSE };
+
+enum ETextSecurity {
+ TSNONE, TSDISC, TSCIRCLE, TSSQUARE
+};
+
+// CSS3 User Modify Properties
+
+enum EUserModify {
+ READ_ONLY, READ_WRITE, READ_WRITE_PLAINTEXT_ONLY
+};
+
+// CSS3 User Drag Values
+
+enum EUserDrag {
+ DRAG_AUTO, DRAG_NONE, DRAG_ELEMENT
+};
+
+// CSS3 User Select Values
+
+enum EUserSelect {
+ SELECT_NONE, SELECT_TEXT
+};
+
+// Word Break Values. Matches WinIE, rather than CSS3
+
+enum EWordBreak {
+ NormalWordBreak, BreakAllWordBreak, BreakWordBreak
+};
+
+enum EWordWrap {
+ NormalWordWrap, BreakWordWrap
+};
+
+enum ENBSPMode {
+ NBNORMAL, SPACE
+};
+
+enum EKHTMLLineBreak {
+ LBNORMAL, AFTER_WHITE_SPACE
+};
+
+enum EMatchNearestMailBlockquoteColor {
+ BCNORMAL, MATCH
+};
+
+enum EResize {
+ RESIZE_NONE, RESIZE_BOTH, RESIZE_HORIZONTAL, RESIZE_VERTICAL
+};
+
+enum EListStyleType {
+ DISC, CIRCLE, SQUARE, LDECIMAL, DECIMAL_LEADING_ZERO,
+ LOWER_ROMAN, UPPER_ROMAN, LOWER_GREEK,
+ LOWER_ALPHA, LOWER_LATIN, UPPER_ALPHA, UPPER_LATIN,
+ HEBREW, ARMENIAN, GEORGIAN, CJK_IDEOGRAPHIC,
+ HIRAGANA, KATAKANA, HIRAGANA_IROHA, KATAKANA_IROHA, LNONE
+};
+
+enum StyleContentType {
+ CONTENT_NONE, CONTENT_OBJECT, CONTENT_TEXT, CONTENT_COUNTER
+};
+
+enum EBorderFit { BorderFitBorder, BorderFitLines };
+
+enum ETimingFunctionType { LinearTimingFunction, CubicBezierTimingFunction };
+
+enum EAnimPlayState {
+ AnimPlayStatePlaying = 0x0,
+ AnimPlayStatePaused = 0x1
+};
+
+enum EWhiteSpace {
+ NORMAL, PRE, PRE_WRAP, PRE_LINE, NOWRAP, KHTML_NOWRAP
+};
+
+enum ETextAlign {
+ TAAUTO, LEFT, RIGHT, CENTER, JUSTIFY, WEBKIT_LEFT, WEBKIT_RIGHT, WEBKIT_CENTER
+};
+
+enum ETextTransform {
+ CAPITALIZE, UPPERCASE, LOWERCASE, TTNONE
+};
+
+enum ETextDecoration {
+ TDNONE = 0x0 , UNDERLINE = 0x1, OVERLINE = 0x2, LINE_THROUGH= 0x4, BLINK = 0x8
+};
+
+enum EPageBreak {
+ PBAUTO, PBALWAYS, PBAVOID
+};
+
+enum EEmptyCell {
+ SHOW, HIDE
+};
+
+enum ECaptionSide {
+ CAPTOP, CAPBOTTOM, CAPLEFT, CAPRIGHT
+};
+
+enum EListStylePosition { OUTSIDE, INSIDE };
+
+enum EVisibility { VISIBLE, HIDDEN, COLLAPSE };
+
+enum ECursor {
+ // The following must match the order in CSSValueKeywords.in.
+ CURSOR_AUTO,
+ CURSOR_CROSS,
+ CURSOR_DEFAULT,
+ CURSOR_POINTER,
+ CURSOR_MOVE,
+ CURSOR_VERTICAL_TEXT,
+ CURSOR_CELL,
+ CURSOR_CONTEXT_MENU,
+ CURSOR_ALIAS,
+ CURSOR_PROGRESS,
+ CURSOR_NO_DROP,
+ CURSOR_NOT_ALLOWED,
+ CURSOR_WEBKIT_ZOOM_IN,
+ CURSOR_WEBKIT_ZOOM_OUT,
+ CURSOR_E_RESIZE,
+ CURSOR_NE_RESIZE,
+ CURSOR_NW_RESIZE,
+ CURSOR_N_RESIZE,
+ CURSOR_SE_RESIZE,
+ CURSOR_SW_RESIZE,
+ CURSOR_S_RESIZE,
+ CURSOR_W_RESIZE,
+ CURSOR_EW_RESIZE,
+ CURSOR_NS_RESIZE,
+ CURSOR_NESW_RESIZE,
+ CURSOR_NWSE_RESIZE,
+ CURSOR_COL_RESIZE,
+ CURSOR_ROW_RESIZE,
+ CURSOR_TEXT,
+ CURSOR_WAIT,
+ CURSOR_HELP,
+ CURSOR_ALL_SCROLL,
+ CURSOR_WEBKIT_GRAB,
+ CURSOR_WEBKIT_GRABBING,
+
+ // The following are handled as exceptions so don't need to match.
+ CURSOR_COPY,
+ CURSOR_NONE
+};
+
+enum EDisplay {
+ INLINE, BLOCK, LIST_ITEM, RUN_IN, COMPACT, INLINE_BLOCK,
+ TABLE, INLINE_TABLE, TABLE_ROW_GROUP,
+ TABLE_HEADER_GROUP, TABLE_FOOTER_GROUP, TABLE_ROW,
+ TABLE_COLUMN_GROUP, TABLE_COLUMN, TABLE_CELL,
+ TABLE_CAPTION, BOX, INLINE_BOX, NONE
+};
+
+enum EPointerEvents {
+ PE_NONE, PE_AUTO, PE_STROKE, PE_FILL, PE_PAINTED, PE_VISIBLE,
+ PE_VISIBLE_STROKE, PE_VISIBLE_FILL, PE_VISIBLE_PAINTED, PE_ALL
+};
+
+enum ETransformStyle3D {
+ TransformStyle3DFlat, TransformStyle3DPreserve3D
+};
+
+enum EBackfaceVisibility {
+ BackfaceVisibilityVisible, BackfaceVisibilityHidden
+};
+
+enum EImageLoadingBorder {
+ IMAGE_LOADING_BORDER_OUTLINE, IMAGE_LOADING_BORDER_NONE
+};
+
+} // namespace WebCore
+
+#endif // RenderStyleConstants_h
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1997 Martin Jones (mjones@kde.org)
+ * (C) 1997 Torben Weis (weis@kde.org)
+ * (C) 1998 Waldo Bastian (bastian@kde.org)
+ * (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef RenderTable_h
+#define RenderTable_h
+
+#include "RenderBlock.h"
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class RenderTableCol;
+class RenderTableCell;
+class RenderTableSection;
+class TableLayout;
+
+class RenderTable : public RenderBlock {
+public:
+ enum Rules {
+ None = 0x00,
+ RGroups = 0x01,
+ CGroups = 0x02,
+ Groups = 0x03,
+ Rows = 0x05,
+ Cols = 0x0a,
+ All = 0x0f
+ };
+ enum Frame {
+ Void = 0x00,
+ Above = 0x01,
+ Below = 0x02,
+ Lhs = 0x04,
+ Rhs = 0x08,
+ Hsides = 0x03,
+ Vsides = 0x0c,
+ Box = 0x0f
+ };
+
+ RenderTable(Node*);
+ ~RenderTable();
+
+ virtual const char* renderName() const { return "RenderTable"; }
+
+ virtual bool isTable() const { return true; }
+
+ virtual bool avoidsFloats() const { return true; }
+
+ int getColumnPos(int col) const { return m_columnPos[col]; }
+
+ int hBorderSpacing() const { return m_hSpacing; }
+ int vBorderSpacing() const { return m_vSpacing; }
+
+ bool collapseBorders() const { return style()->borderCollapse(); }
+ int borderLeft() const { return m_borderLeft; }
+ int borderRight() const { return m_borderRight; }
+ int borderTop() const;
+ int borderBottom() const;
+
+ Rules getRules() const { return static_cast<Rules>(m_rules); }
+
+ const Color& bgColor() const { return style()->backgroundColor(); }
+
+ int outerBorderTop() const;
+ int outerBorderBottom() const;
+ int outerBorderLeft() const;
+ int outerBorderRight() const;
+
+ int calcBorderLeft() const;
+ int calcBorderRight() const;
+ void recalcHorizontalBorders();
+
+ // overrides
+ virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0);
+ virtual void paint(PaintInfo&, int tx, int ty);
+ virtual void paintObject(PaintInfo&, int tx, int ty);
+ virtual void paintBoxDecorations(PaintInfo&, int tx, int ty);
+ virtual void paintMask(PaintInfo& paintInfo, int tx, int ty);
+ virtual void layout();
+ virtual void calcPrefWidths();
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int xPos, int yPos, int tx, int ty, HitTestAction);
+
+ virtual int getBaselineOfFirstLineBox() const;
+
+ virtual RenderBlock* firstLineBlock() const;
+ virtual void updateFirstLetter();
+
+ virtual void setCellWidths();
+
+ virtual void calcWidth();
+
+ struct ColumnStruct {
+ enum {
+ WidthUndefined = 0xffff
+ };
+
+ ColumnStruct()
+ : span(1)
+ , width(WidthUndefined)
+ {
+ }
+
+ unsigned short span;
+ unsigned width; // the calculated position of the column
+ };
+
+ Vector<ColumnStruct>& columns() { return m_columns; }
+ Vector<int>& columnPositions() { return m_columnPos; }
+ RenderTableSection* header() const { return m_head; }
+ RenderTableSection* footer() const { return m_foot; }
+ RenderTableSection* firstBody() const { return m_firstBody; }
+
+ void splitColumn(int pos, int firstSpan);
+ void appendColumn(int span);
+ int numEffCols() const { return m_columns.size(); }
+ int spanOfEffCol(int effCol) const { return m_columns[effCol].span; }
+
+ int colToEffCol(int col) const
+ {
+ int i = 0;
+ int effCol = numEffCols();
+ for (int c = 0; c < col && i < effCol; ++i)
+ c += m_columns[i].span;
+ return i;
+ }
+
+ int effColToCol(int effCol) const
+ {
+ int c = 0;
+ for (int i = 0; i < effCol; i++)
+ c += m_columns[i].span;
+ return c;
+ }
+
+ int bordersPaddingAndSpacing() const
+ {
+ return borderLeft() + borderRight() +
+ (collapseBorders() ? 0 : (paddingLeft() + paddingRight() + (numEffCols() + 1) * hBorderSpacing()));
+ }
+
+ RenderTableCol* colElement(int col, bool* startEdge = 0, bool* endEdge = 0) const;
+
+ bool needsSectionRecalc() const { return m_needsSectionRecalc; }
+ void setNeedsSectionRecalc()
+ {
+ if (documentBeingDestroyed())
+ return;
+ m_needsSectionRecalc = true;
+ setNeedsLayout(true);
+ }
+
+ virtual RenderObject* removeChildNode(RenderObject*, bool fullRemove = true);
+
+ RenderTableSection* sectionAbove(const RenderTableSection*, bool skipEmptySections = false) const;
+ RenderTableSection* sectionBelow(const RenderTableSection*, bool skipEmptySections = false) const;
+
+ RenderTableCell* cellAbove(const RenderTableCell*) const;
+ RenderTableCell* cellBelow(const RenderTableCell*) const;
+ RenderTableCell* cellBefore(const RenderTableCell*) const;
+ RenderTableCell* cellAfter(const RenderTableCell*) const;
+
+ const CollapsedBorderValue* currentBorderStyle() const { return m_currentBorder; }
+
+ bool hasSections() const { return m_head || m_foot || m_firstBody; }
+
+ virtual IntRect getOverflowClipRect(int tx, int ty);
+
+ void recalcSectionsIfNeeded() const
+ {
+ if (m_needsSectionRecalc)
+ recalcSections();
+ }
+
+protected:
+ virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+
+private:
+ void recalcSections() const;
+
+ mutable Vector<int> m_columnPos;
+ mutable Vector<ColumnStruct> m_columns;
+
+ mutable RenderBlock* m_caption;
+ mutable RenderTableSection* m_head;
+ mutable RenderTableSection* m_foot;
+ mutable RenderTableSection* m_firstBody;
+
+ TableLayout* m_tableLayout;
+
+ const CollapsedBorderValue* m_currentBorder;
+
+ unsigned m_frame : 4; // Frame
+ unsigned m_rules : 4; // Rules
+
+ mutable bool m_hasColElements : 1;
+ mutable bool m_needsSectionRecalc : 1;
+
+ short m_hSpacing;
+ short m_vSpacing;
+ int m_borderLeft;
+ int m_borderRight;
+};
+
+} // namespace WebCore
+
+#endif // RenderTable_h
--- /dev/null
+/*
+ * Copyright (C) 1997 Martin Jones (mjones@kde.org)
+ * (C) 1997 Torben Weis (weis@kde.org)
+ * (C) 1998 Waldo Bastian (bastian@kde.org)
+ * (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef RenderTableCell_h
+#define RenderTableCell_h
+
+#include "RenderTableSection.h"
+
+namespace WebCore {
+
+class RenderTableCell : public RenderBlock {
+public:
+ RenderTableCell(Node*);
+
+ virtual const char* renderName() const { return isAnonymous() ? "RenderTableCell (anonymous)" : "RenderTableCell"; }
+
+ virtual bool isTableCell() const { return true; }
+
+ virtual void destroy();
+
+ // FIXME: need to implement cellIndex
+ int cellIndex() const { return 0; }
+ void setCellIndex(int) { }
+
+ int colSpan() const { return m_columnSpan; }
+ void setColSpan(int c) { m_columnSpan = c; }
+
+ int rowSpan() const { return m_rowSpan; }
+ void setRowSpan(int r) { m_rowSpan = r; }
+
+ int col() const { return m_column; }
+ void setCol(int col) { m_column = col; }
+ int row() const { return m_row; }
+ void setRow(int row) { m_row = row; }
+
+ RenderTableSection* section() const { return static_cast<RenderTableSection*>(parent()->parent()); }
+ RenderTable* table() const { return static_cast<RenderTable*>(parent()->parent()->parent()); }
+
+ Length styleOrColWidth() const;
+
+ virtual bool requiresLayer() const { return isPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || hasMask() || hasReflection(); }
+
+ virtual void calcPrefWidths();
+ virtual void calcWidth();
+ void updateWidth(int);
+
+ int borderLeft() const;
+ int borderRight() const;
+ int borderTop() const;
+ int borderBottom() const;
+
+ int borderHalfLeft(bool outer) const;
+ int borderHalfRight(bool outer) const;
+ int borderHalfTop(bool outer) const;
+ int borderHalfBottom(bool outer) const;
+
+ CollapsedBorderValue collapsedLeftBorder(bool rtl) const;
+ CollapsedBorderValue collapsedRightBorder(bool rtl) const;
+ CollapsedBorderValue collapsedTopBorder() const;
+ CollapsedBorderValue collapsedBottomBorder() const;
+
+ typedef Vector<CollapsedBorderValue, 100> CollapsedBorderStyles;
+ void collectBorderStyles(CollapsedBorderStyles&) const;
+ static void sortBorderStyles(CollapsedBorderStyles&);
+
+ virtual void updateFromElement();
+
+ virtual void layout();
+
+ virtual void paint(PaintInfo&, int tx, int ty);
+ virtual void paintBoxDecorations(PaintInfo&, int tx, int ty);
+ virtual void paintMask(PaintInfo& paintInfo, int tx, int ty);
+ void paintCollapsedBorder(GraphicsContext*, int x, int y, int w, int h);
+ void paintBackgroundsBehindCell(PaintInfo&, int tx, int ty, RenderObject* backgroundObject);
+
+ virtual IntRect clippedOverflowRectForRepaint(RenderBox* repaintContainer);
+ virtual void computeRectForRepaint(RenderBox* repaintContainer, IntRect&, bool fixed = false);
+
+ virtual int baselinePosition(bool firstLine = false, bool isRootLineBox = false) const;
+
+ void setIntrinsicPaddingTop(int p) { m_intrinsicPaddingTop = p; }
+ void setIntrinsicPaddingBottom(int p) { m_intrinsicPaddingBottom = p; }
+ void setIntrinsicPadding(int top, int bottom) { setIntrinsicPaddingTop(top); setIntrinsicPaddingBottom(bottom); }
+ void clearIntrinsicPadding() { setIntrinsicPadding(0, 0); }
+
+ int intrinsicPaddingTop() const { return m_intrinsicPaddingTop; }
+ int intrinsicPaddingBottom() const { return m_intrinsicPaddingBottom; }
+
+ virtual int paddingTop(bool includeIntrinsicPadding = true) const;
+ virtual int paddingBottom(bool includeIntrinsicPadding = true) const;
+
+ virtual void setOverrideSize(int);
+
+protected:
+ virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
+ virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+
+ virtual void mapLocalToContainer(RenderBox* repaintContainer, bool useTransforms, bool fixed, TransformState&) const;
+ virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const;
+
+private:
+ int m_row;
+ int m_column;
+ int m_rowSpan;
+ int m_columnSpan;
+ int m_intrinsicPaddingTop;
+ int m_intrinsicPaddingBottom;
+ int m_percentageHeight;
+};
+
+} // namespace WebCore
+
+#endif // RenderTableCell_h
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1997 Martin Jones (mjones@kde.org)
+ * (C) 1997 Torben Weis (weis@kde.org)
+ * (C) 1998 Waldo Bastian (bastian@kde.org)
+ * (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef RenderTableCol_h
+#define RenderTableCol_h
+
+#include "RenderContainer.h"
+
+namespace WebCore {
+
+class RenderTableCol : public RenderContainer
+{
+public:
+ RenderTableCol(Node*);
+
+ virtual const char* renderName() const { return "RenderTableCol"; }
+ virtual bool isTableCol() const { return true; }
+ virtual int lineHeight(bool) const { return 0; }
+ virtual void updateFromElement();
+
+ virtual bool isChildAllowed(RenderObject*, RenderStyle*) const;
+ virtual bool canHaveChildren() const;
+ virtual bool requiresLayer() const { return false; }
+
+ virtual IntRect clippedOverflowRectForRepaint(RenderBox* repaintContainer);
+ virtual void imageChanged(WrappedImagePtr, const IntRect* = 0);
+
+ int span() const { return m_span; }
+ void setSpan(int s) { m_span = s; }
+
+private:
+ int m_span;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1997 Martin Jones (mjones@kde.org)
+ * (C) 1997 Torben Weis (weis@kde.org)
+ * (C) 1998 Waldo Bastian (bastian@kde.org)
+ * (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef RenderTableRow_h
+#define RenderTableRow_h
+
+#include "RenderTableSection.h"
+
+namespace WebCore {
+
+class RenderTableRow : public RenderContainer {
+public:
+ RenderTableRow(Node*);
+
+ RenderTableSection* section() const { return static_cast<RenderTableSection*>(parent()); }
+ RenderTable* table() const { return static_cast<RenderTable*>(parent()->parent()); }
+
+private:
+ virtual const char* renderName() const { return isAnonymous() ? "RenderTableRow (anonymous)" : "RenderTableRow"; }
+
+ virtual bool isTableRow() const { return true; }
+
+ virtual void destroy();
+
+ virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0);
+ virtual int lineHeight(bool, bool) const { return 0; }
+ virtual void position(InlineBox*) { }
+ virtual void layout();
+ virtual IntRect clippedOverflowRectForRepaint(RenderBox* repaintContainer);
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
+
+ // The only time rows get a layer is when they have transparency.
+ virtual bool requiresLayer() const { return isTransparent() || hasOverflowClip() || hasTransform() || hasMask(); }
+
+ virtual void paint(PaintInfo&, int tx, int ty);
+
+ virtual void imageChanged(WrappedImagePtr, const IntRect* = 0);
+
+ virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
+
+};
+
+} // namespace WebCore
+
+#endif // RenderTableRow_h
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1997 Martin Jones (mjones@kde.org)
+ * (C) 1997 Torben Weis (weis@kde.org)
+ * (C) 1998 Waldo Bastian (bastian@kde.org)
+ * (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef RenderTableSection_h
+#define RenderTableSection_h
+
+#include "RenderTable.h"
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class RenderTableCell;
+class RenderTableRow;
+
+class RenderTableSection : public RenderContainer {
+public:
+ RenderTableSection(Node*);
+ ~RenderTableSection();
+
+ virtual const char* renderName() const { return isAnonymous() ? "RenderTableSection (anonymous)" : "RenderTableSection"; }
+
+ virtual bool isTableSection() const { return true; }
+
+ virtual void destroy();
+
+ virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0);
+
+ virtual int getBaselineOfFirstLineBox() const;
+
+ void addCell(RenderTableCell*, RenderTableRow* row);
+
+ void setCellWidths();
+ int calcRowHeight();
+ int layoutRows(int height);
+
+ RenderTable* table() const { return static_cast<RenderTable*>(parent()); }
+
+ struct CellStruct {
+ RenderTableCell* cell;
+ bool inColSpan; // true for columns after the first in a colspan
+ };
+
+ typedef Vector<CellStruct> Row;
+
+ struct RowStruct {
+ Row* row;
+ RenderTableRow* rowRenderer;
+ int baseline;
+ Length height;
+ };
+
+ CellStruct& cellAt(int row, int col) { return (*m_grid[row].row)[col]; }
+ const CellStruct& cellAt(int row, int col) const { return (*m_grid[row].row)[col]; }
+
+ void appendColumn(int pos);
+ void splitColumn(int pos, int newSize);
+
+ virtual int overflowWidth(bool includeInterior = true) const { return (!includeInterior && hasOverflowClip()) ? width() : m_overflowWidth; }
+ virtual int overflowLeft(bool includeInterior = true) const { return (!includeInterior && hasOverflowClip()) ? 0 : m_overflowLeft; }
+ virtual int overflowHeight(bool includeInterior = true) const { return (!includeInterior && hasOverflowClip()) ? height() : m_overflowHeight; }
+ virtual int overflowTop(bool includeInterior = true) const { return (!includeInterior && hasOverflowClip()) ? 0 : m_overflowTop; }
+
+ virtual int lowestPosition(bool includeOverflowInterior, bool includeSelf) const;
+ virtual int rightmostPosition(bool includeOverflowInterior, bool includeSelf) const;
+ virtual int leftmostPosition(bool includeOverflowInterior, bool includeSelf) const;
+
+ int calcOuterBorderTop() const;
+ int calcOuterBorderBottom() const;
+ int calcOuterBorderLeft(bool rtl) const;
+ int calcOuterBorderRight(bool rtl) const;
+ void recalcOuterBorder();
+
+ int outerBorderTop() const { return m_outerBorderTop; }
+ int outerBorderBottom() const { return m_outerBorderBottom; }
+ int outerBorderLeft() const { return m_outerBorderLeft; }
+ int outerBorderRight() const { return m_outerBorderRight; }
+
+ virtual void paint(PaintInfo&, int tx, int ty);
+ virtual void paintObject(PaintInfo&, int tx, int ty);
+
+ virtual void imageChanged(WrappedImagePtr, const IntRect* = 0);
+
+ int numRows() const { return m_gridRows; }
+ int numColumns() const;
+ void recalcCells();
+ void recalcCellsIfNeeded()
+ {
+ if (m_needsCellRecalc)
+ recalcCells();
+ }
+
+ bool needsCellRecalc() const { return m_needsCellRecalc; }
+ void setNeedsCellRecalc()
+ {
+ m_needsCellRecalc = true;
+ table()->setNeedsSectionRecalc();
+ }
+
+ int getBaseline(int row) { return m_grid[row].baseline; }
+
+ virtual RenderObject* removeChildNode(RenderObject*, bool fullRemove = true);
+
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
+
+private:
+ virtual int lineHeight(bool, bool) const { return 0; }
+ virtual void position(InlineBox*) { }
+
+ bool ensureRows(int);
+ void clearGrid();
+
+ Vector<RowStruct> m_grid;
+ int m_gridRows;
+ Vector<int> m_rowPos;
+
+ // the current insertion position
+ int m_cCol;
+ int m_cRow;
+ bool m_needsCellRecalc;
+
+ int m_outerBorderLeft;
+ int m_outerBorderRight;
+ int m_outerBorderTop;
+ int m_outerBorderBottom;
+ int m_overflowLeft;
+ int m_overflowWidth;
+ int m_overflowTop;
+ int m_overflowHeight;
+ bool m_hasOverflowingCell;
+};
+
+} // namespace WebCore
+
+#endif // RenderTableSection_h
--- /dev/null
+/*
+ * (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderText_h
+#define RenderText_h
+
+#include "RenderObject.h"
+#include "SelectionRect.h"
+#include "Timer.h"
+
+namespace WebCore {
+
+class InlineTextBox;
+class StringImpl;
+
+class RenderText : public RenderObject {
+public:
+ RenderText(Node*, PassRefPtr<StringImpl>);
+#ifndef NDEBUG
+ virtual ~RenderText();
+#endif
+
+ virtual const char* renderName() const;
+
+ virtual bool isTextFragment() const;
+ virtual bool isWordBreak() const;
+
+ virtual PassRefPtr<StringImpl> originalText() const;
+
+ void extractTextBox(InlineTextBox*);
+ void attachTextBox(InlineTextBox*);
+ void removeTextBox(InlineTextBox*);
+
+ virtual void destroy();
+
+ StringImpl* text() const { return m_text.get(); }
+
+ virtual InlineBox* createInlineBox(bool makePlaceHolderBox, bool isRootLineBox, bool isOnlyRun = false);
+ virtual InlineTextBox* createInlineTextBox();
+ virtual void dirtyLineBoxes(bool fullLayout, bool isRootInlineBox = false);
+
+ virtual void absoluteRects(Vector<IntRect>&, int tx, int ty, bool topLevel = true);
+ virtual void addLineBoxRects(Vector<IntRect>&, unsigned startOffset = 0, unsigned endOffset = UINT_MAX, bool useSelectionHeight = false);
+ virtual void collectSelectionRects(Vector<SelectionRect>&, unsigned startOffset = 0, unsigned endOffset = UINT_MAX);
+
+ virtual void absoluteQuads(Vector<FloatQuad>&, bool topLevel = true);
+ virtual void collectAbsoluteLineBoxQuads(Vector<FloatQuad>&, unsigned startOffset = 0, unsigned endOffset = UINT_MAX, bool useSelectionHeight = false);
+
+ virtual VisiblePosition positionForCoordinates(int x, int y);
+
+ const UChar* characters() const { return m_text->characters(); }
+ unsigned textLength() const { return m_text->length(); } // non virtual implementation of length()
+ virtual void position(InlineBox*);
+
+ virtual unsigned width(unsigned from, unsigned len, const Font&, int xPos) const;
+ virtual unsigned width(unsigned from, unsigned len, int xPos, bool firstLine = false) const;
+
+ virtual int lineHeight(bool firstLine, bool isRootLineBox = false) const;
+
+ virtual int minPrefWidth() const;
+ virtual int maxPrefWidth() const;
+
+ void trimmedPrefWidths(int leadWidth,
+ int& beginMinW, bool& beginWS,
+ int& endMinW, bool& endWS,
+ bool& hasBreakableChar, bool& hasBreak,
+ int& beginMaxW, int& endMaxW,
+ int& minW, int& maxW, bool& stripFrontSpaces);
+
+ IntRect linesBoundingBox() const;
+
+ int firstRunX() const;
+ int firstRunY() const;
+
+ virtual int verticalPositionHint(bool firstLine) const;
+
+ void setText(PassRefPtr<StringImpl>, bool force = false);
+ void setTextWithOffset(PassRefPtr<StringImpl>, unsigned offset, unsigned len, bool force = false);
+
+ virtual bool canBeSelectionLeaf() const { return true; }
+ virtual SelectionState selectionState() const { return static_cast<SelectionState>(m_selectionState); }
+ virtual void setSelectionState(SelectionState s);
+ virtual IntRect selectionRectForRepaint(RenderBox* repaintContainer, bool clipToVisibleContent = true);
+ virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0);
+
+ virtual int marginLeft() const { return style()->marginLeft().calcMinValue(0); }
+ virtual int marginRight() const { return style()->marginRight().calcMinValue(0); }
+
+ virtual IntRect clippedOverflowRectForRepaint(RenderBox* repaintContainer);
+
+ InlineTextBox* firstTextBox() const { return m_firstTextBox; }
+ InlineTextBox* lastTextBox() const { return m_lastTextBox; }
+
+ virtual int caretMinOffset() const;
+ virtual int caretMaxOffset() const;
+ virtual unsigned caretMaxRenderedOffset() const;
+
+ virtual int previousOffset(int current) const;
+ virtual int nextOffset(int current) const;
+
+ bool containsReversedText() const { return m_containsReversedText; }
+
+ bool isSecure() { return style()->textSecurity() != TSNONE; }
+ void momentarilyRevealLastCharacter();
+ void secureLastCharacter();
+ void secureLastCharacter(Timer<RenderText> * aTimer);
+
+ InlineTextBox* findNextInlineTextBox(int offset, int& pos) const;
+
+ bool allowTabs() const { return !style()->collapseWhiteSpace(); }
+
+ void checkConsistency() const;
+
+ float candidateComputedTextSize() const { return m_candidateComputedTextSize; }
+ void setCandidateComputedTextSize(float s) { m_candidateComputedTextSize = s; }
+
+protected:
+ virtual void styleWillChange(StyleDifference, const RenderStyle*) { }
+ virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+
+ virtual void setTextInternal(PassRefPtr<StringImpl>);
+ virtual void calcPrefWidths(int leadWidth);
+ virtual UChar previousCharacter();
+
+private:
+ // Make length() private so that callers that have a RenderText*
+ // will use the more efficient textLength() instead, while
+ // callers with a RenderObject* can continue to use length().
+ virtual unsigned length() const { return textLength(); }
+
+ virtual void paint(PaintInfo&, int, int) { ASSERT_NOT_REACHED(); }
+ virtual void layout() { ASSERT_NOT_REACHED(); }
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int, int, int, int, HitTestAction) { ASSERT_NOT_REACHED(); return false; }
+
+ void deleteTextBoxes();
+ bool containsOnlyWhitespace(unsigned from, unsigned len) const;
+ int widthFromCache(const Font&, int start, int len, int xPos) const;
+ bool isAllASCII() const { return m_isAllASCII; }
+
+ RefPtr<StringImpl> m_text;
+
+ InlineTextBox* m_firstTextBox;
+ InlineTextBox* m_lastTextBox;
+
+ int m_minWidth;
+ int m_maxWidth;
+ int m_beginMinWidth;
+ int m_endMinWidth;
+
+ unsigned m_selectionState : 3; // enums on Windows are signed, so this needs to be unsigned to prevent it turning negative.
+ bool m_hasBreakableChar : 1; // Whether or not we can be broken into multiple lines.
+ bool m_hasBreak : 1; // Whether or not we have a hard break (e.g., <pre> with '\n').
+ bool m_hasTab : 1; // Whether or not we have a variable width tab character (e.g., <pre> with '\t').
+ bool m_hasBeginWS : 1; // Whether or not we begin with WS (only true if we aren't pre)
+ bool m_hasEndWS : 1; // Whether or not we end with WS (only true if we aren't pre)
+ bool m_linesDirty : 1; // This bit indicates that the text run has already dirtied specific
+ // line boxes, and this hint will enable layoutInlineChildren to avoid
+ // just dirtying everything when character data is modified (e.g., appended/inserted
+ // or removed).
+ bool m_containsReversedText : 1;
+ bool m_isAllASCII : 1;
+
+ bool m_shouldSecureLastCharacter : 1;
+ bool m_hasSecureLastCharacterTimer : 1;
+ // FIXME: This should probably be part of the text sizing structures in Document instead. That would save some memory.
+ float m_candidateComputedTextSize;
+};
+
+inline RenderText* toRenderText(RenderObject* o)
+{
+ ASSERT(!o || o->isText());
+ return static_cast<RenderText*>(o);
+}
+
+inline const RenderText* toRenderText(const RenderObject* o)
+{
+ ASSERT(!o || o->isText());
+ return static_cast<const RenderText*>(o);
+}
+
+#ifdef NDEBUG
+inline void RenderText::checkConsistency() const
+{
+}
+#endif
+
+} // namespace WebCore
+
+#endif // RenderText_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderTextControl_h
+#define RenderTextControl_h
+
+#include "RenderBlock.h"
+
+namespace WebCore {
+
+class FormControlElement;
+class Selection;
+class TextControlInnerElement;
+class TextControlInnerTextElement;
+
+class RenderTextControl : public RenderBlock {
+public:
+ virtual ~RenderTextControl();
+
+ virtual const char* renderName() const { return "RenderTextControl"; }
+ virtual bool hasControlClip() const { return false; }
+ virtual IntRect controlClipRect(int tx, int ty) const;
+ virtual void calcHeight();
+ virtual void calcPrefWidths();
+ virtual void removeLeftoverAnonymousBlock(RenderBlock*) { }
+ virtual void updateFromElement();
+ virtual bool canHaveChildren() const { return false; }
+ virtual bool avoidsFloats() const { return true; }
+
+ virtual bool isEdited() const { return m_edited; }
+ virtual void setEdited(bool isEdited) { m_edited = isEdited; }
+
+ bool isUserEdited() const { return m_userEdited; }
+ void setUserEdited(bool isUserEdited);
+
+ int selectionStart();
+ int selectionEnd();
+ void setSelectionStart(int);
+ void setSelectionEnd(int);
+ void select();
+ void setSelectionRange(int start, int end);
+ Selection selection(int start, int end) const;
+
+ virtual void subtreeHasChanged();
+ String text();
+ String textWithHardLineBreaks();
+ void selectionChanged(bool userTriggered);
+
+ virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
+
+ virtual bool canBeProgramaticallyScrolled(bool) const { return true; }
+ virtual void autoscroll();
+
+ // Subclassed to forward to our inner div.
+ virtual int scrollLeft() const;
+ virtual int scrollTop() const;
+ virtual int scrollWidth() const;
+ virtual int scrollHeight() const;
+ virtual void setScrollLeft(int);
+ virtual void setScrollTop(int);
+ virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1.0f);
+
+ bool canScroll() const;
+
+ // Returns the line height of the inner renderer.
+ virtual int innerLineHeight() const;
+
+ VisiblePosition visiblePositionForIndex(int index);
+ int indexForVisiblePosition(const VisiblePosition&);
+
+protected:
+ RenderTextControl(Node*);
+
+ int scrollbarThickness() const;
+ void adjustInnerTextStyle(const RenderStyle* startStyle, RenderStyle* textBlockStyle) const;
+ void setInnerTextValue(const String&);
+
+ virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+
+ void createSubtreeIfNeeded(TextControlInnerElement* innerBlock);
+ void hitInnerTextElement(HitTestResult&, int x, int y, int tx, int ty);
+ void forwardEvent(Event*);
+
+ int textBlockWidth() const;
+ int textBlockHeight() const;
+
+ virtual int preferredContentWidth(float charWidth) const = 0;
+ virtual void adjustControlHeightBasedOnLineHeight(int lineHeight) = 0;
+ virtual void cacheSelection(int start, int end) = 0;
+ virtual PassRefPtr<RenderStyle> createInnerTextStyle(const RenderStyle* startStyle) const = 0;
+
+ friend class TextIterator;
+ HTMLElement* innerTextElement() const;
+
+ FormControlElement* formControlElement() const;
+
+private:
+ String finishText(Vector<UChar>&) const;
+
+ bool m_edited;
+ bool m_userEdited;
+ RefPtr<TextControlInnerTextElement> m_innerText;
+};
+
+} // namespace WebCore
+
+#endif // RenderTextControl_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderTextControlMultiLine_h
+#define RenderTextControlMultiLine_h
+
+#include "RenderTextControl.h"
+
+namespace WebCore {
+
+class RenderTextControlMultiLine : public RenderTextControl {
+public:
+ RenderTextControlMultiLine(Node*);
+ virtual ~RenderTextControlMultiLine();
+
+ virtual bool isTextArea() const { return true; }
+
+ virtual void subtreeHasChanged();
+ virtual void layout();
+
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
+ void forwardEvent(Event*);
+
+private:
+ virtual int preferredContentWidth(float charWidth) const;
+ virtual void adjustControlHeightBasedOnLineHeight(int lineHeight);
+ virtual int baselinePosition(bool firstLine, bool isRootLineBox) const;
+
+ virtual void updateFromElement();
+ virtual void cacheSelection(int start, int end);
+
+ virtual PassRefPtr<RenderStyle> createInnerTextStyle(const RenderStyle* startStyle) const;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderTextControlSingleLine_h
+#define RenderTextControlSingleLine_h
+
+#include "PopupMenuClient.h"
+#include "RenderTextControl.h"
+#include "Timer.h"
+
+namespace WebCore {
+
+class InputElement;
+class SearchFieldCancelButtonElement;
+class SearchFieldResultsButtonElement;
+class SearchPopupMenu;
+class TextControlInnerElement;
+
+class RenderTextControlSingleLine : public RenderTextControl, private PopupMenuClient {
+public:
+ RenderTextControlSingleLine(Node*);
+ virtual ~RenderTextControlSingleLine();
+
+ virtual bool hasControlClip() const { return m_cancelButton; }
+ virtual bool isTextField() const { return true; }
+
+ bool placeholderIsVisible() const { return m_placeholderVisible; }
+ bool placeholderShouldBeVisible() const;
+ void updatePlaceholderVisibility();
+
+ void addSearchResult();
+ void stopSearchEventTimer();
+
+ bool popupIsVisible() const { return m_searchPopupIsVisible; }
+ void showPopup();
+ virtual void hidePopup(); // PopupMenuClient method
+
+ virtual void subtreeHasChanged();
+ virtual void paint(PaintInfo&, int tx, int ty);
+ virtual void layout();
+
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
+ void forwardEvent(Event*);
+
+private:
+ virtual void capsLockStateMayHaveChanged();
+
+ int textBlockWidth() const;
+ virtual int preferredContentWidth(float charWidth) const;
+ virtual void adjustControlHeightBasedOnLineHeight(int lineHeight);
+
+ void createSubtreeIfNeeded();
+ virtual void updateFromElement();
+ virtual void cacheSelection(int start, int end);
+ virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+
+ virtual PassRefPtr<RenderStyle> createInnerTextStyle(const RenderStyle* startStyle) const;
+ PassRefPtr<RenderStyle> createInnerBlockStyle(const RenderStyle* startStyle) const;
+ PassRefPtr<RenderStyle> createResultsButtonStyle(const RenderStyle* startStyle) const;
+ PassRefPtr<RenderStyle> createCancelButtonStyle(const RenderStyle* startStyle) const;
+
+ void updateCancelButtonVisibility() const;
+ EVisibility visibilityForCancelButton() const;
+ const AtomicString& autosaveName() const;
+
+ void startSearchEventTimer();
+ void searchEventTimerFired(Timer<RenderTextControlSingleLine>*);
+
+private:
+ // PopupMenuClient methods
+ virtual void valueChanged(unsigned listIndex, bool fireEvents = true);
+ virtual String itemText(unsigned listIndex) const;
+ virtual bool itemIsEnabled(unsigned listIndex) const;
+ virtual PopupMenuStyle itemStyle(unsigned listIndex) const;
+ virtual PopupMenuStyle menuStyle() const;
+ virtual int clientInsetLeft() const;
+ virtual int clientInsetRight() const;
+ virtual int clientPaddingLeft() const;
+ virtual int clientPaddingRight() const;
+ virtual int listSize() const;
+ virtual int selectedIndex() const;
+ virtual bool itemIsSeparator(unsigned listIndex) const;
+ virtual bool itemIsLabel(unsigned listIndex) const;
+ virtual bool itemIsSelected(unsigned listIndex) const;
+ virtual bool shouldPopOver() const { return false; }
+ virtual bool valueShouldChangeOnHotTrack() const { return false; }
+ virtual void setTextFromItem(unsigned listIndex);
+ virtual FontSelector* fontSelector() const;
+ virtual HostWindow* hostWindow() const;
+ virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize);
+
+ InputElement* inputElement() const;
+
+private:
+ bool m_placeholderVisible;
+ bool m_searchPopupIsVisible;
+ bool m_shouldDrawCapsLockIndicator;
+
+ RefPtr<TextControlInnerElement> m_innerBlock;
+ RefPtr<SearchFieldResultsButtonElement> m_resultsButton;
+ RefPtr<SearchFieldCancelButtonElement> m_cancelButton;
+
+ Timer<RenderTextControlSingleLine> m_searchEventTimer;
+ RefPtr<SearchPopupMenu> m_searchPopup;
+ Vector<String> m_recentSearches;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderTextFragment_h
+#define RenderTextFragment_h
+
+#include "RenderText.h"
+
+namespace WebCore {
+
+// Used to represent a text substring of an element, e.g., for text runs that are split because of
+// first letter and that must therefore have different styles (and positions in the render tree).
+// We cache offsets so that text transformations can be applied in such a way that we can recover
+// the original unaltered string from our corresponding DOM node.
+class RenderTextFragment : public RenderText {
+public:
+ RenderTextFragment(Node*, StringImpl*, int startOffset, int length);
+ RenderTextFragment(Node*, StringImpl*);
+
+ virtual bool isTextFragment() const { return true; }
+
+ virtual void destroy();
+
+ unsigned start() const { return m_start; }
+ unsigned end() const { return m_end; }
+
+ RenderObject* firstLetter() const { return m_firstLetter; }
+ void setFirstLetter(RenderObject* firstLetter) { m_firstLetter = firstLetter; }
+
+ StringImpl* contentString() const { return m_contentString.get(); }
+ virtual PassRefPtr<StringImpl> originalText() const;
+
+private:
+ virtual void setTextInternal(PassRefPtr<StringImpl>);
+ virtual UChar previousCharacter();
+
+ unsigned m_start;
+ unsigned m_end;
+ RefPtr<StringImpl> m_contentString;
+ RenderObject* m_firstLetter;
+};
+
+} // namespace WebCore
+
+#endif // RenderTextFragment_h
--- /dev/null
+/*
+ * This file is part of the theme implementation for form controls in WebCore.
+ *
+ * Copyright (C) 2005, 2006, 2007, 2008 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderTheme_h
+#define RenderTheme_h
+
+#include "RenderObject.h"
+#if USE(NEW_THEME)
+#include "Theme.h"
+#else
+#include "ThemeTypes.h"
+#endif
+
+namespace WebCore {
+
+class Element;
+class PopupMenu;
+class RenderMenuList;
+class CSSStyleSheet;
+
+class RenderTheme {
+public:
+ RenderTheme();
+ virtual ~RenderTheme() { }
+
+ // This method is called whenever style has been computed for an element and the appearance
+ // property has been set to a value other than "none". The theme should map in all of the appropriate
+ // metrics and defaults given the contents of the style. This includes sophisticated operations like
+ // selection of control size based off the font, the disabling of appearance when certain other properties like
+ // "border" are set, or if the appearance is not supported by the theme.
+ void adjustStyle(CSSStyleSelector*, RenderStyle*, Element*, bool UAHasAppearance,
+ const BorderData&, const FillLayer&, const Color& backgroundColor);
+
+ // This method is called to paint the widget as a background of the RenderObject. A widget's foreground, e.g., the
+ // text of a button, is always rendered by the engine itself. The boolean return value indicates
+ // whether the CSS border/background should also be painted.
+ bool paint(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ bool paintBorderOnly(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ bool paintDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ // The remaining methods should be implemented by the platform-specific portion of the theme, e.g.,
+ // RenderThemeMac.cpp for Mac OS X.
+
+ // These methods return the theme's extra style sheets rules, to let each platform
+ // adjust the default CSS rules in html4.css, quirks.css, or mediaControls.css
+ virtual String extraDefaultStyleSheet() { return String(); }
+ virtual String extraQuirksStyleSheet() { return String(); }
+#if ENABLE(VIDEO)
+ virtual String extraMediaControlsStyleSheet() { return String(); };
+#endif
+
+ // A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline
+ // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of
+ // controls that need to do this.
+ virtual int baselinePosition(const RenderObject*) const;
+
+ // A method for asking if a control is a container or not. Leaf controls have to have some special behavior (like
+ // the baseline position API above).
+ bool isControlContainer(ControlPart) const;
+
+ // A method asking if the control changes its tint when the window has focus or not.
+ virtual bool controlSupportsTints(const RenderObject*) const { return false; }
+
+ // Whether or not the control has been styled enough by the author to disable the native appearance.
+ virtual bool isControlStyled(const RenderStyle*, const BorderData&, const FillLayer&, const Color& backgroundColor) const;
+
+ // A general method asking if any control tinting is supported at all.
+ virtual bool supportsControlTints() const { return false; }
+
+ // Some controls may spill out of their containers (e.g., the check on an OS X checkbox). When these controls repaint,
+ // the theme needs to communicate this inflated rect to the engine so that it can invalidate the whole control.
+ virtual void adjustRepaintRect(const RenderObject*, IntRect&);
+
+ // This method is called whenever a relevant state changes on a particular themed object, e.g., the mouse becomes pressed
+ // or a control becomes disabled.
+ virtual bool stateChanged(RenderObject*, ControlState) const;
+
+ // This method is called whenever the theme changes on the system in order to flush cached resources from the
+ // old theme.
+ virtual void themeChanged() { }
+
+ // A method asking if the theme is able to draw the focus ring.
+ virtual bool supportsFocusRing(const RenderStyle*) const;
+
+ // A method asking if the theme's controls actually care about redrawing when hovered.
+ virtual bool supportsHover(const RenderStyle*) const { return false; }
+
+ // Text selection colors.
+ Color activeSelectionBackgroundColor() const;
+ Color inactiveSelectionBackgroundColor() const;
+ Color activeSelectionForegroundColor() const;
+ Color inactiveSelectionForegroundColor() const;
+
+ // List box selection colors
+ Color activeListBoxSelectionBackgroundColor() const;
+ Color activeListBoxSelectionForegroundColor() const;
+ Color inactiveListBoxSelectionBackgroundColor() const;
+ Color inactiveListBoxSelectionForegroundColor() const;
+
+ virtual Color platformTextSearchHighlightColor() const;
+
+ virtual void platformColorsDidChange();
+
+ virtual double caretBlinkInterval() const { return 0.5; }
+
+ // System fonts and colors for CSS.
+ virtual Color systemColor(int cssValueId) const;
+
+ virtual int minimumMenuListSize(RenderStyle*) const { return 0; }
+
+ virtual void adjustButtonInnerStyle(RenderStyle*) const;
+ virtual void adjustSliderThumbSize(RenderObject*) const;
+
+ virtual int popupInternalPaddingLeft(RenderStyle*) const { return 0; }
+ virtual int popupInternalPaddingRight(RenderStyle*) const { return 0; }
+ virtual int popupInternalPaddingTop(RenderStyle*) const { return 0; }
+ virtual int popupInternalPaddingBottom(RenderStyle*) const { return 0; }
+
+ // Method for painting the caps lock indicator
+ virtual bool paintCapsLockIndicator(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return 0; };
+
+ virtual bool paintCheckboxDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+ virtual bool paintRadioDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+ virtual bool paintButtonDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+ virtual bool paintPushButtonDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+ virtual bool paintSquareButtonDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+ virtual bool paintTextFieldDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+ virtual bool paintTextAreaDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+ virtual bool paintMenuListDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+ virtual bool paintMenuListButtonDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+
+#if ENABLE(VIDEO)
+ // Media controls
+ virtual bool hitTestMediaControlPart(RenderObject*, const IntPoint& absPoint);
+#endif
+
+protected:
+ // The platform selection color.
+ virtual Color platformActiveSelectionBackgroundColor() const;
+ virtual Color platformInactiveSelectionBackgroundColor() const;
+ virtual Color platformActiveSelectionForegroundColor() const;
+ virtual Color platformInactiveSelectionForegroundColor() const;
+
+ virtual Color platformActiveListBoxSelectionBackgroundColor() const;
+ virtual Color platformInactiveListBoxSelectionBackgroundColor() const;
+ virtual Color platformActiveListBoxSelectionForegroundColor() const;
+ virtual Color platformInactiveListBoxSelectionForegroundColor() const;
+
+ virtual bool supportsSelectionForegroundColors() const { return true; }
+ virtual bool supportsListBoxSelectionForegroundColors() const { return true; }
+
+#if !USE(NEW_THEME)
+ // Methods for each appearance value.
+ virtual void adjustCheckboxStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintCheckbox(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+ virtual void setCheckboxSize(RenderStyle*) const { }
+
+ virtual void adjustRadioStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintRadio(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+ virtual void setRadioSize(RenderStyle*) const { }
+
+ virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+ virtual void setButtonSize(RenderStyle*) const { }
+#endif
+
+ virtual void adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+
+ virtual void adjustTextAreaStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintTextArea(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+
+ virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+
+ virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+
+ virtual void adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+
+ virtual void adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+
+ virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSearchField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+
+ virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSearchFieldCancelButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+
+ virtual void adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSearchFieldDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+
+ virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSearchFieldResultsDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+
+ virtual void adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSearchFieldResultsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+
+ virtual bool paintMediaFullscreenButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+ virtual bool paintMediaPlayButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+ virtual bool paintMediaMuteButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+ virtual bool paintMediaSeekBackButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+ virtual bool paintMediaSeekForwardButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+ virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+ virtual bool paintMediaSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+ virtual bool paintMediaTimelineContainer(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+ virtual bool paintMediaCurrentTime(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+ virtual bool paintMediaTimeRemaining(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+
+public:
+ // Methods for state querying
+ ControlStates controlStatesForRenderer(const RenderObject* o) const;
+ bool isActive(const RenderObject*) const;
+ bool isChecked(const RenderObject*) const;
+ bool isIndeterminate(const RenderObject*) const;
+ bool isEnabled(const RenderObject*) const;
+ bool isFocused(const RenderObject*) const;
+ bool isPressed(const RenderObject*) const;
+ bool isHovered(const RenderObject*) const;
+ bool isReadOnlyControl(const RenderObject*) const;
+ bool isDefault(const RenderObject*) const;
+
+private:
+ mutable Color m_activeSelectionBackgroundColor;
+ mutable Color m_inactiveSelectionBackgroundColor;
+ mutable Color m_activeSelectionForegroundColor;
+ mutable Color m_inactiveSelectionForegroundColor;
+
+ mutable Color m_activeListBoxSelectionBackgroundColor;
+ mutable Color m_inactiveListBoxSelectionBackgroundColor;
+ mutable Color m_activeListBoxSelectionForegroundColor;
+ mutable Color m_inactiveListBoxSelectionForegroundColor;
+
+#if USE(NEW_THEME)
+ Theme* m_theme; // The platform-specific theme.
+#endif
+};
+
+// Function to obtain the theme. This is implemented in your platform-specific theme implementation to hand
+// back the appropriate platform theme.
+RenderTheme* theme();
+
+} // namespace WebCore
+
+#endif // RenderTheme_h
--- /dev/null
+/*
+ * This file is part of the WebKit project.
+ *
+ * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * Copyright (C) 2007 Holger Hans Peter Freyther
+ * Copyright (C) 2007 Alp Toker <alp@atoker.com>
+ * Copyright (C) 2008, 2009 Google, Inc.
+ * All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderThemeChromiumGtk_h
+#define RenderThemeChromiumGtk_h
+
+#include "RenderTheme.h"
+
+#include <gtk/gtk.h>
+
+namespace WebCore {
+
+ class RenderThemeChromiumGtk : public RenderTheme {
+ public:
+ RenderThemeChromiumGtk();
+ ~RenderThemeChromiumGtk() { }
+
+ virtual String extraDefaultStyleSheet();
+ virtual String extraQuirksStyleSheet();
+
+ // A method asking if the theme's controls actually care about redrawing when hovered.
+ virtual bool supportsHover(const RenderStyle*) const { return true; }
+
+ // A method asking if the theme is able to draw the focus ring.
+ virtual bool supportsFocusRing(const RenderStyle*) const;
+
+ // The platform selection color.
+ virtual Color platformActiveSelectionBackgroundColor() const;
+ virtual Color platformInactiveSelectionBackgroundColor() const;
+ virtual Color platformActiveSelectionForegroundColor() const;
+ virtual Color platformInactiveSelectionForegroundColor() const;
+ virtual Color platformTextSearchHighlightColor() const;
+
+ virtual double caretBlinkInterval() const;
+
+ // System fonts.
+ virtual void systemFont(int propId, Document*, FontDescription&) const;
+
+ virtual int minimumMenuListSize(RenderStyle*) const;
+
+ virtual bool paintCheckbox(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void setCheckboxSize(RenderStyle*) const;
+
+ virtual bool paintRadio(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void setRadioSize(RenderStyle*) const;
+
+ virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual bool paintTextArea(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { return paintTextField(o, i, r); }
+
+ virtual bool paintSearchField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual bool paintSearchFieldResultsDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintSearchFieldResultsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintSearchFieldCancelButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ // MenuList refers to an unstyled menulist (meaning a menulist without
+ // background-color or border set) and MenuListButton refers to a styled
+ // menulist (a menulist with background-color or border set). They have
+ // this distinction to support showing aqua style themes whenever they
+ // possibly can, which is something we don't want to replicate.
+ //
+ // In short, we either go down the MenuList code path or the MenuListButton
+ // codepath. We never go down both. And in both cases, they render the
+ // entire menulist.
+ virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ // These methods define the padding for the MenuList's inner block.
+ virtual int popupInternalPaddingLeft(RenderStyle*) const;
+ virtual int popupInternalPaddingRight(RenderStyle*) const;
+ virtual int popupInternalPaddingTop(RenderStyle*) const;
+ virtual int popupInternalPaddingBottom(RenderStyle*) const;
+
+ virtual void adjustButtonInnerStyle(RenderStyle* style) const;
+
+ // A method asking if the control changes its tint when the window has focus or not.
+ virtual bool controlSupportsTints(const RenderObject*) const;
+
+ // A general method asking if any control tinting is supported at all.
+ virtual bool supportsControlTints() const { return true; }
+
+ // List Box selection color
+ virtual Color activeListBoxSelectionBackgroundColor() const;
+ virtual Color activeListBoxSelectionForegroundColor() const;
+ virtual Color inactiveListBoxSelectionBackgroundColor() const;
+ virtual Color inactiveListBoxSelectionForegroundColor() const;
+
+ private:
+ // Hold the state
+ GtkWidget* gtkEntry() const;
+ GtkWidget* gtkTreeView() const;
+
+ // Unmapped GdkWindow having a container. This is holding all our fake widgets
+ GtkContainer* gtkContainer() const;
+
+ private:
+ int menuListInternalPadding(RenderStyle*, int paddingType) const;
+
+ mutable GtkWidget* m_gtkWindow;
+ mutable GtkContainer* m_gtkContainer;
+ mutable GtkWidget* m_gtkEntry;
+ mutable GtkWidget* m_gtkTreeView;
+ };
+
+} // namespace WebCore
+
+#endif
--- /dev/null
+/*
+ * This file is part of the theme implementation for form controls in WebCore.
+ *
+ * Copyright (C) 2005 Apple Computer, Inc.
+ * Copyright (C) 2008, 2009 Google, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderThemeChromiumMac_h
+#define RenderThemeChromiumMac_h
+
+#import "RenderTheme.h"
+#import <wtf/HashMap.h>
+#import <wtf/RetainPtr.h>
+
+#ifdef __OBJC__
+@class WebCoreRenderThemeNotificationObserver;
+#else
+class WebCoreRenderThemeNotificationObserver;
+#endif
+
+namespace WebCore {
+
+ class RenderStyle;
+
+ class RenderThemeChromiumMac : public RenderTheme {
+ public:
+ RenderThemeChromiumMac();
+ virtual ~RenderThemeChromiumMac();
+
+ // A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline
+ // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of
+ // controls that need to do this.
+ virtual int baselinePosition(const RenderObject*) const;
+
+ // A method asking if the control changes its tint when the window has focus or not.
+ virtual bool controlSupportsTints(const RenderObject*) const;
+
+ // A general method asking if any control tinting is supported at all.
+ virtual bool supportsControlTints() const { return true; }
+
+ virtual void adjustRepaintRect(const RenderObject*, IntRect&);
+
+ virtual bool isControlStyled(const RenderStyle*, const BorderData&,
+ const FillLayer&, const Color& backgroundColor) const;
+
+ virtual Color platformActiveSelectionBackgroundColor() const;
+ virtual Color platformInactiveSelectionBackgroundColor() const;
+ virtual Color activeListBoxSelectionBackgroundColor() const;
+
+ virtual void platformColorsDidChange();
+
+ // System fonts.
+ virtual void systemFont(int cssValueId, Document*, FontDescription&) const;
+
+ virtual int minimumMenuListSize(RenderStyle*) const;
+
+ virtual void adjustSliderThumbSize(RenderObject*) const;
+
+ virtual int popupInternalPaddingLeft(RenderStyle*) const;
+ virtual int popupInternalPaddingRight(RenderStyle*) const;
+ virtual int popupInternalPaddingTop(RenderStyle*) const;
+ virtual int popupInternalPaddingBottom(RenderStyle*) const;
+
+ virtual bool paintCapsLockIndicator(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual Color systemColor(int cssValueId) const;
+
+ protected:
+ // Methods for each appearance value.
+ virtual bool paintCheckbox(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void setCheckboxSize(RenderStyle*) const;
+
+ virtual bool paintRadio(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void setRadioSize(RenderStyle*) const;
+
+ virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle*, WebCore::Element*) const;
+ virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void setButtonSize(RenderStyle*) const;
+
+ virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+
+ virtual bool paintTextArea(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void adjustTextAreaStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+
+ virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+
+ virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+
+ virtual bool paintSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+
+ virtual bool paintSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+
+ virtual bool paintSearchField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+
+ virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSearchFieldCancelButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual void adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSearchFieldDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSearchFieldResultsDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual void adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSearchFieldResultsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual bool paintMediaFullscreenButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintMediaPlayButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintMediaMuteButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintMediaSeekBackButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintMediaSeekForwardButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintMediaSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ private:
+ IntRect inflateRect(const IntRect&, const IntSize&, const int* margins, float zoomLevel = 1.0f) const;
+
+ // Get the control size based off the font. Used by some of the controls (like buttons).
+ NSControlSize controlSizeForFont(RenderStyle*) const;
+ NSControlSize controlSizeForSystemFont(RenderStyle*) const;
+ void setControlSize(NSCell*, const IntSize* sizes, const IntSize& minSize, float zoomLevel = 1.0f);
+ void setSizeFromFont(RenderStyle*, const IntSize* sizes) const;
+ IntSize sizeForFont(RenderStyle*, const IntSize* sizes) const;
+ IntSize sizeForSystemFont(RenderStyle*, const IntSize* sizes) const;
+ void setFontFromControlSize(CSSStyleSelector*, RenderStyle*, NSControlSize) const;
+
+ void updateCheckedState(NSCell*, const RenderObject*);
+ void updateEnabledState(NSCell*, const RenderObject*);
+ void updateFocusedState(NSCell*, const RenderObject*);
+ void updatePressedState(NSCell*, const RenderObject*);
+
+ // Helpers for adjusting appearance and for painting
+ const IntSize* checkboxSizes() const;
+ const int* checkboxMargins() const;
+ void setCheckboxCellState(const RenderObject*, const IntRect&);
+
+ const IntSize* radioSizes() const;
+ const int* radioMargins() const;
+ void setRadioCellState(const RenderObject*, const IntRect&);
+
+ void setButtonPaddingFromControlSize(RenderStyle*, NSControlSize) const;
+ const IntSize* buttonSizes() const;
+ const int* buttonMargins() const;
+ void setButtonCellState(const RenderObject*, const IntRect&);
+
+ void setPopupButtonCellState(const RenderObject*, const IntRect&);
+ const IntSize* popupButtonSizes() const;
+ const int* popupButtonMargins() const;
+ const int* popupButtonPadding(NSControlSize) const;
+ void paintMenuListButtonGradients(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ const IntSize* menuListSizes() const;
+
+ const IntSize* searchFieldSizes() const;
+ const IntSize* cancelButtonSizes() const;
+ const IntSize* resultsButtonSizes() const;
+ void setSearchCellState(RenderObject*, const IntRect&);
+ void setSearchFieldSize(RenderStyle*) const;
+
+ NSButtonCell* checkbox() const;
+ NSButtonCell* radio() const;
+ NSButtonCell* button() const;
+ NSPopUpButtonCell* popupButton() const;
+ NSSearchFieldCell* search() const;
+ NSMenu* searchMenuTemplate() const;
+ NSSliderCell* sliderThumbHorizontal() const;
+ NSSliderCell* sliderThumbVertical() const;
+
+ private:
+ mutable RetainPtr<NSButtonCell> m_checkbox;
+ mutable RetainPtr<NSButtonCell> m_radio;
+ mutable RetainPtr<NSButtonCell> m_button;
+ mutable RetainPtr<NSPopUpButtonCell> m_popupButton;
+ mutable RetainPtr<NSSearchFieldCell> m_search;
+ mutable RetainPtr<NSMenu> m_searchMenuTemplate;
+ mutable RetainPtr<NSSliderCell> m_sliderThumbHorizontal;
+ mutable RetainPtr<NSSliderCell> m_sliderThumbVertical;
+
+ bool m_isSliderThumbHorizontalPressed;
+ bool m_isSliderThumbVerticalPressed;
+
+ mutable HashMap<int, RGBA32> m_systemColorCache;
+
+ RetainPtr<WebCoreRenderThemeNotificationObserver> m_notificationObserver;
+ };
+
+} // namespace WebCore
+
+#endif
--- /dev/null
+/*
+ * This file is part of the WebKit project.
+ *
+ * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2008, 2009 Google, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderThemeChromiumWin_h
+#define RenderThemeChromiumWin_h
+
+#include "RenderTheme.h"
+
+#if WIN32
+typedef void* HANDLE;
+typedef struct HINSTANCE__* HINSTANCE;
+typedef HINSTANCE HMODULE;
+#endif
+
+namespace WebCore {
+
+ struct ThemeData {
+ ThemeData() : m_part(0), m_state(0), m_classicState(0) {}
+
+ unsigned m_part;
+ unsigned m_state;
+ unsigned m_classicState;
+ };
+
+ class RenderThemeChromiumWin : public RenderTheme {
+ public:
+ RenderThemeChromiumWin() { }
+ ~RenderThemeChromiumWin() { }
+
+ virtual String extraDefaultStyleSheet();
+ virtual String extraQuirksStyleSheet();
+
+ // A method asking if the theme's controls actually care about redrawing when hovered.
+ virtual bool supportsHover(const RenderStyle*) const { return true; }
+
+ // A method asking if the theme is able to draw the focus ring.
+ virtual bool supportsFocusRing(const RenderStyle*) const;
+
+ // The platform selection color.
+ virtual Color platformActiveSelectionBackgroundColor() const;
+ virtual Color platformInactiveSelectionBackgroundColor() const;
+ virtual Color platformActiveSelectionForegroundColor() const;
+ virtual Color platformInactiveSelectionForegroundColor() const;
+ virtual Color platformTextSearchHighlightColor() const;
+
+ virtual double caretBlinkInterval() const;
+
+ // System fonts.
+ virtual void systemFont(int propId, Document*, FontDescription&) const;
+
+ virtual int minimumMenuListSize(RenderStyle*) const;
+
+ virtual bool paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { return paintButton(o, i, r); }
+ virtual void setCheckboxSize(RenderStyle*) const;
+
+ virtual bool paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { return paintButton(o, i, r); }
+ virtual void setRadioSize(RenderStyle*) const;
+
+ virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual bool paintTextArea(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { return paintTextField(o, i, r); }
+
+ virtual bool paintSearchField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ // MenuList refers to an unstyled menulist (meaning a menulist without
+ // background-color or border set) and MenuListButton refers to a styled
+ // menulist (a menulist with background-color or border set). They have
+ // this distinction to support showing aqua style themes whenever they
+ // possibly can, which is something we don't want to replicate.
+ //
+ // In short, we either go down the MenuList code path or the MenuListButton
+ // codepath. We never go down both. And in both cases, they render the
+ // entire menulist.
+ virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ // These methods define the padding for the MenuList's inner block.
+ virtual int popupInternalPaddingLeft(RenderStyle*) const;
+ virtual int popupInternalPaddingRight(RenderStyle*) const;
+ virtual int popupInternalPaddingTop(RenderStyle*) const;
+ virtual int popupInternalPaddingBottom(RenderStyle*) const;
+
+ virtual void adjustButtonInnerStyle(RenderStyle*) const;
+
+ // Provide a way to pass the default font size from the Settings object
+ // to the render theme. FIXME: http://b/1129186 A cleaner way would be
+ // to remove the default font size from this object and have callers
+ // that need the value to get it directly from the appropriate Settings
+ // object.
+ static void setDefaultFontSize(int);
+
+ // Enables/Disables FindInPage mode, which (if enabled) overrides the
+ // selection rect color to be orange.
+ static void setFindInPageMode(bool);
+
+ private:
+ unsigned determineState(RenderObject*);
+ unsigned determineClassicState(RenderObject*);
+
+ ThemeData getThemeData(RenderObject*);
+
+ bool paintTextFieldInternal(RenderObject*, const RenderObject::PaintInfo&, const IntRect&, bool);
+
+ int menuListInternalPadding(RenderStyle*, int paddingType) const;
+
+ // A flag specifying whether we are in Find-in-page mode or not.
+ static bool m_findInPageMode;
+ };
+
+} // namespace WebCore
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ */
+
+#ifndef RENDER_THEME_IPHONE_H
+#define RENDER_THEME_IPHONE_H
+
+
+#include "RenderTheme.h"
+
+namespace WebCore {
+
+class RenderStyle;
+class GraphicsContext;
+
+class RenderThemeIPhone : public RenderTheme {
+public:
+
+ virtual int popupInternalPaddingRight(RenderStyle*) const;
+
+protected:
+
+ virtual int baselinePosition(const RenderObject* o) const;
+
+ virtual bool isControlStyled(const RenderStyle* style, const BorderData& border, const FillLayer& background, const Color& backgroundColor) const;
+
+ // Methods for each appearance value.
+ virtual void adjustCheckboxStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintCheckboxDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual void adjustRadioStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintRadioDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual bool paintButtonDecorations(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r);
+ virtual bool paintPushButtonDecorations(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r);
+ virtual void setButtonSize(RenderStyle*) const;
+
+ virtual bool paintTextFieldDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual bool paintTextAreaDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintMenuListButtonDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+private:
+
+ typedef enum
+ {
+ InsetGradient,
+ ShineGradient,
+ ShadeGradient,
+ ConvexGradient,
+ ConcaveGradient
+ } IPhoneGradientName;
+
+ Color * shadowColor() const;
+ IPhoneGradientRef gradientWithName(IPhoneGradientName aGradientName) const;
+ FloatRect addRoundedBorderClip(const FloatRect& aRect, const BorderData&, GraphicsContext* aContext);
+};
+
+}
+
+
+#endif // RENDER_THEME_IPHONE_H
+
--- /dev/null
+/*
+ * This file is part of the theme implementation for form controls in WebCore.
+ *
+ * Copyright (C) 2005 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderThemeSafari_h
+#define RenderThemeSafari_h
+
+#if USE(SAFARI_THEME)
+
+#include "RenderTheme.h"
+
+// If you have an empty placeholder SafariThemeConstants.h, then include SafariTheme.h
+// This is a workaround until a version of WebKitSupportLibrary is released with an updated SafariThemeConstants.h
+#include <SafariTheme/SafariThemeConstants.h>
+#ifndef SafariThemeConstants_h
+#include <SafariTheme/SafariTheme.h>
+#endif
+
+#if PLATFORM(WIN)
+typedef void* HANDLE;
+typedef struct HINSTANCE__* HINSTANCE;
+typedef HINSTANCE HMODULE;
+#endif
+
+namespace WebCore {
+
+using namespace SafariTheme;
+
+class RenderStyle;
+
+class RenderThemeSafari : public RenderTheme {
+public:
+ RenderThemeSafari();
+ virtual ~RenderThemeSafari();
+
+ // A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline
+ // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of
+ // controls that need to do this.
+ virtual int baselinePosition(const RenderObject*) const;
+
+ // A method asking if the control changes its tint when the window has focus or not.
+ virtual bool controlSupportsTints(const RenderObject*) const;
+
+ // A general method asking if any control tinting is supported at all.
+ virtual bool supportsControlTints() const { return true; }
+
+ virtual void adjustRepaintRect(const RenderObject*, IntRect&);
+
+ virtual bool isControlStyled(const RenderStyle*, const BorderData&,
+ const FillLayer&, const Color& backgroundColor) const;
+
+ virtual Color platformActiveSelectionBackgroundColor() const;
+ virtual Color platformInactiveSelectionBackgroundColor() const;
+ virtual Color activeListBoxSelectionBackgroundColor() const;
+
+ // System fonts.
+ virtual void systemFont(int propId, FontDescription&) const;
+
+ virtual int minimumMenuListSize(RenderStyle*) const;
+
+ virtual void adjustSliderThumbSize(RenderObject*) const;
+ virtual void adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+
+ virtual int popupInternalPaddingLeft(RenderStyle*) const;
+ virtual int popupInternalPaddingRight(RenderStyle*) const;
+ virtual int popupInternalPaddingTop(RenderStyle*) const;
+ virtual int popupInternalPaddingBottom(RenderStyle*) const;
+
+protected:
+ // Methods for each appearance value.
+ virtual bool paintCheckbox(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void setCheckboxSize(RenderStyle*) const;
+
+ virtual bool paintRadio(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void setRadioSize(RenderStyle*) const;
+
+ virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle*, WebCore::Element*) const;
+ virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void setButtonSize(RenderStyle*) const;
+
+ virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+
+ virtual bool paintTextArea(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void adjustTextAreaStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+
+ virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+
+ virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+
+ virtual bool paintSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual bool paintSearchField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+
+ virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSearchFieldCancelButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual void adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSearchFieldDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSearchFieldResultsDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual void adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSearchFieldResultsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual bool paintCapsLockIndicator(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+#if ENABLE(VIDEO)
+ virtual bool paintMediaFullscreenButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintMediaPlayButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintMediaMuteButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintMediaSeekBackButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintMediaSeekForwardButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintMediaSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+#endif
+
+private:
+ IntRect inflateRect(const IntRect&, const IntSize&, const int* margins) const;
+
+ // Get the control size based off the font. Used by some of the controls (like buttons).
+
+ NSControlSize controlSizeForFont(RenderStyle*) const;
+ NSControlSize controlSizeForSystemFont(RenderStyle*) const;
+ //void setControlSize(NSCell*, const IntSize* sizes, const IntSize& minSize);
+ void setSizeFromFont(RenderStyle*, const IntSize* sizes) const;
+ IntSize sizeForFont(RenderStyle*, const IntSize* sizes) const;
+ IntSize sizeForSystemFont(RenderStyle*, const IntSize* sizes) const;
+ void setFontFromControlSize(CSSStyleSelector*, RenderStyle*, NSControlSize) const;
+
+ // Helpers for adjusting appearance and for painting
+ const IntSize* checkboxSizes() const;
+ const int* checkboxMargins(NSControlSize) const;
+
+ const IntSize* radioSizes() const;
+ const int* radioMargins(NSControlSize) const;
+
+ void setButtonPaddingFromControlSize(RenderStyle*, NSControlSize) const;
+ const IntSize* buttonSizes() const;
+ const int* buttonMargins(NSControlSize) const;
+
+ const IntSize* popupButtonSizes() const;
+ const int* popupButtonMargins(NSControlSize) const;
+ const int* popupButtonPadding(NSControlSize) const;
+ void paintMenuListButtonGradients(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ const IntSize* menuListSizes() const;
+
+ const IntSize* searchFieldSizes() const;
+ const IntSize* cancelButtonSizes() const;
+ const IntSize* resultsButtonSizes() const;
+ void setSearchFieldSize(RenderStyle*) const;
+
+ ThemeControlState determineState(RenderObject*) const;
+};
+
+} // namespace WebCore
+
+#endif // #if USE(SAFARI_THEME)
+
+#endif // RenderThemeSafari_h
--- /dev/null
+/*
+ * This file is part of the WebKit project.
+ *
+ * Copyright (C) 2006, 2008 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderThemeWin_h
+#define RenderThemeWin_h
+
+#include "RenderTheme.h"
+
+#if WIN32
+typedef void* HANDLE;
+typedef struct HINSTANCE__* HINSTANCE;
+typedef HINSTANCE HMODULE;
+#endif
+
+namespace WebCore {
+
+struct ThemeData {
+ ThemeData() :m_part(0), m_state(0), m_classicState(0) {}
+ ThemeData(int part, int state)
+ : m_part(part)
+ , m_state(state)
+ , m_classicState(0)
+ { }
+
+ unsigned m_part;
+ unsigned m_state;
+ unsigned m_classicState;
+};
+
+class RenderThemeWin : public RenderTheme {
+public:
+ RenderThemeWin();
+ ~RenderThemeWin();
+
+ virtual String extraDefaultStyleSheet();
+ virtual String extraQuirksStyleSheet();
+
+ // A method asking if the theme's controls actually care about redrawing when hovered.
+ virtual bool supportsHover(const RenderStyle*) const;
+
+ virtual Color platformActiveSelectionBackgroundColor() const;
+ virtual Color platformInactiveSelectionBackgroundColor() const;
+ virtual Color platformActiveSelectionForegroundColor() const;
+ virtual Color platformInactiveSelectionForegroundColor() const;
+
+ // System fonts.
+ virtual void systemFont(int propId, FontDescription&) const;
+ virtual Color systemColor(int cssValueId) const;
+
+ virtual bool paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
+ { return paintButton(o, i, r); }
+ virtual void setCheckboxSize(RenderStyle*) const;
+
+ virtual bool paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
+ { return paintButton(o, i, r); }
+ virtual void setRadioSize(RenderStyle* style) const
+ { return setCheckboxSize(style); }
+
+ virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual bool paintTextArea(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
+ { return paintTextField(o, i, r); }
+
+ virtual void adjustMenuListStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const;
+ virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void adjustMenuListButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const;
+
+ virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual bool paintSliderTrack(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r);
+ virtual bool paintSliderThumb(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r);
+ virtual void adjustSliderThumbSize(RenderObject*) const;
+
+ virtual void adjustButtonInnerStyle(RenderStyle*) const;
+
+ virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSearchField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSearchFieldCancelButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual void adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSearchFieldDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return false; }
+
+ virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSearchFieldResultsDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual void adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSearchFieldResultsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual void themeChanged();
+
+ virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle* style, Element*) const {}
+ virtual void adjustTextFieldStyle(CSSStyleSelector*, RenderStyle* style, Element*) const {}
+ virtual void adjustTextAreaStyle(CSSStyleSelector*, RenderStyle* style, Element*) const {}
+
+ static void setWebKitIsBeingUnloaded();
+
+ virtual bool supportsFocusRing(const RenderStyle*) const;
+
+private:
+ void addIntrinsicMargins(RenderStyle*) const;
+ void close();
+
+ unsigned determineState(RenderObject*);
+ unsigned determineClassicState(RenderObject*);
+ unsigned determineSliderThumbState(RenderObject*);
+ unsigned determineButtonState(RenderObject*);
+
+ bool supportsFocus(ControlPart) const;
+
+ ThemeData getThemeData(RenderObject*);
+ ThemeData getClassicThemeData(RenderObject* o);
+
+ HANDLE buttonTheme() const;
+ HANDLE textFieldTheme() const;
+ HANDLE menuListTheme() const;
+ HANDLE sliderTheme() const;
+
+ mutable HANDLE m_buttonTheme;
+ mutable HANDLE m_textFieldTheme;
+ mutable HANDLE m_menuListTheme;
+ mutable HANDLE m_sliderTheme;
+};
+
+};
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RenderTreeAsText_h
+#define RenderTreeAsText_h
+
+namespace WebCore {
+
+ class RenderObject;
+ class String;
+ class TextStream;
+
+ String externalRepresentation(RenderObject*);
+ void write(TextStream&, const RenderObject&, int indent = 0);
+
+ // Helper function shared with SVGRenderTreeAsText
+ String quoteAndEscapeNonPrintables(const String&);
+
+} // namespace WebCore
+
+#endif // RenderTreeAsText_h
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RenderVideo_h
+#define RenderVideo_h
+
+#if ENABLE(VIDEO)
+
+#include "RenderMedia.h"
+
+namespace WebCore {
+
+class HTMLMediaElement;
+
+class RenderVideo : public RenderMedia {
+public:
+ RenderVideo(HTMLMediaElement*);
+ virtual ~RenderVideo();
+
+ virtual const char* renderName() const { return "RenderVideo"; }
+
+ virtual void paintReplaced(PaintInfo& paintInfo, int tx, int ty);
+
+ virtual void layout();
+
+ virtual int calcReplacedWidth(bool includeMaxWidth = true) const;
+ virtual int calcReplacedHeight() const;
+
+ virtual void calcPrefWidths();
+
+ void videoSizeChanged();
+
+ void updateFromElement();
+
+protected:
+ virtual void intrinsicSizeChanged() { videoSizeChanged(); }
+
+private:
+ int calcAspectRatioWidth() const;
+ int calcAspectRatioHeight() const;
+
+ bool isWidthSpecified() const;
+ bool isHeightSpecified() const;
+
+ IntRect videoBox() const;
+
+ void updatePlayer();
+};
+
+} // namespace WebCore
+
+#endif
+#endif // RenderVideo_h
--- /dev/null
+/*
+ * This file is part of the HTML widget for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderView_h
+#define RenderView_h
+
+#include "FrameView.h"
+#include "Frame.h"
+#include "LayoutState.h"
+#include "RenderBlock.h"
+#include <wtf/OwnPtr.h>
+
+namespace WebCore {
+
+#if USE(ACCELERATED_COMPOSITING)
+class RenderLayerCompositor;
+#endif
+
+class RenderView : public RenderBlock {
+public:
+ RenderView(Node*, FrameView*);
+ virtual ~RenderView();
+
+ virtual const char* renderName() const { return "RenderView"; }
+
+ virtual bool isRenderView() const { return true; }
+
+ virtual void layout();
+ virtual void calcWidth();
+ virtual void calcHeight();
+ virtual void calcPrefWidths();
+
+ int docHeight() const;
+ int docWidth() const;
+
+ // The same as the FrameView's layoutHeight/layoutWidth but with null check guards.
+ int viewHeight() const;
+ int viewWidth() const;
+
+ float zoomFactor() const { return m_frameView->frame() && m_frameView->frame()->shouldApplyPageZoom() ? m_frameView->frame()->zoomFactor() : 1.0f; }
+
+ FrameView* frameView() const { return m_frameView; }
+
+ virtual bool hasOverhangingFloats() { return false; }
+
+ virtual void computeRectForRepaint(RenderBox* repaintContainer, IntRect&, bool fixed = false);
+ virtual void repaintViewRectangle(const IntRect&, bool immediate = false);
+ // Repaint the view, and all composited layers that intersect the given absolute rectangle.
+ // FIXME: ideally we'd never have to do this, if all repaints are container-relative.
+ virtual void repaintRectangleInViewAndCompositedLayers(const IntRect&, bool immediate = false);
+
+ virtual void paint(PaintInfo&, int tx, int ty);
+ virtual void paintBoxDecorations(PaintInfo&, int tx, int ty);
+
+ void setSelection(RenderObject* start, int startPos, RenderObject* end, int endPos);
+ void clearSelection();
+ virtual RenderObject* selectionStart() const { return m_selectionStart; }
+ virtual RenderObject* selectionEnd() const { return m_selectionEnd; }
+
+ bool printing() const;
+ void setPrintImages(bool enable) { m_printImages = enable; }
+ bool printImages() const { return m_printImages; }
+ void setTruncatedAt(int y) { m_truncatedAt = y; m_bestTruncatedAt = m_truncatorWidth = 0; m_forcedPageBreak = false; }
+ void setBestTruncatedAt(int y, RenderBox* forRenderer, bool forcedBreak = false);
+ int bestTruncatedAt() const { return m_bestTruncatedAt; }
+
+ int truncatedAt() const { return m_truncatedAt; }
+
+ virtual void absoluteRects(Vector<IntRect>&, int tx, int ty, bool topLevel = true);
+ virtual void absoluteQuads(Vector<FloatQuad>&, bool topLevel = true);
+
+ IntRect selectionBounds(bool clipToVisibleContent = true) const;
+
+#if USE(ACCELERATED_COMPOSITING)
+ void setMaximalOutlineSize(int o);
+#else
+ void setMaximalOutlineSize(int o) { m_maximalOutlineSize = o; }
+#endif
+ int maximalOutlineSize() const { return m_maximalOutlineSize; }
+
+ virtual IntRect viewRect() const;
+
+ virtual void selectionStartEnd(int& startPos, int& endPos) const;
+
+ IntRect printRect() const { return m_printRect; }
+ void setPrintRect(const IntRect& r) { m_printRect = r; }
+
+ void updateWidgetPositions();
+ void addWidget(RenderObject*);
+ void removeWidget(RenderObject*);
+
+ // layoutDelta is used transiently during layout to store how far an object has moved from its
+ // last layout location, in order to repaint correctly.
+ // If we're doing a full repaint m_layoutState will be 0, but in that case layoutDelta doesn't matter.
+ IntSize layoutDelta() const
+ {
+ return m_layoutState ? m_layoutState->m_layoutDelta : IntSize();
+ }
+ void addLayoutDelta(const IntSize& delta)
+ {
+ if (m_layoutState)
+ m_layoutState->m_layoutDelta += delta;
+ }
+
+ bool doingFullRepaint() const { return m_frameView->needsFullRepaint(); }
+
+ void pushLayoutState(RenderBox* renderer, const IntSize& offset)
+ {
+ if (doingFullRepaint())
+ return;
+ // We push LayoutState even if layoutState is disabled because it stores layoutDelta too.
+ m_layoutState = new (renderArena()) LayoutState(m_layoutState, renderer, offset);
+ }
+
+ void pushLayoutState(RenderObject*);
+
+ void popLayoutState()
+ {
+ if (doingFullRepaint())
+ return;
+ LayoutState* state = m_layoutState;
+ m_layoutState = state->m_next;
+ state->destroy(renderArena());
+ }
+
+ // Returns true if layoutState should be used for its cached offset and clip.
+ bool layoutStateEnabled() const { return m_layoutStateDisableCount == 0 && m_layoutState; }
+ LayoutState* layoutState() const { return m_layoutState; }
+
+ // Suspends the LayoutState optimization. Used under transforms that cannot be represented by
+ // LayoutState (common in SVG) and when manipulating the render tree during layout in ways
+ // that can trigger repaint of a non-child (e.g. when a list item moves its list marker around).
+ // Note that even when disabled, LayoutState is still used to store layoutDelta.
+ void disableLayoutState() { m_layoutStateDisableCount++; }
+ void enableLayoutState() { ASSERT(m_layoutStateDisableCount > 0); m_layoutStateDisableCount--; }
+
+ virtual void updateHitTestResult(HitTestResult&, const IntPoint&);
+
+ // Notifications that this view became visible in a window, or will be
+ // removed from the window.
+ void didMoveOnscreen();
+ void willMoveOffscreen();
+
+#if USE(ACCELERATED_COMPOSITING)
+ RenderLayerCompositor* compositor();
+ bool usesCompositing() const;
+#endif
+
+protected:
+ virtual void mapLocalToContainer(RenderBox* repaintContainer, bool useTransforms, bool fixed, TransformState&) const;
+ virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const;
+
+private:
+ bool shouldRepaint(const IntRect& r) const;
+
+protected:
+ FrameView* m_frameView;
+
+ RenderObject* m_selectionStart;
+ RenderObject* m_selectionEnd;
+ int m_selectionStartPos;
+ int m_selectionEndPos;
+
+ // used to ignore viewport width when printing to the printer
+ bool m_printImages;
+ int m_truncatedAt;
+
+ int m_maximalOutlineSize; // Used to apply a fudge factor to dirty-rect checks on blocks/tables.
+ IntRect m_printRect; // Used when printing.
+
+ typedef HashSet<RenderObject*> RenderObjectSet;
+
+ RenderObjectSet m_widgets;
+
+private:
+ int m_bestTruncatedAt;
+ int m_truncatorWidth;
+ bool m_forcedPageBreak;
+ LayoutState* m_layoutState;
+ unsigned m_layoutStateDisableCount;
+#if USE(ACCELERATED_COMPOSITING)
+ OwnPtr<RenderLayerCompositor> m_compositor;
+#endif
+};
+
+// Stack-based class to assist with LayoutState push/pop
+class LayoutStateMaintainer : Noncopyable {
+public:
+ // ctor to push now
+ LayoutStateMaintainer(RenderView* view, RenderBox* root, IntSize offset, bool disableState = false)
+ : m_view(view)
+ , m_disabled(disableState)
+ , m_didStart(false)
+ , m_didEnd(false)
+ {
+ push(root, offset);
+ }
+
+ // ctor to maybe push later
+ LayoutStateMaintainer(RenderView* view)
+ : m_view(view)
+ , m_disabled(false)
+ , m_didStart(false)
+ , m_didEnd(false)
+ {
+ }
+
+ ~LayoutStateMaintainer()
+ {
+ ASSERT(m_didStart == m_didEnd); // if this fires, it means that someone did a push(), but forgot to pop().
+ }
+
+ void push(RenderBox* root, IntSize offset)
+ {
+ ASSERT(!m_didStart);
+ // We push state even if disabled, because we still need to store layoutDelta
+ m_view->pushLayoutState(root, offset);
+ if (m_disabled)
+ m_view->disableLayoutState();
+ m_didStart = true;
+ }
+
+ void pop()
+ {
+ if (m_didStart) {
+ ASSERT(!m_didEnd);
+ m_view->popLayoutState();
+ if (m_disabled)
+ m_view->enableLayoutState();
+ m_didEnd = true;
+ }
+ }
+
+ bool didPush() const { return m_didStart; }
+
+private:
+ RenderView* m_view;
+ bool m_disabled : 1; // true if the offset and clip part of layoutState is disabled
+ bool m_didStart : 1; // true if we did a push or disable
+ bool m_didEnd : 1; // true if we popped or re-enabled
+};
+
+} // namespace WebCore
+
+#endif // RenderView_h
--- /dev/null
+/*
+ * This file is part of the HTML widget for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderWidget_h
+#define RenderWidget_h
+
+#include "RenderReplaced.h"
+
+namespace WebCore {
+
+class Widget;
+
+class RenderWidget : public RenderReplaced {
+public:
+ RenderWidget(Node*);
+ virtual ~RenderWidget();
+
+ virtual bool isWidget() const { return true; }
+
+ virtual void paint(PaintInfo&, int tx, int ty);
+
+ virtual void destroy();
+ virtual void layout();
+
+ Widget* widget() const { return m_widget; }
+ static RenderWidget* find(const Widget*);
+
+ RenderArena* ref() { ++m_refCount; return renderArena(); }
+ void deref(RenderArena*);
+
+ virtual void setSelectionState(SelectionState);
+
+ virtual void updateWidgetPosition();
+
+ virtual void setWidget(Widget*);
+
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
+
+protected:
+ virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+
+private:
+ void setWidgetGeometry(const IntRect&);
+
+ virtual void deleteWidget();
+
+protected:
+ Widget* m_widget;
+ FrameView* m_view;
+
+private:
+ int m_refCount;
+};
+
+} // namespace WebCore
+
+#endif // RenderWidget_h
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef RenderWordBreak_h
+#define RenderWordBreak_h
+
+#include "RenderText.h"
+
+namespace WebCore {
+
+class HTMLElement;
+
+class RenderWordBreak : public RenderText {
+public:
+ RenderWordBreak(HTMLElement*);
+
+ virtual const char* renderName() const;
+ virtual bool isWordBreak() const;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ReplaceSelectionCommand_h
+#define ReplaceSelectionCommand_h
+
+#include "CompositeEditCommand.h"
+
+namespace WebCore {
+
+class DocumentFragment;
+class ReplacementFragment;
+
+class ReplaceSelectionCommand : public CompositeEditCommand {
+public:
+ static PassRefPtr<ReplaceSelectionCommand> create(Document* document, PassRefPtr<DocumentFragment> fragment,
+ bool selectReplacement = true, bool smartReplace = false, bool matchStyle = false, bool preventNesting = true, bool movingParagraph = false,
+ EditAction action = EditActionPaste)
+ {
+ return adoptRef(new ReplaceSelectionCommand(document, fragment, selectReplacement, smartReplace, matchStyle, preventNesting, movingParagraph, action));
+ }
+
+private:
+ ReplaceSelectionCommand(Document*, PassRefPtr<DocumentFragment>,
+ bool selectReplacement, bool smartReplace, bool matchStyle, bool preventNesting, bool movingParagraph, EditAction);
+
+ virtual void doApply();
+ virtual EditAction editingAction() const;
+
+ void completeHTMLReplacement(const Position& lastPositionToSelect);
+
+ void insertNodeAfterAndUpdateNodesInserted(PassRefPtr<Node> insertChild, Node* refChild);
+ void insertNodeAtAndUpdateNodesInserted(PassRefPtr<Node>, const Position&);
+ void insertNodeBeforeAndUpdateNodesInserted(PassRefPtr<Node> insertChild, Node* refChild);
+
+ void updateNodesInserted(Node*);
+ bool shouldRemoveEndBR(Node*, const VisiblePosition&);
+
+ bool shouldMergeStart(bool, bool);
+ bool shouldMergeEnd(bool selectEndWasEndOfParagraph);
+ bool shouldMerge(const VisiblePosition&, const VisiblePosition&);
+
+ void mergeEndIfNeeded();
+
+ void removeUnrenderedTextNodesAtEnds();
+
+ void negateStyleRulesThatAffectAppearance();
+ void handleStyleSpans();
+ void handlePasteAsQuotationNode();
+
+ virtual void removeNodePreservingChildren(Node*);
+ virtual void removeNodeAndPruneAncestors(Node*);
+
+ VisiblePosition positionAtStartOfInsertedContent();
+ VisiblePosition positionAtEndOfInsertedContent();
+
+ bool performTrivialReplace(const ReplacementFragment&);
+
+ RefPtr<Node> m_firstNodeInserted;
+ RefPtr<Node> m_lastLeafInserted;
+ RefPtr<CSSMutableStyleDeclaration> m_insertionStyle;
+ bool m_selectReplacement;
+ bool m_smartReplace;
+ bool m_matchStyle;
+ RefPtr<DocumentFragment> m_documentFragment;
+ bool m_preventNesting;
+ bool m_movingParagraph;
+ EditAction m_editAction;
+ bool m_shouldMergeEnd;
+};
+
+} // namespace WebCore
+
+#endif // ReplaceSelectionCommand_h
--- /dev/null
+/*
+ Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
+ Copyright (C) 2001 Dirk Mueller <mueller@kde.org>
+ Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef Request_h
+#define Request_h
+
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+ class CachedResource;
+ class DocLoader;
+
+ class Request {
+ public:
+ Request(DocLoader*, CachedResource*, bool incremental, bool skipCanLoadCheck, bool sendResourceLoadCallbacks);
+ ~Request();
+
+ Vector<char>& buffer() { return m_buffer; }
+ CachedResource* cachedResource() { return m_object; }
+ DocLoader* docLoader() { return m_docLoader; }
+
+ bool isIncremental() { return m_incremental; }
+ void setIsIncremental(bool b = true) { m_incremental = b; }
+
+ bool isMultipart() { return m_multipart; }
+ void setIsMultipart(bool b = true) { m_multipart = b; }
+
+ bool shouldSkipCanLoadCheck() const { return m_shouldSkipCanLoadCheck; }
+ bool sendResourceLoadCallbacks() const { return m_sendResourceLoadCallbacks; }
+
+ private:
+ Vector<char> m_buffer;
+ CachedResource* m_object;
+ DocLoader* m_docLoader;
+ bool m_incremental;
+ bool m_multipart;
+ bool m_shouldSkipCanLoadCheck;
+ bool m_sendResourceLoadCallbacks;
+ };
+
+} //namespace WebCore
+
+#endif // Request_h
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ResourceError_h
+#define ResourceError_h
+
+#include "ResourceErrorBase.h"
+
+#include <wtf/RetainPtr.h>
+#include <CoreFoundation/CFStream.h>
+
+namespace WebCore {
+
+class ResourceError : public ResourceErrorBase {
+public:
+ ResourceError()
+ : m_dataIsUpToDate(true)
+ {
+ }
+
+ ResourceError(const String& domain, int errorCode, const String& failingURL, const String& localizedDescription)
+ : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription)
+ , m_dataIsUpToDate(true)
+ {
+ }
+
+ ResourceError(CFStreamError error);
+
+ ResourceError(CFErrorRef error)
+ : m_dataIsUpToDate(false)
+ , m_platformError(error)
+ {
+ m_isNull = !error;
+ }
+
+ operator CFErrorRef() const;
+ operator CFStreamError() const;
+
+private:
+ friend class ResourceErrorBase;
+
+ void platformLazyInit();
+ static bool platformCompare(const ResourceError& a, const ResourceError& b);
+
+ bool m_dataIsUpToDate;
+ mutable RetainPtr<CFErrorRef> m_platformError;
+};
+
+} // namespace WebCore
+
+#endif // ResourceError_h_
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ResourceErrorBase_h
+#define ResourceErrorBase_h
+
+#include "PlatformString.h"
+
+namespace WebCore {
+
+class ResourceError;
+
+class ResourceErrorBase {
+public:
+ bool isNull() const { return m_isNull; }
+
+ const String& domain() const { lazyInit(); return m_domain; }
+ int errorCode() const { lazyInit(); return m_errorCode; }
+ const String& failingURL() const { lazyInit(); return m_failingURL; }
+ const String& localizedDescription() const { lazyInit(); return m_localizedDescription; }
+
+ void setIsCancellation(bool isCancellation) { m_isCancellation = isCancellation; }
+ bool isCancellation() const { return m_isCancellation; }
+
+ static bool compare(const ResourceError& a, const ResourceError& b);
+
+protected:
+ ResourceErrorBase()
+ : m_errorCode(0)
+ , m_isNull(true)
+ , m_isCancellation(false)
+ {
+ }
+
+ ResourceErrorBase(const String& domain, int errorCode, const String& failingURL, const String& localizedDescription)
+ : m_domain(domain)
+ , m_errorCode(errorCode)
+ , m_failingURL(failingURL)
+ , m_localizedDescription(localizedDescription)
+ , m_isNull(false)
+ , m_isCancellation(false)
+ {
+ }
+
+ void lazyInit() const;
+
+ // The ResourceError subclass may "shadow" this method to lazily initialize platform specific fields
+ void platformLazyInit() {}
+
+ // The ResourceError subclass may "shadow" this method to compare platform specific fields
+ static bool platformCompare(const ResourceError&, const ResourceError&) { return true; }
+
+ String m_domain;
+ int m_errorCode;
+ String m_failingURL;
+ String m_localizedDescription;
+ bool m_isNull;
+ bool m_isCancellation;
+};
+
+inline bool operator==(const ResourceError& a, const ResourceError& b) { return ResourceErrorBase::compare(a, b); }
+inline bool operator!=(const ResourceError& a, const ResourceError& b) { return !(a == b); }
+
+} // namespace WebCore
+
+#endif // ResourceErrorBase_h_
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "KURL.h"
+#include "ResourceError.h"
+
+#if USE(CFNETWORK)
+
+// FIXME: Once <rdar://problem/5050881> is fixed in open source we
+// can remove this extern "C"
+extern "C" {
+#include <CFNetwork/CFNetworkErrors.h>
+}
+
+#include <CoreFoundation/CFError.h>
+#include <WTF/RetainPtr.h>
+
+namespace WebCore {
+
+const CFStringRef failingURLStringKey = CFSTR("NSErrorFailingURLStringKey");
+const CFStringRef failingURLKey = CFSTR("NSErrorFailingURLKey");
+
+// FIXME: Once <rdar://problem/5050841> is fixed we can remove this constructor.
+ResourceError::ResourceError(CFStreamError error)
+ : m_dataIsUpToDate(true)
+{
+ m_isNull = false;
+ m_errorCode = error.error;
+
+ switch(error.domain) {
+ case kCFStreamErrorDomainCustom:
+ m_domain ="NSCustomErrorDomain";
+ break;
+ case kCFStreamErrorDomainPOSIX:
+ m_domain = "NSPOSIXErrorDomain";
+ break;
+ case kCFStreamErrorDomainMacOSStatus:
+ m_domain = "NSOSStatusErrorDomain";
+ break;
+ }
+}
+
+void ResourceError::platformLazyInit()
+{
+ if (m_dataIsUpToDate)
+ return;
+
+ if (!m_platformError)
+ return;
+
+ CFStringRef domain = CFErrorGetDomain(m_platformError.get());
+ if (domain == kCFErrorDomainMach || domain == kCFErrorDomainCocoa)
+ m_domain ="NSCustomErrorDomain";
+ else if (domain == kCFErrorDomainCFNetwork)
+ m_domain = "CFURLErrorDomain";
+ else if (domain == kCFErrorDomainPOSIX)
+ m_domain = "NSPOSIXErrorDomain";
+ else if (domain == kCFErrorDomainOSStatus)
+ m_domain = "NSOSStatusErrorDomain";
+ else if (domain == kCFErrorDomainWinSock)
+ m_domain = "kCFErrorDomainWinSock";
+
+ m_errorCode = CFErrorGetCode(m_platformError.get());
+
+ RetainPtr<CFDictionaryRef> userInfo(AdoptCF, CFErrorCopyUserInfo(m_platformError.get()));
+ if (userInfo.get()) {
+ CFStringRef failingURLString = (CFStringRef) CFDictionaryGetValue(userInfo.get(), failingURLStringKey);
+ if (failingURLString)
+ m_failingURL = String(failingURLString);
+ else {
+ CFURLRef failingURL = (CFURLRef) CFDictionaryGetValue(userInfo.get(), failingURLKey);
+ if (failingURL) {
+ RetainPtr<CFURLRef> absoluteURLRef(AdoptCF, CFURLCopyAbsoluteURL(failingURL));
+ if (absoluteURLRef.get()) {
+ failingURLString = CFURLGetString(absoluteURLRef.get());
+ m_failingURL = String(failingURLString);
+ }
+ }
+ }
+ m_localizedDescription = (CFStringRef) CFDictionaryGetValue(userInfo.get(), kCFErrorLocalizedDescriptionKey);
+ }
+
+ m_dataIsUpToDate = true;
+}
+
+bool ResourceError::platformCompare(const ResourceError& a, const ResourceError& b)
+{
+ return (CFErrorRef)a == (CFErrorRef)b;
+}
+
+ResourceError::operator CFErrorRef() const
+{
+ if (m_isNull) {
+ ASSERT(!m_platformError);
+ return nil;
+ }
+
+ if (!m_platformError) {
+ RetainPtr<CFMutableDictionaryRef> userInfo(AdoptCF, CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+
+ if (!m_localizedDescription.isEmpty()) {
+ RetainPtr<CFStringRef> localizedDescriptionString(AdoptCF, m_localizedDescription.createCFString());
+ CFDictionarySetValue(userInfo.get(), kCFErrorLocalizedDescriptionKey, localizedDescriptionString.get());
+ }
+
+ if (!m_failingURL.isEmpty()) {
+ RetainPtr<CFStringRef> failingURLString(AdoptCF, m_failingURL.createCFString());
+ CFDictionarySetValue(userInfo.get(), failingURLStringKey, failingURLString.get());
+ RetainPtr<CFURLRef> url(AdoptCF, KURL(m_failingURL).createCFURL());
+ CFDictionarySetValue(userInfo.get(), failingURLKey, url.get());
+ }
+
+ RetainPtr<CFStringRef> domainString(AdoptCF, m_domain.createCFString());
+ m_platformError.adoptCF(CFErrorCreate(0, domainString.get(), m_errorCode, userInfo.get()));
+ }
+
+ return m_platformError.get();
+}
+
+ResourceError::operator CFStreamError() const
+{
+ lazyInit();
+
+ CFStreamError result;
+ result.error = m_errorCode;
+
+ if (m_domain == "NSCustomErrorDomain")
+ result.domain = kCFStreamErrorDomainCustom;
+ else if (m_domain == "NSPOSIXErrorDomain")
+ result.domain = kCFStreamErrorDomainPOSIX;
+ else if (m_domain == "NSOSStatusErrorDomain")
+ result.domain = kCFStreamErrorDomainMacOSStatus;
+ else
+ ASSERT_NOT_REACHED();
+
+ return result;
+}
+
+} // namespace WebCore
+
+#endif // USE(CFNETWORK)
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ResourceHandle_h
+#define ResourceHandle_h
+
+#include "AuthenticationChallenge.h"
+#include "HTTPHeaderMap.h"
+#include <wtf/OwnPtr.h>
+
+#if PLATFORM(CF)
+typedef const struct __CFData * CFDataRef;
+#endif
+
+#if PLATFORM(WIN)
+typedef unsigned long DWORD;
+typedef unsigned long DWORD_PTR;
+typedef void* LPVOID;
+typedef LPVOID HINTERNET;
+typedef unsigned WPARAM;
+typedef long LPARAM;
+typedef struct HWND__* HWND;
+typedef _W64 long LONG_PTR;
+typedef LONG_PTR LRESULT;
+#endif
+
+
+#if PLATFORM(MAC)
+#include <wtf/RetainPtr.h>
+#ifdef __OBJC__
+@class NSData;
+@class NSError;
+@class NSURLConnection;
+@class WebCoreResourceHandleAsDelegate;
+#else
+class NSData;
+class NSError;
+class NSURLConnection;
+class WebCoreResourceHandleAsDelegate;
+typedef struct objc_object *id;
+#endif
+#endif
+
+#if USE(CFNETWORK)
+typedef struct _CFURLConnection* CFURLConnectionRef;
+typedef int CFHTTPCookieStorageAcceptPolicy;
+typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef;
+#endif
+
+namespace WebCore {
+
+class AuthenticationChallenge;
+class Credential;
+class FormData;
+class Frame;
+class KURL;
+class ProtectionSpace;
+class ResourceError;
+class ResourceHandleClient;
+class ResourceHandleInternal;
+class ResourceRequest;
+class ResourceResponse;
+class SchedulePair;
+class SharedBuffer;
+
+template <typename T> class Timer;
+
+class ResourceHandle : public RefCounted<ResourceHandle> {
+private:
+ ResourceHandle(const ResourceRequest&, ResourceHandleClient*, bool defersLoading, bool shouldContentSniff, bool mightDownloadFromHandle);
+
+ enum FailureType {
+ BlockedFailure,
+ InvalidURLFailure
+ };
+
+public:
+ // FIXME: should not need the Frame
+ static PassRefPtr<ResourceHandle> create(const ResourceRequest&, ResourceHandleClient*, Frame*, bool defersLoading, bool shouldContentSniff, bool mightDownloadFromHandle = false);
+
+ static void loadResourceSynchronously(const ResourceRequest&, ResourceError&, ResourceResponse&, Vector<char>& data, Frame* frame);
+ static bool willLoadFromCache(ResourceRequest&);
+#if PLATFORM(MAC)
+ static bool didSendBodyDataDelegateExists();
+#endif
+
+ ~ResourceHandle();
+
+#if PLATFORM(MAC) || USE(CFNETWORK)
+ bool shouldUseCredentialStorage();
+#endif
+#if PLATFORM(MAC) || USE(CFNETWORK) || USE(CURL)
+ void didReceiveAuthenticationChallenge(const AuthenticationChallenge&);
+ void receivedCredential(const AuthenticationChallenge&, const Credential&);
+ void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&);
+ void receivedCancellation(const AuthenticationChallenge&);
+#endif
+
+#if PLATFORM(MAC)
+ void didCancelAuthenticationChallenge(const AuthenticationChallenge&);
+
+ bool canAuthenticateAgainstProtectionSpace(const ProtectionSpace&);
+
+ NSURLConnection *connection() const;
+ WebCoreResourceHandleAsDelegate *delegate();
+ void releaseDelegate();
+ id releaseProxy();
+
+ void schedule(SchedulePair*);
+ void unschedule(SchedulePair*);
+#elif USE(CFNETWORK)
+ static CFRunLoopRef loaderRunLoop();
+ CFURLConnectionRef connection() const;
+ CFURLConnectionRef releaseConnectionForDownload();
+ static void setHostAllowsAnyHTTPSCertificate(const String&);
+ static void setClientCertificate(const String& host, CFDataRef);
+#endif
+
+#if PLATFORM(WIN) && USE(CURL)
+ static void setHostAllowsAnyHTTPSCertificate(const String&);
+#endif
+#if PLATFORM(WIN) && USE(CURL) && PLATFORM(CF)
+ static void setClientCertificate(const String& host, CFDataRef);
+#endif
+
+ PassRefPtr<SharedBuffer> bufferedData();
+ static bool supportsBufferedData();
+
+#if USE(WININET)
+ void setHasReceivedResponse(bool = true);
+ bool hasReceivedResponse() const;
+ void fileLoadTimer(Timer<ResourceHandle>*);
+ void onHandleCreated(LPARAM);
+ void onRequestRedirected(LPARAM);
+ void onRequestComplete(LPARAM);
+ friend void __stdcall transferJobStatusCallback(HINTERNET, DWORD_PTR, DWORD, LPVOID, DWORD);
+ friend LRESULT __stdcall ResourceHandleWndProc(HWND, unsigned message, WPARAM, LPARAM);
+#endif
+
+#if PLATFORM(QT) || USE(CURL) || USE(SOUP)
+ ResourceHandleInternal* getInternal() { return d.get(); }
+#endif
+
+ // Used to work around the fact that you don't get any more NSURLConnection callbacks until you return from the one you're in.
+ static bool loadsBlocked();
+
+ void clearAuthentication();
+ void cancel();
+
+ // The client may be 0, in which case no callbacks will be made.
+ ResourceHandleClient* client() const;
+ void setClient(ResourceHandleClient*);
+
+ void setDefersLoading(bool);
+
+ const ResourceRequest& request() const;
+
+ void fireFailure(Timer<ResourceHandle>*);
+
+private:
+#if USE(SOUP)
+ bool startData(String urlString);
+ bool startHttp(String urlString);
+ bool startGio(String urlString);
+#endif
+
+ void scheduleFailure(FailureType);
+
+ bool start(Frame*);
+
+ friend class ResourceHandleInternal;
+ OwnPtr<ResourceHandleInternal> d;
+};
+
+void addQLPreviewConverterForURL(NSURL *, id converter);
+void removeQLPreviewConverterForURL(NSURL *);
+const KURL safeQLURLForDocumentURLAndResourceURL(const KURL& documentURL, const String& resourceURL);
+
+}
+
+#endif // ResourceHandle_h
--- /dev/null
+/*
+ * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "ResourceHandle.h"
+#include "ResourceHandleClient.h"
+#include "ResourceHandleInternal.h"
+
+#include "AuthenticationCF.h"
+#include "AuthenticationChallenge.h"
+#include "CookieStorageWin.h"
+#include "CString.h"
+#include "DocLoader.h"
+#include "Frame.h"
+#include "FrameLoader.h"
+#include "Logging.h"
+#include "NotImplemented.h"
+#include "ResourceError.h"
+#include "ResourceResponse.h"
+
+#include <wtf/HashMap.h>
+#include <wtf/Threading.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <process.h> // for _beginthread()
+
+#include <CFNetwork/CFNetwork.h>
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
+
+namespace WebCore {
+
+static HMODULE findCFNetworkModule()
+{
+ if (HMODULE module = GetModuleHandleA("CFNetwork"))
+ return module;
+ return GetModuleHandleA("CFNetwork_debug");
+}
+
+static DWORD cfNetworkVersion()
+{
+ HMODULE cfNetworkModule = findCFNetworkModule();
+ WCHAR filename[MAX_PATH];
+ GetModuleFileName(cfNetworkModule, filename, MAX_PATH);
+ DWORD handle;
+ DWORD versionInfoSize = GetFileVersionInfoSize(filename, &handle);
+ Vector<BYTE> versionInfo(versionInfoSize);
+ GetFileVersionInfo(filename, handle, versionInfoSize, versionInfo.data());
+ VS_FIXEDFILEINFO* fixedFileInfo;
+ UINT fixedFileInfoLength;
+ VerQueryValue(versionInfo.data(), TEXT("\\"), reinterpret_cast<LPVOID*>(&fixedFileInfo), &fixedFileInfoLength);
+ return fixedFileInfo->dwProductVersionMS;
+}
+
+static CFIndex highestSupportedCFURLConnectionClientVersion()
+{
+ const DWORD firstCFNetworkVersionWithConnectionClientV2 = 0x000101a8; // 1.424
+ const DWORD firstCFNetworkVersionWithConnectionClientV3 = 0x000101ad; // 1.429
+
+#ifndef _CFURLConnectionClientV2Present
+ return 1;
+#else
+
+ DWORD version = cfNetworkVersion();
+ if (version < firstCFNetworkVersionWithConnectionClientV2)
+ return 1;
+#ifndef _CFURLConnectionClientV3Present
+ return 2;
+#else
+
+ if (version < firstCFNetworkVersionWithConnectionClientV3)
+ return 2;
+ return 3;
+#endif // _CFURLConnectionClientV3Present
+#endif // _CFURLConnectionClientV2Present
+}
+
+static CFStringRef WebCoreSynchronousLoaderRunLoopMode = CFSTR("WebCoreSynchronousLoaderRunLoopMode");
+
+class WebCoreSynchronousLoader {
+public:
+ static RetainPtr<CFDataRef> load(const ResourceRequest&, ResourceResponse&, ResourceError&);
+
+private:
+ WebCoreSynchronousLoader(ResourceResponse& response, ResourceError& error)
+ : m_isDone(false)
+ , m_response(response)
+ , m_error(error)
+ {
+ }
+
+ static CFURLRequestRef willSendRequest(CFURLConnectionRef, CFURLRequestRef, CFURLResponseRef, const void* clientInfo);
+ static void didReceiveResponse(CFURLConnectionRef, CFURLResponseRef, const void* clientInfo);
+ static void didReceiveData(CFURLConnectionRef, CFDataRef, CFIndex, const void* clientInfo);
+ static void didFinishLoading(CFURLConnectionRef, const void* clientInfo);
+ static void didFail(CFURLConnectionRef, CFErrorRef, const void* clientInfo);
+ static void didReceiveChallenge(CFURLConnectionRef, CFURLAuthChallengeRef, const void* clientInfo);
+
+ bool m_isDone;
+ RetainPtr<CFURLRef> m_url;
+ ResourceResponse& m_response;
+ RetainPtr<CFMutableDataRef> m_data;
+ ResourceError& m_error;
+};
+
+static HashSet<String>& allowsAnyHTTPSCertificateHosts()
+{
+ static HashSet<String> hosts;
+
+ return hosts;
+}
+
+static HashMap<String, RetainPtr<CFDataRef> >& clientCerts()
+{
+ static HashMap<String, RetainPtr<CFDataRef> > certs;
+ return certs;
+}
+
+CFURLRequestRef willSendRequest(CFURLConnectionRef conn, CFURLRequestRef cfRequest, CFURLResponseRef cfRedirectResponse, const void* clientInfo)
+{
+ ResourceHandle* handle = static_cast<ResourceHandle*>(const_cast<void*>(clientInfo));
+
+ if (!cfRedirectResponse) {
+ CFRetain(cfRequest);
+ return cfRequest;
+ }
+
+ LOG(Network, "CFNet - willSendRequest(conn=%p, handle=%p) (%s)", conn, handle, handle->request().url().string().utf8().data());
+
+ ResourceRequest request(cfRequest);
+ if (handle->client())
+ handle->client()->willSendRequest(handle, request, cfRedirectResponse);
+
+ cfRequest = request.cfURLRequest();
+
+ CFRetain(cfRequest);
+ return cfRequest;
+}
+
+void didReceiveResponse(CFURLConnectionRef conn, CFURLResponseRef cfResponse, const void* clientInfo)
+{
+ ResourceHandle* handle = static_cast<ResourceHandle*>(const_cast<void*>(clientInfo));
+
+ LOG(Network, "CFNet - didReceiveResponse(conn=%p, handle=%p) (%s)", conn, handle, handle->request().url().string().utf8().data());
+
+ if (handle->client())
+ handle->client()->didReceiveResponse(handle, cfResponse);
+}
+
+void didReceiveData(CFURLConnectionRef conn, CFDataRef data, CFIndex originalLength, const void* clientInfo)
+{
+ ResourceHandle* handle = static_cast<ResourceHandle*>(const_cast<void*>(clientInfo));
+ const UInt8* bytes = CFDataGetBytePtr(data);
+ CFIndex length = CFDataGetLength(data);
+
+ LOG(Network, "CFNet - didReceiveData(conn=%p, handle=%p, bytes=%d) (%s)", conn, handle, length, handle->request().url().string().utf8().data());
+
+ if (handle->client())
+ handle->client()->didReceiveData(handle, (const char*)bytes, length, originalLength);
+}
+
+#ifdef _CFURLConnectionClientV2Present
+static void didSendBodyData(CFURLConnectionRef conn, CFIndex bytesWritten, CFIndex totalBytesWritten, CFIndex totalBytesExpectedToWrite, const void *clientInfo)
+{
+ ResourceHandle* handle = static_cast<ResourceHandle*>(const_cast<void*>(clientInfo));
+ if (!handle || !handle->client())
+ return;
+ handle->client()->didSendData(handle, totalBytesWritten, totalBytesExpectedToWrite);
+}
+#endif
+
+#ifdef _CFURLConnectionClientV3Present
+static Boolean shouldUseCredentialStorageCallback(CFURLConnectionRef conn, const void* clientInfo)
+{
+ ResourceHandle* handle = const_cast<ResourceHandle*>(static_cast<const ResourceHandle*>(clientInfo));
+
+ LOG(Network, "CFNet - shouldUseCredentialStorage(conn=%p, handle=%p) (%s)", conn, handle, handle->request().url().string().utf8().data());
+
+ if (!handle)
+ return false;
+
+ return handle->shouldUseCredentialStorage();
+}
+#endif
+
+void didFinishLoading(CFURLConnectionRef conn, const void* clientInfo)
+{
+ ResourceHandle* handle = static_cast<ResourceHandle*>(const_cast<void*>(clientInfo));
+
+ LOG(Network, "CFNet - didFinishLoading(conn=%p, handle=%p) (%s)", conn, handle, handle->request().url().string().utf8().data());
+
+ if (handle->client())
+ handle->client()->didFinishLoading(handle);
+}
+
+void didFail(CFURLConnectionRef conn, CFErrorRef error, const void* clientInfo)
+{
+ ResourceHandle* handle = static_cast<ResourceHandle*>(const_cast<void*>(clientInfo));
+
+ LOG(Network, "CFNet - didFail(conn=%p, handle=%p, error = %p) (%s)", conn, handle, error, handle->request().url().string().utf8().data());
+
+ if (handle->client())
+ handle->client()->didFail(handle, ResourceError(error));
+}
+
+CFCachedURLResponseRef willCacheResponse(CFURLConnectionRef conn, CFCachedURLResponseRef cachedResponse, const void* clientInfo)
+{
+ ResourceHandle* handle = static_cast<ResourceHandle*>(const_cast<void*>(clientInfo));
+
+ CacheStoragePolicy policy = static_cast<CacheStoragePolicy>(CFCachedURLResponseGetStoragePolicy(cachedResponse));
+
+ if (handle->client())
+ handle->client()->willCacheResponse(handle, policy);
+
+ if (static_cast<CFURLCacheStoragePolicy>(policy) != CFCachedURLResponseGetStoragePolicy(cachedResponse))
+ cachedResponse = CFCachedURLResponseCreateWithUserInfo(kCFAllocatorDefault,
+ CFCachedURLResponseGetWrappedResponse(cachedResponse),
+ CFCachedURLResponseGetReceiverData(cachedResponse),
+ CFCachedURLResponseGetUserInfo(cachedResponse),
+ static_cast<CFURLCacheStoragePolicy>(policy));
+ CFRetain(cachedResponse);
+
+ return cachedResponse;
+}
+
+void didReceiveChallenge(CFURLConnectionRef conn, CFURLAuthChallengeRef challenge, const void* clientInfo)
+{
+ ResourceHandle* handle = static_cast<ResourceHandle*>(const_cast<void*>(clientInfo));
+ ASSERT(handle);
+ LOG(Network, "CFNet - didReceiveChallenge(conn=%p, handle=%p (%s)", conn, handle, handle->request().url().string().utf8().data());
+
+ handle->didReceiveAuthenticationChallenge(AuthenticationChallenge(challenge, handle));
+}
+
+void addHeadersFromHashMap(CFMutableURLRequestRef request, const HTTPHeaderMap& requestHeaders)
+{
+ if (!requestHeaders.size())
+ return;
+
+ HTTPHeaderMap::const_iterator end = requestHeaders.end();
+ for (HTTPHeaderMap::const_iterator it = requestHeaders.begin(); it != end; ++it) {
+ CFStringRef key = it->first.createCFString();
+ CFStringRef value = it->second.createCFString();
+ CFURLRequestSetHTTPHeaderFieldValue(request, key, value);
+ CFRelease(key);
+ CFRelease(value);
+ }
+}
+
+ResourceHandleInternal::~ResourceHandleInternal()
+{
+ if (m_connection) {
+ LOG(Network, "CFNet - Cancelling connection %p (%s)", m_connection, m_request.url().string().utf8().data());
+ CFURLConnectionCancel(m_connection.get());
+ }
+}
+
+ResourceHandle::~ResourceHandle()
+{
+ LOG(Network, "CFNet - Destroying job %p (%s)", this, d->m_request.url().string().utf8().data());
+}
+
+CFArrayRef arrayFromFormData(const FormData& d)
+{
+ size_t size = d.elements().size();
+ CFMutableArrayRef a = CFArrayCreateMutable(0, d.elements().size(), &kCFTypeArrayCallBacks);
+ for (size_t i = 0; i < size; ++i) {
+ const FormDataElement& e = d.elements()[i];
+ if (e.m_type == FormDataElement::data) {
+ CFDataRef data = CFDataCreate(0, (const UInt8*)e.m_data.data(), e.m_data.size());
+ CFArrayAppendValue(a, data);
+ CFRelease(data);
+ } else {
+ ASSERT(e.m_type == FormDataElement::encodedFile);
+ CFStringRef filename = e.m_filename.createCFString();
+ CFArrayAppendValue(a, filename);
+ CFRelease(filename);
+ }
+ }
+ return a;
+}
+
+void emptyPerform(void* unused)
+{
+}
+
+static CFRunLoopRef loaderRL = 0;
+void* runLoaderThread(void *unused)
+{
+ loaderRL = CFRunLoopGetCurrent();
+
+ // Must add a source to the run loop to prevent CFRunLoopRun() from exiting
+ CFRunLoopSourceContext ctxt = {0, (void *)1 /*must be non-NULL*/, 0, 0, 0, 0, 0, 0, 0, emptyPerform};
+ CFRunLoopSourceRef bogusSource = CFRunLoopSourceCreate(0, 0, &ctxt);
+ CFRunLoopAddSource(loaderRL, bogusSource,kCFRunLoopDefaultMode);
+
+ CFRunLoopRun();
+
+ return 0;
+}
+
+CFRunLoopRef ResourceHandle::loaderRunLoop()
+{
+ if (!loaderRL) {
+ createThread(runLoaderThread, 0, "CFNetwork::Loader");
+ while (loaderRL == 0) {
+ // FIXME: sleep 10? that can't be right...
+ Sleep(10);
+ }
+ }
+ return loaderRL;
+}
+
+static CFURLRequestRef makeFinalRequest(const ResourceRequest& request, bool shouldContentSniff)
+{
+ CFMutableURLRequestRef newRequest = CFURLRequestCreateMutableCopy(kCFAllocatorDefault, request.cfURLRequest());
+
+ if (!shouldContentSniff)
+ wkSetCFURLRequestShouldContentSniff(newRequest, false);
+
+ RetainPtr<CFMutableDictionaryRef> sslProps;
+
+ if (allowsAnyHTTPSCertificateHosts().contains(request.url().host().lower())) {
+ sslProps.adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+ CFDictionaryAddValue(sslProps.get(), kCFStreamSSLAllowsAnyRoot, kCFBooleanTrue);
+ CFDictionaryAddValue(sslProps.get(), kCFStreamSSLAllowsExpiredRoots, kCFBooleanTrue);
+ }
+
+ HashMap<String, RetainPtr<CFDataRef> >::iterator clientCert = clientCerts().find(request.url().host().lower());
+ if (clientCert != clientCerts().end()) {
+ if (!sslProps)
+ sslProps.adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+ wkSetClientCertificateInSSLProperties(sslProps.get(), (clientCert->second).get());
+ }
+
+ if (sslProps)
+ CFURLRequestSetSSLProperties(newRequest, sslProps.get());
+
+ if (CFHTTPCookieStorageRef cookieStorage = currentCookieStorage()) {
+ CFURLRequestSetHTTPCookieStorage(newRequest, cookieStorage);
+ CFURLRequestSetHTTPCookieStorageAcceptPolicy(newRequest, CFHTTPCookieStorageGetCookieAcceptPolicy(cookieStorage));
+ }
+
+ return newRequest;
+}
+
+bool ResourceHandle::start(Frame* frame)
+{
+ // If we are no longer attached to a Page, this must be an attempted load from an
+ // onUnload handler, so let's just block it.
+ if (!frame->page())
+ return false;
+
+ RetainPtr<CFURLRequestRef> request(AdoptCF, makeFinalRequest(d->m_request, d->m_shouldContentSniff));
+
+ static CFIndex clientVersion = highestSupportedCFURLConnectionClientVersion();
+ CFURLConnectionClient* client;
+#if defined(_CFURLConnectionClientV3Present)
+ CFURLConnectionClient_V3 client_V3 = {clientVersion, this, 0, 0, 0, willSendRequest, didReceiveResponse, didReceiveData, NULL, didFinishLoading, didFail, willCacheResponse, didReceiveChallenge, didSendBodyData, shouldUseCredentialStorageCallback, 0};
+ client = reinterpret_cast<CFURLConnectionClient*>(&client_V3);
+#elif defined(_CFURLConnectionClientV2Present)
+ CFURLConnectionClient_V2 client_V2 = {clientVersion, this, 0, 0, 0, willSendRequest, didReceiveResponse, didReceiveData, NULL, didFinishLoading, didFail, willCacheResponse, didReceiveChallenge, didSendBodyData};
+ client = reinterpret_cast<CFURLConnectionClient*>(&client_V2);
+#else
+ CFURLConnectionClient client_V1 = {1, this, 0, 0, 0, willSendRequest, didReceiveResponse, didReceiveData, NULL, didFinishLoading, didFail, willCacheResponse, didReceiveChallenge};
+ client = &client_V1;
+#endif
+
+ d->m_connection.adoptCF(CFURLConnectionCreate(0, request.get(), client));
+
+ CFURLConnectionScheduleWithCurrentMessageQueue(d->m_connection.get());
+ CFURLConnectionScheduleDownloadWithRunLoop(d->m_connection.get(), loaderRunLoop(), kCFRunLoopDefaultMode);
+ CFURLConnectionStart(d->m_connection.get());
+
+ LOG(Network, "CFNet - Starting URL %s (handle=%p, conn=%p)", d->m_request.url().string().utf8().data(), this, d->m_connection);
+
+ return true;
+}
+
+void ResourceHandle::cancel()
+{
+ if (d->m_connection) {
+ CFURLConnectionCancel(d->m_connection.get());
+ d->m_connection = 0;
+ }
+}
+
+PassRefPtr<SharedBuffer> ResourceHandle::bufferedData()
+{
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
+bool ResourceHandle::supportsBufferedData()
+{
+ return false;
+}
+
+bool ResourceHandle::shouldUseCredentialStorage()
+{
+ LOG(Network, "CFNet - shouldUseCredentialStorage()");
+ if (client())
+ return client()->shouldUseCredentialStorage(this);
+
+ return false;
+}
+
+void ResourceHandle::didReceiveAuthenticationChallenge(const AuthenticationChallenge& challenge)
+{
+ LOG(Network, "CFNet - didReceiveAuthenticationChallenge()");
+ ASSERT(!d->m_currentCFChallenge);
+ ASSERT(d->m_currentWebChallenge.isNull());
+ // Since CFURLConnection networking relies on keeping a reference to the original CFURLAuthChallengeRef,
+ // we make sure that is actually present
+ ASSERT(challenge.cfURLAuthChallengeRef());
+
+ d->m_currentCFChallenge = challenge.cfURLAuthChallengeRef();
+ d->m_currentWebChallenge = AuthenticationChallenge(d->m_currentCFChallenge, this);
+
+ if (client())
+ client()->didReceiveAuthenticationChallenge(this, d->m_currentWebChallenge);
+}
+
+void ResourceHandle::receivedCredential(const AuthenticationChallenge& challenge, const Credential& credential)
+{
+ LOG(Network, "CFNet - receivedCredential()");
+ ASSERT(!challenge.isNull());
+ ASSERT(challenge.cfURLAuthChallengeRef());
+ if (challenge != d->m_currentWebChallenge)
+ return;
+
+ CFURLCredentialRef cfCredential = createCF(credential);
+ CFURLConnectionUseCredential(d->m_connection.get(), cfCredential, challenge.cfURLAuthChallengeRef());
+ CFRelease(cfCredential);
+
+ clearAuthentication();
+}
+
+void ResourceHandle::receivedRequestToContinueWithoutCredential(const AuthenticationChallenge& challenge)
+{
+ LOG(Network, "CFNet - receivedRequestToContinueWithoutCredential()");
+ ASSERT(!challenge.isNull());
+ ASSERT(challenge.cfURLAuthChallengeRef());
+ if (challenge != d->m_currentWebChallenge)
+ return;
+
+ CFURLConnectionUseCredential(d->m_connection.get(), 0, challenge.cfURLAuthChallengeRef());
+
+ clearAuthentication();
+}
+
+void ResourceHandle::receivedCancellation(const AuthenticationChallenge& challenge)
+{
+ LOG(Network, "CFNet - receivedCancellation()");
+ if (challenge != d->m_currentWebChallenge)
+ return;
+
+ if (client())
+ client()->receivedCancellation(this, challenge);
+}
+
+CFURLConnectionRef ResourceHandle::connection() const
+{
+ return d->m_connection.get();
+}
+
+CFURLConnectionRef ResourceHandle::releaseConnectionForDownload()
+{
+ LOG(Network, "CFNet - Job %p releasing connection %p for download", this, d->m_connection.get());
+ return d->m_connection.releaseRef();
+}
+
+void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, ResourceError& error, ResourceResponse& response, Vector<char>& vector, Frame*)
+{
+ ASSERT(!request.isEmpty());
+
+ RetainPtr<CFDataRef> data = WebCoreSynchronousLoader::load(request, response, error);
+
+ if (!error.isNull()) {
+ // FIXME: Return the actual response for failed authentication.
+ response = ResourceResponse(request.url(), String(), 0, String(), String());
+ response.setHTTPStatusCode(404);
+ }
+
+ if (data) {
+ ASSERT(vector.isEmpty());
+ vector.append(CFDataGetBytePtr(data.get()), CFDataGetLength(data.get()));
+ }
+}
+
+void ResourceHandle::setHostAllowsAnyHTTPSCertificate(const String& host)
+{
+ allowsAnyHTTPSCertificateHosts().add(host.lower());
+}
+
+void ResourceHandle::setClientCertificate(const String& host, CFDataRef cert)
+{
+ clientCerts().set(host.lower(), cert);
+}
+
+void ResourceHandle::setDefersLoading(bool defers)
+{
+ if (!d->m_connection)
+ return;
+
+ if (defers)
+ CFURLConnectionHalt(d->m_connection.get());
+ else
+ CFURLConnectionResume(d->m_connection.get());
+}
+
+bool ResourceHandle::loadsBlocked()
+{
+ return false;
+}
+
+bool ResourceHandle::willLoadFromCache(ResourceRequest&)
+{
+ // Not having this function means that we'll ask the user about re-posting a form
+ // even when we go back to a page that's still in the cache.
+ notImplemented();
+ return false;
+}
+
+CFURLRequestRef WebCoreSynchronousLoader::willSendRequest(CFURLConnectionRef, CFURLRequestRef cfRequest, CFURLResponseRef cfRedirectResponse, const void* clientInfo)
+{
+ WebCoreSynchronousLoader* loader = static_cast<WebCoreSynchronousLoader*>(const_cast<void*>(clientInfo));
+
+ // FIXME: This needs to be fixed to follow the redirect correctly even for cross-domain requests.
+ if (loader->m_url && !protocolHostAndPortAreEqual(loader->m_url.get(), CFURLRequestGetURL(cfRequest))) {
+ RetainPtr<CFErrorRef> cfError(AdoptCF, CFErrorCreate(kCFAllocatorDefault, kCFErrorDomainCFNetwork, kCFURLErrorBadServerResponse, 0));
+ loader->m_error = cfError.get();
+ loader->m_isDone = true;
+ return 0;
+ }
+
+ loader->m_url = CFURLRequestGetURL(cfRequest);
+
+ CFRetain(cfRequest);
+ return cfRequest;
+}
+
+void WebCoreSynchronousLoader::didReceiveResponse(CFURLConnectionRef, CFURLResponseRef cfResponse, const void* clientInfo)
+{
+ WebCoreSynchronousLoader* loader = static_cast<WebCoreSynchronousLoader*>(const_cast<void*>(clientInfo));
+
+ loader->m_response = cfResponse;
+}
+
+void WebCoreSynchronousLoader::didReceiveData(CFURLConnectionRef, CFDataRef data, CFIndex originalLength, const void* clientInfo)
+{
+ WebCoreSynchronousLoader* loader = static_cast<WebCoreSynchronousLoader*>(const_cast<void*>(clientInfo));
+
+ if (!loader->m_data)
+ loader->m_data.adoptCF(CFDataCreateMutable(kCFAllocatorDefault, originalLength));
+
+ const UInt8* bytes = CFDataGetBytePtr(data);
+ CFIndex length = CFDataGetLength(data);
+
+ CFDataAppendBytes(loader->m_data.get(), bytes, length);
+}
+
+void WebCoreSynchronousLoader::didFinishLoading(CFURLConnectionRef, const void* clientInfo)
+{
+ WebCoreSynchronousLoader* loader = static_cast<WebCoreSynchronousLoader*>(const_cast<void*>(clientInfo));
+
+ loader->m_isDone = true;
+}
+
+void WebCoreSynchronousLoader::didFail(CFURLConnectionRef, CFErrorRef error, const void* clientInfo)
+{
+ WebCoreSynchronousLoader* loader = static_cast<WebCoreSynchronousLoader*>(const_cast<void*>(clientInfo));
+
+ loader->m_error = error;
+ loader->m_isDone = true;
+}
+
+void WebCoreSynchronousLoader::didReceiveChallenge(CFURLConnectionRef conn, CFURLAuthChallengeRef challenge, const void* clientInfo)
+{
+ WebCoreSynchronousLoader* loader = static_cast<WebCoreSynchronousLoader*>(const_cast<void*>(clientInfo));
+
+ // FIXME: Mac uses credentials from URL here, should we do the same?
+ CFURLConnectionUseCredential(conn, 0, challenge);
+}
+
+RetainPtr<CFDataRef> WebCoreSynchronousLoader::load(const ResourceRequest& request, ResourceResponse& response, ResourceError& error)
+{
+ ASSERT(response.isNull());
+ ASSERT(error.isNull());
+
+ WebCoreSynchronousLoader loader(response, error);
+
+ RetainPtr<CFURLRequestRef> cfRequest(AdoptCF, makeFinalRequest(request, true));
+
+ CFURLConnectionClient_V3 client = { 3, &loader, 0, 0, 0, willSendRequest, didReceiveResponse, didReceiveData, 0, didFinishLoading, didFail, 0, didReceiveChallenge, 0, 0, 0 };
+
+ RetainPtr<CFURLConnectionRef> connection(AdoptCF, CFURLConnectionCreate(kCFAllocatorDefault, cfRequest.get(), reinterpret_cast<CFURLConnectionClient*>(&client)));
+
+ CFURLConnectionScheduleWithRunLoop(connection.get(), CFRunLoopGetCurrent(), WebCoreSynchronousLoaderRunLoopMode);
+ CFURLConnectionScheduleDownloadWithRunLoop(connection.get(), CFRunLoopGetCurrent(), WebCoreSynchronousLoaderRunLoopMode);
+ CFURLConnectionStart(connection.get());
+
+ while (!loader.m_isDone)
+ CFRunLoopRunInMode(WebCoreSynchronousLoaderRunLoopMode, UINT_MAX, true);
+
+ CFURLConnectionCancel(connection.get());
+
+ return loader.m_data;
+}
+
+} // namespace WebCore
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ResourceHandleClient_h
+#define ResourceHandleClient_h
+
+#include <wtf/RefCounted.h>
+#include <wtf/Platform.h>
+#include <wtf/RefPtr.h>
+
+#if USE(CFNETWORK)
+#include <ConditionalMacros.h>
+#include <CFNetwork/CFURLResponsePriv.h>
+#endif
+
+#if PLATFORM(MAC)
+#ifdef __OBJC__
+@class NSCachedURLResponse;
+#else
+class NSCachedURLResponse;
+#endif
+#endif
+
+namespace WebCore {
+ class AuthenticationChallenge;
+ class Credential;
+ class KURL;
+ class ProtectionSpace;
+ class ResourceHandle;
+ class ResourceError;
+ class ResourceRequest;
+ class ResourceResponse;
+
+ enum CacheStoragePolicy {
+ StorageAllowed,
+ StorageAllowedInMemoryOnly,
+ StorageNotAllowed,
+ };
+
+ class ResourceHandleClient {
+ public:
+ virtual ~ResourceHandleClient() { }
+
+ // request may be modified
+ virtual void willSendRequest(ResourceHandle*, ResourceRequest&, const ResourceResponse& /*redirectResponse*/) { }
+ virtual void didSendData(ResourceHandle*, unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/) { }
+
+ virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&) { }
+ virtual void didReceiveData(ResourceHandle*, const char*, int, int /*lengthReceived*/) { }
+ virtual void didFinishLoading(ResourceHandle*) { }
+ virtual void didFail(ResourceHandle*, const ResourceError&) { }
+ virtual void wasBlocked(ResourceHandle*) { }
+ virtual void cannotShowURL(ResourceHandle*) { }
+
+ virtual void willCacheResponse(ResourceHandle*, CacheStoragePolicy&) { }
+
+ virtual bool shouldUseCredentialStorage(ResourceHandle*) { return false; }
+ virtual void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) { }
+ virtual void didCancelAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) { }
+
+ virtual bool canAuthenticateAgainstProtectionSpace(ResourceHandle*, const ProtectionSpace&) { return false; }
+
+ virtual void receivedCredential(ResourceHandle*, const AuthenticationChallenge&, const Credential&) { }
+ virtual void receivedRequestToContinueWithoutCredential(ResourceHandle*, const AuthenticationChallenge&) { }
+ virtual void receivedCancellation(ResourceHandle*, const AuthenticationChallenge&) { }
+
+#if PLATFORM(MAC)
+ virtual NSCachedURLResponse* willCacheResponse(ResourceHandle*, NSCachedURLResponse* response) { return response; }
+ virtual void willStopBufferingData(ResourceHandle*, const char*, int) { }
+#endif
+ };
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ResourceHandleInternal_h
+#define ResourceHandleInternal_h
+
+#include "ResourceHandle.h"
+#include "ResourceRequest.h"
+#include "AuthenticationChallenge.h"
+#include "Timer.h"
+
+#if USE(CFNETWORK)
+#include <CFNetwork/CFURLConnectionPriv.h>
+#endif
+
+#if USE(WININET)
+#include <winsock2.h>
+#include <windows.h>
+#endif
+
+#if USE(CURL)
+#include <curl/curl.h>
+#include "FormDataStreamCurl.h"
+#endif
+
+#if USE(SOUP)
+#include <libsoup/soup.h>
+#endif
+
+#if PLATFORM(QT)
+class QWebFrame;
+class QWebNetworkJob;
+namespace WebCore {
+class QNetworkReplyHandler;
+}
+#endif
+
+#if PLATFORM(MAC)
+#ifdef __OBJC__
+@class NSURLAuthenticationChallenge;
+@class NSURLConnection;
+#else
+class NSURLAuthenticationChallenge;
+class NSURLConnection;
+#endif
+#endif
+
+#ifndef __OBJC__
+class NSObject;
+#endif
+
+
+// The allocations and releases in ResourceHandleInternal are
+// Cocoa-exception-free (either simple Foundation classes or
+// WebCoreResourceLoaderImp which avoids doing work in dealloc).
+
+namespace WebCore {
+ class ResourceHandleClient;
+
+ class ResourceHandleInternal : Noncopyable {
+ public:
+ ResourceHandleInternal(ResourceHandle* loader, const ResourceRequest& request, ResourceHandleClient* c, bool defersLoading, bool shouldContentSniff, bool mightDownloadFromHandle)
+ : m_client(c)
+ , m_request(request)
+ , status(0)
+ , m_defersLoading(defersLoading)
+ , m_shouldContentSniff(shouldContentSniff)
+ , m_mightDownloadFromHandle(mightDownloadFromHandle)
+#if USE(CFNETWORK)
+ , m_connection(0)
+#endif
+#if USE(WININET)
+ , m_fileHandle(INVALID_HANDLE_VALUE)
+ , m_fileLoadTimer(loader, &ResourceHandle::fileLoadTimer)
+ , m_resourceHandle(0)
+ , m_secondaryHandle(0)
+ , m_jobId(0)
+ , m_threadId(0)
+ , m_writing(false)
+ , m_formDataString(0)
+ , m_formDataLength(0)
+ , m_bytesRemainingToWrite(0)
+ , m_hasReceivedResponse(false)
+ , m_resend(false)
+#endif
+#if USE(CURL)
+ , m_handle(0)
+ , m_url(0)
+ , m_customHeaders(0)
+ , m_cancelled(false)
+ , m_formDataStream(loader)
+#endif
+#if USE(SOUP)
+ , m_msg(0)
+ , m_cancelled(false)
+ , m_gfile(0)
+ , m_input_stream(0)
+ , m_cancellable(0)
+ , m_buffer(0)
+ , m_bufsize(0)
+ , m_total(0)
+ , m_idleHandler(0)
+#endif
+#if PLATFORM(QT)
+ , m_job(0)
+ , m_frame(0)
+#endif
+#if PLATFORM(MAC)
+ , m_startWhenScheduled(false)
+ , m_currentMacChallenge(nil)
+#elif USE(CFNETWORK)
+ , m_currentCFChallenge(0)
+#endif
+ , m_failureTimer(loader, &ResourceHandle::fireFailure)
+ {
+ }
+
+ ~ResourceHandleInternal();
+
+ ResourceHandleClient* client() { return m_client; }
+ ResourceHandleClient* m_client;
+
+ ResourceRequest m_request;
+
+ int status;
+
+ bool m_defersLoading;
+ bool m_shouldContentSniff;
+ bool m_mightDownloadFromHandle;
+#if USE(CFNETWORK)
+ RetainPtr<CFURLConnectionRef> m_connection;
+#elif PLATFORM(MAC)
+ RetainPtr<NSURLConnection> m_connection;
+ RetainPtr<WebCoreResourceHandleAsDelegate> m_delegate;
+ RetainPtr<id> m_proxy;
+ bool m_startWhenScheduled;
+#endif
+#if USE(WININET)
+ HANDLE m_fileHandle;
+ Timer<ResourceHandle> m_fileLoadTimer;
+ HINTERNET m_resourceHandle;
+ HINTERNET m_secondaryHandle;
+ unsigned m_jobId;
+ DWORD m_threadId;
+ bool m_writing;
+ char* m_formDataString;
+ int m_formDataLength;
+ int m_bytesRemainingToWrite;
+ String m_postReferrer;
+ bool m_hasReceivedResponse;
+ bool m_resend;
+#endif
+#if USE(CURL)
+ CURL* m_handle;
+ char* m_url;
+ struct curl_slist* m_customHeaders;
+ ResourceResponse m_response;
+ bool m_cancelled;
+
+ FormDataStream m_formDataStream;
+ Vector<char> m_postBytes;
+#endif
+#if USE(SOUP)
+ SoupMessage* m_msg;
+ ResourceResponse m_response;
+ bool m_cancelled;
+ GFile* m_gfile;
+ GInputStream* m_input_stream;
+ GCancellable* m_cancellable;
+ char* m_buffer;
+ gsize m_bufsize, m_total;
+ guint m_idleHandler;
+#endif
+#if PLATFORM(QT)
+#if QT_VERSION < 0x040400
+ QWebNetworkJob* m_job;
+#else
+ QNetworkReplyHandler* m_job;
+#endif
+ QWebFrame* m_frame;
+#endif
+#if PLATFORM(MAC)
+ NSURLAuthenticationChallenge *m_currentMacChallenge;
+#endif
+#if USE(CFNETWORK)
+ CFURLAuthChallengeRef m_currentCFChallenge;
+#endif
+ AuthenticationChallenge m_currentWebChallenge;
+
+ ResourceHandle::FailureType m_failureType;
+ Timer<ResourceHandle> m_failureTimer;
+ };
+
+} // namespace WebCore
+
+#endif // ResourceHandleInternal_h
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ResourceLoader_h
+#define ResourceLoader_h
+
+#include "ResourceHandleClient.h"
+#include "ResourceRequest.h"
+#include "ResourceResponse.h"
+#include <wtf/RefCounted.h>
+#include "AuthenticationChallenge.h"
+#include "KURL.h"
+
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+ class ApplicationCache;
+ class DocumentLoader;
+ class Frame;
+ class FrameLoader;
+ class ProtectionSpace;
+ class ResourceHandle;
+ class SharedBuffer;
+
+ class ResourceLoader : public RefCounted<ResourceLoader>, protected ResourceHandleClient {
+ public:
+ virtual ~ResourceLoader();
+
+ void cancel();
+
+ virtual bool load(const ResourceRequest&);
+
+ FrameLoader* frameLoader() const;
+ DocumentLoader* documentLoader() const { return m_documentLoader.get(); }
+
+ virtual void cancel(const ResourceError&);
+ ResourceError cancelledError();
+ ResourceError blockedError();
+ ResourceError cannotShowURLError();
+
+ virtual void setDefersLoading(bool);
+
+ void setIdentifier(unsigned long identifier) { m_identifier = identifier; }
+ unsigned long identifier() const { return m_identifier; }
+
+ virtual void releaseResources();
+ const ResourceResponse& response() const;
+
+ virtual void addData(const char*, int, bool allAtOnce);
+ virtual PassRefPtr<SharedBuffer> resourceData();
+ void clearResourceData();
+
+ virtual void willSendRequest(ResourceRequest&, const ResourceResponse& redirectResponse);
+ virtual void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent);
+ virtual void didReceiveResponse(const ResourceResponse&);
+ virtual void didReceiveData(const char*, int, long long lengthReceived, bool allAtOnce);
+ void willStopBufferingData(const char*, int);
+ virtual void didFinishLoading();
+ virtual void didFail(const ResourceError&);
+
+ virtual bool shouldUseCredentialStorage();
+ virtual void didReceiveAuthenticationChallenge(const AuthenticationChallenge&);
+ void didCancelAuthenticationChallenge(const AuthenticationChallenge&);
+
+ virtual bool canAuthenticateAgainstProtectionSpace(const ProtectionSpace&);
+
+ virtual void receivedCancellation(const AuthenticationChallenge&);
+
+ // ResourceHandleClient
+ virtual void willSendRequest(ResourceHandle*, ResourceRequest&, const ResourceResponse& redirectResponse);
+ virtual void didSendData(ResourceHandle*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent);
+ virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&);
+ virtual void didReceiveData(ResourceHandle*, const char*, int, int lengthReceived);
+ virtual void didFinishLoading(ResourceHandle*);
+ virtual void didFail(ResourceHandle*, const ResourceError&);
+ virtual void wasBlocked(ResourceHandle*);
+ virtual void cannotShowURL(ResourceHandle*);
+ virtual void willStopBufferingData(ResourceHandle*, const char* data, int length) { willStopBufferingData(data, length); }
+ virtual bool shouldUseCredentialStorage(ResourceHandle*) { return shouldUseCredentialStorage(); }
+ virtual void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge& challenge) { didReceiveAuthenticationChallenge(challenge); }
+ virtual void didCancelAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge& challenge) { didCancelAuthenticationChallenge(challenge); }
+ virtual bool canAuthenticateAgainstProtectionSpace(ResourceHandle*, const ProtectionSpace& protectionSpace) { return canAuthenticateAgainstProtectionSpace(protectionSpace); }
+ virtual void receivedCancellation(ResourceHandle*, const AuthenticationChallenge& challenge) { receivedCancellation(challenge); }
+ virtual void willCacheResponse(ResourceHandle*, CacheStoragePolicy&);
+#if PLATFORM(MAC)
+ virtual NSCachedURLResponse* willCacheResponse(ResourceHandle*, NSCachedURLResponse*);
+#endif
+
+ ResourceHandle* handle() const { return m_handle.get(); }
+ bool sendResourceLoadCallbacks() const { return m_sendResourceLoadCallbacks; }
+
+ void setShouldBufferData(bool shouldBufferData);
+
+ protected:
+ ResourceLoader(Frame*, bool sendResourceLoadCallbacks, bool shouldContentSniff);
+
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+ bool scheduleLoadFallbackResourceFromApplicationCache(ApplicationCache* = 0);
+#endif
+
+ virtual void didCancel(const ResourceError&);
+ void didFinishLoadingOnePart();
+
+ const ResourceRequest& request() const { return m_request; }
+ bool reachedTerminalState() const { return m_reachedTerminalState; }
+ bool cancelled() const { return m_cancelled; }
+ bool defersLoading() const { return m_defersLoading; }
+
+ RefPtr<ResourceHandle> m_handle;
+ RefPtr<Frame> m_frame;
+ RefPtr<DocumentLoader> m_documentLoader;
+ ResourceResponse m_response;
+
+ private:
+ ResourceRequest m_request;
+ RefPtr<SharedBuffer> m_resourceData;
+
+ unsigned long m_identifier;
+
+ bool m_reachedTerminalState;
+ bool m_cancelled;
+ bool m_calledDidFinishLoad;
+
+ bool m_sendResourceLoadCallbacks;
+ bool m_shouldContentSniff;
+ bool m_shouldBufferData;
+ bool m_defersLoading;
+ ResourceRequest m_deferredRequest;
+ };
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ResourceRequest_h
+#define ResourceRequest_h
+
+#include "ResourceRequestBase.h"
+
+#include <wtf/RetainPtr.h>
+typedef const struct _CFURLRequest* CFURLRequestRef;
+
+namespace WebCore {
+
+ struct ResourceRequest : ResourceRequestBase {
+
+ ResourceRequest(const String& url)
+ : ResourceRequestBase(KURL(url), UseProtocolCachePolicy)
+ {
+ }
+
+ ResourceRequest(const KURL& url)
+ : ResourceRequestBase(url, UseProtocolCachePolicy)
+ {
+ }
+
+ ResourceRequest(const KURL& url, const String& referrer, ResourceRequestCachePolicy policy = UseProtocolCachePolicy)
+ : ResourceRequestBase(url, policy)
+ {
+ setHTTPReferrer(referrer);
+ }
+
+ ResourceRequest()
+ : ResourceRequestBase(KURL(), UseProtocolCachePolicy)
+ {
+ }
+
+ ResourceRequest(CFURLRequestRef cfRequest)
+ : ResourceRequestBase()
+ , m_cfRequest(cfRequest) { }
+
+ CFURLRequestRef cfURLRequest() const;
+
+ private:
+ friend struct ResourceRequestBase;
+
+ void doUpdatePlatformRequest();
+ void doUpdateResourceRequest();
+
+ RetainPtr<CFURLRequestRef> m_cfRequest;
+ };
+
+} // namespace WebCore
+
+#endif // ResourceRequest_h
--- /dev/null
+/*
+ * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ResourceRequestBase_h
+#define ResourceRequestBase_h
+
+#include "FormData.h"
+#include "KURL.h"
+#include "HTTPHeaderMap.h"
+
+#include <memory>
+#include <wtf/OwnPtr.h>
+
+namespace WebCore {
+
+ enum ResourceRequestCachePolicy {
+ UseProtocolCachePolicy, // normal load
+ ReloadIgnoringCacheData, // reload
+ ReturnCacheDataElseLoad, // back/forward or encoding change - allow stale data
+ ReturnCacheDataDontLoad, // results of a post - allow stale data and only use cache
+ };
+
+ const int unspecifiedTimeoutInterval = INT_MAX;
+
+ class ResourceRequest;
+ struct CrossThreadResourceRequestData;
+
+ // Do not use this type directly. Use ResourceRequest instead.
+ class ResourceRequestBase {
+ public:
+ static std::auto_ptr<ResourceRequest> adopt(std::auto_ptr<CrossThreadResourceRequestData>);
+
+ // Gets a copy of the data suitable for passing to another thread.
+ std::auto_ptr<CrossThreadResourceRequestData> copyData() const;
+
+ bool isNull() const;
+ bool isEmpty() const;
+
+ const KURL& url() const;
+ void setURL(const KURL& url);
+
+ ResourceRequestCachePolicy cachePolicy() const;
+ void setCachePolicy(ResourceRequestCachePolicy cachePolicy);
+
+ double timeoutInterval() const;
+ void setTimeoutInterval(double timeoutInterval);
+
+ const KURL& mainDocumentURL() const;
+ void setMainDocumentURL(const KURL& mainDocumentURL);
+
+ const String& httpMethod() const;
+ void setHTTPMethod(const String& httpMethod);
+
+ const HTTPHeaderMap& httpHeaderFields() const;
+ String httpHeaderField(const AtomicString& name) const;
+ void setHTTPHeaderField(const AtomicString& name, const String& value);
+ void addHTTPHeaderField(const AtomicString& name, const String& value);
+ void addHTTPHeaderFields(const HTTPHeaderMap& headerFields);
+
+ String httpContentType() const { return httpHeaderField("Content-Type"); }
+ void setHTTPContentType(const String& httpContentType) { setHTTPHeaderField("Content-Type", httpContentType); }
+
+ String httpReferrer() const { return httpHeaderField("Referer"); }
+ void setHTTPReferrer(const String& httpReferrer) { setHTTPHeaderField("Referer", httpReferrer); }
+ void clearHTTPReferrer() { m_httpHeaderFields.remove("Referer"); }
+
+ String httpOrigin() const { return httpHeaderField("Origin"); }
+ void setHTTPOrigin(const String& httpOrigin) { setHTTPHeaderField("Origin", httpOrigin); }
+ void clearHTTPOrigin() { m_httpHeaderFields.remove("Origin"); }
+
+ String httpUserAgent() const { return httpHeaderField("User-Agent"); }
+ void setHTTPUserAgent(const String& httpUserAgent) { setHTTPHeaderField("User-Agent", httpUserAgent); }
+
+ String httpAccept() const { return httpHeaderField("Accept"); }
+ void setHTTPAccept(const String& httpAccept) { setHTTPHeaderField("Accept", httpAccept); }
+
+ void setResponseContentDispositionEncodingFallbackArray(const String& encoding1, const String& encoding2 = String(), const String& encoding3 = String());
+
+ FormData* httpBody() const;
+ void setHTTPBody(PassRefPtr<FormData> httpBody);
+
+ bool allowHTTPCookies() const;
+ void setAllowHTTPCookies(bool allowHTTPCookies);
+
+ bool isConditional() const;
+
+ protected:
+ // Used when ResourceRequest is initialized from a platform representation of the request
+ ResourceRequestBase()
+ : m_resourceRequestUpdated(false)
+ , m_platformRequestUpdated(true)
+ {
+ }
+
+ ResourceRequestBase(const KURL& url, ResourceRequestCachePolicy policy)
+ : m_url(url)
+ , m_cachePolicy(policy)
+ , m_timeoutInterval(unspecifiedTimeoutInterval)
+ , m_httpMethod("GET")
+ , m_allowHTTPCookies(true)
+ , m_resourceRequestUpdated(true)
+ , m_platformRequestUpdated(false)
+ {
+ }
+
+ void updatePlatformRequest() const;
+ void updateResourceRequest() const;
+
+ KURL m_url;
+
+ ResourceRequestCachePolicy m_cachePolicy;
+ double m_timeoutInterval;
+ KURL m_mainDocumentURL;
+ String m_httpMethod;
+ HTTPHeaderMap m_httpHeaderFields;
+ Vector<String> m_responseContentDispositionEncodingFallbackArray;
+ RefPtr<FormData> m_httpBody;
+ bool m_allowHTTPCookies;
+ mutable bool m_resourceRequestUpdated;
+ mutable bool m_platformRequestUpdated;
+
+ private:
+ const ResourceRequest& asResourceRequest() const;
+ };
+
+ bool equalIgnoringHeaderFields(const ResourceRequestBase&, const ResourceRequestBase&);
+
+ bool operator==(const ResourceRequestBase&, const ResourceRequestBase&);
+ inline bool operator!=(ResourceRequestBase& a, const ResourceRequestBase& b) { return !(a == b); }
+
+ struct CrossThreadResourceRequestData {
+ KURL m_url;
+
+ ResourceRequestCachePolicy m_cachePolicy;
+ double m_timeoutInterval;
+ KURL m_mainDocumentURL;
+
+ String m_httpMethod;
+ OwnPtr<CrossThreadHTTPHeaderMapData> m_httpHeaders;
+ Vector<String> m_responseContentDispositionEncodingFallbackArray;
+ RefPtr<FormData> m_httpBody;
+ bool m_allowHTTPCookies;
+ };
+
+ unsigned initializeMaximumHTTPConnectionCountPerHost();
+
+} // namespace WebCore
+
+#endif // ResourceRequestBase_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ResourceRequestCFNet.h"
+
+#include "FormDataStreamCFNet.h"
+#include "ResourceRequest.h"
+
+#include <CFNetwork/CFURLRequestPriv.h>
+
+namespace WebCore {
+
+typedef void (*CFURLRequestSetContentDispositionEncodingFallbackArrayFunction)(CFMutableURLRequestRef, CFArrayRef);
+typedef CFArrayRef (*CFURLRequestCopyContentDispositionEncodingFallbackArrayFunction)(CFURLRequestRef);
+
+static HMODULE findCFNetworkModule()
+{
+ if (HMODULE module = GetModuleHandleA("CFNetwork"))
+ return module;
+ return GetModuleHandleA("CFNetwork_debug");
+}
+
+static CFURLRequestSetContentDispositionEncodingFallbackArrayFunction findCFURLRequestSetContentDispositionEncodingFallbackArrayFunction()
+{
+ return reinterpret_cast<CFURLRequestSetContentDispositionEncodingFallbackArrayFunction>(GetProcAddress(findCFNetworkModule(), "_CFURLRequestSetContentDispositionEncodingFallbackArray"));
+}
+
+static CFURLRequestCopyContentDispositionEncodingFallbackArrayFunction findCFURLRequestCopyContentDispositionEncodingFallbackArrayFunction()
+{
+ return reinterpret_cast<CFURLRequestCopyContentDispositionEncodingFallbackArrayFunction>(GetProcAddress(findCFNetworkModule(), "_CFURLRequestCopyContentDispositionEncodingFallbackArray"));
+}
+
+static void setContentDispositionEncodingFallbackArray(CFMutableURLRequestRef request, CFArrayRef fallbackArray)
+{
+ static CFURLRequestSetContentDispositionEncodingFallbackArrayFunction function = findCFURLRequestSetContentDispositionEncodingFallbackArrayFunction();
+ if (function)
+ function(request, fallbackArray);
+}
+
+static CFArrayRef copyContentDispositionEncodingFallbackArray(CFURLRequestRef request)
+{
+ static CFURLRequestCopyContentDispositionEncodingFallbackArrayFunction function = findCFURLRequestCopyContentDispositionEncodingFallbackArrayFunction();
+ if (!function)
+ return 0;
+ return function(request);
+}
+
+CFURLRequestRef ResourceRequest::cfURLRequest() const
+{
+ updatePlatformRequest();
+
+ return m_cfRequest.get();
+}
+
+static inline void addHeadersFromHashMap(CFMutableURLRequestRef request, const HTTPHeaderMap& requestHeaders)
+{
+ if (!requestHeaders.size())
+ return;
+
+ HTTPHeaderMap::const_iterator end = requestHeaders.end();
+ for (HTTPHeaderMap::const_iterator it = requestHeaders.begin(); it != end; ++it) {
+ CFStringRef key = it->first.createCFString();
+ CFStringRef value = it->second.createCFString();
+ CFURLRequestSetHTTPHeaderFieldValue(request, key, value);
+ CFRelease(key);
+ CFRelease(value);
+ }
+}
+
+void ResourceRequest::doUpdatePlatformRequest()
+{
+ CFMutableURLRequestRef cfRequest;
+
+ RetainPtr<CFURLRef> url(AdoptCF, ResourceRequest::url().createCFURL());
+ RetainPtr<CFURLRef> mainDocumentURL(AdoptCF, ResourceRequest::mainDocumentURL().createCFURL());
+ if (m_cfRequest) {
+ cfRequest = CFURLRequestCreateMutableCopy(0, m_cfRequest.get());
+ CFURLRequestSetURL(cfRequest, url.get());
+ CFURLRequestSetMainDocumentURL(cfRequest, mainDocumentURL.get());
+ } else {
+ cfRequest = CFURLRequestCreateMutable(0, url.get(), (CFURLRequestCachePolicy)cachePolicy(), timeoutInterval(), mainDocumentURL.get());
+ }
+
+ RetainPtr<CFStringRef> requestMethod(AdoptCF, httpMethod().createCFString());
+ CFURLRequestSetHTTPRequestMethod(cfRequest, requestMethod.get());
+
+ addHeadersFromHashMap(cfRequest, httpHeaderFields());
+ WebCore::setHTTPBody(cfRequest, httpBody());
+ CFURLRequestSetShouldHandleHTTPCookies(cfRequest, allowHTTPCookies());
+
+ unsigned fallbackCount = m_responseContentDispositionEncodingFallbackArray.size();
+ RetainPtr<CFMutableArrayRef> encodingFallbacks(AdoptCF, CFArrayCreateMutable(kCFAllocatorDefault, fallbackCount, 0));
+ for (unsigned i = 0; i != fallbackCount; ++i) {
+ RetainPtr<CFStringRef> encodingName(AdoptCF, m_responseContentDispositionEncodingFallbackArray[i].createCFString());
+ CFStringEncoding encoding = CFStringConvertIANACharSetNameToEncoding(encodingName.get());
+ if (encoding != kCFStringEncodingInvalidId)
+ CFArrayAppendValue(encodingFallbacks.get(), reinterpret_cast<const void*>(encoding));
+ }
+ setContentDispositionEncodingFallbackArray(cfRequest, encodingFallbacks.get());
+
+ if (m_cfRequest) {
+ RetainPtr<CFHTTPCookieStorageRef> cookieStorage(AdoptCF, CFURLRequestCopyHTTPCookieStorage(m_cfRequest.get()));
+ if (cookieStorage)
+ CFURLRequestSetHTTPCookieStorage(cfRequest, cookieStorage.get());
+ CFURLRequestSetHTTPCookieStorageAcceptPolicy(cfRequest, CFURLRequestGetHTTPCookieStorageAcceptPolicy(m_cfRequest.get()));
+ CFURLRequestSetSSLProperties(cfRequest, CFURLRequestGetSSLProperties(m_cfRequest.get()));
+ }
+
+ m_cfRequest.adoptCF(cfRequest);
+}
+
+void ResourceRequest::doUpdateResourceRequest()
+{
+ m_url = CFURLRequestGetURL(m_cfRequest.get());
+
+ m_cachePolicy = (ResourceRequestCachePolicy)CFURLRequestGetCachePolicy(m_cfRequest.get());
+ m_timeoutInterval = CFURLRequestGetTimeoutInterval(m_cfRequest.get());
+ m_mainDocumentURL = CFURLRequestGetMainDocumentURL(m_cfRequest.get());
+ if (CFStringRef method = CFURLRequestCopyHTTPRequestMethod(m_cfRequest.get())) {
+ m_httpMethod = method;
+ CFRelease(method);
+ }
+ m_allowHTTPCookies = CFURLRequestShouldHandleHTTPCookies(m_cfRequest.get());
+
+ if (CFDictionaryRef headers = CFURLRequestCopyAllHTTPHeaderFields(m_cfRequest.get())) {
+ CFIndex headerCount = CFDictionaryGetCount(headers);
+ Vector<const void*, 128> keys(headerCount);
+ Vector<const void*, 128> values(headerCount);
+ CFDictionaryGetKeysAndValues(headers, keys.data(), values.data());
+ for (int i = 0; i < headerCount; ++i)
+ m_httpHeaderFields.set((CFStringRef)keys[i], (CFStringRef)values[i]);
+ CFRelease(headers);
+ }
+
+ m_responseContentDispositionEncodingFallbackArray.clear();
+ RetainPtr<CFArrayRef> encodingFallbacks(AdoptCF, copyContentDispositionEncodingFallbackArray(m_cfRequest.get()));
+ if (encodingFallbacks) {
+ CFIndex count = CFArrayGetCount(encodingFallbacks.get());
+ for (CFIndex i = 0; i < count; ++i) {
+ CFStringEncoding encoding = reinterpret_cast<CFIndex>(CFArrayGetValueAtIndex(encodingFallbacks.get(), i));
+ if (encoding != kCFStringEncodingInvalidId)
+ m_responseContentDispositionEncodingFallbackArray.append(CFStringGetNameOfEncoding(encoding));
+ }
+ }
+
+ m_httpBody = httpBodyFromRequest(m_cfRequest.get());
+}
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ResourceRequestCFNet_h
+#define ResourceRequestCFNet_h
+
+typedef const struct _CFURLRequest* CFURLRequestRef;
+
+namespace WebCore {
+
+ class ResourceRequest;
+
+ void getResourceRequest(ResourceRequest&, CFURLRequestRef);
+ CFURLRequestRef cfURLRequest(const ResourceRequest&);
+}
+
+#endif // ResourceRequestCFNet_h
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef ResourceResponse_h
+#define ResourceResponse_h
+
+#include "ResourceResponseBase.h"
+#include <wtf/RetainPtr.h>
+
+typedef struct _CFURLResponse* CFURLResponseRef;
+
+namespace WebCore {
+
+class ResourceResponse : public ResourceResponseBase {
+public:
+ ResourceResponse()
+ : m_isUpToDate(true)
+ {
+ }
+
+ ResourceResponse(CFURLResponseRef cfResponse)
+ : m_cfResponse(cfResponse)
+ , m_isUpToDate(false)
+ {
+ m_isNull = !cfResponse;
+ }
+
+ ResourceResponse(const KURL& url, const String& mimeType, long long expectedLength, const String& textEncodingName, const String& filename)
+ : ResourceResponseBase(url, mimeType, expectedLength, textEncodingName, filename)
+ , m_isUpToDate(true)
+ {
+ }
+
+ CFURLResponseRef cfURLResponse() const;
+
+private:
+ friend class ResourceResponseBase;
+
+ void platformLazyInit();
+ static bool platformCompare(const ResourceResponse& a, const ResourceResponse& b);
+
+ RetainPtr<CFURLResponseRef> m_cfResponse;
+ bool m_isUpToDate;
+};
+
+} // namespace WebCore
+
+#endif // ResourceResponse_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ResourceResponseBase_h
+#define ResourceResponseBase_h
+
+#include "HTTPHeaderMap.h"
+#include "KURL.h"
+
+#include <memory>
+
+namespace WebCore {
+
+class ResourceResponse;
+struct CrossThreadResourceResponseData;
+
+// Do not use this class directly, use the class ResponseResponse instead
+class ResourceResponseBase {
+public:
+ static std::auto_ptr<ResourceResponse> adopt(std::auto_ptr<CrossThreadResourceResponseData>);
+
+ // Gets a copy of the data suitable for passing to another thread.
+ std::auto_ptr<CrossThreadResourceResponseData> copyData() const;
+
+ bool isNull() const { return m_isNull; }
+ bool isHTTP() const;
+
+ const KURL& url() const;
+ void setUrl(const KURL& url);
+
+ const String& mimeType() const;
+ void setMimeType(const String& mimeType);
+
+ long long expectedContentLength() const;
+ void setExpectedContentLength(long long expectedContentLength);
+
+ const String& textEncodingName() const;
+ void setTextEncodingName(const String& name);
+
+ // FIXME should compute this on the fly
+ const String& suggestedFilename() const;
+ void setSuggestedFilename(const String&);
+
+ int httpStatusCode() const;
+ void setHTTPStatusCode(int);
+
+ const String& httpStatusText() const;
+ void setHTTPStatusText(const String&);
+
+ String httpHeaderField(const AtomicString& name) const;
+ void setHTTPHeaderField(const AtomicString& name, const String& value);
+ const HTTPHeaderMap& httpHeaderFields() const;
+
+ bool isMultipart() const { return mimeType() == "multipart/x-mixed-replace"; }
+
+ bool isAttachment() const;
+
+ void setExpirationDate(time_t);
+ time_t expirationDate() const;
+
+ void setLastModifiedDate(time_t);
+ time_t lastModifiedDate() const;
+
+ bool cacheControlContainsNoCache() const
+ {
+ if (!m_haveParsedCacheControl)
+ parseCacheControlDirectives();
+ return m_cacheControlContainsNoCache;
+ }
+ bool cacheControlContainsMustRevalidate() const
+ {
+ if (!m_haveParsedCacheControl)
+ parseCacheControlDirectives();
+ return m_cacheControlContainsMustRevalidate;
+ }
+
+ static bool compare(const ResourceResponse& a, const ResourceResponse& b);
+
+protected:
+ ResourceResponseBase()
+ : m_expectedContentLength(0)
+ , m_httpStatusCode(0)
+ , m_expirationDate(0)
+ , m_lastModifiedDate(0)
+ , m_isNull(true)
+ , m_haveParsedCacheControl(false)
+ {
+ }
+
+ ResourceResponseBase(const KURL& url, const String& mimeType, long long expectedLength, const String& textEncodingName, const String& filename)
+ : m_url(url)
+ , m_mimeType(mimeType)
+ , m_expectedContentLength(expectedLength)
+ , m_textEncodingName(textEncodingName)
+ , m_suggestedFilename(filename)
+ , m_httpStatusCode(0)
+ , m_expirationDate(0)
+ , m_lastModifiedDate(0)
+ , m_isNull(false)
+ , m_haveParsedCacheControl(false)
+ {
+ }
+
+ void lazyInit() const;
+
+ // The ResourceResponse subclass may "shadow" this method to lazily initialize platform specific fields
+ void platformLazyInit() { }
+
+ // The ResourceResponse subclass may "shadow" this method to compare platform specific fields
+ static bool platformCompare(const ResourceResponse&, const ResourceResponse&) { return true; }
+
+ KURL m_url;
+ String m_mimeType;
+ long long m_expectedContentLength;
+ String m_textEncodingName;
+ String m_suggestedFilename;
+ int m_httpStatusCode;
+ String m_httpStatusText;
+ HTTPHeaderMap m_httpHeaderFields;
+ time_t m_expirationDate;
+ time_t m_lastModifiedDate;
+ bool m_isNull : 1;
+
+private:
+ void parseCacheControlDirectives() const;
+
+ mutable bool m_haveParsedCacheControl : 1;
+ mutable bool m_cacheControlContainsMustRevalidate : 1;
+ mutable bool m_cacheControlContainsNoCache : 1;
+};
+
+inline bool operator==(const ResourceResponse& a, const ResourceResponse& b) { return ResourceResponseBase::compare(a, b); }
+inline bool operator!=(const ResourceResponse& a, const ResourceResponse& b) { return !(a == b); }
+
+struct CrossThreadResourceResponseData {
+ KURL m_url;
+ String m_mimeType;
+ long long m_expectedContentLength;
+ String m_textEncodingName;
+ String m_suggestedFilename;
+ int m_httpStatusCode;
+ String m_httpStatusText;
+ OwnPtr<CrossThreadHTTPHeaderMapData> m_httpHeaders;
+ time_t m_expirationDate;
+ time_t m_lastModifiedDate;
+ bool m_haveParsedCacheControl : 1;
+ bool m_cacheControlContainsMustRevalidate : 1;
+ bool m_cacheControlContainsNoCache : 1;
+};
+
+} // namespace WebCore
+
+#endif // ResourceResponseBase_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ResourceResponseCFNet.h"
+
+#include "HTTPParsers.h"
+#include "MIMETypeRegistry.h"
+#include "ResourceResponse.h"
+#include <CFNetwork/CFURLResponsePriv.h>
+#include <wtf/RetainPtr.h>
+
+using namespace std;
+
+// We would like a better value for a maximum time_t,
+// but there is no way to do that in C with any certainty.
+// INT_MAX should work well enough for our purposes.
+#define MAX_TIME_T ((time_t)INT_MAX)
+
+namespace WebCore {
+
+CFURLResponseRef ResourceResponse::cfURLResponse() const
+{
+ return m_cfResponse.get();
+}
+
+static inline bool filenameHasSaneExtension(const String& filename)
+{
+ int dot = filename.find('.');
+
+ // The dot can't be the first or last character in the filename.
+ int length = filename.length();
+ return dot > 0 && dot < length - 1;
+}
+
+static time_t toTimeT(CFAbsoluteTime time)
+{
+ static const double maxTimeAsDouble = std::numeric_limits<time_t>::max();
+ static const double minTimeAsDouble = std::numeric_limits<time_t>::min();
+ return min(max(minTimeAsDouble, time + kCFAbsoluteTimeIntervalSince1970), maxTimeAsDouble);
+}
+
+void ResourceResponse::platformLazyInit()
+{
+ if (m_isUpToDate)
+ return;
+ m_isUpToDate = true;
+
+ if (m_isNull) {
+ ASSERT(!m_cfResponse.get());
+ return;
+ }
+
+ // FIXME: We may need to do MIME type sniffing here (unless that is done in CFURLResponseGetMIMEType).
+
+ m_url = CFURLResponseGetURL(m_cfResponse.get());
+ m_mimeType = CFURLResponseGetMIMEType(m_cfResponse.get());
+ m_expectedContentLength = CFURLResponseGetExpectedContentLength(m_cfResponse.get());
+ m_textEncodingName = CFURLResponseGetTextEncodingName(m_cfResponse.get());
+
+ m_expirationDate = toTimeT(CFURLResponseGetExpirationTime(m_cfResponse.get()));
+ m_lastModifiedDate = toTimeT(CFURLResponseGetLastModifiedDate(m_cfResponse.get()));
+
+ RetainPtr<CFStringRef> suggestedFilename(AdoptCF, CFURLResponseCopySuggestedFilename(m_cfResponse.get()));
+ m_suggestedFilename = suggestedFilename.get();
+
+ CFHTTPMessageRef httpResponse = CFURLResponseGetHTTPResponse(m_cfResponse.get());
+ if (httpResponse) {
+ m_httpStatusCode = CFHTTPMessageGetResponseStatusCode(httpResponse);
+
+ RetainPtr<CFStringRef> statusLine(AdoptCF, CFHTTPMessageCopyResponseStatusLine(httpResponse));
+ String statusText(statusLine.get());
+ int spacePos = statusText.find(" ");
+ if (spacePos != -1)
+ statusText = statusText.substring(spacePos + 1);
+ m_httpStatusText = statusText;
+
+ RetainPtr<CFDictionaryRef> headers(AdoptCF, CFHTTPMessageCopyAllHeaderFields(httpResponse));
+ CFIndex headerCount = CFDictionaryGetCount(headers.get());
+ Vector<const void*, 128> keys(headerCount);
+ Vector<const void*, 128> values(headerCount);
+ CFDictionaryGetKeysAndValues(headers.get(), keys.data(), values.data());
+ for (int i = 0; i < headerCount; ++i)
+ m_httpHeaderFields.set((CFStringRef)keys[i], (CFStringRef)values[i]);
+ } else
+ m_httpStatusCode = 0;
+}
+
+bool ResourceResponse::platformCompare(const ResourceResponse& a, const ResourceResponse& b)
+{
+ return CFEqual(a.cfURLResponse(), b.cfURLResponse());
+}
+
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ResourceResponseCFNet_h
+#define ResourceResponseCFNet_h
+
+typedef struct _CFURLResponse* CFURLResponseRef;
+
+namespace WebCore {
+
+ class ResourceResponse;
+
+ void getResourceResponse(ResourceResponse& response, CFURLResponseRef cfResponse);
+
+}
+
+#endif // ResourceResponseCFNet_h
--- /dev/null
+/*
+ * This file is part of the line box implementation for KDE.
+ *
+ * Copyright (C) 2003, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RootInlineBox_h
+#define RootInlineBox_h
+
+#include "BidiContext.h"
+#include "InlineFlowBox.h"
+
+namespace WebCore {
+
+class BidiStatus;
+class EllipsisBox;
+class HitTestResult;
+struct GapRects;
+
+class RootInlineBox : public InlineFlowBox {
+public:
+ RootInlineBox(RenderObject* obj)
+ : InlineFlowBox(obj)
+ , m_overflow(0)
+ , m_lineBreakObj(0)
+ , m_lineBreakPos(0)
+ {
+ }
+
+ virtual bool isRootInlineBox() { return true; }
+
+ virtual void destroy(RenderArena*);
+ void detachEllipsisBox(RenderArena*);
+
+ RootInlineBox* nextRootBox() { return static_cast<RootInlineBox*>(m_nextLine); }
+ RootInlineBox* prevRootBox() { return static_cast<RootInlineBox*>(m_prevLine); }
+
+ virtual void adjustPosition(int dx, int dy);
+
+ virtual int topOverflow() { return m_overflow ? m_overflow->m_topOverflow : m_y; }
+ virtual int bottomOverflow() { return m_overflow ? m_overflow->m_bottomOverflow : m_y + m_height; }
+ virtual int leftOverflow() { return m_overflow ? m_overflow->m_leftOverflow : m_x; }
+ virtual int rightOverflow() { return m_overflow ? m_overflow->m_rightOverflow : m_x + m_width; }
+
+ virtual void setVerticalOverflowPositions(int top, int bottom);
+ void setHorizontalOverflowPositions(int left, int right);
+
+ virtual void setVerticalSelectionPositions(int top, int bottom);
+
+#if ENABLE(SVG)
+ virtual void computePerCharacterLayoutInformation() { }
+#endif
+
+ RenderObject* lineBreakObj() const { return m_lineBreakObj; }
+ BidiStatus lineBreakBidiStatus() const;
+ void setLineBreakInfo(RenderObject*, unsigned breakPos, const BidiStatus&);
+
+ unsigned lineBreakPos() const { return m_lineBreakPos; }
+ void setLineBreakPos(unsigned p) { m_lineBreakPos = p; }
+
+ int blockHeight() const { return m_blockHeight; }
+ void setBlockHeight(int h) { m_blockHeight = h; }
+
+ bool endsWithBreak() const { return m_endsWithBreak; }
+ void setEndsWithBreak(bool b) { m_endsWithBreak = b; }
+
+ void childRemoved(InlineBox* box);
+
+ bool canAccommodateEllipsis(bool ltr, int blockEdge, int lineBoxEdge, int ellipsisWidth);
+ void placeEllipsis(const AtomicString& ellipsisStr, bool ltr, int blockEdge, int ellipsisWidth, InlineBox* markupBox = 0);
+ virtual int placeEllipsisBox(bool ltr, int blockEdge, int ellipsisWidth, bool& foundBox);
+
+ EllipsisBox* ellipsisBox() const;
+
+ void paintEllipsisBox(RenderObject::PaintInfo&, int tx, int ty) const;
+ bool hitTestEllipsisBox(HitTestResult&, int x, int y, int tx, int ty, HitTestAction, bool);
+
+ virtual void clearTruncation();
+
+#if PLATFORM(MAC)
+ void addHighlightOverflow();
+ void paintCustomHighlight(RenderObject::PaintInfo&, int tx, int ty, const AtomicString& highlightType);
+#endif
+
+ virtual void paint(RenderObject::PaintInfo&, int tx, int ty);
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int, int, int, int);
+
+ bool hasSelectedChildren() const { return m_hasSelectedChildren; }
+ void setHasSelectedChildren(bool);
+
+ virtual RenderObject::SelectionState selectionState();
+ InlineBox* firstSelectedBox();
+ InlineBox* lastSelectedBox();
+
+ GapRects fillLineSelectionGap(int selTop, int selHeight, RenderBlock* rootBlock, int blockX, int blockY,
+ int tx, int ty, const RenderObject::PaintInfo*);
+
+ RenderBlock* block() const;
+
+ int selectionTop();
+ int selectionBottom() { return m_overflow ? m_overflow->m_selectionBottom : m_y + m_height; }
+ int selectionHeight() { return max(0, selectionBottom() - selectionTop()); }
+
+ InlineBox* closestLeafChildForXPos(int x, bool onlyEditableLeaves = false);
+
+ Vector<RenderBox*>& floats()
+ {
+ ASSERT(!isDirty());
+ if (!m_overflow)
+ m_overflow = new (m_object->renderArena()) Overflow(this);
+ return m_overflow->floats;
+ }
+
+ Vector<RenderBox*>* floatsPtr() { ASSERT(!isDirty()); return m_overflow ? &m_overflow->floats : 0; }
+
+protected:
+ // Normally we are only as tall as the style on our block dictates, but we might have content
+ // that spills out above the height of our font (e.g, a tall image), or something that extends further
+ // below our line (e.g., a child whose font has a huge descent).
+
+ // Allocated only when some of these fields have non-default values
+ struct Overflow {
+ Overflow(RootInlineBox* box)
+ : m_topOverflow(box->m_y)
+ , m_bottomOverflow(box->m_y + box->m_height)
+ , m_leftOverflow(box->m_x)
+ , m_rightOverflow(box->m_x + box->m_width)
+ , m_selectionTop(box->m_y)
+ , m_selectionBottom(box->m_y + box->m_height)
+ {
+ }
+
+ void destroy(RenderArena*);
+ void* operator new(size_t, RenderArena*) throw();
+ void operator delete(void*, size_t);
+
+ int m_topOverflow;
+ int m_bottomOverflow;
+ int m_leftOverflow;
+ int m_rightOverflow;
+ int m_selectionTop;
+ int m_selectionBottom;
+ // Floats hanging off the line are pushed into this vector during layout. It is only
+ // good for as long as the line has not been marked dirty.
+ Vector<RenderBox*> floats;
+ private:
+ void* operator new(size_t) throw();
+ };
+
+ Overflow* m_overflow;
+
+ // Where this line ended. The exact object and the position within that object are stored so that
+ // we can create an InlineIterator beginning just after the end of this line.
+ RenderObject* m_lineBreakObj;
+ unsigned m_lineBreakPos;
+ RefPtr<BidiContext> m_lineBreakContext;
+
+ // The height of the block at the end of this line. This is where the next line starts.
+ int m_blockHeight;
+
+ WTF::Unicode::Direction m_lineBreakBidiStatusEor : 5;
+ WTF::Unicode::Direction m_lineBreakBidiStatusLastStrong : 5;
+ WTF::Unicode::Direction m_lineBreakBidiStatusLast : 5;
+};
+
+inline void RootInlineBox::setHorizontalOverflowPositions(int left, int right)
+{
+ if (!m_overflow) {
+ if (left == m_x && right == m_x + m_width)
+ return;
+ m_overflow = new (m_object->renderArena()) Overflow(this);
+ }
+ m_overflow->m_leftOverflow = left;
+ m_overflow->m_rightOverflow = right;
+}
+
+inline void RootInlineBox::setVerticalSelectionPositions(int top, int bottom)
+{
+ if (!m_overflow) {
+ if (top == m_y && bottom == m_y + m_height)
+ return;
+ m_overflow = new (m_object->renderArena()) Overflow(this);
+ }
+ m_overflow->m_selectionTop = top;
+ m_overflow->m_selectionBottom = bottom;
+}
+
+} // namespace WebCore
+
+#endif // RootInlineBox_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RotateTransformOperation_h
+#define RotateTransformOperation_h
+
+#include "TransformOperation.h"
+
+namespace WebCore {
+
+class RotateTransformOperation : public TransformOperation {
+public:
+ static PassRefPtr<RotateTransformOperation> create(double angle, OperationType type)
+ {
+ return adoptRef(new RotateTransformOperation(0, 0, 1, angle, type));
+ }
+
+ static PassRefPtr<RotateTransformOperation> create(double x, double y, double z, double angle, OperationType type)
+ {
+ return adoptRef(new RotateTransformOperation(x, y, z, angle, type));
+ }
+
+ double angle() const { return m_angle; }
+
+private:
+ virtual bool isIdentity() const { return m_angle == 0; }
+
+ virtual OperationType getOperationType() const { return m_type; }
+ virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == m_type; }
+
+ virtual bool operator==(const TransformOperation& o) const
+ {
+ if (!isSameType(o))
+ return false;
+ const RotateTransformOperation* r = static_cast<const RotateTransformOperation*>(&o);
+ return m_x == r->m_x && m_y == r->m_y && m_z == r->m_z && m_angle == r->m_angle;
+ }
+
+ virtual bool apply(TransformationMatrix& transform, const IntSize& /*borderBoxSize*/) const
+ {
+ transform.rotate3d(m_x, m_y, m_z, m_angle);
+ return false;
+ }
+
+ virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
+
+ RotateTransformOperation(double x, double y, double z, double angle, OperationType type)
+ : m_x(x)
+ , m_y(y)
+ , m_z(z)
+ , m_angle(angle)
+ , m_type(type)
+ {
+ ASSERT(type == ROTATE_X || type == ROTATE_Y || type == ROTATE_Z || type == ROTATE_3D);
+ }
+
+ double m_x;
+ double m_y;
+ double m_z;
+ double m_angle;
+ OperationType m_type;
+};
+
+} // namespace WebCore
+
+#endif // RotateTransformOperation_h
--- /dev/null
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RuntimeApplicationChecksIPhone_h
+#define RuntimeApplicationChecksIPhone_h
+
+namespace WebCore {
+
+bool applicationIsMobileMail();
+
+} // namespace WebCore
+
+#endif // RuntimeApplicationChecksIPhone_h
--- /dev/null
+/*
+ * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SSLKeyGenerator_h
+#define SSLKeyGenerator_h
+
+#include <wtf/Vector.h>
+#include "PlatformString.h"
+
+namespace WebCore {
+
+ class KURL;
+
+ void getSupportedKeySizes(Vector<String>&);
+ String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String& challengeString, const KURL&);
+
+} // namespace WebCore
+
+#endif // SSLKeyGenerator_h
--- /dev/null
+/*
+ * This file is part of the WebKit project.
+ *
+ * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef SVGCharacterLayoutInfo_h
+#define SVGCharacterLayoutInfo_h
+
+#if ENABLE(SVG)
+#include <wtf/Assertions.h>
+#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
+#include <wtf/Vector.h>
+
+#include "TransformationMatrix.h"
+#include <wtf/RefCounted.h>
+#include "SVGRenderStyle.h"
+#include "SVGTextContentElement.h"
+
+namespace WebCore {
+
+class InlineBox;
+class InlineFlowBox;
+class SVGInlineTextBox;
+class SVGLengthList;
+class SVGNumberList;
+class SVGTextPositioningElement;
+
+template<class Type>
+class PositionedVector : public Vector<Type>
+{
+public:
+ PositionedVector<Type>()
+ : m_position(0)
+ {
+ }
+
+ unsigned position() const
+ {
+ return m_position;
+ }
+
+ void advance(unsigned position)
+ {
+ m_position += position;
+ ASSERT(m_position < Vector<Type>::size());
+ }
+
+ Type valueAtCurrentPosition() const
+ {
+ ASSERT(m_position < Vector<Type>::size());
+ return Vector<Type>::at(m_position);
+ }
+
+private:
+ unsigned m_position;
+};
+
+class PositionedFloatVector : public PositionedVector<float> { };
+struct SVGChar;
+
+struct SVGCharacterLayoutInfo {
+ SVGCharacterLayoutInfo(Vector<SVGChar>&);
+
+ enum StackType { XStack, YStack, DxStack, DyStack, AngleStack, BaselineShiftStack };
+
+ bool xValueAvailable() const;
+ bool yValueAvailable() const;
+ bool dxValueAvailable() const;
+ bool dyValueAvailable() const;
+ bool angleValueAvailable() const;
+ bool baselineShiftValueAvailable() const;
+
+ float xValueNext() const;
+ float yValueNext() const;
+ float dxValueNext() const;
+ float dyValueNext() const;
+ float angleValueNext() const;
+ float baselineShiftValueNext() const;
+
+ void processedChunk(float savedShiftX, float savedShiftY);
+ void processedSingleCharacter();
+
+ bool nextPathLayoutPointAndAngle(float glyphAdvance, float extraAdvance, float newOffset);
+
+ // Used for text-on-path.
+ void addLayoutInformation(InlineFlowBox*, float textAnchorOffset = 0.0f);
+
+ bool inPathLayout() const;
+ void setInPathLayout(bool value);
+
+ // Used for anything else.
+ void addLayoutInformation(SVGTextPositioningElement*);
+
+ // Global position
+ float curx;
+ float cury;
+
+ // Global rotation
+ float angle;
+
+ // Accumulated dx/dy values
+ float dx;
+ float dy;
+
+ // Accumulated baseline-shift values
+ float shiftx;
+ float shifty;
+
+ // Path specific advance values to handle lengthAdjust
+ float pathExtraAdvance;
+ float pathTextLength;
+ float pathChunkLength;
+
+ // Result vector
+ Vector<SVGChar>& svgChars;
+ bool nextDrawnSeperated : 1;
+
+private:
+ // Used for baseline-shift.
+ void addStackContent(StackType, float);
+
+ // Used for angle.
+ void addStackContent(StackType, SVGNumberList*);
+
+ // Used for x/y/dx/dy.
+ void addStackContent(StackType, SVGLengthList*, const SVGElement*);
+
+ void addStackContent(StackType, const PositionedFloatVector&);
+
+ void xStackWalk();
+ void yStackWalk();
+ void dxStackWalk();
+ void dyStackWalk();
+ void angleStackWalk();
+ void baselineShiftStackWalk();
+
+private:
+ bool xStackChanged : 1;
+ bool yStackChanged : 1;
+ bool dxStackChanged : 1;
+ bool dyStackChanged : 1;
+ bool angleStackChanged : 1;
+ bool baselineShiftStackChanged : 1;
+
+ // text on path layout
+ bool pathLayout : 1;
+ float currentOffset;
+ float startOffset;
+ float layoutPathLength;
+ Path layoutPath;
+
+ Vector<PositionedFloatVector> xStack;
+ Vector<PositionedFloatVector> yStack;
+ Vector<PositionedFloatVector> dxStack;
+ Vector<PositionedFloatVector> dyStack;
+ Vector<PositionedFloatVector> angleStack;
+ Vector<float> baselineShiftStack;
+};
+
+// Holds extra data, when the character is laid out on a path
+struct SVGCharOnPath : RefCounted<SVGCharOnPath> {
+ static PassRefPtr<SVGCharOnPath> create() { return adoptRef(new SVGCharOnPath); }
+
+ float xScale;
+ float yScale;
+
+ float xShift;
+ float yShift;
+
+ float orientationAngle;
+
+ bool hidden : 1;
+
+private:
+ SVGCharOnPath()
+ : xScale(1.0f)
+ , yScale(1.0f)
+ , xShift(0.0f)
+ , yShift(0.0f)
+ , orientationAngle(0.0f)
+ , hidden(false)
+ {
+ }
+};
+
+struct SVGChar {
+ SVGChar()
+ : x(0.0f)
+ , y(0.0f)
+ , angle(0.0f)
+ , orientationShiftX(0.0f)
+ , orientationShiftY(0.0f)
+ , pathData()
+ , drawnSeperated(false)
+ , newTextChunk(false)
+ {
+ }
+
+ ~SVGChar()
+ {
+ }
+
+ float x;
+ float y;
+ float angle;
+
+ float orientationShiftX;
+ float orientationShiftY;
+
+ RefPtr<SVGCharOnPath> pathData;
+
+ // Determines wheter this char needs to be drawn seperated
+ bool drawnSeperated : 1;
+
+ // Determines wheter this char starts a new chunk
+ bool newTextChunk : 1;
+
+ // Helper methods
+ bool isHidden() const;
+ TransformationMatrix characterTransform() const;
+};
+
+struct SVGInlineBoxCharacterRange {
+ SVGInlineBoxCharacterRange()
+ : startOffset(INT_MIN)
+ , endOffset(INT_MIN)
+ , box(0)
+ {
+ }
+
+ bool isOpen() const { return (startOffset == endOffset) && (endOffset == INT_MIN); }
+ bool isClosed() const { return startOffset != INT_MIN && endOffset != INT_MIN; }
+
+ int startOffset;
+ int endOffset;
+
+ InlineBox* box;
+};
+
+// Convenience typedef
+typedef SVGTextContentElement::SVGLengthAdjustType ELengthAdjust;
+
+struct SVGTextChunk {
+ SVGTextChunk()
+ : anchor(TA_START)
+ , textLength(0.0f)
+ , lengthAdjust(SVGTextContentElement::LENGTHADJUST_SPACING)
+ , ctm()
+ , isVerticalText(false)
+ , isTextPath(false)
+ , start(0)
+ , end(0)
+ { }
+
+ // text-anchor support
+ ETextAnchor anchor;
+
+ // textLength & lengthAdjust support
+ float textLength;
+ ELengthAdjust lengthAdjust;
+ TransformationMatrix ctm;
+
+ // status flags
+ bool isVerticalText : 1;
+ bool isTextPath : 1;
+
+ // main chunk data
+ Vector<SVGChar>::iterator start;
+ Vector<SVGChar>::iterator end;
+
+ Vector<SVGInlineBoxCharacterRange> boxes;
+};
+
+struct SVGTextChunkWalkerBase {
+ virtual ~SVGTextChunkWalkerBase() { }
+
+ virtual void operator()(SVGInlineTextBox* textBox, int startOffset, const TransformationMatrix& chunkCtm,
+ const Vector<SVGChar>::iterator& start, const Vector<SVGChar>::iterator& end) = 0;
+
+ // Followings methods are only used for painting text chunks
+ virtual void start(InlineBox*) = 0;
+ virtual void end(InlineBox*) = 0;
+
+ virtual bool setupFill(InlineBox*) = 0;
+ virtual bool setupStroke(InlineBox*) = 0;
+};
+
+template<typename CallbackClass>
+struct SVGTextChunkWalker : public SVGTextChunkWalkerBase {
+public:
+ typedef void (CallbackClass::*SVGTextChunkWalkerCallback)(SVGInlineTextBox* textBox,
+ int startOffset,
+ const TransformationMatrix& chunkCtm,
+ const Vector<SVGChar>::iterator& start,
+ const Vector<SVGChar>::iterator& end);
+
+ // These callbacks are only used for painting!
+ typedef void (CallbackClass::*SVGTextChunkStartCallback)(InlineBox* box);
+ typedef void (CallbackClass::*SVGTextChunkEndCallback)(InlineBox* box);
+
+ typedef bool (CallbackClass::*SVGTextChunkSetupFillCallback)(InlineBox* box);
+ typedef bool (CallbackClass::*SVGTextChunkSetupStrokeCallback)(InlineBox* box);
+
+ SVGTextChunkWalker(CallbackClass* object,
+ SVGTextChunkWalkerCallback walker,
+ SVGTextChunkStartCallback start = 0,
+ SVGTextChunkEndCallback end = 0,
+ SVGTextChunkSetupFillCallback fill = 0,
+ SVGTextChunkSetupStrokeCallback stroke = 0)
+ : m_object(object)
+ , m_walkerCallback(walker)
+ , m_startCallback(start)
+ , m_endCallback(end)
+ , m_setupFillCallback(fill)
+ , m_setupStrokeCallback(stroke)
+ {
+ ASSERT(object);
+ ASSERT(walker);
+ }
+
+ virtual void operator()(SVGInlineTextBox* textBox, int startOffset, const TransformationMatrix& chunkCtm,
+ const Vector<SVGChar>::iterator& start, const Vector<SVGChar>::iterator& end)
+ {
+ (*m_object.*m_walkerCallback)(textBox, startOffset, chunkCtm, start, end);
+ }
+
+ // Followings methods are only used for painting text chunks
+ virtual void start(InlineBox* box)
+ {
+ if (m_startCallback)
+ (*m_object.*m_startCallback)(box);
+ else
+ ASSERT_NOT_REACHED();
+ }
+
+ virtual void end(InlineBox* box)
+ {
+ if (m_endCallback)
+ (*m_object.*m_endCallback)(box);
+ else
+ ASSERT_NOT_REACHED();
+ }
+
+ virtual bool setupFill(InlineBox* box)
+ {
+ if (m_setupFillCallback)
+ return (*m_object.*m_setupFillCallback)(box);
+
+ ASSERT_NOT_REACHED();
+ return false;
+ }
+
+ virtual bool setupStroke(InlineBox* box)
+ {
+ if (m_setupStrokeCallback)
+ return (*m_object.*m_setupStrokeCallback)(box);
+
+ ASSERT_NOT_REACHED();
+ return false;
+ }
+
+private:
+ CallbackClass* m_object;
+ SVGTextChunkWalkerCallback m_walkerCallback;
+ SVGTextChunkStartCallback m_startCallback;
+ SVGTextChunkEndCallback m_endCallback;
+ SVGTextChunkSetupFillCallback m_setupFillCallback;
+ SVGTextChunkSetupStrokeCallback m_setupStrokeCallback;
+};
+
+struct SVGTextChunkLayoutInfo {
+ SVGTextChunkLayoutInfo(Vector<SVGTextChunk>& textChunks)
+ : assignChunkProperties(true)
+ , handlingTextPath(false)
+ , svgTextChunks(textChunks)
+ , it(0)
+ {
+ }
+
+ bool assignChunkProperties : 1;
+ bool handlingTextPath : 1;
+
+ Vector<SVGTextChunk>& svgTextChunks;
+ Vector<SVGChar>::iterator it;
+
+ SVGTextChunk chunk;
+};
+
+struct SVGTextDecorationInfo {
+ // ETextDecoration is meant to be used here
+ HashMap<int, RenderObject*> fillServerMap;
+ HashMap<int, RenderObject*> strokeServerMap;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif // SVGCharacterLayoutInfo_h
--- /dev/null
+/*
+ * This file is part of the WebKit project.
+ *
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>
+ * (C) 2006 Apple Computer Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef SVGInlineFlowBox_h
+#define SVGInlineFlowBox_h
+
+#if ENABLE(SVG)
+#include "InlineFlowBox.h"
+
+namespace WebCore {
+
+class SVGInlineFlowBox : public InlineFlowBox {
+public:
+ SVGInlineFlowBox(RenderObject* obj)
+ : InlineFlowBox(obj)
+ {
+ }
+
+ virtual void paint(RenderObject::PaintInfo&, int tx, int ty);
+ virtual int placeBoxesHorizontally(int x, int& leftPosition, int& rightPosition, bool& needsWordSpacing);
+ virtual int verticallyAlignBoxes(int heightOfBlock);
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+
+#endif // SVGInlineFlowBox_h
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 2007 Rob Buis <buis@kde.org>
+ * (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef SVGInlineTextBox_h
+#define SVGInlineTextBox_h
+
+#if ENABLE(SVG)
+#include "InlineTextBox.h"
+
+namespace WebCore {
+
+ class SVGChar;
+ class SVGRootInlineBox;
+ class SVGTextDecorationInfo;
+
+ class SVGInlineTextBox : public InlineTextBox {
+ public:
+ SVGInlineTextBox(RenderObject* obj);
+
+ virtual int selectionTop();
+ virtual int selectionHeight();
+
+ virtual int offsetForPosition(int x, bool includePartialGlyphs = true) const;
+ virtual int positionForOffset(int offset) const;
+
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty);
+ virtual IntRect selectionRect(int absx, int absy, int startPos, int endPos);
+
+ // SVGs custom paint text method
+ void paintCharacters(RenderObject::PaintInfo&, int tx, int ty, const SVGChar&, const UChar* chars, int length, SVGPaintServer*);
+
+ // SVGs custom paint selection method
+ void paintSelection(int boxStartOffset, const SVGChar&, const UChar*, int length, GraphicsContext*, RenderStyle*, const Font&);
+
+ // SVGs custom paint decoration method
+ void paintDecoration(ETextDecoration, GraphicsContext*, int tx, int ty, int width, const SVGChar&, const SVGTextDecorationInfo&);
+
+ SVGRootInlineBox* svgRootInlineBox() const;
+
+ // Helper functions shared with SVGRootInlineBox
+ float calculateGlyphWidth(RenderStyle* style, int offset, int extraCharsAvailable, int& charsConsumed, String& glyphName) const;
+ float calculateGlyphHeight(RenderStyle*, int offset, int extraCharsAvailable) const;
+
+ FloatRect calculateGlyphBoundaries(RenderStyle*, int offset, const SVGChar&) const;
+ SVGChar* closestCharacterToPosition(int x, int y, int& offset) const;
+
+ private:
+ friend class RenderSVGInlineText;
+ bool svgCharacterHitsPosition(int x, int y, int& offset) const;
+ };
+
+} // namespace WebCore
+
+#endif
+#endif // SVGInlineTextBox_h
--- /dev/null
+/*
+ Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ 2004, 2005 Rob Buis <buis@kde.org>
+ Copyright (C) 2005, 2006 Apple Computer, Inc.
+
+ This file is part of the KDE project
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef SVGRenderStyle_h
+#define SVGRenderStyle_h
+
+#if ENABLE(SVG)
+#include "CSSValueList.h"
+#include "DataRef.h"
+#include "GraphicsTypes.h"
+#include "SVGPaint.h"
+#include "SVGRenderStyleDefs.h"
+
+#include <wtf/Platform.h>
+
+namespace WebCore {
+
+ class RenderObject;
+ class RenderStyle;
+
+ class SVGRenderStyle : public RefCounted<SVGRenderStyle> {
+ public:
+ static PassRefPtr<SVGRenderStyle> create() { return adoptRef(new SVGRenderStyle); }
+ PassRefPtr<SVGRenderStyle> copy() const { return adoptRef(new SVGRenderStyle(*this));}
+ ~SVGRenderStyle();
+
+ bool inheritedNotEqual(const SVGRenderStyle*) const;
+ void inheritFrom(const SVGRenderStyle*);
+
+ bool operator==(const SVGRenderStyle&) const;
+ bool operator!=(const SVGRenderStyle& o) const { return !(*this == o); }
+
+ // SVG CSS Properties
+ SVG_RS_DEFINE_ATTRIBUTE(EAlignmentBaseline, AlignmentBaseline, alignmentBaseline, AB_AUTO)
+ SVG_RS_DEFINE_ATTRIBUTE(EDominantBaseline, DominantBaseline, dominantBaseline, DB_AUTO)
+ SVG_RS_DEFINE_ATTRIBUTE(EBaselineShift, BaselineShift, baselineShift, BS_BASELINE)
+
+ SVG_RS_DEFINE_ATTRIBUTE_INHERITED(LineCap, CapStyle, capStyle, ButtCap)
+ SVG_RS_DEFINE_ATTRIBUTE_INHERITED(WindRule, ClipRule, clipRule, RULE_NONZERO)
+ SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EColorInterpolation, ColorInterpolation, colorInterpolation, CI_SRGB)
+ SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EColorInterpolation, ColorInterpolationFilters, colorInterpolationFilters, CI_LINEARRGB)
+ SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EColorRendering, ColorRendering, colorRendering, CR_AUTO)
+ SVG_RS_DEFINE_ATTRIBUTE_INHERITED(WindRule, FillRule, fillRule, RULE_NONZERO)
+ SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EImageRendering, ImageRendering, imageRendering, IR_AUTO)
+ SVG_RS_DEFINE_ATTRIBUTE_INHERITED(LineJoin, JoinStyle, joinStyle, MiterJoin)
+ SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EShapeRendering, ShapeRendering, shapeRendering, SR_AUTO)
+ SVG_RS_DEFINE_ATTRIBUTE_INHERITED(ETextAnchor, TextAnchor, textAnchor, TA_START)
+ SVG_RS_DEFINE_ATTRIBUTE_INHERITED(ETextRendering, TextRendering, textRendering, TR_AUTO)
+ SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EWritingMode, WritingMode, writingMode, WM_LRTB)
+ SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EGlyphOrientation, GlyphOrientationHorizontal, glyphOrientationHorizontal, GO_0DEG)
+ SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EGlyphOrientation, GlyphOrientationVertical, glyphOrientationVertical, GO_AUTO)
+
+ // SVG CSS Properties (using DataRef's)
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, fill, opacity, FillOpacity, fillOpacity, 1.0f)
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(SVGPaint, fill, paint, FillPaint, fillPaint, SVGPaint::defaultFill())
+
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, stroke, opacity, StrokeOpacity, strokeOpacity, 1.0f)
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(SVGPaint, stroke, paint, StrokePaint, strokePaint, SVGPaint::defaultStroke())
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValueList, stroke, dashArray, StrokeDashArray, strokeDashArray, 0)
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, stroke, miterLimit, StrokeMiterLimit, strokeMiterLimit, 4.0f)
+
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValue, stroke, width, StrokeWidth, strokeWidth, 0)
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValue, stroke, dashOffset, StrokeDashOffset, strokeDashOffset, 0);
+
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValue, text, kerning, Kerning, kerning, 0)
+
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, stops, opacity, StopOpacity, stopOpacity, 1.0f)
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(Color, stops, color, StopColor, stopColor, Color(0, 0, 0))
+
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, clip, clipPath, ClipPath, clipPath, String())
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, mask, maskElement, MaskElement, maskElement, String())
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, markers, startMarker, StartMarker, startMarker, String())
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, markers, midMarker, MidMarker, midMarker, String())
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, markers, endMarker, EndMarker, endMarker, String())
+
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, misc, filter, Filter, filter, String())
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, misc, floodOpacity, FloodOpacity, floodOpacity, 1.0f)
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(Color, misc, floodColor, FloodColor, floodColor, Color(0, 0, 0))
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(Color, misc, lightingColor, LightingColor, lightingColor, Color(255, 255, 255))
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValue, misc, baselineShiftValue, BaselineShiftValue, baselineShiftValue, 0)
+
+ // convenience
+ bool hasStroke() const { return (strokePaint()->paintType() != SVGPaint::SVG_PAINTTYPE_NONE); }
+ bool hasFill() const { return (fillPaint()->paintType() != SVGPaint::SVG_PAINTTYPE_NONE); }
+
+ static float cssPrimitiveToLength(const RenderObject*, CSSValue*, float defaultValue = 0.0f);
+
+ protected:
+ // inherit
+ struct InheritedFlags {
+ bool operator==(const InheritedFlags& other) const
+ {
+ return (_colorRendering == other._colorRendering) &&
+ (_imageRendering == other._imageRendering) &&
+ (_shapeRendering == other._shapeRendering) &&
+ (_textRendering == other._textRendering) &&
+ (_clipRule == other._clipRule) &&
+ (_fillRule == other._fillRule) &&
+ (_capStyle == other._capStyle) &&
+ (_joinStyle == other._joinStyle) &&
+ (_textAnchor == other._textAnchor) &&
+ (_colorInterpolation == other._colorInterpolation) &&
+ (_colorInterpolationFilters == other._colorInterpolationFilters) &&
+ (_writingMode == other._writingMode) &&
+ (_glyphOrientationHorizontal == other._glyphOrientationHorizontal) &&
+ (_glyphOrientationVertical == other._glyphOrientationVertical);
+ }
+
+ bool operator!=(const InheritedFlags& other) const
+ {
+ return !(*this == other);
+ }
+
+ unsigned _colorRendering : 2; // EColorRendering
+ unsigned _imageRendering : 2; // EImageRendering
+ unsigned _shapeRendering : 2; // EShapeRendering
+ unsigned _textRendering : 2; // ETextRendering
+ unsigned _clipRule : 1; // WindRule
+ unsigned _fillRule : 1; // WindRule
+ unsigned _capStyle : 2; // LineCap
+ unsigned _joinStyle : 2; // LineJoin
+ unsigned _textAnchor : 2; // ETextAnchor
+ unsigned _colorInterpolation : 2; // EColorInterpolation
+ unsigned _colorInterpolationFilters : 2; // EColorInterpolation
+ unsigned _writingMode : 3; // EWritingMode
+ unsigned _glyphOrientationHorizontal : 3; // EGlyphOrientation
+ unsigned _glyphOrientationVertical : 3; // EGlyphOrientation
+ } svg_inherited_flags;
+
+ // don't inherit
+ struct NonInheritedFlags {
+ // 32 bit non-inherited, don't add to the struct, or the operator will break.
+ bool operator==(const NonInheritedFlags &other) const { return _niflags == other._niflags; }
+ bool operator!=(const NonInheritedFlags &other) const { return _niflags != other._niflags; }
+
+ union {
+ struct {
+ unsigned _alignmentBaseline : 4; // EAlignmentBaseline
+ unsigned _dominantBaseline : 4; // EDominantBaseline
+ unsigned _baselineShift : 2; // EBaselineShift
+ // 22 bits unused
+ } f;
+ uint32_t _niflags;
+ };
+ } svg_noninherited_flags;
+
+ // inherited attributes
+ DataRef<StyleFillData> fill;
+ DataRef<StyleStrokeData> stroke;
+ DataRef<StyleMarkerData> markers;
+ DataRef<StyleTextData> text;
+
+ // non-inherited attributes
+ DataRef<StyleStopData> stops;
+ DataRef<StyleClipData> clip;
+ DataRef<StyleMaskData> mask;
+ DataRef<StyleMiscData> misc;
+
+ private:
+ enum CreateDefaultType { CreateDefault };
+
+ SVGRenderStyle();
+ SVGRenderStyle(const SVGRenderStyle&);
+ SVGRenderStyle(CreateDefaultType); // Used to create the default style.
+
+ void setBitDefaults()
+ {
+ svg_inherited_flags._clipRule = initialClipRule();
+ svg_inherited_flags._colorRendering = initialColorRendering();
+ svg_inherited_flags._fillRule = initialFillRule();
+ svg_inherited_flags._imageRendering = initialImageRendering();
+ svg_inherited_flags._shapeRendering = initialShapeRendering();
+ svg_inherited_flags._textRendering = initialTextRendering();
+ svg_inherited_flags._textAnchor = initialTextAnchor();
+ svg_inherited_flags._capStyle = initialCapStyle();
+ svg_inherited_flags._joinStyle = initialJoinStyle();
+ svg_inherited_flags._colorInterpolation = initialColorInterpolation();
+ svg_inherited_flags._colorInterpolationFilters = initialColorInterpolationFilters();
+ svg_inherited_flags._writingMode = initialWritingMode();
+ svg_inherited_flags._glyphOrientationHorizontal = initialGlyphOrientationHorizontal();
+ svg_inherited_flags._glyphOrientationVertical = initialGlyphOrientationVertical();
+
+ svg_noninherited_flags._niflags = 0;
+ svg_noninherited_flags.f._alignmentBaseline = initialAlignmentBaseline();
+ svg_noninherited_flags.f._dominantBaseline = initialDominantBaseline();
+ svg_noninherited_flags.f._baselineShift = initialBaselineShift();
+ }
+ };
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif // SVGRenderStyle_h
+
+// vim:ts=4:noet
--- /dev/null
+/*
+ Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ 2004, 2005 Rob Buis <buis@kde.org>
+
+ Based on khtml code by:
+ Copyright (C) 2000-2003 Lars Knoll (knoll@kde.org)
+ (C) 2000 Antti Koivisto (koivisto@kde.org)
+ (C) 2000-2003 Dirk Mueller (mueller@kde.org)
+ (C) 2002-2003 Apple Computer, Inc.
+
+ This file is part of the KDE project
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef SVGRenderStyleDefs_h
+#define SVGRenderStyleDefs_h
+
+#if ENABLE(SVG)
+#include "Color.h"
+#include "Path.h"
+#include "PlatformString.h"
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+// Helper macros for 'SVGRenderStyle'
+#define SVG_RS_DEFINE_ATTRIBUTE(Data, Type, Name, Initial) \
+ void set##Type(Data val) { svg_noninherited_flags.f._##Name = val; } \
+ Data Name() const { return (Data) svg_noninherited_flags.f._##Name; } \
+ static Data initial##Type() { return Initial; }
+
+#define SVG_RS_DEFINE_ATTRIBUTE_INHERITED(Data, Type, Name, Initial) \
+ void set##Type(Data val) { svg_inherited_flags._##Name = val; } \
+ Data Name() const { return (Data) svg_inherited_flags._##Name; } \
+ static Data initial##Type() { return Initial; }
+
+// "Helper" macros for SVG's RenderStyle properties
+// FIXME: These are impossible to work with or debug.
+#define SVG_RS_DEFINE_ATTRIBUTE_DATAREF(Data, Group, Variable, Type, Name) \
+ Data Name() const { return Group->Variable; } \
+ void set##Type(Data obj) { SVG_RS_SET_VARIABLE(Group, Variable, obj) }
+
+#define SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(Data, Group, Variable, Type, Name, Initial) \
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF(Data, Group, Variable, Type, Name) \
+ static Data initial##Type() { return Initial; }
+
+#define SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(Data, Group, Variable, Type, Name, Initial) \
+ Data* Name() const { return Group->Variable.get(); } \
+ void set##Type(PassRefPtr<Data> obj) { \
+ if(!(Group->Variable == obj)) \
+ Group.access()->Variable = obj; \
+ } \
+ static Data* initial##Type() { return Initial; }
+
+#define SVG_RS_SET_VARIABLE(Group, Variable, Value) \
+ if(!(Group->Variable == Value)) \
+ Group.access()->Variable = Value;
+
+namespace WebCore {
+
+ enum EBaselineShift {
+ BS_BASELINE, BS_SUB, BS_SUPER, BS_LENGTH
+ };
+
+ enum ETextAnchor {
+ TA_START, TA_MIDDLE, TA_END
+ };
+
+ enum EColorInterpolation {
+ CI_AUTO, CI_SRGB, CI_LINEARRGB
+ };
+
+ enum EColorRendering {
+ CR_AUTO, CR_OPTIMIZESPEED, CR_OPTIMIZEQUALITY
+ };
+
+ enum EImageRendering {
+ IR_AUTO, IR_OPTIMIZESPEED, IR_OPTIMIZEQUALITY
+ };
+
+ enum EShapeRendering {
+ SR_AUTO, SR_OPTIMIZESPEED, SR_CRISPEDGES, SR_GEOMETRICPRECISION
+ };
+
+ enum ETextRendering {
+ TR_AUTO, TR_OPTIMIZESPEED, TR_OPTIMIZELEGIBILITY, TR_GEOMETRICPRECISION
+ };
+
+ enum EWritingMode {
+ WM_LRTB, WM_LR, WM_RLTB, WM_RL, WM_TBRL, WM_TB
+ };
+
+ enum EGlyphOrientation {
+ GO_0DEG, GO_90DEG, GO_180DEG, GO_270DEG, GO_AUTO
+ };
+
+ enum EAlignmentBaseline {
+ AB_AUTO, AB_BASELINE, AB_BEFORE_EDGE, AB_TEXT_BEFORE_EDGE,
+ AB_MIDDLE, AB_CENTRAL, AB_AFTER_EDGE, AB_TEXT_AFTER_EDGE,
+ AB_IDEOGRAPHIC, AB_ALPHABETIC, AB_HANGING, AB_MATHEMATICAL
+ };
+
+ enum EDominantBaseline {
+ DB_AUTO, DB_USE_SCRIPT, DB_NO_CHANGE, DB_RESET_SIZE,
+ DB_IDEOGRAPHIC, DB_ALPHABETIC, DB_HANGING, DB_MATHEMATICAL,
+ DB_CENTRAL, DB_MIDDLE, DB_TEXT_AFTER_EDGE, DB_TEXT_BEFORE_EDGE
+ };
+
+ class CSSValue;
+ class CSSValueList;
+ class SVGPaint;
+
+ // Inherited/Non-Inherited Style Datastructures
+ class StyleFillData : public RefCounted<StyleFillData> {
+ public:
+ static PassRefPtr<StyleFillData> create() { return adoptRef(new StyleFillData); }
+ PassRefPtr<StyleFillData> copy() const { return adoptRef(new StyleFillData(*this)); }
+
+ bool operator==(const StyleFillData &other) const;
+ bool operator!=(const StyleFillData &other) const
+ {
+ return !(*this == other);
+ }
+
+ float opacity;
+ RefPtr<SVGPaint> paint;
+
+ private:
+ StyleFillData();
+ StyleFillData(const StyleFillData&);
+ };
+
+ class StyleStrokeData : public RefCounted<StyleStrokeData> {
+ public:
+ static PassRefPtr<StyleStrokeData> create() { return adoptRef(new StyleStrokeData); }
+ PassRefPtr<StyleStrokeData> copy() const { return adoptRef(new StyleStrokeData(*this)); }
+
+ bool operator==(const StyleStrokeData&) const;
+ bool operator!=(const StyleStrokeData& other) const
+ {
+ return !(*this == other);
+ }
+
+ float opacity;
+ float miterLimit;
+
+ RefPtr<CSSValue> width;
+ RefPtr<CSSValue> dashOffset;
+
+ RefPtr<SVGPaint> paint;
+ RefPtr<CSSValueList> dashArray;
+
+ private:
+ StyleStrokeData();
+ StyleStrokeData(const StyleStrokeData&);
+ };
+
+ class StyleStopData : public RefCounted<StyleStopData> {
+ public:
+ static PassRefPtr<StyleStopData> create() { return adoptRef(new StyleStopData); }
+ PassRefPtr<StyleStopData> copy() const { return adoptRef(new StyleStopData(*this)); }
+
+ bool operator==(const StyleStopData &other) const;
+ bool operator!=(const StyleStopData &other) const
+ {
+ return !(*this == other);
+ }
+
+ float opacity;
+ Color color;
+
+ private:
+ StyleStopData();
+ StyleStopData(const StyleStopData&);
+ };
+
+ class StyleTextData : public RefCounted<StyleTextData> {
+ public:
+ static PassRefPtr<StyleTextData> create() { return adoptRef(new StyleTextData); }
+ PassRefPtr<StyleTextData> copy() const { return adoptRef(new StyleTextData(*this)); }
+
+ bool operator==(const StyleTextData& other) const;
+ bool operator!=(const StyleTextData& other) const
+ {
+ return !(*this == other);
+ }
+
+ RefPtr<CSSValue> kerning;
+
+ private:
+ StyleTextData();
+ StyleTextData(const StyleTextData& other);
+ };
+
+ class StyleClipData : public RefCounted<StyleClipData> {
+ public:
+ static PassRefPtr<StyleClipData> create() { return adoptRef(new StyleClipData); }
+ PassRefPtr<StyleClipData> copy() const { return adoptRef(new StyleClipData(*this)); }
+
+ bool operator==(const StyleClipData &other) const;
+ bool operator!=(const StyleClipData &other) const
+ {
+ return !(*this == other);
+ }
+
+ String clipPath;
+
+ private:
+ StyleClipData();
+ StyleClipData(const StyleClipData&);
+ };
+
+ class StyleMaskData : public RefCounted<StyleMaskData> {
+ public:
+ static PassRefPtr<StyleMaskData> create() { return adoptRef(new StyleMaskData); }
+ PassRefPtr<StyleMaskData> copy() const { return adoptRef(new StyleMaskData(*this)); }
+
+ bool operator==(const StyleMaskData &other) const;
+ bool operator!=(const StyleMaskData &other) const { return !(*this == other); }
+
+ String maskElement;
+
+ private:
+ StyleMaskData();
+ StyleMaskData(const StyleMaskData&);
+ };
+
+ class StyleMarkerData : public RefCounted<StyleMarkerData> {
+ public:
+ static PassRefPtr<StyleMarkerData> create() { return adoptRef(new StyleMarkerData); }
+ PassRefPtr<StyleMarkerData> copy() const { return adoptRef(new StyleMarkerData(*this)); }
+
+ bool operator==(const StyleMarkerData &other) const;
+ bool operator!=(const StyleMarkerData &other) const
+ {
+ return !(*this == other);
+ }
+
+ String startMarker;
+ String midMarker;
+ String endMarker;
+
+ private:
+ StyleMarkerData();
+ StyleMarkerData(const StyleMarkerData&);
+ };
+
+ // Note : the rule for this class is, *no inheritance* of these props
+ class StyleMiscData : public RefCounted<StyleMiscData> {
+ public:
+ static PassRefPtr<StyleMiscData> create() { return adoptRef(new StyleMiscData); }
+ PassRefPtr<StyleMiscData> copy() const { return adoptRef(new StyleMiscData(*this)); }
+
+ bool operator==(const StyleMiscData &other) const;
+ bool operator!=(const StyleMiscData &other) const
+ {
+ return !(*this == other);
+ }
+
+ String filter;
+ Color floodColor;
+ float floodOpacity;
+
+ Color lightingColor;
+
+ // non-inherited text stuff lives here not in StyleTextData.
+ RefPtr<CSSValue> baselineShiftValue;
+
+ private:
+ StyleMiscData();
+ StyleMiscData(const StyleMiscData&);
+ };
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif // SVGRenderStyleDefs_h
+
+// vim:ts=4:noet
--- /dev/null
+/**
+ * This file is part of the DOM implementation for WebKit.
+ *
+ * Copyright (C) 2007 Rob Buis <buis@kde.org>
+ * (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ * (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#if ENABLE(SVG)
+#include "RenderObject.h"
+
+namespace WebCore {
+
+class SVGResourceFilter;
+void prepareToRenderSVGContent(RenderObject*, RenderObject::PaintInfo&, const FloatRect& boundingBox, SVGResourceFilter*&, SVGResourceFilter* rootFilter = 0);
+void finishRenderSVGContent(RenderObject*, RenderObject::PaintInfo&, const FloatRect& boundingBox, SVGResourceFilter*&, GraphicsContext* savedContext);
+
+// This offers a way to render parts of a WebKit rendering tree into a ImageBuffer.
+class ImageBuffer;
+void renderSubtreeToImage(ImageBuffer*, RenderObject*);
+
+void clampImageBufferSizeToViewport(RenderObject*, IntSize&);
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2004, 2005 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SVGRenderTreeAsText_h
+#define SVGRenderTreeAsText_h
+
+#if ENABLE(SVG)
+
+#include "TextStream.h"
+
+namespace WebCore {
+
+ class TransformationMatrix;
+ class Color;
+ class FloatPoint;
+ class FloatRect;
+ class FloatSize;
+ class IntPoint;
+ class IntRect;
+ class Node;
+ class RenderPath;
+ class RenderSVGContainer;
+ class RenderSVGInlineText;
+ class RenderSVGRoot;
+ class RenderSVGText;
+
+// functions used by the main RenderTreeAsText code
+void write(TextStream&, const RenderPath&, int indent = 0);
+void write(TextStream&, const RenderSVGContainer&, int indent = 0);
+void write(TextStream&, const RenderSVGInlineText&, int ident = 0);
+void write(TextStream&, const RenderSVGRoot&, int indent = 0);
+void write(TextStream&, const RenderSVGText&, int ident = 0);
+
+void writeRenderResources(TextStream&, Node* parent);
+
+// helper operators defined used in various classes to dump the render tree.
+TextStream& operator<<(TextStream&, const TransformationMatrix&);
+TextStream& operator<<(TextStream&, const IntRect&);
+TextStream& operator<<(TextStream&, const Color&);
+TextStream& operator<<(TextStream&, const IntPoint&);
+TextStream& operator<<(TextStream&, const FloatSize&);
+TextStream& operator<<(TextStream&, const FloatRect&);
+TextStream& operator<<(TextStream&, const FloatPoint&);
+
+// helper operators specific to dumping the render tree. these are used in various classes to dump the render tree
+// these could be defined in separate namespace to avoid matching these generic signatures unintentionally.
+
+template<typename Item>
+TextStream& operator<<(TextStream& ts, const Vector<Item*>& v)
+{
+ ts << "[";
+
+ for (unsigned i = 0; i < v.size(); i++) {
+ ts << *v[i];
+ if (i < v.size() - 1)
+ ts << ", ";
+ }
+
+ ts << "]";
+ return ts;
+}
+
+template<typename Item>
+TextStream& operator<<(TextStream& ts, const Vector<Item>& v)
+{
+ ts << "[";
+
+ for (unsigned i = 0; i < v.size(); i++) {
+ ts << v[i];
+ if (i < v.size() - 1)
+ ts << ", ";
+ }
+
+ ts << "]";
+ return ts;
+}
+
+template<typename Pointer>
+TextStream& operator<<(TextStream& ts, Pointer* t)
+{
+ ts << reinterpret_cast<intptr_t>(t);
+ return ts;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+
+#endif // SVGRenderTreeAsText_h
--- /dev/null
+/*
+ * This file is part of the WebKit project.
+ *
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>
+ * (C) 2006 Apple Computer Inc.
+ * (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef SVGRootInlineBox_h
+#define SVGRootInlineBox_h
+
+#if ENABLE(SVG)
+#include "RootInlineBox.h"
+#include "SVGCharacterLayoutInfo.h"
+
+namespace WebCore {
+
+class InlineTextBox;
+class RenderSVGRoot;
+class SVGInlineTextBox;
+
+struct LastGlyphInfo {
+ LastGlyphInfo() : isValid(false) { }
+
+ String unicode;
+ String glyphName;
+ bool isValid;
+};
+
+class SVGRootInlineBox : public RootInlineBox {
+public:
+ SVGRootInlineBox(RenderObject* obj)
+ : RootInlineBox(obj)
+ {
+ }
+
+ virtual bool isSVGRootInlineBox() { return true; }
+
+ virtual void paint(RenderObject::PaintInfo&, int tx, int ty);
+
+ virtual int placeBoxesHorizontally(int x, int& leftPosition, int& rightPosition, bool& needsWordSpacing);
+ virtual int verticallyAlignBoxes(int heightOfBlock);
+
+ virtual void computePerCharacterLayoutInformation();
+
+ // Used by SVGInlineTextBox
+ const Vector<SVGTextChunk>& svgTextChunks() const;
+
+ void walkTextChunks(SVGTextChunkWalkerBase*, const SVGInlineTextBox* textBox = 0);
+
+private:
+ friend struct SVGRootInlineBoxPaintWalker;
+
+ void layoutInlineBoxes();
+ void layoutInlineBoxes(InlineFlowBox* start, Vector<SVGChar>::iterator& it, int& minX, int& maxX, int& minY, int& maxY);
+
+ void buildLayoutInformation(InlineFlowBox* start, SVGCharacterLayoutInfo&);
+ void buildLayoutInformationForTextBox(SVGCharacterLayoutInfo&, InlineTextBox*, LastGlyphInfo&);
+
+ void buildTextChunks(Vector<SVGChar>&, Vector<SVGTextChunk>&, InlineFlowBox* start);
+ void buildTextChunks(Vector<SVGChar>&, InlineFlowBox* start, SVGTextChunkLayoutInfo&);
+ void layoutTextChunks();
+
+ SVGTextDecorationInfo retrievePaintServersForTextDecoration(RenderObject* start);
+
+private:
+ Vector<SVGChar> m_svgChars;
+ Vector<SVGTextChunk> m_svgTextChunks;
+};
+
+// Shared with SVGRenderTreeAsText / SVGInlineTextBox
+TextRun svgTextRunForInlineTextBox(const UChar*, int len, RenderStyle* style, const InlineTextBox* textBox, float xPos);
+FloatPoint topLeftPositionOfCharacterRange(Vector<SVGChar>::iterator start, Vector<SVGChar>::iterator end);
+float cummulatedWidthOfInlineBoxCharacterRange(SVGInlineBoxCharacterRange& range);
+float cummulatedHeightOfInlineBoxCharacterRange(SVGInlineBoxCharacterRange& range);
+
+RenderSVGRoot* findSVGRootObject(RenderObject* start);
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+
+#endif // SVGRootInlineBox_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ScaleTransformOperation_h
+#define ScaleTransformOperation_h
+
+#include "TransformOperation.h"
+
+namespace WebCore {
+
+class ScaleTransformOperation : public TransformOperation {
+public:
+ static PassRefPtr<ScaleTransformOperation> create(double sx, double sy, OperationType type)
+ {
+ return adoptRef(new ScaleTransformOperation(sx, sy, 1, type));
+ }
+
+ static PassRefPtr<ScaleTransformOperation> create(double sx, double sy, double sz, OperationType type)
+ {
+ return adoptRef(new ScaleTransformOperation(sx, sy, sz, type));
+ }
+
+ double x() const { return m_x; }
+ double y() const { return m_y; }
+ double z() const { return m_z; }
+
+private:
+ virtual bool isIdentity() const { return m_x == 1 && m_y == 1 && m_z == 1; }
+
+ virtual OperationType getOperationType() const { return m_type; }
+ virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == m_type; }
+
+ virtual bool operator==(const TransformOperation& o) const
+ {
+ if (!isSameType(o))
+ return false;
+ const ScaleTransformOperation* s = static_cast<const ScaleTransformOperation*>(&o);
+ return m_x == s->m_x && m_y == s->m_y && m_z == s->m_z;
+ }
+
+ virtual bool apply(TransformationMatrix& transform, const IntSize&) const
+ {
+ transform.scale3d(m_x, m_y, m_z);
+ return false;
+ }
+
+ virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
+
+ ScaleTransformOperation(double sx, double sy, double sz, OperationType type)
+ : m_x(sx)
+ , m_y(sy)
+ , m_z(sz)
+ , m_type(type)
+ {
+ ASSERT(type == SCALE_X || type == SCALE_Y || type == SCALE_Z || type == SCALE || type == SCALE_3D);
+ }
+
+ double m_x;
+ double m_y;
+ double m_z;
+ OperationType m_type;
+};
+
+} // namespace WebCore
+
+#endif // ScaleTransformOperation_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SchedulePair_h
+#define SchedulePair_h
+
+#include "PlatformString.h"
+#include <wtf/HashSet.h>
+#include <wtf/RetainPtr.h>
+
+#if PLATFORM(MAC)
+#ifdef __OBJC__
+@class NSRunLoop;
+#else
+class NSRunLoop;
+#endif
+#endif
+
+namespace WebCore {
+
+class SchedulePair : public RefCounted<SchedulePair> {
+public:
+ static PassRefPtr<SchedulePair> create(CFRunLoopRef runLoop, CFStringRef mode) { return adoptRef(new SchedulePair(runLoop, mode)); }
+
+#if PLATFORM(MAC)
+ static PassRefPtr<SchedulePair> create(NSRunLoop* runLoop, CFStringRef mode) { return adoptRef(new SchedulePair(runLoop, mode)); }
+ NSRunLoop* nsRunLoop() const { return m_nsRunLoop.get(); }
+#endif
+
+ CFRunLoopRef runLoop() const { return m_runLoop.get(); }
+ CFStringRef mode() const { return m_mode.get(); }
+
+ bool operator==(const SchedulePair& other) const;
+
+private:
+ SchedulePair(CFRunLoopRef, CFStringRef);
+
+#if PLATFORM(MAC)
+ SchedulePair(NSRunLoop*, CFStringRef);
+ RetainPtr<NSRunLoop*> m_nsRunLoop;
+#endif
+
+ RetainPtr<CFRunLoopRef> m_runLoop;
+ RetainPtr<CFStringRef> m_mode;
+};
+
+struct SchedulePairHash {
+ static unsigned hash(const RefPtr<SchedulePair>& pair)
+ {
+ uintptr_t hashCodes[2] = { reinterpret_cast<uintptr_t>(pair->runLoop()), pair->mode() ? CFHash(pair->mode()) : 0 };
+ return StringImpl::computeHash(reinterpret_cast<UChar*>(hashCodes), sizeof(hashCodes) / sizeof(UChar));
+ }
+
+ static bool equal(const RefPtr<SchedulePair>& a, const RefPtr<SchedulePair>& b) { return a == b; }
+
+ static const bool safeToCompareToEmptyOrDeleted = true;
+};
+
+typedef HashSet<RefPtr<SchedulePair>, SchedulePairHash> SchedulePairHashSet;
+
+} // namespace WebCore
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#ifndef Screen_h
+#define Screen_h
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+ class Frame;
+
+ class Screen : public RefCounted<Screen> {
+ public:
+ static PassRefPtr<Screen> create(Frame *frame) { return adoptRef(new Screen(frame)); }
+ void disconnectFrame();
+
+ unsigned height() const;
+ unsigned width() const;
+ unsigned colorDepth() const;
+ unsigned pixelDepth() const;
+ unsigned availLeft() const;
+ unsigned availTop() const;
+ unsigned availHeight() const;
+ unsigned availWidth() const;
+
+ private:
+ Screen(Frame*);
+
+ Frame* m_frame;
+ };
+
+} // namespace WebCore
+
+#endif // Screen_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ScriptElement_h
+#define ScriptElement_h
+
+#include "CachedResourceClient.h"
+#include "CachedResourceHandle.h"
+
+namespace WebCore {
+
+class CachedScript;
+class Element;
+class ScriptElementData;
+class ScriptSourceCode;
+
+class ScriptElement {
+public:
+ ScriptElement() { }
+ virtual ~ScriptElement() { }
+
+ virtual String scriptContent() const = 0;
+
+ virtual String sourceAttributeValue() const = 0;
+ virtual String charsetAttributeValue() const = 0;
+ virtual String typeAttributeValue() const = 0;
+ virtual String languageAttributeValue() const = 0;
+
+ virtual void dispatchLoadEvent() = 0;
+ virtual void dispatchErrorEvent() = 0;
+
+ // A charset for loading the script (may be overridden by HTTP headers or a BOM).
+ virtual String scriptCharset() const = 0;
+
+protected:
+ // Helper functions used by our parent classes.
+ static void insertedIntoDocument(ScriptElementData&, const String& sourceUrl);
+ static void removedFromDocument(ScriptElementData&);
+ static void childrenChanged(ScriptElementData&);
+ static void finishParsingChildren(ScriptElementData&, const String& sourceUrl);
+ static void handleSourceAttribute(ScriptElementData&, const String& sourceUrl);
+};
+
+// HTML/SVGScriptElement hold this struct as member variable
+// and pass it to the static helper functions in ScriptElement
+class ScriptElementData : private CachedResourceClient {
+public:
+ ScriptElementData(ScriptElement*, Element*);
+ virtual ~ScriptElementData();
+
+ bool ignoresLoadRequest() const;
+ bool shouldExecuteAsJavaScript() const;
+
+ String scriptContent() const;
+ String scriptCharset() const;
+
+ Element* element() const { return m_element; }
+ bool createdByParser() const { return m_createdByParser; }
+ void setCreatedByParser(bool value) { m_createdByParser = value; }
+ bool haveFiredLoadEvent() const { return m_firedLoad; }
+ void setHaveFiredLoadEvent(bool firedLoad) { m_firedLoad = firedLoad; }
+
+ void requestScript(const String& sourceUrl);
+ void evaluateScript(const ScriptSourceCode&);
+ void stopLoadRequest();
+
+private:
+ virtual void notifyFinished(CachedResource*);
+
+private:
+ ScriptElement* m_scriptElement;
+ Element* m_element;
+ CachedResourceHandle<CachedScript> m_cachedScript;
+ bool m_createdByParser;
+ bool m_evaluated;
+ bool m_firedLoad;
+};
+
+ScriptElement* toScriptElement(Element*);
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef ScriptExecutionContext_h
+#define ScriptExecutionContext_h
+
+#include "Console.h"
+#include "KURL.h"
+#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/Threading.h>
+
+namespace WebCore {
+
+ class ActiveDOMObject;
+ class MessagePort;
+ class SecurityOrigin;
+ class ScriptString;
+ class String;
+
+ enum MessageDestination {
+ ConsoleDestination,
+ };
+
+ class ScriptExecutionContext {
+ public:
+ ScriptExecutionContext();
+ virtual ~ScriptExecutionContext();
+
+ virtual bool isDocument() const { return false; }
+ virtual bool isWorkerContext() const { return false; }
+
+ const KURL& url() const { return virtualURL(); }
+ KURL completeURL(const String& url) const { return virtualCompleteURL(url); }
+
+ SecurityOrigin* securityOrigin() const { return m_securityOrigin.get(); }
+
+ virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL) = 0;
+ virtual void addMessage(MessageDestination, MessageSource, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL) = 0;
+ virtual void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString) = 0;
+
+ // Active objects are not garbage collected even if inaccessible, e.g. because their activity may result in callbacks being invoked.
+ bool canSuspendActiveDOMObjects();
+ // Active objects can be asked to suspend even if canSuspendActiveDOMObjects() returns 'false' -
+ // step-by-step JS debugging is one example.
+ void suspendActiveDOMObjects();
+ void resumeActiveDOMObjects();
+ void stopActiveDOMObjects();
+ void createdActiveDOMObject(ActiveDOMObject*, void* upcastPointer);
+ void destroyedActiveDOMObject(ActiveDOMObject*);
+ typedef const HashMap<ActiveDOMObject*, void*> ActiveDOMObjectsMap;
+ ActiveDOMObjectsMap& activeDOMObjects() const { return m_activeDOMObjects; }
+
+ // MessagePort is conceptually a kind of ActiveDOMObject, but it needs to be tracked separately for message dispatch.
+ void processMessagePortMessagesSoon();
+ void dispatchMessagePortEvents();
+ void createdMessagePort(MessagePort*);
+ void destroyedMessagePort(MessagePort*);
+ const HashSet<MessagePort*>& messagePorts() const { return m_messagePorts; }
+
+ void ref() { refScriptExecutionContext(); }
+ void deref() { derefScriptExecutionContext(); }
+
+ class Task : public ThreadSafeShared<Task> {
+ public:
+ virtual ~Task();
+ virtual void performTask(ScriptExecutionContext*) = 0;
+ };
+
+ virtual void postTask(PassRefPtr<Task>) = 0; // Executes the task on context's thread asynchronously.
+
+ protected:
+ // Explicitly override the security origin for this script context.
+ // Note: It is dangerous to change the security origin of a script context
+ // that already contains content.
+ void setSecurityOrigin(PassRefPtr<SecurityOrigin>);
+
+ private:
+ virtual const KURL& virtualURL() const = 0;
+ virtual KURL virtualCompleteURL(const String&) const = 0;
+
+ RefPtr<SecurityOrigin> m_securityOrigin;
+
+ HashSet<MessagePort*> m_messagePorts;
+
+ HashMap<ActiveDOMObject*, void*> m_activeDOMObjects;
+
+ virtual void refScriptExecutionContext() = 0;
+ virtual void derefScriptExecutionContext() = 0;
+ };
+
+} // namespace WebCore
+
+
+#endif // ScriptExecutionContext_h
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ScrollTypes_h
+#define ScrollTypes_h
+
+#ifdef __cplusplus
+
+namespace WebCore {
+
+ enum ScrollDirection {
+ ScrollUp,
+ ScrollDown,
+ ScrollLeft,
+ ScrollRight
+ };
+
+ enum ScrollGranularity {
+ ScrollByLine,
+ ScrollByPage,
+ ScrollByDocument,
+ ScrollByPixel
+ };
+
+ enum ScrollbarOrientation { HorizontalScrollbar, VerticalScrollbar };
+
+ enum ScrollbarMode { ScrollbarAuto, ScrollbarAlwaysOff, ScrollbarAlwaysOn };
+
+ enum ScrollbarControlSize { RegularScrollbar, SmallScrollbar };
+
+ typedef unsigned ScrollbarControlState;
+
+ enum ScrollbarControlStateMask {
+ ActiveScrollbarState = 1,
+ EnabledScrollbarState = 1 << 1,
+ PressedScrollbarState = 1 << 2,
+ };
+
+ enum ScrollbarPart {
+ NoPart = 0,
+ BackButtonStartPart = 1,
+ ForwardButtonStartPart = 1 << 1,
+ BackTrackPart = 1 << 2,
+ ThumbPart = 1 << 3,
+ ForwardTrackPart = 1 << 4,
+ BackButtonEndPart = 1 << 5,
+ ForwardButtonEndPart = 1 << 6,
+ ScrollbarBGPart = 1 << 7,
+ TrackBGPart = 1 << 8,
+ AllParts = 0xffffffff,
+ };
+
+ enum ScrollbarButtonsPlacement {
+ ScrollbarButtonsNone,
+ ScrollbarButtonsSingle,
+ ScrollbarButtonsDoubleStart,
+ ScrollbarButtonsDoubleEnd,
+ ScrollbarButtonsDoubleBoth
+ };
+
+ typedef unsigned ScrollbarControlPartMask;
+
+}
+
+#endif // __cplusplus
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ScrollView_h
+#define ScrollView_h
+
+#include "IntRect.h"
+#include "Scrollbar.h"
+#include "ScrollbarClient.h"
+#include "ScrollTypes.h"
+#include "Widget.h"
+
+#include <wtf/HashSet.h>
+
+#ifdef __OBJC__
+@class WAKScrollView;
+#else
+class WAKScrollView;
+#endif
+
+#ifndef NSView
+#define NSView WAKView
+#endif
+
+#if PLATFORM(MAC) && defined __OBJC__
+@protocol WebCoreFrameScrollView;
+#endif
+
+#if PLATFORM(GTK)
+typedef struct _GtkAdjustment GtkAdjustment;
+#endif
+
+#if PLATFORM(WX)
+class wxScrollWinEvent;
+#endif
+
+// DANGER WILL ROBINSON! THIS FILE IS UNDERGOING HEAVY REFACTORING.
+// Everything is changing!
+// Port authors should wait until this refactoring is complete before attempting to implement this interface.
+namespace WebCore {
+
+class HostWindow;
+class PlatformWheelEvent;
+class Scrollbar;
+
+class ScrollView : public Widget, public ScrollbarClient {
+public:
+ ScrollView();
+ ~ScrollView();
+
+ // ScrollbarClient method. FrameView overrides the other two.
+ virtual void valueChanged(Scrollbar*);
+
+ // The window thats hosts the ScrollView. The ScrollView will communicate scrolls and repaints to the
+ // host window in the window's coordinate space.
+ virtual HostWindow* hostWindow() const = 0;
+
+ // Returns a clip rect in host window coordinates. Used to clip the blit on a scroll.
+ virtual IntRect windowClipRect(bool clipToContents = true) const = 0;
+
+ // Methods for child manipulation and inspection.
+ const HashSet<Widget*>* children() const { return &m_children; }
+ void addChild(Widget*);
+ void removeChild(Widget*);
+
+ // If the scroll view does not use a native widget, then it will have cross-platform Scrollbars. These methods
+ // can be used to obtain those scrollbars.
+ Scrollbar* horizontalScrollbar() const { return m_horizontalScrollbar.get(); }
+ Scrollbar* verticalScrollbar() const { return m_verticalScrollbar.get(); }
+ bool isScrollViewScrollbar(const Widget* child) const { return horizontalScrollbar() == child || verticalScrollbar() == child; }
+
+ // Methods for setting and retrieving the scrolling mode in each axis (horizontal/vertical). The mode has values of
+ // AlwaysOff, AlwaysOn, and Auto. AlwaysOff means never show a scrollbar, AlwaysOn means always show a scrollbar.
+ // Auto means show a scrollbar only when one is needed.
+ // Note that for platforms with native widgets, these modes are considered advisory. In other words the underlying native
+ // widget may choose not to honor the requested modes.
+ void setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode verticalMode);
+ void setHorizontalScrollbarMode(ScrollbarMode mode) { setScrollbarModes(mode, verticalScrollbarMode()); }
+ void setVerticalScrollbarMode(ScrollbarMode mode) { setScrollbarModes(horizontalScrollbarMode(), mode); }
+ void scrollbarModes(ScrollbarMode& horizontalMode, ScrollbarMode& verticalMode) const;
+ ScrollbarMode horizontalScrollbarMode() const { ScrollbarMode horizontal, vertical; scrollbarModes(horizontal, vertical); return horizontal; }
+ ScrollbarMode verticalScrollbarMode() const { ScrollbarMode horizontal, vertical; scrollbarModes(horizontal, vertical); return vertical; }
+ virtual void setCanHaveScrollbars(bool flag);
+ bool canHaveScrollbars() const { return horizontalScrollbarMode() != ScrollbarAlwaysOff || verticalScrollbarMode() != ScrollbarAlwaysOff; }
+
+ // Overridden by FrameView to create custom CSS scrollbars if applicable.
+ virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation);
+
+ // If the prohibits scrolling flag is set, then all scrolling in the view (even programmatic scrolling) is turned off.
+ void setProhibitsScrolling(bool b) { m_prohibitsScrolling = b; }
+ bool prohibitsScrolling() const { return m_prohibitsScrolling; }
+
+ // Whether or not a scroll view will blit visible contents when it is scrolled. Blitting is disabled in situations
+ // where it would cause rendering glitches (such as with fixed backgrounds or when the view is partially transparent).
+ void setCanBlitOnScroll(bool);
+ bool canBlitOnScroll() const;
+
+ // The visible content rect has a location that is the scrolled offset of the document. The width and height are the viewport width
+ // and height. By default the scrollbars themselves are excluded from this rectangle, but an optional boolean argument allows them to be
+ // included.
+ IntRect visibleContentRect(bool includeScrollbars = false) const;
+ int visibleWidth() const { return visibleContentRect().width(); }
+ int visibleHeight() const { return visibleContentRect().height(); }
+ IntRect actualVisualContentRect() const;
+
+ // Methods for getting/setting the size webkit should use to layout the contents. By default this is the same as the visible
+ // content size. Explicitly setting a layout size value will cause webkit to layout the contents using this size instead.
+ int layoutWidth() const;
+ int layoutHeight() const;
+ IntSize fixedLayoutSize() const;
+ void setFixedLayoutSize(const IntSize&);
+ bool useFixedLayout() const;
+ void setUseFixedLayout(bool enable);
+
+ // Methods for getting/setting the size of the document contained inside the ScrollView (as an IntSize or as individual width and height
+ // values).
+ IntSize contentsSize() const;
+ int contentsWidth() const { return contentsSize().width(); }
+ int contentsHeight() const { return contentsSize().height(); }
+ virtual void setContentsSize(const IntSize&);
+
+ // Methods for querying the current scrolled position (both as a point, a size, or as individual X and Y values).
+ IntPoint scrollPosition() const { return visibleContentRect().location(); }
+ IntSize scrollOffset() const { return visibleContentRect().location() - IntPoint(); } // Gets the scrolled position as an IntSize. Convenient for adding to other sizes.
+ IntPoint maximumScrollPosition() const; // The maximum position we can be scrolled to.
+ int scrollX() const { return scrollPosition().x(); }
+ int scrollY() const { return scrollPosition().y(); }
+
+ // Methods for scrolling the view. setScrollPosition is the only method that really scrolls the view. The other two methods are helper functions
+ // that ultimately end up calling setScrollPosition.
+ void setScrollPosition(const IntPoint&);
+ void scrollBy(const IntSize& s) { return setScrollPosition(scrollPosition() + s); }
+ void scrollRectIntoViewRecursively(const IntRect&);
+
+ // This method scrolls by lines, pages or pixels.
+ bool scroll(ScrollDirection, ScrollGranularity);
+
+ // Scroll the actual contents of the view (either blitting or invalidating as needed).
+ void scrollContents(const IntSize& scrollDelta);
+
+ // This gives us a means of blocking painting on our scrollbars until the first layout has occurred.
+ void setScrollbarsSuppressed(bool suppressed, bool repaintOnUnsuppress = false);
+ bool scrollbarsSuppressed() const { return m_scrollbarsSuppressed; }
+
+ // Event coordinates are assumed to be in the coordinate space of a window that contains
+ // the entire widget hierarchy. It is up to the platform to decide what the precise definition
+ // of containing window is. (For example on Mac it is the containing NSWindow.)
+ IntPoint windowToContents(const IntPoint&) const;
+ IntPoint contentsToWindow(const IntPoint&) const;
+ IntRect windowToContents(const IntRect&) const;
+ IntRect contentsToWindow(const IntRect&) const;
+
+ // Methods for converting to and from screen coordinates.
+ IntRect contentsToScreen(const IntRect&) const;
+ IntPoint screenToContents(const IntPoint&) const;
+
+ // The purpose of this method is to answer whether or not the scroll view is currently visible. Animations and painting updates can be suspended if
+ // we know that we are either not in a window right now or if that window is not visible.
+ bool isOffscreen() const;
+
+ // These methods are used to enable scrollbars to avoid window resizer controls that overlap the scroll view. This happens on Mac
+ // for example.
+ virtual IntRect windowResizerRect() const { return IntRect(); }
+ bool containsScrollbarsAvoidingResizer() const;
+ void adjustScrollbarsAvoidingResizerCount(int overlapDelta);
+ virtual void setParent(ScrollView*); // Overridden to update the overlapping scrollbar count.
+
+ // Called when our frame rect changes (or the rect/scroll position of an ancestor changes).
+ virtual void frameRectsChanged();
+
+ // Widget override to update our scrollbars and notify our contents of the resize.
+ virtual void setFrameRect(const IntRect&);
+
+ // For platforms that need to hit test scrollbars from within the engine's event handlers (like Win32).
+ Scrollbar* scrollbarUnderMouse(const PlatformMouseEvent& mouseEvent);
+
+ // This method exists for scrollviews that need to handle wheel events manually.
+ // On Mac the underlying NSScrollView just does the scrolling, but on other platforms
+ // (like Windows), we need this method in order to do the scroll ourselves.
+ void wheelEvent(PlatformWheelEvent&);
+
+ IntPoint convertChildToSelf(const Widget* child, const IntPoint& point) const
+ {
+ IntPoint newPoint = point;
+ if (!isScrollViewScrollbar(child))
+ newPoint = point - scrollOffset();
+ newPoint.move(child->x(), child->y());
+ return newPoint;
+ }
+
+ IntPoint convertSelfToChild(const Widget* child, const IntPoint& point) const
+ {
+ IntPoint newPoint = point;
+ if (!isScrollViewScrollbar(child))
+ newPoint = point + scrollOffset();
+ newPoint.move(-child->x(), -child->y());
+ return newPoint;
+ }
+
+ // Widget override. Handles painting of the contents of the view as well as the scrollbars.
+ virtual void paint(GraphicsContext*, const IntRect&);
+
+ // Widget overrides to ensure that our children's visibility status is kept up to date when we get shown and hidden.
+ virtual void show();
+ virtual void hide();
+ virtual void setParentVisible(bool);
+
+ // Pan scrolling methods.
+ void addPanScrollIcon(const IntPoint&);
+ void removePanScrollIcon();
+
+ virtual bool scrollbarCornerPresent() const;
+
+protected:
+ virtual void repaintContentRectangle(const IntRect&, bool now = false);
+ virtual void paintContents(GraphicsContext*, const IntRect& damageRect) = 0;
+
+ virtual void contentsResized() = 0;
+ virtual void visibleContentsResized() = 0;
+
+ // These methods are used to create/destroy scrollbars.
+ void setHasHorizontalScrollbar(bool);
+ void setHasVerticalScrollbar(bool);
+
+private:
+ RefPtr<Scrollbar> m_horizontalScrollbar;
+ RefPtr<Scrollbar> m_verticalScrollbar;
+ ScrollbarMode m_horizontalScrollbarMode;
+ ScrollbarMode m_verticalScrollbarMode;
+ bool m_prohibitsScrolling;
+
+ HashSet<Widget*> m_children;
+
+ // This bool is unused on Mac OS because we directly ask the platform widget
+ // whether it is safe to blit on scroll.
+ bool m_canBlitOnScroll;
+
+ IntSize m_scrollOffset; // FIXME: Would rather store this as a position, but we will wait to make this change until more code is shared.
+ IntSize m_fixedLayoutSize;
+ IntSize m_contentsSize;
+
+ int m_scrollbarsAvoidingResizer;
+ bool m_scrollbarsSuppressed;
+
+ bool m_inUpdateScrollbars;
+
+ IntPoint m_panScrollIconPoint;
+ bool m_drawPanScrollIcon;
+ bool m_useFixedLayout;
+
+ void init();
+ void destroy();
+
+ // Called to update the scrollbars to accurately reflect the state of the view.
+ void updateScrollbars(const IntSize& desiredOffset);
+
+ void platformInit();
+ void platformDestroy();
+ void platformAddChild(Widget*);
+ void platformRemoveChild(Widget*);
+ void platformSetScrollbarModes();
+ void platformScrollbarModes(ScrollbarMode& horizontal, ScrollbarMode& vertical) const;
+ void platformSetCanBlitOnScroll(bool);
+ bool platformCanBlitOnScroll() const;
+ IntRect platformVisibleContentRect(bool includeScrollbars) const;
+ IntSize platformContentsSize() const;
+ void platformSetContentsSize();
+ IntRect platformContentsToScreen(const IntRect&) const;
+ IntPoint platformScreenToContents(const IntPoint&) const;
+ void platformSetScrollPosition(const IntPoint&);
+ bool platformScroll(ScrollDirection, ScrollGranularity);
+ void platformSetScrollbarsSuppressed(bool repaintOnUnsuppress);
+ void platformRepaintContentRectangle(const IntRect&, bool now);
+ bool platformIsOffscreen() const;
+ bool platformHandleHorizontalAdjustment(const IntSize&);
+ bool platformHandleVerticalAdjustment(const IntSize&);
+ bool platformHasHorizontalAdjustment() const;
+ bool platformHasVerticalAdjustment() const;
+
+#if PLATFORM(MAC) && defined __OBJC__
+public:
+ NSView* documentView() const;
+
+private:
+ NSScrollView<WebCoreFrameScrollView>* scrollView() const;
+#endif
+
+#if PLATFORM(QT)
+private:
+ bool rootPreventsBlitting() const { return root()->m_widgetsThatPreventBlitting > 0; }
+ unsigned m_widgetsThatPreventBlitting;
+#else
+ bool rootPreventsBlitting() const { return false; }
+#endif
+
+#if PLATFORM(GTK)
+public:
+ void setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj);
+ GtkAdjustment* m_horizontalAdjustment;
+ GtkAdjustment* m_verticalAdjustment;
+ void setScrollOffset(const IntSize& offset) { m_scrollOffset = offset; }
+#endif
+
+#if PLATFORM(WX)
+public:
+ virtual void setPlatformWidget(wxWindow*);
+ void adjustScrollbars(int x = -1, int y = -1, bool refresh = true);
+private:
+ class ScrollViewPrivate;
+ ScrollViewPrivate* m_data;
+#endif
+
+}; // class ScrollView
+
+} // namespace WebCore
+
+#endif // ScrollView_h
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Scrollbar_h
+#define Scrollbar_h
+
+#include <wtf/RefCounted.h>
+#include "ScrollTypes.h"
+#include "Timer.h"
+#include "Widget.h"
+#include <wtf/MathExtras.h>
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+class GraphicsContext;
+class IntRect;
+class ScrollbarClient;
+class ScrollbarTheme;
+class PlatformMouseEvent;
+
+// These match the numbers we use over in WebKit (WebFrameView.m).
+const int cScrollbarPixelsPerLineStep = 40;
+const float cMouseWheelPixelsPerLineStep = 40.0f / 3.0f;
+const int cAmountToKeepWhenPaging = 40;
+
+class Scrollbar : public Widget, public RefCounted<Scrollbar> {
+protected:
+ Scrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize, ScrollbarTheme* = 0);
+
+public:
+ virtual ~Scrollbar();
+
+ // Must be implemented by platforms that can't simply use the Scrollbar base class. Right now the only platform that is not using the base class is GTK.
+ static PassRefPtr<Scrollbar> createNativeScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize size);
+
+ void setClient(ScrollbarClient* client) { m_client = client; }
+ ScrollbarClient* client() const { return m_client; }
+
+ ScrollbarOrientation orientation() const { return m_orientation; }
+
+ int value() const { return lroundf(m_currentPos); }
+ float currentPos() const { return m_currentPos; }
+ int pressedPos() const { return m_pressedPos; }
+ int visibleSize() const { return m_visibleSize; }
+ int totalSize() const { return m_totalSize; }
+ int maximum() const { return m_totalSize - m_visibleSize; }
+ ScrollbarControlSize controlSize() const { return m_controlSize; }
+
+ int lineStep() const { return m_lineStep; }
+ int pageStep() const { return m_pageStep; }
+ float pixelStep() const { return m_pixelStep; }
+
+ ScrollbarPart pressedPart() const { return m_pressedPart; }
+ ScrollbarPart hoveredPart() const { return m_hoveredPart; }
+ virtual void setHoveredPart(ScrollbarPart);
+ virtual void setPressedPart(ScrollbarPart);
+
+ void setSteps(int lineStep, int pageStep, int pixelsPerStep = 1);
+ bool setValue(int);
+ void setProportion(int visibleSize, int totalSize);
+ void setPressedPos(int p) { m_pressedPos = p; }
+
+ bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1.0f);
+
+ virtual void paint(GraphicsContext*, const IntRect& damageRect);
+
+ bool enabled() const { return m_enabled; }
+ virtual void setEnabled(bool e);
+
+ bool isWindowActive() const;
+
+ // These methods are used for platform scrollbars to give :hover feedback. They will not get called
+ // when the mouse went down in a scrollbar, since it is assumed the scrollbar will start
+ // grabbing all events in that case anyway.
+ bool mouseExited();
+
+ // Used by some platform scrollbars to know when they've been released from capture.
+ bool mouseUp();
+
+ bool mouseDown(const PlatformMouseEvent&);
+
+#if PLATFORM(QT)
+ // For platforms that wish to handle context menu events.
+ // FIXME: This is misplaced. Normal hit testing should be used to populate a correct
+ // context menu. There's no reason why the scrollbar should have to do it.
+ bool contextMenu(const PlatformMouseEvent& event);
+#endif
+
+ // Takes an event and accounts for any transforms that might occur on the scrollbar. Returns
+ // a new event that has had all of the transforms applied.
+ PlatformMouseEvent transformEvent(const PlatformMouseEvent&);
+
+ ScrollbarTheme* theme() const { return m_theme; }
+
+ virtual void setParent(ScrollView*);
+ virtual void setFrameRect(const IntRect&);
+
+ virtual void invalidateRect(const IntRect&);
+
+ bool suppressInvalidation() const { return m_suppressInvalidation; }
+ void setSuppressInvalidation(bool s) { m_suppressInvalidation = s; }
+
+ virtual void styleChanged() { }
+
+protected:
+ virtual void updateThumbPosition();
+ virtual void updateThumbProportion();
+
+ void autoscrollTimerFired(Timer<Scrollbar>*);
+ void startTimerIfNeeded(double delay);
+ void stopTimerIfNeeded();
+ void autoscrollPressedPart(double delay);
+ ScrollDirection pressedPartScrollDirection();
+ ScrollGranularity pressedPartScrollGranularity();
+
+ void moveThumb(int pos);
+
+ ScrollbarClient* m_client;
+ ScrollbarOrientation m_orientation;
+ ScrollbarControlSize m_controlSize;
+ ScrollbarTheme* m_theme;
+
+ int m_visibleSize;
+ int m_totalSize;
+ float m_currentPos;
+ int m_lineStep;
+ int m_pageStep;
+ float m_pixelStep;
+
+ ScrollbarPart m_hoveredPart;
+ ScrollbarPart m_pressedPart;
+ int m_pressedPos;
+
+ bool m_enabled;
+
+ Timer<Scrollbar> m_scrollTimer;
+ bool m_overlapsResizer;
+
+ bool m_suppressInvalidation;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ScrollbarClient_h
+#define ScrollbarClient_h
+
+#include "IntRect.h"
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class Scrollbar;
+
+class ScrollbarClient {
+public:
+ virtual ~ScrollbarClient() {}
+ virtual void valueChanged(Scrollbar*) = 0;
+
+ virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) = 0;
+
+ virtual bool isActive() const = 0;
+
+ virtual bool scrollbarCornerPresent() const = 0;
+
+ virtual void getTickmarks(Vector<IntRect>&) const { }
+};
+
+}
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ScrollbarTheme_h
+#define ScrollbarTheme_h
+
+#include "GraphicsContext.h"
+#include "IntRect.h"
+#include "ScrollTypes.h"
+
+namespace WebCore {
+
+class PlatformMouseEvent;
+class Scrollbar;
+class ScrollView;
+
+class ScrollbarTheme {
+public:
+ virtual ~ScrollbarTheme() {};
+
+ virtual bool paint(Scrollbar*, GraphicsContext*, const IntRect& /*damageRect*/) { return false; }
+ virtual ScrollbarPart hitTest(Scrollbar*, const PlatformMouseEvent&) { return NoPart; }
+
+ virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar) { return 0; }
+
+ virtual ScrollbarButtonsPlacement buttonsPlacement() const { return ScrollbarButtonsSingle; }
+
+ virtual bool supportsControlTints() const { return false; }
+
+ virtual void themeChanged() {}
+
+ virtual bool invalidateOnMouseEnterExit() { return false; }
+
+ void invalidateParts(Scrollbar* scrollbar, ScrollbarControlPartMask mask)
+ {
+ if (mask & BackButtonStartPart)
+ invalidatePart(scrollbar, BackButtonStartPart);
+ if (mask & ForwardButtonStartPart)
+ invalidatePart(scrollbar, ForwardButtonStartPart);
+ if (mask & BackTrackPart)
+ invalidatePart(scrollbar, BackTrackPart);
+ if (mask & ThumbPart)
+ invalidatePart(scrollbar, ThumbPart);
+ if (mask & ForwardTrackPart)
+ invalidatePart(scrollbar, ForwardTrackPart);
+ if (mask & BackButtonEndPart)
+ invalidatePart(scrollbar, BackButtonEndPart);
+ if (mask & ForwardButtonEndPart)
+ invalidatePart(scrollbar, ForwardButtonEndPart);
+ }
+
+ virtual void invalidatePart(Scrollbar*, ScrollbarPart) {}
+
+ virtual void paintScrollCorner(ScrollView*, GraphicsContext* context, const IntRect& cornerRect) { context->fillRect(cornerRect, Color::white); }
+
+ virtual bool shouldCenterOnThumb(Scrollbar*, const PlatformMouseEvent&) { return false; }
+ virtual int thumbPosition(Scrollbar*) { return 0; } // The position of the thumb relative to the track.
+ virtual int thumbLength(Scrollbar*) { return 0; } // The length of the thumb along the axis of the scrollbar.
+ virtual int trackPosition(Scrollbar*) { return 0; } // The position of the track relative to the scrollbar.
+ virtual int trackLength(Scrollbar*) { return 0; } // The length of the track along the axis of the scrollbar.
+
+ virtual double initialAutoscrollTimerDelay() { return 0.25; }
+ virtual double autoscrollTimerDelay() { return 0.05; }
+
+ virtual void registerScrollbar(Scrollbar*) {}
+ virtual void unregisterScrollbar(Scrollbar*) {}
+
+ static ScrollbarTheme* nativeTheme(); // Must be implemented to return the correct theme subclass.
+};
+
+}
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ScrollbarThemeComposite_h
+#define ScrollbarThemeComposite_h
+
+#include "ScrollbarTheme.h"
+
+namespace WebCore {
+
+class ScrollbarThemeComposite : public ScrollbarTheme {
+public:
+ virtual bool paint(Scrollbar*, GraphicsContext* context, const IntRect& damageRect);
+
+ virtual ScrollbarPart hitTest(Scrollbar*, const PlatformMouseEvent&);
+
+ virtual void invalidatePart(Scrollbar*, ScrollbarPart);
+
+ virtual int thumbPosition(Scrollbar*);
+ virtual int thumbLength(Scrollbar*);
+ virtual int trackPosition(Scrollbar*);
+ virtual int trackLength(Scrollbar*);
+
+ virtual void paintScrollCorner(ScrollView*, GraphicsContext*, const IntRect& cornerRect);
+
+protected:
+ virtual bool hasButtons(Scrollbar*) = 0;
+ virtual bool hasThumb(Scrollbar*) = 0;
+
+ virtual IntRect backButtonRect(Scrollbar*, ScrollbarPart, bool painting = false) = 0;
+ virtual IntRect forwardButtonRect(Scrollbar*, ScrollbarPart, bool painting = false) = 0;
+ virtual IntRect trackRect(Scrollbar*, bool painting = false) = 0;
+
+ virtual void splitTrack(Scrollbar*, const IntRect& track, IntRect& startTrack, IntRect& thumb, IntRect& endTrack);
+
+ virtual int minimumThumbLength(Scrollbar*);
+
+ virtual void paintScrollbarBackground(GraphicsContext*, Scrollbar*) {}
+ virtual void paintTrackBackground(GraphicsContext*, Scrollbar*, const IntRect&) {}
+ virtual void paintTrackPiece(GraphicsContext*, Scrollbar*, const IntRect&, ScrollbarPart) {}
+ virtual void paintButton(GraphicsContext*, Scrollbar*, const IntRect&, ScrollbarPart) {}
+ virtual void paintThumb(GraphicsContext*, Scrollbar*, const IntRect&) {}
+ virtual void paintTickmarks(GraphicsContext*, Scrollbar*, const IntRect&) {}
+
+ virtual IntRect constrainTrackRectToTrackPieces(Scrollbar*, const IntRect& rect) { return rect; }
+};
+
+}
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef SearchPopupMenu_h
+#define SearchPopupMenu_h
+
+#include "PopupMenu.h"
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class AtomicString;
+
+class SearchPopupMenu : public PopupMenu {
+public:
+ static PassRefPtr<SearchPopupMenu> create(PopupMenuClient* client) { return adoptRef(new SearchPopupMenu(client)); }
+
+ void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems);
+ void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems);
+
+ bool enabled();
+
+private:
+ SearchPopupMenu(PopupMenuClient*);
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007,2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SecurityOrigin_h
+#define SecurityOrigin_h
+
+#include <wtf/RefCounted.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/Threading.h>
+
+#include "PlatformString.h"
+
+namespace WebCore {
+
+ class KURL;
+
+ class SecurityOrigin : public ThreadSafeShared<SecurityOrigin> {
+ public:
+ static PassRefPtr<SecurityOrigin> createFromDatabaseIdentifier(const String&);
+ static PassRefPtr<SecurityOrigin> createFromString(const String&);
+ static PassRefPtr<SecurityOrigin> create(const KURL&);
+ static PassRefPtr<SecurityOrigin> createEmpty();
+
+ // Create a deep copy of this SecurityOrigin. This method is useful
+ // when marshalling a SecurityOrigin to another thread.
+ PassRefPtr<SecurityOrigin> copy();
+
+ // Set the domain property of this security origin to newDomain. This
+ // function does not check whether newDomain is a suffix of the current
+ // domain. The caller is responsible for validating newDomain.
+ void setDomainFromDOM(const String& newDomain);
+ bool domainWasSetInDOM() const { return m_domainWasSetInDOM; }
+
+ String protocol() const { return m_protocol; }
+ String host() const { return m_host; }
+ String domain() const { return m_domain; }
+ unsigned short port() const { return m_port; }
+
+ // Returns true if this SecurityOrigin can script objects in the given
+ // SecurityOrigin. For example, call this function before allowing
+ // script from one security origin to read or write objects from
+ // another SecurityOrigin.
+ bool canAccess(const SecurityOrigin*) const;
+
+ // Returns true if this SecurityOrigin can read content retrieved from
+ // the given URL. For example, call this function before issuing
+ // XMLHttpRequests.
+ bool canRequest(const KURL&) const;
+
+ // Returns true if this SecurityOrigin can load local resources, such
+ // as images, iframes, and style sheets, and can link to local URLs.
+ // For example, call this function before creating an iframe to a
+ // file:// URL.
+ //
+ // Note: A SecurityOrigin might be allowed to load local resources
+ // without being able to issue an XMLHttpRequest for a local URL.
+ // To determine whether the SecurityOrigin can issue an
+ // XMLHttpRequest for a URL, call canRequest(url).
+ bool canLoadLocalResources() const { return m_canLoadLocalResources; }
+
+ // Explicitly grant the ability to load local resources to this
+ // SecurityOrigin.
+ //
+ // Note: This method exists only to support backwards compatibility
+ // with older versions of WebKit.
+ void grantLoadLocalResources();
+
+ bool isSecureTransitionTo(const KURL&) const;
+
+ // The local SecurityOrigin is the most privileged SecurityOrigin.
+ // The local SecurityOrigin can script any document, navigate to local
+ // resources, and can set arbitrary headers on XMLHttpRequests.
+ bool isLocal() const;
+
+ // The empty SecurityOrigin is the least privileged SecurityOrigin.
+ bool isEmpty() const;
+
+ // Convert this SecurityOrigin into a string. The string
+ // representation of a SecurityOrigin is similar to a URL, except it
+ // lacks a path component. The string representation does not encode
+ // the value of the SecurityOrigin's domain property. The empty
+ // SecurityOrigin is represented with the string "null".
+ String toString() const;
+
+ // Serialize the security origin for storage in the database. This format is
+ // deprecated and should be used only for compatibility with old databases;
+ // use toString() and createFromString() instead.
+ String databaseIdentifier() const;
+
+ // This method checks for equality between SecurityOrigins, not whether
+ // one origin can access another. It is used for hash table keys.
+ // For access checks, use canAccess().
+ // FIXME: If this method is really only useful for hash table keys, it
+ // should be refactored into SecurityOriginHash.
+ bool equal(const SecurityOrigin*) const;
+
+ // This method checks for equality, ignoring the value of document.domain
+ // (and whether it was set) but considering the host. It is used for postMessage.
+ bool isSameSchemeHostPort(const SecurityOrigin*) const;
+
+ private:
+ explicit SecurityOrigin(const KURL&);
+ explicit SecurityOrigin(const SecurityOrigin*);
+
+ String m_protocol;
+ String m_host;
+ String m_domain;
+ unsigned short m_port;
+ bool m_noAccess;
+ bool m_domainWasSetInDOM;
+ bool m_canLoadLocalResources;
+ };
+
+} // namespace WebCore
+
+#endif // SecurityOrigin_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SecurityOriginHash_h
+#define SecurityOriginHash_h
+
+#include "KURL.h"
+#include "SecurityOrigin.h"
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+struct SecurityOriginHash {
+ static unsigned hash(SecurityOrigin* origin)
+ {
+ unsigned hashCodes[3] = {
+ origin->protocol().impl() ? origin->protocol().impl()->hash() : 0,
+ origin->host().impl() ? origin->host().impl()->hash() : 0,
+ origin->port()
+ };
+ return StringImpl::computeHash(reinterpret_cast<UChar*>(hashCodes), sizeof(hashCodes) / sizeof(UChar));
+ }
+ static unsigned hash(const RefPtr<SecurityOrigin>& origin)
+ {
+ return hash(origin.get());
+ }
+
+ static bool equal(SecurityOrigin* a, SecurityOrigin* b)
+ {
+ // FIXME: The hash function above compares three specific fields.
+ // This code to compare those three specific fields should be moved here from
+ // SecurityOrigin as mentioned in SecurityOrigin.h so we don't accidentally change
+ // equal without changing hash to match it.
+ if (!a || !b)
+ return a == b;
+ return a->equal(b);
+ }
+ static bool equal(SecurityOrigin* a, const RefPtr<SecurityOrigin>& b)
+ {
+ return equal(a, b.get());
+ }
+ static bool equal(const RefPtr<SecurityOrigin>& a, SecurityOrigin* b)
+ {
+ return equal(a.get(), b);
+ }
+ static bool equal(const RefPtr<SecurityOrigin>& a, const RefPtr<SecurityOrigin>& b)
+ {
+ return equal(a.get(), b.get());
+ }
+
+ static const bool safeToCompareToEmptyOrDeleted = false;
+};
+
+} // namespace WebCore
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SegmentedFontData_h
+#define SegmentedFontData_h
+
+#include "FontData.h"
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class SimpleFontData;
+
+struct FontDataRange {
+ FontDataRange(UChar32 from, UChar32 to, const SimpleFontData* fontData)
+ : m_from(from)
+ , m_to(to)
+ , m_fontData(fontData)
+ {
+ }
+
+ UChar32 from() const { return m_from; }
+ UChar32 to() const { return m_to; }
+ const SimpleFontData* fontData() const { return m_fontData; }
+
+private:
+ UChar32 m_from;
+ UChar32 m_to;
+ const SimpleFontData* m_fontData;
+};
+
+class SegmentedFontData : public FontData {
+public:
+ virtual ~SegmentedFontData();
+
+ void appendRange(const FontDataRange& range) { m_ranges.append(range); }
+ unsigned numRanges() const { return m_ranges.size(); }
+ const FontDataRange& rangeAt(unsigned i) const { return m_ranges[i]; }
+
+private:
+ virtual const SimpleFontData* fontDataForCharacter(UChar32) const;
+ virtual bool containsCharacters(const UChar*, int length) const;
+
+ virtual bool isCustomFont() const;
+ virtual bool isLoading() const;
+ virtual bool isSegmented() const;
+
+ bool containsCharacter(UChar32) const;
+
+ Vector<FontDataRange, 1> m_ranges;
+};
+
+} // namespace WebCore
+
+#endif // SegmentedFontData_h
--- /dev/null
+/*
+ Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef SegmentedString_h
+#define SegmentedString_h
+
+#include "PlatformString.h"
+#include <wtf/Deque.h>
+
+namespace WebCore {
+
+class SegmentedString;
+
+class SegmentedSubstring {
+public:
+ SegmentedSubstring() : m_length(0), m_current(0), m_doNotExcludeLineNumbers(true) {}
+ SegmentedSubstring(const String& str)
+ : m_length(str.length())
+ , m_current(str.isEmpty() ? 0 : str.characters())
+ , m_string(str)
+ , m_doNotExcludeLineNumbers(true)
+ {
+ }
+
+ SegmentedSubstring(const UChar* str, int length) : m_length(length), m_current(length == 0 ? 0 : str), m_doNotExcludeLineNumbers(true) {}
+
+ void clear() { m_length = 0; m_current = 0; }
+
+ bool excludeLineNumbers() const { return !m_doNotExcludeLineNumbers; }
+ bool doNotExcludeLineNumbers() const { return m_doNotExcludeLineNumbers; }
+
+ void setExcludeLineNumbers() { m_doNotExcludeLineNumbers = false; }
+
+ void appendTo(String& str) const
+ {
+ if (m_string.characters() == m_current) {
+ if (str.isEmpty())
+ str = m_string;
+ else
+ str.append(m_string);
+ } else {
+ str.append(String(m_current, m_length));
+ }
+ }
+
+public:
+ int m_length;
+ const UChar* m_current;
+
+private:
+ String m_string;
+ bool m_doNotExcludeLineNumbers;
+};
+
+class SegmentedString {
+public:
+ SegmentedString()
+ : m_pushedChar1(0), m_pushedChar2(0), m_currentChar(0), m_composite(false) {}
+ SegmentedString(const UChar* str, int length) : m_pushedChar1(0), m_pushedChar2(0)
+ , m_currentString(str, length), m_currentChar(m_currentString.m_current), m_composite(false) {}
+ SegmentedString(const String& str)
+ : m_pushedChar1(0), m_pushedChar2(0), m_currentString(str)
+ , m_currentChar(m_currentString.m_current), m_composite(false) {}
+ SegmentedString(const SegmentedString&);
+
+ const SegmentedString& operator=(const SegmentedString&);
+
+ void clear();
+
+ void append(const SegmentedString&);
+ void prepend(const SegmentedString&);
+
+ bool excludeLineNumbers() const { return m_currentString.excludeLineNumbers(); }
+ void setExcludeLineNumbers();
+
+ void push(UChar c)
+ {
+ if (!m_pushedChar1) {
+ m_pushedChar1 = c;
+ m_currentChar = m_pushedChar1 ? &m_pushedChar1 : m_currentString.m_current;
+ } else {
+ ASSERT(!m_pushedChar2);
+ m_pushedChar2 = c;
+ }
+ }
+
+ bool isEmpty() const { return !current(); }
+ unsigned length() const;
+
+ void advance()
+ {
+ if (!m_pushedChar1 && m_currentString.m_length > 1) {
+ --m_currentString.m_length;
+ m_currentChar = ++m_currentString.m_current;
+ return;
+ }
+ advanceSlowCase();
+ }
+
+ void advancePastNewline(int& lineNumber)
+ {
+ ASSERT(*current() == '\n');
+ if (!m_pushedChar1 && m_currentString.m_length > 1) {
+ lineNumber += m_currentString.doNotExcludeLineNumbers();
+ --m_currentString.m_length;
+ m_currentChar = ++m_currentString.m_current;
+ return;
+ }
+ advanceSlowCase(lineNumber);
+ }
+
+ void advancePastNonNewline()
+ {
+ ASSERT(*current() != '\n');
+ if (!m_pushedChar1 && m_currentString.m_length > 1) {
+ --m_currentString.m_length;
+ m_currentChar = ++m_currentString.m_current;
+ return;
+ }
+ advanceSlowCase();
+ }
+
+ void advance(int& lineNumber)
+ {
+ if (!m_pushedChar1 && m_currentString.m_length > 1) {
+ lineNumber += (*m_currentString.m_current == '\n') & m_currentString.doNotExcludeLineNumbers();
+ --m_currentString.m_length;
+ m_currentChar = ++m_currentString.m_current;
+ return;
+ }
+ advanceSlowCase(lineNumber);
+ }
+
+ bool escaped() const { return m_pushedChar1; }
+
+ String toString() const;
+
+ const UChar& operator*() const { return *current(); }
+ const UChar* operator->() const { return current(); }
+
+private:
+ void append(const SegmentedSubstring&);
+ void prepend(const SegmentedSubstring&);
+
+ void advanceSlowCase();
+ void advanceSlowCase(int& lineNumber);
+ void advanceSubstring();
+ const UChar* current() const { return m_currentChar; }
+
+ UChar m_pushedChar1;
+ UChar m_pushedChar2;
+ SegmentedSubstring m_currentString;
+ const UChar* m_currentChar;
+ Deque<SegmentedSubstring> m_substrings;
+ bool m_composite;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Selection_h
+#define Selection_h
+
+#include "TextGranularity.h"
+#include "VisiblePosition.h"
+
+namespace WebCore {
+
+class Position;
+
+const EAffinity SEL_DEFAULT_AFFINITY = DOWNSTREAM;
+
+class Selection {
+public:
+ enum EState { NONE, CARET, RANGE };
+ enum EDirection { FORWARD, BACKWARD, RIGHT, LEFT };
+
+ Selection();
+
+ Selection(const Position&, EAffinity);
+ Selection(const Position&, const Position&, EAffinity = SEL_DEFAULT_AFFINITY);
+
+ Selection(const Range*, EAffinity = SEL_DEFAULT_AFFINITY);
+
+ Selection(const VisiblePosition&);
+ Selection(const VisiblePosition&, const VisiblePosition&);
+
+ static Selection selectionFromContentsOfNode(Node*);
+
+ EState state() const { return m_state; }
+
+ void setAffinity(EAffinity affinity) { m_affinity = affinity; }
+ EAffinity affinity() const { return m_affinity; }
+
+ void setBase(const Position&);
+ void setBase(const VisiblePosition&);
+ void setExtent(const Position&);
+ void setExtent(const VisiblePosition&);
+
+ Position base() const { return m_base; }
+ Position extent() const { return m_extent; }
+ Position start() const { return m_start; }
+ Position end() const { return m_end; }
+
+ VisiblePosition visibleStart() const { return VisiblePosition(m_start, isRange() ? DOWNSTREAM : affinity()); }
+ VisiblePosition visibleEnd() const { return VisiblePosition(m_end, isRange() ? UPSTREAM : affinity()); }
+
+ bool isNone() const { return state() == NONE; }
+ bool isCaret() const { return state() == CARET; }
+ bool isRange() const { return state() == RANGE; }
+ bool isCaretOrRange() const { return state() != NONE; }
+
+ bool isBaseFirst() const { return m_baseIsFirst; }
+
+ void appendTrailingWhitespace();
+
+ bool expandUsingGranularity(TextGranularity granularity);
+ TextGranularity granularity() const { return m_granularity; }
+
+ PassRefPtr<Range> toRange() const;
+
+ Element* rootEditableElement() const;
+ bool isContentEditable() const;
+ bool isContentRichlyEditable() const;
+ Node* shadowTreeRootNode() const;
+
+ void debugPosition() const;
+
+#ifndef NDEBUG
+ void formatForDebugger(char* buffer, unsigned length) const;
+ void showTreeForThis() const;
+#endif
+
+ void setWithoutValidation(const Position&, const Position&);
+
+private:
+ void validate();
+ void adjustForEditableContent();
+
+ Position m_base; // base position for the selection
+ Position m_extent; // extent position for the selection
+ Position m_start; // start position for the selection
+ Position m_end; // end position for the selection
+
+ EAffinity m_affinity; // the upstream/downstream affinity of the caret
+ TextGranularity m_granularity; // granularity of start/end selection
+
+ // these are cached, can be recalculated by validate()
+ EState m_state; // the state of the selection
+ bool m_baseIsFirst; // true if base is before the extent
+};
+
+inline bool operator==(const Selection& a, const Selection& b)
+{
+ return a.start() == b.start() && a.end() == b.end() && a.affinity() == b.affinity() && a.granularity() == b.granularity() && a.isBaseFirst() == b.isBaseFirst();
+}
+
+inline bool operator!=(const Selection& a, const Selection& b)
+{
+ return !(a == b);
+}
+
+} // namespace WebCore
+
+#ifndef NDEBUG
+// Outside the WebCore namespace for ease of invocation from gdb.
+void showTree(const WebCore::Selection&);
+void showTree(const WebCore::Selection*);
+#endif
+
+#endif // Selection_h
--- /dev/null
+/*
+ * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SelectionController_h
+#define SelectionController_h
+
+#include "IntRect.h"
+#include "Selection.h"
+#include "Range.h"
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+class Frame;
+class GraphicsContext;
+class RenderObject;
+class VisiblePosition;
+
+class SelectionController : Noncopyable {
+public:
+ enum EAlteration { MOVE, EXTEND };
+ enum EDirection { FORWARD, BACKWARD, RIGHT, LEFT };
+
+ SelectionController(Frame* = 0, bool isDragCaretController = false);
+
+ Element* rootEditableElement() const { return m_sel.rootEditableElement(); }
+ bool isContentEditable() const { return m_sel.isContentEditable(); }
+ bool isContentRichlyEditable() const { return m_sel.isContentRichlyEditable(); }
+ Node* shadowTreeRootNode() const { return m_sel.shadowTreeRootNode(); }
+
+ void moveTo(const Range*, EAffinity, bool userTriggered = false);
+ void moveTo(const VisiblePosition&, bool userTriggered = false);
+ void moveTo(const VisiblePosition&, const VisiblePosition&, bool userTriggered = false);
+ void moveTo(const Position&, EAffinity, bool userTriggered = false);
+ void moveTo(const Position&, const Position&, EAffinity, bool userTriggered = false);
+
+ const Selection& selection() const { return m_sel; }
+ void setSelection(const Selection&, bool closeTyping = true, bool clearTypingStyle = true, bool userTriggered = false);
+ bool setSelectedRange(Range*, EAffinity, bool closeTyping);
+ void selectAll();
+ void clear();
+
+ // Call this after doing user-triggered selections to make it easy to delete the frame you entirely selected.
+ void selectFrameElementInParentIfFullySelected();
+
+ bool contains(const IntPoint&);
+
+ Selection::EState state() const { return m_sel.state(); }
+
+ EAffinity affinity() const { return m_sel.affinity(); }
+
+ bool modify(EAlteration, EDirection, TextGranularity, bool userTriggered = false);
+ bool modify(EAlteration, int verticalDistance, bool userTriggered = false);
+ bool expandUsingGranularity(TextGranularity);
+
+ void setBase(const VisiblePosition&, bool userTriggered = false);
+ void setBase(const Position&, EAffinity, bool userTriggered = false);
+ void setExtent(const VisiblePosition&, bool userTriggered = false);
+ void setExtent(const Position&, EAffinity, bool userTriggered = false);
+
+ Position base() const { return m_sel.base(); }
+ Position extent() const { return m_sel.extent(); }
+ Position start() const { return m_sel.start(); }
+ Position end() const { return m_sel.end(); }
+
+ // Return the renderer that is responsible for painting the caret (in the selection start node)
+ RenderObject* caretRenderer() const;
+
+ // Caret rect local to the caret's renderer
+ IntRect localCaretRect() const;
+ // Bounds of (possibly transformed) caret in absolute coords
+ IntRect absoluteCaretBounds();
+ void setNeedsLayout(bool flag = true);
+
+ void setLastChangeWasHorizontalExtension(bool b) { m_lastChangeWasHorizontalExtension = b; }
+ void willBeModified(EAlteration, EDirection);
+
+ bool isNone() const { return m_sel.isNone(); }
+ bool isCaret() const { return m_sel.isCaret(); }
+ bool isRange() const { return m_sel.isRange(); }
+ bool isCaretOrRange() const { return m_sel.isCaretOrRange(); }
+ bool isInPasswordField() const;
+
+ PassRefPtr<Range> toRange() const { return m_sel.toRange(); }
+
+ void debugRenderer(RenderObject*, bool selected) const;
+
+ void nodeWillBeRemoved(Node*);
+
+ bool recomputeCaretRect(); // returns true if caret rect moved
+ void invalidateCaretRect();
+ void paintCaret(GraphicsContext*, int tx, int ty, const IntRect& clipRect);
+
+ // Used to suspend caret blinking while the mouse is down.
+ void setCaretBlinkingSuspended(bool suspended) { m_isCaretBlinkingSuspended = suspended; }
+ bool isCaretBlinkingSuspended() const { return m_isCaretBlinkingSuspended; }
+
+ // Focus
+ void setFocused(bool);
+ bool isFocusedAndActive() const;
+ void pageActivationChanged();
+
+#ifndef NDEBUG
+ void formatForDebugger(char* buffer, unsigned length) const;
+ void showTreeForThis() const;
+#endif
+
+public:
+ void expandSelectionToElementContainingCaretSelection();
+ PassRefPtr<Range> elementRangeContainingCaretSelection() const;
+ void expandSelectionToWordContainingCaretSelection();
+ PassRefPtr<Range> wordRangeContainingCaretSelection();
+ void expandSelectionToStartOfWordContainingCaretSelection();
+ UChar characterInRelationToCaretSelection(int amount) const;
+ UChar characterBeforeCaretSelection() const;
+ UChar characterAfterCaretSelection() const;
+ int wordOffsetInRange(const Range *range) const;
+ bool spaceFollowsWordInRange(const Range * range) const;
+ bool selectionAtDocumentStart() const;
+ bool selectionAtSentenceStart() const;
+ bool selectionAtWordStart() const;
+ bool rangeAtSentenceStart(const Range *range) const;
+ PassRefPtr<Range> rangeByMovingCurrentSelection(int amount) const;
+ PassRefPtr<Range> rangeByExtendingCurrentSelection(int amount) const;
+ void selectRangeOnElement(unsigned int location, unsigned int length, Node* node);
+ bool selectionIsCaretInDisplayBlockElementAtOffset(int offset) const;
+ void suppressCloseTyping() { ++m_closeTypingSuppressions; }
+ void restoreCloseTyping() { --m_closeTypingSuppressions; }
+private:
+ static Selection wordSelectionContainingCaretSelection(const Selection&);
+ bool _selectionAtSentenceStart(const Selection& sel) const;
+ PassRefPtr<Range> _rangeByAlteringCurrentSelection(EAlteration alteration, int amount) const;
+
+private:
+ enum EPositionType { START, END, BASE, EXTENT };
+
+ VisiblePosition modifyExtendingRightForward(TextGranularity);
+ VisiblePosition modifyMovingRight(TextGranularity);
+ VisiblePosition modifyMovingForward(TextGranularity);
+ VisiblePosition modifyExtendingLeftBackward(TextGranularity);
+ VisiblePosition modifyMovingLeft(TextGranularity);
+ VisiblePosition modifyMovingBackward(TextGranularity);
+
+ void layout();
+ IntRect caretRepaintRect() const;
+
+ int xPosForVerticalArrowNavigation(EPositionType);
+
+#if PLATFORM(MAC)
+ void notifyAccessibilityForSelectionChange();
+#else
+ void notifyAccessibilityForSelectionChange() {};
+#endif
+
+ void focusedOrActiveStateChanged();
+ bool caretRendersInsideNode(Node*) const;
+
+ IntRect absoluteBoundsForLocalRect(const IntRect&) const;
+
+ Frame* m_frame;
+ int m_xPosForVerticalArrowNavigation;
+
+ Selection m_sel;
+
+ IntRect m_caretRect; // caret rect in coords local to the renderer responsible for painting the caret
+ IntRect m_absCaretBounds; // absolute bounding rect for the caret
+ IntRect m_absoluteCaretRepaintBounds;
+
+ bool m_needsLayout : 1; // true if the caret and expectedVisible rectangles need to be calculated
+ bool m_absCaretBoundsDirty: 1;
+ bool m_lastChangeWasHorizontalExtension : 1;
+ bool m_isDragCaretController : 1;
+ bool m_isCaretBlinkingSuspended : 1;
+ bool m_focused : 1;
+
+ int m_closeTypingSuppressions;
+};
+
+inline bool operator==(const SelectionController& a, const SelectionController& b)
+{
+ return a.start() == b.start() && a.end() == b.end() && a.affinity() == b.affinity();
+}
+
+inline bool operator!=(const SelectionController& a, const SelectionController& b)
+{
+ return !(a == b);
+}
+
+} // namespace WebCore
+
+#ifndef NDEBUG
+// Outside the WebCore namespace for ease of invocation from gdb.
+void showTree(const WebCore::SelectionController&);
+void showTree(const WebCore::SelectionController*);
+#endif
+
+#endif // SelectionController_h
--- /dev/null
+/*
+ * SelectionRect.h
+ * WebCore
+ *
+ * Copyright (C) 2009, Apple Inc. All rights reserved.
+ *
+ */
+
+#ifndef SelectionRect_h
+#define SelectionRect_h
+
+#include "IntRect.h"
+#include "TextDirection.h"
+
+namespace WebCore {
+
+class SelectionRect {
+public:
+ SelectionRect();
+ explicit SelectionRect(const IntRect &);
+ SelectionRect(const IntRect &, TextDirection, int, int, int, bool, bool, bool, bool, bool);
+ ~SelectionRect() { }
+
+ IntRect rect() const { return m_rect; }
+ TextDirection direction() const { return m_direction; }
+ int minX() const { return m_minX; }
+ int maxX() const { return m_maxX; }
+ int lineNumber() const { return m_lineNumber; }
+ bool isLineBreak() const { return m_isLineBreak; }
+ bool isFirstOnLine() const { return m_isFirstOnLine; }
+ bool isLastOnLine() const { return m_isLastOnLine; }
+ bool containsStart() const { return m_containsStart; }
+ bool containsEnd() const { return m_containsEnd; }
+
+ void setRect(const IntRect &r) { m_rect = r; }
+ void setDirection(TextDirection d) { m_direction = d; }
+ void setMinX(int x) { m_minX = x; }
+ void setMaxX(int x) { m_maxX = x; }
+ void setLineNumber(int n) { m_lineNumber = n; }
+ void setIsLineBreak(bool b) { m_isLineBreak = b; }
+ void setIsFirstOnLine(bool b) { m_isFirstOnLine = b; }
+ void setIsLastOnLine(bool b) { m_isLastOnLine = b; }
+ void setContainsStart(bool b) { m_containsStart = b; }
+ void setContainsEnd(bool b) { m_containsEnd = b; }
+
+private:
+ IntRect m_rect;
+ TextDirection m_direction;
+ int m_minX;
+ int m_maxX;
+ int m_lineNumber;
+ bool m_isLineBreak;
+ bool m_isFirstOnLine;
+ bool m_isLastOnLine;
+ bool m_containsStart;
+ bool m_containsEnd;
+};
+
+}
+
+#endif
+
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SelectorNodeList_h
+#define SelectorNodeList_h
+
+#include "StaticNodeList.h"
+
+namespace WebCore {
+
+ class CSSSelectorList;
+
+ PassRefPtr<StaticNodeList> createSelectorNodeList(Node* rootNode, const CSSSelectorList&);
+
+} // namespace WebCore
+
+#endif // SelectorNodeList_h
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SetNodeAttributeCommand_h
+#define SetNodeAttributeCommand_h
+
+#include "EditCommand.h"
+#include "QualifiedName.h"
+
+namespace WebCore {
+
+class SetNodeAttributeCommand : public SimpleEditCommand {
+public:
+ static PassRefPtr<SetNodeAttributeCommand> create(PassRefPtr<Element> element, const QualifiedName& attribute, const AtomicString& value)
+ {
+ return adoptRef(new SetNodeAttributeCommand(element, attribute, value));
+ }
+
+private:
+ SetNodeAttributeCommand(PassRefPtr<Element>, const QualifiedName& attribute, const AtomicString& value);
+
+ virtual void doApply();
+ virtual void doUnapply();
+
+ RefPtr<Element> m_element;
+ QualifiedName m_attribute;
+ AtomicString m_value;
+ AtomicString m_oldValue;
+};
+
+} // namespace WebCore
+
+#endif // SetNodeAttributeCommand_h
--- /dev/null
+/*
+ * Copyright (C) 2003, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Settings_h
+#define Settings_h
+
+#include "AtomicString.h"
+#include "FontDescription.h"
+#include "KURL.h"
+
+#include "Document.h"
+
+namespace WebCore {
+
+ class Page;
+
+ enum EditableLinkBehavior {
+ EditableLinkDefaultBehavior = 0,
+ EditableLinkAlwaysLive,
+ EditableLinkOnlyLiveWithShiftKey,
+ EditableLinkLiveWhenNotFocused,
+ EditableLinkNeverLive
+ };
+
+ enum TextDirectionSubmenuInclusionBehavior {
+ TextDirectionSubmenuNeverIncluded,
+ TextDirectionSubmenuAutomaticallyIncluded,
+ TextDirectionSubmenuAlwaysIncluded
+ };
+
+ class Settings {
+ public:
+ Settings(Page*);
+
+ void setStandardFontFamily(const AtomicString&);
+ const AtomicString& standardFontFamily() const { return m_standardFontFamily; }
+
+ void setFixedFontFamily(const AtomicString&);
+ const AtomicString& fixedFontFamily() const { return m_fixedFontFamily; }
+
+ void setSerifFontFamily(const AtomicString&);
+ const AtomicString& serifFontFamily() const { return m_serifFontFamily; }
+
+ void setSansSerifFontFamily(const AtomicString&);
+ const AtomicString& sansSerifFontFamily() const { return m_sansSerifFontFamily; }
+
+ void setCursiveFontFamily(const AtomicString&);
+ const AtomicString& cursiveFontFamily() const { return m_cursiveFontFamily; }
+
+ void setFantasyFontFamily(const AtomicString&);
+ const AtomicString& fantasyFontFamily() const { return m_fantasyFontFamily; }
+
+ void setMinimumFontSize(int);
+ int minimumFontSize() const { return m_minimumFontSize; }
+
+ void setMinimumLogicalFontSize(int);
+ int minimumLogicalFontSize() const { return m_minimumLogicalFontSize; }
+
+ void setDefaultFontSize(int);
+ int defaultFontSize() const { return m_defaultFontSize; }
+
+ void setDefaultFixedFontSize(int);
+ int defaultFixedFontSize() const { return m_defaultFixedFontSize; }
+
+ void setLoadsImagesAutomatically(bool);
+ bool loadsImagesAutomatically() const { return m_loadsImagesAutomatically; }
+
+ void setJavaScriptEnabled(bool);
+ bool isJavaScriptEnabled() const { return m_isJavaScriptEnabled; }
+
+ void setJavaScriptCanOpenWindowsAutomatically(bool);
+ bool JavaScriptCanOpenWindowsAutomatically() const { return m_javaScriptCanOpenWindowsAutomatically; }
+
+ void setJavaEnabled(bool);
+ bool isJavaEnabled() const { return m_isJavaEnabled; }
+
+ void setPluginsEnabled(bool);
+ bool arePluginsEnabled() const { return m_arePluginsEnabled; }
+
+ void setDatabasesEnabled(bool);
+ bool databasesEnabled() const { return m_databasesEnabled; }
+
+ void setLocalStorageEnabled(bool);
+ bool localStorageEnabled() const { return m_localStorageEnabled; }
+
+ void setPrivateBrowsingEnabled(bool);
+ bool privateBrowsingEnabled() const { return m_privateBrowsingEnabled; }
+
+ void setDefaultTextEncodingName(const String&);
+ const String& defaultTextEncodingName() const { return m_defaultTextEncodingName; }
+
+ void setUserStyleSheetLocation(const KURL&);
+ const KURL& userStyleSheetLocation() const { return m_userStyleSheetLocation; }
+
+ void setShouldPrintBackgrounds(bool);
+ bool shouldPrintBackgrounds() const { return m_shouldPrintBackgrounds; }
+
+ void setTextAreasAreResizable(bool);
+ bool textAreasAreResizable() const { return m_textAreasAreResizable; }
+
+ void setEditableLinkBehavior(EditableLinkBehavior);
+ EditableLinkBehavior editableLinkBehavior() const { return m_editableLinkBehavior; }
+
+ void setTextDirectionSubmenuInclusionBehavior(TextDirectionSubmenuInclusionBehavior);
+ TextDirectionSubmenuInclusionBehavior textDirectionSubmenuInclusionBehavior() const { return m_textDirectionSubmenuInclusionBehavior; }
+
+#if ENABLE(DASHBOARD_SUPPORT)
+ void setUsesDashboardBackwardCompatibilityMode(bool);
+ bool usesDashboardBackwardCompatibilityMode() const { return m_usesDashboardBackwardCompatibilityMode; }
+#endif
+
+ void setNeedsAdobeFrameReloadingQuirk(bool);
+ bool needsAcrobatFrameReloadingQuirk() const { return m_needsAdobeFrameReloadingQuirk; }
+
+ void setNeedsKeyboardEventDisambiguationQuirks(bool);
+ bool needsKeyboardEventDisambiguationQuirks() const { return m_needsKeyboardEventDisambiguationQuirks; }
+
+ void setDOMPasteAllowed(bool);
+ bool isDOMPasteAllowed() const { return m_isDOMPasteAllowed; }
+
+ void setUsesPageCache(bool);
+ bool usesPageCache() const { return m_usesPageCache; }
+
+ void setShrinksStandaloneImagesToFit(bool);
+ bool shrinksStandaloneImagesToFit() const { return m_shrinksStandaloneImagesToFit; }
+
+ void setShowsURLsInToolTips(bool);
+ bool showsURLsInToolTips() const { return m_showsURLsInToolTips; }
+
+ void setFTPDirectoryTemplatePath(const String&);
+ const String& ftpDirectoryTemplatePath() const { return m_ftpDirectoryTemplatePath; }
+
+ void setForceFTPDirectoryListings(bool);
+ bool forceFTPDirectoryListings() const { return m_forceFTPDirectoryListings; }
+
+ void setDeveloperExtrasEnabled(bool);
+ bool developerExtrasEnabled() const { return m_developerExtrasEnabled; }
+
+ void setFlatFrameSetLayoutEnabled(bool);
+ bool flatFrameSetLayoutEnabled() const { return m_flatFrameSetLayoutEnabled; }
+
+ void setStandalone(bool flag);
+ bool standalone() const { return m_standalone; }
+
+ void setMaximumResourceDataLength(long long length);
+ long long maximumResourceDataLength();
+
+ void setTelephoneNumberParsingEnabled(bool flag) { m_telephoneNumberParsingEnabled = flag; }
+ bool telephoneNumberParsingEnabled() const { return m_telephoneNumberParsingEnabled; }
+
+ void setMinimumZoomFontSize(float size) { m_minimumZoomFontSize = size; }
+ float minimumZoomFontSize() const { return m_minimumZoomFontSize; }
+
+ void setLayoutInterval(int t) { m_layoutInterval = t < cLayoutScheduleThreshold ? cLayoutScheduleThreshold : t; }
+ int layoutInterval() const { return m_layoutInterval; }
+
+ void setMaxParseDuration(double maxParseDuration) { m_maxParseDuration = maxParseDuration; }
+ double maxParseDuration() const { return m_maxParseDuration; }
+
+ void setAuthorAndUserStylesEnabled(bool);
+ bool authorAndUserStylesEnabled() const { return m_authorAndUserStylesEnabled; }
+
+ void setFontRenderingMode(FontRenderingMode mode);
+ FontRenderingMode fontRenderingMode() const;
+
+ void setNeedsSiteSpecificQuirks(bool);
+ bool needsSiteSpecificQuirks() const { return m_needsSiteSpecificQuirks; }
+
+ void setWebArchiveDebugModeEnabled(bool);
+ bool webArchiveDebugModeEnabled() const { return m_webArchiveDebugModeEnabled; }
+
+ void setLocalStorageDatabasePath(const String&);
+ const String& localStorageDatabasePath() const { return m_localStorageDatabasePath; }
+
+ void disableRangeMutationForOldAppleMail(bool);
+ bool rangeMutationDisabledForOldAppleMail() const { return m_rangeMutationDisabledForOldAppleMail; }
+
+ void setApplicationChromeMode(bool);
+ bool inApplicationChromeMode() const { return m_inApplicationChromeMode; }
+
+ void setOfflineWebApplicationCacheEnabled(bool);
+ bool offlineWebApplicationCacheEnabled() const { return m_offlineWebApplicationCacheEnabled; }
+
+ void setShouldPaintCustomScrollbars(bool);
+ bool shouldPaintCustomScrollbars() const { return m_shouldPaintCustomScrollbars; }
+
+ void setZoomsTextOnly(bool);
+ bool zoomsTextOnly() const { return m_zoomsTextOnly; }
+
+ void setEnforceCSSMIMETypeInStrictMode(bool);
+ bool enforceCSSMIMETypeInStrictMode() { return m_enforceCSSMIMETypeInStrictMode; }
+
+ void setMaximumDecodedImageSize(size_t size) { m_maximumDecodedImageSize = size; }
+ size_t maximumDecodedImageSize() const { return m_maximumDecodedImageSize; }
+
+#if USE(SAFARI_THEME)
+ // Windows debugging pref (global) for switching between the Aqua look and a native windows look.
+ static void setShouldPaintNativeControls(bool);
+ static bool shouldPaintNativeControls() { return gShouldPaintNativeControls; }
+#endif
+
+ private:
+ Page* m_page;
+
+ String m_defaultTextEncodingName;
+ String m_ftpDirectoryTemplatePath;
+ String m_localStorageDatabasePath;
+ KURL m_userStyleSheetLocation;
+ AtomicString m_standardFontFamily;
+ AtomicString m_fixedFontFamily;
+ AtomicString m_serifFontFamily;
+ AtomicString m_sansSerifFontFamily;
+ AtomicString m_cursiveFontFamily;
+ AtomicString m_fantasyFontFamily;
+ EditableLinkBehavior m_editableLinkBehavior;
+ TextDirectionSubmenuInclusionBehavior m_textDirectionSubmenuInclusionBehavior;
+ int m_minimumFontSize;
+ int m_minimumLogicalFontSize;
+ int m_defaultFontSize;
+ int m_defaultFixedFontSize;
+ bool m_isJavaEnabled : 1;
+ bool m_loadsImagesAutomatically : 1;
+ bool m_privateBrowsingEnabled : 1;
+ bool m_arePluginsEnabled : 1;
+ bool m_databasesEnabled : 1;
+ bool m_localStorageEnabled : 1;
+ bool m_isJavaScriptEnabled : 1;
+ bool m_javaScriptCanOpenWindowsAutomatically : 1;
+ bool m_shouldPrintBackgrounds : 1;
+ bool m_textAreasAreResizable : 1;
+#if ENABLE(DASHBOARD_SUPPORT)
+ bool m_usesDashboardBackwardCompatibilityMode : 1;
+#endif
+ bool m_needsAdobeFrameReloadingQuirk : 1;
+ bool m_needsKeyboardEventDisambiguationQuirks : 1;
+ bool m_isDOMPasteAllowed : 1;
+ bool m_shrinksStandaloneImagesToFit : 1;
+ bool m_usesPageCache: 1;
+ bool m_showsURLsInToolTips : 1;
+ bool m_forceFTPDirectoryListings : 1;
+ bool m_developerExtrasEnabled : 1;
+ bool m_authorAndUserStylesEnabled : 1;
+ bool m_needsSiteSpecificQuirks : 1;
+ unsigned m_fontRenderingMode : 1;
+ bool m_flatFrameSetLayoutEnabled : 1;
+ bool m_standalone : 1;
+ bool m_telephoneNumberParsingEnabled : 1;
+ bool m_webArchiveDebugModeEnabled : 1;
+ bool m_inApplicationChromeMode : 1;
+ bool m_offlineWebApplicationCacheEnabled : 1;
+ bool m_rangeMutationDisabledForOldAppleMail : 1;
+ bool m_shouldPaintCustomScrollbars : 1;
+ bool m_zoomsTextOnly : 1;
+ bool m_enforceCSSMIMETypeInStrictMode : 1;
+ size_t m_maximumDecodedImageSize;
+ long long m_maximumResourceDataLength;
+ float m_minimumZoomFontSize;
+ int m_layoutInterval;
+ double m_maxParseDuration;
+
+#if USE(SAFARI_THEME)
+ static bool gShouldPaintNativeControls;
+#endif
+ };
+
+} // namespace WebCore
+
+#endif // Settings_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ShadowData_h
+#define ShadowData_h
+
+#include "Color.h"
+
+namespace WebCore {
+
+// This struct holds information about shadows for the text-shadow and box-shadow properties.
+
+struct ShadowData {
+ ShadowData()
+ : x(0)
+ , y(0)
+ , blur(0)
+ , next(0)
+ {
+ }
+
+ ShadowData(int _x, int _y, int _blur, const Color& _color)
+ : x(_x)
+ , y(_y)
+ , blur(_blur)
+ , color(_color)
+ , next(0)
+ {
+ }
+
+ ShadowData(const ShadowData& o);
+
+ ~ShadowData() { delete next; }
+
+ bool operator==(const ShadowData& o) const;
+ bool operator!=(const ShadowData& o) const
+ {
+ return !(*this == o);
+ }
+
+ int x;
+ int y;
+ int blur;
+ Color color;
+ ShadowData* next;
+};
+
+} // namespace WebCore
+
+#endif // ShadowData_h
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef ShadowValue_h
+#define ShadowValue_h
+
+#include "CSSValue.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class CSSPrimitiveValue;
+
+// Used for text-shadow and box-shadow
+class ShadowValue : public CSSValue {
+public:
+ static PassRefPtr<ShadowValue> create(PassRefPtr<CSSPrimitiveValue> x,
+ PassRefPtr<CSSPrimitiveValue> y,
+ PassRefPtr<CSSPrimitiveValue> blur,
+ PassRefPtr<CSSPrimitiveValue> color)
+ {
+ return adoptRef(new ShadowValue(x, y, blur, color));
+ }
+
+ virtual String cssText() const;
+
+ RefPtr<CSSPrimitiveValue> x;
+ RefPtr<CSSPrimitiveValue> y;
+ RefPtr<CSSPrimitiveValue> blur;
+ RefPtr<CSSPrimitiveValue> color;
+
+private:
+ ShadowValue(PassRefPtr<CSSPrimitiveValue> x,
+ PassRefPtr<CSSPrimitiveValue> y,
+ PassRefPtr<CSSPrimitiveValue> blur,
+ PassRefPtr<CSSPrimitiveValue> color);
+};
+
+} // namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef SharedBuffer_h
+#define SharedBuffer_h
+
+#include "PlatformString.h"
+#include <wtf/Forward.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+#if PLATFORM(CF)
+#include <wtf/RetainPtr.h>
+#endif
+
+#if PLATFORM(MAC)
+#ifdef __OBJC__
+@class NSData;
+#else
+class NSData;
+#endif
+
+#endif
+
+namespace WebCore {
+
+class PurgeableBuffer;
+
+class SharedBuffer : public RefCounted<SharedBuffer> {
+public:
+ static PassRefPtr<SharedBuffer> create() { return adoptRef(new SharedBuffer); }
+ static PassRefPtr<SharedBuffer> create(const char* c, int i) { return adoptRef(new SharedBuffer(c, i)); }
+ static PassRefPtr<SharedBuffer> create(const unsigned char* c, int i) { return adoptRef(new SharedBuffer(c, i)); }
+
+ static PassRefPtr<SharedBuffer> createWithContentsOfFile(const String& filePath);
+
+ static PassRefPtr<SharedBuffer> adoptVector(Vector<char>& vector);
+
+ // The buffer must be in non-purgeable state before adopted to a SharedBuffer.
+ // It will stay that way until released.
+ static PassRefPtr<SharedBuffer> adoptPurgeableBuffer(PurgeableBuffer* buffer);
+
+ ~SharedBuffer();
+
+#if PLATFORM(MAC)
+ NSData *createNSData();
+ static PassRefPtr<SharedBuffer> wrapNSData(NSData *data);
+#endif
+#if PLATFORM(CF)
+ CFDataRef createCFData();
+#endif
+
+ const char* data() const;
+ unsigned size() const;
+ const Vector<char> &buffer() { return m_buffer; }
+
+ bool isEmpty() const { return size() == 0; }
+
+ void append(const char*, int);
+ void clear();
+ const char* platformData() const;
+ unsigned platformDataSize() const;
+
+ PassRefPtr<SharedBuffer> copy() const;
+
+ bool hasPurgeableBuffer() const { return m_purgeableBuffer.get(); }
+
+ // Ensure this buffer has no other clients before calling this.
+ PurgeableBuffer* releasePurgeableBuffer();
+
+private:
+ SharedBuffer();
+ SharedBuffer(const char*, int);
+ SharedBuffer(const unsigned char*, int);
+
+ void clearPlatformData();
+ void maybeTransferPlatformData();
+ bool hasPlatformData() const;
+
+ Vector<char> m_buffer;
+ OwnPtr<PurgeableBuffer> m_purgeableBuffer;
+#if PLATFORM(CF)
+ SharedBuffer(CFDataRef);
+ RetainPtr<CFDataRef> m_cfData;
+#endif
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SharedTimer_h
+#define SharedTimer_h
+
+namespace WebCore {
+
+ // Single timer, shared to implement all the timers managed by the Timer class.
+ // Not intended to be used directly; use the Timer class instead.
+
+ void setSharedTimerFiredFunction(void (*)());
+
+ // The fire time is relative to the classic POSIX epoch of January 1, 1970,
+ // as the result of currentTime() is.
+
+ void setSharedTimerFireTime(double fireTime);
+ void stopSharedTimer();
+
+}
+
+#endif
--- /dev/null
+/*
+ * This file is part of the internal font implementation.
+ *
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef SimpleFontData_h
+#define SimpleFontData_h
+
+#include "FontData.h"
+#include "FontPlatformData.h"
+#include "GlyphPageTreeNode.h"
+#include "GlyphWidthMap.h"
+#include <wtf/OwnPtr.h>
+
+#if USE(ATSUI)
+typedef struct OpaqueATSUStyle* ATSUStyle;
+#endif
+
+#if PLATFORM(WIN)
+#include <usp10.h>
+#endif
+
+#if PLATFORM(CAIRO)
+#include <cairo.h>
+#endif
+
+#if PLATFORM(QT)
+#include <QFont>
+#endif
+
+namespace WebCore {
+
+class FontDescription;
+class FontPlatformData;
+class SharedBuffer;
+class SVGFontData;
+class WidthMap;
+
+enum Pitch { UnknownPitch, FixedPitch, VariablePitch };
+
+class SimpleFontData : public FontData {
+public:
+ SimpleFontData(const FontPlatformData&, bool customFont = false, bool loading = false, SVGFontData* data = 0);
+ virtual ~SimpleFontData();
+
+public:
+ const FontPlatformData& platformData() const { return m_font; }
+ SimpleFontData* smallCapsFontData(const FontDescription& fontDescription) const;
+
+ // vertical metrics
+ int ascent() const { return m_ascent; }
+ int descent() const { return m_descent; }
+ int lineSpacing() const { return m_lineSpacing; }
+ int lineGap() const { return m_lineGap; }
+ float xHeight() const { return m_xHeight; }
+ unsigned unitsPerEm() const { return m_unitsPerEm; }
+
+ float widthForGlyph(Glyph) const;
+ float platformWidthForGlyph(Glyph) const;
+
+ virtual const SimpleFontData* fontDataForCharacter(UChar32) const;
+ virtual bool containsCharacters(const UChar*, int length) const;
+
+ void determinePitch();
+ Pitch pitch() const { return m_treatAsFixedPitch ? FixedPitch : VariablePitch; }
+
+#if ENABLE(SVG_FONTS)
+ SVGFontData* svgFontData() const { return m_svgFontData.get(); }
+ bool isSVGFont() const { return m_svgFontData; }
+#else
+ bool isSVGFont() const { return false; }
+#endif
+
+ virtual bool isCustomFont() const { return m_isCustomFont; }
+ virtual bool isLoading() const { return m_isLoading; }
+ virtual bool isSegmented() const;
+
+ const GlyphData& missingGlyphData() const { return m_missingGlyphData; }
+
+ GSFontRef getGSFont() const { return m_font.font(); }
+ bool isImageFont() const { return m_font.m_isImageFont; };
+
+#if USE(CORE_TEXT)
+ CTFontRef getCTFont() const;
+ CFDictionaryRef getCFStringAttributes() const;
+#endif
+
+#if USE(ATSUI)
+ void checkShapesArabic() const;
+ bool shapesArabic() const
+ {
+ if (!m_checkedShapesArabic)
+ checkShapesArabic();
+ return m_shapesArabic;
+ }
+#endif
+
+#if PLATFORM(QT)
+ QFont getQtFont() const { return m_font.font(); }
+#endif
+
+#if PLATFORM(WIN)
+ bool isSystemFont() const { return m_isSystemFont; }
+ SCRIPT_FONTPROPERTIES* scriptFontProperties() const;
+ SCRIPT_CACHE* scriptCache() const { return &m_scriptCache; }
+
+ static void setShouldApplyMacAscentHack(bool);
+ static bool shouldApplyMacAscentHack();
+#endif
+
+#if PLATFORM(CAIRO)
+ void setFont(cairo_t*) const;
+#endif
+
+#if PLATFORM(WX)
+ wxFont getWxFont() const { return m_font.font(); }
+#endif
+
+private:
+ void platformInit();
+ void platformGlyphInit();
+ void platformDestroy();
+
+ void commonInit();
+
+#if PLATFORM(WIN)
+ void initGDIFont();
+ void platformCommonDestroy();
+ float widthForGDIGlyph(Glyph glyph) const;
+#endif
+
+public:
+ int m_ascent;
+ int m_descent;
+ int m_lineSpacing;
+ int m_lineGap;
+ float m_xHeight;
+ unsigned m_unitsPerEm;
+
+ FontPlatformData m_font;
+
+ mutable GlyphWidthMap m_glyphToWidthMap;
+
+ bool m_treatAsFixedPitch;
+
+#if ENABLE(SVG_FONTS)
+ OwnPtr<SVGFontData> m_svgFontData;
+#endif
+
+ bool m_isCustomFont; // Whether or not we are custom font loaded via @font-face
+ bool m_isLoading; // Whether or not this custom font is still in the act of loading.
+
+ Glyph m_spaceGlyph;
+ float m_spaceWidth;
+ float m_adjustedSpaceWidth;
+
+ GlyphData m_missingGlyphData;
+
+ mutable SimpleFontData* m_smallCapsFontData;
+
+#if PLATFORM(CG) || PLATFORM(WIN)
+ float m_syntheticBoldOffset;
+#endif
+
+
+#if USE(ATSUI)
+ mutable ATSUStyle m_ATSUStyle;
+ mutable bool m_ATSUStyleInitialized;
+ mutable bool m_ATSUMirrors;
+ mutable bool m_checkedShapesArabic;
+ mutable bool m_shapesArabic;
+#endif
+
+#if USE(CORE_TEXT)
+ mutable RetainPtr<CTFontRef> m_CTFont;
+ mutable RetainPtr<CFDictionaryRef> m_CFStringAttributes;
+#endif
+
+#if PLATFORM(WIN)
+ bool m_isSystemFont;
+ mutable SCRIPT_CACHE m_scriptCache;
+ mutable SCRIPT_FONTPROPERTIES* m_scriptFontProperties;
+#endif
+};
+
+} // namespace WebCore
+
+#endif // SimpleFontData_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef SkewTransformOperation_h
+#define SkewTransformOperation_h
+
+#include "TransformOperation.h"
+
+namespace WebCore {
+
+class SkewTransformOperation : public TransformOperation {
+public:
+ static PassRefPtr<SkewTransformOperation> create(double angleX, double angleY, OperationType type)
+ {
+ return adoptRef(new SkewTransformOperation(angleX, angleY, type));
+ }
+
+private:
+ virtual bool isIdentity() const { return m_angleX == 0 && m_angleY == 0; }
+ virtual OperationType getOperationType() const { return m_type; }
+ virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == m_type; }
+
+ virtual bool operator==(const TransformOperation& o) const
+ {
+ if (!isSameType(o))
+ return false;
+ const SkewTransformOperation* s = static_cast<const SkewTransformOperation*>(&o);
+ return m_angleX == s->m_angleX && m_angleY == s->m_angleY;
+ }
+
+ virtual bool apply(TransformationMatrix& transform, const IntSize&) const
+ {
+ transform.skew(m_angleX, m_angleY);
+ return false;
+ }
+
+ virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
+
+ SkewTransformOperation(double angleX, double angleY, OperationType type)
+ : m_angleX(angleX)
+ , m_angleY(angleY)
+ , m_type(type)
+ {
+ }
+
+ double m_angleX;
+ double m_angleY;
+ OperationType m_type;
+};
+
+} // namespace WebCore
+
+#endif // SkewTransformOperation_h
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+bool isCharacterSmartReplaceExempt(UChar32 c, bool isPreviousCharacter);
+
+} // namespace WebCore
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Sound_h
+#define Sound_h
+
+namespace WebCore {
+
+ void systemBeep();
+
+} // namespace WebCore
+
+#endif // Sound_h
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SplitElementCommand_h
+#define SplitElementCommand_h
+
+#include "EditCommand.h"
+
+namespace WebCore {
+
+class SplitElementCommand : public SimpleEditCommand {
+public:
+ static PassRefPtr<SplitElementCommand> create(PassRefPtr<Element> element, PassRefPtr<Node> splitPointChild)
+ {
+ return adoptRef(new SplitElementCommand(element, splitPointChild));
+ }
+
+private:
+ SplitElementCommand(PassRefPtr<Element>, PassRefPtr<Node> splitPointChild);
+
+ virtual void doApply();
+ virtual void doUnapply();
+
+ RefPtr<Element> m_element1;
+ RefPtr<Element> m_element2;
+ RefPtr<Node> m_atChild;
+};
+
+} // namespace WebCore
+
+#endif // SplitElementCommand_h
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SplitTextNodeCommand_h
+#define SplitTextNodeCommand_h
+
+#include "EditCommand.h"
+
+namespace WebCore {
+
+class Text;
+
+class SplitTextNodeCommand : public SimpleEditCommand {
+public:
+ static PassRefPtr<SplitTextNodeCommand> create(PassRefPtr<Text> node, int offset)
+ {
+ return adoptRef(new SplitTextNodeCommand(node, offset));
+ }
+
+private:
+ SplitTextNodeCommand(PassRefPtr<Text>, int offset);
+
+ virtual void doApply();
+ virtual void doUnapply();
+
+ RefPtr<Text> m_text1;
+ RefPtr<Text> m_text2;
+ unsigned m_offset;
+};
+
+} // namespace WebCore
+
+#endif // SplitTextNodeCommand_h
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SplitTextNodeContainingElementCommand_h
+#define SplitTextNodeContainingElementCommand_h
+
+#include "CompositeEditCommand.h"
+
+namespace WebCore {
+
+class SplitTextNodeContainingElementCommand : public CompositeEditCommand {
+public:
+ static PassRefPtr<SplitTextNodeContainingElementCommand> create(PassRefPtr<Text> node, int offset)
+ {
+ return adoptRef(new SplitTextNodeContainingElementCommand(node, offset));
+ }
+
+private:
+ SplitTextNodeContainingElementCommand(PassRefPtr<Text>, int offset);
+
+ virtual void doApply();
+
+ RefPtr<Text> m_text;
+ int m_offset;
+};
+
+} // namespace WebCore
+
+#endif // SplitTextNodeContainingElementCommand_h
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef StaticConstructors_h
+#define StaticConstructors_h
+
+// For WebCore we need to avoid having static constructors. We achieve this
+// with two separate methods for GCC and MSVC. Both methods prevent the static
+// initializers from being registered and called on program startup. On GCC, we
+// declare the global objects with a different type that can be POD default
+// initialized by the linker/loader. On MSVC we use a special compiler feature
+// to have the CRT ignore our static initializers. The constructors will never
+// be called and the objects will be left uninitialized.
+//
+// With both of these approaches, we must define and explicitly call an init
+// routine that uses placement new to create the objects and overwrite the
+// uninitialized placeholders.
+//
+// This is not completely portable, but is what we have for now without
+// changing how a lot of code accesses these global objects.
+
+#ifdef SKIP_STATIC_CONSTRUCTORS_ON_MSVC
+// - Assume that all includes of this header want ALL of their static
+// initializers ignored. This is currently the case. This means that if
+// a .cc includes this header (or it somehow gets included), all static
+// initializers after the include will not be executed.
+// - We do this with a pragma, so that all of the static initializer pointers
+// go into our own section, and the CRT won't call them. Eventually it would
+// be nice if the section was discarded, because we don't want the pointers.
+// See: http://msdn.microsoft.com/en-us/library/7977wcck(VS.80).aspx
+#pragma warning(disable:4075)
+#pragma init_seg(".unwantedstaticinits")
+#endif
+
+#ifndef SKIP_STATIC_CONSTRUCTORS_ON_GCC
+ // Define an global in the normal way.
+#if COMPILER(MSVC7)
+#define DEFINE_GLOBAL(type, name) \
+ const type name;
+#else
+#define DEFINE_GLOBAL(type, name, ...) \
+ const type name;
+#endif
+
+#else
+// Define an correctly-sized array of pointers to avoid static initialization.
+// Use an array of pointers instead of an array of char in case there is some alignment issue.
+#if COMPILER(MSVC7)
+#define DEFINE_GLOBAL(type, name) \
+ void * name[(sizeof(type) + sizeof(void *) - 1) / sizeof(void *)];
+#else
+#define DEFINE_GLOBAL(type, name, ...) \
+ void * name[(sizeof(type) + sizeof(void *) - 1) / sizeof(void *)];
+#endif
+#endif
+
+#endif // StaticConstructors_h
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef StaticNodeList_h
+#define StaticNodeList_h
+
+#include "NodeList.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+ class Node;
+
+ class StaticNodeList : public NodeList {
+ public:
+ // Adopts the contents of the nodes vector.
+ static PassRefPtr<StaticNodeList> adopt(Vector<RefPtr<Node> >& nodes)
+ {
+ return adoptRef(new StaticNodeList(nodes));
+ }
+
+ virtual unsigned length() const;
+ virtual Node* item(unsigned index) const;
+ virtual Node* itemWithName(const AtomicString&) const;
+
+ private:
+ StaticNodeList(Vector<RefPtr<Node> >& nodes)
+ {
+ m_nodes.swap(nodes);
+ }
+ Vector<RefPtr<Node> > m_nodes;
+ };
+
+} // namespace WebCore
+
+#endif // StaticNodeList_h
--- /dev/null
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef StaticStringList_h
+#define StaticStringList_h
+
+#include "DOMStringList.h"
+
+namespace WebCore {
+
+ class StaticStringList : public DOMStringList {
+ public:
+ static PassRefPtr<StaticStringList> create(const Vector<String>& strings)
+ {
+ return adoptRef(new StaticStringList(strings));
+ }
+ static PassRefPtr<StaticStringList> adopt(Vector<String>& strings)
+ {
+ StaticStringList* newList = new StaticStringList;
+ newList->m_strings.swap(strings);
+ return adoptRef(newList);
+ }
+ virtual ~StaticStringList();
+
+ virtual unsigned length() const;
+ virtual String item(unsigned) const;
+ virtual bool contains(const String&) const;
+
+ private:
+ StaticStringList(const Vector<String>&);
+ StaticStringList();
+
+ Vector<String> m_strings;
+ };
+
+} // namespace WebCore
+
+#endif // StaticStringList
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef StringBuffer_h
+#define StringBuffer_h
+
+#include <wtf/Assertions.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+class StringBuffer : Noncopyable {
+public:
+ explicit StringBuffer(unsigned length)
+ : m_length(length)
+ , m_data(static_cast<UChar*>(fastMalloc(length * sizeof(UChar))))
+ {
+ }
+ ~StringBuffer()
+ {
+ fastFree(m_data);
+ }
+
+ void shrink(unsigned newLength)
+ {
+ ASSERT(newLength <= m_length);
+ m_length = newLength;
+ }
+
+ void resize(unsigned newLength)
+ {
+ if (newLength > m_length)
+ m_data = static_cast<UChar*>(fastRealloc(m_data, newLength * sizeof(UChar)));
+ m_length = newLength;
+ }
+
+ unsigned length() const { return m_length; }
+ UChar* characters() { return m_data; }
+
+ UChar& operator[](unsigned i) { ASSERT(i < m_length); return m_data[i]; }
+
+ UChar* release() { UChar* data = m_data; m_data = 0; return data; }
+
+private:
+ unsigned m_length;
+ UChar* m_data;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef StringBuilder_h
+#define StringBuilder_h
+
+#include "PlatformString.h"
+
+namespace WebCore {
+
+ class StringBuilder {
+ public:
+ StringBuilder() : m_totalLength(UINT_MAX) {}
+
+ void setNonNull() { if (m_totalLength == UINT_MAX) m_totalLength = 0; }
+
+ void append(const String&);
+ void append(UChar);
+ void append(char);
+
+ String toString() const;
+
+ private:
+ bool isNull() const { return m_totalLength == UINT_MAX; }
+
+ unsigned m_totalLength;
+ Vector<String, 16> m_strings;
+ };
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef StringHash_h
+#define StringHash_h
+
+#include "AtomicString.h"
+#include "PlatformString.h"
+#include <wtf/HashFunctions.h>
+#include <wtf/HashTraits.h>
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+ // FIXME: We should really figure out a way to put the computeHash function that's
+ // currently a member function of StringImpl into this file so we can be a little
+ // closer to having all the nearly-identical hash functions in one place.
+
+ struct StringHash {
+ static unsigned hash(StringImpl* key) { return key->hash(); }
+ static bool equal(StringImpl* a, StringImpl* b)
+ {
+ if (a == b)
+ return true;
+ if (!a || !b)
+ return false;
+
+ unsigned aLength = a->length();
+ unsigned bLength = b->length();
+ if (aLength != bLength)
+ return false;
+
+ const uint32_t* aChars = reinterpret_cast<const uint32_t*>(a->characters());
+ const uint32_t* bChars = reinterpret_cast<const uint32_t*>(b->characters());
+
+ unsigned halfLength = aLength >> 1;
+ for (unsigned i = 0; i != halfLength; ++i)
+ if (*aChars++ != *bChars++)
+ return false;
+
+ if (aLength & 1 && *reinterpret_cast<const uint16_t*>(aChars) != *reinterpret_cast<const uint16_t*>(bChars))
+ return false;
+
+ return true;
+ }
+
+ static unsigned hash(const RefPtr<StringImpl>& key) { return key->hash(); }
+ static bool equal(const RefPtr<StringImpl>& a, const RefPtr<StringImpl>& b)
+ {
+ return equal(a.get(), b.get());
+ }
+
+ static unsigned hash(const String& key) { return key.impl()->hash(); }
+ static bool equal(const String& a, const String& b)
+ {
+ return equal(a.impl(), b.impl());
+ }
+
+ static const bool safeToCompareToEmptyOrDeleted = false;
+ };
+
+ class CaseFoldingHash {
+ public:
+ // Paul Hsieh's SuperFastHash
+ // http://www.azillionmonkeys.com/qed/hash.html
+ static unsigned hash(const UChar* data, unsigned length)
+ {
+ unsigned l = length;
+ const UChar* s = data;
+ uint32_t hash = WTF::stringHashingStartValue;
+ uint32_t tmp;
+
+ int rem = l & 1;
+ l >>= 1;
+
+ // Main loop.
+ for (; l > 0; l--) {
+ hash += WTF::Unicode::foldCase(s[0]);
+ tmp = (WTF::Unicode::foldCase(s[1]) << 11) ^ hash;
+ hash = (hash << 16) ^ tmp;
+ s += 2;
+ hash += hash >> 11;
+ }
+
+ // Handle end case.
+ if (rem) {
+ hash += WTF::Unicode::foldCase(s[0]);
+ hash ^= hash << 11;
+ hash += hash >> 17;
+ }
+
+ // Force "avalanching" of final 127 bits.
+ hash ^= hash << 3;
+ hash += hash >> 5;
+ hash ^= hash << 2;
+ hash += hash >> 15;
+ hash ^= hash << 10;
+
+ // This avoids ever returning a hash code of 0, since that is used to
+ // signal "hash not computed yet", using a value that is likely to be
+ // effectively the same as 0 when the low bits are masked.
+ hash |= !hash << 31;
+
+ return hash;
+ }
+
+ static unsigned hash(StringImpl* str)
+ {
+ return hash(str->characters(), str->length());
+ }
+
+ static unsigned hash(const char* str, unsigned length)
+ {
+ // This hash is designed to work on 16-bit chunks at a time. But since the normal case
+ // (above) is to hash UTF-16 characters, we just treat the 8-bit chars as if they
+ // were 16-bit chunks, which will give matching results.
+
+ unsigned l = length;
+ const char* s = str;
+ uint32_t hash = WTF::stringHashingStartValue;
+ uint32_t tmp;
+
+ int rem = l & 1;
+ l >>= 1;
+
+ // Main loop
+ for (; l > 0; l--) {
+ hash += WTF::Unicode::foldCase(s[0]);
+ tmp = (WTF::Unicode::foldCase(s[1]) << 11) ^ hash;
+ hash = (hash << 16) ^ tmp;
+ s += 2;
+ hash += hash >> 11;
+ }
+
+ // Handle end case
+ if (rem) {
+ hash += WTF::Unicode::foldCase(s[0]);
+ hash ^= hash << 11;
+ hash += hash >> 17;
+ }
+
+ // Force "avalanching" of final 127 bits
+ hash ^= hash << 3;
+ hash += hash >> 5;
+ hash ^= hash << 2;
+ hash += hash >> 15;
+ hash ^= hash << 10;
+
+ // this avoids ever returning a hash code of 0, since that is used to
+ // signal "hash not computed yet", using a value that is likely to be
+ // effectively the same as 0 when the low bits are masked
+ hash |= !hash << 31;
+
+ return hash;
+ }
+
+ static bool equal(StringImpl* a, StringImpl* b)
+ {
+ if (a == b)
+ return true;
+ if (!a || !b)
+ return false;
+ unsigned length = a->length();
+ if (length != b->length())
+ return false;
+ return WTF::Unicode::umemcasecmp(a->characters(), b->characters(), length) == 0;
+ }
+
+ static unsigned hash(const RefPtr<StringImpl>& key)
+ {
+ return hash(key.get());
+ }
+
+ static bool equal(const RefPtr<StringImpl>& a, const RefPtr<StringImpl>& b)
+ {
+ return equal(a.get(), b.get());
+ }
+
+ static unsigned hash(const String& key)
+ {
+ return hash(key.impl());
+ }
+ static unsigned hash(const AtomicString& key)
+ {
+ return hash(key.impl());
+ }
+ static bool equal(const String& a, const String& b)
+ {
+ return equal(a.impl(), b.impl());
+ }
+ static bool equal(const AtomicString& a, const AtomicString& b)
+ {
+ return (a == b) || equal(a.impl(), b.impl());
+ }
+
+ static const bool safeToCompareToEmptyOrDeleted = false;
+ };
+
+ // This hash can be used in cases where the key is a hash of a string, but we don't
+ // want to store the string. It's not really specific to string hashing, but all our
+ // current uses of it are for strings.
+ struct AlreadyHashed : IntHash<unsigned> {
+ static unsigned hash(unsigned key) { return key; }
+
+ // To use a hash value as a key for a hash table, we need to eliminate the
+ // "deleted" value, which is negative one. That could be done by changing
+ // the string hash function to never generate negative one, but this works
+ // and is still relatively efficient.
+ static unsigned avoidDeletedValue(unsigned hash)
+ {
+ ASSERT(hash);
+ unsigned newHash = hash | (!(hash + 1) << 31);
+ ASSERT(newHash);
+ ASSERT(newHash != 0xFFFFFFFF);
+ return newHash;
+ }
+ };
+
+}
+
+namespace WTF {
+
+ template<> struct HashTraits<WebCore::String> : GenericHashTraits<WebCore::String> {
+ static const bool emptyValueIsZero = true;
+ static void constructDeletedValue(WebCore::String& slot) { new (&slot) WebCore::String(HashTableDeletedValue); }
+#if 0
+ static bool isDeletedValue(const WebCore::String& slot) { return slot.isHashTableDeletedValue(); }
+#endif
+ };
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef StringImpl_h
+#define StringImpl_h
+
+#include <limits.h>
+#include <wtf/ASCIICType.h>
+#include <wtf/Forward.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+#include <wtf/unicode/Unicode.h>
+
+#if PLATFORM(CF) || (PLATFORM(QT) && PLATFORM(DARWIN))
+typedef const struct __CFString * CFStringRef;
+#endif
+
+#ifdef __OBJC__
+@class NSString;
+#endif
+
+namespace WebCore {
+
+class AtomicString;
+class StringBuffer;
+
+struct CStringTranslator;
+struct HashAndCharactersTranslator;
+struct StringHash;
+struct UCharBufferTranslator;
+
+enum TextCaseSensitivity { TextCaseSensitive, TextCaseInsensitive };
+
+typedef bool (*CharacterMatchFunctionPtr)(UChar);
+
+class StringImpl : public RefCounted<StringImpl> {
+ friend class AtomicString;
+ friend struct CStringTranslator;
+ friend struct HashAndCharactersTranslator;
+ friend struct UCharBufferTranslator;
+private:
+ friend class ThreadGlobalData;
+ StringImpl();
+ StringImpl(const UChar*, unsigned length);
+ StringImpl(const char*, unsigned length);
+
+ struct AdoptBuffer { };
+ StringImpl(UChar*, unsigned length, AdoptBuffer);
+
+ struct WithTerminatingNullCharacter { };
+ StringImpl(const StringImpl&, WithTerminatingNullCharacter);
+
+ // For AtomicString.
+ StringImpl(const UChar*, unsigned length, unsigned hash);
+ StringImpl(const char*, unsigned length, unsigned hash);
+
+public:
+ ~StringImpl();
+
+ static PassRefPtr<StringImpl> create(const UChar*, unsigned length);
+ static PassRefPtr<StringImpl> create(const char*, unsigned length);
+ static PassRefPtr<StringImpl> create(const char*);
+
+ static PassRefPtr<StringImpl> createWithTerminatingNullCharacter(const StringImpl&);
+
+ static PassRefPtr<StringImpl> createStrippingNullCharacters(const UChar*, unsigned length);
+ static PassRefPtr<StringImpl> adopt(StringBuffer&);
+ static PassRefPtr<StringImpl> adopt(Vector<UChar>&);
+
+ const UChar* characters() { return m_data; }
+ unsigned length() { return m_length; }
+
+ bool hasTerminatingNullCharacter() { return m_hasTerminatingNullCharacter; }
+
+ unsigned hash() { if (m_hash == 0) m_hash = computeHash(m_data, m_length); return m_hash; }
+ unsigned existingHash() const { ASSERT(m_hash); return m_hash; }
+ static unsigned computeHash(const UChar*, unsigned len);
+ static unsigned computeHash(const char*);
+
+ // Makes a deep copy. Helpful only if you need to use a String on another thread.
+ // Since StringImpl objects are immutable, there's no other reason to make a copy.
+ PassRefPtr<StringImpl> copy();
+
+ // Makes a deep copy like copy() but only for a substring.
+ // (This ensures that you always get something suitable for a thread while subtring
+ // may not. For example, in the empty string case, substring returns empty() which
+ // is not safe for another thread.)
+ PassRefPtr<StringImpl> substringCopy(unsigned pos, unsigned len = UINT_MAX);
+
+ PassRefPtr<StringImpl> substring(unsigned pos, unsigned len = UINT_MAX);
+
+ UChar operator[](unsigned i) { ASSERT(i < m_length); return m_data[i]; }
+ UChar32 characterStartingAt(unsigned);
+
+ bool containsOnlyWhitespace();
+
+ int toIntStrict(bool* ok = 0, int base = 10);
+ unsigned toUIntStrict(bool* ok = 0, int base = 10);
+ int64_t toInt64Strict(bool* ok = 0, int base = 10);
+ uint64_t toUInt64Strict(bool* ok = 0, int base = 10);
+
+ int toInt(bool* ok = 0); // ignores trailing garbage
+ unsigned toUInt(bool* ok = 0); // ignores trailing garbage
+ int64_t toInt64(bool* ok = 0); // ignores trailing garbage
+ uint64_t toUInt64(bool* ok = 0); // ignores trailing garbage
+
+ double toDouble(bool* ok = 0);
+ float toFloat(bool* ok = 0);
+
+ bool isLower();
+ PassRefPtr<StringImpl> lower();
+ PassRefPtr<StringImpl> upper();
+ PassRefPtr<StringImpl> secure(UChar aChar, bool last = true);
+ PassRefPtr<StringImpl> capitalize(UChar previousCharacter);
+ PassRefPtr<StringImpl> foldCase();
+
+ PassRefPtr<StringImpl> stripWhiteSpace();
+ PassRefPtr<StringImpl> simplifyWhiteSpace();
+
+ PassRefPtr<StringImpl> removeCharacters(CharacterMatchFunctionPtr);
+
+ int find(const char*, int index = 0, bool caseSensitive = true);
+ int find(UChar, int index = 0);
+ int find(CharacterMatchFunctionPtr, int index = 0);
+ int find(StringImpl*, int index, bool caseSensitive = true);
+
+ int reverseFind(UChar, int index);
+ int reverseFind(StringImpl*, int index, bool caseSensitive = true);
+
+ bool startsWith(StringImpl* m_data, bool caseSensitive = true) { return reverseFind(m_data, 0, caseSensitive) == 0; }
+ bool endsWith(StringImpl*, bool caseSensitive = true);
+
+ PassRefPtr<StringImpl> replace(UChar, UChar);
+ PassRefPtr<StringImpl> replace(UChar, StringImpl*);
+ PassRefPtr<StringImpl> replace(StringImpl*, StringImpl*);
+ PassRefPtr<StringImpl> replace(unsigned index, unsigned len, StringImpl*);
+
+ static StringImpl* empty();
+
+ Vector<char> ascii();
+ int wordCount(int maxWordsToCount = INT_MAX);
+
+ WTF::Unicode::Direction defaultWritingDirection();
+
+#if PLATFORM(CF) || (PLATFORM(QT) && PLATFORM(DARWIN))
+ CFStringRef createCFString();
+#endif
+#ifdef __OBJC__
+ operator NSString*();
+#endif
+
+private:
+ unsigned m_length;
+ const UChar* m_data;
+ mutable unsigned m_hash;
+ bool m_inTable;
+ bool m_hasTerminatingNullCharacter;
+};
+
+bool equal(StringImpl*, StringImpl*);
+bool equal(StringImpl*, const char*);
+inline bool equal(const char* a, StringImpl* b) { return equal(b, a); }
+
+bool equalIgnoringCase(StringImpl*, StringImpl*);
+bool equalIgnoringCase(StringImpl*, const char*);
+inline bool equalIgnoringCase(const char* a, StringImpl* b) { return equalIgnoringCase(b, a); }
+
+// Golden ratio - arbitrary start value to avoid mapping all 0's to all 0's
+// or anything like that.
+const unsigned phi = 0x9e3779b9U;
+
+// Paul Hsieh's SuperFastHash
+// http://www.azillionmonkeys.com/qed/hash.html
+inline unsigned StringImpl::computeHash(const UChar* data, unsigned length)
+{
+ unsigned hash = phi;
+
+ // Main loop.
+ for (unsigned pairCount = length >> 1; pairCount; pairCount--) {
+ hash += data[0];
+ unsigned tmp = (data[1] << 11) ^ hash;
+ hash = (hash << 16) ^ tmp;
+ data += 2;
+ hash += hash >> 11;
+ }
+
+ // Handle end case.
+ if (length & 1) {
+ hash += data[0];
+ hash ^= hash << 11;
+ hash += hash >> 17;
+ }
+
+ // Force "avalanching" of final 127 bits.
+ hash ^= hash << 3;
+ hash += hash >> 5;
+ hash ^= hash << 2;
+ hash += hash >> 15;
+ hash ^= hash << 10;
+
+ // This avoids ever returning a hash code of 0, since that is used to
+ // signal "hash not computed yet", using a value that is likely to be
+ // effectively the same as 0 when the low bits are masked.
+ hash |= !hash << 31;
+
+ return hash;
+}
+
+// Paul Hsieh's SuperFastHash
+// http://www.azillionmonkeys.com/qed/hash.html
+inline unsigned StringImpl::computeHash(const char* data)
+{
+ // This hash is designed to work on 16-bit chunks at a time. But since the normal case
+ // (above) is to hash UTF-16 characters, we just treat the 8-bit chars as if they
+ // were 16-bit chunks, which should give matching results
+
+ unsigned hash = phi;
+
+ // Main loop
+ for (;;) {
+ unsigned char b0 = data[0];
+ if (!b0)
+ break;
+ unsigned char b1 = data[1];
+ if (!b1) {
+ hash += b0;
+ hash ^= hash << 11;
+ hash += hash >> 17;
+ break;
+ }
+ hash += b0;
+ unsigned tmp = (b1 << 11) ^ hash;
+ hash = (hash << 16) ^ tmp;
+ data += 2;
+ hash += hash >> 11;
+ }
+
+ // Force "avalanching" of final 127 bits.
+ hash ^= hash << 3;
+ hash += hash >> 5;
+ hash ^= hash << 2;
+ hash += hash >> 15;
+ hash ^= hash << 10;
+
+ // This avoids ever returning a hash code of 0, since that is used to
+ // signal "hash not computed yet", using a value that is likely to be
+ // effectively the same as 0 when the low bits are masked.
+ hash |= !hash << 31;
+
+ return hash;
+}
+
+static inline bool isSpaceOrNewline(UChar c)
+{
+ // Use isASCIISpace() for basic Latin-1.
+ // This will include newlines, which aren't included in Unicode DirWS.
+ return c <= 0x7F ? WTF::isASCIISpace(c) : WTF::Unicode::direction(c) == WTF::Unicode::WhiteSpaceNeutral;
+}
+
+}
+
+namespace WTF {
+
+ // WebCore::StringHash is the default hash for StringImpl* and RefPtr<StringImpl>
+ template<typename T> struct DefaultHash;
+ template<> struct DefaultHash<WebCore::StringImpl*> {
+ typedef WebCore::StringHash Hash;
+ };
+ template<> struct DefaultHash<RefPtr<WebCore::StringImpl> > {
+ typedef WebCore::StringHash Hash;
+ };
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef StringTruncator_h
+#define StringTruncator_h
+
+namespace WebCore {
+
+ class Font;
+ class String;
+
+ class StringTruncator {
+ public:
+ static String centerTruncate(const String&, float maxWidth, const Font&, bool disableRoundingHacks = true);
+ static String rightTruncate(const String&, float maxWidth, const Font&, bool disableRoundingHacks = true);
+ static String centerTruncate(const String&, float maxWidth, const Font&, bool disableRoundingHacks, float& resultWidth);
+ static String rightTruncate(const String&, float maxWidth, const Font&, bool disableRoundingHacks, float& resultWidth);
+ static String leftTruncate(const String&, float maxWidth, const Font&, bool disableRoundingHacks, float& resultWidth);
+ static String rightClipToCharacter(const String&, float maxWidth, const Font&, bool disableRoundingHacks, float& resultWidth);
+ static String rightClipToWord(const String& string, float maxWidth, const Font& font, bool disableRoundingHacks, float& resultWidth);
+ static float width(const String&, const Font&, bool disableRoundingHacks = true);
+ };
+
+} // namespace WebCore
+
+#endif // !defined(StringTruncator_h)
--- /dev/null
+/*
+ Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef StrokeStyleApplier_h
+#define StrokeStyleApplier_h
+
+namespace WebCore {
+
+ class GraphicsContext;
+
+ class StrokeStyleApplier {
+ public:
+ virtual void strokeStyle(GraphicsContext*) = 0;
+
+ protected:
+ StrokeStyleApplier() {}
+ virtual ~StrokeStyleApplier() {}
+ };
+}
+
+#endif
+
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef StyleBackgroundData_h
+#define StyleBackgroundData_h
+
+#include "Color.h"
+#include "FillLayer.h"
+#include "OutlineValue.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class StyleBackgroundData : public RefCounted<StyleBackgroundData> {
+public:
+ static PassRefPtr<StyleBackgroundData> create() { return adoptRef(new StyleBackgroundData); }
+ PassRefPtr<StyleBackgroundData> copy() const { return adoptRef(new StyleBackgroundData(*this)); }
+ ~StyleBackgroundData() { }
+
+ bool operator==(const StyleBackgroundData& o) const;
+ bool operator!=(const StyleBackgroundData& o) const
+ {
+ return !(*this == o);
+ }
+
+ FillLayer m_background;
+ Color m_color;
+ OutlineValue m_outline;
+
+private:
+ StyleBackgroundData();
+ StyleBackgroundData(const StyleBackgroundData&);
+};
+
+} // namespace WebCore
+
+#endif // StyleBackgroundData_h
--- /dev/null
+/*
+ * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 1999 Waldo Bastian (bastian@kde.org)
+ * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmial.com)
+ * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef StyleBase_h
+#define StyleBase_h
+
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+ class String;
+ class StyleSheet;
+ class KURL;
+
+ // Base class for most CSS DOM objects.
+
+ // FIXME: We don't need these to all share one base class.
+ // Refactor so they don't any more.
+
+ class StyleBase : public RefCounted<StyleBase> {
+ public:
+ virtual ~StyleBase() { }
+
+ StyleBase* parent() const { return m_parent; }
+ void setParent(StyleBase* parent) { m_parent = parent; }
+
+ // returns the url of the style sheet this object belongs to
+ KURL baseURL() const;
+
+ virtual bool isCSSStyleSheet() const { return false; }
+ virtual bool isCharsetRule() { return false; }
+ virtual bool isFontFaceRule() { return false; }
+ virtual bool isImportRule() { return false; }
+ virtual bool isKeyframeRule() { return false; }
+ virtual bool isKeyframesRule() { return false; }
+ virtual bool isMediaRule() { return false; }
+ virtual bool isVariablesRule() { return false; }
+
+ virtual bool isRule() { return false; }
+ virtual bool isStyleRule() { return false; }
+ virtual bool isStyleSheet() const { return false; }
+ virtual bool isXSLStyleSheet() const { return false; }
+
+ virtual bool isMutableStyleDeclaration() const { return false; }
+
+ virtual String cssText() const;
+
+ virtual void checkLoaded();
+
+ bool useStrictParsing() const { return !m_parent || m_parent->useStrictParsing(); }
+
+ virtual void insertedIntoParent() { }
+
+ StyleSheet* stylesheet();
+
+ protected:
+ StyleBase(StyleBase* parent)
+ : m_parent(parent)
+ {
+ }
+
+ private:
+ StyleBase* m_parent;
+ };
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef StyleBoxData_h
+#define StyleBoxData_h
+
+#include "Length.h"
+#include <wtf/RefCounted.h>
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+class StyleBoxData : public RefCounted<StyleBoxData> {
+public:
+ static PassRefPtr<StyleBoxData> create() { return adoptRef(new StyleBoxData); }
+ PassRefPtr<StyleBoxData> copy() const { return adoptRef(new StyleBoxData(*this)); }
+
+ bool operator==(const StyleBoxData& o) const;
+ bool operator!=(const StyleBoxData& o) const
+ {
+ return !(*this == o);
+ }
+
+ Length width;
+ Length height;
+
+ Length min_width;
+ Length max_width;
+
+ Length min_height;
+ Length max_height;
+
+ Length vertical_align;
+
+ int z_index;
+ bool z_auto : 1;
+ unsigned boxSizing : 1; // EBoxSizing
+
+private:
+ StyleBoxData();
+ StyleBoxData(const StyleBoxData&);
+};
+
+} // namespace WebCore
+
+#endif // StyleBoxData_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef StyleCachedImage_h
+#define StyleCachedImage_h
+
+#include "CachedResourceHandle.h"
+#include "StyleImage.h"
+
+namespace WebCore {
+
+class CachedImage;
+
+class StyleCachedImage : public StyleImage {
+public:
+ static PassRefPtr<StyleCachedImage> create(CachedImage* image) { return adoptRef(new StyleCachedImage(image)); }
+ virtual WrappedImagePtr data() const { return m_image.get(); }
+
+ virtual bool isCachedImage() const { return true; }
+
+ virtual PassRefPtr<CSSValue> cssValue();
+
+ CachedImage* cachedImage() const { return m_image.get(); }
+
+ virtual bool canRender(float multiplier) const;
+ virtual bool isLoaded() const;
+ virtual bool errorOccurred() const;
+ virtual IntSize imageSize(const RenderObject*, float multiplier) const;
+ virtual bool imageHasRelativeWidth() const;
+ virtual bool imageHasRelativeHeight() const;
+ virtual bool usesImageContainerSize() const;
+ virtual void setImageContainerSize(const IntSize&);
+ virtual void addClient(RenderObject*);
+ virtual void removeClient(RenderObject*);
+ virtual Image* image(RenderObject*, const IntSize&) const;
+
+private:
+ StyleCachedImage(CachedImage* image)
+ : m_image(image)
+ {
+ }
+
+ CachedResourceHandle<CachedImage> m_image;
+};
+
+}
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef StyleDashboardRegion_h
+#define StyleDashboardRegion_h
+#if ENABLE(DASHBOARD_SUPPORT)
+
+#include "LengthBox.h"
+#include "PlatformString.h"
+
+namespace WebCore {
+
+// Dashboard region attributes. Not inherited.
+
+struct StyleDashboardRegion {
+ String label;
+ LengthBox offset;
+ int type;
+
+ enum {
+ None,
+ Circle,
+ Rectangle
+ };
+
+ bool operator==(const StyleDashboardRegion& o) const
+ {
+ return type == o.type && offset == o.offset && label == o.label;
+ }
+
+ bool operator!=(const StyleDashboardRegion& o) const
+ {
+ return !(*this == o);
+ }
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(DASHBOARD_SUPPORT)
+#endif // StyleDashboardRegion_h
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 2006, 2007 Rob Buis
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef StyleElement_h
+#define StyleElement_h
+
+#include "CSSStyleSheet.h"
+
+namespace WebCore {
+
+class Element;
+
+class StyleElement {
+public:
+ StyleElement();
+ virtual ~StyleElement() {}
+
+protected:
+ StyleSheet* sheet(Element*);
+
+ virtual void setLoading(bool) {}
+
+ virtual const AtomicString& type() const = 0;
+ virtual const AtomicString& media() const = 0;
+
+ void insertedIntoDocument(Document*, Element*);
+ void removedFromDocument(Document*);
+ void process(Element*);
+
+ void createSheet(Element* e, const String& text = String());
+
+protected:
+ RefPtr<CSSStyleSheet> m_sheet;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef StyleFlexibleBoxData_h
+#define StyleFlexibleBoxData_h
+
+#include <wtf/RefCounted.h>
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+class StyleFlexibleBoxData : public RefCounted<StyleFlexibleBoxData> {
+public:
+ static PassRefPtr<StyleFlexibleBoxData> create() { return adoptRef(new StyleFlexibleBoxData); }
+ PassRefPtr<StyleFlexibleBoxData> copy() const { return adoptRef(new StyleFlexibleBoxData(*this)); }
+
+ bool operator==(const StyleFlexibleBoxData& o) const;
+ bool operator!=(const StyleFlexibleBoxData& o) const
+ {
+ return !(*this == o);
+ }
+
+ float flex;
+ unsigned int flex_group;
+ unsigned int ordinal_group;
+
+ unsigned align : 3; // EBoxAlignment
+ unsigned pack: 3; // EBoxAlignment
+ unsigned orient: 1; // EBoxOrient
+ unsigned lines : 1; // EBoxLines
+
+private:
+ StyleFlexibleBoxData();
+ StyleFlexibleBoxData(const StyleFlexibleBoxData&);
+};
+
+} // namespace WebCore
+
+#endif // StyleFlexibleBoxData_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef StyleGeneratedImage_h
+#define StyleGeneratedImage_h
+
+#include "StyleImage.h"
+
+namespace WebCore {
+
+class CSSValue;
+class CSSImageGeneratorValue;
+
+class StyleGeneratedImage : public StyleImage {
+public:
+ static PassRefPtr<StyleGeneratedImage> create(CSSImageGeneratorValue* val, bool fixedSize)
+ {
+ return adoptRef(new StyleGeneratedImage(val, fixedSize));
+ }
+
+ virtual WrappedImagePtr data() const { return m_generator; }
+
+ virtual bool isGeneratedImage() const { return true; }
+
+ virtual PassRefPtr<CSSValue> cssValue();
+
+ virtual IntSize imageSize(const RenderObject*, float multiplier) const;
+ virtual bool imageHasRelativeWidth() const { return !m_fixedSize; }
+ virtual bool imageHasRelativeHeight() const { return !m_fixedSize; }
+ virtual bool usesImageContainerSize() const { return !m_fixedSize; }
+ virtual void setImageContainerSize(const IntSize&);
+ virtual void addClient(RenderObject*);
+ virtual void removeClient(RenderObject*);
+ virtual Image* image(RenderObject*, const IntSize&) const;
+
+private:
+ StyleGeneratedImage(CSSImageGeneratorValue* val, bool fixedSize)
+ : m_generator(val)
+ , m_fixedSize(fixedSize)
+ {
+ }
+
+ CSSImageGeneratorValue* m_generator; // The generator holds a reference to us.
+ IntSize m_containerSize;
+ bool m_fixedSize;
+};
+
+}
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef StyleImage_h
+#define StyleImage_h
+
+#include "IntSize.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class CSSValue;
+class Image;
+class RenderObject;
+
+typedef void* WrappedImagePtr;
+
+class StyleImage : public RefCounted<StyleImage> {
+public:
+ virtual ~StyleImage() { }
+
+ bool operator==(const StyleImage& other)
+ {
+ return data() == other.data();
+ }
+
+ virtual PassRefPtr<CSSValue> cssValue() = 0;
+
+ virtual bool canRender(float /*multiplier*/) const { return true; }
+ virtual bool isLoaded() const { return true; }
+ virtual bool errorOccurred() const { return false; }
+ virtual IntSize imageSize(const RenderObject*, float multiplier) const = 0;
+ virtual bool imageHasRelativeWidth() const = 0;
+ virtual bool imageHasRelativeHeight() const = 0;
+ virtual bool usesImageContainerSize() const = 0;
+ virtual void setImageContainerSize(const IntSize&) = 0;
+ virtual void addClient(RenderObject*) = 0;
+ virtual void removeClient(RenderObject*) = 0;
+ virtual Image* image(RenderObject*, const IntSize&) const = 0;
+ virtual WrappedImagePtr data() const = 0;
+ virtual bool isCachedImage() const { return false; }
+ virtual bool isGeneratedImage() const { return false; }
+
+ static bool imagesEquivalent(StyleImage* image1, StyleImage* image2)
+ {
+ if (image1 != image2) {
+ if (!image1 || !image2)
+ return false;
+ return *image1 == *image2;
+ }
+ return true;
+ }
+
+protected:
+ StyleImage() { }
+};
+
+}
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef StyleInheritedData_h
+#define StyleInheritedData_h
+
+#include "Color.h"
+#include "Font.h"
+#include "Length.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class StyleImage;
+class CursorList;
+
+class StyleInheritedData : public RefCounted<StyleInheritedData> {
+public:
+ static PassRefPtr<StyleInheritedData> create() { return adoptRef(new StyleInheritedData); }
+ PassRefPtr<StyleInheritedData> copy() const { return adoptRef(new StyleInheritedData(*this)); }
+ ~StyleInheritedData();
+
+ bool operator==(const StyleInheritedData& o) const;
+ bool operator!=( const StyleInheritedData& o) const
+ {
+ return !(*this == o);
+ }
+
+ Length indent;
+ // could be packed in a short but doesn't
+ // make a difference currently because of padding
+ Length line_height;
+ Length specified_line_height;
+
+ RefPtr<StyleImage> list_style_image;
+ RefPtr<CursorList> cursorData;
+
+ Font font;
+ Color color;
+
+ float m_effectiveZoom;
+
+ short horizontal_border_spacing;
+ short vertical_border_spacing;
+
+ // Paged media properties.
+ short widows;
+ short orphans;
+ unsigned page_break_inside : 2; // EPageBreak
+
+private:
+ StyleInheritedData();
+ StyleInheritedData(const StyleInheritedData&);
+};
+
+} // namespace WebCore
+
+#endif // StyleInheritedData_h
--- /dev/null
+/*
+ * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * 1999 Waldo Bastian (bastian@kde.org)
+ * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef StyleList_h
+#define StyleList_h
+
+#include "StyleBase.h"
+#include <wtf/Forward.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+ // a style class which has a list of children (StyleSheets for example)
+ class StyleList : public StyleBase {
+ public:
+ unsigned length() { return m_children.size(); }
+ StyleBase* item(unsigned num) { return num < length() ? m_children[num].get() : 0; }
+
+ void append(PassRefPtr<StyleBase>);
+ void insert(unsigned position, PassRefPtr<StyleBase>);
+ void remove(unsigned position);
+
+ protected:
+ StyleList(StyleBase* parent) : StyleBase(parent) { }
+
+ Vector<RefPtr<StyleBase> > m_children;
+ };
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef StyleMarqueeData_h
+#define StyleMarqueeData_h
+
+#include "Length.h"
+#include "RenderStyleConstants.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class StyleMarqueeData : public RefCounted<StyleMarqueeData> {
+public:
+ static PassRefPtr<StyleMarqueeData> create() { return adoptRef(new StyleMarqueeData); }
+ PassRefPtr<StyleMarqueeData> copy() const { return adoptRef(new StyleMarqueeData(*this)); }
+
+ bool operator==(const StyleMarqueeData& o) const;
+ bool operator!=(const StyleMarqueeData& o) const
+ {
+ return !(*this == o);
+ }
+
+ Length increment;
+ int speed;
+
+ int loops; // -1 means infinite.
+
+ unsigned behavior : 2; // EMarqueeBehavior
+ EMarqueeDirection direction : 3; // not unsigned because EMarqueeDirection has negative values
+
+private:
+ StyleMarqueeData();
+ StyleMarqueeData(const StyleMarqueeData&);
+};
+
+} // namespace WebCore
+
+#endif // StyleMarqueeData_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef StyleMultiColData_h
+#define StyleMultiColData_h
+
+#include "BorderValue.h"
+#include "Length.h"
+#include "RenderStyleConstants.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+// CSS3 Multi Column Layout
+
+class StyleMultiColData : public RefCounted<StyleMultiColData> {
+public:
+ static PassRefPtr<StyleMultiColData> create() { return adoptRef(new StyleMultiColData); }
+ PassRefPtr<StyleMultiColData> copy() const { return adoptRef(new StyleMultiColData(*this)); }
+
+ bool operator==(const StyleMultiColData& o) const;
+ bool operator!=(const StyleMultiColData &o) const
+ {
+ return !(*this == o);
+ }
+
+ unsigned short ruleWidth() const
+ {
+ if (m_rule.style() == BNONE || m_rule.style() == BHIDDEN)
+ return 0;
+ return m_rule.width;
+ }
+
+ float m_width;
+ unsigned short m_count;
+ float m_gap;
+ BorderValue m_rule;
+
+ bool m_autoWidth : 1;
+ bool m_autoCount : 1;
+ bool m_normalGap : 1;
+ unsigned m_breakBefore : 2; // EPageBreak
+ unsigned m_breakAfter : 2; // EPageBreak
+ unsigned m_breakInside : 2; // EPageBreak
+
+private:
+ StyleMultiColData();
+ StyleMultiColData(const StyleMultiColData&);
+};
+
+} // namespace WebCore
+
+#endif // StyleMultiColData_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef StyleRareInheritedData_h
+#define StyleRareInheritedData_h
+
+#include "AtomicString.h"
+#include "Color.h"
+#include <wtf/RefCounted.h>
+#include <wtf/PassRefPtr.h>
+
+#include "TextSizeAdjustment.h"
+
+namespace WebCore {
+
+struct ShadowData;
+
+// This struct is for rarely used inherited CSS3, CSS2, and WebKit-specific properties.
+// By grouping them together, we save space, and only allocate this object when someone
+// actually uses one of these properties.
+class StyleRareInheritedData : public RefCounted<StyleRareInheritedData> {
+public:
+ static PassRefPtr<StyleRareInheritedData> create() { return adoptRef(new StyleRareInheritedData); }
+ PassRefPtr<StyleRareInheritedData> copy() const { return adoptRef(new StyleRareInheritedData(*this)); }
+ ~StyleRareInheritedData();
+
+ bool operator==(const StyleRareInheritedData& o) const;
+ bool operator!=(const StyleRareInheritedData& o) const
+ {
+ return !(*this == o);
+ }
+ bool shadowDataEquivalent(const StyleRareInheritedData&) const;
+
+ Color textStrokeColor;
+ float textStrokeWidth;
+ Color textFillColor;
+
+ ShadowData* textShadow; // Our text shadow information for shadowed text drawing.
+ AtomicString highlight; // Apple-specific extension for custom highlight rendering.
+ unsigned textSecurity : 2; // ETextSecurity
+ unsigned userModify : 2; // EUserModify (editing)
+ unsigned wordBreak : 2; // EWordBreak
+ unsigned wordWrap : 1; // EWordWrap
+ unsigned nbspMode : 1; // ENBSPMode
+ unsigned khtmlLineBreak : 1; // EKHTMLLineBreak
+ TextSizeAdjustment textSizeAdjust; // An Apple extension to an Apple extension.
+ unsigned resize : 2; // EResize
+ unsigned userSelect : 1; // EUserSelect
+ unsigned touchCalloutEnabled : 1;
+ Color tapHighlightColor;
+ Color compositionFillColor;
+ Color compositionFrameColor;
+
+private:
+ StyleRareInheritedData();
+ StyleRareInheritedData(const StyleRareInheritedData&);
+};
+
+} // namespace WebCore
+
+#endif // StyleRareInheritedData_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef StyleRareNonInheritedData_h
+#define StyleRareNonInheritedData_h
+
+#include "CounterDirectives.h"
+#include "CursorData.h"
+#include "DataRef.h"
+#include "FillLayer.h"
+#include "NinePieceImage.h"
+#include "StyleTransformData.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class AnimationList;
+class CSSStyleSelector;
+class StyleFlexibleBoxData;
+class StyleMarqueeData;
+class StyleMultiColData;
+class StyleReflection;
+class StyleTransformData;
+struct ContentData;
+struct ShadowData;
+
+#if ENABLE(DASHBOARD_SUPPORT)
+class StyleDashboardRegion;
+#endif
+
+#if ENABLE(XBL)
+class BindingURI;
+#endif
+
+// This struct is for rarely used non-inherited CSS3, CSS2, and WebKit-specific properties.
+// By grouping them together, we save space, and only allocate this object when someone
+// actually uses one of these properties.
+class StyleRareNonInheritedData : public RefCounted<StyleRareNonInheritedData> {
+public:
+ static PassRefPtr<StyleRareNonInheritedData> create() { return adoptRef(new StyleRareNonInheritedData); }
+ PassRefPtr<StyleRareNonInheritedData> copy() const { return adoptRef(new StyleRareNonInheritedData(*this)); }
+ ~StyleRareNonInheritedData();
+
+#if ENABLE(XBL)
+ bool bindingsEquivalent(const StyleRareNonInheritedData&) const;
+#endif
+
+ bool operator==(const StyleRareNonInheritedData&) const;
+ bool operator!=(const StyleRareNonInheritedData& o) const { return !(*this == o); }
+
+ bool shadowDataEquivalent(const StyleRareNonInheritedData& o) const;
+ bool reflectionDataEquivalent(const StyleRareNonInheritedData& o) const;
+ bool animationDataEquivalent(const StyleRareNonInheritedData&) const;
+ bool transitionDataEquivalent(const StyleRareNonInheritedData&) const;
+
+ int lineClamp; // An Apple extension.
+#if ENABLE(DASHBOARD_SUPPORT)
+ Vector<StyleDashboardRegion> m_dashboardRegions;
+#endif
+ float opacity; // Whether or not we're transparent.
+
+ DataRef<StyleFlexibleBoxData> flexibleBox; // Flexible box properties
+ DataRef<StyleMarqueeData> marquee; // Marquee properties
+ DataRef<StyleMultiColData> m_multiCol; // CSS3 multicol properties
+ DataRef<StyleTransformData> m_transform; // Transform properties (rotate, scale, skew, etc.)
+
+ OwnPtr<ContentData> m_content;
+ OwnPtr<CounterDirectiveMap> m_counterDirectives;
+
+ unsigned userDrag : 2; // EUserDrag
+ bool textOverflow : 1; // Whether or not lines that spill out should be truncated with "..."
+ unsigned marginTopCollapse : 2; // EMarginCollapse
+ unsigned marginBottomCollapse : 2; // EMarginCollapse
+ unsigned matchNearestMailBlockquoteColor : 1; // EMatchNearestMailBlockquoteColor, FIXME: This property needs to be eliminated. It should never have been added.
+ unsigned m_appearance : 6; // EAppearance
+ unsigned m_borderFit : 1; // EBorderFit
+#if USE(ACCELERATED_COMPOSITING)
+ bool m_runningAcceleratedAnimation : 1;
+#endif
+ unsigned m_imageLoadingBorder : 1;
+ OwnPtr<ShadowData> m_boxShadow; // For box-shadow decorations.
+
+ RefPtr<StyleReflection> m_boxReflect;
+
+ OwnPtr<AnimationList> m_animations;
+ OwnPtr<AnimationList> m_transitions;
+
+ FillLayer m_mask;
+ NinePieceImage m_maskBoxImage;
+
+ ETransformStyle3D m_transformStyle3D;
+ EBackfaceVisibility m_backfaceVisibility;
+ float m_perspective;
+ Length m_perspectiveOriginX;
+ Length m_perspectiveOriginY;
+
+#if ENABLE(XBL)
+ OwnPtr<BindingURI> bindingURI; // The XBL binding URI list.
+#endif
+
+private:
+ StyleRareNonInheritedData();
+ StyleRareNonInheritedData(const StyleRareNonInheritedData&);
+};
+
+} // namespace WebCore
+
+#endif // StyleRareNonInheritedData_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef StyleReflection_h
+#define StyleReflection_h
+
+#include "CSSReflectionDirection.h"
+#include "Length.h"
+#include "NinePieceImage.h"
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class StyleReflection : public RefCounted<StyleReflection> {
+public:
+ static PassRefPtr<StyleReflection> create()
+ {
+ return adoptRef(new StyleReflection);
+ }
+
+ bool operator==(const StyleReflection& o) const
+ {
+ return m_direction == o.m_direction && m_offset == o.m_offset && m_mask == o.m_mask;
+ }
+ bool operator!=(const StyleReflection& o) const { return !(*this == o); }
+
+ CSSReflectionDirection direction() const { return m_direction; }
+ Length offset() const { return m_offset; }
+ const NinePieceImage& mask() const { return m_mask; }
+
+ void setDirection(CSSReflectionDirection dir) { m_direction = dir; }
+ void setOffset(const Length& l) { m_offset = l; }
+ void setMask(const NinePieceImage& image) { m_mask = image; }
+
+private:
+ StyleReflection()
+ : m_direction(ReflectionBelow)
+ , m_offset(0, Fixed)
+ {
+ }
+
+ CSSReflectionDirection m_direction;
+ Length m_offset;
+ NinePieceImage m_mask;
+};
+
+} // namespace WebCore
+
+#endif // StyleReflection_h
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef StyleSheet_h
+#define StyleSheet_h
+
+#include "KURLHash.h"
+#include "PlatformString.h"
+#include "StyleList.h"
+#include <wtf/ListHashSet.h>
+
+namespace WebCore {
+
+class CachedCSSStyleSheet;
+class MediaList;
+class Node;
+
+class StyleSheet : public StyleList {
+public:
+ virtual ~StyleSheet();
+
+ bool disabled() const { return m_disabled; }
+ void setDisabled(bool disabled) { m_disabled = disabled; styleSheetChanged(); }
+
+ Node* ownerNode() const { return m_parentNode; }
+ StyleSheet *parentStyleSheet() const;
+ const String& href() const { return m_strHref; }
+ void setHref(const String& href) { m_strHref = href; }
+ const String& title() const { return m_strTitle; }
+ void setTitle(const String& s) { m_strTitle = s; }
+ MediaList* media() const { return m_media.get(); }
+ void setMedia(PassRefPtr<MediaList>);
+
+ virtual String type() const = 0;
+ virtual bool isLoading() = 0;
+ virtual void styleSheetChanged() { }
+
+ virtual KURL completeURL(const String& url) const;
+ virtual void addSubresourceStyleURLs(ListHashSet<KURL>&) { }
+
+ virtual bool parseString(const String&, bool strict = true) = 0;
+
+protected:
+ StyleSheet(Node* ownerNode, const String& href);
+ StyleSheet(StyleSheet* parentSheet, const String& href);
+ StyleSheet(StyleBase* owner, const String& href);
+
+private:
+ virtual bool isStyleSheet() const { return true; }
+
+ Node* m_parentNode;
+ String m_strHref;
+ String m_strTitle;
+ RefPtr<MediaList> m_media;
+ bool m_disabled;
+};
+
+} // namespace
+
+#endif
--- /dev/null
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef StyleSheetList_h
+#define StyleSheetList_h
+
+#include <wtf/RefCounted.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class Document;
+class HTMLStyleElement;
+class StyleSheet;
+class String;
+
+typedef Vector<RefPtr<StyleSheet> > StyleSheetVector;
+
+class StyleSheetList : public RefCounted<StyleSheetList> {
+public:
+ static PassRefPtr<StyleSheetList> create(Document* doc) { return adoptRef(new StyleSheetList(doc)); }
+ ~StyleSheetList();
+
+ void documentDestroyed();
+
+ unsigned length() const;
+ StyleSheet* item(unsigned index);
+
+ HTMLStyleElement* getNamedItem(const String&) const;
+
+ void swap(StyleSheetVector& sheets)
+ {
+ m_sheets.swap(sheets);
+ }
+
+private:
+ StyleSheetList(Document*);
+
+ Document* m_doc;
+ StyleSheetVector m_sheets;
+};
+
+} // namespace WebCore
+
+#endif // StyleSheetList_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef StyleSurroundData_h
+#define StyleSurroundData_h
+
+#include "BorderData.h"
+#include "LengthBox.h"
+#include <wtf/RefCounted.h>
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+class StyleSurroundData : public RefCounted<StyleSurroundData> {
+public:
+ static PassRefPtr<StyleSurroundData> create() { return adoptRef(new StyleSurroundData); }
+ PassRefPtr<StyleSurroundData> copy() const { return adoptRef(new StyleSurroundData(*this)); }
+
+ bool operator==(const StyleSurroundData& o) const;
+ bool operator!=(const StyleSurroundData& o) const
+ {
+ return !(*this == o);
+ }
+
+ LengthBox offset;
+ LengthBox margin;
+ LengthBox padding;
+ BorderData border;
+
+private:
+ StyleSurroundData();
+ StyleSurroundData(const StyleSurroundData&);
+};
+
+} // namespace WebCore
+
+#endif // StyleSurroundData_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef StyleTransformData_h
+#define StyleTransformData_h
+
+#include "Length.h"
+#include "TransformOperations.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class StyleTransformData : public RefCounted<StyleTransformData> {
+public:
+ static PassRefPtr<StyleTransformData> create() { return adoptRef(new StyleTransformData); }
+ PassRefPtr<StyleTransformData> copy() const { return adoptRef(new StyleTransformData(*this)); }
+
+ bool operator==(const StyleTransformData& o) const;
+ bool operator!=(const StyleTransformData& o) const
+ {
+ return !(*this == o);
+ }
+
+ TransformOperations m_operations;
+ Length m_x;
+ Length m_y;
+ float m_z;
+
+private:
+ StyleTransformData();
+ StyleTransformData(const StyleTransformData&);
+};
+
+} // namespace WebCore
+
+#endif // StyleTransformData_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef StyleVisualData_h
+#define StyleVisualData_h
+
+#include "LengthBox.h"
+#include <wtf/RefCounted.h>
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+class StyleVisualData : public RefCounted<StyleVisualData> {
+public:
+ static PassRefPtr<StyleVisualData> create() { return adoptRef(new StyleVisualData); }
+ PassRefPtr<StyleVisualData> copy() const { return adoptRef(new StyleVisualData(*this)); }
+ ~StyleVisualData();
+
+ bool operator==(const StyleVisualData& o) const
+ {
+ return ( clip == o.clip &&
+ hasClip == o.hasClip &&
+ counterIncrement == o.counterIncrement &&
+ counterReset == o.counterReset &&
+ textDecoration == o.textDecoration &&
+ m_zoom == o.m_zoom);
+ }
+ bool operator!=(const StyleVisualData& o) const { return !(*this == o); }
+
+ LengthBox clip;
+ bool hasClip : 1;
+ unsigned textDecoration : 4; // Text decorations defined *only* by this element.
+
+ short counterIncrement; // ok, so these are not visual mode specific
+ short counterReset; // can't go to inherited, since these are not inherited
+
+ float m_zoom;
+
+private:
+ StyleVisualData();
+ StyleVisualData(const StyleVisualData&);
+};
+
+} // namespace WebCore
+
+#endif // StyleVisualData_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Peter Kelly (pmk@post.com)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef StyledElement_h
+#define StyledElement_h
+
+#include "Element.h"
+#include "NamedMappedAttrMap.h"
+
+namespace WebCore {
+
+class CSSMappedAttributeDeclaration;
+class MappedAttribute;
+
+class StyledElement : public Element {
+public:
+ StyledElement(const QualifiedName&, Document*);
+ virtual ~StyledElement();
+
+ virtual bool isStyledElement() const { return true; }
+
+ NamedMappedAttrMap* mappedAttributes() { return static_cast<NamedMappedAttrMap*>(namedAttrMap.get()); }
+ const NamedMappedAttrMap* mappedAttributes() const { return static_cast<NamedMappedAttrMap*>(namedAttrMap.get()); }
+ bool hasMappedAttributes() const { return namedAttrMap && mappedAttributes()->hasMappedAttributes(); }
+ bool isMappedAttribute(const QualifiedName& name) const { MappedAttributeEntry res = eNone; mapToEntry(name, res); return res != eNone; }
+
+ void addCSSLength(MappedAttribute* attr, int id, const String &value);
+ void addCSSProperty(MappedAttribute* attr, int id, const String &value);
+ void addCSSProperty(MappedAttribute* attr, int id, int value);
+ void addCSSStringProperty(MappedAttribute* attr, int id, const String &value, CSSPrimitiveValue::UnitTypes = CSSPrimitiveValue::CSS_STRING);
+ void addCSSImageProperty(MappedAttribute*, int propertyID, const String& url);
+ void addCSSColor(MappedAttribute* attr, int id, const String &c);
+ void createMappedDecl(MappedAttribute* attr);
+
+ static CSSMappedAttributeDeclaration* getMappedAttributeDecl(MappedAttributeEntry type, const QualifiedName& name, const AtomicString& value);
+ static void setMappedAttributeDecl(MappedAttributeEntry, const QualifiedName& name, const AtomicString& value, CSSMappedAttributeDeclaration*);
+ static void removeMappedAttributeDecl(MappedAttributeEntry type, const QualifiedName& name, const AtomicString& value);
+
+ static CSSMappedAttributeDeclaration* getMappedAttributeDecl(MappedAttributeEntry, Attribute*);
+ static void setMappedAttributeDecl(MappedAttributeEntry, Attribute*, CSSMappedAttributeDeclaration*);
+
+ CSSMutableStyleDeclaration* inlineStyleDecl() const { return m_inlineStyleDecl.get(); }
+ virtual bool canHaveAdditionalAttributeStyleDecls() const { return false; }
+ virtual void additionalAttributeStyleDecls(Vector<CSSMutableStyleDeclaration*>&) {};
+ CSSMutableStyleDeclaration* getInlineStyleDecl();
+ CSSStyleDeclaration* style();
+ void createInlineStyleDecl();
+ void destroyInlineStyleDecl();
+ void invalidateStyleAttribute();
+ virtual void updateStyleAttribute() const;
+
+ const ClassNames& classNames() const { ASSERT(hasClass()); ASSERT(mappedAttributes()); return mappedAttributes()->classNames(); }
+
+ virtual void attributeChanged(Attribute*, bool preserveDecls = false);
+ virtual void parseMappedAttribute(MappedAttribute*);
+ virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
+ virtual void createAttributeMap() const;
+ virtual PassRefPtr<Attribute> createAttribute(const QualifiedName&, const AtomicString& value);
+
+ virtual void copyNonAttributeProperties(const Element*);
+
+ virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
+
+protected:
+ // classAttributeChanged() exists to share code between
+ // parseMappedAttribute (called via setAttribute()) and
+ // svgAttributeChanged (called when element.className.baseValue is set)
+ void classAttributeChanged(const AtomicString& newClassString);
+
+ RefPtr<CSSMutableStyleDeclaration> m_inlineStyleDecl;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SubresourceLoader_h
+#define SubresourceLoader_h
+
+#include "ResourceLoader.h"
+
+namespace WebCore {
+
+ class ResourceRequest;
+ class SubresourceLoaderClient;
+
+ class SubresourceLoader : public ResourceLoader {
+ public:
+ static PassRefPtr<SubresourceLoader> create(Frame*, SubresourceLoaderClient*, const ResourceRequest&, bool skipCanLoadCheck = false, bool sendResourceLoadCallbacks = true, bool shouldContentSniff = true);
+
+ void clearClient() { m_client = 0; }
+
+ private:
+ SubresourceLoader(Frame*, SubresourceLoaderClient*, bool sendResourceLoadCallbacks, bool shouldContentSniff);
+ virtual ~SubresourceLoader();
+
+ virtual void willSendRequest(ResourceRequest&, const ResourceResponse& redirectResponse);
+ virtual void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent);
+ virtual void didReceiveResponse(const ResourceResponse&);
+ virtual void didReceiveData(const char*, int, long long lengthReceived, bool allAtOnce);
+ virtual void didFinishLoading();
+ virtual void didFail(const ResourceError&);
+ virtual bool shouldUseCredentialStorage();
+ virtual void didReceiveAuthenticationChallenge(const AuthenticationChallenge&);
+ virtual void receivedCancellation(const AuthenticationChallenge&);
+ virtual void didCancel(const ResourceError&);
+
+ SubresourceLoaderClient* m_client;
+ bool m_loadingMultipartContent;
+ };
+
+}
+
+#endif // SubresourceLoader_h
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SubresourceLoaderClient_h
+#define SubresourceLoaderClient_h
+
+namespace WebCore {
+
+class AuthenticationChallenge;
+class ResourceError;
+class ResourceRequest;
+class ResourceResponse;
+class SubresourceLoader;
+
+class SubresourceLoaderClient {
+public:
+ virtual ~SubresourceLoaderClient() { }
+
+ // request may be modified
+ virtual void willSendRequest(SubresourceLoader*, ResourceRequest&, const ResourceResponse& /*redirectResponse*/) { }
+ virtual void didSendData(SubresourceLoader*, unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/) { }
+
+ virtual void didReceiveResponse(SubresourceLoader*, const ResourceResponse&) { }
+ virtual void didReceiveData(SubresourceLoader*, const char*, int /*lengthReceived*/) { }
+ virtual void didFinishLoading(SubresourceLoader*) { }
+ virtual void didFail(SubresourceLoader*, const ResourceError&) { }
+
+ virtual bool getShouldUseCredentialStorage(SubresourceLoader*, bool& /*shouldUseCredentialStorage*/) { return false; }
+ virtual void didReceiveAuthenticationChallenge(SubresourceLoader*, const AuthenticationChallenge&) { }
+ virtual void receivedCancellation(SubresourceLoader*, const AuthenticationChallenge&) { }
+
+};
+
+} // namespace WebCore
+
+#endif // SubresourceLoaderClient_h
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SubstituteData_h
+#define SubstituteData_h
+
+#include "KURL.h"
+#include "SharedBuffer.h"
+#include "PlatformString.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+ class SubstituteData {
+ public:
+ SubstituteData() { }
+
+ SubstituteData(PassRefPtr<SharedBuffer> content, const String& mimeType, const String& textEncoding, const KURL& failingURL, const KURL& responseURL = KURL())
+ : m_content(content)
+ , m_mimeType(mimeType)
+ , m_textEncoding(textEncoding)
+ , m_failingURL(failingURL)
+ , m_responseURL(responseURL)
+ {
+ }
+
+ bool isValid() const { return m_content != 0; }
+
+ const SharedBuffer* content() const { return m_content.get(); }
+ const String& mimeType() const { return m_mimeType; }
+ const String& textEncoding() const { return m_textEncoding; }
+ const KURL& failingURL() const { return m_failingURL; }
+ const KURL& responseURL() const { return m_responseURL; }
+
+ private:
+ RefPtr<SharedBuffer> m_content;
+ String m_mimeType;
+ String m_textEncoding;
+ KURL m_failingURL;
+ KURL m_responseURL;
+ };
+
+}
+
+#endif // SubstituteData_h
+
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SubstituteResource_h
+#define SubstituteResource_h
+
+#include <wtf/RefCounted.h>
+
+#include "KURL.h"
+#include "ResourceResponse.h"
+#include "SharedBuffer.h"
+
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class SubstituteResource : public RefCounted<SubstituteResource> {
+public:
+ virtual ~SubstituteResource() { }
+
+ const KURL& url() const { return m_url; }
+ const ResourceResponse& response() const { return m_response; }
+ SharedBuffer* data() const { return m_data.get(); }
+
+protected:
+ SubstituteResource(const KURL& url, const ResourceResponse& response, PassRefPtr<SharedBuffer> data)
+ : m_url(url)
+ , m_response(response)
+ , m_data(data)
+ {
+ ASSERT(m_data);
+ }
+
+private:
+ KURL m_url;
+ ResourceResponse m_response;
+ RefPtr<SharedBuffer> m_data;
+};
+
+}
+
+#endif // SubstituteResource_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SystemMemory_h
+#define SystemMemory_h
+
+namespace WebCore {
+
+ bool hasEnoughMemoryFor(unsigned bytes);
+ // 0-100
+ int systemMemoryLevel();
+ size_t systemTotalMemory();
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SystemTime_h
+#define SystemTime_h
+
+namespace WebCore {
+
+ // Return the number of seconds since a user event has been generated
+ float userIdleTime();
+
+}
+
+#endif
--- /dev/null
+/*
+ * This file is part of the HTML rendering engine for KDE.
+ *
+ * Copyright (C) 2002 Lars Knoll (knoll@kde.org)
+ * (C) 2002 Dirk Mueller (mueller@kde.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef TableLayout_h
+#define TableLayout_h
+
+namespace WebCore {
+
+class RenderTable;
+
+class TableLayout {
+public:
+ TableLayout(RenderTable* table)
+ : m_table(table)
+ {
+ }
+
+ virtual ~TableLayout() { }
+
+ virtual void calcPrefWidths(int& minWidth, int& maxWidth) = 0;
+ virtual void layout() = 0;
+
+protected:
+ RenderTable* m_table;
+};
+
+} // namespace WebCore
+
+#endif // TableLayout_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef TagNodeList_h
+#define TagNodeList_h
+
+#include "AtomicString.h"
+#include "DynamicNodeList.h"
+
+namespace WebCore {
+
+ // NodeList that limits to a particular tag.
+ class TagNodeList : public DynamicNodeList {
+ public:
+ static PassRefPtr<TagNodeList> create(PassRefPtr<Node> rootNode, const AtomicString& namespaceURI, const AtomicString& localName, DynamicNodeList::Caches* caches)
+ {
+ return adoptRef(new TagNodeList(rootNode, namespaceURI, localName, caches));
+ }
+
+ private:
+ TagNodeList(PassRefPtr<Node> rootNode, const AtomicString& namespaceURI, const AtomicString& localName, DynamicNodeList::Caches* caches);
+
+ virtual bool nodeMatches(Element*) const;
+
+ AtomicString m_namespaceURI;
+ AtomicString m_localName;
+ };
+
+} // namespace WebCore
+
+#endif // TagNodeList_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Text_h
+#define Text_h
+
+#include "CharacterData.h"
+
+namespace WebCore {
+
+const unsigned cTextNodeLengthLimit = 1 << 16;
+
+class Text : public CharacterData {
+public:
+ Text(Document *impl, const String &_text);
+ Text(Document *impl);
+ virtual ~Text();
+
+ // DOM methods & attributes for CharacterData
+
+ PassRefPtr<Text> splitText(unsigned offset, ExceptionCode&);
+
+ // DOM Level 3: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-1312295772
+ String wholeText() const;
+ PassRefPtr<Text> replaceWholeText(const String&, ExceptionCode&);
+
+ // DOM methods overridden from parent classes
+
+ virtual String nodeName() const;
+ virtual NodeType nodeType() const;
+ virtual PassRefPtr<Node> cloneNode(bool deep);
+
+ // Other methods (not part of DOM)
+
+ virtual void attach();
+ virtual bool rendererIsNeeded(RenderStyle*);
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+ virtual void recalcStyle(StyleChange = NoChange);
+ virtual bool childTypeAllowed(NodeType);
+
+ static PassRefPtr<Text> createWithLengthLimit(Document*, const String&, unsigned& charsLeft, unsigned maxChars = cTextNodeLengthLimit);
+
+#if ENABLE(WML)
+ virtual void insertedIntoDocument();
+#endif
+
+#ifndef NDEBUG
+ virtual void formatForDebugger(char* buffer, unsigned length) const;
+#endif
+
+protected:
+ virtual PassRefPtr<Text> createNew(PassRefPtr<StringImpl>);
+};
+
+} // namespace WebCore
+
+#endif // Text_h
--- /dev/null
+/*
+ * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TextAffinity_h
+#define TextAffinity_h
+
+#include <wtf/Platform.h>
+
+
+namespace WebCore {
+
+// These match the AppKit values for these concepts.
+// From NSTextView.h:
+// NSSelectionAffinityUpstream = 0
+// NSSelectionAffinityDownstream = 1
+enum EAffinity { UPSTREAM = 0, DOWNSTREAM = 1 };
+
+} // namespace WebCore
+
+#ifdef __OBJC__
+
+inline NSSelectionAffinity kit(WebCore::EAffinity affinity)
+{
+ return static_cast<NSSelectionAffinity>(affinity);
+}
+
+inline WebCore::EAffinity core(NSSelectionAffinity affinity)
+{
+ return static_cast<WebCore::EAffinity>(affinity);
+}
+
+#endif
+
+#endif // TextAffinity_h
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TextBoundaries_h
+#define TextBoundaries_h
+
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+ char* currentTextBreakLocaleID();
+ inline bool requiresContextForWordBoundary(UChar32 ch) { return WTF::Unicode::hasLineBreakingPropertyComplexContextOrIdeographic(ch); }
+
+ void findWordBoundary(const UChar*, int len, int position, int* start, int* end);
+ int findNextWordFromIndex(const UChar*, int len, int position, bool forward);
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006 Lars Knoll <lars@trolltech.com>
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TextBreakIterator_h
+#define TextBreakIterator_h
+
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+ class TextBreakIterator;
+
+ // Note: The returned iterator is good only until you get another iterator.
+
+ // Iterates over "extended grapheme clusters", as defined in UAX #29.
+ // Note that platform implementations may be less sophisticated - e.g. ICU prior to
+ // version 4.0 only supports "legacy grapheme clusters".
+ // Use this for general text processing, e.g. string truncation.
+ TextBreakIterator* characterBreakIterator(const UChar*, int length);
+
+ // This is similar to character break iterator in most cases, but is subject to
+ // platform UI conventions. One notable example where this can be different
+ // from character break iterator is Thai prepend characters, see bug 24342.
+ // Use this for insertion point and selection manipulations.
+ TextBreakIterator* cursorMovementIterator(const UChar*, int length);
+
+ TextBreakIterator* wordBreakIterator(const UChar*, int length);
+ TextBreakIterator* lineBreakIterator(const UChar*, int length);
+ TextBreakIterator* sentenceBreakIterator(const UChar*, int length);
+
+ int textBreakFirst(TextBreakIterator*);
+ int textBreakNext(TextBreakIterator*);
+ int textBreakCurrent(TextBreakIterator*);
+ int textBreakPreceding(TextBreakIterator*, int);
+ int textBreakFollowing(TextBreakIterator*, int);
+ bool isTextBreak(TextBreakIterator*, int);
+
+ const int TextBreakDone = -1;
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TextBreakIteratorInternalICU_h
+#define TextBreakIteratorInternalICU_h
+
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+ const char* currentTextBreakLocaleID();
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TextCodec_h
+#define TextCodec_h
+
+#include <memory>
+#include <wtf/Noncopyable.h>
+#include <wtf/Vector.h>
+#include <wtf/unicode/Unicode.h>
+
+#include "PlatformString.h"
+
+namespace WebCore {
+ class TextEncoding;
+
+ // Specifies what will happen when a character is encountered that is
+ // not encodable in the character set.
+ enum UnencodableHandling {
+ // Substitutes the replacement character "?".
+ QuestionMarksForUnencodables,
+
+ // Encodes the character as an XML entity. For example, U+06DE
+ // would be "۞" (0x6DE = 1758 in octal).
+ EntitiesForUnencodables,
+
+ // Encodes the character as en entity as above, but escaped
+ // non-alphanumeric characters. This is used in URLs.
+ // For example, U+6DE would be "%26%231758%3B".
+ URLEncodedEntitiesForUnencodables,
+ };
+
+ typedef char UnencodableReplacementArray[32];
+
+ class TextCodec : Noncopyable {
+ public:
+ virtual ~TextCodec();
+
+ String decode(const char* str, size_t length, bool flush = false)
+ {
+ bool ignored;
+ return decode(str, length, flush, false, ignored);
+ }
+
+ virtual String decode(const char*, size_t length, bool flush, bool stopOnError, bool& sawError) = 0;
+ virtual CString encode(const UChar*, size_t length, UnencodableHandling) = 0;
+
+ // Fills a null-terminated string representation of the given
+ // unencodable character into the given replacement buffer.
+ // The length of the string (not including the null) will be returned.
+ static int getUnencodableReplacement(unsigned codePoint, UnencodableHandling, UnencodableReplacementArray);
+ };
+
+ typedef void (*EncodingNameRegistrar)(const char* alias, const char* name);
+
+ typedef std::auto_ptr<TextCodec> (*NewTextCodecFunction)(const TextEncoding&, const void* additionalData);
+ typedef void (*TextCodecRegistrar)(const char* name, NewTextCodecFunction, const void* additionalData);
+
+} // namespace WebCore
+
+#endif // TextCodec_h
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TextCodecICU_h
+#define TextCodecICU_h
+
+#include "TextCodec.h"
+#include "TextEncoding.h"
+
+typedef struct UConverter UConverter;
+
+namespace WebCore {
+
+ class TextCodecICU : public TextCodec {
+ public:
+ static void registerBaseEncodingNames(EncodingNameRegistrar);
+ static void registerBaseCodecs(TextCodecRegistrar);
+
+ static void registerExtendedEncodingNames(EncodingNameRegistrar);
+ static void registerExtendedCodecs(TextCodecRegistrar);
+
+ TextCodecICU(const TextEncoding&);
+ virtual ~TextCodecICU();
+
+ virtual String decode(const char*, size_t length, bool flush, bool stopOnError, bool& sawError);
+ virtual CString encode(const UChar*, size_t length, UnencodableHandling);
+
+ private:
+ void createICUConverter() const;
+ void releaseICUConverter() const;
+ bool needsGBKFallbacks() const { return m_needsGBKFallbacks; }
+ void setNeedsGBKFallbacks(bool needsFallbacks) { m_needsGBKFallbacks = needsFallbacks; }
+
+ int decodeToBuffer(UChar* buffer, UChar* bufferLimit, const char*& source,
+ const char* sourceLimit, int32_t* offsets, bool flush, UErrorCode& err);
+
+ TextEncoding m_encoding;
+ unsigned m_numBufferedBytes;
+ unsigned char m_bufferedBytes[16]; // bigger than any single multi-byte character
+ mutable UConverter* m_converterICU;
+ mutable bool m_needsGBKFallbacks;
+ };
+
+ struct ICUConverterWrapper {
+ ICUConverterWrapper()
+ : converter(0)
+ {
+ }
+ ~ICUConverterWrapper();
+
+ UConverter* converter;
+ };
+
+} // namespace WebCore
+
+#endif // TextCodecICU_h
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TextCodecLatin1_h
+#define TextCodecLatin1_h
+
+#include "TextCodec.h"
+
+namespace WebCore {
+
+ class TextCodecLatin1 : public TextCodec {
+ public:
+ static void registerEncodingNames(EncodingNameRegistrar);
+ static void registerCodecs(TextCodecRegistrar);
+
+ virtual String decode(const char*, size_t length, bool flush, bool stopOnError, bool& sawError);
+ virtual CString encode(const UChar*, size_t length, UnencodableHandling);
+ };
+
+} // namespace WebCore
+
+#endif // TextCodecLatin1_h
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TextCodecUTF16_h
+#define TextCodecUTF16_h
+
+#include "TextCodec.h"
+
+namespace WebCore {
+
+ class TextCodecUTF16 : public TextCodec {
+ public:
+ static void registerEncodingNames(EncodingNameRegistrar);
+ static void registerCodecs(TextCodecRegistrar);
+
+ TextCodecUTF16(bool littleEndian) : m_littleEndian(littleEndian), m_haveBufferedByte(false) { }
+
+ virtual String decode(const char*, size_t length, bool flush, bool stopOnError, bool& sawError);
+ virtual CString encode(const UChar*, size_t length, UnencodableHandling);
+
+ private:
+ bool m_littleEndian;
+ bool m_haveBufferedByte;
+ unsigned char m_bufferedByte;
+ };
+
+} // namespace WebCore
+
+#endif // TextCodecUTF16_h
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TextCodecUserDefined_h
+#define TextCodecUserDefined_h
+
+#include "TextCodec.h"
+
+namespace WebCore {
+
+ class TextCodecUserDefined : public TextCodec {
+ public:
+ static void registerEncodingNames(EncodingNameRegistrar);
+ static void registerCodecs(TextCodecRegistrar);
+
+ virtual String decode(const char*, size_t length, bool flush, bool stopOnError, bool& sawError);
+ virtual CString encode(const UChar*, size_t length, UnencodableHandling);
+ };
+
+} // namespace WebCore
+
+#endif // TextCodecUserDefined_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TextControlInnerElements_h
+#define TextControlInnerElements_h
+
+#include "HTMLDivElement.h"
+
+namespace WebCore {
+
+class String;
+
+class TextControlInnerElement : public HTMLDivElement
+{
+public:
+ TextControlInnerElement(Document*, Node* shadowParent = 0);
+
+ virtual bool isMouseFocusable() const { return false; }
+ virtual bool isShadowNode() const { return m_shadowParent; }
+ virtual Node* shadowParentNode() { return m_shadowParent; }
+ void setShadowParentNode(Node* node) { m_shadowParent = node; }
+ void attachInnerElement(Node*, PassRefPtr<RenderStyle>, RenderArena*);
+
+private:
+ Node* m_shadowParent;
+};
+
+class TextControlInnerTextElement : public TextControlInnerElement {
+public:
+ TextControlInnerTextElement(Document*, Node* shadowParent);
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+ virtual void defaultEventHandler(Event*);
+};
+
+class SearchFieldResultsButtonElement : public TextControlInnerElement {
+public:
+ SearchFieldResultsButtonElement(Document*);
+ virtual void defaultEventHandler(Event*);
+};
+
+class SearchFieldCancelButtonElement : public TextControlInnerElement {
+public:
+ SearchFieldCancelButtonElement(Document*);
+ virtual void defaultEventHandler(Event*);
+private:
+ bool m_capturing;
+};
+
+} //namespace
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TextDecoder_h
+#define TextDecoder_h
+
+#include "PlatformString.h"
+#include "TextCodec.h"
+#include "TextEncoding.h"
+#include <wtf/OwnPtr.h>
+
+namespace WebCore {
+
+ class TextCodec;
+
+ class TextDecoder {
+ public:
+ TextDecoder(const TextEncoding&);
+ void reset(const TextEncoding&);
+ const TextEncoding& encoding() const { return m_encoding; };
+
+ String decode(const char* data, size_t length, bool flush, bool stopOnError, bool& sawError)
+ {
+ if (!m_checkedForBOM)
+ return checkForBOM(data, length, flush, stopOnError, sawError);
+ return m_codec->decode(data, length, flush, stopOnError, sawError);
+ }
+
+ private:
+ String checkForBOM(const char*, size_t length, bool flush, bool stopOnError, bool& sawError);
+
+ TextEncoding m_encoding;
+ OwnPtr<TextCodec> m_codec;
+
+ bool m_checkedForBOM;
+ unsigned char m_numBufferedBytes;
+ unsigned char m_bufferedBytes[3];
+ };
+
+} // namespace WebCore
+
+#endif // TextDecoder_h
--- /dev/null
+/*
+ * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TextDirection_h
+#define TextDirection_h
+
+namespace WebCore {
+
+ enum TextDirection { RTL, LTR };
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * 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 TextDocument_h
+#define TextDocument_h
+
+#include "HTMLDocument.h"
+
+namespace WebCore {
+
+class HTMLViewSourceDocument;
+
+class TextDocument : public HTMLDocument {
+public:
+ static PassRefPtr<TextDocument> create(Frame* frame)
+ {
+ return new TextDocument(frame);
+ }
+
+private:
+ TextDocument(Frame*);
+
+ virtual Tokenizer* createTokenizer();
+};
+
+Tokenizer* createTextTokenizer(HTMLViewSourceDocument*);
+
+}
+
+#endif // TextDocument_h
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TextEncoding_h
+#define TextEncoding_h
+
+#include "TextCodec.h"
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+ class CString;
+ class String;
+
+ class TextEncoding {
+ public:
+ TextEncoding() : m_name(0) { }
+ TextEncoding(const char* name);
+ TextEncoding(const String& name);
+
+ bool isValid() const { return m_name; }
+ const char* name() const { return m_name; }
+ bool usesVisualOrdering() const;
+ bool isJapanese() const;
+
+ PassRefPtr<StringImpl> displayString(PassRefPtr<StringImpl> str) const
+ {
+ if (m_backslashAsCurrencySymbol == '\\' || !str)
+ return str;
+ return str->replace('\\', m_backslashAsCurrencySymbol);
+ }
+ void displayBuffer(UChar* characters, unsigned len) const
+ {
+ if (m_backslashAsCurrencySymbol == '\\')
+ return;
+ for (unsigned i = 0; i < len; ++i) {
+ if (characters[i] == '\\')
+ characters[i] = m_backslashAsCurrencySymbol;
+ }
+ }
+
+ const TextEncoding& closestByteBasedEquivalent() const;
+ const TextEncoding& encodingForFormSubmission() const;
+
+ String decode(const char* str, size_t length) const
+ {
+ bool ignored;
+ return decode(str, length, false, ignored);
+ }
+ String decode(const char*, size_t length, bool stopOnError, bool& sawError) const;
+ CString encode(const UChar*, size_t length, UnencodableHandling) const;
+
+ private:
+ UChar backslashAsCurrencySymbol() const;
+ bool isNonByteBasedEncoding() const;
+ bool isUTF7Encoding() const;
+
+ const char* m_name;
+ UChar m_backslashAsCurrencySymbol;
+ };
+
+ inline bool operator==(const TextEncoding& a, const TextEncoding& b) { return a.name() == b.name(); }
+ inline bool operator!=(const TextEncoding& a, const TextEncoding& b) { return a.name() != b.name(); }
+
+ const TextEncoding& ASCIIEncoding();
+ const TextEncoding& Latin1Encoding();
+ const TextEncoding& UTF16BigEndianEncoding();
+ const TextEncoding& UTF16LittleEndianEncoding();
+ const TextEncoding& UTF32BigEndianEncoding();
+ const TextEncoding& UTF32LittleEndianEncoding();
+ const TextEncoding& UTF8Encoding();
+ const TextEncoding& WindowsLatin1Encoding();
+
+} // namespace WebCore
+
+#endif // TextEncoding_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TextEncodingRegistry_h
+#define TextEncodingRegistry_h
+
+#include <memory>
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+ class TextCodec;
+ class TextEncoding;
+
+ // Only TextEncoding and TextDecoder should use this function directly.
+ // - Use TextDecoder::decode to decode, since it handles BOMs.
+ // - Use TextEncoding::decode to decode if you have all the data at once.
+ // It's implemented by calling TextDecoder::decode so works just as well.
+ // - Use TextEncoding::encode to encode, since it takes care of normalization.
+ std::auto_ptr<TextCodec> newTextCodec(const TextEncoding&);
+
+ // Only TextEncoding should use this function directly.
+ const char* atomicCanonicalTextEncodingName(const char* alias);
+ const char* atomicCanonicalTextEncodingName(const UChar* aliasCharacters, size_t aliasLength);
+
+ // Only TextEncoding should use this function directly.
+ bool noExtendedTextEncodingNameUsed();
+
+}
+
+#endif // TextEncodingRegistry_h
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef TextEvent_h
+#define TextEvent_h
+
+#include "UIEvent.h"
+
+namespace WebCore {
+
+ class TextEvent : public UIEvent {
+ public:
+ static PassRefPtr<TextEvent> create()
+ {
+ return adoptRef(new TextEvent);
+ }
+ static PassRefPtr<TextEvent> create(PassRefPtr<AbstractView> view, const String& data)
+ {
+ return adoptRef(new TextEvent(view, data));
+ }
+ virtual ~TextEvent();
+
+ void initTextEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>, const String& data);
+
+ String data() const { return m_data; }
+
+ virtual bool isTextEvent() const;
+
+ // If true, any newline characters in the text are line breaks only, not paragraph separators.
+ bool isLineBreak() const { return m_isLineBreak; }
+ void setIsLineBreak(bool isLineBreak) { m_isLineBreak = isLineBreak; }
+
+ // If true, any tab characters in the text are backtabs.
+ bool isBackTab() const { return m_isBackTab; }
+ void setIsBackTab(bool isBackTab) { m_isBackTab = isBackTab; }
+
+ private:
+ TextEvent();
+ TextEvent(PassRefPtr<AbstractView>, const String& data);
+
+ String m_data;
+ bool m_isLineBreak;
+ bool m_isBackTab;
+ };
+
+} // namespace WebCore
+
+#endif // TextEvent_h
--- /dev/null
+/*
+ * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TextGranularity_h
+#define TextGranularity_h
+
+namespace WebCore {
+
+// FIXME: This really should be broken up into more than one concept.
+// Frame doesn't need the 3 boundaries in this enum.
+enum TextGranularity {
+ CharacterGranularity,
+ WordGranularity,
+ SentenceGranularity,
+ LineGranularity,
+ ParagraphGranularity,
+ SentenceBoundary,
+ LineBoundary,
+ ParagraphBoundary,
+ DocumentBoundary
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TextIterator_h
+#define TextIterator_h
+
+#include "InlineTextBox.h"
+#include "Range.h"
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+// FIXME: Can't really answer this question correctly without knowing the white-space mode.
+// FIXME: Move this somewhere else in the editing directory. It doesn't belong here.
+inline bool isCollapsibleWhitespace(UChar c)
+{
+ switch (c) {
+ case ' ':
+ case '\n':
+ return true;
+ default:
+ return false;
+ }
+}
+
+String plainText(const Range*);
+UChar* plainTextToMallocAllocatedBuffer(const Range*, unsigned& bufferLength, bool isDisplayString);
+PassRefPtr<Range> findPlainText(const Range*, const String&, bool forward, bool caseSensitive);
+
+// Iterates through the DOM range, returning all the text, and 0-length boundaries
+// at points where replaced elements break up the text flow. The text comes back in
+// chunks so as to optimize for performance of the iteration.
+
+class TextIterator {
+public:
+ TextIterator();
+ explicit TextIterator(const Range*, bool emitCharactersBetweenAllVisiblePositions = false, bool enterTextControls = false);
+
+ bool atEnd() const { return !m_positionNode; }
+ void advance();
+
+ int length() const { return m_textLength; }
+ const UChar* characters() const { return m_textCharacters; }
+
+ PassRefPtr<Range> range() const;
+ Node* node() const;
+
+ static int rangeLength(const Range*, bool spacesForReplacedElements = false);
+ static PassRefPtr<Range> rangeFromLocationAndLength(Element* scope, int rangeLocation, int rangeLength, bool spacesForReplacedElements = false);
+ static PassRefPtr<Range> subrange(Range* entireRange, int characterOffset, int characterCount);
+
+private:
+ void exitNode();
+ bool shouldRepresentNodeOffsetZero();
+ bool shouldEmitSpaceBeforeAndAfterNode(Node*);
+ void representNodeOffsetZero();
+ bool handleTextNode();
+ bool handleReplacedElement();
+ bool handleNonTextNode();
+ void handleTextBox();
+ void emitCharacter(UChar, Node *textNode, Node *offsetBaseNode, int textStartOffset, int textEndOffset);
+ void emitText(Node *textNode, int textStartOffset, int textEndOffset);
+
+ // Current position, not necessarily of the text being returned, but position
+ // as we walk through the DOM tree.
+ Node *m_node;
+ int m_offset;
+ bool m_handledNode;
+ bool m_handledChildren;
+ bool m_inShadowContent;
+
+ // The range.
+ Node *m_startContainer;
+ int m_startOffset;
+ Node *m_endContainer;
+ int m_endOffset;
+ Node *m_pastEndNode;
+
+ // The current text and its position, in the form to be returned from the iterator.
+ Node *m_positionNode;
+ mutable Node *m_positionOffsetBaseNode;
+ mutable int m_positionStartOffset;
+ mutable int m_positionEndOffset;
+ const UChar* m_textCharacters;
+ int m_textLength;
+
+ // Used when there is still some pending text from the current node; when these
+ // are false and 0, we go back to normal iterating.
+ bool m_needAnotherNewline;
+ InlineTextBox *m_textBox;
+
+ // Used to do the whitespace collapsing logic.
+ Node *m_lastTextNode;
+ bool m_lastTextNodeEndedWithCollapsedSpace;
+ UChar m_lastCharacter;
+
+ // Used for whitespace characters that aren't in the DOM, so we can point at them.
+ UChar m_singleCharacterBuffer;
+
+ // Used when text boxes are out of order (Hebrew/Arabic w/ embeded LTR text)
+ Vector<InlineTextBox*> m_sortedTextBoxes;
+ size_t m_sortedTextBoxesPosition;
+
+ // Used when deciding whether to emit a "positioning" (e.g. newline) before any other content
+ bool m_haveEmitted;
+
+ // Used by selection preservation code. There should be one character emitted between every VisiblePosition
+ // in the Range used to create the TextIterator.
+ // FIXME <rdar://problem/6028818>: This functionality should eventually be phased out when we rewrite
+ // moveParagraphs to not clone/destroy moved content.
+ bool m_emitCharactersBetweenAllVisiblePositions;
+ bool m_enterTextControls;
+};
+
+// Iterates through the DOM range, returning all the text, and 0-length boundaries
+// at points where replaced elements break up the text flow. The text comes back in
+// chunks so as to optimize for performance of the iteration.
+class SimplifiedBackwardsTextIterator {
+public:
+ SimplifiedBackwardsTextIterator();
+ explicit SimplifiedBackwardsTextIterator(const Range *);
+
+ bool atEnd() const { return !m_positionNode; }
+ void advance();
+
+ int length() const { return m_textLength; }
+ const UChar* characters() const { return m_textCharacters; }
+
+ PassRefPtr<Range> range() const;
+
+private:
+ void exitNode();
+ bool handleTextNode();
+ bool handleReplacedElement();
+ bool handleNonTextNode();
+ void emitCharacter(UChar, Node *Node, int startOffset, int endOffset);
+
+ // Current position, not necessarily of the text being returned, but position
+ // as we walk through the DOM tree.
+ Node* m_node;
+ int m_offset;
+ bool m_handledNode;
+ bool m_handledChildren;
+
+ // End of the range.
+ Node* m_startNode;
+ int m_startOffset;
+ // Start of the range.
+ Node* m_endNode;
+ int m_endOffset;
+
+ // The current text and its position, in the form to be returned from the iterator.
+ Node* m_positionNode;
+ int m_positionStartOffset;
+ int m_positionEndOffset;
+ const UChar* m_textCharacters;
+ int m_textLength;
+
+ // Used to do the whitespace logic.
+ Node* m_lastTextNode;
+ UChar m_lastCharacter;
+
+ // Used for whitespace characters that aren't in the DOM, so we can point at them.
+ UChar m_singleCharacterBuffer;
+
+ // The node after the last node this iterator should process.
+ Node* m_pastStartNode;
+};
+
+// Builds on the text iterator, adding a character position so we can walk one
+// character at a time, or faster, as needed. Useful for searching.
+class CharacterIterator {
+public:
+ CharacterIterator();
+ explicit CharacterIterator(const Range* r, bool emitCharactersBetweenAllVisiblePositions = false, bool enterTextControls = false);
+
+ void advance(int numCharacters);
+
+ bool atBreak() const { return m_atBreak; }
+ bool atEnd() const { return m_textIterator.atEnd(); }
+
+ int length() const { return m_textIterator.length() - m_runOffset; }
+ const UChar* characters() const { return m_textIterator.characters() + m_runOffset; }
+ String string(int numChars);
+
+ int characterOffset() const { return m_offset; }
+ PassRefPtr<Range> range() const;
+
+private:
+ int m_offset;
+ int m_runOffset;
+ bool m_atBreak;
+
+ TextIterator m_textIterator;
+};
+
+class BackwardsCharacterIterator {
+public:
+ BackwardsCharacterIterator();
+ explicit BackwardsCharacterIterator(const Range*);
+
+ void advance(int);
+
+ bool atEnd() const { return m_textIterator.atEnd(); }
+
+ PassRefPtr<Range> range() const;
+
+private:
+ int m_offset;
+ int m_runOffset;
+ bool m_atBreak;
+
+ SimplifiedBackwardsTextIterator m_textIterator;
+};
+
+// Very similar to the TextIterator, except that the chunks of text returned are "well behaved",
+// meaning they never end split up a word. This is useful for spellcheck or (perhaps one day) searching.
+class WordAwareIterator {
+public:
+ WordAwareIterator();
+ explicit WordAwareIterator(const Range *r);
+
+ bool atEnd() const { return !m_didLookAhead && m_textIterator.atEnd(); }
+ void advance();
+
+ int length() const;
+ const UChar* characters() const;
+
+ // Range of the text we're currently returning
+ PassRefPtr<Range> range() const { return m_range; }
+
+private:
+ // text from the previous chunk from the textIterator
+ const UChar* m_previousText;
+ int m_previousLength;
+
+ // many chunks from textIterator concatenated
+ Vector<UChar> m_buffer;
+
+ // Did we have to look ahead in the textIterator to confirm the current chunk?
+ bool m_didLookAhead;
+
+ RefPtr<Range> m_range;
+
+ TextIterator m_textIterator;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TextMetrics_h
+#define TextMetrics_h
+
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class TextMetrics : public RefCounted<TextMetrics> {
+public:
+ static PassRefPtr<TextMetrics> create() { return adoptRef(new TextMetrics); }
+
+ unsigned width() const { return m_width; }
+ void setWidth(float w) { m_width = w; }
+
+private:
+ TextMetrics()
+ : m_width(0)
+ { }
+
+ float m_width;
+};
+
+} // namespace WebCore
+
+#endif // TextMetrics_h
--- /dev/null
+/*
+ Copyright (C) 1999 Lars Knoll (knoll@mpi-hd.mpg.de)
+ Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
+ Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#ifndef TextResourceDecoder_h
+#define TextResourceDecoder_h
+
+#include "TextDecoder.h"
+
+namespace WebCore {
+
+class TextResourceDecoder : public RefCounted<TextResourceDecoder> {
+public:
+ enum EncodingSource {
+ DefaultEncoding,
+ AutoDetectedEncoding,
+ EncodingFromXMLHeader,
+ EncodingFromMetaTag,
+ EncodingFromCSSCharset,
+ EncodingFromHTTPHeader,
+ UserChosenEncoding
+ };
+
+ static PassRefPtr<TextResourceDecoder> create(const String& mimeType, const TextEncoding& defaultEncoding = TextEncoding())
+ {
+ return adoptRef(new TextResourceDecoder(mimeType, defaultEncoding));
+ }
+ ~TextResourceDecoder();
+
+ void setEncoding(const TextEncoding&, EncodingSource);
+ const TextEncoding& encoding() const { return m_decoder.encoding(); }
+
+ String decode(const char* data, size_t length);
+ String flush();
+
+ bool sawError() const { return m_sawError; }
+
+private:
+ TextResourceDecoder(const String& mimeType, const TextEncoding& defaultEncoding);
+
+ enum ContentType { PlainText, HTML, XML, CSS }; // PlainText is equivalent to directly using TextDecoder.
+ static ContentType determineContentType(const String& mimeType);
+ static const TextEncoding& defaultEncoding(ContentType, const TextEncoding& defaultEncoding);
+
+ void checkForBOM(const char*, size_t);
+ bool checkForCSSCharset(const char*, size_t, bool& movedDataToBuffer);
+ bool checkForHeadCharset(const char*, size_t, bool& movedDataToBuffer);
+ void detectJapaneseEncoding(const char*, size_t);
+
+ ContentType m_contentType;
+ TextDecoder m_decoder;
+ EncodingSource m_source;
+ Vector<char> m_buffer;
+ bool m_checkedForBOM;
+ bool m_checkedForCSSCharset;
+ bool m_checkedForHeadCharset;
+ bool m_sawError;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2006, 2007 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TextRun_h
+#define TextRun_h
+
+#include "PlatformString.h"
+
+namespace WebCore {
+
+class RenderObject;
+class SVGPaintServer;
+
+class TextRun {
+public:
+ TextRun(const UChar* c, int len, bool allowTabs = false, int xpos = 0, int padding = 0, bool rtl = false, bool directionalOverride = false,
+ bool applyRunRounding = true, bool applyWordRounding = true)
+ : m_characters(c)
+ , m_len(len)
+ , m_xpos(xpos)
+ , m_padding(padding)
+ , m_allowTabs(allowTabs)
+ , m_rtl(rtl)
+ , m_directionalOverride(directionalOverride)
+ , m_applyRunRounding(applyRunRounding)
+ , m_applyWordRounding(applyWordRounding)
+ , m_disableSpacing(false)
+#if ENABLE(SVG_FONTS)
+ , m_referencingRenderObject(0)
+ , m_activePaintServer(0)
+#endif
+ {
+ }
+
+ TextRun(const String& s, bool allowTabs = false, int xpos = 0, int padding = 0, bool rtl = false, bool directionalOverride = false,
+ bool applyRunRounding = true, bool applyWordRounding = true)
+ : m_characters(s.characters())
+ , m_len(s.length())
+ , m_xpos(xpos)
+ , m_padding(padding)
+ , m_allowTabs(allowTabs)
+ , m_rtl(rtl)
+ , m_directionalOverride(directionalOverride)
+ , m_applyRunRounding(applyRunRounding)
+ , m_applyWordRounding(applyWordRounding)
+ , m_disableSpacing(false)
+#if ENABLE(SVG_FONTS)
+ , m_referencingRenderObject(0)
+ , m_activePaintServer(0)
+#endif
+ {
+ }
+
+ UChar operator[](int i) const { return m_characters[i]; }
+ const UChar* data(int i) const { return &m_characters[i]; }
+
+ const UChar* characters() const { return m_characters; }
+ int length() const { return m_len; }
+
+ void setText(const UChar* c, int len) { m_characters = c; m_len = len; }
+
+ bool allowTabs() const { return m_allowTabs; }
+ int xPos() const { return m_xpos; }
+ int padding() const { return m_padding; }
+ bool rtl() const { return m_rtl; }
+ bool ltr() const { return !m_rtl; }
+ bool directionalOverride() const { return m_directionalOverride; }
+ bool applyRunRounding() const { return m_applyRunRounding; }
+ bool applyWordRounding() const { return m_applyWordRounding; }
+ bool spacingDisabled() const { return m_disableSpacing; }
+
+ void disableSpacing() { m_disableSpacing = true; }
+ void disableRoundingHacks() { m_applyRunRounding = m_applyWordRounding = false; }
+ void setRTL(bool b) { m_rtl = b; }
+ void setDirectionalOverride(bool override) { m_directionalOverride = override; }
+
+#if ENABLE(SVG_FONTS)
+ RenderObject* referencingRenderObject() const { return m_referencingRenderObject; }
+ void setReferencingRenderObject(RenderObject* object) { m_referencingRenderObject = object; }
+
+ SVGPaintServer* activePaintServer() const { return m_activePaintServer; }
+ void setActivePaintServer(SVGPaintServer* object) { m_activePaintServer = object; }
+#endif
+
+private:
+ const UChar* m_characters;
+ int m_len;
+
+ int m_xpos;
+ int m_padding;
+ bool m_allowTabs;
+ bool m_rtl;
+ bool m_directionalOverride;
+ bool m_applyRunRounding;
+ bool m_applyWordRounding;
+ bool m_disableSpacing;
+
+#if ENABLE(SVG_FONTS)
+ RenderObject* m_referencingRenderObject;
+ SVGPaintServer* m_activePaintServer;
+#endif
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TextSizeAdjustment_h
+#define TextSizeAdjustment_h
+
+enum TextSizeAdjustmentType { AutoTextSizeAdjustment = -1, NoTextSizeAdjustment = -2 };
+
+class TextSizeAdjustment {
+public:
+ TextSizeAdjustment() : m_value(AutoTextSizeAdjustment) { }
+ TextSizeAdjustment(float value) : m_value(value) { }
+
+ float percentage() { return m_value; }
+ float multiplier() { return m_value / 100; }
+
+ bool isAuto() { return m_value == AutoTextSizeAdjustment; }
+ bool isNone() { return m_value == NoTextSizeAdjustment; }
+
+ bool operator == (const TextSizeAdjustment & anAdjustment) const { return m_value == anAdjustment.m_value; }
+ bool operator != (const TextSizeAdjustment & anAdjustment) const { return m_value != anAdjustment.m_value; }
+
+private:
+ float m_value;
+};
+
+#endif // TextSizeAdjustment_h
--- /dev/null
+/*
+ * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TextStream_h
+#define TextStream_h
+
+#include <wtf/Vector.h>
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+class String;
+
+class TextStream {
+public:
+ TextStream& operator<<(bool);
+ TextStream& operator<<(int);
+ TextStream& operator<<(unsigned);
+ TextStream& operator<<(long);
+ TextStream& operator<<(unsigned long);
+ TextStream& operator<<(float);
+ TextStream& operator<<(double);
+ TextStream& operator<<(const char*);
+ TextStream& operator<<(const String&);
+ TextStream& operator<<(void*);
+#if PLATFORM(WIN_OS) && PLATFORM(X86_64) && COMPILER(MSVC)
+ TextStream& operator<<(unsigned __int64);
+ TextStream& operator<<(__int64);
+#endif
+
+ String release();
+
+private:
+ Vector<UChar> m_text;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Theme_h
+#define Theme_h
+
+#include "Color.h"
+#include "Font.h"
+#include "IntRect.h"
+#include "LengthBox.h"
+#include "LengthSize.h"
+#include "PlatformString.h"
+#include "ThemeTypes.h"
+
+namespace WebCore {
+
+class GraphicsContext;
+class ScrollView;
+
+// Unlike other platform classes, Theme does extensively use virtual functions. This design allows a platform to switch between multiple themes at runtime.
+class Theme {
+public:
+ Theme() { }
+ virtual ~Theme() { }
+
+ // A method to obtain the baseline position adjustment for a "leaf" control. This will only be used if a baseline
+ // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of
+ // controls that need to do this. The adjustment is an offset that adds to the baseline, e.g., marginTop() + height() + |offset|.
+ // The offset is not zoomed.
+ virtual int baselinePositionAdjustment(ControlPart) const { return 0; }
+
+ // A method asking if the control changes its appearance when the window is inactive.
+ virtual bool controlHasInactiveAppearance(ControlPart) const { return false; }
+
+ // General methods for whether or not any of the controls in the theme change appearance when the window is inactive or
+ // when hovered over.
+ virtual bool controlsCanHaveInactiveAppearance() const { return false; }
+ virtual bool controlsCanHaveHoveredAppearance() const { return false; }
+
+ // Used by RenderTheme::isControlStyled to figure out if the native look and feel should be turned off.
+ virtual bool controlDrawsBorder(ControlPart) const { return true; }
+ virtual bool controlDrawsBackground(ControlPart) const { return true; }
+ virtual bool controlDrawsFocusOutline(ControlPart) const { return true; }
+
+ // Methods for obtaining platform-specific colors.
+ virtual Color selectionColor(ControlPart, ControlState, SelectionPart) const { return Color(); }
+ virtual Color textSearchHighlightColor() const { return Color(); }
+
+ // CSS system colors and fonts
+ virtual Color systemColor(ThemeColor) const { return Color(); }
+ virtual Font systemFont(ThemeFont, FontDescription&) const { return Font(); }
+
+ // How fast the caret blinks in text fields.
+ virtual double caretBlinkInterval() const { return 0.5; }
+
+ // Notification when the theme has changed
+ virtual void themeChanged() { }
+
+ // Methods used to adjust the RenderStyles of controls.
+
+ // The font description result should have a zoomed font size.
+ virtual FontDescription controlFont(ControlPart, const Font& font, float /*zoomFactor*/) const { return font.fontDescription(); }
+
+ // The size here is in zoomed coordinates already. If a new size is returned, it also needs to be in zoomed coordinates.
+ virtual LengthSize controlSize(ControlPart, const Font&, const LengthSize& zoomedSize, float /*zoomFactor*/) const { return zoomedSize; }
+
+ // Returns the minimum size for a control in zoomed coordinates.
+ virtual LengthSize minimumControlSize(ControlPart, const Font&, float /*zoomFactor*/) const { return LengthSize(Length(0, Fixed), Length(0, Fixed)); }
+
+ // Allows the theme to modify the existing padding/border.
+ virtual LengthBox controlPadding(ControlPart, const Font&, const LengthBox& zoomedBox, float zoomFactor) const;
+ virtual LengthBox controlBorder(ControlPart, const Font&, const LengthBox& zoomedBox, float zoomFactor) const;
+
+ // Whether or not whitespace: pre should be forced on always.
+ virtual bool controlRequiresPreWhiteSpace(ControlPart) const { return false; }
+
+ // Method for painting a control. The rect is in zoomed coordinates.
+ virtual void paint(ControlPart, ControlStates, GraphicsContext*, const IntRect& /*zoomedRect*/, float /*zoomFactor*/, ScrollView*) const { }
+
+ // Some controls may spill out of their containers (e.g., the check on an OS X checkbox). When these controls repaint,
+ // the theme needs to communicate this inflated rect to the engine so that it can invalidate the whole control.
+ // The rect passed in is in zoomed coordinates, so the inflation should take that into account and make sure the inflation
+ // amount is also scaled by the zoomFactor.
+ virtual void inflateControlPaintRect(ControlPart, ControlStates, IntRect& /*zoomedRect*/, float /*zoomFactor*/) const { }
+
+ // This method is called once, from RenderTheme::adjustDefaultStyleSheet(), to let each platform adjust
+ // the default CSS rules in html4.css.
+ static String defaultStyleSheet();
+
+private:
+ mutable Color m_activeSelectionColor;
+ mutable Color m_inactiveSelectionColor;
+};
+
+// Function to obtain the theme. This is implemented in the platform-specific subclasses.
+Theme* platformTheme();
+
+} // namespace WebCore
+
+#endif // Theme_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ThemeTypes_h
+#define ThemeTypes_h
+
+namespace WebCore {
+
+enum ControlState {
+ HoverState = 1,
+ PressedState = 1 << 1,
+ FocusState = 1 << 2,
+ EnabledState = 1 << 3,
+ CheckedState = 1 << 4,
+ ReadOnlyState = 1 << 5,
+ DefaultState = 1 << 6,
+ WindowInactiveState = 1 << 7,
+ IndeterminateState = 1 << 8,
+ AllStates = 0xffffffff
+};
+
+typedef unsigned ControlStates;
+
+enum ControlPart {
+ NoControlPart, CheckboxPart, RadioPart, PushButtonPart, SquareButtonPart, ButtonPart,
+ ButtonBevelPart, DefaultButtonPart, ListboxPart, ListItemPart,
+ MediaFullscreenButtonPart, MediaMuteButtonPart, MediaPlayButtonPart, MediaSeekBackButtonPart,
+ MediaSeekForwardButtonPart, MediaSliderPart, MediaSliderThumbPart, MediaTimelineContainerPart,
+ MediaCurrentTimePart, MediaTimeRemainingPart,
+ MenulistPart, MenulistButtonPart, MenulistTextPart, MenulistTextFieldPart,
+ SliderHorizontalPart, SliderVerticalPart, SliderThumbHorizontalPart,
+ SliderThumbVerticalPart, CaretPart, SearchFieldPart, SearchFieldDecorationPart,
+ SearchFieldResultsDecorationPart, SearchFieldResultsButtonPart,
+ SearchFieldCancelButtonPart, TextFieldPart, TextAreaPart, CapsLockIndicatorPart
+};
+
+enum SelectionPart {
+ SelectionBackground, SelectionForeground
+};
+
+enum ThemeFont {
+ CaptionFont, IconFont, MenuFont, MessageBoxFont, SmallCaptionFont, StatusBarFont, MiniControlFont, SmallControlFont, ControlFont
+};
+
+enum ThemeColor {
+ ActiveBorderColor, ActiveCaptionColor, AppWorkspaceColor, BackgroundColor, ButtonFaceColor, ButtonHighlightColor, ButtonShadowColor,
+ ButtonTextColor, CaptionTextColor, GrayTextColor, HighlightColor, HighlightTextColor, InactiveBorderColor, InactiveCaptionColor,
+ InactiveCaptionTextColor, InfoBackgroundColor, InfoTextColor, MatchColor, MenuTextColor, ScrollbarColor, ThreeDDarkDhasowColor,
+ ThreeDFaceColor, ThreeDHighlightColor, ThreeDLightShadowColor, ThreeDShadowCLor, WindowColor, WindowFrameColor, WindowTextColor,
+ FocusRingColor
+};
+
+}
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ThreadCheck_h
+#define ThreadCheck_h
+
+#define WebCoreThreadViolationCheck() do {} while (0)
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef ThreadGlobalData_h
+#define ThreadGlobalData_h
+
+#include "StringHash.h"
+#include <wtf/HashSet.h>
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+ class EventNames;
+ struct ICUConverterWrapper;
+ struct TECConverterWrapper;
+
+ class ThreadGlobalData : Noncopyable {
+ public:
+ ThreadGlobalData();
+ ~ThreadGlobalData();
+
+ EventNames& eventNames() { return *m_eventNames; }
+ StringImpl* emptyString() { return m_emptyString; }
+ HashSet<StringImpl*>& atomicStringTable() { return *m_atomicStringTable; }
+
+#if USE(ICU_UNICODE)
+ ICUConverterWrapper& cachedConverterICU() { return *m_cachedConverterICU; }
+#endif
+
+
+ private:
+ StringImpl* m_emptyString;
+ HashSet<StringImpl*>* m_atomicStringTable;
+ EventNames* m_eventNames;
+
+#if USE(ICU_UNICODE)
+ ICUConverterWrapper* m_cachedConverterICU;
+#endif
+
+ };
+
+ ThreadGlobalData& threadGlobalData();
+
+} // namespace WebCore
+
+#endif // ThreadGlobalData_h
--- /dev/null
+/*
+ * Copyright (c) 2009, 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 ThreadableLoader_h
+#define ThreadableLoader_h
+
+#include <wtf/Noncopyable.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+ class ResourceError;
+ class ResourceRequest;
+ class ResourceResponse;
+ class ScriptExecutionContext;
+ class ThreadableLoaderClient;
+
+ enum LoadCallbacks {
+ SendLoadCallbacks,
+ DoNotSendLoadCallbacks
+ };
+
+ enum ContentSniff {
+ SniffContent,
+ DoNotSniffContent
+ };
+
+ // Useful for doing loader operations from any thread (not threadsafe,
+ // just able to run on threads other than the main thread).
+ class ThreadableLoader : Noncopyable {
+ public:
+ static PassRefPtr<ThreadableLoader> create(ScriptExecutionContext*, ThreadableLoaderClient*, const ResourceRequest&, LoadCallbacks, ContentSniff);
+ static unsigned long loadResourceSynchronously(ScriptExecutionContext*, const ResourceRequest&, ResourceError&, ResourceResponse&, Vector<char>& data);
+
+ virtual void cancel() = 0;
+ void ref() { refThreadableLoader(); }
+ void deref() { derefThreadableLoader(); }
+
+ protected:
+ virtual ~ThreadableLoader() { }
+ virtual void refThreadableLoader() = 0;
+ virtual void derefThreadableLoader() = 0;
+ };
+
+} // namespace WebCore
+
+#endif // ThreadableLoader_h
--- /dev/null
+/*
+ * Copyright (c) 2009, 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 ThreadableLoaderClient_h
+#define ThreadableLoaderClient_h
+
+namespace WebCore {
+
+ class ResourceResponse;
+
+ class ThreadableLoaderClient {
+ public:
+ virtual void didSendData(unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/) { }
+
+ virtual void didReceiveResponse(const ResourceResponse&) { }
+ virtual void didReceiveData(const char*, int /*lengthReceived*/) { }
+ virtual void didFinishLoading(unsigned long /*identifer*/) { }
+ virtual void didFail() { }
+ virtual void didGetCancelled() { }
+
+ virtual void didReceiveAuthenticationCancellation(const ResourceResponse&) { }
+
+ protected:
+ virtual ~ThreadableLoaderClient() { }
+ };
+
+} // namespace WebCore
+
+#endif // ThreadableLoaderClient_h
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TimeRanges_h
+#define TimeRanges_h
+
+#include "ExceptionCode.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class TimeRanges : public RefCounted<TimeRanges> {
+public:
+ static PassRefPtr<TimeRanges> create()
+ {
+ return adoptRef(new TimeRanges);
+ }
+ static PassRefPtr<TimeRanges> create(float start, float end)
+ {
+ return adoptRef(new TimeRanges(start, end));
+ }
+
+ unsigned length() const { return m_ranges.size(); }
+ float start(unsigned index, ExceptionCode&) const;
+ float end(unsigned index, ExceptionCode&) const;
+
+ void add(float start, float end);
+
+ bool contain(float time) const;
+
+private:
+ TimeRanges() { }
+ TimeRanges(float start, float end);
+
+ struct Range {
+ Range() { }
+ Range(float start, float end) {
+ m_start = start;
+ m_end = end;
+ }
+ float m_start;
+ float m_end;
+ };
+
+ Vector<Range> m_ranges;
+};
+
+} // namespace WebCore
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Timer_h
+#define Timer_h
+
+#include <wtf/Noncopyable.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+// Time intervals are all in seconds.
+
+class TimerHeapElement;
+
+class TimerBase : Noncopyable {
+public:
+ TimerBase();
+ virtual ~TimerBase();
+
+ void start(double nextFireInterval, double repeatInterval);
+
+ void startRepeating(double repeatInterval) { start(repeatInterval, repeatInterval); }
+ void startOneShot(double interval) { start(interval, 0); }
+
+ void stop();
+ bool isActive() const;
+
+ double nextFireInterval() const;
+ double repeatInterval() const { return m_repeatInterval; }
+
+ void augmentRepeatInterval(double delta) { setNextFireTime(m_nextFireTime + delta); m_repeatInterval += delta; }
+
+ static void fireTimersInNestedEventLoop();
+
+private:
+ virtual void fired() = 0;
+
+ void checkConsistency() const;
+ void checkHeapIndex() const;
+
+ void setNextFireTime(double);
+
+ bool inHeap() const { return m_heapIndex != -1; }
+
+ void heapDecreaseKey();
+ void heapDelete();
+ void heapDeleteMin();
+ void heapIncreaseKey();
+ void heapInsert();
+ void heapPop();
+ void heapPopMin();
+
+ static void collectFiringTimers(double fireTime, Vector<TimerBase*>&);
+ static void fireTimers(double fireTime, const Vector<TimerBase*>&);
+ static void sharedTimerFired();
+
+ double m_nextFireTime; // 0 if inactive
+ double m_repeatInterval; // 0 if not repeating
+ int m_heapIndex; // -1 if not in heap
+ unsigned m_heapInsertionOrder; // Used to keep order among equal-fire-time timers
+
+ friend void updateSharedTimer();
+ friend class TimerHeapElement;
+ friend bool operator<(const TimerHeapElement&, const TimerHeapElement&);
+};
+
+template <typename TimerFiredClass> class Timer : public TimerBase {
+public:
+ typedef void (TimerFiredClass::*TimerFiredFunction)(Timer*);
+
+ Timer(TimerFiredClass* o, TimerFiredFunction f)
+ : m_object(o), m_function(f) { }
+
+private:
+ virtual void fired() { (m_object->*m_function)(this); }
+
+ TimerFiredClass* m_object;
+ TimerFiredFunction m_function;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TimingFunction_h
+#define TimingFunction_h
+
+#include "RenderStyleConstants.h"
+
+namespace WebCore {
+
+struct TimingFunction {
+ TimingFunction()
+ : m_type(CubicBezierTimingFunction)
+ , m_x1(0.25)
+ , m_y1(0.1)
+ , m_x2(0.25)
+ , m_y2(1.0)
+ {
+ }
+
+ TimingFunction(ETimingFunctionType timingFunction, double x1 = 0.0, double y1 = 0.0, double x2 = 1.0, double y2 = 1.0)
+ : m_type(timingFunction)
+ , m_x1(x1)
+ , m_y1(y1)
+ , m_x2(x2)
+ , m_y2(y2)
+ {
+ }
+
+ bool operator==(const TimingFunction& o) const
+ {
+ return m_type == o.m_type && m_x1 == o.m_x1 && m_y1 == o.m_y1 && m_x2 == o.m_x2 && m_y2 == o.m_y2;
+ }
+
+ double x1() const { return m_x1; }
+ double y1() const { return m_y1; }
+ double x2() const { return m_x2; }
+ double y2() const { return m_y2; }
+
+ ETimingFunctionType type() const { return m_type; }
+
+private:
+ ETimingFunctionType m_type;
+
+ double m_x1;
+ double m_y1;
+ double m_x2;
+ double m_y2;
+};
+
+} // namespace WebCore
+
+#endif // TimingFunction_h
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 2000 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Tokenizer_h
+#define Tokenizer_h
+
+namespace WebCore {
+
+ class SegmentedString;
+
+ class Tokenizer {
+ public:
+ virtual ~Tokenizer() { }
+
+ // Script output must be prepended, while new data
+ // received during executing a script must be appended, hence the
+ // extra bool to be able to distinguish between both cases.
+ // document.write() always uses false, while the loader uses true.
+ virtual bool write(const SegmentedString&, bool appendData) = 0;
+ virtual void finish() = 0;
+ virtual bool isWaitingForScripts() const = 0;
+ virtual void stopParsing() { m_parserStopped = true; }
+ virtual bool processingData() const { return false; }
+ virtual int executingScript() const { return 0; }
+
+ virtual bool wantsRawData() const { return false; }
+ virtual bool writeRawData(const char* /*data*/, int /*length*/) { return false; }
+
+ bool inViewSourceMode() const { return m_inViewSourceMode; }
+ void setInViewSourceMode(bool mode) { m_inViewSourceMode = mode; }
+
+ virtual bool wellFormed() const { return true; }
+
+ virtual int lineNumber() const { return -1; }
+ virtual int columnNumber() const { return -1; }
+
+ virtual void executeScriptsWaitingForStylesheets() {}
+
+ virtual bool isHTMLTokenizer() const { return false; }
+
+ virtual void parsePending() { }
+
+ protected:
+ Tokenizer(bool viewSourceMode = false)
+ : m_parserStopped(false)
+ , m_inViewSourceMode(viewSourceMode)
+ {
+ }
+
+ // The tokenizer has buffers, so parsing may continue even after
+ // it stops receiving data. We use m_parserStopped to stop the tokenizer
+ // even when it has buffered data.
+ bool m_parserStopped;
+ bool m_inViewSourceMode;
+ };
+
+} // namespace WebCore
+
+#endif // Tokenizer_h
--- /dev/null
+/*
+ * Copyright (C) 2008, Apple Inc. All rights reserved.
+ *
+ * No license or rights are granted by Apple expressly or by implication,
+ * estoppel, or otherwise, to Apple copyrights, patents, trademarks, trade
+ * secrets or other rights.
+ */
+
+#ifndef Touch_h
+#define Touch_h
+
+#include <wtf/Platform.h>
+
+#if ENABLE(TOUCH_EVENTS)
+
+#include <wtf/RefCounted.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+#include "EventTarget.h"
+#include "DOMWindow.h"
+
+namespace WebCore {
+
+ class DOMWindow;
+
+ class Touch : public RefCounted<Touch> {
+ public:
+ static PassRefPtr<Touch> create()
+ {
+ return adoptRef(new Touch());
+ }
+ static PassRefPtr<Touch> create(DOMWindow* view, EventTarget* target, unsigned identifier, int pageX, int pageY, int screenX, int screenY)
+ {
+ return adoptRef(new Touch(view, target, identifier, pageX, pageY, screenX, screenY));
+ }
+
+ EventTarget* target() const { return m_target.get(); }
+
+ bool updateLocation(int pageX, int pageY, int screenX, int screenY);
+
+ unsigned identifier() const { return m_identifier; }
+
+ int clientX() const { return m_clientX; }
+ int clientY() const { return m_clientY; }
+ int pageX() const { return m_pageX; }
+ int pageY() const { return m_pageY; }
+ int screenX() const { return m_screenX; }
+ int screenY() const { return m_screenY; }
+
+ private:
+ Touch() { }
+ Touch(DOMWindow* view, EventTarget* target, unsigned identifier, int pageX, int pageY, int screenX, int screenY);
+
+ DOMWindow* view() const { return m_view.get(); }
+
+ RefPtr<DOMWindow> m_view;
+ RefPtr<EventTarget> m_target;
+
+ unsigned m_identifier;
+ int m_clientX;
+ int m_clientY;
+ int m_pageX;
+ int m_pageY;
+ int m_screenX;
+ int m_screenY;
+ };
+
+} // namespace WebCore
+
+#endif // ENABLE(TOUCH_EVENTS)
+
+#endif // Touch_h
--- /dev/null
+/*
+ * Copyright (C) 2008, Apple Inc. All rights reserved.
+ *
+ * No license or rights are granted by Apple expressly or by implication,
+ * estoppel, or otherwise, to Apple copyrights, patents, trademarks, trade
+ * secrets or other rights.
+ */
+
+#ifndef TouchEvent_h
+#define TouchEvent_h
+
+#include <wtf/Platform.h>
+
+#if ENABLE(TOUCH_EVENTS)
+
+#include <wtf/RefPtr.h>
+#include "MouseRelatedEvent.h"
+#include "TouchList.h"
+
+namespace WebCore {
+
+ class TouchEvent : public MouseRelatedEvent {
+ public:
+ static PassRefPtr<TouchEvent> create()
+ {
+ return adoptRef(new TouchEvent);
+ }
+ static PassRefPtr<TouchEvent> create(
+ const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view, int detail,
+ int screenX, int screenY, int pageX, int pageY,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
+ TouchList* touches, TouchList* targetTouches, TouchList* changedTouches,
+ float scale, float rotation, bool isSimulated = false)
+ {
+ return adoptRef(new TouchEvent(type, canBubble, cancelable, view, detail,
+ screenX, screenY, pageX, pageY,
+ ctrlKey, altKey, shiftKey, metaKey,
+ touches, targetTouches, changedTouches,
+ scale, rotation, isSimulated));
+ }
+ virtual ~TouchEvent() {}
+
+ void initTouchEvent(const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view, int detail,
+ int screenX, int screenY, int clientX, int clientY,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
+ TouchList* touches, TouchList* targetTouches, TouchList* changedTouches,
+ float scale, float rotation);
+
+ virtual bool isTouchEvent() const { return true; }
+
+ TouchList* touches() const { return m_touches.get(); }
+ TouchList* targetTouches() const { return m_targetTouches.get(); }
+ TouchList* changedTouches() const { return m_changedTouches.get(); }
+
+ float scale() const { return m_scale; }
+ float rotation() const { return m_rotation; }
+
+ private:
+ TouchEvent() { }
+ TouchEvent(const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view, int detail,
+ int screenX, int screenY, int pageX, int pageY,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
+ TouchList* touches, TouchList* targetTouches, TouchList* changedTouches,
+ float scale, float rotation, bool isSimulated = false);
+
+ RefPtr<TouchList> m_touches;
+ RefPtr<TouchList> m_targetTouches;
+ RefPtr<TouchList> m_changedTouches;
+ float m_scale;
+ float m_rotation;
+ };
+
+} // namespace WebCore
+
+#endif // ENABLE(TOUCH_EVENTS)
+
+#endif // TouchEvent_h
--- /dev/null
+/*
+ * Copyright (C) 2008, Apple Inc. All rights reserved.
+ *
+ * No license or rights are granted by Apple expressly or by implication,
+ * estoppel, or otherwise, to Apple copyrights, patents, trademarks, trade
+ * secrets or other rights.
+ */
+
+#ifndef TouchList_h
+#define TouchList_h
+
+#include <wtf/Platform.h>
+
+#if ENABLE(TOUCH_EVENTS)
+
+#include <wtf/RefCounted.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/Vector.h>
+#include "Touch.h"
+
+namespace WebCore {
+
+ class TouchList : public RefCounted<TouchList> {
+ public:
+ static PassRefPtr<TouchList> create()
+ {
+ return adoptRef(new TouchList());
+ }
+ virtual ~TouchList() {}
+
+ virtual bool isTouchList() { return true; }
+
+ unsigned length() const { return m_values.size(); }
+ Touch* item (unsigned index) { return index < length() ? m_values[index].get() : 0; }
+
+ void append(const PassRefPtr<Touch>);
+
+ private:
+ TouchList() { }
+
+ Vector<RefPtr<Touch> > m_values;
+ };
+
+} // namespace WebCore
+
+#endif // ENABLE(TOUCH_EVENTS)
+
+#endif // TouchList_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TransformOperation_h
+#define TransformOperation_h
+
+#include "TransformationMatrix.h"
+#include "IntSize.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+// CSS Transforms (may become part of CSS3)
+
+class TransformOperation : public RefCounted<TransformOperation> {
+public:
+ enum OperationType {
+ SCALE_X, SCALE_Y, SCALE,
+ TRANSLATE_X, TRANSLATE_Y, TRANSLATE,
+ ROTATE,
+ ROTATE_Z = ROTATE,
+ SKEW_X, SKEW_Y, SKEW,
+ MATRIX,
+ SCALE_Z, SCALE_3D,
+ TRANSLATE_Z, TRANSLATE_3D,
+ ROTATE_X, ROTATE_Y, ROTATE_3D,
+ MATRIX_3D,
+ PERSPECTIVE,
+ IDENTITY, NONE
+ };
+
+ virtual ~TransformOperation() { }
+
+ virtual bool operator==(const TransformOperation&) const = 0;
+ bool operator!=(const TransformOperation& o) const { return !(*this == o); }
+
+ virtual bool isIdentity() const = 0;
+
+ // Return true if the borderBoxSize was used in the computation, false otherwise.
+ virtual bool apply(TransformationMatrix&, const IntSize& borderBoxSize) const = 0;
+
+ virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false) = 0;
+
+ virtual OperationType getOperationType() const = 0;
+ virtual bool isSameType(const TransformOperation&) const { return false; }
+
+ bool is3DOperation() const
+ {
+ OperationType opType = getOperationType();
+ return opType == SCALE_Z ||
+ opType == SCALE_3D ||
+ opType == TRANSLATE_Z ||
+ opType == TRANSLATE_3D ||
+ opType == ROTATE_X ||
+ opType == ROTATE_Y ||
+ opType == ROTATE_3D ||
+ opType == MATRIX_3D ||
+ opType == PERSPECTIVE;
+ }
+};
+
+} // namespace WebCore
+
+#endif // TransformOperation_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TransformOperations_h
+#define TransformOperations_h
+
+#include "TransformOperation.h"
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class TransformOperations {
+public:
+ TransformOperations(bool makeIdentity = false);
+
+ bool operator==(const TransformOperations& o) const;
+ bool operator!=(const TransformOperations& o) const
+ {
+ return !(*this == o);
+ }
+
+ void apply(const IntSize& sz, TransformationMatrix& t) const
+ {
+ for (unsigned i = 0; i < m_operations.size(); ++i)
+ m_operations[i]->apply(t, sz);
+ }
+
+ // Return true if any of the operation types are 3D operation types (even if the
+ // values describe affine transforms)
+ bool has3DOperation() const
+ {
+ for (unsigned i = 0; i < m_operations.size(); ++i)
+ if (m_operations[i]->is3DOperation())
+ return true;
+ return false;
+ }
+
+ Vector<RefPtr<TransformOperation> >& operations() { return m_operations; }
+ const Vector<RefPtr<TransformOperation> >& operations() const { return m_operations; }
+
+private:
+ Vector<RefPtr<TransformOperation> > m_operations;
+};
+
+} // namespace WebCore
+
+#endif // TransformOperations_h
--- /dev/null
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TransformState_h
+#define TransformState_h
+
+#include "FloatPoint.h"
+#include "FloatQuad.h"
+#include "IntSize.h"
+#include "TransformationMatrix.h"
+#include <wtf/Noncopyable.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class TransformState : Noncopyable {
+public:
+ enum TransformDirection { ApplyTransformDirection, UnapplyInverseTransformDirection };
+ enum TransformAccumulation { FlattenTransform, AccumulateTransform };
+
+ // If quad is non-null, it will be mapped
+ TransformState(TransformDirection mappingDirection, const FloatPoint& p, const FloatQuad* quad = 0)
+ : m_lastPlanarPoint(p)
+ , m_accumulatingTransform(false)
+ , m_mapQuad(quad != 0)
+ , m_direction(mappingDirection)
+ {
+ if (quad)
+ m_lastPlanarQuad = *quad;
+ }
+
+ void move(const IntSize& s, TransformAccumulation accumulate = FlattenTransform)
+ {
+ move(s.width(), s.height(), accumulate);
+ }
+
+ void move(int x, int y, TransformAccumulation = FlattenTransform);
+ void applyTransform(const TransformationMatrix& transformFromContainer, TransformAccumulation = FlattenTransform);
+ void flatten();
+
+ // Return the coords of the point or quad in the last flattened layer
+ FloatPoint lastPlanarPoint() const { return m_lastPlanarPoint; }
+ FloatQuad lastPlanarQuad() const { return m_lastPlanarQuad; }
+
+ // Return the point or quad mapped through the current transform
+ FloatPoint mappedPoint() const;
+ FloatQuad mappedQuad() const;
+
+private:
+ void flattenWithTransform(const TransformationMatrix&);
+
+ FloatPoint m_lastPlanarPoint;
+ FloatQuad m_lastPlanarQuad;
+
+ // We only allocate the transform if we need to
+ OwnPtr<TransformationMatrix> m_accumulatedTransform;
+ bool m_accumulatingTransform;
+ bool m_mapQuad;
+ TransformDirection m_direction;
+};
+
+class HitTestingTransformState : public RefCounted<HitTestingTransformState> {
+public:
+ static PassRefPtr<HitTestingTransformState> create(const FloatPoint& p, const FloatQuad& quad)
+ {
+ return adoptRef(new HitTestingTransformState(p, quad));
+ }
+
+ static PassRefPtr<HitTestingTransformState> create(const HitTestingTransformState& other)
+ {
+ return adoptRef(new HitTestingTransformState(other));
+ }
+
+ enum TransformAccumulation { FlattenTransform, AccumulateTransform };
+ void translate(int x, int y, TransformAccumulation);
+ void applyTransform(const TransformationMatrix& transformFromContainer, TransformAccumulation);
+
+ FloatPoint mappedPoint() const;
+ FloatQuad mappedQuad() const;
+ void flatten();
+
+ FloatPoint m_lastPlanarPoint;
+ FloatQuad m_lastPlanarQuad;
+ TransformationMatrix m_accumulatedTransform;
+ bool m_accumulatingTransform;
+
+private:
+ HitTestingTransformState(const FloatPoint& p, const FloatQuad& quad)
+ : m_lastPlanarPoint(p)
+ , m_lastPlanarQuad(quad)
+ , m_accumulatingTransform(false)
+ {
+ }
+
+ HitTestingTransformState(const HitTestingTransformState& other)
+ : RefCounted<HitTestingTransformState>()
+ , m_lastPlanarPoint(other.m_lastPlanarPoint)
+ , m_lastPlanarQuad(other.m_lastPlanarQuad)
+ , m_accumulatedTransform(other.m_accumulatedTransform)
+ , m_accumulatingTransform(other.m_accumulatingTransform)
+ {
+ }
+
+ void flattenWithTransform(const TransformationMatrix&);
+};
+
+} // namespace WebCore
+
+#endif // TransformState_h
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TransformationMatrix_h
+#define TransformationMatrix_h
+
+#include "FloatPoint.h"
+#include "IntPoint.h"
+#include <string.h> //for memcpy
+
+#if PLATFORM(CG)
+#include <CoreGraphics/CGAffineTransform.h>
+#endif
+
+namespace WebCore {
+
+class IntRect;
+class FloatPoint3D;
+class FloatRect;
+class FloatQuad;
+
+class TransformationMatrix {
+public:
+ typedef double Matrix4[4][4];
+
+ TransformationMatrix() { makeIdentity(); }
+ TransformationMatrix(const TransformationMatrix& t) { *this = t; }
+ TransformationMatrix(double a, double b, double c, double d, double e, double f) { setMatrix(a, b, c, d, e, f); }
+ TransformationMatrix(double m11, double m12, double m13, double m14,
+ double m21, double m22, double m23, double m24,
+ double m31, double m32, double m33, double m34,
+ double m41, double m42, double m43, double m44)
+ {
+ setMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
+ }
+
+ void setMatrix(double a, double b, double c, double d, double e, double f)
+ {
+ m_matrix[0][0] = a; m_matrix[0][1] = b; m_matrix[0][2] = 0; m_matrix[0][3] = 0;
+ m_matrix[1][0] = c; m_matrix[1][1] = d; m_matrix[1][2] = 0; m_matrix[1][3] = 0;
+ m_matrix[2][0] = 0; m_matrix[2][1] = 0; m_matrix[2][2] = 1; m_matrix[2][3] = 0;
+ m_matrix[3][0] = e; m_matrix[3][1] = f; m_matrix[3][2] = 0; m_matrix[3][3] = 1;
+ }
+
+ void setMatrix(double m11, double m12, double m13, double m14,
+ double m21, double m22, double m23, double m24,
+ double m31, double m32, double m33, double m34,
+ double m41, double m42, double m43, double m44)
+ {
+ m_matrix[0][0] = m11; m_matrix[0][1] = m12; m_matrix[0][2] = m13; m_matrix[0][3] = m14;
+ m_matrix[1][0] = m21; m_matrix[1][1] = m22; m_matrix[1][2] = m23; m_matrix[1][3] = m24;
+ m_matrix[2][0] = m31; m_matrix[2][1] = m32; m_matrix[2][2] = m33; m_matrix[2][3] = m34;
+ m_matrix[3][0] = m41; m_matrix[3][1] = m42; m_matrix[3][2] = m43; m_matrix[3][3] = m44;
+ }
+
+ TransformationMatrix& operator =(const TransformationMatrix &t)
+ {
+ setMatrix(t.m_matrix);
+ return *this;
+ }
+
+ TransformationMatrix& makeIdentity()
+ {
+ setMatrix(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
+ return *this;
+ }
+
+ bool isIdentity() const
+ {
+ return m_matrix[0][0] == 1 && m_matrix[0][1] == 0 && m_matrix[0][2] == 0 && m_matrix[0][3] == 0 &&
+ m_matrix[1][0] == 0 && m_matrix[1][1] == 1 && m_matrix[1][2] == 0 && m_matrix[1][3] == 0 &&
+ m_matrix[2][0] == 0 && m_matrix[2][1] == 0 && m_matrix[2][2] == 1 && m_matrix[2][3] == 0 &&
+ m_matrix[3][0] == 0 && m_matrix[3][1] == 0 && m_matrix[3][2] == 0 && m_matrix[3][3] == 1;
+ }
+
+ // This form preserves the double math from input to output
+ void map(double x, double y, double& x2, double& y2) const { multVecMatrix(x, y, x2, y2); }
+
+ // Map a 3D point through the transform, returning a 3D point.
+ FloatPoint3D mapPoint(const FloatPoint3D&) const;
+
+ // Map a 2D point through the transform, returning a 2D point.
+ // Note that this ignores the z component, effectively projecting the point into the z=0 plane.
+ FloatPoint mapPoint(const FloatPoint&) const;
+
+ // Like the version above, except that it rounds the mapped point to the nearest integer value.
+ IntPoint mapPoint(const IntPoint& p) const
+ {
+ return roundedIntPoint(mapPoint(p));
+ }
+
+ // If the matrix has 3D components, the z component of the result is
+ // dropped, effectively projecting the rect into the z=0 plane
+ FloatRect mapRect(const FloatRect&) const;
+
+ // Rounds the resulting mapped rectangle out. This is helpful for bounding
+ // box computations but may not be what is wanted in other contexts.
+ IntRect mapRect(const IntRect&) const;
+
+ // If the matrix has 3D components, the z component of the result is
+ // dropped, effectively projecting the quad into the z=0 plane
+ FloatQuad mapQuad(const FloatQuad&) const;
+
+ // Map a point on the z=0 plane into a point on
+ // the plane with with the transform applied, by extending
+ // a ray perpendicular to the source plane and computing
+ // the local x,y position of the point where that ray intersects
+ // with the destination plane.
+ FloatPoint projectPoint(const FloatPoint&) const;
+ // Projects the four corners of the quad
+ FloatQuad projectQuad(const FloatQuad&) const;
+
+ double m11() const { return m_matrix[0][0]; }
+ void setM11(double f) { m_matrix[0][0] = f; }
+ double m12() const { return m_matrix[0][1]; }
+ void setM12(double f) { m_matrix[0][1] = f; }
+ double m13() const { return m_matrix[0][2]; }
+ void setM13(double f) { m_matrix[0][2] = f; }
+ double m14() const { return m_matrix[0][3]; }
+ void setM14(double f) { m_matrix[0][3] = f; }
+ double m21() const { return m_matrix[1][0]; }
+ void setM21(double f) { m_matrix[1][0] = f; }
+ double m22() const { return m_matrix[1][1]; }
+ void setM22(double f) { m_matrix[1][1] = f; }
+ double m23() const { return m_matrix[1][2]; }
+ void setM23(double f) { m_matrix[1][2] = f; }
+ double m24() const { return m_matrix[1][3]; }
+ void setM24(double f) { m_matrix[1][3] = f; }
+ double m31() const { return m_matrix[2][0]; }
+ void setM31(double f) { m_matrix[2][0] = f; }
+ double m32() const { return m_matrix[2][1]; }
+ void setM32(double f) { m_matrix[2][1] = f; }
+ double m33() const { return m_matrix[2][2]; }
+ void setM33(double f) { m_matrix[2][2] = f; }
+ double m34() const { return m_matrix[2][3]; }
+ void setM34(double f) { m_matrix[2][3] = f; }
+ double m41() const { return m_matrix[3][0]; }
+ void setM41(double f) { m_matrix[3][0] = f; }
+ double m42() const { return m_matrix[3][1]; }
+ void setM42(double f) { m_matrix[3][1] = f; }
+ double m43() const { return m_matrix[3][2]; }
+ void setM43(double f) { m_matrix[3][2] = f; }
+ double m44() const { return m_matrix[3][3]; }
+ void setM44(double f) { m_matrix[3][3] = f; }
+
+ double a() const { return m_matrix[0][0]; }
+ void setA(double a) { m_matrix[0][0] = a; }
+
+ double b() const { return m_matrix[0][1]; }
+ void setB(double b) { m_matrix[0][1] = b; }
+
+ double c() const { return m_matrix[1][0]; }
+ void setC(double c) { m_matrix[1][0] = c; }
+
+ double d() const { return m_matrix[1][1]; }
+ void setD(double d) { m_matrix[1][1] = d; }
+
+ double e() const { return m_matrix[3][0]; }
+ void setE(double e) { m_matrix[3][0] = e; }
+
+ double f() const { return m_matrix[3][1]; }
+ void setF(double f) { m_matrix[3][1] = f; }
+
+ // this = this * mat
+ TransformationMatrix& multiply(const TransformationMatrix& t) { return *this *= t; }
+
+ // this = mat * this
+ TransformationMatrix& multLeft(const TransformationMatrix& mat);
+
+ TransformationMatrix& scale(double);
+ TransformationMatrix& scaleNonUniform(double sx, double sy);
+ TransformationMatrix& scale3d(double sx, double sy, double sz);
+
+ TransformationMatrix& rotate(double d) { return rotate3d(0, 0, d); }
+ TransformationMatrix& rotateFromVector(double x, double y);
+ TransformationMatrix& rotate3d(double rx, double ry, double rz);
+
+ // The vector (x,y,z) is normalized if it's not already. A vector of
+ // (0,0,0) uses a vector of (0,0,1).
+ TransformationMatrix& rotate3d(double x, double y, double z, double angle);
+
+ TransformationMatrix& translate(double tx, double ty);
+ TransformationMatrix& translate3d(double tx, double ty, double tz);
+
+ // translation added with a post-multiply
+ TransformationMatrix& translateRight(double tx, double ty);
+ TransformationMatrix& translateRight3d(double tx, double ty, double tz);
+
+ TransformationMatrix& flipX();
+ TransformationMatrix& flipY();
+ TransformationMatrix& skew(double angleX, double angleY);
+ TransformationMatrix& skewX(double angle) { return skew(angle, 0); }
+ TransformationMatrix& skewY(double angle) { return skew(0, angle); }
+
+ TransformationMatrix& applyPerspective(double p);
+ bool hasPerspective() const { return m_matrix[2][3] != 0.0f; }
+
+ bool isInvertible() const;
+
+ // This method returns the identity matrix if it is not invertible.
+ // Use isInvertible() before calling this if you need to know.
+ TransformationMatrix inverse() const;
+
+ // decompose the matrix into its component parts
+ typedef struct {
+ double scaleX, scaleY, scaleZ;
+ double skewXY, skewXZ, skewYZ;
+ double quaternionX, quaternionY, quaternionZ, quaternionW;
+ double translateX, translateY, translateZ;
+ double perspectiveX, perspectiveY, perspectiveZ, perspectiveW;
+ } DecomposedType;
+
+ bool decompose(DecomposedType& decomp) const;
+ void recompose(const DecomposedType& decomp);
+
+ void blend(const TransformationMatrix& from, double progress);
+
+ bool isAffine() const
+ {
+ return (m13() == 0 && m14() == 0 && m23() == 0 && m24() == 0 &&
+ m31() == 0 && m32() == 0 && m33() == 1 && m34() == 0 && m43() == 0 && m44() == 1);
+ }
+
+ // Throw away the non-affine parts of the matrix (lossy!)
+ void makeAffine();
+
+ bool operator==(const TransformationMatrix& m2) const
+ {
+ return (m_matrix[0][0] == m2.m_matrix[0][0] &&
+ m_matrix[0][1] == m2.m_matrix[0][1] &&
+ m_matrix[0][2] == m2.m_matrix[0][2] &&
+ m_matrix[0][3] == m2.m_matrix[0][3] &&
+ m_matrix[1][0] == m2.m_matrix[1][0] &&
+ m_matrix[1][1] == m2.m_matrix[1][1] &&
+ m_matrix[1][2] == m2.m_matrix[1][2] &&
+ m_matrix[1][3] == m2.m_matrix[1][3] &&
+ m_matrix[2][0] == m2.m_matrix[2][0] &&
+ m_matrix[2][1] == m2.m_matrix[2][1] &&
+ m_matrix[2][2] == m2.m_matrix[2][2] &&
+ m_matrix[2][3] == m2.m_matrix[2][3] &&
+ m_matrix[3][0] == m2.m_matrix[3][0] &&
+ m_matrix[3][1] == m2.m_matrix[3][1] &&
+ m_matrix[3][2] == m2.m_matrix[3][2] &&
+ m_matrix[3][3] == m2.m_matrix[3][3]);
+ }
+
+ bool operator!=(const TransformationMatrix& other) const { return !(*this == other); }
+
+ // *this = *this * t (i.e., a multRight)
+ TransformationMatrix& operator*=(const TransformationMatrix& t)
+ {
+ *this = *this * t;
+ return *this;
+ }
+
+ // result = *this * t (i.e., a multRight)
+ TransformationMatrix operator*(const TransformationMatrix& t)
+ {
+ TransformationMatrix result = t;
+ result.multLeft(*this);
+ return result;
+ }
+
+#if PLATFORM(CG)
+ operator CGAffineTransform() const;
+#endif
+
+private:
+ TransformationMatrix makeMapBetweenRects(const FloatRect& source, const FloatRect& dest);
+
+ // multiply passed 2D point by matrix (assume z=0)
+ void multVecMatrix(double x, double y, double& dstX, double& dstY) const;
+
+ // multiply passed 3D point by matrix
+ void multVecMatrix(double x, double y, double z, double& dstX, double& dstY, double& dstZ) const;
+
+ void setMatrix(const Matrix4 m)
+ {
+ if (m && m != m_matrix)
+ memcpy(m_matrix, m, sizeof(Matrix4));
+ }
+
+ bool isIdentityOrTranslation() const
+ {
+ return m_matrix[0][0] == 1 && m_matrix[0][1] == 0 && m_matrix[0][2] == 0 && m_matrix[0][3] == 0 &&
+ m_matrix[1][0] == 0 && m_matrix[1][1] == 1 && m_matrix[1][2] == 0 && m_matrix[1][3] == 0 &&
+ m_matrix[2][0] == 0 && m_matrix[2][1] == 0 && m_matrix[2][2] == 1 && m_matrix[2][3] == 0 &&
+ m_matrix[3][3] == 1;
+ }
+
+ Matrix4 m_matrix;
+};
+
+} // namespace WebCore
+
+#endif // TransformationMatrix_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * (C) 2000 Antti Koivisto (koivisto@kde.org)
+ * (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TranslateTransformOperation_h
+#define TranslateTransformOperation_h
+
+#include "Length.h"
+#include "TransformOperation.h"
+
+namespace WebCore {
+
+class TranslateTransformOperation : public TransformOperation {
+public:
+ static PassRefPtr<TranslateTransformOperation> create(const Length& tx, const Length& ty, OperationType type)
+ {
+ return adoptRef(new TranslateTransformOperation(tx, ty, Length(0, Fixed), type));
+ }
+
+ static PassRefPtr<TranslateTransformOperation> create(const Length& tx, const Length& ty, const Length& tz, OperationType type)
+ {
+ return adoptRef(new TranslateTransformOperation(tx, ty, tz, type));
+ }
+
+ double x(const IntSize& borderBoxSize) const { return m_x.calcFloatValue(borderBoxSize.width()); }
+ double y(const IntSize& borderBoxSize) const { return m_y.calcFloatValue(borderBoxSize.height()); }
+ double z(const IntSize&) const { return m_z.calcFloatValue(1); }
+
+private:
+ virtual bool isIdentity() const { return m_x.calcFloatValue(1) == 0 && m_y.calcFloatValue(1) == 0 && m_z.calcFloatValue(1) == 0; }
+
+ virtual OperationType getOperationType() const { return m_type; }
+ virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == m_type; }
+
+ virtual bool operator==(const TransformOperation& o) const
+ {
+ if (!isSameType(o))
+ return false;
+ const TranslateTransformOperation* t = static_cast<const TranslateTransformOperation*>(&o);
+ return m_x == t->m_x && m_y == t->m_y && m_z == t->m_z;
+ }
+
+ virtual bool apply(TransformationMatrix& transform, const IntSize& borderBoxSize) const
+ {
+ transform.translate3d(x(borderBoxSize), y(borderBoxSize), z(borderBoxSize));
+ return m_x.type() == Percent || m_y.type() == Percent;
+ }
+
+ virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
+
+ TranslateTransformOperation(const Length& tx, const Length& ty, const Length& tz, OperationType type)
+ : m_x(tx)
+ , m_y(ty)
+ , m_z(tz)
+ , m_type(type)
+ {
+ ASSERT(type == TRANSLATE_X || type == TRANSLATE_Y || type == TRANSLATE_Z || type == TRANSLATE || type == TRANSLATE_3D);
+ }
+
+ Length m_x;
+ Length m_y;
+ Length m_z;
+ OperationType m_type;
+};
+
+} // namespace WebCore
+
+#endif // TranslateTransformOperation_h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2000 Frederik Holljen (frederik.holljen@hig.no)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Traversal_h
+#define Traversal_h
+
+#include "ScriptState.h"
+#include <wtf/Forward.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+ class Node;
+ class NodeFilter;
+
+ class Traversal {
+ public:
+ Node* root() const { return m_root.get(); }
+ unsigned whatToShow() const { return m_whatToShow; }
+ NodeFilter* filter() const { return m_filter.get(); }
+ bool expandEntityReferences() const { return m_expandEntityReferences; }
+
+ protected:
+ Traversal(PassRefPtr<Node>, unsigned whatToShow, PassRefPtr<NodeFilter>, bool expandEntityReferences);
+ short acceptNode(ScriptState*, Node*) const;
+
+ private:
+ RefPtr<Node> m_root;
+ unsigned m_whatToShow;
+ RefPtr<NodeFilter> m_filter;
+ bool m_expandEntityReferences;
+ };
+
+} // namespace WebCore
+
+#endif // Traversal_h
--- /dev/null
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TreeShared_h
+#define TreeShared_h
+
+#include <wtf/Assertions.h>
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+template<class T> class TreeShared : Noncopyable {
+public:
+ TreeShared()
+ : m_refCount(0)
+ , m_parent(0)
+ {
+#ifndef NDEBUG
+ m_deletionHasBegun = false;
+ m_inRemovedLastRefFunction = false;
+#endif
+ }
+ TreeShared(T* parent)
+ : m_refCount(0)
+ , m_parent(0)
+ {
+#ifndef NDEBUG
+ m_deletionHasBegun = false;
+ m_inRemovedLastRefFunction = false;
+#endif
+ }
+ virtual ~TreeShared()
+ {
+ ASSERT(m_deletionHasBegun);
+ }
+
+ void ref()
+ {
+ ASSERT(!m_deletionHasBegun);
+ ASSERT(!m_inRemovedLastRefFunction);
+ ++m_refCount;
+ }
+
+ void deref()
+ {
+ ASSERT(!m_deletionHasBegun);
+ ASSERT(!m_inRemovedLastRefFunction);
+ if (--m_refCount <= 0 && !m_parent) {
+#ifndef NDEBUG
+ m_inRemovedLastRefFunction = true;
+#endif
+ removedLastRef();
+ }
+ }
+
+ bool hasOneRef() const
+ {
+ ASSERT(!m_deletionHasBegun);
+ ASSERT(!m_inRemovedLastRefFunction);
+ return m_refCount == 1;
+ }
+
+ int refCount() const
+ {
+ return m_refCount;
+ }
+
+ void setParent(T* parent) { m_parent = parent; }
+ T* parent() const { return m_parent; }
+
+#ifndef NDEBUG
+ bool m_deletionHasBegun;
+ bool m_inRemovedLastRefFunction;
+#endif
+
+private:
+ virtual void removedLastRef()
+ {
+#ifndef NDEBUG
+ m_deletionHasBegun = true;
+#endif
+ delete this;
+ }
+
+ int m_refCount;
+ T* m_parent;
+};
+
+}
+
+#endif // TreeShared.h
--- /dev/null
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2000 Frederik Holljen (frederik.holljen@hig.no)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TreeWalker_h
+#define TreeWalker_h
+
+#include "JSDOMBinding.h"
+#include "NodeFilter.h"
+#include "Traversal.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+ typedef int ExceptionCode;
+
+ class TreeWalker : public RefCounted<TreeWalker>, public Traversal {
+ public:
+ static PassRefPtr<TreeWalker> create(PassRefPtr<Node> rootNode, unsigned whatToShow, PassRefPtr<NodeFilter> filter, bool expandEntityReferences)
+ {
+ return adoptRef(new TreeWalker(rootNode, whatToShow, filter, expandEntityReferences));
+ }
+
+ Node* currentNode() const { return m_current.get(); }
+ void setCurrentNode(PassRefPtr<Node>, ExceptionCode&);
+
+ Node* parentNode(ScriptState*);
+ Node* firstChild(ScriptState*);
+ Node* lastChild(ScriptState*);
+ Node* previousSibling(ScriptState*);
+ Node* nextSibling(ScriptState*);
+ Node* previousNode(ScriptState*);
+ Node* nextNode(ScriptState*);
+
+ // For non-JS bindings. Silently ignores the JavaScript exception if any.
+ Node* parentNode() { return parentNode(scriptStateFromNode(m_current.get())); }
+ Node* firstChild() { return firstChild(scriptStateFromNode(m_current.get())); }
+ Node* lastChild() { return lastChild(scriptStateFromNode(m_current.get())); }
+ Node* previousSibling() { return previousSibling(scriptStateFromNode(m_current.get())); }
+ Node* nextSibling() { return nextSibling(scriptStateFromNode(m_current.get())); }
+ Node* previousNode() { return previousNode(scriptStateFromNode(m_current.get())); }
+ Node* nextNode() { return nextNode(scriptStateFromNode(m_current.get())); }
+
+ private:
+ TreeWalker(PassRefPtr<Node>, unsigned whatToShow, PassRefPtr<NodeFilter>, bool expandEntityReferences);
+
+ Node* setCurrent(PassRefPtr<Node>);
+
+ RefPtr<Node> m_current;
+ };
+
+} // namespace WebCore
+
+#endif // TreeWalker_h
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TypingCommand_h
+#define TypingCommand_h
+
+#include "CompositeEditCommand.h"
+
+namespace WebCore {
+
+class TypingCommand : public CompositeEditCommand {
+public:
+ enum ETypingCommand {
+ DeleteSelection,
+ DeleteKey,
+ ForwardDeleteKey,
+ InsertText,
+ InsertLineBreak,
+ InsertParagraphSeparator,
+ InsertParagraphSeparatorInQuotedContent
+ };
+
+ static void deleteSelection(Document*, bool smartDelete = false);
+ static void deleteKeyPressed(Document*, bool smartDelete = false, TextGranularity = CharacterGranularity, bool killRing = false);
+ static void forwardDeleteKeyPressed(Document*, bool smartDelete = false, TextGranularity = CharacterGranularity, bool killRing = false);
+ static void insertText(Document*, const String&, bool selectInsertedText = false, bool insertedTextIsComposition = false);
+ static void insertText(Document*, const String&, const Selection&, bool selectInsertedText = false, bool insertedTextIsComposition = false);
+ static void insertLineBreak(Document*);
+ static void insertParagraphSeparator(Document*);
+ static void insertParagraphSeparatorInQuotedContent(Document*);
+ static bool isOpenForMoreTypingCommand(const EditCommand*);
+ static void closeTyping(EditCommand*);
+
+ bool isOpenForMoreTyping() const { return m_openForMoreTyping; }
+ void closeTyping() { m_openForMoreTyping = false; }
+
+ void insertText(const String &text, bool selectInsertedText);
+ void insertTextRunWithoutNewlines(const String &text, bool selectInsertedText);
+ void insertLineBreak();
+ void insertParagraphSeparatorInQuotedContent();
+ void insertParagraphSeparator();
+ void deleteKeyPressed(TextGranularity, bool killRing);
+ void forwardDeleteKeyPressed(TextGranularity, bool killRing);
+ void deleteSelection(bool smartDelete);
+
+ void setEndingSelectionOnLastInsertCommand(const Selection& selection);
+
+private:
+ static PassRefPtr<TypingCommand> create(Document* document, ETypingCommand command, const String& text = "", bool selectInsertedText = false, TextGranularity granularity = CharacterGranularity, bool killRing = false)
+ {
+ return adoptRef(new TypingCommand(document, command, text, selectInsertedText, granularity, killRing));
+ }
+
+ TypingCommand(Document*, ETypingCommand, const String& text, bool selectInsertedText, TextGranularity, bool killRing);
+
+ bool smartDelete() const { return m_smartDelete; }
+ void setSmartDelete(bool smartDelete) { m_smartDelete = smartDelete; }
+
+ virtual void doApply();
+ virtual EditAction editingAction() const;
+ virtual bool isTypingCommand() const;
+ virtual bool preservesTypingStyle() const;
+
+ void markMisspellingsAfterTyping();
+ void typingAddedToOpenCommand();
+
+ ETypingCommand m_commandType;
+ String m_textToInsert;
+ bool m_openForMoreTyping;
+ bool m_selectInsertedText;
+ bool m_smartDelete;
+ TextGranularity m_granularity;
+ bool m_killRing;
+
+ // Undoing a series of backward deletes will restore a selection around all of the
+ // characters that were deleted, but only if the typing command being undone
+ // was opened with a backward delete.
+ bool m_openedByBackwardDelete;
+};
+
+} // namespace WebCore
+
+#endif // TypingCommand_h
--- /dev/null
+/*
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
+ * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef UIEvent_h
+#define UIEvent_h
+
+#include "DOMWindow.h"
+#include "Event.h"
+
+namespace WebCore {
+
+ typedef DOMWindow AbstractView;
+
+ class UIEvent : public Event {
+ public:
+ static PassRefPtr<UIEvent> create()
+ {
+ return adoptRef(new UIEvent);
+ }
+ static PassRefPtr<UIEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view, int detail)
+ {
+ return adoptRef(new UIEvent(type, canBubble, cancelable, view, detail));
+ }
+ virtual ~UIEvent();
+
+ void initUIEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>, int detail);
+
+ AbstractView* view() const { return m_view.get(); }
+ int detail() const { return m_detail; }
+
+ virtual bool isUIEvent() const;
+
+ virtual int keyCode() const;
+ virtual int charCode() const;
+
+ virtual int layerX() const;
+ virtual int layerY() const;
+
+ virtual int pageX() const;
+ virtual int pageY() const;
+
+ virtual int which() const;
+
+ protected:
+ UIEvent();
+ UIEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>, int detail);
+
+ private:
+ RefPtr<AbstractView> m_view;
+ int m_detail;
+ };
+
+} // namespace WebCore
+
+#endif // UIEvent_h
--- /dev/null
+/*
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
+ * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef UIEventWithKeyState_h
+#define UIEventWithKeyState_h
+
+#include "UIEvent.h"
+
+namespace WebCore {
+
+ class UIEventWithKeyState : public UIEvent {
+ public:
+ bool ctrlKey() const { return m_ctrlKey; }
+ bool shiftKey() const { return m_shiftKey; }
+ bool altKey() const { return m_altKey; }
+ bool metaKey() const { return m_metaKey; }
+
+ protected:
+ UIEventWithKeyState()
+ : m_ctrlKey(false)
+ , m_altKey(false)
+ , m_shiftKey(false)
+ , m_metaKey(false)
+ {
+ }
+
+ UIEventWithKeyState(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view,
+ int detail, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
+ : UIEvent(type, canBubble, cancelable, view, detail)
+ , m_ctrlKey(ctrlKey)
+ , m_altKey(altKey)
+ , m_shiftKey(shiftKey)
+ , m_metaKey(metaKey)
+ {
+ }
+
+ // Expose these so init functions can set them.
+ bool m_ctrlKey : 1;
+ bool m_altKey : 1;
+ bool m_shiftKey : 1;
+ bool m_metaKey : 1;
+ };
+
+ UIEventWithKeyState* findEventWithKeyState(Event*);
+
+} // namespace WebCore
+
+#endif // UIEventWithKeyState_h
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Computer, Inc.
+ *
+ * Portions are Copyright (C) 1998 Netscape Communications Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of either the Mozilla Public License Version 1.1, found at
+ * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
+ * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
+ * (the "GPL"), in which case the provisions of the MPL or the GPL are
+ * applicable instead of those above. If you wish to allow use of your
+ * version of this file only under the terms of one of those two
+ * licenses (the MPL or the GPL) and not to allow others to use your
+ * version of this file under the LGPL, indicate your decision by
+ * deletingthe provisions above and replace them with the notice and
+ * other provisions required by the MPL or the GPL, as the case may be.
+ * If you do not delete the provisions above, a recipient may use your
+ * version of this file under any of the LGPL, the MPL or the GPL.
+ */
+
+#ifndef UnicodeRange_H
+#define UnicodeRange_H
+
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+// The following constants define unicode subranges
+// values below cRangeNum must be continuous so that we can map to
+// a lang group directly.
+// All ranges we care about should fit within 32 bits.
+
+// Frequently used range definitions
+const unsigned char cRangeCyrillic = 0;
+const unsigned char cRangeGreek = 1;
+const unsigned char cRangeTurkish = 2;
+const unsigned char cRangeHebrew = 3;
+const unsigned char cRangeArabic = 4;
+const unsigned char cRangeBaltic = 5;
+const unsigned char cRangeThai = 6;
+const unsigned char cRangeKorean = 7;
+const unsigned char cRangeJapanese = 8;
+const unsigned char cRangeSChinese = 9;
+const unsigned char cRangeTChinese = 10;
+const unsigned char cRangeDevanagari = 11;
+const unsigned char cRangeTamil = 12;
+const unsigned char cRangeArmenian = 13;
+const unsigned char cRangeBengali = 14;
+const unsigned char cRangeCanadian = 15;
+const unsigned char cRangeEthiopic = 16;
+const unsigned char cRangeGeorgian = 17;
+const unsigned char cRangeGujarati = 18;
+const unsigned char cRangeGurmukhi = 19;
+const unsigned char cRangeKhmer = 20;
+const unsigned char cRangeMalayalam = 21;
+
+const unsigned char cRangeSpecificItemNum = 22;
+
+//range/rangeSet grow to this place 22-29
+
+const unsigned char cRangeSetStart = 30; // range set definition starts from here
+const unsigned char cRangeSetLatin = 30;
+const unsigned char cRangeSetCJK = 31;
+const unsigned char cRangeSetEnd = 31; // range set definition ends here
+
+// less frequently used range definition
+const unsigned char cRangeSurrogate = 32;
+const unsigned char cRangePrivate = 33;
+const unsigned char cRangeMisc = 34;
+const unsigned char cRangeUnassigned = 35;
+const unsigned char cRangeSyriac = 36;
+const unsigned char cRangeThaana = 37;
+const unsigned char cRangeOriya = 38;
+const unsigned char cRangeTelugu = 39;
+const unsigned char cRangeKannada = 40;
+const unsigned char cRangeSinhala = 41;
+const unsigned char cRangeLao = 42;
+const unsigned char cRangeTibetan = 43;
+const unsigned char cRangeMyanmar = 44;
+const unsigned char cRangeCherokee = 45;
+const unsigned char cRangeOghamRunic = 46;
+const unsigned char cRangeMongolian = 47;
+const unsigned char cRangeMathOperators = 48;
+const unsigned char cRangeMiscTechnical = 49;
+const unsigned char cRangeControlOpticalEnclose = 50;
+const unsigned char cRangeBoxBlockGeometrics = 51;
+const unsigned char cRangeMiscSymbols = 52;
+const unsigned char cRangeDingbats = 53;
+const unsigned char cRangeBraillePattern = 54;
+const unsigned char cRangeYi = 55;
+const unsigned char cRangeCombiningDiacriticalMarks = 56;
+const unsigned char cRangeSpecials = 57;
+
+const unsigned char cRangeTableBase = 128; //values over 127 are reserved for internal use only
+const unsigned char cRangeTertiaryTable = 145; // leave room for 16 subtable
+ // indices (cRangeTableBase + 1 ..
+ // cRangeTableBase + 16)
+
+
+
+unsigned int findCharUnicodeRange(UChar32 ch);
+const char* langGroupFromUnicodeRange(unsigned char unicodeRange);
+
+}
+
+#endif // UnicodeRange_H
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef UnitBezier_h
+#define UnitBezier_h
+
+#include <math.h>
+
+namespace WebCore {
+
+ struct UnitBezier {
+ UnitBezier(double p1x, double p1y, double p2x, double p2y)
+ {
+ // Calculate the polynomial coefficients, implicit first and last control points are (0,0) and (1,1).
+ cx = 3.0 * p1x;
+ bx = 3.0 * (p2x - p1x) - cx;
+ ax = 1.0 - cx -bx;
+
+ cy = 3.0 * p1y;
+ by = 3.0 * (p2y - p1y) - cy;
+ ay = 1.0 - cy - by;
+ }
+
+ double sampleCurveX(double t)
+ {
+ // `ax t^3 + bx t^2 + cx t' expanded using Horner's rule.
+ return ((ax * t + bx) * t + cx) * t;
+ }
+
+ double sampleCurveY(double t)
+ {
+ return ((ay * t + by) * t + cy) * t;
+ }
+
+ double sampleCurveDerivativeX(double t)
+ {
+ return (3.0 * ax * t + 2.0 * bx) * t + cx;
+ }
+
+ // Given an x value, find a parametric value it came from.
+ double solveCurveX(double x, double epsilon)
+ {
+ double t0;
+ double t1;
+ double t2;
+ double x2;
+ double d2;
+ int i;
+
+ // First try a few iterations of Newton's method -- normally very fast.
+ for (t2 = x, i = 0; i < 8; i++) {
+ x2 = sampleCurveX(t2) - x;
+ if (fabs (x2) < epsilon)
+ return t2;
+ d2 = sampleCurveDerivativeX(t2);
+ if (fabs(d2) < 1e-6)
+ break;
+ t2 = t2 - x2 / d2;
+ }
+
+ // Fall back to the bisection method for reliability.
+ t0 = 0.0;
+ t1 = 1.0;
+ t2 = x;
+
+ if (t2 < t0)
+ return t0;
+ if (t2 > t1)
+ return t1;
+
+ while (t0 < t1) {
+ x2 = sampleCurveX(t2);
+ if (fabs(x2 - x) < epsilon)
+ return t2;
+ if (x > x2)
+ t0 = t2;
+ else
+ t1 = t2;
+ t2 = (t1 - t0) * .5 + t0;
+ }
+
+ // Failure.
+ return t2;
+ }
+
+ double solve(double x, double epsilon)
+ {
+ return sampleCurveY(solveCurveX(x, epsilon));
+ }
+
+ private:
+ double ax;
+ double bx;
+ double cx;
+
+ double ay;
+ double by;
+ double cy;
+ };
+}
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef UnlinkCommand_h
+#define UnlinkCommand_h
+
+#include "CompositeEditCommand.h"
+
+namespace WebCore {
+
+class UnlinkCommand : public CompositeEditCommand {
+public:
+ static PassRefPtr<UnlinkCommand> create(Document* document)
+ {
+ return adoptRef(new UnlinkCommand(document));
+ }
+
+private:
+ UnlinkCommand(Document*);
+
+ virtual void doApply();
+ virtual EditAction editingAction() const { return EditActionUnlink; }
+};
+
+} // namespace WebCore
+
+#endif // UnlinkCommand_h
--- /dev/null
+/*
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef UserStyleSheetLoader_h
+#define UserStyleSheetLoader_h
+
+#include "CachedResourceClient.h"
+#include "CachedResourceHandle.h"
+
+#include "Document.h"
+
+namespace WebCore {
+ class CachedCSSStyleSheet;
+ class String;
+
+ // This class is deprecated and should not be used in any new code. User
+ // stylesheet loading should instead happen through Page.
+ class UserStyleSheetLoader : CachedResourceClient {
+ public:
+ UserStyleSheetLoader(PassRefPtr<Document>, const String& url);
+ ~UserStyleSheetLoader();
+
+ private:
+ virtual void setCSSStyleSheet(const String& URL, const String& charset, const CachedCSSStyleSheet* sheet);
+
+ RefPtr<Document> m_document;
+ CachedResourceHandle<CachedCSSStyleSheet> m_cachedSheet;
+ };
+
+} // namespace WebCore
+
+#endif // UserStyleSheetLoader_h
--- /dev/null
+/*
+ * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef VisiblePosition_h
+#define VisiblePosition_h
+
+#include "Node.h"
+#include "Position.h"
+#include "TextDirection.h"
+
+namespace WebCore {
+
+// VisiblePosition default affinity is downstream because
+// the callers do not really care (they just want the
+// deep position without regard to line position), and this
+// is cheaper than UPSTREAM
+#define VP_DEFAULT_AFFINITY DOWNSTREAM
+
+// Callers who do not know where on the line the position is,
+// but would like UPSTREAM if at a line break or DOWNSTREAM
+// otherwise, need a clear way to specify that. The
+// constructors auto-correct UPSTREAM to DOWNSTREAM if the
+// position is not at a line break.
+#define VP_UPSTREAM_IF_POSSIBLE UPSTREAM
+
+class InlineBox;
+
+class VisiblePosition {
+public:
+ // NOTE: UPSTREAM affinity will be used only if pos is at end of a wrapped line,
+ // otherwise it will be converted to DOWNSTREAM
+ VisiblePosition() : m_affinity(VP_DEFAULT_AFFINITY) { }
+ VisiblePosition(Node*, int offset, EAffinity);
+ VisiblePosition(const Position&, EAffinity = VP_DEFAULT_AFFINITY);
+
+ void clear() { m_deepPosition.clear(); }
+
+ bool isNull() const { return m_deepPosition.isNull(); }
+ bool isNotNull() const { return m_deepPosition.isNotNull(); }
+
+ Position deepEquivalent() const { return m_deepPosition; }
+ EAffinity affinity() const { ASSERT(m_affinity == UPSTREAM || m_affinity == DOWNSTREAM); return m_affinity; }
+ void setAffinity(EAffinity affinity) { m_affinity = affinity; }
+
+ // next() and previous() will increment/decrement by a character cluster.
+ VisiblePosition next(bool stayInEditableContent = false) const;
+ VisiblePosition previous(bool stayInEditableContent = false) const;
+ VisiblePosition honorEditableBoundaryAtOrBefore(const VisiblePosition&) const;
+ VisiblePosition honorEditableBoundaryAtOrAfter(const VisiblePosition&) const;
+
+ VisiblePosition left(bool stayInEditableContent = false) const;
+ VisiblePosition right(bool stayInEditableContent = false) const;
+
+ UChar32 characterAfter() const;
+ UChar32 characterBefore() const { return previous().characterAfter(); }
+
+ void debugPosition(const char* msg = "") const;
+
+ Element* rootEditableElement() const { return m_deepPosition.isNotNull() ? m_deepPosition.node()->rootEditableElement() : 0; }
+
+ void getInlineBoxAndOffset(InlineBox*& inlineBox, int& caretOffset) const
+ {
+ m_deepPosition.getInlineBoxAndOffset(m_affinity, inlineBox, caretOffset);
+ }
+
+ void getInlineBoxAndOffset(TextDirection primaryDirection, InlineBox*& inlineBox, int& caretOffset) const
+ {
+ m_deepPosition.getInlineBoxAndOffset(m_affinity, primaryDirection, inlineBox, caretOffset);
+ }
+
+ // Rect is local to the returned renderer
+ IntRect localCaretRect(RenderObject*&) const;
+ // Bounds of (possibly transformed) caret in absolute coords
+ IntRect absoluteCaretBounds() const;
+ // Abs x position of the caret ignoring transforms.
+ // FIXME: navigation with transforms should be smarter.
+ int xOffsetForVerticalNavigation() const;
+
+#ifndef NDEBUG
+ void formatForDebugger(char* buffer, unsigned length) const;
+ void showTreeForThis() const;
+#endif
+
+private:
+ void init(const Position&, EAffinity);
+ Position canonicalPosition(const Position&);
+
+ Position leftVisuallyDistinctCandidate() const;
+ Position rightVisuallyDistinctCandidate() const;
+
+ Position m_deepPosition;
+ EAffinity m_affinity;
+};
+
+// FIXME: This shouldn't ignore affinity.
+inline bool operator==(const VisiblePosition& a, const VisiblePosition& b)
+{
+ return a.deepEquivalent() == b.deepEquivalent();
+}
+
+inline bool operator!=(const VisiblePosition& a, const VisiblePosition& b)
+{
+ return !(a == b);
+}
+
+PassRefPtr<Range> makeRange(const VisiblePosition&, const VisiblePosition&);
+bool setStart(Range*, const VisiblePosition&);
+bool setEnd(Range*, const VisiblePosition&);
+VisiblePosition startVisiblePosition(const Range*, EAffinity);
+VisiblePosition endVisiblePosition(const Range*, EAffinity);
+
+Node *enclosingBlockFlowElement(const VisiblePosition&);
+
+bool isFirstVisiblePositionInNode(const VisiblePosition&, const Node*);
+bool isLastVisiblePositionInNode(const VisiblePosition&, const Node*);
+
+} // namespace WebCore
+
+#ifndef NDEBUG
+// Outside the WebCore namespace for ease of invocation from gdb.
+void showTree(const WebCore::VisiblePosition*);
+void showTree(const WebCore::VisiblePosition&);
+#endif
+
+#endif // VisiblePosition_h
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef VoidCallback_h
+#define VoidCallback_h
+
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class VoidCallback : public RefCounted<VoidCallback> {
+public:
+ virtual ~VoidCallback() { }
+
+ virtual void handleEvent() = 0;
+
+protected:
+ VoidCallback() {}
+};
+
+} // namespace WebCore
+
+#endif
--- /dev/null
+//
+// WAKAppKitStubs.h
+//
+// Copyright (C) 2005, 2006, 2007, 2008, Apple Inc. All rights reserved.
+//
+/* Unicodes we reserve for function keys on the keyboard, OpenStep reserves the range 0xF700-0xF8FF for this purpose. The availability of various keys will be system dependent. */
+
+// Include Platform.h so that other applications including this file don't have to.
+#ifndef WAKAppKitStubs_h
+#define WAKAppKitStubs_h
+
+#import <JavaScriptCore/Platform.h>
+#import <CoreGraphics/CoreGraphics.h>
+#import <Foundation/Foundation.h>
+
+#import "WKTypes.h"
+
+#ifndef NSView
+#define NSClipView WAKClipView
+#define NSView WAKView
+#define NSScroller WAKScroller
+#define NSScrollView WAKScrollView
+#define WebDynamicScrollBarsView WAKScrollView
+#define NSWindow WAKWindow
+#define NSResponder WAKResponder
+
+#define NSPoint CGPoint
+#define NSSize CGSize
+#define NSRect CGRect
+
+#define NSZeroPoint CGPointZero
+#define NSZeroSize CGSizeZero
+#define NSZeroRect CGRectZero
+
+#define NSMakePoint CGPointMake
+#define NSMakeSize CGSizeMake
+#define NSMakeRect CGRectMake
+
+#define NSEqualPoints CGPointEqualToPoint
+#define NSEqualSizes CGSizeEqualToSize
+#define NSEqualRects CGRectEqualToRect
+
+#define NSPointInRect(x,y) CGRectContainsPoint(y,x)
+#define NSInsetRect CGRectInset
+#define NSIntersectionRect CGRectIntersection
+#define NSIsEmptyRect CGRectIsEmpty
+#define NSMaxX CGRectGetMaxX
+#define NSMaxY CGRectGetMaxY
+#define NSContainsRect CGRectContainsRect
+#define NSWidth CGRectGetWidth
+#define NSHeight CGRectGetHeight
+
+#endif
+
+enum {
+ NSUpArrowFunctionKey = 0xF700,
+ NSDownArrowFunctionKey = 0xF701,
+ NSLeftArrowFunctionKey = 0xF702,
+ NSRightArrowFunctionKey = 0xF703,
+ NSF1FunctionKey = 0xF704,
+ NSF2FunctionKey = 0xF705,
+ NSF3FunctionKey = 0xF706,
+ NSF4FunctionKey = 0xF707,
+ NSF5FunctionKey = 0xF708,
+ NSF6FunctionKey = 0xF709,
+ NSF7FunctionKey = 0xF70A,
+ NSF8FunctionKey = 0xF70B,
+ NSF9FunctionKey = 0xF70C,
+ NSF10FunctionKey = 0xF70D,
+ NSF11FunctionKey = 0xF70E,
+ NSF12FunctionKey = 0xF70F,
+ NSF13FunctionKey = 0xF710,
+ NSF14FunctionKey = 0xF711,
+ NSF15FunctionKey = 0xF712,
+ NSF16FunctionKey = 0xF713,
+ NSF17FunctionKey = 0xF714,
+ NSF18FunctionKey = 0xF715,
+ NSF19FunctionKey = 0xF716,
+ NSF20FunctionKey = 0xF717,
+ NSF21FunctionKey = 0xF718,
+ NSF22FunctionKey = 0xF719,
+ NSF23FunctionKey = 0xF71A,
+ NSF24FunctionKey = 0xF71B,
+ NSF25FunctionKey = 0xF71C,
+ NSF26FunctionKey = 0xF71D,
+ NSF27FunctionKey = 0xF71E,
+ NSF28FunctionKey = 0xF71F,
+ NSF29FunctionKey = 0xF720,
+ NSF30FunctionKey = 0xF721,
+ NSF31FunctionKey = 0xF722,
+ NSF32FunctionKey = 0xF723,
+ NSF33FunctionKey = 0xF724,
+ NSF34FunctionKey = 0xF725,
+ NSF35FunctionKey = 0xF726,
+ NSInsertFunctionKey = 0xF727,
+ NSDeleteFunctionKey = 0xF728,
+ NSHomeFunctionKey = 0xF729,
+ NSBeginFunctionKey = 0xF72A,
+ NSEndFunctionKey = 0xF72B,
+ NSPageUpFunctionKey = 0xF72C,
+ NSPageDownFunctionKey = 0xF72D,
+ NSPrintScreenFunctionKey = 0xF72E,
+ NSScrollLockFunctionKey = 0xF72F,
+ NSPauseFunctionKey = 0xF730,
+ NSSysReqFunctionKey = 0xF731,
+ NSBreakFunctionKey = 0xF732,
+ NSResetFunctionKey = 0xF733,
+ NSStopFunctionKey = 0xF734,
+ NSMenuFunctionKey = 0xF735,
+ NSUserFunctionKey = 0xF736,
+ NSSystemFunctionKey = 0xF737,
+ NSPrintFunctionKey = 0xF738,
+ NSClearLineFunctionKey = 0xF739,
+ NSClearDisplayFunctionKey = 0xF73A,
+ NSInsertLineFunctionKey = 0xF73B,
+ NSDeleteLineFunctionKey = 0xF73C,
+ NSInsertCharFunctionKey = 0xF73D,
+ NSDeleteCharFunctionKey = 0xF73E,
+ NSPrevFunctionKey = 0xF73F,
+ NSNextFunctionKey = 0xF740,
+ NSSelectFunctionKey = 0xF741,
+ NSExecuteFunctionKey = 0xF742,
+ NSUndoFunctionKey = 0xF743,
+ NSRedoFunctionKey = 0xF744,
+ NSFindFunctionKey = 0xF745,
+ NSHelpFunctionKey = 0xF746,
+ NSModeSwitchFunctionKey = 0xF747
+};
+
+enum {
+ NSParagraphSeparatorCharacter = 0x2029,
+ NSLineSeparatorCharacter = 0x2028,
+ NSTabCharacter = 0x0009,
+ NSFormFeedCharacter = 0x000c,
+ NSNewlineCharacter = 0x000a,
+ NSCarriageReturnCharacter = 0x000d,
+ NSEnterCharacter = 0x0003,
+ NSBackspaceCharacter = 0x0008,
+ NSBackTabCharacter = 0x0019,
+ NSDeleteCharacter = 0x007f
+};
+
+/* Device-independent bits found in event modifier flags */
+enum {
+ NSAlphaShiftKeyMask = 1 << 16,
+ NSShiftKeyMask = 1 << 17,
+ NSControlKeyMask = 1 << 18,
+ NSAlternateKeyMask = 1 << 19,
+ NSCommandKeyMask = 1 << 20,
+ NSNumericPadKeyMask = 1 << 21,
+ NSHelpKeyMask = 1 << 22,
+ NSFunctionKeyMask = 1 << 23,
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+ NSDeviceIndependentModifierFlagsMask = 0xffff0000U
+#endif
+};
+
+typedef enum _NSWritingDirection {
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+ NSWritingDirectionNatural = -1, /* Determines direction using the Unicode Bidi Algorithm rules P2 and P3 */
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 */
+ NSWritingDirectionLeftToRight = 0, /* Left to right writing direction */
+ NSWritingDirectionRightToLeft /* Right to left writing direction */
+} NSWritingDirection;
+
+typedef enum _NSSelectionAffinity {
+ NSSelectionAffinityUpstream = 0,
+ NSSelectionAffinityDownstream = 1
+} NSSelectionAffinity;
+
+typedef enum _NSCellState {
+ NSMixedState = -1,
+ NSOffState = 0,
+ NSOnState = 1
+} NSCellStateValue;
+
+typedef enum _NSCompositingOperation {
+ NSCompositeClear = 0,
+ NSCompositeCopy = 1,
+ NSCompositeSourceOver = 2,
+ NSCompositeSourceIn = 3,
+ NSCompositeSourceOut = 4,
+ NSCompositeSourceAtop = 5,
+ NSCompositeDestinationOver = 6,
+ NSCompositeDestinationIn = 7,
+ NSCompositeDestinationOut = 8,
+ NSCompositeDestinationAtop = 9,
+ NSCompositeXOR = 10,
+ NSCompositePlusDarker = 11,
+ NSCompositeHighlight = 12,
+ NSCompositePlusLighter = 13
+} NSCompositingOperation;
+
+typedef enum _NSMultibyteGlyphPacking {
+ NSOneByteGlyphPacking,
+ NSJapaneseEUCGlyphPacking,
+ NSAsciiWithDoubleByteEUCGlyphPacking,
+ NSTwoByteGlyphPacking,
+ NSFourByteGlyphPacking,
+ NSNativeShortGlyphPacking
+} NSMultibyteGlyphPacking;
+
+typedef enum _NSSelectionDirection {
+ NSDirectSelection = 0,
+ NSSelectingNext,
+ NSSelectingPrevious
+} NSSelectionDirection;
+
+void *WKAutorelease(id object);
+
+@interface NSCursor : NSObject
++ (void)setHiddenUntilMouseMoves:(BOOL)flag;
+@end
+
+@interface NSValue (CGRidiculousness)
++ (id)valueWithSize:(CGSize)aSize;
+- (CGSize)sizeValue;
++ (id)valueWithRect:(CGRect)aRect;
+- (CGRect)rectValue;
+@end
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+BOOL WKMouseInRect(CGPoint aPoint, CGRect aRect);
+void WKBeep(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
--- /dev/null
+//
+// WAKClipView.h
+// WebCore
+//
+// Copyright 2008 Apple. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+#import "WAKView.h"
+
+@interface WAKClipView : WAKView
+{
+}
+- (void)setDocumentView:(WAKView *)aView;
+- (id)documentView;
+- (BOOL)copiesOnScroll;
+- (void)setCopiesOnScroll:(BOOL)flag;
+- (CGRect)documentVisibleRect;
+@end
--- /dev/null
+//
+// WAKResponder.h
+// WebCore
+//
+// Copyright (C) 2005, 2006, 2007, 2008, Apple Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <GraphicsServices/GSBase.h>
+#import <JavaScriptCore/Platform.h>
+#import "WKTypes.h"
+
+@interface WAKResponder : NSObject
+{
+
+}
+
+- (void)handleEvent:(GSEventRef)event;
+
+- (void)scrollWheel:(GSEventRef)theEvent;
+- (BOOL)tryToPerform:(SEL)anAction with:(id)anObject;
+- (void)mouseEntered:(GSEventRef)theEvent;
+- (void)mouseExited:(GSEventRef)theEvent;
+- (void)keyDown:(GSEventRef)event;
+- (void)keyUp:(GSEventRef)event;
+#if ENABLE(TOUCH_EVENTS)
+- (void)touch:(GSEventRef)event;
+#endif
+
+- (void)insertText:(NSString *)text;
+
+- (void)deleteBackward:(id)sender;
+- (void)deleteForward:(id)sender;
+- (void)insertParagraphSeparator:(id)sender;
+
+- (void)moveDown:(id)sender;
+- (void)moveDownAndModifySelection:(id)sender;
+- (void)moveLeft:(id)sender;
+- (void)moveLeftAndModifySelection:(id)sender;
+- (void)moveRight:(id)sender;
+- (void)moveRightAndModifySelection:(id)sender;
+- (void)moveUp:(id)sender;
+- (void)moveUpAndModifySelection:(id)sender;
+
+- (WAKResponder *)nextResponder;
+- (BOOL)acceptsFirstResponder;
+- (BOOL)becomeFirstResponder;
+- (BOOL)resignFirstResponder;
+
+- (void)mouseDragged:(GSEventRef)theEvent;
+- (void)mouseUp:(GSEventRef)theEvent;
+- (void)mouseDown:(GSEventRef)theEvent;
+- (void)mouseMoved:(GSEventRef)theEvent;
+
+@end
--- /dev/null
+//
+// WAKScrollView.h
+// WebCore
+//
+// Copyright (C) 2005, 2006, 2007, Apple Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+#import "WAKClipView.h"
+#import "WAKView.h"
+#import "WebCoreFrameView.h"
+
+@interface WAKScroller : WAKView
++ (float)scrollerWidth;
+@end
+
+@interface WAKScrollView : WAKView <WebCoreFrameScrollView>
+{
+ WAKView *_documentView; // Only here so the ObjC instance stays around.
+ id _delegate;
+}
+
+- (CGRect)documentVisibleRect;
+- (void)setContentView:(WAKClipView *)aView;
+- (WAKClipView *)contentView;
+- (id)documentView;
+- (void)setDocumentView:(WAKView *)aView;
+- (void)setHasVerticalScroller:(BOOL)flag;
+- (BOOL)hasVerticalScroller;
+- (void)setHasHorizontalScroller:(BOOL)flag;
+- (BOOL)hasHorizontalScroller;
+- (void)setVerticalScroller:(WAKScroller *)anObject;
+- (WAKScroller *)verticalScroller;
+- (void)setHorizontalScroller:(WAKScroller *)anObject;
+- (WAKScroller *)horizontalScroller;
+- (void)reflectScrolledClipView:(WAKClipView *)aClipView;
+- (void)setDrawsBackground:(BOOL)flag;
+- (float)verticalLineScroll;
+- (void)setLineScroll:(float)aFloat;
+- (BOOL)drawsBackground;
+- (float)horizontalLineScroll;
+
+- (void)setAllowsHorizontalScrolling:(BOOL)flag;
+- (BOOL)allowsHorizontalScrolling;
+- (void)setAllowsVerticalScrolling:(BOOL)flag;
+- (BOOL)allowsVerticalScrolling;
+- (void)setAllowsScrolling:(BOOL)flag;
+- (BOOL)allowsScrolling;
+
+- (void)setDelegate:(id)delegate;
+- (id)delegate;
+
+- (CGPoint)contentsPoint;
+- (CGRect)actualDocumentVisibleRect;
+
+@end
+
+@interface NSObject (WAKScrollViewDelegate)
+- (CGPoint)contentsPointForScrollView:(WAKScrollView *)aScrollView;
+- (CGRect)documentVisibleRectForScrollView:(WAKScrollView *)aScrollView;
+- (BOOL)scrollView:(WAKScrollView *)scrollView shouldScrollToPoint:(CGPoint)point;
+@end
--- /dev/null
+//
+// WAKStringDrawing.h
+// WebKit
+//
+// Copyright (C) 2005, 2006, 2007, 2008, Apple Inc. All rights reserved.
+//
+
+#import <CoreGraphics/CoreGraphics.h>
+#import <Foundation/Foundation.h>
+#import <GraphicsServices/GraphicsServices.h>
+
+typedef enum {
+ // The order of the enum items is important, and it is used for >= comparisions
+ WebEllipsisStyleNone = 0, // Old style, no truncation. Doesn't respect the "width" passed to it. Left in for compatability.
+ WebEllipsisStyleHead = 1,
+ WebEllipsisStyleTail = 2,
+ WebEllipsisStyleCenter = 3,
+ WebEllipsisStyleClip = 4, // Doesn't really clip, but instad truncates at the last character.
+ WebEllipsisStyleWordWrap = 5, // Truncates based on the width/height passed to it.
+ WebEllipsisStyleCharacterWrap = 6, // For "drawAtPoint", it is just like WebEllipsisStyleClip, since it doesn't really clip, but truncates at the last character
+} WebEllipsisStyle;
+
+typedef enum {
+ WebTextAlignmentLeft = 0,
+ WebTextAlignmentCenter = 1,
+ WebTextAlignmentRight = 2,
+} WebTextAlignment;
+
+@interface NSString (WebStringDrawing)
+
++ (void)_web_setWordRoundingEnabled:(BOOL)flag;
++ (BOOL)_web_wordRoundingEnabled;
+
+- (CGSize)_web_drawAtPoint:(CGPoint)point withFont:(GSFontRef)font;
+
+- (CGSize)_web_sizeWithFont:(GSFontRef)font;
+
+// Size after applying ellipsis style and clipping to width.
+- (CGSize)_web_sizeWithFont:(GSFontRef)font forWidth:(float)width ellipsis:(WebEllipsisStyle)ellipsisStyle;
+- (CGSize)_web_sizeWithFont:(GSFontRef)font forWidth:(float)width ellipsis:(WebEllipsisStyle)ellipsisStyle letterSpacing:(float)letterSpacing;
+
+// Draw text to fit width. Clip or apply ellipsis according to style.
+- (CGSize)_web_drawAtPoint:(CGPoint)point forWidth:(float)width withFont:(GSFontRef)font ellipsis:(WebEllipsisStyle)ellipsisStyle;
+- (CGSize)_web_drawAtPoint:(CGPoint)point forWidth:(float)width withFont:(GSFontRef)font ellipsis:(WebEllipsisStyle)ellipsisStyle letterSpacing:(float)letterSpacing;
+- (CGSize)_web_drawAtPoint:(CGPoint)point forWidth:(float)width withFont:(GSFontRef)font ellipsis:(WebEllipsisStyle)ellipsisStyle letterSpacing:(float)letterSpacing includeEmoji:(BOOL)includeEmoji;
+
+// Wrap and clip to rect.
+- (CGSize)_web_drawInRect:(CGRect)rect withFont:(GSFontRef)font ellipsis:(WebEllipsisStyle)ellipsisStyle alignment:(WebTextAlignment)alignment;
+- (CGSize)_web_drawInRect:(CGRect)rect withFont:(GSFontRef)font ellipsis:(WebEllipsisStyle)ellipsisStyle alignment:(WebTextAlignment)alignment lineSpacing:(int)lineSpacing;
+- (CGSize)_web_drawInRect:(CGRect)rect withFont:(GSFontRef)font ellipsis:(WebEllipsisStyle)ellipsisStyle alignment:(WebTextAlignment)alignment lineSpacing:(int)lineSpacing includeEmoji:(BOOL)includeEmoji;
+- (CGSize)_web_sizeInRect:(CGRect)rect withFont:(GSFontRef)font ellipsis:(WebEllipsisStyle)ellipsisStyle;
+- (CGSize)_web_sizeInRect:(CGRect)rect withFont:(GSFontRef)font ellipsis:(WebEllipsisStyle)ellipsisStyle lineSpacing:(int)lineSpacing;
+
+// Determine the secured version of this string
+- (NSString *)_web_securedStringIncludingLastCharacter:(BOOL)includingLastCharacter;
+
+@end
--- /dev/null
+//
+// WAKView.h
+//
+// Copyright (C) 2005, 2006, 2007, 2008, Apple Inc. All rights reserved.
+//
+#import <Foundation/Foundation.h>
+#import <CoreGraphics/CoreGraphics.h>
+
+#import "WAKResponder.h"
+#import "WKView.h"
+
+#ifndef NSRect
+#define NSRect CGRect
+#endif
+#define NSPoint CGPoint
+#define NSSize CGSize
+
+extern NSString *WAKViewFrameSizeDidChangeNotification;
+extern NSString *WAKViewDidScrollNotification;
+
+@class WAKWindow;
+
+@interface WAKView : WAKResponder
+{
+ WKViewContext viewContext;
+ WKViewRef viewRef;
+
+ NSMutableSet *subviewReferences; // This array is only used to keep WAKViews alive.
+ // The actual subviews are maintained by the WKView.
+}
+
++ (WAKView *)focusView;
+
+- (id)initWithFrame:(CGRect)rect;
+
+- (WAKWindow *)window;
+
+- (NSRect)bounds;
+- (NSRect)frame;
+
+- (void)setFrame:(NSRect)frameRect;
+- (void)setFrameSize:(NSSize)newSize;
+- (void)setBoundsSize:(NSSize)size;
+- (void)frameSizeChanged;
+
+- (NSArray *)subviews;
+- (WAKView *)superview;
+- (void)addSubview:(WAKView *)subview;
+- (void)willRemoveSubview:(WAKView *)subview;
+- (void)removeFromSuperview;
+- (BOOL)isDescendantOf:(WAKView *)aView;
+- (WAKView *)lastScrollableAncestor;
+
+- (void)viewDidMoveToWindow;
+
+- (void)lockFocus;
+- (void)unlockFocus;
+
+- (void)setNeedsDisplay:(BOOL)flag;
+- (void)setNeedsDisplayInRect:(CGRect)invalidRect;
+- (BOOL)needsDisplay;
+- (void)display;
+- (void)displayIfNeeded;
+- (void)displayRect:(NSRect)rect;
+- (void)displayRectIgnoringOpacity:(NSRect)rect;
+- (void)drawRect:(CGRect)rect;
+- (void)viewWillDraw;
+
+- (WAKView *)hitTest:(NSPoint)point;
+- (NSPoint)convertPoint:(NSPoint)point fromView:(WAKView *)aView;
+- (NSPoint)convertPoint:(NSPoint)point toView:(WAKView *)aView;
+- (NSSize)convertSize:(NSSize)size toView:(WAKView *)aView;
+- (NSRect)convertRect:(NSRect)rect fromView:(WAKView *)aView;
+- (NSRect)convertRect:(NSRect)rect toView:(WAKView *)aView;
+
+- (BOOL)needsPanelToBecomeKey;
+
+- (BOOL)scrollRectToVisible:(NSRect)aRect;
+- (void)scrollPoint:(NSPoint)aPoint;
+- (NSRect)visibleRect;
+
+- (void)setHidden:(BOOL)flag;
+
+- (void)setNextKeyView:(WAKView *)aView;
+- (WAKView *)nextKeyView;
+- (WAKView *)nextValidKeyView;
+- (WAKView *)previousKeyView;
+- (WAKView *)previousValidKeyView;
+
+- (void)invalidateGState;
+- (void)releaseGState;
+
+- (void)setAutoresizingMask:(unsigned int)mask;
+- (unsigned int)autoresizingMask;
+- (BOOL)inLiveResize;
+
+- (BOOL)mouse:(NSPoint)aPoint inRect:(NSRect)aRect;
+
+- (void)setNeedsLayout:(BOOL)flag;
+- (void)layout;
+- (void)layoutIfNeeded;
+
+- (void)setScale:(float)scale;
+- (float)scale;
+
+- (void)_setDrawsOwnDescendants:(BOOL)draw;
+
+@end
--- /dev/null
+//
+// WAKViewPrivate.h
+//
+// Copyright (C) 2005, 2006, 2007, Apple Inc. All rights reserved.
+//
+#import "WAKView.h"
+
+@interface WAKView (WAKPrivate)
+- (WKViewRef)_viewRef;
++ (void)_addViewWrapper:(WAKView *)view;
++ (void)_removeViewWrapper:(WAKView *)view;
++ (WAKView *)_wrapperForViewRef:(WKViewRef)_viewRef;
+- (void)_handleEvent:(GSEventRef)event;
+- (BOOL)_handleResponderCall:(WKViewResponderCallbackType)type;
+- (NSMutableSet *)_subviewReferences;
+@end
--- /dev/null
+//
+// WAKWindow.h
+//
+// Copyright (C) 2005, 2006, 2007, 2009 Apple Inc. All rights reserved.
+//
+
+#ifndef WAKWindow_h
+#define WAKWindow_h
+
+#import <Foundation/Foundation.h>
+
+#import <CoreGraphics/CoreGraphics.h>
+
+#import "WAKAppKitStubs.h"
+
+#import "WAKResponder.h"
+#import "WAKView.h"
+#import "WKWindow.h"
+#import "WKContentObservation.h"
+
+@class CALayer;
+
+typedef enum {
+ kWAKWindowTilingModeNormal,
+ kWAKWindowTilingModeMinimal,
+ kWAKWindowTilingModePanning,
+ kWAKWindowTilingModeZooming,
+ kWAKWindowTilingModeDisabled
+} WAKWindowTilingMode;
+
+@interface WAKWindow : WAKResponder
+{
+ WKWindowRef window;
+}
+// Create layer hosted window
+- (id)initWithLayer:(CALayer *)hostLayer;
+// Create unhosted window for manual painting
+- (id)initWithFrame:(CGRect)frame;
+
+- (void)setContentView:(WAKView *)aView;
+- (WAKView *)contentView;
+- (void)close;
+- (WAKResponder *)firstResponder;
+- (NSPoint)convertBaseToScreen:(NSPoint)aPoint;
+- (NSPoint)convertScreenToBase:(NSPoint)aPoint;
+- (void)endEditingFor:(id)anObject;
+- (int)windowNumber;
+- (GSEventRef)currentEvent;
+- (BOOL)isKeyWindow;
+- (NSSelectionDirection)keyViewSelectionDirection;
+- (BOOL)makeFirstResponder:(NSResponder *)aResponder;
+- (WKWindowRef)_windowRef;
+- (void)setFrame:(NSRect)frameRect display:(BOOL)flag;
+- (void)sendGSEvent:(id)aGSEventRef;
+- (void)sendGSEvent:(id)aGSEventRef contentChange:(WKContentChange *)aContentChange;
+
+- (id)attachedSheet;
+
+- (BOOL)_needsToResetDragMargins;
+- (void)_setNeedsToResetDragMargins:(BOOL)flag;
+
+// Tiling support
+- (void)layoutTiles;
+- (void)layoutTilesNow;
+- (void)setNeedsDisplay;
+- (void)setNeedsDisplayInRect:(CGRect)rect;
+- (BOOL)tilesOpaque;
+- (void)setTilesOpaque:(BOOL)opaque;
+- (CGRect)visibleRect;
+- (void)removeAllNonVisibleTiles;
+- (void)removeAllTiles;
+- (void)setTilingMode:(WAKWindowTilingMode)mode;
+- (WAKWindowTilingMode)tilingMode;
+- (BOOL)hasPendingDraw;
+
+- (BOOL)useOrientationDependentFontAntialiasing;
+- (void)setUseOrientationDependentFontAntialiasing:(BOOL)aa;
++ (BOOL)hasLandscapeOrientation;
++ (void)setOrientationProvider:(id)provider;
+
+@end
+
+#endif
+
--- /dev/null
+//
+// WAKWindowPrivate.h
+//
+// Copyright (C) 2005, 2006, 2007, Apple Inc. All rights reserved.
+//
+#import "WAKWindow.h"
+
+@interface WAKWindow (WAKPrivate)
++ (WAKWindow *)_wrapperForWindowRef:(WKWindowRef)_windowRef;
+@end
+
--- /dev/null
+/*
+ * WKClipView.h
+ * WebCore
+ *
+ * Copyright (C) 2005, 2006, 2007, Apple Inc. All rights reserved.
+ *
+ */
+#import "WKView.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct WKClipView {
+ struct WKView view;
+ WKViewRef documentView;
+ unsigned int copiesOnScroll:1;
+};
+
+extern WKClassInfo WKClipViewClassInfo;
+
+WKClipViewRef WKClipViewCreateWithFrame (CGRect rect, WKViewContext *context);
+void WKClipViewInitialize (WKClipViewRef view);
+
+WKViewRef WKClipViewGetDocumentView (WKClipViewRef view);
+void WKClipViewSetDocumentView (WKClipViewRef view, WKViewRef documentView);
+
+bool WKClipViewCopiesOnScroll (WKClipViewRef view);
+void WKClipViewSetCopiesOnScroll (WKClipViewRef view, bool flag);
+
+CGRect WKClipViewGetDocumentVisibleRect (WKClipViewRef view);
+
+#ifdef __cplusplus
+}
+#endif
--- /dev/null
+/*
+ * WKContentObservation.h
+ * WebCore
+ *
+ * Copyright (C) 2007, 2008, Apple Inc. All rights reserved.
+ *
+ */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum
+{
+ WKContentNoChange = 0,
+ WKContentVisibilityChange = 2,
+ WKContentIndeterminateChange = 1
+} WKContentChange;
+
+bool WKObservingContentChanges(void);
+bool WKObservingIndeterminateContentChanges(void);
+
+void WKStopObservingContentChanges(void);
+void WKBeginObservingContentChanges(bool allowsIntedeterminateChanges);
+
+WKContentChange WKObservedContentChange(void);
+void WKSetObservedContentChange(WKContentChange aChange);
+
+int WebThreadCountOfObservedContentModifiers(void);
+void WebThreadClearObservedContentModifiers(void);
+
+bool WebThreadContainsObservedContentModifier(void * aContentModifier);
+void WebThreadAddObservedContentModifier(void * aContentModifier);
+void WebThreadRemoveObservedContentModifier(void * aContentModifier);
+
+#ifdef __cplusplus
+}
+#endif
+
--- /dev/null
+//
+// WKGraphics.h
+//
+// Copyright (C) 2005, 2006, 2007, Apple Inc. All rights reserved.
+//
+#import <CoreGraphics/CoreGraphics.h>
+#import <CoreGraphics/CoreGraphicsPrivate.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+ WKNonZeroWindingRule = 0,
+ WKEvenOddWindingRule = 1
+} WKWindingRule;
+
+CGContextRef WKGetCurrentGraphicsContext(void);
+void WKSetCurrentGraphicsContext(CGContextRef context);
+
+void WKDrawFramedRect (CGContextRef context, CGRect aRect);
+void WKDrawFramedRectWithWidthUsingOperation (CGContextRef context, CGRect aRect, float frameWidth, CGCompositeOperation op);
+void WKRectFill (CGContextRef context, CGRect aRect);
+void WKRectFillList (CGContextRef context, const CGRect *rects, int count);
+void WKRectFillUsingOperation (CGContextRef context, CGRect aRect, CGCompositeOperation op);
+void WKRectFillListUsingOperation (CGContextRef context, const CGRect *rects, int count, CGCompositeOperation op);
+CGImageRef WKGraphicsCreateImageFromBundleWithName (const char *image_file);
+CGPatternRef WKCreatePatternFromCGImage(CGImageRef imageRef);
+void WKSetPattern(CGContextRef context, CGPatternRef pattern, bool fill, bool stroke);
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef __cplusplus
+class WKFontAntialiasingStateSaver
+{
+public:
+
+ WKFontAntialiasingStateSaver(bool useOrientationDependentFontAntialiasing)
+ : m_useOrientationDependentFontAntialiasing(useOrientationDependentFontAntialiasing)
+ {
+ }
+
+ void setup(bool isLandscapeOrientation);
+ void restore();
+
+private:
+
+ bool m_useOrientationDependentFontAntialiasing;
+ bool m_oldShouldUseFontSmoothing;
+ CGFontAntialiasingStyle m_oldAntialiasingStyle;
+};
+#endif
--- /dev/null
+//
+// WKGraphicsPrivate.h
+//
+// Copyright (C) 2005, 2006, 2007, Apple Inc. All rights reserved.
+//
--- /dev/null
+//
+// WKScreen.h
+//
+// Copyright (C) 2005, 2006, 2007, Apple Inc. All rights reserved.
+//
+#import <CoreGraphics/CoreGraphics.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+CGRect WKScreenGetMainScreenFrame (void);
+CGRect WKScreenGetZeroScreenFrame (void);
+
+#ifdef __cplusplus
+}
+#endif
--- /dev/null
+/*
+ * WKScrollView.h
+ * WebCore
+ *
+ * Copyright (C) 2005, 2006, 2007, Apple Inc. All rights reserved.
+ *
+ */
+#import "WKView.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef bool (*WKScrollViewShouldScrollCallback)(WKScrollViewRef scrollView, CGPoint scrollPoint, void *userInfo);
+
+typedef struct _WKScrollViewContext {
+ WKViewContext viewContext;
+ WKScrollViewShouldScrollCallback shouldScrollCallback;
+ void *shouldScrollUserInfo;
+} WKScrollViewContext;
+
+struct WKScrollView {
+ struct WKView view;
+
+ WKScrollViewContext scrollContext;
+ WKClipViewRef contentView;
+
+ CGPoint mouseDownPoint;
+ CGPoint lastDraggedPoint;
+ unsigned int mouseDraggedStartedPan:1;
+};
+
+extern WKClassInfo WKScrollViewClassInfo;
+
+WKScrollViewRef WKScrollViewCreateWithFrame (CGRect rect);
+void WKScrollViewInitialize (WKScrollViewRef view);
+
+WKClipViewRef WKScrollViewGetContentView (WKScrollViewRef view);
+void WKScrollViewSetContentView (WKScrollViewRef view, WKClipViewRef contentView);
+
+WKViewRef WKScrollViewGetDocumentView (WKScrollViewRef view);
+void WKScrollViewSetDocumentView (WKScrollViewRef view, WKViewRef documentView);
+
+void WKScrollViewTile (WKScrollViewRef view);
+
+void WKScrollViewAdjustScrollers (WKScrollViewRef view);
+
+bool WKScrollViewScrollToPoint(WKScrollViewRef view, CGPoint point);
+
+#ifdef __cplusplus
+}
+#endif
--- /dev/null
+//
+// WKTypes.h
+//
+// Copyright (C) 2005, 2006, 2007, Apple Inc. All rights reserved.
+//
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _WKObject WKObject;
+typedef struct _WKObject *WKObjectRef;
+typedef struct WKControl* WKControlRef;
+typedef struct WKClipView* WKClipViewRef;
+typedef struct WKScrollView* WKScrollViewRef;
+typedef struct WKWindow* WKWindowRef;
+typedef struct WKView* WKViewRef;
+
+#ifdef __cplusplus
+}
+#endif
--- /dev/null
+//
+// WKUtilities.h
+//
+// Copyright (C) 2005, 2006, 2007, Apple Inc. All rights reserved.
+//
+
+#import <CoreGraphics/CoreGraphics.h>
+
+#import "WKTypes.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern const CFArrayCallBacks WKCollectionArrayCallBacks;
+extern const CFSetCallBacks WKCollectionSetCallBacks;
+
+
+typedef void(*WKDeallocCallback)(WKObjectRef object);
+
+typedef struct _WKClassInfo WKClassInfo;
+
+struct _WKClassInfo
+{
+ const WKClassInfo *parent;
+ const char *name;
+ WKDeallocCallback dealloc;
+};
+
+extern WKClassInfo WKObjectClass;
+
+struct _WKObject
+{
+ unsigned referenceCount;
+ WKClassInfo *classInfo;
+};
+
+const void *WKCreateObjectWithSize (size_t size, WKClassInfo *info);
+const void *WKRetain(const void *object);
+void WKRelease(const void *object);
+
+const void *WKCollectionRetain (CFAllocatorRef allocator, const void *value);
+void WKCollectionRelease (CFAllocatorRef allocator, const void *value);
+
+void WKReportError(const char *file, int line, const char *function, const char *format, ...);
+#define WKError(formatAndArgs...) WKReportError(__FILE__, __LINE__, __PRETTY_FUNCTION__, formatAndArgs)
+
+CFIndex WKArrayIndexOfValue (CFArrayRef array, const void *value);
+
+WKClassInfo *WKGetClassInfo (WKObjectRef object);
+
+#ifdef __cplusplus
+}
+#endif
--- /dev/null
+//
+// WKView.h
+//
+// Copyright (C) 2005, 2006, 2007, 2008, Apple Inc. All rights reserved.
+//
+
+#import <CoreGraphics/CoreGraphics.h>
+#import <CoreGraphics/CGSRegion.h>
+#import <GraphicsServices/GSEvent.h>
+#import "WKUtilities.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+ NSViewNotSizable = 0,
+ NSViewMinXMargin = 1,
+ NSViewWidthSizable = 2,
+ NSViewMaxXMargin = 4,
+ NSViewMinYMargin = 8,
+ NSViewHeightSizable = 16,
+ NSViewMaxYMargin = 32
+};
+
+typedef enum {
+ WKViewNotificationViewDidMoveToWindow,
+ WKViewNotificationViewFrameSizeChanged,
+ WKViewNotificationViewDidScroll
+} WKViewNotificationType;
+
+typedef enum {
+ WKViewResponderAcceptsFirstResponder,
+ WKViewResponderBecomeFirstResponder,
+ WKViewResponderResignFirstResponder,
+} WKViewResponderCallbackType;
+
+typedef void (*WKViewDrawCallback)(WKViewRef view, CGRect dirtyRect, void *userInfo);
+typedef bool (*WKViewEventCallback)(WKViewRef view, GSEventRef event, void *userInfo);
+typedef void (*WKViewNotificationCallback)(WKViewRef view, WKViewNotificationType type, void *userInfo);
+typedef void (*WKViewLayoutCallback)(WKViewRef view, void *userInfo, bool force);
+typedef bool (*WKViewResponderCallback)(WKViewRef view, WKViewResponderCallbackType type, void *userInfo);
+typedef WKViewRef (*WKViewHitTestCallback)(WKViewRef view, CGPoint point, void *userInfo);
+typedef void (*WKViewWillRemoveSubviewCallback)(WKViewRef view, WKViewRef subview);
+typedef void (*WKViewInvalidateGStateCallback)(WKViewRef view);
+
+typedef struct _WKViewContext {
+ WKViewDrawCallback drawCallback;
+ void *drawUserInfo;
+ WKViewEventCallback eventCallback;
+ void *eventUserInfo;
+ WKViewNotificationCallback notificationCallback;
+ void *notificationUserInfo;
+ WKViewLayoutCallback layoutCallback;
+ void *layoutUserInfo;
+ WKViewResponderCallback responderCallback;
+ void *responderUserInfo;
+ WKViewHitTestCallback hitTestCallback;
+ void *hitTestUserInfo;
+ WKViewWillRemoveSubviewCallback willRemoveSubviewCallback;
+ WKViewInvalidateGStateCallback invalidateGStateCallback;
+} WKViewContext;
+
+struct WKView {
+ WKObject isa;
+
+ WKViewContext *context;
+
+ WKWindowRef window;
+
+ WKViewRef superview;
+ CFMutableArrayRef subviews;
+
+ CGPoint origin;
+ CGRect bounds;
+
+ unsigned int isHidden:1;
+
+ unsigned int autoresizingMask;
+
+ float scale;
+
+ bool drawsOwnDescendants;
+};
+
+WKViewRef WKViewGetFocusView (void);
+
+extern WKClassInfo WKViewClassInfo;
+
+WKViewRef WKViewCreateWithFrame (CGRect rect, WKViewContext *context);
+void WKViewInitialize (WKViewRef view, CGRect rect, WKViewContext *context);
+
+void WKViewSetViewContext (WKViewRef view, WKViewContext *context);
+void WKViewGetViewContext (WKViewRef view, WKViewContext *context);
+
+CGRect WKViewGetBounds (WKViewRef view);
+
+void WKViewSetFrameOrigin (WKViewRef view, CGPoint newPoint);
+void WKViewSetFrameSize (WKViewRef view, CGSize newSize);
+void WKViewSetBoundsSize (WKViewRef view, CGSize newSize);
+
+CGRect WKViewGetFrame (WKViewRef view);
+
+void WKViewSetScale (WKViewRef view, float scale);
+float WKViewGetScale (WKViewRef view);
+
+WKWindowRef WKViewGetWindow (WKViewRef view);
+
+CFArrayRef WKViewGetSubviews (WKViewRef view);
+
+WKViewRef WKViewGetSuperview (WKViewRef view);
+
+void WKViewAddSubview (WKViewRef view, WKViewRef subview);
+void WKViewRemoveFromSuperview (WKViewRef view);
+
+void WKViewSetNeedsDisplay (WKViewRef view);
+void WKViewSetNeedsDisplayInRect (WKViewRef view, CGRect invalidRect);
+void WKViewDisplay (WKViewRef view);
+void WKViewDisplayRect (WKViewRef view, CGRect rectToDraw);
+
+void WKViewLockFocus (WKViewRef view);
+void WKViewUnlockFocus (WKViewRef view);
+
+bool WKViewGetIsHidden (WKViewRef view);
+void WKViewSetIsHidden (WKViewRef view, bool flag);
+
+CGPoint WKViewConvertPointToSuperview (WKViewRef view, CGPoint aPoint);
+CGPoint WKViewConvertPointFromSuperview (WKViewRef view, CGPoint aPoint);
+CGPoint WKViewConvertPointToBase(WKViewRef view, CGPoint aPoint);
+CGPoint WKViewConvertPointFromBase(WKViewRef view, CGPoint aPoint);
+
+CGRect WKViewConvertRectToSuperview (WKViewRef view, CGRect aRect);
+CGRect WKViewConvertRectFromSuperview (WKViewRef view, CGRect aRect);
+CGRect WKViewConvertRectToBase (WKViewRef view, CGRect r);
+CGRect WKViewConvertRectFromBase (WKViewRef view, CGRect aRect);
+
+CGRect WKViewGetVisibleRect (WKViewRef view);
+
+WKViewRef WKViewFirstChild (WKViewRef view);
+WKViewRef WKViewNextSibling (WKViewRef view);
+WKViewRef WKViewTraverseNext (WKViewRef view);
+
+bool WKViewAcceptsFirstResponder (WKViewRef view);
+bool WKViewBecomeFirstResponder (WKViewRef view);
+bool WKViewResignFirstResponder (WKViewRef view);
+
+unsigned int WKViewGetAutoresizingMask(WKViewRef view);
+void WKViewSetAutoresizingMask (WKViewRef view, unsigned int mask);
+
+WKViewRef WKViewHitTest(WKViewRef view, CGPoint superviewPoint);
+void WKViewScrollToPoint(WKViewRef view, CGPoint point);
+void WKViewScrollToRect(WKViewRef view, CGRect rect);
+
+void WKViewLayout(WKViewRef view, bool force);
+
+CGImageRef WKViewCreateImage(WKViewRef view);
+
+#ifdef __cplusplus
+}
+#endif
+
--- /dev/null
+//
+// WKViewPrivate.h
+//
+// Copyright (C) 2005, 2006, 2007, Apple Inc. All rights reserved.
+//
+
+#import "WKView.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _WKViewSetWindow (WKViewRef view, WKWindowRef window);
+void _WKViewSetSuperview (WKViewRef view, WKViewRef superview);
+void _WKViewWillRemoveSubview(WKViewRef view, WKViewRef subview);
+WKViewRef _WKViewBaseView (WKViewRef view);
+WKViewRef _WKViewHitTest(WKViewRef view, CGPoint point);
+bool _WKViewHandleEvent (WKViewRef view, GSEventRef event);
+void _WKViewAutoresize(WKViewRef view, const CGRect *oldSuperFrame, const CGRect *newSuperFrame);
+WKScrollViewRef _WKViewParentScrollView(WKViewRef view);
+void _WKViewAdjustScrollers(WKViewRef view);
+void _WKViewDraw(CGContextRef context, WKViewRef view, CGRect dirtyRect, bool onlyDrawVisibleRect);
+void _WKViewSetViewContext (WKViewRef view, WKViewContext *context);
+
+#ifdef __cplusplus
+}
+#endif
--- /dev/null
+//
+// WKWindow.h
+//
+// Copyright (C) 2005, 2006, 2007, 2008, Apple Inc. All rights reserved.
+//
+#ifndef WKWindow_h
+#define WKWindow_h
+
+#import <CoreGraphics/CoreGraphics.h>
+#import <CoreGraphics/CGSTypes.h>
+#import <GraphicsServices/GSEvent.h>
+
+#import "WebCoreThread.h"
+#import "WKTypes.h"
+#import "WKUtilities.h"
+
+#ifdef __cplusplus
+namespace WebCore {
+ class TiledSurface;
+}
+typedef WebCore::TiledSurface TiledSurface;
+#else
+typedef struct TiledSurface TiledSurface;
+#endif
+
+#ifdef __OBJC__
+@class WAKWindow;
+#else
+typedef struct WAKWindow WAKWindow;
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct WKWindow {
+ WKObject obj;
+ WAKWindow* wakWindow;
+ CGRect frame;
+ WKViewRef contentView;
+ WKViewRef responderView;
+ TiledSurface* tiledSurface;
+ unsigned int useOrientationDependentFontAntialiasing:1;
+ unsigned int isOffscreen:1;
+};
+
+extern WKClassInfo WKWindowClassInfo;
+
+WKWindowRef WKWindowCreate(WAKWindow* wakWindow, CGRect contentRect);
+
+void WKWindowSetContentView (WKWindowRef window, WKViewRef aView);
+WKViewRef WKWindowGetContentView (WKWindowRef window);
+
+void WKWindowSetContentRect(WKWindowRef window, CGRect contentRect);
+CGRect WKWindowGetContentRect(WKWindowRef window);
+
+void WKWindowClose (WKWindowRef window);
+
+bool WKWindowMakeFirstResponder (WKWindowRef window, WKViewRef view);
+WKViewRef WKWindowFirstResponder (WKWindowRef window);
+void WKWindowSendEvent (WKWindowRef window, GSEventRef event);
+
+CGPoint WKWindowConvertBaseToScreen (WKWindowRef window, CGPoint point);
+CGPoint WKWindowConvertScreenToBase (WKWindowRef window, CGPoint point);
+
+void WKWindowSetFrame(WKWindowRef window, CGRect frame, bool display);
+
+GSEventRef WKEventGetCurrentEvent(void);
+
+void WKWindowPrepareForDrawing(WKWindowRef window);
+
+void WKWindowSetNeedsDisplay(WKWindowRef window, bool flag);
+void WKWindowSetNeedsDisplayInRect(WKWindowRef window, CGRect rect);
+
+void WKWindowDrawRect(WKWindowRef window, CGRect dirtyRect);
+
+void WKWindowSetOffscreen(WKWindowRef window, bool flag);
+
+void WKWindowSetTiledSurface(WKWindowRef window, TiledSurface*);
+TiledSurface* WKWindowGetTiledSurface(WKWindowRef window);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+//
+// WKWindowPrivate.h
+//
+// Copyright (C) 2005, 2006, 2007, Apple Inc. All rights reserved.
+//
+
+#import "WKWindow.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+bool _WKWindowHaveDirtyWindows(void);
+void _WKWindowLayoutDirtyWindows(void);
+void _WKWindowDrawDirtyWindows(void);
+
+#ifdef __cplusplus
+}
+#endif
--- /dev/null
+/*
+ * WebCoreTelephoneParser.h
+ * WebCore
+ *
+ * Copyright (C) 2007, 2008, Apple Inc. All rights reserved.
+ *
+ */
+
+#include "string.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ method: WebCoreFindTelephoneNumber(UniChar [], unsigned *, int *, int *)
+ description: parses string looking for a phone number
+ in string: Array of UniChars to parse
+ in len: Number of characters in 'string'
+ out startPos: index of first charcater in phone number, -1 if not found
+ out endPos: index of last character in phone number, -1 if not found.
+ */
+void WebCoreFindTelephoneNumber(const UniChar string[], unsigned len, int *startPos, int *endPos);
+
+#ifdef __cplusplus
+}
+#endif
--- /dev/null
+/*
+ * WebCoreThread.h
+ * WebCore
+ *
+ * Copyright (C) 2006, 2007, Apple Inc. All rights reserved.
+ *
+ */
+
+#import <GraphicsServices/GSEvent.h>
+
+#ifndef WebCoreThread_h
+#define WebCoreThread_h
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+typedef struct {
+ CGContextRef currentCGContext;
+} WebThreadContext;
+
+extern bool webThreadShouldYield;
+
+// The lock is automatically freed at the bottom of the runloop. No need to unlock.
+// Note that calling this function may hang your UI for several seconds. Don't use
+// unless you have to.
+void WebThreadLock(void);
+
+// This is a no-op for compatibility only. It will go away. Please don't use.
+void WebThreadUnlock(void);
+
+// Please don't use anything below this line unless you know what you are doing. If unsure, ask.
+// ---------------------------------------------------------------------------------------------
+bool WebTryThreadLock(void);
+bool WebThreadIsLocked(void);
+bool WebThreadIsLockedOrDisabled(void);
+
+void WebThreadLockPushModal(void);
+void WebThreadLockPopModal(void);
+
+void WebThreadEnable(void);
+bool WebThreadIsEnabled(void);
+bool WebThreadIsCurrent(void);
+bool WebThreadNotCurrent(void);
+
+// These are for <rdar://problem/6817341> Many apps crashing calling -[UIFieldEditor text] in secondary thread
+// Don't use them to solve any random problems you might have.
+void WebThreadLockFromAnyThread();
+void WebThreadUnlockFromAnyThread();
+
+static inline bool WebThreadShouldYield(void) { return webThreadShouldYield; }
+static inline void WebThreadSetShouldYield() { webThreadShouldYield = true; }
+
+CFRunLoopRef WebThreadRunLoop(void);
+WebThreadContext *WebThreadCurrentContext(void);
+bool WebThreadContextIsCurrent(void);
+
+void WebThreadPrepareForDrawing(void);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif // WebCoreThread_h
--- /dev/null
+/*
+ * WebCoreThreadMessage.h
+ * WebCore
+ *
+ * Copyright (C) 2006, 2007, 2008, Apple Inc. All rights reserved.
+ *
+ */
+
+#import <Foundation/Foundation.h>
+
+#ifdef __OBJC__
+#import <WebCore/WebCoreThread.h>
+#endif // __OBJC__
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+//
+// Release an object on the main thread.
+//
+@interface NSObject(WebCoreThreadAdditions)
+- (void)releaseOnMainThread;
+@end
+
+// Register a class for deallocation on the WebThread
+void WebCoreObjCDeallocOnWebThread(Class cls);
+
+// Asynchronous from main thread to web thread.
+void WebThreadCallAPI(NSInvocation *invocation);
+void WebThreadAdoptAndRelease(id obj);
+
+// Synchronous from web thread to main thread, or main thread to main thread.
+void WebThreadCallDelegate(NSInvocation *invocation);
+void WebThreadPostNotification(NSString *name, id object, id userInfo);
+
+// Asynchronous from web thread to main thread, but synchronous when called on the main thread.
+void WebThreadCallDelegateAsync(NSInvocation *invocation);
+void WebThreadPostNotificationAsync(NSString *name, id object, id userInfo);
+
+// Convenience method for creating an NSInvocation object
+NSInvocation *WebThreadCreateNSInvocation(id target, SEL selector);
+
+#if defined(__cplusplus)
+}
+#endif
--- /dev/null
+/*
+ * WebCoreThreadSafe.h
+ * WebCore
+ *
+ * Copyright (C) 2006, 2007, Apple Inc. All rights reserved.
+ *
+ */
+
+#import <Foundation/Foundation.h>
+#import <GraphicsServices/GraphicsServices.h>
+
+// Listing of methods that are currently thread-safe.
+
+@interface WAKView : NSObject
+@end
+
+@interface WebView : WAKView
+- (void)reload:(id)sender;
+- (void)stopLoading:(id)sender;
+- (BOOL)canGoBack;
+- (void)goBack;
+- (BOOL)canGoForward;
+- (void)goForward;
+@end
+
+@interface WebFrame : NSObject
+- (void)loadRequest:(NSURLRequest *)request;
+@end
+
+@interface WAKResponder : NSObject
+@end
+
+@interface WAKWindow : WAKResponder
+- (void)sendGSEvent:(GSEventRef)event;
+@end
+
+@protocol WebPolicyDecisionListener <NSObject>
+- (void)use;
+@end
+
+@interface WebScriptObject : NSObject
+@end
+
+@interface DOMObject : WebScriptObject
+@end
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebKitAnimationEvent_h
+#define WebKitAnimationEvent_h
+
+#include "Event.h"
+
+namespace WebCore {
+
+ class WebKitAnimationEvent : public Event {
+ public:
+ static PassRefPtr<WebKitAnimationEvent> create()
+ {
+ return adoptRef(new WebKitAnimationEvent);
+ }
+ static PassRefPtr<WebKitAnimationEvent> create(const AtomicString& type, const String& animationName, double elapsedTime)
+ {
+ return adoptRef(new WebKitAnimationEvent(type, animationName, elapsedTime));
+ }
+
+ virtual ~WebKitAnimationEvent();
+
+ void initWebKitAnimationEvent(const AtomicString& type,
+ bool canBubbleArg,
+ bool cancelableArg,
+ const String& animationName,
+ double elapsedTime);
+
+ const String& animationName() const;
+ double elapsedTime() const;
+
+ virtual bool isWebKitAnimationEvent() const { return true; }
+
+ private:
+ WebKitAnimationEvent();
+ WebKitAnimationEvent(const AtomicString& type, const String& animationName, double elapsedTime);
+
+ String m_animationName;
+ double m_elapsedTime;
+ };
+
+} // namespace WebCore
+
+#endif // WebKitAnimationEvent_h
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebKitCSSKeyframeRule_h
+#define WebKitCSSKeyframeRule_h
+
+#include "CSSRule.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class CSSMutableStyleDeclaration;
+
+typedef int ExceptionCode;
+
+class WebKitCSSKeyframeRule : public CSSRule {
+public:
+ static PassRefPtr<WebKitCSSKeyframeRule> create()
+ {
+ return adoptRef(new WebKitCSSKeyframeRule(0));
+ }
+ static PassRefPtr<WebKitCSSKeyframeRule> create(CSSStyleSheet* parent)
+ {
+ return adoptRef(new WebKitCSSKeyframeRule(parent));
+ }
+
+ virtual ~WebKitCSSKeyframeRule();
+
+ virtual bool isKeyframeRule() { return true; }
+
+ // Inherited from CSSRule
+ virtual unsigned short type() const { return WEBKIT_KEYFRAME_RULE; }
+
+ String keyText() const { return m_key; }
+ void setKeyText(const String& s) { m_key = s; }
+
+ void getKeys(Vector<float>& keys) const { parseKeyString(m_key, keys); }
+
+ CSSMutableStyleDeclaration* style() const { return m_style.get(); }
+
+ virtual String cssText() const;
+
+ // Not part of the CSSOM
+ virtual bool parseString(const String&, bool = false);
+
+ void setDeclaration(PassRefPtr<CSSMutableStyleDeclaration>);
+
+ CSSMutableStyleDeclaration* declaration() { return m_style.get(); }
+ const CSSMutableStyleDeclaration* declaration() const { return m_style.get(); }
+
+private:
+ static void parseKeyString(const String& s, Vector<float>& keys);
+
+ WebKitCSSKeyframeRule(CSSStyleSheet* parent);
+
+ RefPtr<CSSMutableStyleDeclaration> m_style;
+ String m_key; // comma separated list of keys
+};
+
+} // namespace WebCore
+
+#endif // WebKitCSSKeyframeRule_h
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebKitCSSKeyframesRule_h
+#define WebKitCSSKeyframesRule_h
+
+#include "CSSRule.h"
+#include <wtf/RefPtr.h>
+#include "AtomicString.h"
+
+namespace WebCore {
+
+class CSSRuleList;
+class WebKitCSSKeyframeRule;
+class String;
+
+typedef int ExceptionCode;
+
+class WebKitCSSKeyframesRule : public CSSRule {
+public:
+ static PassRefPtr<WebKitCSSKeyframesRule> create()
+ {
+ return adoptRef(new WebKitCSSKeyframesRule(0));
+ }
+ static PassRefPtr<WebKitCSSKeyframesRule> create(CSSStyleSheet* parent)
+ {
+ return adoptRef(new WebKitCSSKeyframesRule(parent));
+ }
+
+ ~WebKitCSSKeyframesRule();
+
+ virtual bool isKeyframesRule() { return true; }
+
+ // Inherited from CSSRule
+ virtual unsigned short type() const { return WEBKIT_KEYFRAMES_RULE; }
+
+ String name() const;
+ void setName(const String&);
+
+ // This version of setName does not call styleSheetChanged to avoid
+ // unnecessary work. It assumes callers will either make that call
+ // themselves, or know that it will get called later.
+ void setNameInternal(const String& name)
+ {
+ m_name = name;
+ }
+
+ CSSRuleList* cssRules() { return m_lstCSSRules.get(); }
+
+ void insertRule(const String& rule);
+ void deleteRule(const String& key);
+ WebKitCSSKeyframeRule* findRule(const String& key);
+
+ virtual String cssText() const;
+
+ /* not part of the DOM */
+ unsigned length() const;
+ WebKitCSSKeyframeRule* item(unsigned index);
+ const WebKitCSSKeyframeRule* item(unsigned index) const;
+ void append(WebKitCSSKeyframeRule* rule);
+
+private:
+ WebKitCSSKeyframesRule(CSSStyleSheet* parent);
+
+ int findRuleIndex(const String& key) const;
+
+ RefPtr<CSSRuleList> m_lstCSSRules;
+ AtomicString m_name;
+};
+
+} // namespace WebCore
+
+#endif // WebKitCSSKeyframesRule_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebKitCSSMatrix_h
+#define WebKitCSSMatrix_h
+
+#include "ExceptionCode.h"
+#include "PlatformString.h"
+#include "StyleBase.h"
+#include "TransformationMatrix.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class WebKitCSSMatrix : public StyleBase {
+public:
+ static PassRefPtr<WebKitCSSMatrix> create()
+ {
+ return adoptRef(new WebKitCSSMatrix());
+ }
+ static PassRefPtr<WebKitCSSMatrix> create(const WebKitCSSMatrix& m)
+ {
+ return adoptRef(new WebKitCSSMatrix(m));
+ }
+ static PassRefPtr<WebKitCSSMatrix> create(const TransformationMatrix& m)
+ {
+ return adoptRef(new WebKitCSSMatrix(m));
+ }
+ static PassRefPtr<WebKitCSSMatrix> create(const String& s, ExceptionCode& ec)
+ {
+ return adoptRef(new WebKitCSSMatrix(s, ec));
+ }
+
+ virtual ~WebKitCSSMatrix();
+
+ double a() const { return m_matrix.a(); }
+ double b() const { return m_matrix.b(); }
+ double c() const { return m_matrix.c(); }
+ double d() const { return m_matrix.d(); }
+ double e() const { return m_matrix.e(); }
+ double f() const { return m_matrix.f(); }
+
+ void setA(double f) { m_matrix.setA(f); }
+ void setB(double f) { m_matrix.setB(f); }
+ void setC(double f) { m_matrix.setC(f); }
+ void setD(double f) { m_matrix.setD(f); }
+ void setE(double f) { m_matrix.setE(f); }
+ void setF(double f) { m_matrix.setF(f); }
+
+ double m11() const { return m_matrix.m11(); }
+ double m12() const { return m_matrix.m12(); }
+ double m13() const { return m_matrix.m13(); }
+ double m14() const { return m_matrix.m14(); }
+ double m21() const { return m_matrix.m21(); }
+ double m22() const { return m_matrix.m22(); }
+ double m23() const { return m_matrix.m23(); }
+ double m24() const { return m_matrix.m24(); }
+ double m31() const { return m_matrix.m31(); }
+ double m32() const { return m_matrix.m32(); }
+ double m33() const { return m_matrix.m33(); }
+ double m34() const { return m_matrix.m34(); }
+ double m41() const { return m_matrix.m41(); }
+ double m42() const { return m_matrix.m42(); }
+ double m43() const { return m_matrix.m43(); }
+ double m44() const { return m_matrix.m44(); }
+
+ void setM11(double f) { m_matrix.setM11(f); }
+ void setM12(double f) { m_matrix.setM12(f); }
+ void setM13(double f) { m_matrix.setM13(f); }
+ void setM14(double f) { m_matrix.setM14(f); }
+ void setM21(double f) { m_matrix.setM21(f); }
+ void setM22(double f) { m_matrix.setM22(f); }
+ void setM23(double f) { m_matrix.setM23(f); }
+ void setM24(double f) { m_matrix.setM24(f); }
+ void setM31(double f) { m_matrix.setM31(f); }
+ void setM32(double f) { m_matrix.setM32(f); }
+ void setM33(double f) { m_matrix.setM33(f); }
+ void setM34(double f) { m_matrix.setM34(f); }
+ void setM41(double f) { m_matrix.setM41(f); }
+ void setM42(double f) { m_matrix.setM42(f); }
+ void setM43(double f) { m_matrix.setM43(f); }
+ void setM44(double f) { m_matrix.setM44(f); }
+
+ void setMatrixValue(const String& string, ExceptionCode&);
+
+ // The following math function return a new matrix with the
+ // specified operation applied. The this value is not modified.
+
+ // Multiply this matrix by secondMatrix, on the right (result = this * secondMatrix)
+ PassRefPtr<WebKitCSSMatrix> multiply(WebKitCSSMatrix* secondMatrix) const;
+
+ // Return the inverse of this matrix. Throw an exception if the matrix is not invertible
+ PassRefPtr<WebKitCSSMatrix> inverse(ExceptionCode&) const;
+
+ // Return this matrix translated by the passed values.
+ // Passing a NaN will use a value of 0. This allows the 3D form to used for 2D operations
+ // Operation is performed as though the this matrix is multiplied by a matrix with
+ // the translation values on the left (result = translation(x,y,z) * this)
+ PassRefPtr<WebKitCSSMatrix> translate(double x, double y, double z) const;
+
+ // Returns this matrix scaled by the passed values.
+ // Passing scaleX or scaleZ as NaN uses a value of 1, but passing scaleY of NaN
+ // makes it the same as scaleX. This allows the 3D form to used for 2D operations
+ // Operation is performed as though the this matrix is multiplied by a matrix with
+ // the scale values on the left (result = scale(x,y,z) * this)
+ PassRefPtr<WebKitCSSMatrix> scale(double scaleX, double scaleY, double scaleZ) const;
+
+ // Returns this matrix rotated by the passed values.
+ // If rotY and rotZ are NaN, rotate about Z (rotX=0, rotateY=0, rotateZ=rotX).
+ // Otherwise use a rotation value of 0 for any passed NaN.
+ // Operation is performed as though the this matrix is multiplied by a matrix with
+ // the rotation values on the left (result = rotation(x,y,z) * this)
+ PassRefPtr<WebKitCSSMatrix> rotate(double rotX, double rotY, double rotZ) const;
+
+ // Returns this matrix rotated about the passed axis by the passed angle.
+ // Passing a NaN will use a value of 0. If the axis is (0,0,0) use a value
+ // Operation is performed as though the this matrix is multiplied by a matrix with
+ // the rotation values on the left (result = rotation(x,y,z,angle) * this)
+ PassRefPtr<WebKitCSSMatrix> rotateAxisAngle(double x, double y, double z, double angle) const;
+
+ const TransformationMatrix& transform() const { return m_matrix; }
+
+ String toString() const;
+
+protected:
+ WebKitCSSMatrix();
+ WebKitCSSMatrix(const WebKitCSSMatrix&);
+ WebKitCSSMatrix(const TransformationMatrix&);
+ WebKitCSSMatrix(const String&, ExceptionCode& );
+
+ TransformationMatrix m_matrix;
+};
+
+} // namespace WebCore
+
+#endif // WebKitCSSMatrix_h
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebKitCSSTransformValue_h
+#define WebKitCSSTransformValue_h
+
+#include "CSSValueList.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class WebKitCSSTransformValue : public CSSValueList {
+public:
+ // NOTE: these have to match the values in the IDL
+ enum TransformOperationType {
+ UnknownTransformOperation,
+ TranslateTransformOperation,
+ TranslateXTransformOperation,
+ TranslateYTransformOperation,
+ RotateTransformOperation,
+ ScaleTransformOperation,
+ ScaleXTransformOperation,
+ ScaleYTransformOperation,
+ SkewTransformOperation,
+ SkewXTransformOperation,
+ SkewYTransformOperation,
+ MatrixTransformOperation,
+ TranslateZTransformOperation,
+ Translate3DTransformOperation,
+ RotateXTransformOperation,
+ RotateYTransformOperation,
+ RotateZTransformOperation,
+ Rotate3DTransformOperation,
+ ScaleZTransformOperation,
+ Scale3DTransformOperation,
+ PerspectiveTransformOperation,
+ Matrix3DTransformOperation
+ };
+
+ static PassRefPtr<WebKitCSSTransformValue> create(TransformOperationType type)
+ {
+ return adoptRef(new WebKitCSSTransformValue(type));
+ }
+
+ virtual ~WebKitCSSTransformValue();
+
+ virtual String cssText() const;
+
+ TransformOperationType operationType() const { return m_type; }
+
+private:
+ WebKitCSSTransformValue(TransformOperationType);
+
+ virtual bool isWebKitCSSTransformValue() const { return true; }
+
+ TransformOperationType m_type;
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebKitPoint_h
+#define WebKitPoint_h
+
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+ class WebKitPoint : public RefCounted<WebKitPoint> {
+ public:
+
+ static PassRefPtr<WebKitPoint> create()
+ {
+ return adoptRef(new WebKitPoint());
+ }
+ static PassRefPtr<WebKitPoint> create(float x, float y)
+ {
+ return adoptRef(new WebKitPoint(x, y));
+ }
+
+ float x() const { return m_x; }
+ float y() const { return m_y; }
+
+ void setX(float x) { m_x = x; }
+ void setY(float y) { m_y = y; }
+
+ private:
+ WebKitPoint(float x=0, float y=0)
+ : m_x(x)
+ , m_y(y)
+ {
+ }
+
+ float m_x, m_y;
+ };
+
+} // namespace WebCore
+
+#endif // WebKitPoint_h
--- /dev/null
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebKitTransitionEvent_h
+#define WebKitTransitionEvent_h
+
+#include "Event.h"
+
+namespace WebCore {
+
+ class WebKitTransitionEvent : public Event {
+ public:
+ static PassRefPtr<WebKitTransitionEvent> create()
+ {
+ return adoptRef(new WebKitTransitionEvent);
+ }
+ static PassRefPtr<WebKitTransitionEvent> create(const AtomicString& type, const String& animationName, double elapsedTime)
+ {
+ return adoptRef(new WebKitTransitionEvent(type, animationName, elapsedTime));
+ }
+
+ virtual ~WebKitTransitionEvent();
+
+ void initWebKitTransitionEvent(const AtomicString& type,
+ bool canBubbleArg,
+ bool cancelableArg,
+ const String& propertyName,
+ double elapsedTime);
+
+ const String& propertyName() const;
+ double elapsedTime() const;
+
+ virtual bool isWebKitTransitionEvent() const { return true; }
+
+ private:
+ WebKitTransitionEvent();
+ WebKitTransitionEvent(const AtomicString& type, const String& propertyName, double elapsedTime);
+
+ String m_propertyName;
+ double m_elapsedTime;
+ };
+
+} // namespace WebCore
+
+#endif // WebKitTransitionEvent_h
--- /dev/null
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebLayer_h
+#define WebLayer_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#import <QuartzCore/QuartzCore.h>
+
+namespace WebCore {
+ class GraphicsLayer;
+}
+
+// Category implemented by WebLayer and WebTiledLayer.
+@interface CALayer(WebLayerAdditions)
+
+- (void)setLayerOwner:(WebCore::GraphicsLayer*)layer;
+- (WebCore::GraphicsLayer*)layerOwner;
+
+- (float)contentsScale;
+- (void)setContentsScale:(float)scale;
+
+@end
+
+@interface WebLayer : CALayer
+{
+ WebCore::GraphicsLayer* m_layerOwner;
+ float m_contentsScale;
+}
+
+// Class method allows us to share implementation across TiledLayerMac and WebLayer
++ (void)drawContents:(WebCore::GraphicsLayer*)layerContents ofLayer:(CALayer*)layer intoContext:(CGContextRef)context;
+
+@end
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif // WebLayer_h
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Foundation/Foundation.h>
+#import <JavaScriptCore/JSBase.h>
+#import <JavaScriptCore/WebKitAvailability.h>
+
+#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_1_3
+
+// NSObject (WebScripting) -----------------------------------------------------
+
+/*
+ Classes may implement one or more methods in WebScripting to export interfaces
+ to WebKit's JavaScript environment.
+
+ By default, no properties or functions are exported. A class must implement
+ +isKeyExcludedFromWebScript: and/or +isSelectorExcludedFromWebScript: to
+ expose selected properties and methods, respectively, to JavaScript.
+
+ Access to exported properties is done using KVC -- specifically, the following
+ KVC methods:
+
+ - (void)setValue:(id)value forKey:(NSString *)key
+ - (id)valueForKey:(NSString *)key
+
+ Clients may also intercept property set/get operations that are made by the
+ scripting environment for properties that are not exported. This is done using
+ the KVC methods:
+
+ - (void)setValue:(id)value forUndefinedKey:(NSString *)key
+ - (id)valueForUndefinedKey:(NSString *)key
+
+ Similarly, clients may intercept method invocations that are made by the
+ scripting environment for methods that are not exported. This is done using
+ the method:
+
+ - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args;
+
+ If clients need to raise an exception in the script environment
+ they can call [WebScriptObject throwException:]. Note that throwing an
+ exception using this method will only succeed if the method that throws the exception
+ is being called within the scope of a script invocation.
+
+ Not all methods are exposed. Only those methods whose parameters and return
+ type meets the export criteria are exposed. Valid types are Objective-C instances
+ and scalars. Other types are not allowed.
+
+ Types will be converted automatically between JavaScript and Objective-C in
+ the following manner:
+
+ JavaScript ObjC
+ ---------- ----------
+ null => nil
+ undefined => WebUndefined
+ number => NSNumber
+ boolean => CFBoolean
+ string => NSString
+ object => id
+
+ The object => id conversion occurs as follows: if the object wraps an underlying
+ Objective-C object (i.e., if it was created by a previous ObjC => JavaScript conversion),
+ then the underlying Objective-C object is returned. Otherwise, a new WebScriptObject
+ is created and returned.
+
+ The above conversions occur only if the declared ObjC type is an object type.
+ For primitive types like int and char, a numeric cast is performed.
+
+ ObjC JavaScript
+ ---- ----------
+ NSNull => null
+ nil => undefined
+ WebUndefined => undefined
+ CFBoolean => boolean
+ NSNumber => number
+ NSString => string
+ NSArray => array object
+ WebScriptObject => object
+
+ The above conversions occur only if the declared ObjC type is an object type.
+ For primitive type like int and char, a numeric cast is performed.
+*/
+@interface NSObject (WebScripting)
+
+/*!
+ @method webScriptNameForSelector:
+ @param selector The selector that will be exposed to the script environment.
+ @discussion Use the returned string as the exported name for the selector
+ in the script environment. It is the responsibility of the class to ensure
+ uniqueness of the returned name. If nil is returned or this
+ method is not implemented the default name for the selector will
+ be used. The default name concatenates the components of the
+ Objective-C selector name and replaces ':' with '_'. '_' characters
+ are escaped with an additional '$', i.e. '_' becomes "$_". '$' are
+ also escaped, i.e.
+ Objective-C name Default script name
+ moveTo:: move__
+ moveTo_ moveTo$_
+ moveTo$_ moveTo$$$_
+ @result Returns the name to be used to represent the specified selector in the
+ scripting environment.
+*/
++ (NSString *)webScriptNameForSelector:(SEL)selector;
+
+/*!
+ @method isSelectorExcludedFromWebScript:
+ @param selector The selector the will be exposed to the script environment.
+ @discussion Return NO to export the selector to the script environment.
+ Return YES to prevent the selector from being exported to the script environment.
+ If this method is not implemented on the class no selectors will be exported.
+ @result Returns YES to hide the selector, NO to export the selector.
+*/
++ (BOOL)isSelectorExcludedFromWebScript:(SEL)selector;
+
+/*!
+ @method webScriptNameForKey:
+ @param name The name of the instance variable that will be exposed to the
+ script environment. Only instance variables that meet the export criteria will
+ be exposed.
+ @discussion Provide an alternate name for a property.
+ @result Returns the name to be used to represent the specified property in the
+ scripting environment.
+*/
++ (NSString *)webScriptNameForKey:(const char *)name;
+
+/*!
+ @method isKeyExcludedFromWebScript:
+ @param name The name of the instance variable that will be exposed to the
+ script environment.
+ @discussion Return NO to export the property to the script environment.
+ Return YES to prevent the property from being exported to the script environment.
+ @result Returns YES to hide the property, NO to export the property.
+*/
++ (BOOL)isKeyExcludedFromWebScript:(const char *)name;
+
+/*!
+ @method invokeUndefinedMethodFromWebScript:withArguments:
+ @param name The name of the method to invoke.
+ @param arguments The arguments to pass the method.
+ @discussion If a script attempts to invoke a method that is not exported,
+ invokeUndefinedMethodFromWebScript:withArguments: will be called.
+ @result The return value of the invocation. The value will be converted as appropriate
+ for the script environment.
+*/
+- (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)arguments;
+
+/*!
+ @method invokeDefaultMethodWithArguments:
+ @param arguments The arguments to pass the method.
+ @discussion If a script attempts to call an exposed object as a function,
+ this method will be called.
+ @result The return value of the call. The value will be converted as appropriate
+ for the script environment.
+*/
+- (id)invokeDefaultMethodWithArguments:(NSArray *)arguments;
+
+/*!
+ @method finalizeForWebScript
+ @discussion finalizeForScript is called on objects exposed to the script
+ environment just before the script environment garbage collects the object.
+ Subsequently, any references to WebScriptObjects made by the exposed object will
+ be invalid and have undefined consequences.
+*/
+- (void)finalizeForWebScript;
+
+@end
+
+
+// WebScriptObject --------------------------------------------------
+
+@class WebScriptObjectPrivate;
+@class WebFrame;
+
+/*!
+ @class WebScriptObject
+ @discussion WebScriptObjects are used to wrap script objects passed from
+ script environments to Objective-C. WebScriptObjects cannot be created
+ directly. In normal uses of WebKit, you gain access to the script
+ environment using the "windowScriptObject" method on WebView.
+
+ The following KVC methods are commonly used to access properties of the
+ WebScriptObject:
+
+ - (void)setValue:(id)value forKey:(NSString *)key
+ - (id)valueForKey:(NSString *)key
+
+ As it possible to remove attributes from web script objects, the following
+ additional method augments the basic KVC methods:
+
+ - (void)removeWebScriptKey:(NSString *)name;
+
+ Also, since the sparse array access allowed in script objects doesn't map well
+ to NSArray, the following methods can be used to access index based properties:
+
+ - (id)webScriptValueAtIndex:(unsigned)index;
+ - (void)setWebScriptValueAtIndex:(unsigned)index value:(id)value;
+*/
+@interface WebScriptObject : NSObject
+{
+ WebScriptObjectPrivate *_private;
+}
+
+/*!
+ @method throwException:
+ @discussion Throws an exception in the current script execution context.
+ @result Either NO if an exception could not be raised, YES otherwise.
+*/
++ (BOOL)throwException:(NSString *)exceptionMessage;
+
+/*!
+ @method JSObject
+ @result The equivalent JSObjectRef for this WebScriptObject.
+ @discussion Use this method to bridge between the WebScriptObject and
+ JavaScriptCore APIs.
+*/
+- (JSObjectRef)JSObject WEBKIT_OBJC_METHOD_ANNOTATION(AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER);
+
+/*!
+ @method callWebScriptMethod:withArguments:
+ @param name The name of the method to call in the script environment.
+ @param arguments The arguments to pass to the script environment.
+ @discussion Calls the specified method in the script environment using the
+ specified arguments.
+ @result Returns the result of calling the script method.
+ Returns WebUndefined when an exception is thrown in the script environment.
+*/
+- (id)callWebScriptMethod:(NSString *)name withArguments:(NSArray *)arguments;
+
+/*!
+ @method evaluateWebScript:
+ @param script The script to execute in the target script environment.
+ @discussion The script will be executed in the target script environment. The format
+ of the script is dependent of the target script environment.
+ @result Returns the result of evaluating the script in the script environment.
+ Returns WebUndefined when an exception is thrown in the script environment.
+*/
+- (id)evaluateWebScript:(NSString *)script;
+
+/*!
+ @method removeWebScriptKey:
+ @param name The name of the property to remove.
+ @discussion Removes the property from the object in the script environment.
+*/
+- (void)removeWebScriptKey:(NSString *)name;
+
+/*!
+ @method stringRepresentation
+ @discussion Converts the target object to a string representation. The coercion
+ of non string objects type is dependent on the script environment.
+ @result Returns the string representation of the object.
+*/
+- (NSString *)stringRepresentation;
+
+/*!
+ @method webScriptValueAtIndex:
+ @param index The index of the property to return.
+ @discussion Gets the value of the property at the specified index.
+ @result The value of the property. Returns WebUndefined when an exception is
+ thrown in the script environment.
+*/
+- (id)webScriptValueAtIndex:(unsigned)index;
+
+/*!
+ @method setWebScriptValueAtIndex:value:
+ @param index The index of the property to set.
+ @param value The value of the property to set.
+ @discussion Sets the property value at the specified index.
+*/
+- (void)setWebScriptValueAtIndex:(unsigned)index value:(id)value;
+
+/*!
+ @method setException:
+ @param description The description of the exception.
+ @discussion Raises an exception in the script environment in the context of the
+ current object.
+*/
+- (void)setException:(NSString *)description;
+
+@end
+
+
+// WebUndefined --------------------------------------------------------------
+
+/*!
+ @class WebUndefined
+*/
+@interface WebUndefined : NSObject <NSCoding, NSCopying>
+
+/*!
+ @method undefined
+ @result The WebUndefined shared instance.
+*/
++ (WebUndefined *)undefined;
+
+@end
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _WEB_SCRIPT_OBJECT_PRIVATE_H_
+#define _WEB_SCRIPT_OBJECT_PRIVATE_H_
+
+#import "WebScriptObject.h"
+#import <runtime/JSValue.h>
+#import <wtf/PassRefPtr.h>
+
+namespace JSC {
+
+ class JSObject;
+
+ namespace Bindings {
+ class RootObject;
+ }
+}
+namespace WebCore {
+ NSObject* getJSWrapper(JSC::JSObject*);
+ void addJSWrapper(NSObject* wrapper, JSC::JSObject*);
+ void removeJSWrapper(JSC::JSObject*);
+ id createJSWrapper(JSC::JSObject*, PassRefPtr<JSC::Bindings::RootObject> origin, PassRefPtr<JSC::Bindings::RootObject> root);
+}
+
+@interface WebScriptObject (Private)
++ (id)_convertValueToObjcValue:(JSC::JSValuePtr)value originRootObject:(JSC::Bindings::RootObject*)originRootObject rootObject:(JSC::Bindings::RootObject*)rootObject;
++ (id)scriptObjectForJSObject:(JSObjectRef)jsObject originRootObject:(JSC::Bindings::RootObject*)originRootObject rootObject:(JSC::Bindings::RootObject*)rootObject;
+- (id)_init;
+- (id)_initWithJSObject:(JSC::JSObject*)imp originRootObject:(PassRefPtr<JSC::Bindings::RootObject>)originRootObject rootObject:(PassRefPtr<JSC::Bindings::RootObject>)rootObject;
+- (void)_setImp:(JSC::JSObject*)imp originRootObject:(PassRefPtr<JSC::Bindings::RootObject>)originRootObject rootObject:(PassRefPtr<JSC::Bindings::RootObject>)rootObject;
+- (void)_setOriginRootObject:(PassRefPtr<JSC::Bindings::RootObject>)originRootObject andRootObject:(PassRefPtr<JSC::Bindings::RootObject>)rootObject;
+- (void)_initializeScriptDOMNodeImp;
+- (JSC::JSObject *)_imp;
+- (BOOL)_hasImp;
+- (JSC::Bindings::RootObject*)_rootObject;
+- (JSC::Bindings::RootObject*)_originRootObject;
+@end
+
+@interface WebScriptObjectPrivate : NSObject
+{
+@public
+ JSC::JSObject *imp;
+ JSC::Bindings::RootObject* rootObject;
+ JSC::Bindings::RootObject* originRootObject;
+ BOOL isCreatedByDOMWrapper;
+}
+@end
+
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebTiledLayer_h
+#define WebTiledLayer_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#import "WebLayer.h"
+
+@interface WebTiledLayer : CATiledLayer
+{
+ WebCore::GraphicsLayer* m_layerOwner;
+}
+
+// implements WebLayerAdditions
+
+@end
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif // WebTiledLayer_h
+
--- /dev/null
+/*
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
+ * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WheelEvent_h
+#define WheelEvent_h
+
+#include "MouseRelatedEvent.h"
+
+namespace WebCore {
+
+ // extension: mouse wheel event
+ class WheelEvent : public MouseRelatedEvent {
+ public:
+ static PassRefPtr<WheelEvent> create()
+ {
+ return adoptRef(new WheelEvent);
+ }
+ static PassRefPtr<WheelEvent> create(float wheelDeltaX, float wheelDeltaY, PassRefPtr<AbstractView> view,
+ int screenX, int screenY, int pageX, int pageY,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
+ {
+ return adoptRef(new WheelEvent(wheelDeltaX, wheelDeltaY, view, screenX, screenY, pageX, pageY,
+ ctrlKey, altKey, shiftKey, metaKey));
+ }
+
+ void initWheelEvent(int wheelDeltaX, int wheelDeltaY, PassRefPtr<AbstractView>,
+ int screenX, int screenY, int pageX, int pageY,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
+
+ int wheelDelta() const { if (m_wheelDeltaY == 0) return m_wheelDeltaX; return m_wheelDeltaY; }
+ int wheelDeltaX() const { return m_wheelDeltaX; }
+ int wheelDeltaY() const { return m_wheelDeltaY; }
+
+ // Needed for Objective-C legacy support
+ bool isHorizontal() const { return m_wheelDeltaX; }
+
+ private:
+ WheelEvent();
+ WheelEvent(float wheelDeltaX, float wheelDeltaY, PassRefPtr<AbstractView>,
+ int screenX, int screenY, int pageX, int pageY,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
+
+ virtual bool isWheelEvent() const;
+
+ int m_wheelDeltaX;
+ int m_wheelDeltaY;
+ };
+
+} // namespace WebCore
+
+#endif // WheelEvent_h
--- /dev/null
+/*
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2008 Collabora Ltd. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Widget_h
+#define Widget_h
+
+#include <wtf/Platform.h>
+
+#ifndef NSView
+#define NSView WAKView
+#endif
+
+#if PLATFORM(MAC)
+#ifdef __OBJC__
+@class NSView;
+@class NSWindow;
+#else
+class NSView;
+class NSWindow;
+#endif
+typedef NSView* PlatformWidget;
+#endif
+
+#if PLATFORM(WIN)
+typedef struct HWND__* HWND;
+typedef HWND PlatformWidget;
+#endif
+
+#if PLATFORM(GTK)
+typedef struct _GdkDrawable GdkDrawable;
+typedef struct _GtkWidget GtkWidget;
+typedef struct _GtkContainer GtkContainer;
+typedef GtkWidget* PlatformWidget;
+#endif
+
+#if PLATFORM(QT)
+#include <qglobal.h>
+QT_BEGIN_NAMESPACE
+class QWidget;
+QT_END_NAMESPACE
+typedef QWidget* PlatformWidget;
+#endif
+
+#if PLATFORM(WX)
+class wxWindow;
+typedef wxWindow* PlatformWidget;
+#endif
+
+#if PLATFORM(CHROMIUM)
+#include "PlatformWidget.h"
+#endif
+
+#include "IntPoint.h"
+#include "IntRect.h"
+#include "IntSize.h"
+
+namespace WebCore {
+
+class Cursor;
+class Event;
+class Font;
+class GraphicsContext;
+class PlatformMouseEvent;
+class ScrollView;
+class WidgetClient;
+class WidgetPrivate;
+
+// The Widget class serves as a base class for three kinds of objects:
+// (1) Scrollable areas (ScrollView)
+// (2) Scrollbars (Scrollbar)
+// (3) Plugins (PluginView)
+//
+// A widget may or may not be backed by a platform-specific object (e.g., HWND on Windows, NSView on Mac, QWidget on Qt).
+//
+// Widgets are connected in a hierarchy, with the restriction that plugins and scrollbars are always leaves of the
+// tree. Only ScrollViews can have children (and therefore the Widget class has no concept of children).
+//
+// The rules right now for which widgets get platform-specific objects are as follows:
+// ScrollView - Mac
+// Scrollbar - Mac, Gtk
+// Plugin - Mac, Windows (windowed only), Qt (windowed only, widget is an HWND on windows), Gtk (windowed only)
+//
+class Widget {
+public:
+ Widget(PlatformWidget = 0);
+ virtual ~Widget();
+
+ PlatformWidget platformWidget() const { return m_widget; }
+ void setPlatformWidget(PlatformWidget widget)
+ {
+ if (widget != m_widget) {
+ releasePlatformWidget();
+ m_widget = widget;
+ retainPlatformWidget();
+ }
+ }
+
+ int x() const { return frameRect().x(); }
+ int y() const { return frameRect().y(); }
+ int width() const { return frameRect().width(); }
+ int height() const { return frameRect().height(); }
+ IntSize size() const { return frameRect().size(); }
+ IntPoint pos() const { return frameRect().location(); }
+
+ virtual void setFrameRect(const IntRect&);
+ virtual IntRect frameRect() const;
+ IntRect boundsRect() const { return IntRect(0, 0, width(), height()); }
+
+ void resize(int w, int h) { setFrameRect(IntRect(x(), y(), w, h)); }
+ void resize(const IntSize& s) { setFrameRect(IntRect(pos(), s)); }
+ void move(int x, int y) { setFrameRect(IntRect(x, y, width(), height())); }
+ void move(const IntPoint& p) { setFrameRect(IntRect(p, size())); }
+
+ virtual void paint(GraphicsContext*, const IntRect&);
+ void invalidate() { invalidateRect(boundsRect()); }
+ virtual void invalidateRect(const IntRect&) = 0;
+
+ virtual void setFocus();
+
+ void setCursor(const Cursor&);
+ Cursor cursor();
+
+ virtual void show();
+ virtual void hide();
+ bool isSelfVisible() const { return m_selfVisible; } // Whether or not we have been explicitly marked as visible or not.
+ bool isParentVisible() const { return m_parentVisible; } // Whether or not our parent is visible.
+ bool isVisible() const { return m_selfVisible && m_parentVisible; } // Whether or not we are actually visible.
+ virtual void setParentVisible(bool visible) { m_parentVisible = visible; }
+ void setSelfVisible(bool v) { m_selfVisible = v; }
+
+ void setIsSelected(bool);
+
+ virtual bool isFrameView() const { return false; }
+ virtual bool isPluginView() const { return false; }
+
+ void removeFromParent();
+ virtual void setParent(ScrollView* view);
+ ScrollView* parent() const { return m_parent; }
+ ScrollView* root() const;
+
+ virtual void handleEvent(Event*) { }
+
+ // It is important for cross-platform code to realize that Mac has flipped coordinates. Therefore any code
+ // that tries to convert the location of a rect using the point-based convertFromContainingWindow will end
+ // up with an inaccurate rect. Always make sure to use the rect-based convertFromContainingWindow method
+ // when converting window rects.
+ IntRect convertToContainingWindow(const IntRect&) const;
+ IntPoint convertToContainingWindow(const IntPoint&) const;
+ IntPoint convertFromContainingWindow(const IntPoint&) const; // See comment above about when not to use this method.
+ IntRect convertFromContainingWindow(const IntRect&) const;
+
+ virtual void frameRectsChanged() {}
+
+#if PLATFORM(MAC)
+ NSView* getOuterView() const;
+
+ static void beforeMouseDown(NSView*, Widget*);
+ static void afterMouseDown(NSView*, Widget*);
+
+ void removeFromSuperview();
+#endif
+ void addToSuperview(NSView* superview);
+
+private:
+ void init(PlatformWidget); // Must be called by all Widget constructors to initialize cross-platform data.
+
+ void releasePlatformWidget();
+ void retainPlatformWidget();
+
+private:
+ ScrollView* m_parent;
+ PlatformWidget m_widget;
+ bool m_selfVisible;
+ bool m_parentVisible;
+
+ IntRect m_frame; // Not used when a native widget exists.
+
+#if PLATFORM(MAC) || PLATFORM(GTK)
+ WidgetPrivate* m_data;
+#endif
+};
+
+} // namespace WebCore
+
+#endif // Widget_h
--- /dev/null
+/*
+ * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Holger Hans Peter Freyther
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WidthIterator_h
+#define WidthIterator_h
+
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+class Font;
+class GlyphBuffer;
+class TextRun;
+
+struct WidthIterator {
+ WidthIterator(const Font*, const TextRun&);
+
+ void advance(int to, GlyphBuffer* = 0);
+ bool advanceOneCharacter(float& width, GlyphBuffer* = 0);
+
+ const Font* m_font;
+
+ const TextRun& m_run;
+ int m_end;
+
+ unsigned m_currentCharacter;
+ float m_runWidthSoFar;
+ float m_padding;
+ float m_padPerSpace;
+ float m_finalRoundingWidth;
+
+private:
+ UChar32 normalizeVoicingMarks(int currentCharacter);
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2003, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WindowFeatures_h
+#define WindowFeatures_h
+
+#include "PlatformString.h"
+#include <wtf/HashMap.h>
+
+namespace WebCore {
+
+ struct WindowFeatures {
+ WindowFeatures()
+ : xSet(false)
+ , ySet(false)
+ , widthSet(false)
+ , heightSet(false)
+ , menuBarVisible(true)
+ , statusBarVisible(true)
+ , toolBarVisible(true)
+ , locationBarVisible(true)
+ , scrollbarsVisible(true)
+ , resizable(true)
+ , fullscreen(false)
+ , dialog(false)
+ {
+ }
+
+ WindowFeatures(const String& features);
+
+ void setWindowFeature(const String& keyString, const String& valueString);
+
+ static bool boolFeature(const HashMap<String, String>& features, const char* key, bool defaultValue = false);
+ static float floatFeature(const HashMap<String, String>& features, const char* key, float min, float max, float defaultValue);
+
+ float x;
+ bool xSet;
+ float y;
+ bool ySet;
+ float width;
+ bool widthSet;
+ float height;
+ bool heightSet;
+
+ bool menuBarVisible;
+ bool statusBarVisible;
+ bool toolBarVisible;
+ bool locationBarVisible;
+ bool scrollbarsVisible;
+ bool resizable;
+
+ bool fullscreen;
+ bool dialog;
+ };
+
+} // namespace WebCore
+
+#endif // WindowFeatures_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef Worker_h
+#define Worker_h
+
+#if ENABLE(WORKERS)
+
+#include "AtomicStringHash.h"
+#include "ActiveDOMObject.h"
+#include "CachedResourceClient.h"
+#include "CachedResourceHandle.h"
+#include "EventListener.h"
+#include "EventTarget.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+ class CachedResource;
+ class CachedScript;
+ class Document;
+ class ScriptExecutionContext;
+ class String;
+ class WorkerMessagingProxy;
+ class WorkerTask;
+
+ typedef int ExceptionCode;
+
+ class Worker : public RefCounted<Worker>, public ActiveDOMObject, private CachedResourceClient, public EventTarget {
+ public:
+ static PassRefPtr<Worker> create(const String& url, Document* document, ExceptionCode& ec) { return adoptRef(new Worker(url, document, ec)); }
+ ~Worker();
+
+ virtual ScriptExecutionContext* scriptExecutionContext() const { return ActiveDOMObject::scriptExecutionContext(); }
+ Document* document() const;
+
+ virtual Worker* toWorker() { return this; }
+
+ void postMessage(const String& message);
+
+ void terminate();
+
+ virtual bool canSuspend() const;
+ virtual void stop();
+ virtual bool hasPendingActivity() const;
+
+ virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture);
+ virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture);
+ virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&);
+
+ typedef Vector<RefPtr<EventListener> > ListenerVector;
+ typedef HashMap<AtomicString, ListenerVector> EventListenersMap;
+ EventListenersMap& eventListeners() { return m_eventListeners; }
+
+ using RefCounted<Worker>::ref;
+ using RefCounted<Worker>::deref;
+
+ void setOnmessage(PassRefPtr<EventListener> eventListener) { m_onMessageListener = eventListener; }
+ EventListener* onmessage() const { return m_onMessageListener.get(); }
+
+ void setOnerror(PassRefPtr<EventListener> eventListener) { m_onErrorListener = eventListener; }
+ EventListener* onerror() const { return m_onErrorListener.get(); }
+
+ private:
+ Worker(const String&, Document*, ExceptionCode&);
+
+ virtual void notifyFinished(CachedResource*);
+
+ void dispatchErrorEvent();
+
+ virtual void refEventTarget() { ref(); }
+ virtual void derefEventTarget() { deref(); }
+
+ KURL m_scriptURL;
+ CachedResourceHandle<CachedScript> m_cachedScript;
+
+ WorkerMessagingProxy* m_messagingProxy; // The proxy outlives the worker to perform thread shutdown.
+
+ RefPtr<EventListener> m_onMessageListener;
+ RefPtr<EventListener> m_onErrorListener;
+ EventListenersMap m_eventListeners;
+ };
+
+} // namespace WebCore
+
+#endif // ENABLE(WORKERS)
+
+#endif // Worker_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef WorkerContext_h
+#define WorkerContext_h
+
+#if ENABLE(WORKERS)
+
+#include "AtomicStringHash.h"
+#include "EventListener.h"
+#include "EventTarget.h"
+#include "ScriptExecutionContext.h"
+#include "WorkerScriptController.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+ class WorkerLocation;
+ class WorkerNavigator;
+ class WorkerThread;
+
+ class WorkerContext : public RefCounted<WorkerContext>, public ScriptExecutionContext, public EventTarget {
+ public:
+ static PassRefPtr<WorkerContext> create(const KURL& url, const String& userAgent, WorkerThread* thread)
+ {
+ return adoptRef(new WorkerContext(url, userAgent, thread));
+ }
+
+ virtual ~WorkerContext();
+
+ virtual bool isWorkerContext() const { return true; }
+
+ virtual ScriptExecutionContext* scriptExecutionContext() const;
+
+ const KURL& url() const { return m_url; }
+ KURL completeURL(const String&) const;
+
+ WorkerLocation* location() const { return m_location.get(); }
+ WorkerNavigator* navigator() const;
+
+ WorkerScriptController* script() { return m_script.get(); }
+ void clearScript() { return m_script.clear(); }
+ WorkerThread* thread() { return m_thread; }
+
+ bool hasPendingActivity() const;
+
+ virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL);
+ virtual void addMessage(MessageDestination, MessageSource, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL);
+ virtual void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString);
+
+ virtual WorkerContext* toWorkerContext() { return this; }
+
+ void postMessage(const String& message);
+ virtual void postTask(PassRefPtr<Task>); // Executes the task on context's thread asynchronously.
+ void postTaskToParentContext(PassRefPtr<Task>); // Executes the task in the parent's context (and thread) asynchronously.
+
+ virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture);
+ virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture);
+ virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&);
+
+ void setOnmessage(PassRefPtr<EventListener> eventListener) { m_onmessageListener = eventListener; }
+ EventListener* onmessage() const { return m_onmessageListener.get(); }
+
+ typedef Vector<RefPtr<EventListener> > ListenerVector;
+ typedef HashMap<AtomicString, ListenerVector> EventListenersMap;
+ EventListenersMap& eventListeners() { return m_eventListeners; }
+
+ using RefCounted<WorkerContext>::ref;
+ using RefCounted<WorkerContext>::deref;
+
+ private:
+ virtual void refScriptExecutionContext() { ref(); }
+ virtual void derefScriptExecutionContext() { deref(); }
+ virtual void refEventTarget() { ref(); }
+ virtual void derefEventTarget() { deref(); }
+
+ WorkerContext(const KURL&, const String&, WorkerThread*);
+
+ virtual const KURL& virtualURL() const;
+ virtual KURL virtualCompleteURL(const String&) const;
+
+ KURL m_url;
+ String m_userAgent;
+ RefPtr<WorkerLocation> m_location;
+ mutable RefPtr<WorkerNavigator> m_navigator;
+
+ OwnPtr<WorkerScriptController> m_script;
+ WorkerThread* m_thread;
+
+ RefPtr<EventListener> m_onmessageListener;
+ EventListenersMap m_eventListeners;
+ };
+
+} // namespace WebCore
+
+#endif // ENABLE(WORKERS)
+
+#endif // WorkerContext_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef WorkerLocation_h
+#define WorkerLocation_h
+
+#if ENABLE(WORKERS)
+
+#include "KURL.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+ class String;
+
+ class WorkerLocation : public RefCounted<WorkerLocation> {
+ public:
+ static PassRefPtr<WorkerLocation> create(const KURL& url)
+ {
+ return adoptRef(new WorkerLocation(url));
+ }
+
+ const KURL& url() const { return m_url; }
+
+ String href() const;
+
+ // URI decomposition attributes
+ String protocol() const;
+ String host() const;
+ String hostname() const;
+ String port() const;
+ String pathname() const;
+ String search() const;
+ String hash() const;
+
+ String toString() const;
+
+ private:
+ WorkerLocation(const KURL& url) : m_url(url) { }
+
+ KURL m_url;
+ };
+
+} // namespace WebCore
+
+#endif // ENABLE(WORKERS)
+
+#endif // WorkerLocation_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef WorkerMessagingProxy_h
+#define WorkerMessagingProxy_h
+
+#if ENABLE(WORKERS)
+
+#include "ScriptExecutionContext.h"
+#include <wtf/Noncopyable.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+ class ScriptExecutionContext;
+ class String;
+ class Worker;
+ class WorkerTask;
+ class WorkerThread;
+
+ class WorkerMessagingProxy : Noncopyable {
+ public:
+ WorkerMessagingProxy(PassRefPtr<ScriptExecutionContext>, Worker*);
+
+ void postMessageToWorkerObject(const String& message);
+ void postMessageToWorkerContext(const String& message);
+ void postTaskToParentContext(PassRefPtr<ScriptExecutionContext::Task>);
+
+ void postWorkerException(const String& errorMessage, int lineNumber, const String& sourceURL);
+
+ void workerThreadCreated(PassRefPtr<WorkerThread>);
+ void workerObjectDestroyed();
+ void workerContextDestroyed();
+
+ void terminate();
+
+ void confirmWorkerThreadMessage(bool hasPendingActivity);
+ void reportWorkerThreadActivity(bool hasPendingActivity);
+ bool workerThreadHasPendingActivity() const;
+
+ private:
+ friend class GenericWorkerTaskBase;
+ friend class MessageWorkerTask;
+ friend class WorkerContextDestroyedTask;
+ friend class WorkerExceptionTask;
+ friend class WorkerThreadActivityReportTask;
+
+ ~WorkerMessagingProxy();
+
+ void workerContextDestroyedInternal();
+ void reportWorkerThreadActivityInternal(bool confirmingMessage, bool hasPendingActivity);
+ Worker* workerObject() const { return m_workerObject; }
+ bool askedToTerminate() { return m_askedToTerminate; }
+
+ RefPtr<ScriptExecutionContext> m_scriptExecutionContext;
+ Worker* m_workerObject;
+ RefPtr<WorkerThread> m_workerThread;
+
+ unsigned m_unconfirmedMessageCount; // Unconfirmed messages from worker object to worker thread.
+ bool m_workerThreadHadPendingActivity; // The latest confirmation from worker thread reported that it was still active.
+
+ bool m_askedToTerminate;
+
+ Vector<RefPtr<WorkerTask> > m_queuedEarlyTasks; // Tasks are queued here until there's a thread object created.
+ };
+
+} // namespace WebCore
+
+#endif // ENABLE(WORKERS)
+
+#endif // WorkerMessagingProxy_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef WorkerNavigator_h
+#define WorkerNavigator_h
+
+#if ENABLE(WORKERS)
+
+#include "NavigatorBase.h"
+#include "PlatformString.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+ class WorkerNavigator : public NavigatorBase, public RefCounted<WorkerNavigator> {
+ public:
+ static PassRefPtr<WorkerNavigator> create(const String& userAgent) { return adoptRef(new WorkerNavigator(userAgent)); }
+ virtual ~WorkerNavigator();
+
+ virtual String userAgent() const;
+
+ private:
+ WorkerNavigator(const String&);
+
+ String m_userAgent;
+ };
+
+} // namespace WebCore
+
+#endif // ENABLE(WORKERS)
+
+#endif // WorkerNavigator_h
--- /dev/null
+/*
+ * Copyright (C) 2009 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 WorkerRunLoop_h
+#define WorkerRunLoop_h
+
+#if ENABLE(WORKERS)
+
+#include "WorkerTask.h"
+#include <wtf/MessageQueue.h>
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+ class WorkerContext;
+
+ class WorkerRunLoop {
+ public:
+ WorkerRunLoop() {}
+
+ // Blocking call. Waits for tasks and timers, invokes the callbacks.
+ void run(WorkerContext*);
+
+ void terminate();
+ bool terminated() { return m_messageQueue.killed(); }
+
+ void postTask(PassRefPtr<WorkerTask>);
+
+ private:
+ MessageQueue<RefPtr<WorkerTask> > m_messageQueue;
+ };
+
+} // namespace WebCore
+
+#endif // ENABLE(WORKERS)
+
+#endif // WorkerRunLoop_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef WorkerTask_h
+#define WorkerTask_h
+
+#if ENABLE(WORKERS)
+
+#include <wtf/Threading.h>
+
+namespace WebCore {
+
+ class WorkerContext;
+
+ class WorkerTask : public ThreadSafeShared<WorkerTask> {
+ public:
+ virtual ~WorkerTask();
+ virtual void performTask(WorkerContext*) = 0;
+ };
+
+} // namespace WebCore
+
+#endif // ENABLE(WORKERS)
+
+#endif // WorkerTask_h
--- /dev/null
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef WorkerThread_h
+#define WorkerThread_h
+
+#if ENABLE(WORKERS)
+
+#include <WorkerRunLoop.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+ class KURL;
+ class String;
+ class WorkerContext;
+ class WorkerMessagingProxy;
+ class WorkerTask;
+ struct WorkerThreadStartupData;
+
+ class WorkerThread : public RefCounted<WorkerThread> {
+ public:
+ static PassRefPtr<WorkerThread> create(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerMessagingProxy*);
+ ~WorkerThread();
+
+ bool start();
+ void stop();
+
+ ThreadIdentifier threadID() const { return m_threadID; }
+ WorkerRunLoop& runLoop() { return m_runLoop; }
+ WorkerMessagingProxy* messagingProxy() const { return m_messagingProxy; }
+
+ private:
+ WorkerThread(const KURL&, const String& userAgent, const String& sourceCode, WorkerMessagingProxy*);
+
+ static void* workerThreadStart(void*);
+ void* workerThread();
+
+ ThreadIdentifier m_threadID;
+ WorkerRunLoop m_runLoop;
+ WorkerMessagingProxy* m_messagingProxy;
+
+ RefPtr<WorkerContext> m_workerContext;
+ Mutex m_threadCreationMutex;
+
+ OwnPtr<WorkerThreadStartupData> m_startupData;
+ };
+
+} // namespace WebCore
+
+#endif // ENABLE(WORKERS)
+
+#endif // WorkerThread_h
--- /dev/null
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WrapContentsInDummySpanCommand_h
+#define WrapContentsInDummySpanCommand_h
+
+#include "EditCommand.h"
+
+namespace WebCore {
+
+class HTMLElement;
+
+class WrapContentsInDummySpanCommand : public SimpleEditCommand {
+public:
+ static PassRefPtr<WrapContentsInDummySpanCommand> create(PassRefPtr<Element> element)
+ {
+ return adoptRef(new WrapContentsInDummySpanCommand(element));
+ }
+
+private:
+ WrapContentsInDummySpanCommand(PassRefPtr<Element>);
+
+ virtual void doApply();
+ virtual void doUnapply();
+
+ RefPtr<Element> m_element;
+ RefPtr<HTMLElement> m_dummySpan;
+};
+
+} // namespace WebCore
+
+#endif // WrapContentsInDummySpanCommand_h
--- /dev/null
+/*
+ * Copyright (C) 2000 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef XMLTokenizer_h
+#define XMLTokenizer_h
+
+#include "CachedResourceClient.h"
+#include "CachedResourceHandle.h"
+#include "SegmentedString.h"
+#include "StringHash.h"
+#include "Tokenizer.h"
+#include <wtf/HashMap.h>
+#include <wtf/OwnPtr.h>
+
+#if USE(QXMLSTREAM)
+#include <QtXml/qxmlstream.h>
+#else
+#include <libxml/tree.h>
+#include <libxml/xmlstring.h>
+#endif
+
+namespace WebCore {
+
+ class Node;
+ class CachedScript;
+ class DocLoader;
+ class DocumentFragment;
+ class Document;
+ class Element;
+ class FrameView;
+ class PendingCallbacks;
+ class ScriptElement;
+
+ class XMLTokenizer : public Tokenizer, public CachedResourceClient {
+ public:
+ XMLTokenizer(Document*, FrameView* = 0);
+ XMLTokenizer(DocumentFragment*, Element*);
+ ~XMLTokenizer();
+
+ enum ErrorType { warning, nonFatal, fatal };
+
+ // from Tokenizer
+ virtual bool write(const SegmentedString&, bool appendData);
+ virtual void finish();
+ virtual bool isWaitingForScripts() const;
+ virtual void stopParsing();
+
+ void end();
+
+ void pauseParsing();
+ void resumeParsing();
+
+ void setIsXHTMLDocument(bool isXHTML) { m_isXHTMLDocument = isXHTML; }
+ bool isXHTMLDocument() const { return m_isXHTMLDocument; }
+#if ENABLE(WML)
+ bool isWMLDocument() const;
+#endif
+
+ // from CachedResourceClient
+ virtual void notifyFinished(CachedResource* finishedObj);
+
+
+ void handleError(ErrorType type, const char* m, int lineNumber, int columnNumber);
+
+ virtual bool wellFormed() const { return !m_sawError; }
+
+ int lineNumber() const;
+ int columnNumber() const;
+
+#if USE(QXMLSTREAM)
+private:
+ void parse();
+ void startDocument();
+ void parseStartElement();
+ void parseEndElement();
+ void parseCharacters();
+ void parseProcessingInstruction();
+ void parseCdata();
+ void parseComment();
+ void endDocument();
+ void parseDtd();
+ bool hasError() const;
+#else
+public:
+ // callbacks from parser SAX
+ void error(ErrorType, const char* message, va_list args) WTF_ATTRIBUTE_PRINTF(3, 0);
+ void startElementNs(const xmlChar* xmlLocalName, const xmlChar* xmlPrefix, const xmlChar* xmlURI, int nb_namespaces,
+ const xmlChar** namespaces, int nb_attributes, int nb_defaulted, const xmlChar** libxmlAttributes);
+ void endElementNs();
+ void characters(const xmlChar* s, int len);
+ void processingInstruction(const xmlChar* target, const xmlChar* data);
+ void cdataBlock(const xmlChar* s, int len);
+ void comment(const xmlChar* s);
+ void startDocument(const xmlChar* version, const xmlChar* encoding, int standalone);
+ void internalSubset(const xmlChar* name, const xmlChar* externalID, const xmlChar* systemID);
+ void endDocument();
+#endif
+ private:
+ friend bool parseXMLDocumentFragment(const String& chunk, DocumentFragment* fragment, Element* parent);
+
+ void initializeParserContext(const char* chunk = 0);
+ void setCurrentNode(Node*);
+
+ void insertErrorMessageBlock();
+
+ bool enterText();
+ void exitText();
+
+ void doWrite(const String&);
+ void doEnd();
+
+ Document* m_doc;
+ FrameView* m_view;
+
+ String m_originalSourceForTransform;
+
+#if USE(QXMLSTREAM)
+ QXmlStreamReader m_stream;
+ bool m_wroteText;
+#else
+ xmlParserCtxtPtr m_context;
+ OwnPtr<PendingCallbacks> m_pendingCallbacks;
+ Vector<xmlChar> m_bufferedText;
+#endif
+ Node* m_currentNode;
+ bool m_currentNodeIsReferenced;
+
+ bool m_sawError;
+ bool m_sawXSLTransform;
+ bool m_sawFirstElement;
+ bool m_isXHTMLDocument;
+
+ bool m_parserPaused;
+ bool m_requestingScript;
+ bool m_finishCalled;
+
+ int m_errorCount;
+ int m_lastErrorLine;
+ int m_lastErrorColumn;
+ String m_errorMessages;
+
+ CachedResourceHandle<CachedScript> m_pendingScript;
+ RefPtr<Element> m_scriptElement;
+ int m_scriptStartLine;
+
+ bool m_parsingFragment;
+ String m_defaultNamespaceURI;
+
+ typedef HashMap<String, String> PrefixForNamespaceMap;
+ PrefixForNamespaceMap m_prefixToNamespaceMap;
+ SegmentedString m_pendingSrc;
+ };
+
+#if ENABLE(XSLT)
+void* xmlDocPtrForString(DocLoader*, const String& source, const String& url);
+#endif
+
+HashMap<String, String> parseAttributes(const String&, bool& attrsOK);
+bool parseXMLDocumentFragment(const String&, DocumentFragment*, Element* parent = 0);
+
+} // namespace WebCore
+
+#endif // XMLTokenizer_h
--- /dev/null
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef XMLTokenizerScope_h
+#define XMLTokenizerScope_h
+
+#include <wtf/Noncopyable.h>
+
+#if ENABLE(XSLT)
+#include <libxml/tree.h>
+#endif
+
+namespace WebCore {
+
+ class DocLoader;
+
+ class XMLTokenizerScope : Noncopyable {
+ public:
+ XMLTokenizerScope(DocLoader* docLoader);
+ ~XMLTokenizerScope();
+
+ static DocLoader* currentDocLoader;
+
+#if ENABLE(XSLT)
+ XMLTokenizerScope(DocLoader* docLoader, xmlGenericErrorFunc genericErrorFunc, xmlStructuredErrorFunc structuredErrorFunc = 0, void* errorContext = 0);
+#endif
+
+ private:
+ DocLoader* m_oldDocLoader;
+
+#if ENABLE(XSLT)
+ xmlGenericErrorFunc m_oldGenericErrorFunc;
+ xmlStructuredErrorFunc m_oldStructuredErrorFunc;
+ void* m_oldErrorContext;
+#endif
+ };
+
+} // namespace WebCore
+
+#endif // XMLTokenizerScope_h
--- /dev/null
+/*
+ * This file is part of the html renderer for KDE.
+ *
+ * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2003 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef bidi_h
+#define bidi_h
+
+#include "BidiResolver.h"
+
+namespace WebCore {
+
+class RenderArena;
+class RenderBlock;
+class RenderObject;
+class InlineBox;
+
+struct BidiRun : BidiCharacterRun {
+ BidiRun(int start, int stop, RenderObject* object, BidiContext* context, WTF::Unicode::Direction dir)
+ : BidiCharacterRun(start, stop, context, dir)
+ , m_object(object)
+ , m_box(0)
+ {
+ }
+
+ void destroy();
+
+ // Overloaded new operator.
+ void* operator new(size_t, RenderArena*) throw();
+
+ // Overridden to prevent the normal delete from being called.
+ void operator delete(void*, size_t);
+
+ BidiRun* next() { return static_cast<BidiRun*>(m_next); }
+
+private:
+ // The normal operator new is disallowed.
+ void* operator new(size_t) throw();
+
+public:
+ RenderObject* m_object;
+ InlineBox* m_box;
+};
+
+} // namespace WebCore
+
+#endif // bidi_h
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 2005 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef break_lines_h
+#define break_lines_h
+
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+ int nextBreakablePosition(const UChar*, int pos, int len, bool breakNBSP = false);
+
+ inline bool isBreakable(const UChar* str, int pos, int len, int& nextBreakable, bool breakNBSP = false)
+ {
+ if (pos > nextBreakable)
+ nextBreakable = nextBreakablePosition(str, pos, len, breakNBSP);
+ return pos == nextBreakable;
+ }
+
+} // namespace WebCore
+
+#endif // break_lines_h
--- /dev/null
+/*
+ * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef htmlediting_h
+#define htmlediting_h
+
+#include <wtf/Forward.h>
+#include "HTMLNames.h"
+
+namespace WebCore {
+
+class Document;
+class Element;
+class HTMLElement;
+class Node;
+class Position;
+class Range;
+class Selection;
+class String;
+class VisiblePosition;
+
+Position rangeCompliantEquivalent(const Position&);
+Position rangeCompliantEquivalent(const VisiblePosition&);
+int maxDeepOffset(const Node*);
+bool isAtomicNode(const Node*);
+bool editingIgnoresContent(const Node*);
+bool canHaveChildrenForEditing(const Node*);
+Node* highestEditableRoot(const Position&);
+VisiblePosition firstEditablePositionAfterPositionInRoot(const Position&, Node*);
+VisiblePosition lastEditablePositionBeforePositionInRoot(const Position&, Node*);
+int comparePositions(const Position&, const Position&);
+Node* lowestEditableAncestor(Node*);
+bool isContentEditable(const Node*);
+Position nextCandidate(const Position&);
+Position nextVisuallyDistinctCandidate(const Position&);
+Position previousCandidate(const Position&);
+Position previousVisuallyDistinctCandidate(const Position&);
+bool isEditablePosition(const Position&);
+bool isRichlyEditablePosition(const Position&);
+Element* editableRootForPosition(const Position&);
+bool isBlock(const Node*);
+Node* enclosingBlock(Node*);
+
+String stringWithRebalancedWhitespace(const String&, bool, bool);
+const String& nonBreakingSpaceString();
+
+//------------------------------------------------------------------------------------------
+
+Position positionBeforeNode(const Node*);
+Position positionAfterNode(const Node*);
+
+PassRefPtr<Range> avoidIntersectionWithNode(const Range*, Node*);
+Selection avoidIntersectionWithNode(const Selection&, Node*);
+
+bool isSpecialElement(const Node*);
+bool validBlockTag(const String&);
+
+PassRefPtr<HTMLElement> createDefaultParagraphElement(Document*);
+PassRefPtr<HTMLElement> createBreakElement(Document*);
+PassRefPtr<HTMLElement> createOrderedListElement(Document*);
+PassRefPtr<HTMLElement> createUnorderedListElement(Document*);
+PassRefPtr<HTMLElement> createListItemElement(Document*);
+PassRefPtr<HTMLElement> createHTMLElement(Document*, const QualifiedName&);
+PassRefPtr<HTMLElement> createHTMLElement(Document*, const AtomicString&);
+
+bool isTabSpanNode(const Node*);
+bool isTabSpanTextNode(const Node*);
+Node* tabSpanNode(const Node*);
+Position positionBeforeTabSpan(const Position&);
+PassRefPtr<Element> createTabSpanElement(Document*);
+PassRefPtr<Element> createTabSpanElement(Document*, PassRefPtr<Node> tabTextNode);
+PassRefPtr<Element> createTabSpanElement(Document*, const String& tabText);
+
+bool isNodeRendered(const Node*);
+bool isMailBlockquote(const Node*);
+Node* nearestMailBlockquote(const Node*);
+unsigned numEnclosingMailBlockquotes(const Position&);
+int caretMinOffset(const Node*);
+int caretMaxOffset(const Node*);
+
+//------------------------------------------------------------------------------------------
+
+bool isTableStructureNode(const Node*);
+PassRefPtr<Element> createBlockPlaceholderElement(Document*);
+
+bool isFirstVisiblePositionInSpecialElement(const Position&);
+Position positionBeforeContainingSpecialElement(const Position&, Node** containingSpecialElement=0);
+bool isLastVisiblePositionInSpecialElement(const Position&);
+Position positionAfterContainingSpecialElement(const Position&, Node** containingSpecialElement=0);
+Position positionOutsideContainingSpecialElement(const Position&, Node** containingSpecialElement=0);
+Node* isLastPositionBeforeTable(const VisiblePosition&);
+Node* isFirstPositionAfterTable(const VisiblePosition&);
+
+Node* enclosingNodeWithTag(const Position&, const QualifiedName&);
+Node* enclosingNodeOfType(const Position&, bool (*nodeIsOfType)(const Node*), bool onlyReturnEditableNodes = true);
+Node* highestEnclosingNodeOfType(const Position&, bool (*nodeIsOfType)(const Node*));
+Node* enclosingTableCell(const Position&);
+Node* enclosingEmptyListItem(const VisiblePosition&);
+Node* enclosingAnchorElement(const Position&);
+bool isListElement(Node*);
+HTMLElement* enclosingList(Node*);
+HTMLElement* outermostEnclosingList(Node*);
+Node* enclosingListChild(Node*);
+Node* highestAncestor(Node*);
+bool isTableElement(Node*);
+bool isTableCell(const Node*);
+
+bool lineBreakExistsAtPosition(const Position&);
+bool lineBreakExistsAtVisiblePosition(const VisiblePosition&);
+
+Selection selectionForParagraphIteration(const Selection&);
+
+int indexForVisiblePosition(VisiblePosition&);
+
+}
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
+ Copyright (C) 2001 Dirk Mueller <mueller@kde.org>
+ Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef loader_h
+#define loader_h
+
+#include "AtomicString.h"
+#include "AtomicStringImpl.h"
+#include "PlatformString.h"
+#include "SubresourceLoaderClient.h"
+#include "Timer.h"
+#include <wtf/Deque.h>
+#include <wtf/HashMap.h>
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+ class CachedResource;
+ class DocLoader;
+ class Request;
+
+ class Loader : Noncopyable {
+ public:
+ Loader();
+ ~Loader();
+
+ void load(DocLoader*, CachedResource*, bool incremental = true, bool skipCanLoadCheck = false, bool sendResourceLoadCallbacks = true);
+
+ void cancelRequests(DocLoader*);
+
+ enum Priority { Low, Medium, High };
+ void servePendingRequests(Priority minimumPriority = Low);
+
+ bool isSuspendingPendingRequests() { return m_isSuspendingPendingRequests; }
+ void suspendPendingRequests();
+ void resumePendingRequests();
+
+ private:
+ Priority determinePriority(const CachedResource*) const;
+ void scheduleServePendingRequests();
+
+ void requestTimerFired(Timer<Loader>*);
+
+ class Host : private SubresourceLoaderClient {
+ public:
+ Host(const AtomicString& name, unsigned maxRequestsInFlight);
+ ~Host();
+
+ const AtomicString& name() const { return m_name; }
+ void addRequest(Request*, Priority);
+ void servePendingRequests(Priority minimumPriority = Low);
+ void cancelRequests(DocLoader*);
+ bool hasRequests() const;
+
+ bool processingResource() const { return m_numResourcesProcessing != 0; }
+
+ private:
+ class ProcessingResource {
+ public:
+ ProcessingResource(Host* host)
+ : m_host(host)
+ {
+ m_host->m_numResourcesProcessing++;
+ }
+
+ ~ProcessingResource()
+ {
+ m_host->m_numResourcesProcessing--;
+ }
+
+ private:
+ Host* m_host;
+ };
+
+ virtual void didReceiveResponse(SubresourceLoader*, const ResourceResponse&);
+ virtual void didReceiveData(SubresourceLoader*, const char*, int);
+ virtual void didFinishLoading(SubresourceLoader*);
+ virtual void didFail(SubresourceLoader*, const ResourceError&);
+
+ typedef Deque<Request*> RequestQueue;
+ void servePendingRequests(RequestQueue& requestsPending, bool& serveLowerPriority);
+ void didFail(SubresourceLoader*, bool cancelled = false);
+ void cancelPendingRequests(RequestQueue& requestsPending, DocLoader*);
+
+ RequestQueue m_requestsPending[High + 1];
+ typedef HashMap<RefPtr<SubresourceLoader>, Request*> RequestMap;
+ RequestMap m_requestsLoading;
+ const AtomicString m_name;
+ const int m_maxRequestsInFlight;
+ int m_numResourcesProcessing;
+ };
+ typedef HashMap<AtomicStringImpl*, Host*> HostMap;
+ HostMap m_hosts;
+ Host m_nonHTTPProtocolHost;
+
+ Timer<Loader> m_requestTimer;
+
+ bool m_isSuspendingPendingRequests;
+ };
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef markup_h
+#define markup_h
+
+#include "HTMLInterchange.h"
+#include <wtf/Forward.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+ class Document;
+ class DocumentFragment;
+ class Node;
+ class Range;
+ class String;
+
+ enum EChildrenOnly { IncludeNode, ChildrenOnly };
+
+ PassRefPtr<DocumentFragment> createFragmentFromText(Range* context, const String& text);
+ PassRefPtr<DocumentFragment> createFragmentFromMarkup(Document*, const String& markup, const String& baseURL);
+ PassRefPtr<DocumentFragment> createFragmentFromNodes(Document*, const Vector<Node*>&);
+
+ String createMarkup(const Range*,
+ Vector<Node*>* = 0, EAnnotateForInterchange = DoNotAnnotateForInterchange, bool convertBlocksToInlines = false);
+ String createMarkup(const Node*, EChildrenOnly = IncludeNode, Vector<Node*>* = 0);
+
+ String createFullMarkup(const Node*);
+ String createFullMarkup(const Range*);
+
+}
+
+#endif // markup_h
--- /dev/null
+/*
+ * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef visible_units_h
+#define visible_units_h
+
+#include "Document.h"
+#include "TextAffinity.h"
+
+namespace WebCore {
+
+class VisiblePosition;
+
+enum EWordSide { RightWordIfOnBoundary = false, LeftWordIfOnBoundary = true };
+
+// words
+VisiblePosition startOfWord(const VisiblePosition &, EWordSide = RightWordIfOnBoundary);
+VisiblePosition endOfWord(const VisiblePosition &, EWordSide = RightWordIfOnBoundary);
+VisiblePosition previousWordPosition(const VisiblePosition &);
+VisiblePosition nextWordPosition(const VisiblePosition &);
+
+// sentences
+VisiblePosition startOfSentence(const VisiblePosition &);
+VisiblePosition endOfSentence(const VisiblePosition &);
+VisiblePosition previousSentencePosition(const VisiblePosition &);
+VisiblePosition nextSentencePosition(const VisiblePosition &);
+
+// lines
+VisiblePosition startOfLine(const VisiblePosition &);
+VisiblePosition endOfLine(const VisiblePosition &);
+VisiblePosition previousLinePosition(const VisiblePosition &, int x);
+VisiblePosition nextLinePosition(const VisiblePosition &, int x);
+bool inSameLine(const VisiblePosition &, const VisiblePosition &);
+bool isStartOfLine(const VisiblePosition &);
+bool isEndOfLine(const VisiblePosition &);
+
+// paragraphs (perhaps a misnomer, can be divided by line break elements)
+VisiblePosition startOfParagraph(const VisiblePosition&);
+VisiblePosition endOfParagraph(const VisiblePosition&);
+VisiblePosition startOfNextParagraph(const VisiblePosition&);
+VisiblePosition previousParagraphPosition(const VisiblePosition &, int x);
+VisiblePosition nextParagraphPosition(const VisiblePosition &, int x);
+bool inSameParagraph(const VisiblePosition &, const VisiblePosition &);
+bool isStartOfParagraph(const VisiblePosition &);
+bool isEndOfParagraph(const VisiblePosition &);
+
+// blocks (true paragraphs; line break elements don't break blocks)
+VisiblePosition startOfBlock(const VisiblePosition &);
+VisiblePosition endOfBlock(const VisiblePosition &);
+bool inSameBlock(const VisiblePosition &, const VisiblePosition &);
+bool isStartOfBlock(const VisiblePosition &);
+bool isEndOfBlock(const VisiblePosition &);
+
+// document
+VisiblePosition startOfDocument(const Node*);
+VisiblePosition endOfDocument(const Node*);
+VisiblePosition startOfDocument(const VisiblePosition &);
+VisiblePosition endOfDocument(const VisiblePosition &);
+bool inSameDocument(const VisiblePosition &, const VisiblePosition &);
+bool isStartOfDocument(const VisiblePosition &);
+bool isEndOfDocument(const VisiblePosition &);
+
+// editable content
+VisiblePosition startOfEditableContent(const VisiblePosition&);
+VisiblePosition endOfEditableContent(const VisiblePosition&);
+
+} // namespace WebCore
+
+#endif // VisiblePosition_h