From a90939db6f3470c710a75766bc67dd24975a4ddd Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Fri, 17 Jan 2014 12:23:05 +0000 Subject: [PATCH] Adding the WebCore headers (for Cydget). --- WebCore/AXObjectCache.h | 111 + WebCore/AccessibilityImageMapLink.h | 72 + WebCore/AccessibilityList.h | 56 + WebCore/AccessibilityListBox.h | 66 + WebCore/AccessibilityListBoxOption.h | 79 + WebCore/AccessibilityObject.h | 429 ++++ WebCore/AccessibilityRenderObject.h | 243 ++ WebCore/AccessibilityTable.h | 86 + WebCore/AccessibilityTableCell.h | 65 + WebCore/AccessibilityTableColumn.h | 75 + WebCore/AccessibilityTableHeaderContainer.h | 67 + WebCore/AccessibilityTableRow.h | 65 + WebCore/ActiveDOMObject.h | 80 + WebCore/Animation.h | 151 ++ WebCore/AnimationList.h | 60 + WebCore/AppendNodeCommand.h | 52 + WebCore/ApplyStyleCommand.h | 120 + WebCore/Arena.h | 130 + WebCore/AtomicString.h | 159 ++ WebCore/AtomicStringHash.h | 66 + WebCore/AtomicStringImpl.h | 36 + WebCore/Attr.h | 96 + WebCore/Attribute.h | 91 + WebCore/AuthenticationCF.cpp | 266 ++ WebCore/AuthenticationCF.h | 49 + WebCore/AuthenticationChallenge.h | 57 + WebCore/AuthenticationChallengeBase.h | 70 + WebCore/AutoTableLayout.h | 87 + WebCore/AutodrainedPool.h | 67 + WebCore/BackForwardList.h | 125 + WebCore/BarInfo.h | 57 + WebCore/Base64.h | 41 + WebCore/BeforeTextInsertedEvent.h | 53 + WebCore/BeforeUnloadEvent.h | 53 + WebCore/BidiContext.h | 69 + WebCore/BidiResolver.h | 946 +++++++ WebCore/BindingURI.h | 59 + WebCore/BitmapImage.h | 280 +++ WebCore/BorderData.h | 109 + WebCore/BorderValue.h | 75 + WebCore/BreakBlockquoteCommand.h | 47 + WebCore/CDATASection.h | 48 + WebCore/CSSBorderImageValue.h | 62 + WebCore/CSSCanvasValue.h | 68 + WebCore/CSSCharsetRule.h | 57 + WebCore/CSSComputedStyleDeclaration.h | 79 + WebCore/CSSCursorImageValue.h | 63 + WebCore/CSSFontFace.h | 96 + WebCore/CSSFontFaceRule.h | 67 + WebCore/CSSFontFaceSource.h | 83 + WebCore/CSSFontFaceSrcValue.h | 92 + WebCore/CSSFontSelector.h | 77 + WebCore/CSSFunctionValue.h | 58 + WebCore/CSSGradientValue.h | 112 + WebCore/CSSHelper.h | 42 + WebCore/CSSImageGeneratorValue.h | 73 + WebCore/CSSImageValue.h | 59 + WebCore/CSSImportRule.h | 77 + WebCore/CSSInheritedValue.h | 45 + WebCore/CSSInitialValue.h | 58 + WebCore/CSSMappedAttributeDeclaration.h | 65 + WebCore/CSSMediaRule.h | 69 + WebCore/CSSMutableStyleDeclaration.h | 222 ++ WebCore/CSSNamespace.h | 59 + WebCore/CSSPageRule.h | 60 + WebCore/CSSParser.h | 307 +++ WebCore/CSSParserValues.h | 100 + WebCore/CSSPrimitiveValue.h | 214 ++ WebCore/CSSPrimitiveValueMappings.h | 2239 +++++++++++++++++ WebCore/CSSProperty.h | 81 + WebCore/CSSPropertyLonghand.h | 53 + WebCore/CSSPropertyNames.in | 252 ++ WebCore/CSSQuirkPrimitiveValue.h | 50 + WebCore/CSSReflectValue.h | 70 + WebCore/CSSReflectionDirection.h | 35 + WebCore/CSSRule.h | 72 + WebCore/CSSRuleList.h | 68 + WebCore/CSSSegmentedFontFace.h | 70 + WebCore/CSSSelector.h | 261 ++ WebCore/CSSSelectorList.h | 55 + WebCore/CSSStyleDeclaration.h | 78 + WebCore/CSSStyleRule.h | 75 + WebCore/CSSStyleSelector.h | 327 +++ WebCore/CSSStyleSheet.h | 113 + WebCore/CSSTimingFunctionValue.h | 67 + WebCore/CSSUnicodeRangeValue.h | 62 + WebCore/CSSUnknownRule.h | 36 + WebCore/CSSValue.h | 78 + WebCore/CSSValueList.h | 77 + WebCore/CSSVariableDependentValue.h | 57 + WebCore/CSSVariablesDeclaration.h | 82 + WebCore/CSSVariablesRule.h | 70 + WebCore/CString.h | 80 + WebCore/Cache.h | 212 ++ WebCore/CachePolicy.h | 40 + WebCore/CachedCSSStyleSheet.h | 68 + WebCore/CachedFont.h | 89 + WebCore/CachedFrame.h | 73 + WebCore/CachedFramePlatformData.h | 45 + WebCore/CachedImage.h | 112 + WebCore/CachedPage.h | 72 + WebCore/CachedResource.h | 252 ++ WebCore/CachedResourceClient.h | 82 + WebCore/CachedResourceClientWalker.h | 49 + WebCore/CachedResourceHandle.h | 92 + WebCore/CachedScript.h | 67 + WebCore/CachedXBLDocument.h | 67 + WebCore/CachedXSLStyleSheet.h | 64 + WebCore/CanvasGradient.h | 66 + WebCore/CanvasPattern.h | 62 + WebCore/CanvasPixelArray.h | 64 + WebCore/CanvasRenderingContext2D.h | 263 ++ WebCore/CanvasStyle.h | 89 + WebCore/CharacterData.h | 75 + WebCore/CharacterNames.h | 63 + WebCore/ChildNodeList.h | 50 + WebCore/Chrome.h | 143 ++ WebCore/ChromeClient.h | 218 ++ WebCore/ClassNames.h | 89 + WebCore/ClassNodeList.h | 55 + WebCore/Clipboard.h | 100 + WebCore/ClipboardAccessPolicy.h | 37 + WebCore/ClipboardEvent.h | 56 + WebCore/CollapsedBorderValue.h | 66 + WebCore/Color.h | 157 ++ WebCore/ColorMac.h | 43 + WebCore/Comment.h | 51 + WebCore/CompositeEditCommand.h | 120 + WebCore/Console.h | 122 + WebCore/ContainerNode.h | 126 + WebCore/ContainerNodeAlgorithms.h | 149 ++ WebCore/ContentData.h | 62 + WebCore/ContentType.h | 47 + WebCore/ContextMenu.h | 89 + WebCore/ContextMenuClient.h | 59 + WebCore/ContextMenuController.h | 61 + WebCore/ContextMenuItem.h | 238 ++ WebCore/CookieJar.h | 41 + WebCore/Coordinates.h | 88 + WebCore/CoreTextController.h | 114 + WebCore/Counter.h | 61 + WebCore/CounterContent.h | 62 + WebCore/CounterDirectives.h | 54 + WebCore/CounterNode.h | 81 + WebCore/CreateLinkCommand.h | 51 + WebCore/Credential.h | 59 + WebCore/CrossOriginAccessControl.h | 41 + WebCore/CrossOriginPreflightResultCache.h | 76 + WebCore/Cursor.h | 106 + WebCore/CursorData.h | 56 + WebCore/CursorList.h | 59 + WebCore/DNS.h | 36 + WebCore/DNSCFNet.cpp | 38 + WebCore/DOM.h | 36 + WebCore/DOMAbstractViewFrame.h | 33 + WebCore/DOMCSS.h | 300 +++ WebCore/DOMCore.h | 45 + WebCore/DOMCoreException.h | 52 + WebCore/DOMCustomXPathNSResolver.h | 56 + WebCore/DOMEventException.h | 39 + WebCore/DOMEvents.h | 46 + WebCore/DOMException.h | 53 + WebCore/DOMExtensions.h | 112 + WebCore/DOMHTML.h | 86 + WebCore/DOMImplementation.h | 72 + WebCore/DOMImplementationFront.h | 61 + WebCore/DOMInternal.h | 95 + WebCore/DOMObject.h | 49 + WebCore/DOMPrivate.h | 131 + WebCore/DOMRangeException.h | 40 + WebCore/DOMRanges.h | 28 + WebCore/DOMSVG.h | 170 ++ WebCore/DOMSVGException.h | 41 + WebCore/DOMSelection.h | 102 + WebCore/DOMStringList.h | 46 + WebCore/DOMStylesheets.h | 33 + WebCore/DOMTimer.h | 68 + WebCore/DOMTraversal.h | 33 + WebCore/DOMUIKitExtensions.h | 42 + WebCore/DOMViews.h | 31 + WebCore/DOMWindow.h | 332 +++ WebCore/DOMXPath.h | 34 + WebCore/DOMXPathException.h | 40 + WebCore/DashArray.h | 39 + WebCore/DashboardRegion.h | 48 + WebCore/DataRef.h | 71 + WebCore/DeleteButton.h | 42 + WebCore/DeleteButtonController.h | 77 + WebCore/DeleteFromTextNodeCommand.h | 56 + WebCore/DeleteSelectionCommand.h | 99 + WebCore/DeprecatedPtrList.h | 113 + WebCore/DeprecatedPtrListImpl.h | 122 + WebCore/DocLoader.h | 138 + WebCore/DocPtr.h | 114 + WebCore/Document.h | 1269 ++++++++++ WebCore/DocumentFragment.h | 46 + WebCore/DocumentIPhone.h | 29 + WebCore/DocumentIPhoneForward.h | 14 + WebCore/DocumentLoader.h | 322 +++ WebCore/DocumentMarker.h | 60 + WebCore/DocumentThreadableLoader.h | 78 + WebCore/DocumentType.h | 70 + WebCore/DragActions.h | 66 + WebCore/DragClient.h | 81 + WebCore/DragController.h | 25 + WebCore/DragData.h | 91 + WebCore/DragImage.h | 90 + WebCore/DynamicNodeList.h | 81 + WebCore/EditAction.h | 72 + WebCore/EditCommand.h | 95 + WebCore/EditingText.h | 44 + WebCore/Editor.h | 305 +++ WebCore/EditorClient.h | 152 ++ WebCore/EditorDeleteAction.h | 40 + WebCore/EditorInsertAction.h | 40 + WebCore/Element.h | 256 ++ WebCore/ElementRareData.h | 59 + WebCore/EllipsisBox.h | 53 + WebCore/EmptyClients.h | 385 +++ WebCore/Entity.h | 43 + WebCore/EntityReference.h | 43 + WebCore/Event.h | 175 ++ WebCore/EventException.h | 59 + WebCore/EventHandler.h | 379 +++ WebCore/EventListener.h | 55 + WebCore/EventLoop.h | 49 + WebCore/EventNames.h | 162 ++ WebCore/EventTarget.h | 105 + WebCore/EventTargetNode.h | 228 ++ WebCore/ExceptionBase.h | 57 + WebCore/ExceptionCode.h | 87 + WebCore/ExceptionHandlers.h | 58 + WebCore/FTPDirectoryDocument.h | 48 + WebCore/FTPDirectoryParser.h | 157 ++ WebCore/File.h | 56 + WebCore/FileChooser.h | 80 + WebCore/FileList.h | 59 + WebCore/FileSystem.h | 176 ++ WebCore/FillLayer.h | 161 ++ WebCore/FixedTableLayout.h | 49 + WebCore/FloatConversion.h | 61 + WebCore/FloatPoint.h | 147 ++ WebCore/FloatPoint3D.h | 58 + WebCore/FloatQuad.h | 146 ++ WebCore/FloatRect.h | 184 ++ WebCore/FloatSize.h | 128 + WebCore/FocusController.h | 64 + WebCore/FocusDirection.h | 36 + WebCore/Font.h | 203 ++ WebCore/FontCache.h | 103 + WebCore/FontCustomPlatformData.h | 50 + WebCore/FontData.h | 60 + WebCore/FontDescription.h | 148 ++ WebCore/FontFallbackList.h | 79 + WebCore/FontFamily.h | 88 + WebCore/FontFamilyValue.h | 50 + WebCore/FontPlatformData.h | 118 + WebCore/FontRenderingMode.h | 37 + WebCore/FontSelector.h | 47 + WebCore/FontTraitsMask.h | 70 + WebCore/FontValue.h | 57 + WebCore/FormControlElement.h | 47 + WebCore/FormControlElementWithState.h | 53 + WebCore/FormData.h | 110 + WebCore/FormDataBuilder.h | 77 + WebCore/FormDataList.h | 69 + WebCore/FormDataStreamCFNet.cpp | 422 ++++ WebCore/FormDataStreamCFNet.h | 44 + WebCore/FormState.h | 59 + WebCore/FormatBlockCommand.h | 52 + WebCore/Frame.h | 514 ++++ WebCore/FrameLoadRequest.h | 66 + WebCore/FrameLoader.h | 683 +++++ WebCore/FrameLoaderClient.h | 226 ++ WebCore/FrameLoaderTypes.h | 78 + WebCore/FrameTree.h | 87 + WebCore/FrameView.h | 279 ++ WebCore/GapRects.h | 62 + WebCore/GeneratedImage.h | 76 + WebCore/Generator.h | 45 + WebCore/GenericWorkerTask.h | 109 + WebCore/Geolocation.h | 130 + WebCore/GeolocationService.h | 76 + WebCore/Geoposition.h | 60 + WebCore/GestureEvent.h | 67 + WebCore/GlyphBuffer.h | 191 ++ WebCore/GlyphPageTreeNode.h | 177 ++ WebCore/GlyphWidthMap.h | 74 + WebCore/Gradient.h | 114 + WebCore/GraphicsContext.h | 398 +++ WebCore/GraphicsContextPrivate.h | 122 + WebCore/GraphicsLayer.h | 417 +++ WebCore/GraphicsLayerCA.h | 138 + WebCore/GraphicsLayerClient.h | 69 + WebCore/GraphicsTypes.h | 80 + WebCore/HTMLAnchorElement.h | 108 + WebCore/HTMLAppletElement.h | 81 + WebCore/HTMLAreaElement.h | 85 + WebCore/HTMLAudioElement.h | 46 + WebCore/HTMLBRElement.h | 51 + WebCore/HTMLBaseElement.h | 57 + WebCore/HTMLBaseFontElement.h | 49 + WebCore/HTMLBlockquoteElement.h | 43 + WebCore/HTMLBodyElement.h | 81 + WebCore/HTMLButtonElement.h | 73 + WebCore/HTMLCanvasElement.h | 131 + WebCore/HTMLCollection.h | 159 ++ WebCore/HTMLDListElement.h | 43 + WebCore/HTMLDirectoryElement.h | 43 + WebCore/HTMLDivElement.h | 46 + WebCore/HTMLDocument.h | 112 + WebCore/HTMLElement.h | 121 + WebCore/HTMLElementFactory.h | 47 + WebCore/HTMLEmbedElement.h | 71 + WebCore/HTMLFieldSetElement.h | 56 + WebCore/HTMLFontElement.h | 53 + WebCore/HTMLFormCollection.h | 66 + WebCore/HTMLFormControlElement.h | 140 ++ WebCore/HTMLFormElement.h | 166 ++ WebCore/HTMLFrameElement.h | 60 + WebCore/HTMLFrameElementBase.h | 109 + WebCore/HTMLFrameOwnerElement.h | 68 + WebCore/HTMLFrameSetElement.h | 93 + WebCore/HTMLHRElement.h | 55 + WebCore/HTMLHeadElement.h | 50 + WebCore/HTMLHeadingElement.h | 45 + WebCore/HTMLHtmlElement.h | 53 + WebCore/HTMLIFrameElement.h | 68 + WebCore/HTMLImageElement.h | 132 + WebCore/HTMLImageLoader.h | 45 + WebCore/HTMLInputElement.h | 249 ++ WebCore/HTMLInterchange.h | 46 + WebCore/HTMLIsIndexElement.h | 49 + WebCore/HTMLKeygenElement.h | 48 + WebCore/HTMLLIElement.h | 53 + WebCore/HTMLLabelElement.h | 65 + WebCore/HTMLLegendElement.h | 57 + WebCore/HTMLLinkElement.h | 119 + WebCore/HTMLMapElement.h | 59 + WebCore/HTMLMarqueeElement.h | 59 + WebCore/HTMLMediaElement.h | 286 +++ WebCore/HTMLMenuElement.h | 43 + WebCore/HTMLMetaElement.h | 64 + WebCore/HTMLModElement.h | 50 + WebCore/HTMLNameCollection.h | 50 + WebCore/HTMLOListElement.h | 56 + WebCore/HTMLObjectElement.h | 119 + WebCore/HTMLOptGroupElement.h | 71 + WebCore/HTMLOptionElement.h | 92 + WebCore/HTMLOptionsCollection.h | 55 + WebCore/HTMLParagraphElement.h | 46 + WebCore/HTMLParamElement.h | 66 + WebCore/HTMLParser.h | 197 ++ WebCore/HTMLParserErrorCodes.h | 71 + WebCore/HTMLParserQuirks.h | 49 + WebCore/HTMLPlugInElement.h | 87 + WebCore/HTMLPlugInImageElement.h | 49 + WebCore/HTMLPreElement.h | 50 + WebCore/HTMLQuoteElement.h | 45 + WebCore/HTMLScriptElement.h | 93 + WebCore/HTMLSelectElement.h | 186 ++ WebCore/HTMLSourceElement.h | 59 + WebCore/HTMLStyleElement.h | 74 + WebCore/HTMLTableCaptionElement.h | 50 + WebCore/HTMLTableCellElement.h | 118 + WebCore/HTMLTableColElement.h | 77 + WebCore/HTMLTableElement.h | 131 + WebCore/HTMLTablePartElement.h | 47 + WebCore/HTMLTableRowElement.h | 72 + WebCore/HTMLTableRowsCollection.h | 54 + WebCore/HTMLTableSectionElement.h | 66 + WebCore/HTMLTextAreaElement.h | 111 + WebCore/HTMLTitleElement.h | 52 + WebCore/HTMLTokenizer.h | 425 ++++ WebCore/HTMLUListElement.h | 49 + WebCore/HTMLVideoElement.h | 77 + WebCore/HTMLViewSourceDocument.h | 65 + WebCore/HTTPHeaderMap.h | 52 + WebCore/HTTPParsers.h | 42 + WebCore/History.h | 56 + WebCore/HistoryItem.h | 250 ++ WebCore/HitTestRequest.h | 44 + WebCore/HitTestResult.h | 94 + WebCore/HostWindow.h | 66 + WebCore/Icon.h | 70 + WebCore/IdentityTransformOperation.h | 67 + WebCore/Image.h | 179 ++ WebCore/ImageBuffer.h | 90 + WebCore/ImageData.h | 55 + WebCore/ImageDocument.h | 76 + WebCore/ImageLoader.h | 79 + WebCore/ImageObserver.h | 54 + WebCore/ImageSource.h | 147 ++ WebCore/IndentOutdentCommand.h | 60 + WebCore/InlineBox.h | 319 +++ WebCore/InlineFlowBox.h | 171 ++ WebCore/InlineRunBox.h | 54 + WebCore/InlineTextBox.h | 145 ++ WebCore/InputElement.h | 125 + WebCore/InsertIntoTextNodeCommand.h | 55 + WebCore/InsertLineBreakCommand.h | 54 + WebCore/InsertListCommand.h | 64 + WebCore/InsertNodeBeforeCommand.h | 52 + WebCore/InsertParagraphSeparatorCommand.h | 59 + WebCore/InsertTextCommand.h | 61 + WebCore/IntPoint.h | 169 ++ WebCore/IntRect.h | 204 ++ WebCore/IntSize.h | 159 ++ WebCore/IntSizeHash.h | 46 + WebCore/JoinTextNodesCommand.h | 54 + WebCore/KURL.h | 353 +++ WebCore/KURLHash.h | 61 + WebCore/KeyboardEvent.h | 116 + WebCore/KeyframeList.h | 90 + WebCore/Language.h | 37 + WebCore/LayoutState.h | 80 + WebCore/Length.h | 197 ++ WebCore/LengthBox.h | 85 + WebCore/LengthSize.h | 58 + WebCore/LinkHash.h | 67 + WebCore/ListMarkerBox.h | 41 + WebCore/LocalizedStrings.h | 55 + WebCore/Location.h | 71 + WebCore/Logging.h | 62 + WebCore/MIMETypeRegistry.h | 78 + WebCore/MainResourceLoader.h | 104 + WebCore/MappedAttribute.h | 68 + WebCore/MappedAttributeEntry.h | 55 + WebCore/Matrix3DTransformOperation.h | 72 + WebCore/MatrixTransformOperation.h | 99 + WebCore/MediaControlElements.h | 155 ++ WebCore/MediaDocument.h | 54 + WebCore/MediaError.h | 52 + WebCore/MediaFeatureNames.h | 73 + WebCore/MediaList.h | 92 + WebCore/MediaPlayer.h | 192 ++ WebCore/MediaPlayerPrivate.h | 96 + WebCore/MediaPlayerPrivateQTKit.h | 157 ++ WebCore/MediaPlayerProxy.h | 118 + WebCore/MediaQuery.h | 62 + WebCore/MediaQueryEvaluator.h | 91 + WebCore/MediaQueryExp.h | 68 + WebCore/MergeIdenticalElementsCommand.h | 53 + WebCore/MessageChannel.h | 56 + WebCore/MessageEvent.h | 73 + WebCore/MessagePort.h | 136 + WebCore/ModifySelectionListLevel.h | 80 + WebCore/MouseEvent.h | 87 + WebCore/MouseEventWithHitTestResults.h | 51 + WebCore/MouseRelatedEvent.h | 78 + WebCore/MoveSelectionCommand.h | 55 + WebCore/MutationEvent.h | 77 + WebCore/NameNodeList.h | 52 + WebCore/NamedAttrMap.h | 110 + WebCore/NamedMappedAttrMap.h | 62 + WebCore/NamedNodeMap.h | 64 + WebCore/NavigationAction.h | 61 + WebCore/Navigator.h | 70 + WebCore/NavigatorBase.h | 54 + WebCore/NetscapePlugInStreamLoader.h | 70 + WebCore/NetworkStateNotifier.h | 65 + WebCore/NinePieceImage.h | 70 + WebCore/Node.h | 597 +++++ WebCore/NodeFilter.h | 88 + WebCore/NodeFilterCondition.h | 44 + WebCore/NodeIterator.h | 82 + WebCore/NodeList.h | 46 + WebCore/NodeRareData.h | 118 + WebCore/NodeRenderStyle.h | 40 + WebCore/NodeWithIndex.h | 64 + WebCore/NotImplemented.h | 55 + WebCore/Notation.h | 55 + WebCore/ObjCEventListener.h | 55 + WebCore/ObjCNodeFilterCondition.h | 60 + WebCore/OptionElement.h | 80 + WebCore/OptionGroupElement.h | 43 + WebCore/OutlineValue.h | 56 + WebCore/OverflowEvent.h | 69 + WebCore/Page.h | 266 ++ WebCore/PageCache.h | 83 + WebCore/PageGroup.h | 87 + WebCore/Pair.h | 65 + WebCore/ParserUtilities.h | 54 + WebCore/Pasteboard.h | 135 + WebCore/Path.h | 140 ++ WebCore/PathTraversalState.h | 72 + WebCore/Pattern.h | 82 + WebCore/Pen.h | 72 + WebCore/PerspectiveTransformOperation.h | 71 + WebCore/PlatformKeyboardEvent.h | 187 ++ WebCore/PlatformMenuDescription.h | 64 + WebCore/PlatformMouseEvent.h | 165 ++ WebCore/PlatformScreen.h | 58 + WebCore/PlatformString.h | 375 +++ WebCore/PlatformTouchEvent.h | 51 + WebCore/PlatformWheelEvent.h | 139 + WebCore/PluginDocument.h | 48 + WebCore/PointerEventsHitRules.h | 50 + WebCore/PopupMenu.h | 185 ++ WebCore/PopupMenuClient.h | 67 + WebCore/PopupMenuStyle.h | 58 + WebCore/Position.h | 135 + WebCore/PositionCallback.h | 44 + WebCore/PositionError.h | 62 + WebCore/PositionErrorCallback.h | 44 + WebCore/PositionIterator.h | 74 + WebCore/PositionOptions.h | 60 + WebCore/PreloadScanner.h | 144 ++ WebCore/PrintContext.h | 57 + WebCore/ProcessingInstruction.h | 100 + WebCore/ProgressEvent.h | 69 + WebCore/ProgressTracker.h | 80 + WebCore/ProtectionSpace.h | 81 + WebCore/PublicDOMInterfaces.h | 1082 ++++++++ WebCore/PublicDOMInterfacesIPhone.h | 46 + WebCore/PurgeableBuffer.h | 76 + WebCore/QualifiedName.h | 169 ++ WebCore/Range.h | 150 ++ WebCore/RangeBoundaryPoint.h | 182 ++ WebCore/RangeException.h | 58 + WebCore/Rect.h | 62 + WebCore/RegisteredEventListener.h | 58 + WebCore/RegularExpression.h | 55 + WebCore/RemoveCSSPropertyCommand.h | 55 + WebCore/RemoveFormatCommand.h | 49 + WebCore/RemoveNodeCommand.h | 53 + WebCore/RemoveNodePreservingChildrenCommand.h | 50 + WebCore/RenderApplet.h | 52 + WebCore/RenderArena.h | 64 + WebCore/RenderBR.h | 71 + WebCore/RenderBlock.h | 473 ++++ WebCore/RenderBox.h | 417 +++ WebCore/RenderBoxModelObject.h | 130 + WebCore/RenderButton.h | 79 + WebCore/RenderContainer.h | 82 + WebCore/RenderCounter.h | 54 + WebCore/RenderFieldset.h | 59 + WebCore/RenderFileUploadControl.h | 67 + WebCore/RenderFlexibleBox.h | 66 + WebCore/RenderFlow.h | 152 ++ WebCore/RenderForeignObject.h | 61 + WebCore/RenderFrame.h | 51 + WebCore/RenderFrameSet.h | 126 + WebCore/RenderHTMLCanvas.h | 52 + WebCore/RenderImage.h | 110 + WebCore/RenderImageGeneratedContent.h | 64 + WebCore/RenderInline.h | 89 + WebCore/RenderLayer.h | 647 +++++ WebCore/RenderLayerBacking.h | 174 ++ WebCore/RenderLayerCompositor.h | 147 ++ WebCore/RenderLegend.h | 42 + WebCore/RenderListBox.h | 131 + WebCore/RenderListItem.h | 83 + WebCore/RenderListMarker.h | 85 + WebCore/RenderMarquee.h | 97 + WebCore/RenderMedia.h | 124 + WebCore/RenderMenuList.h | 119 + WebCore/RenderObject.h | 888 +++++++ WebCore/RenderPart.h | 62 + WebCore/RenderPartObject.h | 54 + WebCore/RenderPath.h | 93 + WebCore/RenderReplaced.h | 87 + WebCore/RenderReplica.h | 53 + WebCore/RenderSVGBlock.h | 41 + WebCore/RenderSVGContainer.h | 124 + WebCore/RenderSVGGradientStop.h | 59 + WebCore/RenderSVGHiddenContainer.h | 67 + WebCore/RenderSVGImage.h | 75 + WebCore/RenderSVGInline.h | 41 + WebCore/RenderSVGInlineText.h | 61 + WebCore/RenderSVGRoot.h | 82 + WebCore/RenderSVGTSpan.h | 41 + WebCore/RenderSVGText.h | 71 + WebCore/RenderSVGTextPath.h | 55 + WebCore/RenderSVGTransformableContainer.h | 39 + WebCore/RenderSVGViewportContainer.h | 64 + WebCore/RenderScrollbar.h | 83 + WebCore/RenderScrollbarPart.h | 68 + WebCore/RenderScrollbarTheme.h | 82 + WebCore/RenderSelectionInfo.h | 104 + WebCore/RenderSlider.h | 73 + WebCore/RenderStyle.h | 1184 +++++++++ WebCore/RenderStyleConstants.h | 318 +++ WebCore/RenderTable.h | 228 ++ WebCore/RenderTableCell.h | 134 + WebCore/RenderTableCol.h | 61 + WebCore/RenderTableRow.h | 68 + WebCore/RenderTableSection.h | 157 ++ WebCore/RenderText.h | 208 ++ WebCore/RenderTextControl.h | 125 + WebCore/RenderTextControlMultiLine.h | 54 + WebCore/RenderTextControlSingleLine.h | 127 + WebCore/RenderTextFragment.h | 64 + WebCore/RenderTheme.h | 265 ++ WebCore/RenderThemeChromiumGtk.h | 136 + WebCore/RenderThemeChromiumMac.h | 210 ++ WebCore/RenderThemeChromiumWin.h | 136 + WebCore/RenderThemeIPhone.h | 65 + WebCore/RenderThemeMac.h | 21 + WebCore/RenderThemeSafari.h | 181 ++ WebCore/RenderThemeWin.h | 149 ++ WebCore/RenderTreeAsText.h | 43 + WebCore/RenderVideo.h | 75 + WebCore/RenderView.h | 265 ++ WebCore/RenderWidget.h | 77 + WebCore/RenderWordBreak.h | 46 + WebCore/ReplaceSelectionCommand.h | 96 + WebCore/Request.h | 63 + WebCore/ResourceError.h | 73 + WebCore/ResourceErrorBase.h | 88 + WebCore/ResourceErrorCF.cpp | 164 ++ WebCore/ResourceHandle.h | 203 ++ WebCore/ResourceHandleCFNet.cpp | 634 +++++ WebCore/ResourceHandleClient.h | 97 + WebCore/ResourceHandleInternal.h | 218 ++ WebCore/ResourceLoader.h | 159 ++ WebCore/ResourceRequest.h | 77 + WebCore/ResourceRequestBase.h | 173 ++ WebCore/ResourceRequestCFNet.cpp | 172 ++ WebCore/ResourceRequestCFNet.h | 39 + WebCore/ResourceResponse.h | 69 + WebCore/ResourceResponseBase.h | 176 ++ WebCore/ResourceResponseCFNet.cpp | 117 + WebCore/ResourceResponseCFNet.h | 39 + WebCore/RootInlineBox.h | 206 ++ WebCore/RotateTransformOperation.h | 87 + WebCore/RuntimeApplicationChecksIPhone.h | 35 + WebCore/SSLKeyGenerator.h | 41 + WebCore/SVGCharacterLayoutInfo.h | 416 +++ WebCore/SVGInlineFlowBox.h | 48 + WebCore/SVGInlineTextBox.h | 75 + WebCore/SVGRenderStyle.h | 215 ++ WebCore/SVGRenderStyleDefs.h | 292 +++ WebCore/SVGRenderSupport.h | 42 + WebCore/SVGRenderTreeAsText.h | 111 + WebCore/SVGRootInlineBox.h | 99 + WebCore/ScaleTransformOperation.h | 87 + WebCore/SchedulePair.h | 88 + WebCore/Screen.h | 62 + WebCore/ScriptElement.h | 100 + WebCore/ScriptExecutionContext.h | 119 + WebCore/ScrollTypes.h | 89 + WebCore/ScrollView.h | 339 +++ WebCore/Scrollbar.h | 167 ++ WebCore/ScrollbarClient.h | 51 + WebCore/ScrollbarTheme.h | 94 + WebCore/ScrollbarThemeComposite.h | 71 + WebCore/SearchPopupMenu.h | 46 + WebCore/SecurityOrigin.h | 141 ++ WebCore/SecurityOriginHash.h | 81 + WebCore/SegmentedFontData.h | 77 + WebCore/SegmentedString.h | 176 ++ WebCore/Selection.h | 136 + WebCore/SelectionController.h | 219 ++ WebCore/SelectionRect.h | 62 + WebCore/SelectorNodeList.h | 42 + WebCore/SetNodeAttributeCommand.h | 55 + WebCore/Settings.h | 291 +++ WebCore/ShadowData.h | 71 + WebCore/ShadowValue.h | 59 + WebCore/SharedBuffer.h | 112 + WebCore/SharedTimer.h | 44 + WebCore/SimpleFontData.h | 205 ++ WebCore/SkewTransformOperation.h | 74 + WebCore/SmartReplace.h | 35 + WebCore/Sound.h | 35 + WebCore/SplitElementCommand.h | 53 + WebCore/SplitTextNodeCommand.h | 55 + .../SplitTextNodeContainingElementCommand.h | 51 + WebCore/StaticConstructors.h | 76 + WebCore/StaticNodeList.h | 63 + WebCore/StaticStringList.h | 61 + WebCore/StringBuffer.h | 77 + WebCore/StringBuilder.h | 57 + WebCore/StringHash.h | 250 ++ WebCore/StringImpl.h | 293 +++ WebCore/StringTruncator.h | 51 + WebCore/StrokeStyleApplier.h | 38 + WebCore/StyleBackgroundData.h | 59 + WebCore/StyleBase.h | 86 + WebCore/StyleBoxData.h | 67 + WebCore/StyleCachedImage.h | 67 + WebCore/StyleDashboardRegion.h | 61 + WebCore/StyleElement.h | 56 + WebCore/StyleFlexibleBoxData.h | 60 + WebCore/StyleGeneratedImage.h | 69 + WebCore/StyleImage.h | 81 + WebCore/StyleInheritedData.h | 81 + WebCore/StyleList.h | 49 + WebCore/StyleMarqueeData.h | 61 + WebCore/StyleMultiColData.h | 75 + WebCore/StyleRareInheritedData.h | 82 + WebCore/StyleRareNonInheritedData.h | 131 + WebCore/StyleReflection.h | 70 + WebCore/StyleSheet.h | 77 + WebCore/StyleSheetList.h | 63 + WebCore/StyleSurroundData.h | 58 + WebCore/StyleTransformData.h | 58 + WebCore/StyleVisualData.h | 67 + WebCore/StyledElement.h | 96 + WebCore/SubresourceLoader.h | 66 + WebCore/SubresourceLoaderClient.h | 61 + WebCore/SubstituteData.h | 69 + WebCore/SubstituteResource.h | 64 + WebCore/SystemMemory.h | 41 + WebCore/SystemTime.h | 36 + WebCore/TableLayout.h | 48 + WebCore/TagNodeList.h | 51 + WebCore/Text.h | 76 + WebCore/TextAffinity.h | 56 + WebCore/TextBoundaries.h | 41 + WebCore/TextBreakIterator.h | 60 + WebCore/TextBreakIteratorInternalICU.h | 32 + WebCore/TextCodec.h | 84 + WebCore/TextCodecICU.h | 79 + WebCore/TextCodecLatin1.h | 44 + WebCore/TextCodecUTF16.h | 51 + WebCore/TextCodecUserDefined.h | 44 + WebCore/TextControlInnerElements.h | 73 + WebCore/TextDecoder.h | 64 + WebCore/TextDirection.h | 35 + WebCore/TextDocument.h | 51 + WebCore/TextEncoding.h | 98 + WebCore/TextEncodingRegistry.h | 53 + WebCore/TextEvent.h | 71 + WebCore/TextGranularity.h | 47 + WebCore/TextIterator.h | 272 ++ WebCore/TextMetrics.h | 50 + WebCore/TextResourceDecoder.h | 80 + WebCore/TextRun.h | 126 + WebCore/TextSizeAdjustment.h | 44 + WebCore/TextStream.h | 61 + WebCore/Theme.h | 122 + WebCore/ThemeTypes.h | 76 + WebCore/ThreadCheck.h | 31 + WebCore/ThreadGlobalData.h | 69 + WebCore/ThreadableLoader.h | 75 + WebCore/ThreadableLoaderClient.h | 56 + WebCore/TimeRanges.h | 74 + WebCore/Timer.h | 106 + WebCore/TimingFunction.h | 74 + WebCore/Tokenizer.h | 80 + WebCore/Touch.h | 72 + WebCore/TouchEvent.h | 77 + WebCore/TouchList.h | 48 + WebCore/TransformOperation.h | 86 + WebCore/TransformOperations.h | 69 + WebCore/TransformState.h | 133 + WebCore/TransformationMatrix.h | 318 +++ WebCore/TranslateTransformOperation.h | 88 + WebCore/Traversal.h | 57 + WebCore/TreeShared.h | 108 + WebCore/TreeWalker.h | 75 + WebCore/TypingCommand.h | 105 + WebCore/UIEvent.h | 75 + WebCore/UIEventWithKeyState.h | 68 + WebCore/UnicodeRange.h | 120 + WebCore/UnitBezier.h | 123 + WebCore/UnlinkCommand.h | 49 + WebCore/UserStyleSheetLoader.h | 57 + WebCore/VisiblePosition.h | 147 ++ WebCore/VoidCallback.h | 45 + WebCore/WAKAppKitStubs.h | 234 ++ WebCore/WAKClipView.h | 20 + WebCore/WAKResponder.h | 55 + WebCore/WAKScrollView.h | 63 + WebCore/WAKStringDrawing.h | 57 + WebCore/WAKView.h | 108 + WebCore/WAKViewPrivate.h | 16 + WebCore/WAKWindow.h | 84 + WebCore/WAKWindowPrivate.h | 11 + WebCore/WKClipView.h | 35 + WebCore/WKContentObservation.h | 40 + WebCore/WKGraphics.h | 54 + WebCore/WKGraphicsPrivate.h | 5 + WebCore/WKScreen.h | 17 + WebCore/WKScrollView.h | 52 + WebCore/WKTypes.h | 20 + WebCore/WKUtilities.h | 54 + WebCore/WKView.h | 161 ++ WebCore/WKViewPrivate.h | 27 + WebCore/WKWindow.h | 86 + WebCore/WKWindowPrivate.h | 19 + WebCore/WebCoreTelephoneParser.h | 27 + WebCore/WebCoreThread.h | 64 + WebCore/WebCoreThreadMessage.h | 46 + WebCore/WebCoreThreadSafe.h | 45 + WebCore/WebKitAnimationEvent.h | 67 + WebCore/WebKitCSSKeyframeRule.h | 85 + WebCore/WebKitCSSKeyframesRule.h | 95 + WebCore/WebKitCSSMatrix.h | 159 ++ WebCore/WebKitCSSTransformValue.h | 84 + WebCore/WebKitPoint.h | 63 + WebCore/WebKitTransitionEvent.h | 67 + WebCore/WebLayer.h | 61 + WebCore/WebScriptObject.h | 318 +++ WebCore/WebScriptObjectPrivate.h | 73 + WebCore/WebTiledLayer.h | 45 + WebCore/WheelEvent.h | 71 + WebCore/Widget.h | 208 ++ WebCore/WidthIterator.h | 56 + WebCore/WindowFeatures.h | 83 + WebCore/Worker.h | 113 + WebCore/WorkerContext.h | 124 + WebCore/WorkerLocation.h | 73 + WebCore/WorkerMessagingProxy.h | 96 + WebCore/WorkerNavigator.h | 56 + WebCore/WorkerRunLoop.h | 64 + WebCore/WorkerTask.h | 48 + WebCore/WorkerThread.h | 78 + WebCore/WrapContentsInDummySpanCommand.h | 54 + WebCore/XMLTokenizer.h | 183 ++ WebCore/XMLTokenizerScope.h | 62 + WebCore/bidi.h | 65 + WebCore/break_lines.h | 41 + WebCore/htmlediting.h | 139 + WebCore/loader.h | 121 + WebCore/markup.h | 56 + WebCore/visible_units.h | 91 + 819 files changed, 85782 insertions(+) create mode 100644 WebCore/AXObjectCache.h create mode 100644 WebCore/AccessibilityImageMapLink.h create mode 100644 WebCore/AccessibilityList.h create mode 100644 WebCore/AccessibilityListBox.h create mode 100644 WebCore/AccessibilityListBoxOption.h create mode 100644 WebCore/AccessibilityObject.h create mode 100644 WebCore/AccessibilityRenderObject.h create mode 100644 WebCore/AccessibilityTable.h create mode 100644 WebCore/AccessibilityTableCell.h create mode 100644 WebCore/AccessibilityTableColumn.h create mode 100644 WebCore/AccessibilityTableHeaderContainer.h create mode 100644 WebCore/AccessibilityTableRow.h create mode 100644 WebCore/ActiveDOMObject.h create mode 100644 WebCore/Animation.h create mode 100644 WebCore/AnimationList.h create mode 100644 WebCore/AppendNodeCommand.h create mode 100644 WebCore/ApplyStyleCommand.h create mode 100644 WebCore/Arena.h create mode 100644 WebCore/AtomicString.h create mode 100644 WebCore/AtomicStringHash.h create mode 100644 WebCore/AtomicStringImpl.h create mode 100644 WebCore/Attr.h create mode 100644 WebCore/Attribute.h create mode 100644 WebCore/AuthenticationCF.cpp create mode 100644 WebCore/AuthenticationCF.h create mode 100644 WebCore/AuthenticationChallenge.h create mode 100644 WebCore/AuthenticationChallengeBase.h create mode 100644 WebCore/AutoTableLayout.h create mode 100644 WebCore/AutodrainedPool.h create mode 100644 WebCore/BackForwardList.h create mode 100644 WebCore/BarInfo.h create mode 100644 WebCore/Base64.h create mode 100644 WebCore/BeforeTextInsertedEvent.h create mode 100644 WebCore/BeforeUnloadEvent.h create mode 100644 WebCore/BidiContext.h create mode 100644 WebCore/BidiResolver.h create mode 100644 WebCore/BindingURI.h create mode 100644 WebCore/BitmapImage.h create mode 100644 WebCore/BorderData.h create mode 100644 WebCore/BorderValue.h create mode 100644 WebCore/BreakBlockquoteCommand.h create mode 100644 WebCore/CDATASection.h create mode 100644 WebCore/CSSBorderImageValue.h create mode 100644 WebCore/CSSCanvasValue.h create mode 100644 WebCore/CSSCharsetRule.h create mode 100644 WebCore/CSSComputedStyleDeclaration.h create mode 100644 WebCore/CSSCursorImageValue.h create mode 100644 WebCore/CSSFontFace.h create mode 100644 WebCore/CSSFontFaceRule.h create mode 100644 WebCore/CSSFontFaceSource.h create mode 100644 WebCore/CSSFontFaceSrcValue.h create mode 100644 WebCore/CSSFontSelector.h create mode 100644 WebCore/CSSFunctionValue.h create mode 100644 WebCore/CSSGradientValue.h create mode 100644 WebCore/CSSHelper.h create mode 100644 WebCore/CSSImageGeneratorValue.h create mode 100644 WebCore/CSSImageValue.h create mode 100644 WebCore/CSSImportRule.h create mode 100644 WebCore/CSSInheritedValue.h create mode 100644 WebCore/CSSInitialValue.h create mode 100644 WebCore/CSSMappedAttributeDeclaration.h create mode 100644 WebCore/CSSMediaRule.h create mode 100644 WebCore/CSSMutableStyleDeclaration.h create mode 100644 WebCore/CSSNamespace.h create mode 100644 WebCore/CSSPageRule.h create mode 100644 WebCore/CSSParser.h create mode 100644 WebCore/CSSParserValues.h create mode 100644 WebCore/CSSPrimitiveValue.h create mode 100644 WebCore/CSSPrimitiveValueMappings.h create mode 100644 WebCore/CSSProperty.h create mode 100644 WebCore/CSSPropertyLonghand.h create mode 100644 WebCore/CSSPropertyNames.in create mode 100644 WebCore/CSSQuirkPrimitiveValue.h create mode 100644 WebCore/CSSReflectValue.h create mode 100644 WebCore/CSSReflectionDirection.h create mode 100644 WebCore/CSSRule.h create mode 100644 WebCore/CSSRuleList.h create mode 100644 WebCore/CSSSegmentedFontFace.h create mode 100644 WebCore/CSSSelector.h create mode 100644 WebCore/CSSSelectorList.h create mode 100644 WebCore/CSSStyleDeclaration.h create mode 100644 WebCore/CSSStyleRule.h create mode 100644 WebCore/CSSStyleSelector.h create mode 100644 WebCore/CSSStyleSheet.h create mode 100644 WebCore/CSSTimingFunctionValue.h create mode 100644 WebCore/CSSUnicodeRangeValue.h create mode 100644 WebCore/CSSUnknownRule.h create mode 100644 WebCore/CSSValue.h create mode 100644 WebCore/CSSValueList.h create mode 100644 WebCore/CSSVariableDependentValue.h create mode 100644 WebCore/CSSVariablesDeclaration.h create mode 100644 WebCore/CSSVariablesRule.h create mode 100644 WebCore/CString.h create mode 100644 WebCore/Cache.h create mode 100644 WebCore/CachePolicy.h create mode 100644 WebCore/CachedCSSStyleSheet.h create mode 100644 WebCore/CachedFont.h create mode 100644 WebCore/CachedFrame.h create mode 100644 WebCore/CachedFramePlatformData.h create mode 100644 WebCore/CachedImage.h create mode 100644 WebCore/CachedPage.h create mode 100644 WebCore/CachedResource.h create mode 100644 WebCore/CachedResourceClient.h create mode 100644 WebCore/CachedResourceClientWalker.h create mode 100644 WebCore/CachedResourceHandle.h create mode 100644 WebCore/CachedScript.h create mode 100644 WebCore/CachedXBLDocument.h create mode 100644 WebCore/CachedXSLStyleSheet.h create mode 100644 WebCore/CanvasGradient.h create mode 100644 WebCore/CanvasPattern.h create mode 100644 WebCore/CanvasPixelArray.h create mode 100644 WebCore/CanvasRenderingContext2D.h create mode 100644 WebCore/CanvasStyle.h create mode 100644 WebCore/CharacterData.h create mode 100644 WebCore/CharacterNames.h create mode 100644 WebCore/ChildNodeList.h create mode 100644 WebCore/Chrome.h create mode 100644 WebCore/ChromeClient.h create mode 100644 WebCore/ClassNames.h create mode 100644 WebCore/ClassNodeList.h create mode 100644 WebCore/Clipboard.h create mode 100644 WebCore/ClipboardAccessPolicy.h create mode 100644 WebCore/ClipboardEvent.h create mode 100644 WebCore/CollapsedBorderValue.h create mode 100644 WebCore/Color.h create mode 100644 WebCore/ColorMac.h create mode 100644 WebCore/Comment.h create mode 100644 WebCore/CompositeEditCommand.h create mode 100644 WebCore/Console.h create mode 100644 WebCore/ContainerNode.h create mode 100644 WebCore/ContainerNodeAlgorithms.h create mode 100644 WebCore/ContentData.h create mode 100644 WebCore/ContentType.h create mode 100644 WebCore/ContextMenu.h create mode 100644 WebCore/ContextMenuClient.h create mode 100644 WebCore/ContextMenuController.h create mode 100644 WebCore/ContextMenuItem.h create mode 100644 WebCore/CookieJar.h create mode 100644 WebCore/Coordinates.h create mode 100644 WebCore/CoreTextController.h create mode 100644 WebCore/Counter.h create mode 100644 WebCore/CounterContent.h create mode 100644 WebCore/CounterDirectives.h create mode 100644 WebCore/CounterNode.h create mode 100644 WebCore/CreateLinkCommand.h create mode 100644 WebCore/Credential.h create mode 100644 WebCore/CrossOriginAccessControl.h create mode 100644 WebCore/CrossOriginPreflightResultCache.h create mode 100644 WebCore/Cursor.h create mode 100644 WebCore/CursorData.h create mode 100644 WebCore/CursorList.h create mode 100644 WebCore/DNS.h create mode 100644 WebCore/DNSCFNet.cpp create mode 100644 WebCore/DOM.h create mode 100644 WebCore/DOMAbstractViewFrame.h create mode 100644 WebCore/DOMCSS.h create mode 100644 WebCore/DOMCore.h create mode 100644 WebCore/DOMCoreException.h create mode 100644 WebCore/DOMCustomXPathNSResolver.h create mode 100644 WebCore/DOMEventException.h create mode 100644 WebCore/DOMEvents.h create mode 100644 WebCore/DOMException.h create mode 100644 WebCore/DOMExtensions.h create mode 100644 WebCore/DOMHTML.h create mode 100644 WebCore/DOMImplementation.h create mode 100644 WebCore/DOMImplementationFront.h create mode 100644 WebCore/DOMInternal.h create mode 100644 WebCore/DOMObject.h create mode 100644 WebCore/DOMPrivate.h create mode 100644 WebCore/DOMRangeException.h create mode 100644 WebCore/DOMRanges.h create mode 100644 WebCore/DOMSVG.h create mode 100644 WebCore/DOMSVGException.h create mode 100644 WebCore/DOMSelection.h create mode 100644 WebCore/DOMStringList.h create mode 100644 WebCore/DOMStylesheets.h create mode 100644 WebCore/DOMTimer.h create mode 100644 WebCore/DOMTraversal.h create mode 100644 WebCore/DOMUIKitExtensions.h create mode 100644 WebCore/DOMViews.h create mode 100644 WebCore/DOMWindow.h create mode 100644 WebCore/DOMXPath.h create mode 100644 WebCore/DOMXPathException.h create mode 100644 WebCore/DashArray.h create mode 100644 WebCore/DashboardRegion.h create mode 100644 WebCore/DataRef.h create mode 100644 WebCore/DeleteButton.h create mode 100644 WebCore/DeleteButtonController.h create mode 100644 WebCore/DeleteFromTextNodeCommand.h create mode 100644 WebCore/DeleteSelectionCommand.h create mode 100644 WebCore/DeprecatedPtrList.h create mode 100644 WebCore/DeprecatedPtrListImpl.h create mode 100644 WebCore/DocLoader.h create mode 100644 WebCore/DocPtr.h create mode 100644 WebCore/Document.h create mode 100644 WebCore/DocumentFragment.h create mode 100644 WebCore/DocumentIPhone.h create mode 100644 WebCore/DocumentIPhoneForward.h create mode 100644 WebCore/DocumentLoader.h create mode 100644 WebCore/DocumentMarker.h create mode 100644 WebCore/DocumentThreadableLoader.h create mode 100644 WebCore/DocumentType.h create mode 100644 WebCore/DragActions.h create mode 100644 WebCore/DragClient.h create mode 100644 WebCore/DragController.h create mode 100644 WebCore/DragData.h create mode 100644 WebCore/DragImage.h create mode 100644 WebCore/DynamicNodeList.h create mode 100644 WebCore/EditAction.h create mode 100644 WebCore/EditCommand.h create mode 100644 WebCore/EditingText.h create mode 100644 WebCore/Editor.h create mode 100644 WebCore/EditorClient.h create mode 100644 WebCore/EditorDeleteAction.h create mode 100644 WebCore/EditorInsertAction.h create mode 100644 WebCore/Element.h create mode 100644 WebCore/ElementRareData.h create mode 100644 WebCore/EllipsisBox.h create mode 100644 WebCore/EmptyClients.h create mode 100644 WebCore/Entity.h create mode 100644 WebCore/EntityReference.h create mode 100644 WebCore/Event.h create mode 100644 WebCore/EventException.h create mode 100644 WebCore/EventHandler.h create mode 100644 WebCore/EventListener.h create mode 100644 WebCore/EventLoop.h create mode 100644 WebCore/EventNames.h create mode 100644 WebCore/EventTarget.h create mode 100644 WebCore/EventTargetNode.h create mode 100644 WebCore/ExceptionBase.h create mode 100644 WebCore/ExceptionCode.h create mode 100644 WebCore/ExceptionHandlers.h create mode 100644 WebCore/FTPDirectoryDocument.h create mode 100644 WebCore/FTPDirectoryParser.h create mode 100644 WebCore/File.h create mode 100644 WebCore/FileChooser.h create mode 100644 WebCore/FileList.h create mode 100644 WebCore/FileSystem.h create mode 100644 WebCore/FillLayer.h create mode 100644 WebCore/FixedTableLayout.h create mode 100644 WebCore/FloatConversion.h create mode 100644 WebCore/FloatPoint.h create mode 100644 WebCore/FloatPoint3D.h create mode 100644 WebCore/FloatQuad.h create mode 100644 WebCore/FloatRect.h create mode 100644 WebCore/FloatSize.h create mode 100644 WebCore/FocusController.h create mode 100644 WebCore/FocusDirection.h create mode 100644 WebCore/Font.h create mode 100644 WebCore/FontCache.h create mode 100644 WebCore/FontCustomPlatformData.h create mode 100644 WebCore/FontData.h create mode 100644 WebCore/FontDescription.h create mode 100644 WebCore/FontFallbackList.h create mode 100644 WebCore/FontFamily.h create mode 100644 WebCore/FontFamilyValue.h create mode 100644 WebCore/FontPlatformData.h create mode 100644 WebCore/FontRenderingMode.h create mode 100644 WebCore/FontSelector.h create mode 100644 WebCore/FontTraitsMask.h create mode 100644 WebCore/FontValue.h create mode 100644 WebCore/FormControlElement.h create mode 100644 WebCore/FormControlElementWithState.h create mode 100644 WebCore/FormData.h create mode 100644 WebCore/FormDataBuilder.h create mode 100644 WebCore/FormDataList.h create mode 100644 WebCore/FormDataStreamCFNet.cpp create mode 100644 WebCore/FormDataStreamCFNet.h create mode 100644 WebCore/FormState.h create mode 100644 WebCore/FormatBlockCommand.h create mode 100644 WebCore/Frame.h create mode 100644 WebCore/FrameLoadRequest.h create mode 100644 WebCore/FrameLoader.h create mode 100644 WebCore/FrameLoaderClient.h create mode 100644 WebCore/FrameLoaderTypes.h create mode 100644 WebCore/FrameTree.h create mode 100644 WebCore/FrameView.h create mode 100644 WebCore/GapRects.h create mode 100644 WebCore/GeneratedImage.h create mode 100644 WebCore/Generator.h create mode 100644 WebCore/GenericWorkerTask.h create mode 100644 WebCore/Geolocation.h create mode 100644 WebCore/GeolocationService.h create mode 100644 WebCore/Geoposition.h create mode 100644 WebCore/GestureEvent.h create mode 100644 WebCore/GlyphBuffer.h create mode 100644 WebCore/GlyphPageTreeNode.h create mode 100644 WebCore/GlyphWidthMap.h create mode 100644 WebCore/Gradient.h create mode 100644 WebCore/GraphicsContext.h create mode 100644 WebCore/GraphicsContextPrivate.h create mode 100644 WebCore/GraphicsLayer.h create mode 100644 WebCore/GraphicsLayerCA.h create mode 100644 WebCore/GraphicsLayerClient.h create mode 100644 WebCore/GraphicsTypes.h create mode 100644 WebCore/HTMLAnchorElement.h create mode 100644 WebCore/HTMLAppletElement.h create mode 100644 WebCore/HTMLAreaElement.h create mode 100644 WebCore/HTMLAudioElement.h create mode 100644 WebCore/HTMLBRElement.h create mode 100644 WebCore/HTMLBaseElement.h create mode 100644 WebCore/HTMLBaseFontElement.h create mode 100644 WebCore/HTMLBlockquoteElement.h create mode 100644 WebCore/HTMLBodyElement.h create mode 100644 WebCore/HTMLButtonElement.h create mode 100644 WebCore/HTMLCanvasElement.h create mode 100644 WebCore/HTMLCollection.h create mode 100644 WebCore/HTMLDListElement.h create mode 100644 WebCore/HTMLDirectoryElement.h create mode 100644 WebCore/HTMLDivElement.h create mode 100644 WebCore/HTMLDocument.h create mode 100644 WebCore/HTMLElement.h create mode 100644 WebCore/HTMLElementFactory.h create mode 100644 WebCore/HTMLEmbedElement.h create mode 100644 WebCore/HTMLFieldSetElement.h create mode 100644 WebCore/HTMLFontElement.h create mode 100644 WebCore/HTMLFormCollection.h create mode 100644 WebCore/HTMLFormControlElement.h create mode 100644 WebCore/HTMLFormElement.h create mode 100644 WebCore/HTMLFrameElement.h create mode 100644 WebCore/HTMLFrameElementBase.h create mode 100644 WebCore/HTMLFrameOwnerElement.h create mode 100644 WebCore/HTMLFrameSetElement.h create mode 100644 WebCore/HTMLHRElement.h create mode 100644 WebCore/HTMLHeadElement.h create mode 100644 WebCore/HTMLHeadingElement.h create mode 100644 WebCore/HTMLHtmlElement.h create mode 100644 WebCore/HTMLIFrameElement.h create mode 100644 WebCore/HTMLImageElement.h create mode 100644 WebCore/HTMLImageLoader.h create mode 100644 WebCore/HTMLInputElement.h create mode 100644 WebCore/HTMLInterchange.h create mode 100644 WebCore/HTMLIsIndexElement.h create mode 100644 WebCore/HTMLKeygenElement.h create mode 100644 WebCore/HTMLLIElement.h create mode 100644 WebCore/HTMLLabelElement.h create mode 100644 WebCore/HTMLLegendElement.h create mode 100644 WebCore/HTMLLinkElement.h create mode 100644 WebCore/HTMLMapElement.h create mode 100644 WebCore/HTMLMarqueeElement.h create mode 100644 WebCore/HTMLMediaElement.h create mode 100644 WebCore/HTMLMenuElement.h create mode 100644 WebCore/HTMLMetaElement.h create mode 100644 WebCore/HTMLModElement.h create mode 100644 WebCore/HTMLNameCollection.h create mode 100644 WebCore/HTMLOListElement.h create mode 100644 WebCore/HTMLObjectElement.h create mode 100644 WebCore/HTMLOptGroupElement.h create mode 100644 WebCore/HTMLOptionElement.h create mode 100644 WebCore/HTMLOptionsCollection.h create mode 100644 WebCore/HTMLParagraphElement.h create mode 100644 WebCore/HTMLParamElement.h create mode 100644 WebCore/HTMLParser.h create mode 100644 WebCore/HTMLParserErrorCodes.h create mode 100644 WebCore/HTMLParserQuirks.h create mode 100644 WebCore/HTMLPlugInElement.h create mode 100644 WebCore/HTMLPlugInImageElement.h create mode 100644 WebCore/HTMLPreElement.h create mode 100644 WebCore/HTMLQuoteElement.h create mode 100644 WebCore/HTMLScriptElement.h create mode 100644 WebCore/HTMLSelectElement.h create mode 100644 WebCore/HTMLSourceElement.h create mode 100644 WebCore/HTMLStyleElement.h create mode 100644 WebCore/HTMLTableCaptionElement.h create mode 100644 WebCore/HTMLTableCellElement.h create mode 100644 WebCore/HTMLTableColElement.h create mode 100644 WebCore/HTMLTableElement.h create mode 100644 WebCore/HTMLTablePartElement.h create mode 100644 WebCore/HTMLTableRowElement.h create mode 100644 WebCore/HTMLTableRowsCollection.h create mode 100644 WebCore/HTMLTableSectionElement.h create mode 100644 WebCore/HTMLTextAreaElement.h create mode 100644 WebCore/HTMLTitleElement.h create mode 100644 WebCore/HTMLTokenizer.h create mode 100644 WebCore/HTMLUListElement.h create mode 100644 WebCore/HTMLVideoElement.h create mode 100644 WebCore/HTMLViewSourceDocument.h create mode 100644 WebCore/HTTPHeaderMap.h create mode 100644 WebCore/HTTPParsers.h create mode 100644 WebCore/History.h create mode 100644 WebCore/HistoryItem.h create mode 100644 WebCore/HitTestRequest.h create mode 100644 WebCore/HitTestResult.h create mode 100644 WebCore/HostWindow.h create mode 100644 WebCore/Icon.h create mode 100644 WebCore/IdentityTransformOperation.h create mode 100644 WebCore/Image.h create mode 100644 WebCore/ImageBuffer.h create mode 100644 WebCore/ImageData.h create mode 100644 WebCore/ImageDocument.h create mode 100644 WebCore/ImageLoader.h create mode 100644 WebCore/ImageObserver.h create mode 100644 WebCore/ImageSource.h create mode 100644 WebCore/IndentOutdentCommand.h create mode 100644 WebCore/InlineBox.h create mode 100644 WebCore/InlineFlowBox.h create mode 100644 WebCore/InlineRunBox.h create mode 100644 WebCore/InlineTextBox.h create mode 100644 WebCore/InputElement.h create mode 100644 WebCore/InsertIntoTextNodeCommand.h create mode 100644 WebCore/InsertLineBreakCommand.h create mode 100644 WebCore/InsertListCommand.h create mode 100644 WebCore/InsertNodeBeforeCommand.h create mode 100644 WebCore/InsertParagraphSeparatorCommand.h create mode 100644 WebCore/InsertTextCommand.h create mode 100644 WebCore/IntPoint.h create mode 100644 WebCore/IntRect.h create mode 100644 WebCore/IntSize.h create mode 100644 WebCore/IntSizeHash.h create mode 100644 WebCore/JoinTextNodesCommand.h create mode 100644 WebCore/KURL.h create mode 100644 WebCore/KURLHash.h create mode 100644 WebCore/KeyboardEvent.h create mode 100644 WebCore/KeyframeList.h create mode 100644 WebCore/Language.h create mode 100644 WebCore/LayoutState.h create mode 100644 WebCore/Length.h create mode 100644 WebCore/LengthBox.h create mode 100644 WebCore/LengthSize.h create mode 100644 WebCore/LinkHash.h create mode 100644 WebCore/ListMarkerBox.h create mode 100644 WebCore/LocalizedStrings.h create mode 100644 WebCore/Location.h create mode 100644 WebCore/Logging.h create mode 100644 WebCore/MIMETypeRegistry.h create mode 100644 WebCore/MainResourceLoader.h create mode 100644 WebCore/MappedAttribute.h create mode 100644 WebCore/MappedAttributeEntry.h create mode 100644 WebCore/Matrix3DTransformOperation.h create mode 100644 WebCore/MatrixTransformOperation.h create mode 100644 WebCore/MediaControlElements.h create mode 100644 WebCore/MediaDocument.h create mode 100644 WebCore/MediaError.h create mode 100644 WebCore/MediaFeatureNames.h create mode 100644 WebCore/MediaList.h create mode 100644 WebCore/MediaPlayer.h create mode 100644 WebCore/MediaPlayerPrivate.h create mode 100644 WebCore/MediaPlayerPrivateQTKit.h create mode 100644 WebCore/MediaPlayerProxy.h create mode 100644 WebCore/MediaQuery.h create mode 100644 WebCore/MediaQueryEvaluator.h create mode 100644 WebCore/MediaQueryExp.h create mode 100644 WebCore/MergeIdenticalElementsCommand.h create mode 100644 WebCore/MessageChannel.h create mode 100644 WebCore/MessageEvent.h create mode 100644 WebCore/MessagePort.h create mode 100644 WebCore/ModifySelectionListLevel.h create mode 100644 WebCore/MouseEvent.h create mode 100644 WebCore/MouseEventWithHitTestResults.h create mode 100644 WebCore/MouseRelatedEvent.h create mode 100644 WebCore/MoveSelectionCommand.h create mode 100644 WebCore/MutationEvent.h create mode 100644 WebCore/NameNodeList.h create mode 100644 WebCore/NamedAttrMap.h create mode 100644 WebCore/NamedMappedAttrMap.h create mode 100644 WebCore/NamedNodeMap.h create mode 100644 WebCore/NavigationAction.h create mode 100644 WebCore/Navigator.h create mode 100644 WebCore/NavigatorBase.h create mode 100644 WebCore/NetscapePlugInStreamLoader.h create mode 100644 WebCore/NetworkStateNotifier.h create mode 100644 WebCore/NinePieceImage.h create mode 100644 WebCore/Node.h create mode 100644 WebCore/NodeFilter.h create mode 100644 WebCore/NodeFilterCondition.h create mode 100644 WebCore/NodeIterator.h create mode 100644 WebCore/NodeList.h create mode 100644 WebCore/NodeRareData.h create mode 100644 WebCore/NodeRenderStyle.h create mode 100644 WebCore/NodeWithIndex.h create mode 100644 WebCore/NotImplemented.h create mode 100644 WebCore/Notation.h create mode 100644 WebCore/ObjCEventListener.h create mode 100644 WebCore/ObjCNodeFilterCondition.h create mode 100644 WebCore/OptionElement.h create mode 100644 WebCore/OptionGroupElement.h create mode 100644 WebCore/OutlineValue.h create mode 100644 WebCore/OverflowEvent.h create mode 100644 WebCore/Page.h create mode 100644 WebCore/PageCache.h create mode 100644 WebCore/PageGroup.h create mode 100644 WebCore/Pair.h create mode 100644 WebCore/ParserUtilities.h create mode 100644 WebCore/Pasteboard.h create mode 100644 WebCore/Path.h create mode 100644 WebCore/PathTraversalState.h create mode 100644 WebCore/Pattern.h create mode 100644 WebCore/Pen.h create mode 100644 WebCore/PerspectiveTransformOperation.h create mode 100644 WebCore/PlatformKeyboardEvent.h create mode 100644 WebCore/PlatformMenuDescription.h create mode 100644 WebCore/PlatformMouseEvent.h create mode 100644 WebCore/PlatformScreen.h create mode 100644 WebCore/PlatformString.h create mode 100644 WebCore/PlatformTouchEvent.h create mode 100644 WebCore/PlatformWheelEvent.h create mode 100644 WebCore/PluginDocument.h create mode 100644 WebCore/PointerEventsHitRules.h create mode 100644 WebCore/PopupMenu.h create mode 100644 WebCore/PopupMenuClient.h create mode 100644 WebCore/PopupMenuStyle.h create mode 100644 WebCore/Position.h create mode 100644 WebCore/PositionCallback.h create mode 100644 WebCore/PositionError.h create mode 100644 WebCore/PositionErrorCallback.h create mode 100644 WebCore/PositionIterator.h create mode 100644 WebCore/PositionOptions.h create mode 100644 WebCore/PreloadScanner.h create mode 100644 WebCore/PrintContext.h create mode 100644 WebCore/ProcessingInstruction.h create mode 100644 WebCore/ProgressEvent.h create mode 100644 WebCore/ProgressTracker.h create mode 100644 WebCore/ProtectionSpace.h create mode 100644 WebCore/PublicDOMInterfaces.h create mode 100644 WebCore/PublicDOMInterfacesIPhone.h create mode 100644 WebCore/PurgeableBuffer.h create mode 100644 WebCore/QualifiedName.h create mode 100644 WebCore/Range.h create mode 100644 WebCore/RangeBoundaryPoint.h create mode 100644 WebCore/RangeException.h create mode 100644 WebCore/Rect.h create mode 100644 WebCore/RegisteredEventListener.h create mode 100644 WebCore/RegularExpression.h create mode 100644 WebCore/RemoveCSSPropertyCommand.h create mode 100644 WebCore/RemoveFormatCommand.h create mode 100644 WebCore/RemoveNodeCommand.h create mode 100644 WebCore/RemoveNodePreservingChildrenCommand.h create mode 100644 WebCore/RenderApplet.h create mode 100644 WebCore/RenderArena.h create mode 100644 WebCore/RenderBR.h create mode 100644 WebCore/RenderBlock.h create mode 100644 WebCore/RenderBox.h create mode 100644 WebCore/RenderBoxModelObject.h create mode 100644 WebCore/RenderButton.h create mode 100644 WebCore/RenderContainer.h create mode 100644 WebCore/RenderCounter.h create mode 100644 WebCore/RenderFieldset.h create mode 100644 WebCore/RenderFileUploadControl.h create mode 100644 WebCore/RenderFlexibleBox.h create mode 100644 WebCore/RenderFlow.h create mode 100644 WebCore/RenderForeignObject.h create mode 100644 WebCore/RenderFrame.h create mode 100644 WebCore/RenderFrameSet.h create mode 100644 WebCore/RenderHTMLCanvas.h create mode 100644 WebCore/RenderImage.h create mode 100644 WebCore/RenderImageGeneratedContent.h create mode 100644 WebCore/RenderInline.h create mode 100644 WebCore/RenderLayer.h create mode 100644 WebCore/RenderLayerBacking.h create mode 100644 WebCore/RenderLayerCompositor.h create mode 100644 WebCore/RenderLegend.h create mode 100644 WebCore/RenderListBox.h create mode 100644 WebCore/RenderListItem.h create mode 100644 WebCore/RenderListMarker.h create mode 100644 WebCore/RenderMarquee.h create mode 100644 WebCore/RenderMedia.h create mode 100644 WebCore/RenderMenuList.h create mode 100644 WebCore/RenderObject.h create mode 100644 WebCore/RenderPart.h create mode 100644 WebCore/RenderPartObject.h create mode 100644 WebCore/RenderPath.h create mode 100644 WebCore/RenderReplaced.h create mode 100644 WebCore/RenderReplica.h create mode 100644 WebCore/RenderSVGBlock.h create mode 100644 WebCore/RenderSVGContainer.h create mode 100644 WebCore/RenderSVGGradientStop.h create mode 100644 WebCore/RenderSVGHiddenContainer.h create mode 100644 WebCore/RenderSVGImage.h create mode 100644 WebCore/RenderSVGInline.h create mode 100644 WebCore/RenderSVGInlineText.h create mode 100644 WebCore/RenderSVGRoot.h create mode 100644 WebCore/RenderSVGTSpan.h create mode 100644 WebCore/RenderSVGText.h create mode 100644 WebCore/RenderSVGTextPath.h create mode 100644 WebCore/RenderSVGTransformableContainer.h create mode 100644 WebCore/RenderSVGViewportContainer.h create mode 100644 WebCore/RenderScrollbar.h create mode 100644 WebCore/RenderScrollbarPart.h create mode 100644 WebCore/RenderScrollbarTheme.h create mode 100644 WebCore/RenderSelectionInfo.h create mode 100644 WebCore/RenderSlider.h create mode 100644 WebCore/RenderStyle.h create mode 100644 WebCore/RenderStyleConstants.h create mode 100644 WebCore/RenderTable.h create mode 100644 WebCore/RenderTableCell.h create mode 100644 WebCore/RenderTableCol.h create mode 100644 WebCore/RenderTableRow.h create mode 100644 WebCore/RenderTableSection.h create mode 100644 WebCore/RenderText.h create mode 100644 WebCore/RenderTextControl.h create mode 100644 WebCore/RenderTextControlMultiLine.h create mode 100644 WebCore/RenderTextControlSingleLine.h create mode 100644 WebCore/RenderTextFragment.h create mode 100644 WebCore/RenderTheme.h create mode 100644 WebCore/RenderThemeChromiumGtk.h create mode 100644 WebCore/RenderThemeChromiumMac.h create mode 100644 WebCore/RenderThemeChromiumWin.h create mode 100644 WebCore/RenderThemeIPhone.h create mode 100644 WebCore/RenderThemeMac.h create mode 100644 WebCore/RenderThemeSafari.h create mode 100644 WebCore/RenderThemeWin.h create mode 100644 WebCore/RenderTreeAsText.h create mode 100644 WebCore/RenderVideo.h create mode 100644 WebCore/RenderView.h create mode 100644 WebCore/RenderWidget.h create mode 100644 WebCore/RenderWordBreak.h create mode 100644 WebCore/ReplaceSelectionCommand.h create mode 100644 WebCore/Request.h create mode 100644 WebCore/ResourceError.h create mode 100644 WebCore/ResourceErrorBase.h create mode 100644 WebCore/ResourceErrorCF.cpp create mode 100644 WebCore/ResourceHandle.h create mode 100644 WebCore/ResourceHandleCFNet.cpp create mode 100644 WebCore/ResourceHandleClient.h create mode 100644 WebCore/ResourceHandleInternal.h create mode 100644 WebCore/ResourceLoader.h create mode 100644 WebCore/ResourceRequest.h create mode 100644 WebCore/ResourceRequestBase.h create mode 100644 WebCore/ResourceRequestCFNet.cpp create mode 100644 WebCore/ResourceRequestCFNet.h create mode 100644 WebCore/ResourceResponse.h create mode 100644 WebCore/ResourceResponseBase.h create mode 100644 WebCore/ResourceResponseCFNet.cpp create mode 100644 WebCore/ResourceResponseCFNet.h create mode 100644 WebCore/RootInlineBox.h create mode 100644 WebCore/RotateTransformOperation.h create mode 100644 WebCore/RuntimeApplicationChecksIPhone.h create mode 100644 WebCore/SSLKeyGenerator.h create mode 100644 WebCore/SVGCharacterLayoutInfo.h create mode 100644 WebCore/SVGInlineFlowBox.h create mode 100644 WebCore/SVGInlineTextBox.h create mode 100644 WebCore/SVGRenderStyle.h create mode 100644 WebCore/SVGRenderStyleDefs.h create mode 100644 WebCore/SVGRenderSupport.h create mode 100644 WebCore/SVGRenderTreeAsText.h create mode 100644 WebCore/SVGRootInlineBox.h create mode 100644 WebCore/ScaleTransformOperation.h create mode 100644 WebCore/SchedulePair.h create mode 100644 WebCore/Screen.h create mode 100644 WebCore/ScriptElement.h create mode 100644 WebCore/ScriptExecutionContext.h create mode 100644 WebCore/ScrollTypes.h create mode 100644 WebCore/ScrollView.h create mode 100644 WebCore/Scrollbar.h create mode 100644 WebCore/ScrollbarClient.h create mode 100644 WebCore/ScrollbarTheme.h create mode 100644 WebCore/ScrollbarThemeComposite.h create mode 100644 WebCore/SearchPopupMenu.h create mode 100644 WebCore/SecurityOrigin.h create mode 100644 WebCore/SecurityOriginHash.h create mode 100644 WebCore/SegmentedFontData.h create mode 100644 WebCore/SegmentedString.h create mode 100644 WebCore/Selection.h create mode 100644 WebCore/SelectionController.h create mode 100644 WebCore/SelectionRect.h create mode 100644 WebCore/SelectorNodeList.h create mode 100644 WebCore/SetNodeAttributeCommand.h create mode 100644 WebCore/Settings.h create mode 100644 WebCore/ShadowData.h create mode 100644 WebCore/ShadowValue.h create mode 100644 WebCore/SharedBuffer.h create mode 100644 WebCore/SharedTimer.h create mode 100644 WebCore/SimpleFontData.h create mode 100644 WebCore/SkewTransformOperation.h create mode 100644 WebCore/SmartReplace.h create mode 100644 WebCore/Sound.h create mode 100644 WebCore/SplitElementCommand.h create mode 100644 WebCore/SplitTextNodeCommand.h create mode 100644 WebCore/SplitTextNodeContainingElementCommand.h create mode 100644 WebCore/StaticConstructors.h create mode 100644 WebCore/StaticNodeList.h create mode 100644 WebCore/StaticStringList.h create mode 100644 WebCore/StringBuffer.h create mode 100644 WebCore/StringBuilder.h create mode 100644 WebCore/StringHash.h create mode 100644 WebCore/StringImpl.h create mode 100644 WebCore/StringTruncator.h create mode 100644 WebCore/StrokeStyleApplier.h create mode 100644 WebCore/StyleBackgroundData.h create mode 100644 WebCore/StyleBase.h create mode 100644 WebCore/StyleBoxData.h create mode 100644 WebCore/StyleCachedImage.h create mode 100644 WebCore/StyleDashboardRegion.h create mode 100644 WebCore/StyleElement.h create mode 100644 WebCore/StyleFlexibleBoxData.h create mode 100644 WebCore/StyleGeneratedImage.h create mode 100644 WebCore/StyleImage.h create mode 100644 WebCore/StyleInheritedData.h create mode 100644 WebCore/StyleList.h create mode 100644 WebCore/StyleMarqueeData.h create mode 100644 WebCore/StyleMultiColData.h create mode 100644 WebCore/StyleRareInheritedData.h create mode 100644 WebCore/StyleRareNonInheritedData.h create mode 100644 WebCore/StyleReflection.h create mode 100644 WebCore/StyleSheet.h create mode 100644 WebCore/StyleSheetList.h create mode 100644 WebCore/StyleSurroundData.h create mode 100644 WebCore/StyleTransformData.h create mode 100644 WebCore/StyleVisualData.h create mode 100644 WebCore/StyledElement.h create mode 100644 WebCore/SubresourceLoader.h create mode 100644 WebCore/SubresourceLoaderClient.h create mode 100644 WebCore/SubstituteData.h create mode 100644 WebCore/SubstituteResource.h create mode 100644 WebCore/SystemMemory.h create mode 100644 WebCore/SystemTime.h create mode 100644 WebCore/TableLayout.h create mode 100644 WebCore/TagNodeList.h create mode 100644 WebCore/Text.h create mode 100644 WebCore/TextAffinity.h create mode 100644 WebCore/TextBoundaries.h create mode 100644 WebCore/TextBreakIterator.h create mode 100644 WebCore/TextBreakIteratorInternalICU.h create mode 100644 WebCore/TextCodec.h create mode 100644 WebCore/TextCodecICU.h create mode 100644 WebCore/TextCodecLatin1.h create mode 100644 WebCore/TextCodecUTF16.h create mode 100644 WebCore/TextCodecUserDefined.h create mode 100644 WebCore/TextControlInnerElements.h create mode 100644 WebCore/TextDecoder.h create mode 100644 WebCore/TextDirection.h create mode 100644 WebCore/TextDocument.h create mode 100644 WebCore/TextEncoding.h create mode 100644 WebCore/TextEncodingRegistry.h create mode 100644 WebCore/TextEvent.h create mode 100644 WebCore/TextGranularity.h create mode 100644 WebCore/TextIterator.h create mode 100644 WebCore/TextMetrics.h create mode 100644 WebCore/TextResourceDecoder.h create mode 100644 WebCore/TextRun.h create mode 100644 WebCore/TextSizeAdjustment.h create mode 100644 WebCore/TextStream.h create mode 100644 WebCore/Theme.h create mode 100644 WebCore/ThemeTypes.h create mode 100644 WebCore/ThreadCheck.h create mode 100644 WebCore/ThreadGlobalData.h create mode 100644 WebCore/ThreadableLoader.h create mode 100644 WebCore/ThreadableLoaderClient.h create mode 100644 WebCore/TimeRanges.h create mode 100644 WebCore/Timer.h create mode 100644 WebCore/TimingFunction.h create mode 100644 WebCore/Tokenizer.h create mode 100644 WebCore/Touch.h create mode 100644 WebCore/TouchEvent.h create mode 100644 WebCore/TouchList.h create mode 100644 WebCore/TransformOperation.h create mode 100644 WebCore/TransformOperations.h create mode 100644 WebCore/TransformState.h create mode 100644 WebCore/TransformationMatrix.h create mode 100644 WebCore/TranslateTransformOperation.h create mode 100644 WebCore/Traversal.h create mode 100644 WebCore/TreeShared.h create mode 100644 WebCore/TreeWalker.h create mode 100644 WebCore/TypingCommand.h create mode 100644 WebCore/UIEvent.h create mode 100644 WebCore/UIEventWithKeyState.h create mode 100644 WebCore/UnicodeRange.h create mode 100644 WebCore/UnitBezier.h create mode 100644 WebCore/UnlinkCommand.h create mode 100644 WebCore/UserStyleSheetLoader.h create mode 100644 WebCore/VisiblePosition.h create mode 100644 WebCore/VoidCallback.h create mode 100644 WebCore/WAKAppKitStubs.h create mode 100644 WebCore/WAKClipView.h create mode 100644 WebCore/WAKResponder.h create mode 100644 WebCore/WAKScrollView.h create mode 100644 WebCore/WAKStringDrawing.h create mode 100644 WebCore/WAKView.h create mode 100644 WebCore/WAKViewPrivate.h create mode 100644 WebCore/WAKWindow.h create mode 100644 WebCore/WAKWindowPrivate.h create mode 100644 WebCore/WKClipView.h create mode 100644 WebCore/WKContentObservation.h create mode 100644 WebCore/WKGraphics.h create mode 100644 WebCore/WKGraphicsPrivate.h create mode 100644 WebCore/WKScreen.h create mode 100644 WebCore/WKScrollView.h create mode 100644 WebCore/WKTypes.h create mode 100644 WebCore/WKUtilities.h create mode 100644 WebCore/WKView.h create mode 100644 WebCore/WKViewPrivate.h create mode 100644 WebCore/WKWindow.h create mode 100644 WebCore/WKWindowPrivate.h create mode 100644 WebCore/WebCoreTelephoneParser.h create mode 100644 WebCore/WebCoreThread.h create mode 100644 WebCore/WebCoreThreadMessage.h create mode 100644 WebCore/WebCoreThreadSafe.h create mode 100644 WebCore/WebKitAnimationEvent.h create mode 100644 WebCore/WebKitCSSKeyframeRule.h create mode 100644 WebCore/WebKitCSSKeyframesRule.h create mode 100644 WebCore/WebKitCSSMatrix.h create mode 100644 WebCore/WebKitCSSTransformValue.h create mode 100644 WebCore/WebKitPoint.h create mode 100644 WebCore/WebKitTransitionEvent.h create mode 100644 WebCore/WebLayer.h create mode 100644 WebCore/WebScriptObject.h create mode 100644 WebCore/WebScriptObjectPrivate.h create mode 100644 WebCore/WebTiledLayer.h create mode 100644 WebCore/WheelEvent.h create mode 100644 WebCore/Widget.h create mode 100644 WebCore/WidthIterator.h create mode 100644 WebCore/WindowFeatures.h create mode 100644 WebCore/Worker.h create mode 100644 WebCore/WorkerContext.h create mode 100644 WebCore/WorkerLocation.h create mode 100644 WebCore/WorkerMessagingProxy.h create mode 100644 WebCore/WorkerNavigator.h create mode 100644 WebCore/WorkerRunLoop.h create mode 100644 WebCore/WorkerTask.h create mode 100644 WebCore/WorkerThread.h create mode 100644 WebCore/WrapContentsInDummySpanCommand.h create mode 100644 WebCore/XMLTokenizer.h create mode 100644 WebCore/XMLTokenizerScope.h create mode 100644 WebCore/bidi.h create mode 100644 WebCore/break_lines.h create mode 100644 WebCore/htmlediting.h create mode 100644 WebCore/loader.h create mode 100644 WebCore/markup.h create mode 100644 WebCore/visible_units.h diff --git a/WebCore/AXObjectCache.h b/WebCore/AXObjectCache.h new file mode 100644 index 0000000..23e5fde --- /dev/null +++ b/WebCore/AXObjectCache.h @@ -0,0 +1,111 @@ +/* + * 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 +#include +#include +#include + +#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 > m_objects; + HashMap m_renderObjectMapping; + static bool gAccessibilityEnabled; + static bool gAccessibilityEnhancedUserInterfaceEnabled; + + HashSet 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 diff --git a/WebCore/AccessibilityImageMapLink.h b/WebCore/AccessibilityImageMapLink.h new file mode 100644 index 0000000..7fc8d3c --- /dev/null +++ b/WebCore/AccessibilityImageMapLink.h @@ -0,0 +1,72 @@ +/* + * 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 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 diff --git a/WebCore/AccessibilityList.h b/WebCore/AccessibilityList.h new file mode 100644 index 0000000..315ccac --- /dev/null +++ b/WebCore/AccessibilityList.h @@ -0,0 +1,56 @@ +/* + * 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 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 diff --git a/WebCore/AccessibilityListBox.h b/WebCore/AccessibilityListBox.h new file mode 100644 index 0000000..3f3352d --- /dev/null +++ b/WebCore/AccessibilityListBox.h @@ -0,0 +1,66 @@ +/* + * 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 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 diff --git a/WebCore/AccessibilityListBoxOption.h b/WebCore/AccessibilityListBoxOption.h new file mode 100644 index 0000000..1b588cd --- /dev/null +++ b/WebCore/AccessibilityListBoxOption.h @@ -0,0 +1,79 @@ +/* + * 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 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 diff --git a/WebCore/AccessibilityObject.h b/WebCore/AccessibilityObject.h new file mode 100644 index 0000000..a751003 --- /dev/null +++ b/WebCore/AccessibilityObject.h @@ -0,0 +1,429 @@ +/* + * 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 +#include +#include + +#if PLATFORM(MAC) +#include +#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 { +protected: + AccessibilityObject(); +public: + virtual ~AccessibilityObject(); + + typedef Vector > 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 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 m_wrapper; +#elif PLATFORM(WIN) + COMPtr m_wrapper; +#elif PLATFORM(GTK) + AtkObject* m_wrapper; +#elif PLATFORM(CHROMIUM) + RefPtr m_wrapper; +#endif +}; + +} // namespace WebCore + +#endif // AccessibilityObject_h diff --git a/WebCore/AccessibilityRenderObject.h b/WebCore/AccessibilityRenderObject.h new file mode 100644 index 0000000..03ba1db --- /dev/null +++ b/WebCore/AccessibilityRenderObject.h @@ -0,0 +1,243 @@ +/* + * 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 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 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 diff --git a/WebCore/AccessibilityTable.h b/WebCore/AccessibilityTable.h new file mode 100644 index 0000000..b98b6b7 --- /dev/null +++ b/WebCore/AccessibilityTable.h @@ -0,0 +1,86 @@ +/* + * 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 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 diff --git a/WebCore/AccessibilityTableCell.h b/WebCore/AccessibilityTableCell.h new file mode 100644 index 0000000..8f8dd77 --- /dev/null +++ b/WebCore/AccessibilityTableCell.h @@ -0,0 +1,65 @@ +/* + * 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 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& rowRange); + // fills in the start location and column span of cell + void columnIndexRange(pair& 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 diff --git a/WebCore/AccessibilityTableColumn.h b/WebCore/AccessibilityTableColumn.h new file mode 100644 index 0000000..6270398 --- /dev/null +++ b/WebCore/AccessibilityTableColumn.h @@ -0,0 +1,75 @@ +/* + * 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 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 diff --git a/WebCore/AccessibilityTableHeaderContainer.h b/WebCore/AccessibilityTableHeaderContainer.h new file mode 100644 index 0000000..8a9448a --- /dev/null +++ b/WebCore/AccessibilityTableHeaderContainer.h @@ -0,0 +1,67 @@ +/* + * 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 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 diff --git a/WebCore/AccessibilityTableRow.h b/WebCore/AccessibilityTableRow.h new file mode 100644 index 0000000..0ec7f04 --- /dev/null +++ b/WebCore/AccessibilityTableRow.h @@ -0,0 +1,65 @@ +/* + * 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 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 diff --git a/WebCore/ActiveDOMObject.h b/WebCore/ActiveDOMObject.h new file mode 100644 index 0000000..e58d3f9 --- /dev/null +++ b/WebCore/ActiveDOMObject.h @@ -0,0 +1,80 @@ +/* + * 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 + +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 void setPendingActivity(T* thisObject) + { + ASSERT(thisObject == this); + thisObject->ref(); + m_pendingActivityCount++; + } + + template void unsetPendingActivity(T* thisObject) + { + ASSERT(m_pendingActivityCount > 0); + --m_pendingActivityCount; + thisObject->deref(); + } + + private: + ScriptExecutionContext* m_scriptExecutionContext; + unsigned m_pendingActivityCount; + }; + +} // namespace WebCore + +#endif // ActiveDOMObject_h diff --git a/WebCore/Animation.h b/WebCore/Animation.h new file mode 100644 index 0000000..306a1b9 --- /dev/null +++ b/WebCore/Animation.h @@ -0,0 +1,151 @@ +/* + * 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 +#include + +namespace WebCore { + +const int cAnimateNone = 0; +const int cAnimateAll = -2; + +class Animation : public RefCounted { +public: + ~Animation(); + + static PassRefPtr 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 diff --git a/WebCore/AnimationList.h b/WebCore/AnimationList.h new file mode 100644 index 0000000..9901424 --- /dev/null +++ b/WebCore/AnimationList.h @@ -0,0 +1,60 @@ +/* + * 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 +#include + +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 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 > m_animations; +}; + + +} // namespace WebCore + +#endif // AnimationList_h diff --git a/WebCore/AppendNodeCommand.h b/WebCore/AppendNodeCommand.h new file mode 100644 index 0000000..5ffb881 --- /dev/null +++ b/WebCore/AppendNodeCommand.h @@ -0,0 +1,52 @@ +/* + * 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 create(PassRefPtr parent, PassRefPtr node) + { + return adoptRef(new AppendNodeCommand(parent, node)); + } + +private: + AppendNodeCommand(PassRefPtr parent, PassRefPtr node); + + virtual void doApply(); + virtual void doUnapply(); + + RefPtr m_parent; + RefPtr m_node; +}; + +} // namespace WebCore + +#endif // AppendNodeCommand_h diff --git a/WebCore/ApplyStyleCommand.h b/WebCore/ApplyStyleCommand.h new file mode 100644 index 0000000..a42225d --- /dev/null +++ b/WebCore/ApplyStyleCommand.h @@ -0,0 +1,120 @@ +/* + * 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 create(Document* document, CSSStyleDeclaration* style, EditAction action = EditActionChangeAttributes, EPropertyLevel level = PropertyDefault) + { + return adoptRef(new ApplyStyleCommand(document, style, action, level)); + } + static PassRefPtr 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 create(PassRefPtr 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, 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, 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 extractTextDecorationStyle(Node*); + PassRefPtr 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); + float computedFontSize(const Node*); + void joinChildTextNodes(Node*, const Position& start, const Position& end); + + HTMLElement* splitAncestorsWithUnicodeBidi(Node*, bool before, RefPtr allowedDirection); + void removeEmbeddingUpToEnclosingBlock(Node* node, Node* unsplitAncestor); + + void updateStartEnd(const Position& newStart, const Position& newEnd); + Position startPosition(); + Position endPosition(); + + RefPtr m_style; + EditAction m_editingAction; + EPropertyLevel m_propertyLevel; + Position m_start; + Position m_end; + bool m_useEndingSelection; + RefPtr m_styledInlineElement; + bool m_removeOnly; +}; + +bool isStyleSpan(const Node*); +PassRefPtr createStyleSpanElement(Document*); + +} // namespace WebCore + +#endif diff --git a/WebCore/Arena.h b/WebCore/Arena.h new file mode 100644 index 0000000..b6f6931 --- /dev/null +++ b/WebCore/Arena.h @@ -0,0 +1,130 @@ +/* + * Copyright (C) 1998-2000 Netscape Communications Corporation. + * Copyright (C) 2003-6 Apple Computer + * + * Other contributors: + * Nick Blievers + * Jeff Hostetler + * Tom Rini + * Raffaele Sena + * + * 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 diff --git a/WebCore/AtomicString.h b/WebCore/AtomicString.h new file mode 100644 index 0000000..f4efab9 --- /dev/null +++ b/WebCore/AtomicString.h @@ -0,0 +1,159 @@ +/* + * 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(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 add(const char*); + static PassRefPtr add(const UChar*, int length); + static PassRefPtr add(const UChar*); + static PassRefPtr add(StringImpl*); +#if USE(JSC) + static PassRefPtr add(const JSC::UString&); + static PassRefPtr 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 struct DefaultHash; + template<> struct DefaultHash { + typedef WebCore::AtomicStringHash Hash; + }; + +} // namespace WTF + +#endif // AtomicString_h diff --git a/WebCore/AtomicStringHash.h b/WebCore/AtomicStringHash.h new file mode 100644 index 0000000..da7140e --- /dev/null +++ b/WebCore/AtomicStringHash.h @@ -0,0 +1,66 @@ +/* + * 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 + +#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 : GenericHashTraits { + 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 diff --git a/WebCore/AtomicStringImpl.h b/WebCore/AtomicStringImpl.h new file mode 100644 index 0000000..d905afc --- /dev/null +++ b/WebCore/AtomicStringImpl.h @@ -0,0 +1,36 @@ +/* + * 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 diff --git a/WebCore/Attr.h b/WebCore/Attr.h new file mode 100644 index 0000000..9525251 --- /dev/null +++ b/WebCore/Attr.h @@ -0,0 +1,96 @@ +/* + * 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); + ~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 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 m_attribute; + unsigned m_ignoreChildrenChanged : 31; + bool m_specified : 1; +}; + +} // namespace WebCore + +#endif // Attr_h diff --git a/WebCore/Attribute.h b/WebCore/Attribute.h new file mode 100644 index 0000000..2b2863f --- /dev/null +++ b/WebCore/Attribute.h @@ -0,0 +1,91 @@ +/* + * 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 { + friend class Attr; + friend class NamedAttrMap; +public: + static PassRefPtr 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 createAttrIfNeeded(Element*); + + bool isNull() const { return m_value.isNull(); } + bool isEmpty() const { return m_value.isEmpty(); } + + virtual PassRefPtr 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 diff --git a/WebCore/AuthenticationCF.cpp b/WebCore/AuthenticationCF.cpp new file mode 100644 index 0000000..bb05a39 --- /dev/null +++ b/WebCore/AuthenticationCF.cpp @@ -0,0 +1,266 @@ +/* + * 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 +#include +#include + +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); +} + +}; diff --git a/WebCore/AuthenticationCF.h b/WebCore/AuthenticationCF.h new file mode 100644 index 0000000..681e71f --- /dev/null +++ b/WebCore/AuthenticationCF.h @@ -0,0 +1,49 @@ +/* + * 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 diff --git a/WebCore/AuthenticationChallenge.h b/WebCore/AuthenticationChallenge.h new file mode 100644 index 0000000..9697d7e --- /dev/null +++ b/WebCore/AuthenticationChallenge.h @@ -0,0 +1,57 @@ +/* + * 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 + +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 m_sourceHandle; + RetainPtr m_cfChallenge; +}; + +} + +#endif diff --git a/WebCore/AuthenticationChallengeBase.h b/WebCore/AuthenticationChallengeBase.h new file mode 100644 index 0000000..9d85866 --- /dev/null +++ b/WebCore/AuthenticationChallengeBase.h @@ -0,0 +1,70 @@ +/* + * 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 diff --git a/WebCore/AutoTableLayout.h b/WebCore/AutoTableLayout.h new file mode 100644 index 0000000..641a68b --- /dev/null +++ b/WebCore/AutoTableLayout.h @@ -0,0 +1,87 @@ +/* + * 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 + +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 m_layoutStruct; + Vector 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 diff --git a/WebCore/AutodrainedPool.h b/WebCore/AutodrainedPool.h new file mode 100644 index 0000000..1cbbec6 --- /dev/null +++ b/WebCore/AutodrainedPool.h @@ -0,0 +1,67 @@ +/* + * 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 + +#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 + + diff --git a/WebCore/BackForwardList.h b/WebCore/BackForwardList.h new file mode 100644 index 0000000..8df76aa --- /dev/null +++ b/WebCore/BackForwardList.h @@ -0,0 +1,125 @@ +/* + * 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 +#include +#include +#include + +namespace WebCore { + +class HistoryItem; +class Page; + +typedef Vector > HistoryItemVector; +typedef HashSet > 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) = 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 { +public: + static PassRefPtr 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); + 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 diff --git a/WebCore/BarInfo.h b/WebCore/BarInfo.h new file mode 100644 index 0000000..4cbbcfc --- /dev/null +++ b/WebCore/BarInfo.h @@ -0,0 +1,57 @@ +/* + * 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 +#include + +namespace WebCore { + + class Frame; + + class BarInfo : public RefCounted { + public: + enum Type { Locationbar, Menubar, Personalbar, Scrollbars, Statusbar, Toolbar }; + + static PassRefPtr 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 diff --git a/WebCore/Base64.h b/WebCore/Base64.h new file mode 100644 index 0000000..0b176e6 --- /dev/null +++ b/WebCore/Base64.h @@ -0,0 +1,41 @@ +/* + * 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 + +namespace WebCore { + +void base64Encode(const Vector&, Vector&, 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&, Vector&); +bool base64Decode(const char*, unsigned, Vector&); + +} + +#endif // Base64_h diff --git a/WebCore/BeforeTextInsertedEvent.h b/WebCore/BeforeTextInsertedEvent.h new file mode 100644 index 0000000..f2a2ac4 --- /dev/null +++ b/WebCore/BeforeTextInsertedEvent.h @@ -0,0 +1,53 @@ +/* + * 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 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 diff --git a/WebCore/BeforeUnloadEvent.h b/WebCore/BeforeUnloadEvent.h new file mode 100644 index 0000000..39c96fd --- /dev/null +++ b/WebCore/BeforeUnloadEvent.h @@ -0,0 +1,53 @@ +/* + * 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 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 diff --git a/WebCore/BidiContext.h b/WebCore/BidiContext.h new file mode 100644 index 0000000..89123c8 --- /dev/null +++ b/WebCore/BidiContext.h @@ -0,0 +1,69 @@ +/* + * 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 +#include +#include + +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(m_direction); } + bool override() const { return m_override; } + +private: + unsigned char m_level; + unsigned m_direction : 5; // Direction + bool m_override : 1; + RefPtr m_parent; + mutable int m_refCount; +}; + +bool operator==(const BidiContext&, const BidiContext&); + +} // namespace WebCore + +#endif // BidiContext_h diff --git a/WebCore/BidiResolver.h b/WebCore/BidiResolver.h new file mode 100644 index 0000000..1cc0456 --- /dev/null +++ b/WebCore/BidiResolver.h @@ -0,0 +1,946 @@ +/* + * 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 +#include +#include + +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) + : eor(eorDir) + , lastStrong(lastStrongDir) + , last(lastDir) + , context(bidiContext) + { + } + + WTF::Unicode::Direction eor; + WTF::Unicode::Direction lastStrong; + WTF::Unicode::Direction last; + RefPtr 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 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 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 m_currentExplicitEmbeddingSequence; +}; + +template +inline void BidiResolver::addRun(Run* run) +{ + if (!m_firstRun) + m_firstRun = run; + else + m_lastRun->m_next = run; + m_lastRun = run; + m_runCount++; +} + +template +inline void BidiResolver::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 +inline void BidiResolver::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 +inline void BidiResolver::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 +void BidiResolver::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 +void BidiResolver::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 +void BidiResolver::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 +void BidiResolver::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 +void BidiResolver::commitExplicitEmbedding() +{ + using namespace WTF::Unicode; + + unsigned char fromLevel = context()->level(); + RefPtr 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 +void BidiResolver::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 +void BidiResolver::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 +void BidiResolver::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 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 diff --git a/WebCore/BindingURI.h b/WebCore/BindingURI.h new file mode 100644 index 0000000..923f1aa --- /dev/null +++ b/WebCore/BindingURI.h @@ -0,0 +1,59 @@ +/* + * 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 diff --git a/WebCore/BitmapImage.h b/WebCore/BitmapImage.h new file mode 100644 index 0000000..63cd879 --- /dev/null +++ b/WebCore/BitmapImage.h @@ -0,0 +1,280 @@ +/* + * 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 +#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 : public SimpleClassVectorTraits {}; +} + +namespace WebCore { + +template 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 create(NativeImagePtr nativeImage, ImageObserver* observer = 0) + { + return adoptRef(new BitmapImage(nativeImage, observer)); + } + static PassRefPtr 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*); + + // 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 m_frames; // An array of the cached frames of the animation. We have to ref frames to pin them in the cache. + + Timer* 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 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 diff --git a/WebCore/BorderData.h b/WebCore/BorderData.h new file mode 100644 index 0000000..8ca0d65 --- /dev/null +++ b/WebCore/BorderData.h @@ -0,0 +1,109 @@ +/* + * 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 diff --git a/WebCore/BorderValue.h b/WebCore/BorderValue.h new file mode 100644 index 0000000..e61e708 --- /dev/null +++ b/WebCore/BorderValue.h @@ -0,0 +1,75 @@ +/* + * 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(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 diff --git a/WebCore/BreakBlockquoteCommand.h b/WebCore/BreakBlockquoteCommand.h new file mode 100644 index 0000000..885e5d6 --- /dev/null +++ b/WebCore/BreakBlockquoteCommand.h @@ -0,0 +1,47 @@ +/* + * 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 create(Document* document) + { + return adoptRef(new BreakBlockquoteCommand(document)); + } + +private: + BreakBlockquoteCommand(Document*); + virtual void doApply(); +}; + +} // namespace WebCore + +#endif diff --git a/WebCore/CDATASection.h b/WebCore/CDATASection.h new file mode 100644 index 0000000..8b7df9d --- /dev/null +++ b/WebCore/CDATASection.h @@ -0,0 +1,48 @@ +/* + * 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 cloneNode(bool deep); + virtual bool childTypeAllowed(NodeType); + +protected: + virtual PassRefPtr createNew(PassRefPtr); +}; + +} // namespace WebCore + +#endif // CDATASection_h diff --git a/WebCore/CSSBorderImageValue.h b/WebCore/CSSBorderImageValue.h new file mode 100644 index 0000000..23832b8 --- /dev/null +++ b/WebCore/CSSBorderImageValue.h @@ -0,0 +1,62 @@ +/* + * (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 +#include + +namespace WebCore { + +class Rect; + +class CSSBorderImageValue : public CSSValue { +public: + static PassRefPtr create(PassRefPtr image, PassRefPtr 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&, const CSSStyleSheet*); + + // The border image. + RefPtr m_image; + + // These four values are used to make "cuts" in the image. They can be numbers + // or percentages. + RefPtr 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 image, PassRefPtr sliceRect, int horizontalRule, int verticalRule); +}; + +} // namespace WebCore + +#endif // CSSBorderImageValue_h diff --git a/WebCore/CSSCanvasValue.h b/WebCore/CSSCanvasValue.h new file mode 100644 index 0000000..a698f31 --- /dev/null +++ b/WebCore/CSSCanvasValue.h @@ -0,0 +1,68 @@ +/* + * 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 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 diff --git a/WebCore/CSSCharsetRule.h b/WebCore/CSSCharsetRule.h new file mode 100644 index 0000000..07fb075 --- /dev/null +++ b/WebCore/CSSCharsetRule.h @@ -0,0 +1,57 @@ +/* + * (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 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 diff --git a/WebCore/CSSComputedStyleDeclaration.h b/WebCore/CSSComputedStyleDeclaration.h new file mode 100644 index 0000000..487c02b --- /dev/null +++ b/WebCore/CSSComputedStyleDeclaration.h @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2004 Zack Rusin + * 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 computedStyle(PassRefPtr); + virtual ~CSSComputedStyleDeclaration(); + + virtual String cssText() const; + + virtual unsigned length() const; + virtual String item(unsigned index) const; + + virtual PassRefPtr 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 copy() const; + virtual PassRefPtr makeMutable(); + + PassRefPtr getPropertyCSSValue(int propertyID, EUpdateLayout) const; +#if ENABLE(SVG) + PassRefPtr getSVGPropertyCSSValue(int propertyID, EUpdateLayout) const; +#endif + + PassRefPtr copyInheritableProperties() const; + + static void removeComputedInheritablePropertiesFrom(CSSMutableStyleDeclaration*); + +private: + CSSComputedStyleDeclaration(PassRefPtr); + + virtual void setCssText(const String&, ExceptionCode&); + + virtual String removeProperty(int propertyID, ExceptionCode&); + virtual void setProperty(int propertyId, const String& value, bool important, ExceptionCode&); + + RefPtr m_node; +}; + +inline PassRefPtr computedStyle(PassRefPtr node) +{ + return adoptRef(new CSSComputedStyleDeclaration(node)); +} + +} // namespace WebCore + +#endif // CSSComputedStyleDeclaration_h diff --git a/WebCore/CSSCursorImageValue.h b/WebCore/CSSCursorImageValue.h new file mode 100644 index 0000000..efcdda6 --- /dev/null +++ b/WebCore/CSSCursorImageValue.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2006 Rob Buis + * 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 + +namespace WebCore { + +class Element; +class SVGElement; + +class CSSCursorImageValue : public CSSImageValue { +public: + static PassRefPtr 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 m_referencedElements; +#endif +}; + +} // namespace WebCore + +#endif // CSSCursorImageValue_h diff --git a/WebCore/CSSFontFace.h b/WebCore/CSSFontFace.h new file mode 100644 index 0000000..41c9c55 --- /dev/null +++ b/WebCore/CSSFontFace.h @@ -0,0 +1,96 @@ +/* + * 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 +#include +#include +#include +#include + +namespace WebCore { + +class CSSFontFaceSource; +class CSSSegmentedFontFace; +class FontDescription; +class SimpleFontData; + +class CSSFontFace : public RefCounted { +public: + static PassRefPtr 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& 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 m_ranges; + HashSet m_segmentedFontFaces; + Vector m_sources; +}; + +} + +#endif diff --git a/WebCore/CSSFontFaceRule.h b/WebCore/CSSFontFaceRule.h new file mode 100644 index 0000000..5148d0c --- /dev/null +++ b/WebCore/CSSFontFaceRule.h @@ -0,0 +1,67 @@ +/* + * (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 +#include + +namespace WebCore { + +class CSSMutableStyleDeclaration; + +class CSSFontFaceRule : public CSSRule { +public: + static PassRefPtr create() + { + return adoptRef(new CSSFontFaceRule(0)); + } + static PassRefPtr create(CSSStyleSheet* parent) + { + return adoptRef(new CSSFontFaceRule(parent)); + } + + virtual ~CSSFontFaceRule(); + + CSSMutableStyleDeclaration* style() const { return m_style.get(); } + + virtual String cssText() const; + + void setDeclaration(PassRefPtr); + + virtual void addSubresourceStyleURLs(ListHashSet& urls); + +private: + CSSFontFaceRule(CSSStyleSheet* parent); + + virtual bool isFontFaceRule() { return true; } + + // Inherited from CSSRule + virtual unsigned short type() const { return FONT_FACE_RULE; } + + RefPtr m_style; +}; + +} // namespace WebCore + +#endif // CSSFontFaceRule_h diff --git a/WebCore/CSSFontFaceSource.h b/WebCore/CSSFontFaceSource.h new file mode 100644 index 0000000..c6baef2 --- /dev/null +++ b/WebCore/CSSFontFaceSource.h @@ -0,0 +1,83 @@ +/* + * 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 + +#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 m_font; // For remote fonts, a pointer to our cached resource. + CSSFontFace* m_face; // Our owning font face. + HashMap m_fontDataTable; // The hash key is composed of size synthetic styles. + +#if ENABLE(SVG_FONTS) + SVGFontFaceElement* m_svgFontFaceElement; + RefPtr m_externalSVGFontElement; +#endif +}; + +} + +#endif diff --git a/WebCore/CSSFontFaceSrcValue.h b/WebCore/CSSFontFaceSrcValue.h new file mode 100644 index 0000000..22f1be7 --- /dev/null +++ b/WebCore/CSSFontFaceSrcValue.h @@ -0,0 +1,92 @@ +/* + * 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 + +#if ENABLE(SVG_FONTS) +#include "SVGFontFaceElement.h" +#endif + +namespace WebCore { + +class CSSFontFaceSrcValue : public CSSValue { +public: + static PassRefPtr create(const String& resource) + { + return adoptRef(new CSSFontFaceSrcValue(resource, false)); + } + static PassRefPtr 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&, 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 diff --git a/WebCore/CSSFontSelector.h b/WebCore/CSSFontSelector.h new file mode 100644 index 0000000..af454bd --- /dev/null +++ b/WebCore/CSSFontSelector.h @@ -0,0 +1,77 @@ +/* + * 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 +#include + +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 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 >*, CaseFoldingHash> m_fontFaces; + HashMap >*, CaseFoldingHash> m_locallyInstalledFontFaces; + HashMap >*, CaseFoldingHash> m_fonts; +}; + +} // namespace WebCore + +#endif // CSSFontSelector_h diff --git a/WebCore/CSSFunctionValue.h b/WebCore/CSSFunctionValue.h new file mode 100644 index 0000000..e9545a1 --- /dev/null +++ b/WebCore/CSSFunctionValue.h @@ -0,0 +1,58 @@ +/* + * 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 create(CSSParserFunction* function) + { + return adoptRef(new CSSFunctionValue(function)); + } + + ~CSSFunctionValue(); + + virtual String cssText() const; + + virtual CSSParserValue parserValue() const; + +private: + CSSFunctionValue(CSSParserFunction*); + + String m_name; + RefPtr m_args; +}; + +} +#endif + diff --git a/WebCore/CSSGradientValue.h b/WebCore/CSSGradientValue.h new file mode 100644 index 0000000..83c1815 --- /dev/null +++ b/WebCore/CSSGradientValue.h @@ -0,0 +1,112 @@ +/* + * 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 +#include + +namespace WebCore { + +class FloatPoint; +class Gradient; + +enum CSSGradientType { CSSLinearGradient, CSSRadialGradient }; + +struct CSSGradientColorStop { + CSSGradientColorStop() + : m_stop(0) + { + } + + float m_stop; + RefPtr m_color; +}; + +class CSSGradientValue : public CSSImageGeneratorValue { +public: + static PassRefPtr 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 val) { m_firstX = val; } + void setFirstY(PassRefPtr val) { m_firstY = val; } + void setSecondX(PassRefPtr val) { m_secondX = val; } + void setSecondY(PassRefPtr val) { m_secondY = val; } + + void setFirstRadius(PassRefPtr val) { m_firstRadius = val; } + void setSecondRadius(PassRefPtr 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 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 m_firstX; + RefPtr m_firstY; + + RefPtr m_secondX; + RefPtr m_secondY; + + // Radii (for radial gradients only) + RefPtr m_firstRadius; + RefPtr m_secondRadius; + + // Stops + Vector m_stops; + bool m_stopsSorted; +}; + +} // namespace WebCore + +#endif // CSSGradientValue_h diff --git a/WebCore/CSSHelper.h b/WebCore/CSSHelper.h new file mode 100644 index 0000000..7f32d88 --- /dev/null +++ b/WebCore/CSSHelper.h @@ -0,0 +1,42 @@ +/* + * 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 diff --git a/WebCore/CSSImageGeneratorValue.h b/WebCore/CSSImageGeneratorValue.h new file mode 100644 index 0000000..661fd37 --- /dev/null +++ b/WebCore/CSSImageGeneratorValue.h @@ -0,0 +1,73 @@ +/* + * 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 +#include +#include + +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); + + HashCountedSet m_sizes; // A count of how many times a given image size is in use. + HashMap m_clients; // A map from RenderObjects to image sizes. + HashMap > m_images; // A cache of Image objects by image size. + + RefPtr m_image; + bool m_accessedImage; + +private: + virtual bool isImageGeneratorValue() const { return true; } +}; + +} // namespace WebCore + +#endif // CSSImageGeneratorValue_h diff --git a/WebCore/CSSImageValue.h b/WebCore/CSSImageValue.h new file mode 100644 index 0000000..a1715cd --- /dev/null +++ b/WebCore/CSSImageValue.h @@ -0,0 +1,59 @@ +/* + * (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 + +namespace WebCore { + +class DocLoader; +class StyleCachedImage; + +class CSSImageValue : public CSSPrimitiveValue, private CachedResourceClient { +public: + static PassRefPtr create() { return adoptRef(new CSSImageValue); } + static PassRefPtr 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 m_image; + bool m_accessedImage; +}; + +} // namespace WebCore + +#endif // CSSImageValue_h diff --git a/WebCore/CSSImportRule.h b/WebCore/CSSImportRule.h new file mode 100644 index 0000000..f546006 --- /dev/null +++ b/WebCore/CSSImportRule.h @@ -0,0 +1,77 @@ +/* + * (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 create(CSSStyleSheet* parent, const String& href, PassRefPtr 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& urls); + +private: + CSSImportRule(CSSStyleSheet* parent, const String& href, PassRefPtr); + + 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 m_lstMedia; + RefPtr m_styleSheet; + CachedResourceHandle m_cachedSheet; + bool m_loading; +}; + +} // namespace WebCore + +#endif // CSSImportRule_h diff --git a/WebCore/CSSInheritedValue.h b/WebCore/CSSInheritedValue.h new file mode 100644 index 0000000..e015a98 --- /dev/null +++ b/WebCore/CSSInheritedValue.h @@ -0,0 +1,45 @@ +/* + * (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 + +namespace WebCore { + +class CSSInheritedValue : public CSSValue { +public: + static PassRefPtr create() + { + return adoptRef(new CSSInheritedValue); + } + + virtual String cssText() const; + +private: + CSSInheritedValue() { } + virtual unsigned short cssValueType() const; +}; + +} // namespace WebCore + +#endif // CSSInheritedValue_h diff --git a/WebCore/CSSInitialValue.h b/WebCore/CSSInitialValue.h new file mode 100644 index 0000000..96bc2a5 --- /dev/null +++ b/WebCore/CSSInitialValue.h @@ -0,0 +1,58 @@ +/* + * (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 + +namespace WebCore { + +class CSSInitialValue : public CSSValue { +public: + static PassRefPtr createExplicit() + { + static CSSInitialValue* explicitValue = new CSSInitialValue(false); + return explicitValue; + } + static PassRefPtr 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 diff --git a/WebCore/CSSMappedAttributeDeclaration.h b/WebCore/CSSMappedAttributeDeclaration.h new file mode 100644 index 0000000..19ba5a0 --- /dev/null +++ b/WebCore/CSSMappedAttributeDeclaration.h @@ -0,0 +1,65 @@ +/* + * 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 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 diff --git a/WebCore/CSSMediaRule.h b/WebCore/CSSMediaRule.h new file mode 100644 index 0000000..5eead7c --- /dev/null +++ b/WebCore/CSSMediaRule.h @@ -0,0 +1,69 @@ +/* + * (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 create(CSSStyleSheet* parent, PassRefPtr media, PassRefPtr 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, PassRefPtr); + + virtual bool isMediaRule() { return true; } + + // Inherited from CSSRule + virtual unsigned short type() const { return MEDIA_RULE; } + + RefPtr m_lstMedia; + RefPtr m_lstCSSRules; +}; + +} // namespace WebCore + +#endif // CSSMediaRule_h diff --git a/WebCore/CSSMutableStyleDeclaration.h b/WebCore/CSSMutableStyleDeclaration.h new file mode 100644 index 0000000..9c84916 --- /dev/null +++ b/WebCore/CSSMutableStyleDeclaration.h @@ -0,0 +1,222 @@ +/* + * (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 +#include + +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 create() + { + return adoptRef(new CSSMutableStyleDeclaration); + } + static PassRefPtr create(CSSRule* parentRule) + { + return adoptRef(new CSSMutableStyleDeclaration(parentRule)); + } + static PassRefPtr create(CSSRule* parentRule, const CSSProperty* const* properties, int numProperties) + { + return adoptRef(new CSSMutableStyleDeclaration(parentRule, properties, numProperties)); + } + static PassRefPtr create(const Vector& 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 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 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 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&); + +protected: + CSSMutableStyleDeclaration(CSSRule* parentRule); + +private: + CSSMutableStyleDeclaration(); + CSSMutableStyleDeclaration(CSSRule* parentRule, const Vector&, unsigned variableDependentValueCount); + CSSMutableStyleDeclaration(CSSRule* parentRule, const CSSProperty* const *, int numProperties); + + virtual PassRefPtr 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::const_iterator findPropertyWithId(int propertyId) const; + Vector::iterator findPropertyWithId(int propertyId); + + Vector 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(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(m_decl)->m_iteratorCount++; +#endif +} + +inline CSSMutableStyleDeclarationConstIterator::~CSSMutableStyleDeclarationConstIterator() +{ +#ifndef NDEBUG + const_cast(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(m_decl)->m_iteratorCount++; +#endif + return *this; +} + +inline CSSMutableStyleDeclarationConstIterator& CSSMutableStyleDeclarationConstIterator::operator++() +{ + ASSERT(m_current != const_cast(m_decl)->m_properties.end()); + ++m_current; + return *this; +} + +inline CSSMutableStyleDeclarationConstIterator& CSSMutableStyleDeclarationConstIterator::operator--() +{ + --m_current; + return *this; +} + +} // namespace WebCore + +#endif // CSSMutableStyleDeclaration_h diff --git a/WebCore/CSSNamespace.h b/WebCore/CSSNamespace.h new file mode 100644 index 0000000..9194be8 --- /dev/null +++ b/WebCore/CSSNamespace.h @@ -0,0 +1,59 @@ +/* + * 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 diff --git a/WebCore/CSSPageRule.h b/WebCore/CSSPageRule.h new file mode 100644 index 0000000..8e374a5 --- /dev/null +++ b/WebCore/CSSPageRule.h @@ -0,0 +1,60 @@ +/* + * (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 +#include + +namespace WebCore { + +class CSSMutableStyleDeclaration; + +class CSSPageRule : public CSSRule { +public: + static PassRefPtr 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 m_style; +}; + +} // namespace WebCore + +#endif // CSSPageRule_h diff --git a/WebCore/CSSParser.h b/WebCore/CSSParser.h new file mode 100644 index 0000000..e694bbd --- /dev/null +++ b/WebCore/CSSParser.h @@ -0,0 +1,307 @@ +/* + * Copyright (C) 2003 Lars Knoll (knoll@kde.org) + * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008 Eric Seidel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see 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 +#include + +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 parseRule(CSSStyleSheet*, const String&); + PassRefPtr 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, 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 parseBackgroundColor(); + + bool parseFillImage(RefPtr&); + PassRefPtr parseFillPositionXY(bool& xFound, bool& yFound); + void parseFillPosition(RefPtr&, RefPtr&); + PassRefPtr parseFillSize(); + + bool parseFillProperty(int propId, int& propId1, int& propId2, RefPtr&, RefPtr&); + bool parseFillShorthand(int propId, const int* properties, int numProperties, bool important); + + void addFillValue(RefPtr& lval, PassRefPtr rval); + + void addAnimationValue(RefPtr& lval, PassRefPtr rval); + + PassRefPtr parseAnimationDelay(); + PassRefPtr parseAnimationDirection(); + PassRefPtr parseAnimationDuration(); + PassRefPtr parseAnimationIterationCount(); + PassRefPtr parseAnimationName(); + PassRefPtr parseAnimationPlayState(); + PassRefPtr parseAnimationProperty(); + PassRefPtr parseAnimationTimingFunction(); + + void parseTransformOriginShorthand(RefPtr&, RefPtr&, RefPtr&); + bool parseTimingFunctionValue(CSSParserValueList*& args, double& result); + bool parseAnimationProperty(int propId, RefPtr&); + 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 parseFontFamily(); + + bool parseCounter(int propId, int defaultValue, bool important); + PassRefPtr parseCounterContent(CSSParserValueList* args, bool counters); + + bool parseColorParameters(CSSParserValue*, int* colorValues, bool parseAlpha); + bool parseHSLParameters(CSSParserValue*, double* colorValues, bool parseAlpha); + PassRefPtr 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 parseSVGPaint(); + PassRefPtr parseSVGColor(); + PassRefPtr parseSVGStrokeDasharray(); +#endif + + // CSS3 Parsing Routines (for properties specific to CSS3) + bool parseShadow(int propId, bool important); + bool parseBorderImage(int propId, bool important, RefPtr&); + + bool parseReflect(int propId, bool important); + + // Image generators + bool parseCanvas(RefPtr&); + bool parseGradient(RefPtr&); + + PassRefPtr parseTransform(); + bool parseTransformOrigin(int propId, int& propId1, int& propId2, int& propId3, RefPtr&, RefPtr&, RefPtr&); + bool parsePerspectiveOrigin(int propId, int& propId1, int& propId, RefPtr&, RefPtr&); + 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* selectors); + CSSRule* createFontFaceRule(); + CSSRule* createVariablesRule(MediaList*, bool variablesKeyword); + + MediaQueryExp* createFloatingMediaQueryExp(const AtomicString&, CSSParserValueList*); + MediaQueryExp* sinkFloatingMediaQueryExp(MediaQueryExp*); + Vector* createFloatingMediaQueryExpList(); + Vector* sinkFloatingMediaQueryExpList(Vector*); + MediaQuery* createFloatingMediaQuery(MediaQuery::Restrictor, const String&, Vector*); + MediaQuery* createFloatingMediaQuery(Vector*); + MediaQuery* sinkFloatingMediaQuery(MediaQuery*); + + bool addVariable(const CSSParserString&, CSSParserValueList*); + bool addVariableDeclarationBlock(const CSSParserString&); + bool checkForVariables(CSSParserValueList*); + void addUnresolvedProperty(int propId, bool important); + + Vector* reusableSelectorVector() { return &m_reusableSelectorVector; } + + public: + bool m_strict; + bool m_important; + int m_id; + CSSStyleSheet* m_styleSheet; + RefPtr m_rule; + RefPtr 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 m_variableNames; + Vector > 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 > m_parsedStyleObjects; + Vector > m_parsedRuleLists; + HashSet m_floatingSelectors; + HashSet m_floatingValueLists; + HashSet m_floatingFunctions; + + MediaQuery* m_floatingMediaQuery; + MediaQueryExp* m_floatingMediaQueryExp; + Vector* m_floatingMediaQueryExpList; + + Vector 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(static_cast(a) | static_cast(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 diff --git a/WebCore/CSSParserValues.h b/WebCore/CSSParserValues.h new file mode 100644 index 0000000..4e0a280 --- /dev/null +++ b/WebCore/CSSParserValues.h @@ -0,0 +1,100 @@ +/* + * 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 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 m_values; + unsigned m_current; + unsigned m_variablesCount; +}; + +struct CSSParserFunction { + CSSParserString name; + CSSParserValueList* args; + + ~CSSParserFunction() { delete args; } +}; + +} + +#endif diff --git a/WebCore/CSSPrimitiveValue.h b/WebCore/CSSPrimitiveValue.h new file mode 100644 index 0000000..ece9fc5 --- /dev/null +++ b/WebCore/CSSPrimitiveValue.h @@ -0,0 +1,214 @@ +/* + * (C) 1999-2003 Lars Knoll (knoll@kde.org) + * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2007 Alexey Proskuryakov + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see 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 + +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 createIdentifier(int ident); + static PassRefPtr createColor(unsigned rgbValue); + static PassRefPtr create(double value, UnitTypes type); + static PassRefPtr create(const String& value, UnitTypes type); + + template static PassRefPtr 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(getDoubleValue(unitType, ec)); } + float getFloatValue(unsigned short unitType) { return static_cast(getDoubleValue(unitType)); } + float getFloatValue() const { return static_cast(m_value.num); } + + int getIntValue(unsigned short unitType, ExceptionCode& ec) { return static_cast(getDoubleValue(unitType, ec)); } + int getIntValue(unsigned short unitType) { return static_cast(getDoubleValue(unitType)); } + int getIntValue() const { return static_cast(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 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&, 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 CSSPrimitiveValue(T); // Defined in CSSPrimitiveValueMappings.h + template CSSPrimitiveValue(T* val) { init(PassRefPtr(val)); } + template CSSPrimitiveValue(PassRefPtr val) { init(val); } + + static void create(int); // compile-time guard + static void create(unsigned); // compile-time guard + template operator T*(); // compile-time guard + + void init(PassRefPtr); + void init(PassRefPtr); + void init(PassRefPtr); + void init(PassRefPtr); // 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 diff --git a/WebCore/CSSPrimitiveValueMappings.h b/WebCore/CSSPrimitiveValueMappings.h new file mode 100644 index 0000000..9731429 --- /dev/null +++ b/WebCore/CSSPrimitiveValueMappings.h @@ -0,0 +1,2239 @@ +/* + * Copyright (C) 2007 Alexey Proskuryakov . + * 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(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(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(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(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(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(m_value.ident - CSSValueLrTb); +} + +#endif + +} + +#endif diff --git a/WebCore/CSSProperty.h b/WebCore/CSSProperty.h new file mode 100644 index 0000000..7af8348 --- /dev/null +++ b/WebCore/CSSProperty.h @@ -0,0 +1,81 @@ +/* + * 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 +#include + +namespace WebCore { + +class CSSProperty { +public: + CSSProperty(int propID, PassRefPtr 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 m_value; +}; + +} // namespace WebCore + +namespace WTF { + // Properties in Vector can be initialized with memset and moved using memcpy. + template<> struct VectorTraits : SimpleClassVectorTraits { }; +} + +#endif // CSSProperty_h diff --git a/WebCore/CSSPropertyLonghand.h b/WebCore/CSSPropertyLonghand.h new file mode 100644 index 0000000..9633c02 --- /dev/null +++ b/WebCore/CSSPropertyLonghand.h @@ -0,0 +1,53 @@ +/* + * (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 diff --git a/WebCore/CSSPropertyNames.in b/WebCore/CSSPropertyNames.in new file mode 100644 index 0000000..d591147 --- /dev/null +++ b/WebCore/CSSPropertyNames.in @@ -0,0 +1,252 @@ +# +# 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 diff --git a/WebCore/CSSQuirkPrimitiveValue.h b/WebCore/CSSQuirkPrimitiveValue.h new file mode 100644 index 0000000..56857b7 --- /dev/null +++ b/WebCore/CSSQuirkPrimitiveValue.h @@ -0,0 +1,50 @@ +/* + * (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 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 diff --git a/WebCore/CSSReflectValue.h b/WebCore/CSSReflectValue.h new file mode 100644 index 0000000..d61f8c4 --- /dev/null +++ b/WebCore/CSSReflectValue.h @@ -0,0 +1,70 @@ +/* + * 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 +#include + +namespace WebCore { + +class CSSPrimitiveValue; + +class CSSReflectValue : public CSSValue { +public: + static PassRefPtr create(CSSReflectionDirection direction, + PassRefPtr offset, PassRefPtr 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&, const CSSStyleSheet*); + +private: + CSSReflectValue(CSSReflectionDirection direction, + PassRefPtr offset, PassRefPtr mask) + : m_direction(direction) + , m_offset(offset) + , m_mask(mask) + { + } + + CSSReflectionDirection m_direction; + RefPtr m_offset; + RefPtr m_mask; +}; + +} // namespace WebCore + +#endif // CSSReflectValue_h diff --git a/WebCore/CSSReflectionDirection.h b/WebCore/CSSReflectionDirection.h new file mode 100644 index 0000000..5a0c203 --- /dev/null +++ b/WebCore/CSSReflectionDirection.h @@ -0,0 +1,35 @@ +/* + * 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 diff --git a/WebCore/CSSRule.h b/WebCore/CSSRule.h new file mode 100644 index 0000000..fc48dd6 --- /dev/null +++ b/WebCore/CSSRule.h @@ -0,0 +1,72 @@ +/* + * (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 + +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&) { } + +protected: + CSSRule(CSSStyleSheet* parent) + : StyleBase(parent) + { + } + +private: + virtual bool isRule() { return true; } +}; + +} // namespace WebCore + +#endif // CSSRule_h diff --git a/WebCore/CSSRuleList.h b/WebCore/CSSRuleList.h new file mode 100644 index 0000000..26186b3 --- /dev/null +++ b/WebCore/CSSRuleList.h @@ -0,0 +1,68 @@ +/* + * 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 +#include +#include +#include + +namespace WebCore { + +class CSSRule; +class StyleList; + +class CSSRuleList : public RefCounted { +public: + static PassRefPtr create(StyleList* list, bool omitCharsetRules = false) + { + return adoptRef(new CSSRuleList(list, omitCharsetRules)); + } + static PassRefPtr 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 m_list; + Vector > m_lstCSSRules; // FIXME: Want to eliminate, but used by IE rules() extension and still used by media rules. +}; + +} // namespace WebCore + +#endif // CSSRuleList_h diff --git a/WebCore/CSSSegmentedFontFace.h b/WebCore/CSSSegmentedFontFace.h new file mode 100644 index 0000000..57a3c58 --- /dev/null +++ b/WebCore/CSSSegmentedFontFace.h @@ -0,0 +1,70 @@ +/* + * 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 +#include +#include +#include +#include + +namespace WebCore { + +class CSSFontFace; +class CSSFontSelector; +class FontData; +class FontDescription; +class SegmentedFontData; + +class CSSSegmentedFontFace : public RefCounted { +public: + static PassRefPtr 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); + + FontData* getFontData(const FontDescription&); + +private: + CSSSegmentedFontFace(CSSFontSelector*); + + void pruneTable(); + + CSSFontSelector* m_fontSelector; + HashMap m_fontDataTable; + Vector, 1> m_fontFaces; +}; + +} // namespace WebCore + +#endif // CSSSegmentedFontFace_h diff --git a/WebCore/CSSSelector.h b/WebCore/CSSSelector.h new file mode 100644 index 0000000..728c34d --- /dev/null +++ b/WebCore/CSSSelector.h @@ -0,0 +1,261 @@ +/* + * 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 +#include + +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(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(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 m_tagHistory; + OwnPtr 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 diff --git a/WebCore/CSSSelectorList.h b/WebCore/CSSSelectorList.h new file mode 100644 index 0000000..7a41fcf --- /dev/null +++ b/WebCore/CSSSelectorList.h @@ -0,0 +1,55 @@ +/* + * 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 + +namespace WebCore { + + class CSSSelectorList : Noncopyable { + public: + CSSSelectorList() : m_selectorArray(0) { } + ~CSSSelectorList(); + + void adopt(CSSSelectorList& list); + void adoptSelectorVector(Vector& 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 diff --git a/WebCore/CSSStyleDeclaration.h b/WebCore/CSSStyleDeclaration.h new file mode 100644 index 0000000..e6fede6 --- /dev/null +++ b/WebCore/CSSStyleDeclaration.h @@ -0,0 +1,78 @@ +/* + * (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 + +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 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 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 copy() const = 0; + virtual PassRefPtr makeMutable() = 0; + + void diff(CSSMutableStyleDeclaration*) const; + + PassRefPtr copyPropertiesInSet(const int* set, unsigned length) const; + +protected: + CSSStyleDeclaration(CSSRule* parentRule = 0); +}; + +} // namespace WebCore + +#endif // CSSStyleDeclaration_h diff --git a/WebCore/CSSStyleRule.h b/WebCore/CSSStyleRule.h new file mode 100644 index 0000000..23d8648 --- /dev/null +++ b/WebCore/CSSStyleRule.h @@ -0,0 +1,75 @@ +/* + * (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 +#include + +namespace WebCore { + +class CSSMutableStyleDeclaration; +class CSSSelector; + +class CSSStyleRule : public CSSRule { +public: + static PassRefPtr 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& selectors) { m_selectorList.adoptSelectorVector(selectors); } + void setDeclaration(PassRefPtr); + + const CSSSelectorList& selectorList() const { return m_selectorList; } + CSSMutableStyleDeclaration* declaration() { return m_style.get(); } + + virtual void addSubresourceStyleURLs(ListHashSet& urls); + +private: + CSSStyleRule(CSSStyleSheet* parent); + + virtual bool isStyleRule() { return true; } + + // Inherited from CSSRule + virtual unsigned short type() const { return STYLE_RULE; } + + RefPtr m_style; + CSSSelectorList m_selectorList; +}; + +} // namespace WebCore + +#endif // CSSStyleRule_h diff --git a/WebCore/CSSStyleSelector.h b/WebCore/CSSStyleSelector.h new file mode 100644 index 0000000..b925efc --- /dev/null +++ b/WebCore/CSSStyleSelector.h @@ -0,0 +1,327 @@ +/* + * 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 +#include +#include +#include + +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 styleForElement(Element*, RenderStyle* parentStyle = 0, bool allowSharing = true, bool resolveForRootDefault = false); + void keyframeStylesForAnimation(Element*, const RenderStyle*, KeyframeList& list); + + PassRefPtr 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 styleRulesForElement(Element*, bool authorOnly); + PassRefPtr 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 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& usedBlockVariables); + + void addKeyframeStyle(PassRefPtr 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 m_userSheet; + + bool m_hasUAAppearance; + BorderData m_borderData; + FillLayer m_backgroundData; + Color m_backgroundColor; + + typedef HashMap > 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* selectorAttrs, RenderStyle::PseudoId& dynamicPseudo, bool isAncestor, bool isSubSelector, RenderStyle* = 0, RenderStyle* elementParentStyle = 0) const; + bool checkOneSelector(CSSSelector*, Element*, HashSet* 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 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 m_matchedDecls; + + // A buffer used to hold the set of matched rules for an element, and a temporary buffer used for + // merge sorting. + Vector m_matchedRules; + + RefPtr m_ruleList; + + MediaQueryEvaluator* m_medium; + RefPtr m_rootDefaultStyle; + + RenderStyle::PseudoId m_dynamicPseudo; + + SelectorChecker m_checker; + + RefPtr m_style; + RenderStyle* m_parentStyle; + Element* m_element; + StyledElement* m_styledElement; + Node* m_parentNode; + CSSValue* m_lineHeightValue; + bool m_fontDirty; + bool m_matchAuthorAndUserStyles; + + RefPtr m_fontSelector; + HashSet m_selectorAttrs; + Vector m_additionalAttributeStyleDecls; + Vector m_viewportDependentMediaQueryResults; + + HashMap m_variablesMap; + HashMap > 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 diff --git a/WebCore/CSSStyleSheet.h b/WebCore/CSSStyleSheet.h new file mode 100644 index 0000000..8646ee9 --- /dev/null +++ b/WebCore/CSSStyleSheet.h @@ -0,0 +1,113 @@ +/* + * (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 create() + { + return adoptRef(new CSSStyleSheet(static_cast(0), String(), String())); + } + static PassRefPtr create(Node* ownerNode) + { + return adoptRef(new CSSStyleSheet(ownerNode, String(), String())); + } + static PassRefPtr create(Node* ownerNode, const String& href) + { + return adoptRef(new CSSStyleSheet(ownerNode, href, String())); + } + static PassRefPtr create(Node* ownerNode, const String& href, const String& charset) + { + return adoptRef(new CSSStyleSheet(ownerNode, href, charset)); + } + static PassRefPtr create(CSSRule* ownerRule, const String& href, const String& charset) + { + return adoptRef(new CSSStyleSheet(ownerRule, href, charset)); + } + + virtual ~CSSStyleSheet(); + + CSSRule* ownerRule() const; + PassRefPtr cssRules(bool omitCharsetRules = false); + unsigned insertRule(const String& rule, unsigned index, ExceptionCode&); + void deleteRule(unsigned index, ExceptionCode&); + + // IE Extensions + PassRefPtr 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&); + + 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 diff --git a/WebCore/CSSTimingFunctionValue.h b/WebCore/CSSTimingFunctionValue.h new file mode 100644 index 0000000..e465993 --- /dev/null +++ b/WebCore/CSSTimingFunctionValue.h @@ -0,0 +1,67 @@ +/* + * 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 + +namespace WebCore { + +class CSSTimingFunctionValue : public CSSValue { +public: + static PassRefPtr 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 diff --git a/WebCore/CSSUnicodeRangeValue.h b/WebCore/CSSUnicodeRangeValue.h new file mode 100644 index 0000000..0ba1980 --- /dev/null +++ b/WebCore/CSSUnicodeRangeValue.h @@ -0,0 +1,62 @@ +/* + * 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 +#include + +namespace WebCore { + +class CSSUnicodeRangeValue : public CSSValue { +public: + static PassRefPtr 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 diff --git a/WebCore/CSSUnknownRule.h b/WebCore/CSSUnknownRule.h new file mode 100644 index 0000000..b2448dd --- /dev/null +++ b/WebCore/CSSUnknownRule.h @@ -0,0 +1,36 @@ +/* + * (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 diff --git a/WebCore/CSSValue.h b/WebCore/CSSValue.h new file mode 100644 index 0000000..0bd6496 --- /dev/null +++ b/WebCore/CSSValue.h @@ -0,0 +1,78 @@ +/* + * (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 +#include + +namespace WebCore { + +class CSSStyleSheet; + +typedef int ExceptionCode; + +class CSSValue : public RefCounted { +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&, const CSSStyleSheet*) { } +}; + +} // namespace WebCore + +#endif // CSSValue_h diff --git a/WebCore/CSSValueList.h b/WebCore/CSSValueList.h new file mode 100644 index 0000000..d34f445 --- /dev/null +++ b/WebCore/CSSValueList.h @@ -0,0 +1,77 @@ +/* + * (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 +#include + +namespace WebCore { + +class CSSParserValueList; + +class CSSValueList : public CSSValue { +public: + static PassRefPtr createCommaSeparated() + { + return adoptRef(new CSSValueList(false)); + } + static PassRefPtr createSpaceSeparated() + { + return adoptRef(new CSSValueList(true)); + } + static PassRefPtr 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); + void prepend(PassRefPtr); + + virtual String cssText() const; + + CSSParserValueList* createParserValueList() const; + + virtual void addSubresourceStyleURLs(ListHashSet&, const CSSStyleSheet*); + +protected: + CSSValueList(bool isSpaceSeparated); + CSSValueList(CSSParserValueList*); + +private: + virtual bool isValueList() const { return true; } + + virtual unsigned short cssValueType() const; + + Vector > m_values; + bool m_isSpaceSeparated; +}; + +} // namespace WebCore + +#endif // CSSValueList_h diff --git a/WebCore/CSSVariableDependentValue.h b/WebCore/CSSVariableDependentValue.h new file mode 100644 index 0000000..e8dce2e --- /dev/null +++ b/WebCore/CSSVariableDependentValue.h @@ -0,0 +1,57 @@ +/* + * 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 create(PassRefPtr 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); + + RefPtr m_list; +}; + +} +#endif + diff --git a/WebCore/CSSVariablesDeclaration.h b/WebCore/CSSVariablesDeclaration.h new file mode 100644 index 0000000..aa98158 --- /dev/null +++ b/WebCore/CSSVariablesDeclaration.h @@ -0,0 +1,82 @@ +/* + * 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 +#include +#include + +namespace WebCore { + +typedef int ExceptionCode; + +class CSSMutableStyleDeclaration; +class CSSRule; +class CSSValue; +class CSSValueList; + +class CSSVariablesDeclaration : public StyleBase { +public: + static PassRefPtr create(StyleBase* owningRule, const Vector& names, const Vector >& 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 variableValue, bool updateNamesList = true); + + CSSValueList* getParsedVariable(const String& variableName); + CSSMutableStyleDeclaration* getParsedVariableDeclarationBlock(const String& variableName); + +private: + CSSVariablesDeclaration(StyleBase* owningRule, const Vector& names, const Vector >& values); + + void setChanged(); + +protected: + Vector m_variableNames; + HashMap > m_variablesMap; +}; + +} // namespace WebCore + +#endif // CSSVariablesDeclaration_h diff --git a/WebCore/CSSVariablesRule.h b/WebCore/CSSVariablesRule.h new file mode 100644 index 0000000..d2cea39 --- /dev/null +++ b/WebCore/CSSVariablesRule.h @@ -0,0 +1,70 @@ +/* + * 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 + +namespace WebCore { + +class CSSStyleSheet; +class MediaList; + +class CSSVariablesRule : public CSSRule { +public: + static PassRefPtr 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 decl) { m_variables = decl; } + +private: + CSSVariablesRule(CSSStyleSheet* parent, MediaList*, bool variablesKeyword); + + RefPtr m_lstMedia; + RefPtr m_variables; + bool m_variablesKeyword; +}; + +} // namespace WebCore + +#endif // CSSVariablesRule_h diff --git a/WebCore/CString.h b/WebCore/CString.h new file mode 100644 index 0000000..09f112f --- /dev/null +++ b/WebCore/CString.h @@ -0,0 +1,80 @@ +/* + * 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 +#include +#include + +namespace WebCore { + + class CStringBuffer : public RefCounted { + public: + static PassRefPtr create(unsigned length) { return adoptRef(new CStringBuffer(length)); } + + char* data() { return m_vector.data(); } + size_t length() const { return m_vector.size(); } + + PassRefPtr releaseBuffer() { return SharedBuffer::adoptVector(m_vector); } + + private: + CStringBuffer(unsigned length) : m_vector(length) { } + + Vector 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 releaseBuffer(); + + private: + void copyBufferIfNeeded(); + void init(const char*, unsigned length); + RefPtr 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 diff --git a/WebCore/Cache.h b/WebCore/Cache.h new file mode 100644 index 0000000..3ca70dc --- /dev/null +++ b/WebCore/Cache.h @@ -0,0 +1,212 @@ +/* + Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) + Copyright (C) 2001 Dirk Mueller + 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 +#include +#include +#include + +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 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 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 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 m_resources; +}; + +// Function to obtain the global cache. +Cache* cache(); + +} + +#endif diff --git a/WebCore/CachePolicy.h b/WebCore/CachePolicy.h new file mode 100644 index 0000000..93f92b1 --- /dev/null +++ b/WebCore/CachePolicy.h @@ -0,0 +1,40 @@ +/* + * 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 diff --git a/WebCore/CachedCSSStyleSheet.h b/WebCore/CachedCSSStyleSheet.h new file mode 100644 index 0000000..fa0b31a --- /dev/null +++ b/WebCore/CachedCSSStyleSheet.h @@ -0,0 +1,68 @@ +/* + Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) + Copyright (C) 2001 Dirk Mueller + 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 + +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 data, bool allDataReceived); + virtual void error(); + + virtual bool schedule() const { return true; } + + void checkNotify(); + + private: + bool canUseSheet(bool enforceMIMEType) const; + + protected: + RefPtr m_decoder; + String m_decodedSheetText; + }; + +} + +#endif diff --git a/WebCore/CachedFont.h b/WebCore/CachedFont.h new file mode 100644 index 0000000..fd19cdb --- /dev/null +++ b/WebCore/CachedFont.h @@ -0,0 +1,89 @@ +/* + * 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 + +#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 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 m_externalSVGDocument; +#endif + + friend class Cache; +}; + +} + +#endif diff --git a/WebCore/CachedFrame.h b/WebCore/CachedFrame.h new file mode 100644 index 0000000..c7beb15 --- /dev/null +++ b/WebCore/CachedFrame.h @@ -0,0 +1,73 @@ +/* + * 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 + +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 m_document; + RefPtr m_documentLoader; + RefPtr m_view; + RefPtr m_mousePressNode; + KURL m_URL; + ScriptCachedFrameData m_cachedFrameScriptData; + OwnPtr m_cachedFramePlatformData; +}; + +} // namespace WebCore + +#endif // CachedFrame_h diff --git a/WebCore/CachedFramePlatformData.h b/WebCore/CachedFramePlatformData.h new file mode 100644 index 0000000..01da8e5 --- /dev/null +++ b/WebCore/CachedFramePlatformData.h @@ -0,0 +1,45 @@ +/* + * 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 diff --git a/WebCore/CachedImage.h b/WebCore/CachedImage.h new file mode 100644 index 0000000..30cc234 --- /dev/null +++ b/WebCore/CachedImage.h @@ -0,0 +1,112 @@ +/* + Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) + Copyright (C) 2001 Dirk Mueller + 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 + +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 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*); + + RefPtr m_image; + Timer m_decodedDataDeletionTimer; + +public: + unsigned animatedImageSize(); + void stopAnimatedImage(); + +private: + bool checkOutOfMemory(); +}; + +} + +#endif diff --git a/WebCore/CachedPage.h b/WebCore/CachedPage.h new file mode 100644 index 0000000..a9cf71c --- /dev/null +++ b/WebCore/CachedPage.h @@ -0,0 +1,72 @@ +/* + * 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 { +public: + static PassRefPtr 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 + diff --git a/WebCore/CachedResource.h b/WebCore/CachedResource.h new file mode 100644 index 0000000..0c61c75 --- /dev/null +++ b/WebCore/CachedResource.h @@ -0,0 +1,252 @@ +/* + Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) + Copyright (C) 2001 Dirk Mueller + 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 +#include +#include +#include +#include + +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 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 m_clients; + + String m_url; + String m_accept; + Request* m_request; + + ResourceResponse m_response; + RefPtr m_data; + OwnPtr 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 m_handlesToRevalidate; + + time_t m_expirationDate; +}; + +} + +#endif diff --git a/WebCore/CachedResourceClient.h b/WebCore/CachedResourceClient.h new file mode 100644 index 0000000..1f20f47 --- /dev/null +++ b/WebCore/CachedResourceClient.h @@ -0,0 +1,82 @@ +/* + Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) + Copyright (C) 2001 Dirk Mueller + 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 diff --git a/WebCore/CachedResourceClientWalker.h b/WebCore/CachedResourceClientWalker.h new file mode 100644 index 0000000..d079584 --- /dev/null +++ b/WebCore/CachedResourceClientWalker.h @@ -0,0 +1,49 @@ +/* + Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) + Copyright (C) 2001 Dirk Mueller + 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 +#include + +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* next(); + private: + const HashCountedSet& m_clientSet; + Vector m_clientVector; + size_t m_index; + }; + +} + +#endif diff --git a/WebCore/CachedResourceHandle.h b/WebCore/CachedResourceHandle.h new file mode 100644 index 0000000..13c03c7 --- /dev/null +++ b/WebCore/CachedResourceHandle.h @@ -0,0 +1,92 @@ +/* + * 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 CachedResourceHandle : public CachedResourceHandleBase { + public: + CachedResourceHandle() { } + CachedResourceHandle(R* res) : CachedResourceHandleBase(res) { } + CachedResourceHandle(const CachedResourceHandle& o) : CachedResourceHandleBase(o) { } + + R* get() const { return reinterpret_cast(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 bool operator==(const CachedResourceHandle& h, const RR* res) + { + return h.get() == res; + } + template bool operator==(const RR* res, const CachedResourceHandle& h) + { + return h.get() == res; + } + template bool operator!=(const CachedResourceHandle& h, const RR* res) + { + return h.get() != res; + } + template bool operator!=(const RR* res, const CachedResourceHandle& h) + { + return h.get() != res; + } +} + +#endif diff --git a/WebCore/CachedScript.h b/WebCore/CachedScript.h new file mode 100644 index 0000000..1715e06 --- /dev/null +++ b/WebCore/CachedScript.h @@ -0,0 +1,67 @@ +/* + Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) + Copyright (C) 2001 Dirk Mueller + 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 data, bool allDataReceived); + virtual void error(); + + virtual bool schedule() const { return false; } + + void checkNotify(); + + virtual void destroyDecodedData(); + + private: + void decodedDataDeletionTimerFired(Timer*); + + String m_script; + TextEncoding m_encoding; + Timer m_decodedDataDeletionTimer; + }; +} + +#endif diff --git a/WebCore/CachedXBLDocument.h b/WebCore/CachedXBLDocument.h new file mode 100644 index 0000000..b92a255 --- /dev/null +++ b/WebCore/CachedXBLDocument.h @@ -0,0 +1,67 @@ +/* + Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) + Copyright (C) 2001 Dirk Mueller + 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 + +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&, bool allDataReceived); + virtual void error(); + + virtual bool schedule() const { return true; } + + void checkNotify(); + + protected: + XBL::XBLDocument* m_document; + RefPtr m_decoder; + }; + +#endif + +} + +#endif diff --git a/WebCore/CachedXSLStyleSheet.h b/WebCore/CachedXSLStyleSheet.h new file mode 100644 index 0000000..9eca098 --- /dev/null +++ b/WebCore/CachedXSLStyleSheet.h @@ -0,0 +1,64 @@ +/* + Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) + Copyright (C) 2001 Dirk Mueller + 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 + +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 data, bool allDataReceived); + virtual void error(); + + virtual bool schedule() const { return true; } + + void checkNotify(); + + protected: + String m_sheet; + RefPtr m_decoder; + }; + +#endif + +} + +#endif diff --git a/WebCore/CanvasGradient.h b/WebCore/CanvasGradient.h new file mode 100644 index 0000000..3b81dbd --- /dev/null +++ b/WebCore/CanvasGradient.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2007 Alp Toker + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING 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 +#include + +namespace WebCore { + + class String; + + typedef int ExceptionCode; + + class CanvasGradient : public RefCounted { + public: + static PassRefPtr create(const FloatPoint& p0, const FloatPoint& p1) + { + return adoptRef(new CanvasGradient(p0, p1)); + } + static PassRefPtr 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 m_gradient; + }; + +} //namespace + +#endif diff --git a/WebCore/CanvasPattern.h b/WebCore/CanvasPattern.h new file mode 100644 index 0000000..6c012d1 --- /dev/null +++ b/WebCore/CanvasPattern.h @@ -0,0 +1,62 @@ +/* + * 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 +#include + +namespace WebCore { + + class Image; + class String; + + typedef int ExceptionCode; + + class CanvasPattern : public RefCounted { + public: + static void parseRepetitionType(const String&, bool& repeatX, bool& repeatY, ExceptionCode&); + + static PassRefPtr 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 m_pattern; + bool m_originClean; + }; + +} // namespace WebCore + +#endif diff --git a/WebCore/CanvasPixelArray.h b/WebCore/CanvasPixelArray.h new file mode 100644 index 0000000..b91a642 --- /dev/null +++ b/WebCore/CanvasPixelArray.h @@ -0,0 +1,64 @@ +/* + * 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 +#include +#include +#include +#include + +namespace WebCore { + + class CanvasPixelArray : public RefCounted { + public: + static PassRefPtr 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 m_data; + }; + +} // namespace WebCore + +#endif // CanvasPixelArray_h diff --git a/WebCore/CanvasRenderingContext2D.h b/WebCore/CanvasRenderingContext2D.h new file mode 100644 index 0000000..92fa5f1 --- /dev/null +++ b/WebCore/CanvasRenderingContext2D.h @@ -0,0 +1,263 @@ +/* + * 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 + +#if PLATFORM(CG) +#include +#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* fillStyle() const; + void setFillStyle(PassRefPtr); + + 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 createLinearGradient(float x0, float y0, float x1, float y1, ExceptionCode&); + PassRefPtr createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1, ExceptionCode&); + PassRefPtr createPattern(HTMLImageElement*, const String& repetitionType, ExceptionCode&); + PassRefPtr createPattern(HTMLCanvasElement*, const String& repetitionType, ExceptionCode&); + + PassRefPtr createImageData(float width, float height) const; + PassRefPtr 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 measureText(const String& text); + + LineCap getLineCap() const { return state().m_lineCap; } + LineJoin getLineJoin() const { return state().m_lineJoin; } + + private: + struct State { + State(); + + RefPtr m_strokeStyle; + RefPtr 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 m_stateStack; + }; + +} // namespace WebCore + +#endif diff --git a/WebCore/CanvasStyle.h b/WebCore/CanvasStyle.h new file mode 100644 index 0000000..fe01bd1 --- /dev/null +++ b/WebCore/CanvasStyle.h @@ -0,0 +1,89 @@ +/* + * 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 { + public: + static PassRefPtr create(const String& color) { return adoptRef(new CanvasStyle(color)); } + static PassRefPtr create(float grayLevel) { return adoptRef(new CanvasStyle(grayLevel)); } + static PassRefPtr create(const String& color, float alpha) { return adoptRef(new CanvasStyle(color, alpha)); } + static PassRefPtr create(float grayLevel, float alpha) { return adoptRef(new CanvasStyle(grayLevel, alpha)); } + static PassRefPtr create(float r, float g, float b, float a) { return adoptRef(new CanvasStyle(r, g, b, a)); } + static PassRefPtr create(float c, float m, float y, float k, float a) { return adoptRef(new CanvasStyle(c, m, y, k, a)); } + static PassRefPtr create(PassRefPtr gradient) { return adoptRef(new CanvasStyle(gradient)); } + static PassRefPtr create(PassRefPtr 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); + CanvasStyle(PassRefPtr); + + enum Type { ColorString, ColorStringWithAlpha, GrayLevel, RGBA, CMYKA, Gradient, ImagePattern }; + + Type m_type; + + String m_color; + RefPtr m_gradient; + RefPtr 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 diff --git a/WebCore/CharacterData.h b/WebCore/CharacterData.h new file mode 100644 index 0000000..412650e --- /dev/null +++ b/WebCore/CharacterData.h @@ -0,0 +1,75 @@ +/* + * 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 m_data; + + void dispatchModifiedEvent(StringImpl* oldValue); + +private: + void checkCharDataOperation(unsigned offset, ExceptionCode&); +}; + +} // namespace WebCore + +#endif // CharacterData_h + diff --git a/WebCore/CharacterNames.h b/WebCore/CharacterNames.h new file mode 100644 index 0000000..6b7f22f --- /dev/null +++ b/WebCore/CharacterNames.h @@ -0,0 +1,63 @@ +/* + * 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 + +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 diff --git a/WebCore/ChildNodeList.h b/WebCore/ChildNodeList.h new file mode 100644 index 0000000..f38106d --- /dev/null +++ b/WebCore/ChildNodeList.h @@ -0,0 +1,50 @@ +/* + * 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 + +namespace WebCore { + + class ChildNodeList : public DynamicNodeList { + public: + static PassRefPtr create(PassRefPtr rootNode, Caches* caches) + { + return adoptRef(new ChildNodeList(rootNode, caches)); + } + + virtual unsigned length() const; + virtual Node* item(unsigned index) const; + + protected: + ChildNodeList(PassRefPtr rootNode, Caches*); + + virtual bool nodeMatches(Element*) const; + }; + +} // namespace WebCore + +#endif // ChildNodeList_h diff --git a/WebCore/Chrome.h b/WebCore/Chrome.h new file mode 100644 index 0000000..1da40fb --- /dev/null +++ b/WebCore/Chrome.h @@ -0,0 +1,143 @@ +/* + * 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 +#include + +#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); + +#if PLATFORM(MAC) + void focusNSView(NSView*); +#endif + + private: + Page* m_page; + ChromeClient* m_client; + }; +} + +#endif // Chrome_h diff --git a/WebCore/ChromeClient.h b/WebCore/ChromeClient.h new file mode 100644 index 0000000..191fb78 --- /dev/null +++ b/WebCore/ChromeClient.h @@ -0,0 +1,218 @@ +/* + * 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 +#include + +#include "Console.h" +#include + +#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, 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) = 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 diff --git a/WebCore/ClassNames.h b/WebCore/ClassNames.h new file mode 100644 index 0000000..7992d54 --- /dev/null +++ b/WebCore/ClassNames.h @@ -0,0 +1,89 @@ +/* + * 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 +#include + +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 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 m_data; + }; + + inline bool isClassWhitespace(UChar c) + { + return c == ' ' || c == '\r' || c == '\n' || c == '\t' || c == '\f'; + } + +} // namespace WebCore + +#endif // ClassNames_h diff --git a/WebCore/ClassNodeList.h b/WebCore/ClassNodeList.h new file mode 100644 index 0000000..d40ee19 --- /dev/null +++ b/WebCore/ClassNodeList.h @@ -0,0 +1,55 @@ +/* + * 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 create(PassRefPtr rootNode, const String& classNames, Caches* caches) + { + return adoptRef(new ClassNodeList(rootNode, classNames, caches)); + } + + private: + ClassNodeList(PassRefPtr rootNode, const String& classNames, Caches*); + + virtual bool nodeMatches(Element*) const; + + ClassNames m_classNames; + }; + +} // namespace WebCore + +#endif // ClassNodeList_h diff --git a/WebCore/Clipboard.h b/WebCore/Clipboard.h new file mode 100644 index 0000000..59ae026 --- /dev/null +++ b/WebCore/Clipboard.h @@ -0,0 +1,100 @@ +/* + * 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 { + 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 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 m_dragImage; + RefPtr m_dragImageElement; + }; + +} // namespace WebCore + +#endif // Clipboard_h diff --git a/WebCore/ClipboardAccessPolicy.h b/WebCore/ClipboardAccessPolicy.h new file mode 100644 index 0000000..7a54009 --- /dev/null +++ b/WebCore/ClipboardAccessPolicy.h @@ -0,0 +1,37 @@ +/* + * 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 diff --git a/WebCore/ClipboardEvent.h b/WebCore/ClipboardEvent.h new file mode 100644 index 0000000..b9bc705 --- /dev/null +++ b/WebCore/ClipboardEvent.h @@ -0,0 +1,56 @@ +/* + * 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 create() + { + return adoptRef(new ClipboardEvent); + } + static PassRefPtr create(const AtomicString& type, bool canBubbleArg, bool cancelableArg, PassRefPtr 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); + + RefPtr m_clipboard; + }; + +} // namespace WebCore + +#endif // ClipboardEvent_h diff --git a/WebCore/CollapsedBorderValue.h b/WebCore/CollapsedBorderValue.h new file mode 100644 index 0000000..805f474 --- /dev/null +++ b/WebCore/CollapsedBorderValue.h @@ -0,0 +1,66 @@ +/* + * 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 diff --git a/WebCore/Color.h b/WebCore/Color.h new file mode 100644 index 0000000..2f54a9c --- /dev/null +++ b/WebCore/Color.h @@ -0,0 +1,157 @@ +/* + * 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 + +#if PLATFORM(CG) +typedef struct CGColor* CGColorRef; +#endif + +#if PLATFORM(QT) +#include +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 diff --git a/WebCore/ColorMac.h b/WebCore/ColorMac.h new file mode 100644 index 0000000..f279b22 --- /dev/null +++ b/WebCore/ColorMac.h @@ -0,0 +1,43 @@ +/* + * 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 diff --git a/WebCore/Comment.h b/WebCore/Comment.h new file mode 100644 index 0000000..f5f1810 --- /dev/null +++ b/WebCore/Comment.h @@ -0,0 +1,51 @@ +/* + * 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 cloneNode(bool deep); + + // Other methods (not part of DOM) + virtual bool isCommentNode() const { return true; } + virtual bool childTypeAllowed(NodeType); +}; + +} // namespace WebCore + +#endif // Comment_h diff --git a/WebCore/CompositeEditCommand.h b/WebCore/CompositeEditCommand.h new file mode 100644 index 0000000..403d24e --- /dev/null +++ b/WebCore/CompositeEditCommand.h @@ -0,0 +1,120 @@ +/* + * 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 + +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, PassRefPtr parent); + void applyCommandToComposite(PassRefPtr); + void applyStyle(CSSStyleDeclaration*, EditAction = EditActionChangeAttributes); + void applyStyle(CSSStyleDeclaration*, const Position& start, const Position& end, EditAction = EditActionChangeAttributes); + void applyStyledElement(PassRefPtr); + void removeStyledElement(PassRefPtr); + 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, unsigned offset, unsigned count); + void inputText(const String&, bool selectInsertedText = false); + void insertNodeAfter(PassRefPtr, PassRefPtr refChild); + void insertNodeAt(PassRefPtr, const Position&); + void insertNodeAtTabSpanPosition(PassRefPtr, const Position&); + void insertNodeBefore(PassRefPtr, PassRefPtr refChild); + void insertParagraphSeparator(bool useDefaultParagraphElement = false); + void insertLineBreak(); + void insertTextIntoNode(PassRefPtr, unsigned offset, const String& text); + void joinTextNodes(PassRefPtr, PassRefPtr); + void mergeIdenticalElements(PassRefPtr, PassRefPtr); + void rebalanceWhitespace(); + void rebalanceWhitespaceAt(const Position&); + void prepareWhitespaceAtPositionForSplit(Position&); + void removeCSSProperty(PassRefPtr, CSSPropertyID); + void removeNodeAttribute(PassRefPtr, const QualifiedName& attribute); + void removeChildrenInRange(PassRefPtr, unsigned from, unsigned to); + virtual void removeNode(PassRefPtr); + void removeNodePreservingChildren(PassRefPtr); + void removeNodeAndPruneAncestors(PassRefPtr); + void prune(PassRefPtr); + void replaceTextInNode(PassRefPtr, unsigned offset, unsigned count, const String& replacementText); + Position positionOutsideTabSpan(const Position&); + void setNodeAttribute(PassRefPtr, const QualifiedName& attribute, const AtomicString& value); + void splitElement(PassRefPtr, PassRefPtr atChild); + void splitTextNode(PassRefPtr, unsigned offset); + void splitTextNodeContainingElement(PassRefPtr, unsigned offset); + void wrapContentsInDummySpan(PassRefPtr); + + void deleteInsignificantText(PassRefPtr, unsigned start, unsigned end); + void deleteInsignificantText(const Position& start, const Position& end); + void deleteInsignificantTextDownstream(const Position&); + + PassRefPtr appendBlockPlaceholder(PassRefPtr); + PassRefPtr insertBlockPlaceholder(const Position&); + PassRefPtr addBlockPlaceholderIfNeeded(Element*); + void removePlaceholderAt(const Position&); + + PassRefPtr insertNewDefaultParagraphElementAt(const Position&); + + PassRefPtr 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 splitTreeToNode(Node*, Node*, bool splitAncestor = false); + + Vector > m_commands; + +private: + virtual void doUnapply(); + virtual void doReapply(); +}; + +} // namespace WebCore + +#endif // CompositeEditCommand_h diff --git a/WebCore/Console.h b/WebCore/Console.h new file mode 100644 index 0000000..7301fc9 --- /dev/null +++ b/WebCore/Console.h @@ -0,0 +1,122 @@ +/* + * 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 +#endif + +#include +#include + +namespace WebCore { + +#if USE(JSC) + typedef Vector > 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 { + public: + static PassRefPtr 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 diff --git a/WebCore/ContainerNode.h b/WebCore/ContainerNode.h new file mode 100644 index 0000000..f6bce34 --- /dev/null +++ b/WebCore/ContainerNode.h @@ -0,0 +1,126 @@ +/* + * 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 + 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 newChild, Node* refChild, ExceptionCode&, bool shouldLazyAttach = false); + virtual bool replaceChild(PassRefPtr newChild, Node* oldChild, ExceptionCode&, bool shouldLazyAttach = false); + virtual bool removeChild(Node* child, ExceptionCode&); + virtual bool appendChild(PassRefPtr newChild, ExceptionCode&, bool shouldLazyAttach = false); + + virtual ContainerNode* addChild(PassRefPtr); + 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 + friend void appendChildToContainer(GenericNode* child, GenericNodeContainer* container); + + template + 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(this)->childNodeCount(); +} + +inline Node* Node::containerChildNode(unsigned index) const +{ + ASSERT(isContainerNode()); + return static_cast(this)->childNode(index); +} + +inline Node* Node::containerFirstChild() const +{ + ASSERT(isContainerNode()); + return static_cast(this)->firstChild(); +} + +inline Node* Node::containerLastChild() const +{ + ASSERT(isContainerNode()); + return static_cast(this)->lastChild(); +} + +} // namespace WebCore + +#endif // ContainerNode_h diff --git a/WebCore/ContainerNodeAlgorithms.h b/WebCore/ContainerNodeAlgorithms.h new file mode 100644 index 0000000..55095a7 --- /dev/null +++ b/WebCore/ContainerNodeAlgorithms.h @@ -0,0 +1,149 @@ +/* + * Copyright (C) 2007 Apple Inc. All rights reserved. + * (C) 2008 Nikolas Zimmermann + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see 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 + +namespace WebCore { + +class Node; + +namespace Private { + + template + 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 +void removeAllChildrenInContainer(GenericNodeContainer* container) +{ + // List of nodes to be deleted. + GenericNode* head = 0; + GenericNode* tail = 0; + + Private::addChildNodesToDeletionQueue(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(head, tail, static_cast(n)); + + delete n; + } +} + +template +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 + struct NodeRemovalDispatcher { + static void dispatch(GenericNode*) + { + // no-op, by default + } + }; + + template + struct NodeRemovalDispatcher { + static void dispatch(GenericNode* node) + { + if (node->inDocument()) + node->removedFromDocument(); + } + }; + + template + struct ShouldDispatchRemovalNotification { + static const bool value = false; + }; + + template<> + struct ShouldDispatchRemovalNotification { + static const bool value = true; + }; + + template + 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::value>::dispatch(n); + } + + container->setFirstChild(0); + container->setLastChild(0); + } +}; + +} // namespace WebCore + +#endif // ContainerNodeAlgorithms_h diff --git a/WebCore/ContentData.h b/WebCore/ContentData.h new file mode 100644 index 0000000..44785ef --- /dev/null +++ b/WebCore/ContentData.h @@ -0,0 +1,62 @@ +/* + * 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 + +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 diff --git a/WebCore/ContentType.h b/WebCore/ContentType.h new file mode 100644 index 0000000..bf8fc4c --- /dev/null +++ b/WebCore/ContentType.h @@ -0,0 +1,47 @@ +/* + * 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 diff --git a/WebCore/ContextMenu.h b/WebCore/ContextMenu.h new file mode 100644 index 0000000..9418ff5 --- /dev/null +++ b/WebCore/ContextMenu.h @@ -0,0 +1,89 @@ +/* + * 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 + +#include "ContextMenuItem.h" +#include "HitTestResult.h" +#include "PlatformMenuDescription.h" +#include "PlatformString.h" +#if PLATFORM(MAC) +#include +#elif PLATFORM(QT) +#include +#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 m_platformDescription; +#elif PLATFORM(QT) + QList m_items; +#else + PlatformMenuDescription m_platformDescription; +#endif + }; + +} + +#endif // ContextMenu_h diff --git a/WebCore/ContextMenuClient.h b/WebCore/ContextMenuClient.h new file mode 100644 index 0000000..775adc5 --- /dev/null +++ b/WebCore/ContextMenuClient.h @@ -0,0 +1,59 @@ +/* + * 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 diff --git a/WebCore/ContextMenuController.h b/WebCore/ContextMenuController.h new file mode 100644 index 0000000..cb7e6ee --- /dev/null +++ b/WebCore/ContextMenuController.h @@ -0,0 +1,61 @@ +/* + * 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 +#include + +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 m_contextMenu; + }; + +} + +#endif diff --git a/WebCore/ContextMenuItem.h b/WebCore/ContextMenuItem.h new file mode 100644 index 0000000..8ce00eb --- /dev/null +++ b/WebCore/ContextMenuItem.h @@ -0,0 +1,238 @@ +/* + * 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 + +#if PLATFORM(MAC) +#include + +#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 +#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 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 m_platformDescription; +#else + PlatformMenuItemDescription m_platformDescription; +#endif + }; + +} + +#endif // ContextMenuItem_h diff --git a/WebCore/CookieJar.h b/WebCore/CookieJar.h new file mode 100644 index 0000000..178ee79 --- /dev/null +++ b/WebCore/CookieJar.h @@ -0,0 +1,41 @@ +/* + * 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 diff --git a/WebCore/Coordinates.h b/WebCore/Coordinates.h new file mode 100644 index 0000000..acb5dd0 --- /dev/null +++ b/WebCore/Coordinates.h @@ -0,0 +1,88 @@ +/* + * 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 + +namespace WebCore { + +typedef int ExceptionCode; + +class Coordinates : public RefCounted { +public: + static PassRefPtr 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 diff --git a/WebCore/CoreTextController.h b/WebCore/CoreTextController.h new file mode 100644 index 0000000..8dbb7fb --- /dev/null +++ b/WebCore/CoreTextController.h @@ -0,0 +1,114 @@ +/* + * 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 +#include + +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 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 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 m_smallCapsBuffer; + + Vector m_coreTextRuns; + Vector m_adjustedAdvances; + Vector 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 diff --git a/WebCore/Counter.h b/WebCore/Counter.h new file mode 100644 index 0000000..0a45009 --- /dev/null +++ b/WebCore/Counter.h @@ -0,0 +1,61 @@ +/* + * (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 { +public: + static PassRefPtr create(PassRefPtr identifier, PassRefPtr listStyle, PassRefPtr 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 identifier) { m_identifier = identifier; } + void setListStyle(PassRefPtr listStyle) { m_listStyle = listStyle; } + void setSeparator(PassRefPtr separator) { m_separator = separator; } + +private: + Counter(PassRefPtr identifier, PassRefPtr listStyle, PassRefPtr separator) + : m_identifier(identifier) + , m_listStyle(listStyle) + , m_separator(separator) + { + } + + RefPtr m_identifier; // string + RefPtr m_listStyle; // int + RefPtr m_separator; // string +}; + +} // namespace WebCore + +#endif // Counter_h diff --git a/WebCore/CounterContent.h b/WebCore/CounterContent.h new file mode 100644 index 0000000..06440ad --- /dev/null +++ b/WebCore/CounterContent.h @@ -0,0 +1,62 @@ +/* + * 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 diff --git a/WebCore/CounterDirectives.h b/WebCore/CounterDirectives.h new file mode 100644 index 0000000..9cbdeae --- /dev/null +++ b/WebCore/CounterDirectives.h @@ -0,0 +1,54 @@ +/* + * 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 +#include + +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, CounterDirectives> CounterDirectiveMap; + +} // namespace WebCore + +#endif // CounterDirectives_h diff --git a/WebCore/CounterNode.h b/WebCore/CounterNode.h new file mode 100644 index 0000000..57f9563 --- /dev/null +++ b/WebCore/CounterNode.h @@ -0,0 +1,81 @@ +/* + * 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 + +// 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 diff --git a/WebCore/CreateLinkCommand.h b/WebCore/CreateLinkCommand.h new file mode 100644 index 0000000..ba5fe6f --- /dev/null +++ b/WebCore/CreateLinkCommand.h @@ -0,0 +1,51 @@ +/* + * 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 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 diff --git a/WebCore/Credential.h b/WebCore/Credential.h new file mode 100644 index 0000000..4d80490 --- /dev/null +++ b/WebCore/Credential.h @@ -0,0 +1,59 @@ +/* + * 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 diff --git a/WebCore/CrossOriginAccessControl.h b/WebCore/CrossOriginAccessControl.h new file mode 100644 index 0000000..267646f --- /dev/null +++ b/WebCore/CrossOriginAccessControl.h @@ -0,0 +1,41 @@ +/* + * 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 diff --git a/WebCore/CrossOriginPreflightResultCache.h b/WebCore/CrossOriginPreflightResultCache.h new file mode 100644 index 0000000..a7ec957 --- /dev/null +++ b/WebCore/CrossOriginPreflightResultCache.h @@ -0,0 +1,76 @@ +/* + * 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 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 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, CrossOriginPreflightResultCacheItem*> CrossOriginPreflightResultHashMap; + + CrossOriginPreflightResultHashMap m_preflightHashMap; + Mutex m_mutex; + }; + +} // namespace WebCore diff --git a/WebCore/Cursor.h b/WebCore/Cursor.h new file mode 100644 index 0000000..609e438 --- /dev/null +++ b/WebCore/Cursor.h @@ -0,0 +1,106 @@ +/* + * 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 + +#if PLATFORM(WIN) +typedef struct HICON__* HICON; +typedef HICON HCURSOR; +#include +#include +#include +#elif PLATFORM(GTK) +typedef struct _GdkCursor GdkCursor; +#elif PLATFORM(QT) +#include +#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 diff --git a/WebCore/CursorData.h b/WebCore/CursorData.h new file mode 100644 index 0000000..7c6b31d --- /dev/null +++ b/WebCore/CursorData.h @@ -0,0 +1,56 @@ +/* + * 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 cursorImage; +}; + +} // namespace WebCore + +#endif // CursorData_h diff --git a/WebCore/CursorList.h b/WebCore/CursorList.h new file mode 100644 index 0000000..bdd65d4 --- /dev/null +++ b/WebCore/CursorList.h @@ -0,0 +1,59 @@ +/* + * 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 +#include + +namespace WebCore { + +class CursorList : public RefCounted { +public: + static PassRefPtr 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 m_vector; +}; + +} // namespace WebCore + +#endif // CursorList_h diff --git a/WebCore/DNS.h b/WebCore/DNS.h new file mode 100644 index 0000000..c232272 --- /dev/null +++ b/WebCore/DNS.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2008 Collin Jackson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this 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 diff --git a/WebCore/DNSCFNet.cpp b/WebCore/DNSCFNet.cpp new file mode 100644 index 0000000..bf21ab1 --- /dev/null +++ b/WebCore/DNSCFNet.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2008 Collin Jackson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this 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(); +} + +} diff --git a/WebCore/DOM.h b/WebCore/DOM.h new file mode 100644 index 0000000..a3d6201 --- /dev/null +++ b/WebCore/DOM.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 +#import +#import +#import +#import +#import +#import +#import +#import +#import diff --git a/WebCore/DOMAbstractViewFrame.h b/WebCore/DOMAbstractViewFrame.h new file mode 100644 index 0000000..386a912 --- /dev/null +++ b/WebCore/DOMAbstractViewFrame.h @@ -0,0 +1,33 @@ +/* + * 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 + +@interface DOMAbstractView (Frame) +- (void)_disconnectFrame; +@end diff --git a/WebCore/DOMCSS.h b/WebCore/DOMCSS.h new file mode 100644 index 0000000..daaa8a0 --- /dev/null +++ b/WebCore/DOMCSS.h @@ -0,0 +1,300 @@ +/* + * Copyright (C) 2004 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 +#import +#import +#import +#import + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + +#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 diff --git a/WebCore/DOMCore.h b/WebCore/DOMCore.h new file mode 100644 index 0000000..afac8ed --- /dev/null +++ b/WebCore/DOMCore.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import diff --git a/WebCore/DOMCoreException.h b/WebCore/DOMCoreException.h new file mode 100644 index 0000000..3c89694 --- /dev/null +++ b/WebCore/DOMCoreException.h @@ -0,0 +1,52 @@ +/* + * 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 create(const ExceptionCodeDescription& description) + { + return adoptRef(new DOMCoreException(description)); + } + + private: + DOMCoreException(const ExceptionCodeDescription& description) + : ExceptionBase(description) + { + } + }; + +} // namespace WebCore + +#endif // DOMCoreException_h diff --git a/WebCore/DOMCustomXPathNSResolver.h b/WebCore/DOMCustomXPathNSResolver.h new file mode 100644 index 0000000..2609e90 --- /dev/null +++ b/WebCore/DOMCustomXPathNSResolver.h @@ -0,0 +1,56 @@ +/* + * 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 + +namespace WebCore { + + class Frame; + + class DOMCustomXPathNSResolver : public XPathNSResolver { + public: + static PassRefPtr create(id customResolver) { return adoptRef(new DOMCustomXPathNSResolver(customResolver)); } + virtual ~DOMCustomXPathNSResolver(); + + virtual String lookupNamespaceURI(const String& prefix); + + private: + DOMCustomXPathNSResolver(id ); + id m_customResolver; // DOMCustomXPathNSResolvers are always temporary, thus no need to GC protect the object. + }; + +} // namespace WebCore + +#endif // ENABLE(XPATH) + +#endif // DOMCustomXPathNSResolver_h diff --git a/WebCore/DOMEventException.h b/WebCore/DOMEventException.h new file mode 100644 index 0000000..a485955 --- /dev/null +++ b/WebCore/DOMEventException.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 + +#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_1_3 + +@class NSString; + +extern NSString * const DOMEventException; + +enum DOMEventExceptionCode { + DOM_UNSPECIFIED_EVENT_TYPE_ERR = 0 +}; + +#endif diff --git a/WebCore/DOMEvents.h b/WebCore/DOMEvents.h new file mode 100644 index 0000000..255007f --- /dev/null +++ b/WebCore/DOMEvents.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2004, 2006, 2008 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 +#import +#import +#import + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + +#if ENABLE(TOUCH_EVENTS) +#import +#import +#endif diff --git a/WebCore/DOMException.h b/WebCore/DOMException.h new file mode 100644 index 0000000..64d7194 --- /dev/null +++ b/WebCore/DOMException.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 + +#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 diff --git a/WebCore/DOMExtensions.h b/WebCore/DOMExtensions.h new file mode 100644 index 0000000..dcf3732 --- /dev/null +++ b/WebCore/DOMExtensions.h @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2004-2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + +#import + +@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 diff --git a/WebCore/DOMHTML.h b/WebCore/DOMHTML.h new file mode 100644 index 0000000..cd80612 --- /dev/null +++ b/WebCore/DOMHTML.h @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2004-2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import diff --git a/WebCore/DOMImplementation.h b/WebCore/DOMImplementation.h new file mode 100644 index 0000000..9e6f9a9 --- /dev/null +++ b/WebCore/DOMImplementation.h @@ -0,0 +1,72 @@ +/* + * 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 +#include + +namespace WebCore { + +class CSSStyleSheet; +class Document; +class DocumentType; +class Frame; +class HTMLDocument; +class String; + +typedef int ExceptionCode; + +class DOMImplementation : public RefCounted { +public: + static PassRefPtr create() { return adoptRef(new DOMImplementation); } + + // DOM methods & attributes for DOMImplementation + static bool hasFeature(const String& feature, const String& version); + static PassRefPtr createDocumentType(const String& qualifiedName, const String& publicId, const String &systemId, ExceptionCode&); + static PassRefPtr createDocument(const String& namespaceURI, const String& qualifiedName, DocumentType*, ExceptionCode&); + + DOMImplementation* getInterface(const String& feature); + + // From the DOMImplementationCSS interface + static PassRefPtr createCSSStyleSheet(const String& title, const String& media, ExceptionCode&); + + // From the HTMLDOMImplementation interface + static PassRefPtr createHTMLDocument(const String& title); + + // Other methods (not part of DOM) + static PassRefPtr createDocument(const String& MIMEType, Frame*, bool inViewSourceMode); + static PassRefPtr createDocument(Frame*); + static PassRefPtr createHTMLDocument(Frame*); + + static bool isXMLMIMEType(const String& MIMEType); + static bool isTextMIMEType(const String& MIMEType); + +private: + DOMImplementation() { } +}; + +} //namespace + +#endif diff --git a/WebCore/DOMImplementationFront.h b/WebCore/DOMImplementationFront.h new file mode 100644 index 0000000..877a3b6 --- /dev/null +++ b/WebCore/DOMImplementationFront.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see 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 + +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 createDocumentType(const String& qualifiedName, const String& publicId, const String& systemId, ExceptionCode&); + PassRefPtr createDocument(const String& namespaceURI, const String& qualifiedName, DocumentType*, ExceptionCode&); + DOMImplementationFront* getInterface(const String& feature); + PassRefPtr createCSSStyleSheet(const String& title, const String& media, ExceptionCode&); + PassRefPtr createHTMLDocument(const String& title); +}; + +DOMImplementationFront* implementationFront(Document*); +DOMImplementationFront* implementationFront(JSDOMImplementation*); + +} // namespace WebCore + +#endif // DOMImplementationFront_h diff --git a/WebCore/DOMInternal.h b/WebCore/DOMInternal.h new file mode 100644 index 0000000..83ef1aa --- /dev/null +++ b/WebCore/DOMInternal.h @@ -0,0 +1,95 @@ +/* + * 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 + +#import + +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 +@end + +#if ENABLE(XPATH) +@interface DOMNativeXPathNSResolver : DOMObject +@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 origin, PassRefPtr current); + +NSObject* getDOMWrapper(DOMObjectInternal*); +void addDOMWrapper(NSObject* wrapper, DOMObjectInternal*); +void removeDOMWrapper(DOMObjectInternal*); + +template +inline id getDOMWrapper(Source impl) +{ + return getDOMWrapper(reinterpret_cast(impl)); +} + +template +inline void addDOMWrapper(NSObject* wrapper, Source impl) +{ + addDOMWrapper(wrapper, reinterpret_cast(impl)); +} + +DOMNodeFilter *kit(WebCore::NodeFilter*); +WebCore::NodeFilter* core(DOMNodeFilter *); + +#if ENABLE(XPATH) +DOMNativeXPathNSResolver *kit(WebCore::XPathNSResolver*); +WebCore::XPathNSResolver* core(DOMNativeXPathNSResolver *); +#endif // ENABLE(XPATH) diff --git a/WebCore/DOMObject.h b/WebCore/DOMObject.h new file mode 100644 index 0000000..1a3f1f3 --- /dev/null +++ b/WebCore/DOMObject.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2004, 2006, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 +#import + +#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_1_3 + +@class DOMStyleSheet; + +typedef unsigned long long DOMTimeStamp; + +typedef struct DOMObjectInternal DOMObjectInternal; + +@interface DOMObject : WebScriptObject +{ +@private + DOMObjectInternal *_internal; +} +@end + +@interface DOMObject (DOMLinkStyle) +- (DOMStyleSheet *)sheet; +@end + +#endif diff --git a/WebCore/DOMPrivate.h b/WebCore/DOMPrivate.h new file mode 100644 index 0000000..c6a2b62 --- /dev/null +++ b/WebCore/DOMPrivate.h @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2004-2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + +#import +#import +#import +#import +#import +#import +#import +#import +#if ENABLE(SVG_DOM_OBJC_BINDINGS) +#import +#endif +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + +#import + +@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 diff --git a/WebCore/DOMRangeException.h b/WebCore/DOMRangeException.h new file mode 100644 index 0000000..874a540 --- /dev/null +++ b/WebCore/DOMRangeException.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 + +#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 diff --git a/WebCore/DOMRanges.h b/WebCore/DOMRanges.h new file mode 100644 index 0000000..c7e9ffc --- /dev/null +++ b/WebCore/DOMRanges.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 +#import diff --git a/WebCore/DOMSVG.h b/WebCore/DOMSVG.h new file mode 100644 index 0000000..f1321d8 --- /dev/null +++ b/WebCore/DOMSVG.h @@ -0,0 +1,170 @@ +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import diff --git a/WebCore/DOMSVGException.h b/WebCore/DOMSVGException.h new file mode 100644 index 0000000..b757978 --- /dev/null +++ b/WebCore/DOMSVGException.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 + +#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 diff --git a/WebCore/DOMSelection.h b/WebCore/DOMSelection.h new file mode 100644 index 0000000..fd8d1fc --- /dev/null +++ b/WebCore/DOMSelection.h @@ -0,0 +1,102 @@ +/* + * 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 +#include +#include + +namespace WebCore { + + class Frame; + class Range; + class Node; + class String; + + typedef int ExceptionCode; + + class DOMSelection : public RefCounted { + public: + static PassRefPtr 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 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 diff --git a/WebCore/DOMStringList.h b/WebCore/DOMStringList.h new file mode 100644 index 0000000..630e33e --- /dev/null +++ b/WebCore/DOMStringList.h @@ -0,0 +1,46 @@ +/* + * 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 + +namespace WebCore { + + class DOMStringList : public RefCounted { + 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 diff --git a/WebCore/DOMStylesheets.h b/WebCore/DOMStylesheets.h new file mode 100644 index 0000000..81b5def --- /dev/null +++ b/WebCore/DOMStylesheets.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2004 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 +#import +#import + +#import +#import +#import diff --git a/WebCore/DOMTimer.h b/WebCore/DOMTimer.h new file mode 100644 index 0000000..200b9b1 --- /dev/null +++ b/WebCore/DOMTimer.h @@ -0,0 +1,68 @@ +/* + * 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 + +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 m_action; + double m_nextFireInterval; + double m_repeatInterval; +}; + +} // namespace WebCore + +#endif // DOMTimer_h + diff --git a/WebCore/DOMTraversal.h b/WebCore/DOMTraversal.h new file mode 100644 index 0000000..db9dea8 --- /dev/null +++ b/WebCore/DOMTraversal.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 +#import +#import + +#import +#import +#import diff --git a/WebCore/DOMUIKitExtensions.h b/WebCore/DOMUIKitExtensions.h new file mode 100644 index 0000000..4e8137a --- /dev/null +++ b/WebCore/DOMUIKitExtensions.h @@ -0,0 +1,42 @@ +// +// 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 + diff --git a/WebCore/DOMViews.h b/WebCore/DOMViews.h new file mode 100644 index 0000000..4b625c8 --- /dev/null +++ b/WebCore/DOMViews.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2004 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 +#import +#import + +#import diff --git a/WebCore/DOMWindow.h b/WebCore/DOMWindow.h new file mode 100644 index 0000000..3ddf69f --- /dev/null +++ b/WebCore/DOMWindow.h @@ -0,0 +1,332 @@ +/* + * 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 +#include +#include + +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 { + public: + static PassRefPtr 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 getComputedStyle(Element*, const String& pseudoElt) const; + + // WebKit extensions + PassRefPtr getMatchedCSSRules(Element*, const String& pseudoElt, bool authorOnly = true) const; + double devicePixelRatio() const; + + PassRefPtr webkitConvertPointFromPageToNode(Node* node, const WebKitPoint* p) const; + PassRefPtr webkitConvertPointFromNodeToPage(Node* node, const WebKitPoint* p) const; + +#if ENABLE(DATABASE) + // HTML 5 client-side database + PassRefPtr 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* onblur() const; + void setOnblur(PassRefPtr); + EventListener* onchange() const; + void setOnchange(PassRefPtr); + EventListener* onclick() const; + void setOnclick(PassRefPtr); + EventListener* ondblclick() const; + void setOndblclick(PassRefPtr); + EventListener* onerror() const; + void setOnerror(PassRefPtr); + EventListener* onfocus() const; + void setOnfocus(PassRefPtr); + EventListener* onkeydown() const; + void setOnkeydown(PassRefPtr); + EventListener* onkeypress() const; + void setOnkeypress(PassRefPtr); + EventListener* onkeyup() const; + void setOnkeyup(PassRefPtr); + EventListener* onload() const; + void setOnload(PassRefPtr); + EventListener* onmousedown() const; + void setOnmousedown(PassRefPtr); + EventListener* onmousemove() const; + void setOnmousemove(PassRefPtr); + EventListener* onmouseout() const; + void setOnmouseout(PassRefPtr); + EventListener* onmouseover() const; + void setOnmouseover(PassRefPtr); + EventListener* onmouseup() const; + void setOnmouseup(PassRefPtr); + EventListener* onmousewheel() const; + void setOnmousewheel(PassRefPtr); + EventListener* onreset() const; + void setOnreset(PassRefPtr); + EventListener* onresize() const; + void setOnresize(PassRefPtr); + EventListener* onscroll() const; + void setOnscroll(PassRefPtr); + EventListener* onsearch() const; + void setOnsearch(PassRefPtr); + EventListener* onselect() const; + void setOnselect(PassRefPtr); + EventListener* onsubmit() const; + void setOnsubmit(PassRefPtr); + EventListener* onunload() const; + void setOnunload(PassRefPtr); + EventListener* onbeforeunload() const; + void setOnbeforeunload(PassRefPtr); + EventListener* onwebkitanimationstart() const; + void setOnwebkitanimationstart(PassRefPtr); + EventListener* onwebkitanimationiteration() const; + void setOnwebkitanimationiteration(PassRefPtr); + EventListener* onwebkitanimationend() const; + void setOnwebkitanimationend(PassRefPtr); + EventListener* onwebkittransitionend() const; + void setOnwebkittransitionend(PassRefPtr); + EventListener* onorientationchange() const; + void setOnorientationchange(PassRefPtr); +#if ENABLE(TOUCH_EVENTS) + EventListener* ontouchstart() const; + void setOntouchstart(PassRefPtr); + EventListener* ontouchmove() const; + void setOntouchmove(PassRefPtr); + EventListener* ontouchend() const; + void setOntouchend(PassRefPtr); + EventListener* ontouchcancel() const; + void setOntouchcancel(PassRefPtr); + EventListener* ongesturestart() const; + void setOngesturestart(PassRefPtr); + EventListener* ongesturechange() const; + void setOngesturechange(PassRefPtr); + EventListener* ongestureend() const; + void setOngestureend(PassRefPtr); +#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* inlineEventListenerForType(const AtomicString& eventType) const; + + RefPtr m_securityOrigin; + KURL m_url; + + Frame* m_frame; + mutable RefPtr m_screen; + mutable RefPtr m_selection; + mutable RefPtr m_history; + mutable RefPtr m_locationbar; + mutable RefPtr m_menubar; + mutable RefPtr m_personalbar; + mutable RefPtr m_scrollbars; + mutable RefPtr m_statusbar; + mutable RefPtr m_toolbar; + mutable RefPtr m_console; + mutable RefPtr m_navigator; + mutable RefPtr m_location; +#if ENABLE(DOM_STORAGE) + mutable RefPtr m_sessionStorage; + mutable RefPtr m_localStorage; +#endif +#if ENABLE(OFFLINE_WEB_APPLICATIONS) + mutable RefPtr m_applicationCache; +#endif + }; + +} // namespace WebCore + +#endif diff --git a/WebCore/DOMXPath.h b/WebCore/DOMXPath.h new file mode 100644 index 0000000..f5472c3 --- /dev/null +++ b/WebCore/DOMXPath.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 +#import +#import + +#import +#import +#import +#import diff --git a/WebCore/DOMXPathException.h b/WebCore/DOMXPathException.h new file mode 100644 index 0000000..32f95fb --- /dev/null +++ b/WebCore/DOMXPathException.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 + +#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 diff --git a/WebCore/DashArray.h b/WebCore/DashArray.h new file mode 100644 index 0000000..46b84a4 --- /dev/null +++ b/WebCore/DashArray.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2008 Dirk Schulze + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING 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 + +#if PLATFORM(CG) +typedef Vector DashArray; +#elif PLATFORM(CAIRO) +typedef Vector DashArray; +#else +typedef Vector DashArray; +#endif + +#endif // DashArray_h diff --git a/WebCore/DashboardRegion.h b/WebCore/DashboardRegion.h new file mode 100644 index 0000000..91e5d7a --- /dev/null +++ b/WebCore/DashboardRegion.h @@ -0,0 +1,48 @@ +/* + * (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 { +public: + static PassRefPtr create() { return adoptRef(new DashboardRegion); } + + RefPtr 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 diff --git a/WebCore/DataRef.h b/WebCore/DataRef.h new file mode 100644 index 0000000..c8d8072 --- /dev/null +++ b/WebCore/DataRef.h @@ -0,0 +1,71 @@ +/* + * 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 + +namespace WebCore { + +template 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& o) const + { + ASSERT(m_data); + ASSERT(o.m_data); + return m_data == o.m_data || *m_data == *o.m_data; + } + + bool operator!=(const DataRef& o) const + { + ASSERT(m_data); + ASSERT(o.m_data); + return m_data != o.m_data && *m_data != *o.m_data; + } + +private: + RefPtr m_data; +}; + +} // namespace WebCore + +#endif // DataRef_h diff --git a/WebCore/DeleteButton.h b/WebCore/DeleteButton.h new file mode 100644 index 0000000..ac3cdac --- /dev/null +++ b/WebCore/DeleteButton.h @@ -0,0 +1,42 @@ +/* + * 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 diff --git a/WebCore/DeleteButtonController.h b/WebCore/DeleteButtonController.h new file mode 100644 index 0000000..ab2d0b0 --- /dev/null +++ b/WebCore/DeleteButtonController.h @@ -0,0 +1,77 @@ +/* + * 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 m_target; + RefPtr m_containerElement; + RefPtr m_outlineElement; + RefPtr m_buttonElement; + bool m_wasStaticPositioned; + bool m_wasAutoZIndex; + unsigned m_disableStack; +}; + +} // namespace WebCore + +#endif diff --git a/WebCore/DeleteFromTextNodeCommand.h b/WebCore/DeleteFromTextNodeCommand.h new file mode 100644 index 0000000..0d145f5 --- /dev/null +++ b/WebCore/DeleteFromTextNodeCommand.h @@ -0,0 +1,56 @@ +/* + * 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 create(PassRefPtr node, unsigned offset, unsigned count) + { + return adoptRef(new DeleteFromTextNodeCommand(node, offset, count)); + } + +private: + DeleteFromTextNodeCommand(PassRefPtr, unsigned offset, unsigned count); + + virtual void doApply(); + virtual void doUnapply(); + + RefPtr m_node; + unsigned m_offset; + unsigned m_count; + String m_text; +}; + +} // namespace WebCore + +#endif // DeleteFromTextNodeCommand_h diff --git a/WebCore/DeleteSelectionCommand.h b/WebCore/DeleteSelectionCommand.h new file mode 100644 index 0000000..d3863f1 --- /dev/null +++ b/WebCore/DeleteSelectionCommand.h @@ -0,0 +1,99 @@ +/* + * 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 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 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); + virtual void deleteTextFromNode(PassRefPtr, 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 m_startBlock; + RefPtr m_endBlock; + RefPtr m_typingStyle; + RefPtr m_deleteIntoBlockquoteStyle; + RefPtr m_startRoot; + RefPtr m_endRoot; + RefPtr m_startTableRow; + RefPtr m_endTableRow; +}; + +} // namespace WebCore + +#endif // DeleteSelectionCommand_h diff --git a/WebCore/DeprecatedPtrList.h b/WebCore/DeprecatedPtrList.h new file mode 100644 index 0000000..67161af --- /dev/null +++ b/WebCore/DeprecatedPtrList.h @@ -0,0 +1,113 @@ +/* + * 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 DeprecatedPtrListIterator; + +template 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 Iterator; + typedef DeprecatedPtrListIterator 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; + + DeprecatedPtrListImpl impl; + bool del_item; +}; + +template class DeprecatedPtrListIterator { +public: + DeprecatedPtrListIterator() { } + DeprecatedPtrListIterator(const DeprecatedPtrList &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 diff --git a/WebCore/DeprecatedPtrListImpl.h b/WebCore/DeprecatedPtrListImpl.h new file mode 100644 index 0000000..5e4121b --- /dev/null +++ b/WebCore/DeprecatedPtrListImpl.h @@ -0,0 +1,122 @@ +/* + * 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 diff --git a/WebCore/DocLoader.h b/WebCore/DocLoader.h new file mode 100644 index 0000000..17edcc5 --- /dev/null +++ b/WebCore/DocLoader.h @@ -0,0 +1,138 @@ +/* + Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) + Copyright (C) 2001 Dirk Mueller + 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 +#include +#include + +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 > 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 m_reloadedURLs; + mutable DocumentResourceMap m_documentResources; + Document* m_doc; + + int m_requestCount; + + ListHashSet m_preloads; + struct PendingPreload { + CachedResource::Type m_type; + String m_url; + String m_charset; + }; + Vector m_pendingPreloads; + + //29 bits left + bool m_autoLoadImages : 1; + bool m_loadInProgress : 1; + bool m_allowStaleResources : 1; +}; + +} + +#endif diff --git a/WebCore/DocPtr.h b/WebCore/DocPtr.h new file mode 100644 index 0000000..8b50e8d --- /dev/null +++ b/WebCore/DocPtr.h @@ -0,0 +1,114 @@ +/* + * 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 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 DocPtr(const DocPtr &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 DocPtr &DocPtr::operator=(const DocPtr &o) +{ + T *optr = o.m_ptr; + if (optr) + optr->selfOnlyRef(); + if (T *ptr = m_ptr) + ptr->selfOnlyDeref(); + m_ptr = optr; + return *this; +} + +template inline DocPtr &DocPtr::operator=(T *optr) +{ + if (optr) + optr->selfOnlyRef(); + if (T *ptr = m_ptr) + ptr->selfOnlyDeref(); + m_ptr = optr; + return *this; +} + +template inline bool operator==(const DocPtr &a, const DocPtr &b) +{ + return a.get() == b.get(); +} + +template inline bool operator==(const DocPtr &a, const T *b) +{ + return a.get() == b; +} + +template inline bool operator==(const T *a, const DocPtr &b) +{ + return a == b.get(); +} + +template inline bool operator!=(const DocPtr &a, const DocPtr &b) +{ + return a.get() != b.get(); +} + +template inline bool operator!=(const DocPtr &a, const T *b) +{ + return a.get() != b; +} + +template inline bool operator!=(const T *a, const DocPtr &b) +{ + return a != b.get(); +} + +} // namespace WebCore + +#endif // DocPtr_h diff --git a/WebCore/Document.h b/WebCore/Document.h new file mode 100644 index 0000000..1f31862 --- /dev/null +++ b/WebCore/Document.h @@ -0,0 +1,1269 @@ +/* + * 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 +#include + +#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(-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 { + 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 { + static const bool emptyValueIsZero = true; + static void constructDeletedValue(TextAutoSizingKey& slot); + static bool isDeletedValue(const TextAutoSizingKey& value); +}; + +class TextAutoSizingValue : public RefCounted{ +public: + static PassRefPtr create() + { + return adoptRef(new TextAutoSizingValue()); + } + + void addNode(Node *node, float size); + bool adjustNodeSizes (); + int numNodes () const; + void reset(); + +private: + TextAutoSizingValue() { } + + HashSet > 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 create(Frame* frame) + { + return new Document(frame, false); + } + static PassRefPtr 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 createElement(const AtomicString& tagName, ExceptionCode&); + PassRefPtr createDocumentFragment (); + PassRefPtr createTextNode(const String& data); + PassRefPtr createComment(const String& data); + PassRefPtr createCDATASection(const String& data, ExceptionCode&); + PassRefPtr createProcessingInstruction(const String& target, const String& data, ExceptionCode&); + PassRefPtr createAttribute(const String& name, ExceptionCode& ec) { return createAttributeNS(String(), name, ec, true); } + PassRefPtr createAttributeNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode&, bool shouldIgnoreNamespaceChecks = false); + PassRefPtr createEntityReference(const String& name, ExceptionCode&); + PassRefPtr importNode(Node* importedNode, bool deep, ExceptionCode&); + virtual PassRefPtr createElementNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode&); + PassRefPtr 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 adoptNode(PassRefPtr source, ExceptionCode&); + + PassRefPtr images(); + PassRefPtr embeds(); + PassRefPtr plugins(); // an alias for embeds() required for the JS DOM bindings. + PassRefPtr applets(); + PassRefPtr links(); + PassRefPtr forms(); + PassRefPtr anchors(); + PassRefPtr all(); + PassRefPtr objects(); + PassRefPtr scripts(); + PassRefPtr windowNamedItems(const String& name); + PassRefPtr 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 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 in a HTML document), searching for stylesheets. Stylesheets can be contained in + * ,