diff options
author | Ben Murdoch <benm@google.com> | 2010-05-11 18:35:50 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-05-14 10:23:05 +0100 |
commit | 21939df44de1705786c545cd1bf519d47250322d (patch) | |
tree | ef56c310f5c0cdc379c2abb2e212308a3281ce20 /WebCore | |
parent | 4ff1d8891d520763f17675827154340c7c740f90 (diff) | |
download | external_webkit-21939df44de1705786c545cd1bf519d47250322d.zip external_webkit-21939df44de1705786c545cd1bf519d47250322d.tar.gz external_webkit-21939df44de1705786c545cd1bf519d47250322d.tar.bz2 |
Merge Webkit at r58956: Initial merge by Git.
Change-Id: I1d9fb60ea2c3f2ddc04c17a871acdb39353be228
Diffstat (limited to 'WebCore')
775 files changed, 27875 insertions, 11825 deletions
diff --git a/WebCore/Android.derived.jscbindings.mk b/WebCore/Android.derived.jscbindings.mk index d51a4d5..47d70e2 100644 --- a/WebCore/Android.derived.jscbindings.mk +++ b/WebCore/Android.derived.jscbindings.mk @@ -69,10 +69,10 @@ GEN := \ $(intermediates)/css/JSCSSVariablesDeclaration.h \ $(intermediates)/css/JSCSSVariablesRule.h \ $(intermediates)/css/JSCounter.h \ - $(intermediates)/css/JSMedia.h \ $(intermediates)/css/JSMediaList.h \ $(intermediates)/css/JSRGBColor.h \ $(intermediates)/css/JSRect.h \ + $(intermediates)/css/JSStyleMedia.h \ $(intermediates)/css/JSStyleSheet.h \ $(intermediates)/css/JSStyleSheetList.h \ $(intermediates)/css/JSWebKitCSSKeyframeRule.h \ @@ -159,6 +159,7 @@ GEN := \ $(intermediates)/html/JSDataGridColumn.h \ $(intermediates)/html/JSDataGridColumnList.h \ $(intermediates)/html/JSFile.h \ + $(intermediates)/html/JSFileError.h \ $(intermediates)/html/JSFileList.h \ $(intermediates)/html/JSHTMLAllCollection.h \ $(intermediates)/html/JSHTMLAnchorElement.h \ diff --git a/WebCore/Android.derived.v8bindings.mk b/WebCore/Android.derived.v8bindings.mk index efc4ebf..0cc1f96 100644 --- a/WebCore/Android.derived.v8bindings.mk +++ b/WebCore/Android.derived.v8bindings.mk @@ -52,10 +52,10 @@ GEN := \ $(intermediates)/bindings/V8CSSVariablesDeclaration.h \ $(intermediates)/bindings/V8CSSVariablesRule.h \ $(intermediates)/bindings/V8Counter.h \ - $(intermediates)/bindings/V8Media.h \ $(intermediates)/bindings/V8MediaList.h \ $(intermediates)/bindings/V8Rect.h \ $(intermediates)/bindings/V8RGBColor.h \ + $(intermediates)/bindings/V8StyleMedia.h \ $(intermediates)/bindings/V8StyleSheet.h \ $(intermediates)/bindings/V8StyleSheetList.h \ $(intermediates)/bindings/V8WebKitCSSKeyframeRule.h \ @@ -143,6 +143,7 @@ GEN := \ $(intermediates)/bindings/V8DataGridColumn.h \ $(intermediates)/bindings/V8DataGridColumnList.h \ $(intermediates)/bindings/V8File.h \ + $(intermediates)/bindings/V8FileError.h \ $(intermediates)/bindings/V8FileList.h \ $(intermediates)/bindings/V8HTMLAllCollection.h \ $(intermediates)/bindings/V8HTMLAnchorElement.h \ diff --git a/WebCore/Android.jscbindings.mk b/WebCore/Android.jscbindings.mk index bd775b3..c768fae 100644 --- a/WebCore/Android.jscbindings.mk +++ b/WebCore/Android.jscbindings.mk @@ -61,7 +61,6 @@ LOCAL_SRC_FILES += \ bindings/js/DOMObjectHashTableMap.cpp \ bindings/js/DOMWrapperWorld.cpp \ bindings/js/GCController.cpp \ - bindings/js/JSAbstractWorkerCustom.cpp \ bindings/js/JSAttrCustom.cpp \ bindings/js/JSAudioConstructor.cpp \ bindings/js/JSCDATASectionCustom.cpp \ @@ -99,7 +98,6 @@ LOCAL_SRC_FILES += \ bindings/js/JSDatabaseCustom.cpp \ bindings/js/JSDedicatedWorkerContextCustom.cpp \ bindings/js/JSDocumentCustom.cpp \ - bindings/js/JSDocumentFragmentCustom.cpp \ bindings/js/JSElementCustom.cpp \ bindings/js/JSEventCustom.cpp \ bindings/js/JSEventListener.cpp \ diff --git a/WebCore/Android.mk b/WebCore/Android.mk index 217dd9f..7ad7005 100644 --- a/WebCore/Android.mk +++ b/WebCore/Android.mk @@ -448,7 +448,6 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ platform/graphics/FontFastPath.cpp \ platform/graphics/GeneratedImage.cpp \ platform/graphics/GlyphPageTreeNode.cpp \ - platform/graphics/GlyphMetricsMap.cpp \ platform/graphics/Gradient.cpp \ platform/graphics/GraphicsContext.cpp \ platform/graphics/GraphicsLayer.cpp \ @@ -652,10 +651,16 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ rendering/RenderSVGInline.cpp \ rendering/RenderSVGInlineText.cpp \ rendering/RenderSVGModelObject.cpp \ + rendering/RenderSVGResource.cpp \ rendering/RenderSVGResourceClipper.cpp \ rendering/RenderSVGResourceFilter.cpp \ + rendering/RenderSVGResourceGradient.cpp \ + rendering/RenderSVGResourceLinearGradient.cpp \ rendering/RenderSVGResourceMarker.cpp \ rendering/RenderSVGResourceMasker.cpp \ + rendering/RenderSVGResourcePattern.cpp \ + rendering/RenderSVGResourceRadialGradient.cpp \ + rendering/RenderSVGResourceSolidColor.cpp \ rendering/RenderSVGRoot.cpp \ rendering/RenderSVGShadowTreeRootContainer.cpp \ rendering/RenderSVGTSpan.cpp \ @@ -690,6 +695,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ ifeq ($(ENABLE_SVG), true) LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ + rendering/SVGCharacterData.cpp \ rendering/SVGCharacterLayoutInfo.cpp \ rendering/SVGInlineFlowBox.cpp \ rendering/SVGInlineTextBox.cpp \ @@ -901,13 +907,6 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ svg/animation/SVGSMILElement.cpp \ \ svg/graphics/SVGImage.cpp \ - svg/graphics/SVGPaintServer.cpp \ - svg/graphics/SVGPaintServerGradient.cpp \ - svg/graphics/SVGPaintServerLinearGradient.cpp \ - svg/graphics/SVGPaintServerPattern.cpp \ - svg/graphics/SVGPaintServerRadialGradient.cpp \ - svg/graphics/SVGPaintServerSolid.cpp \ - svg/graphics/SVGResource.cpp \ \ svg/graphics/filters/SVGFEConvolveMatrix.cpp \ svg/graphics/filters/SVGFEDiffuseLighting.cpp \ diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index 9700ffe..c6bf40b 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,7741 @@ +2010-05-07 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed: chromium dev tools tests fix. + Add a more strict check prior to accessing constructor property in + Web Inspector frontend. + + * inspector/front-end/InjectedScript.js: + (injectedScriptConstructor): + +2010-05-07 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Joseph Pecoraro. + + Web Inspector: On Linux/Windows panel history is + traversed while iterating over words in text prompt. + + https://bugs.webkit.org/show_bug.cgi?id=38740 + + * inspector/front-end/TextPrompt.js: + (WebInspector.TextPrompt): + * inspector/front-end/inspector.js: + (WebInspector.documentKeyDown): + +2010-05-07 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: come up with InjectedScript._className that works for both JSC and V8. + + https://bugs.webkit.org/show_bug.cgi?id=38755 + + * inspector/front-end/InjectedScript.js: + (injectedScriptConstructor): + +2010-05-07 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by Adam Barth. + + document.write is not synchronous after page load + https://bugs.webkit.org/show_bug.cgi?id=38146 + + If there are no pending scripts, a document.write call should be + synchronous. This matches other browsers and the HTML5 spec. Forcing + the tokenizer to be synchronous in Document::write does not affect + external scripts written by the write call. This should only change + behavior of document.write after the page is done loading. + + Difficult to test reliably due to HTMLTokenizing relying on processing time. + I made a manual test because the test requires processing very large strings + synchronously and therefore can take some time. + + Test: WebCore/manual-tests/dom/document-write-synchronous-after-page-load.html + + * dom/Document.cpp: + (WebCore::SynchronousHTMLTokenizerGuard::SynchronousHTMLTokenizerGuard): if the provided tokenizer is an HTMLTokenizer make it synchronous + (WebCore::SynchronousHTMLTokenizerGuard::~SynchronousHTMLTokenizerGuard): if the provided tokenizer was an HTMLTokenizer return its synchronous state + (WebCore::Document::write): temporarily set the tokenizer to synchronous during document.write + * dom/Tokenizer.h: + (WebCore::Tokenizer::asHTMLTokenizer): default implementation returns 0, to be overridden by HTMLTokenizer + * html/HTMLTokenizer.h: allow access to to the force synchronous state + (WebCore::HTMLTokenizer::forceSynchronous): accessor + (WebCore::HTMLTokenizer::asHTMLTokenizer): override the default to return itself + * manual-tests/dom/document-write-synchronous-after-page-load.html: Added. + +2010-05-07 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix rendering of -webkit-user-select: none + + -webkit-user-select: none is implemented by filling + the area with an invalid default-constructed Color. + In most ports passing an invalid color down to the + graphics backend seems to produce transparent fills. + + In Qt the behavior of painting with an invalid QColor + is undefined, and in practice it results in painting + black opaque areas. + + One way to fix this would be to use Qt::transparent + when converting an undefined Color to a QColor, but + Qt does not have short circuits for fully transparent + painting, and we actually end up in slow code paths + due to the transparency. So, we're better of doing the + short circuit in WebKit. + + https://bugs.webkit.org/show_bug.cgi?id=38523 + + * platform/graphics/qt/GraphicsContextQt.cpp: + +2010-05-07 Ben Murdoch <benm@google.com> + + Reviewed by Darin Adler. + + Potential crash in EventHandler::handleTouchEvent + https://bugs.webkit.org/show_bug.cgi?id=38646 + + Fix a ref counting bug that can cause a crash if the m_originatingouchPointTargets + hashmap holds the last ref to an EventTarget when the user lifts their finger. + + This is very hard to reproduce in a consistent way and clearly a + simple logic error in the code, therefore no new tests. + + * page/EventHandler.cpp: + (WebCore::EventHandler::handleTouchEvent): Don't let the RefPtr we get back from + the hasmap go out of scope so soon as it could delete the wrapped ptr if the + hashmap held the last ref (and we use the raw ptr that the RefPtr + wraps later in the WebCore::Touch constructor). + +2010-05-07 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Rubber-stamped by Kenneth Rohde Christiansen. + + [GTK] Fails to build on GTK+ < 2.14 + https://bugs.webkit.org/show_bug.cgi?id=38746 + + Build fix only. Do basically the same as gtk_adjustment_configure + would do if we are bellow GTK+ 2.14. + + * platform/gtk/ScrollViewGtk.cpp: + (WebCore::AdjustmentConfigure): + +2010-05-07 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Rubber-stamped by Xan Lopez. + + Crash with MgOpenModerna font, with non-UTF-8 character + https://bugs.webkit.org/show_bug.cgi?id=37795 + + NULL-check the font platform data, for now, to avoid the crash. + + Could not yet figure out a way to get a test written that does not + involve adding the font to the tree, but there are doubts about + licensing. + + * platform/graphics/cairo/FontCacheCairo.cpp: + (WebCore::FontCache::getFontDataForCharacters): + +2010-05-07 MORITA Hajime <morrita@google.com> + + Reviewed by Eric Seidel. + + [Chromium] RenderThemeChromiumMac.mm should share the code with RenderThemeMac.mm + https://bugs.webkit.org/show_bug.cgi?id=37204 + + Made RenderThemeChromiumMac subclass of RenderThemeMac, instead of RenderTheme. + Added some method to RenderThemeMac for overriding on RenderThemeChromiumMac. + + No new tests; Should have no behavioural change. + + * WebCore.gyp/WebCore.gyp: + * rendering/RenderThemeChromiumMac.h: + * rendering/RenderThemeChromiumMac.mm: + (WebCore::RenderThemeChromiumMac::usesTestModeFocusRingColor): + (WebCore::RenderThemeChromiumMac::documentViewFor): + (WebCore::RenderThemeChromiumMac::adjustMediaSliderThumbSize): + (WebCore::RenderThemeChromiumMac::paintMediaVolumeSliderTrack): + (WebCore::RenderThemeChromiumMac::paintMediaVolumeSliderThumb): + * rendering/RenderThemeMac.h: + (WebCore::RenderThemeMac::updateActiveState): Added for overriding + * rendering/RenderThemeMac.mm: + (WebCore::RenderThemeMac::usesTestModeFocusRingColor): Added for overriding + (WebCore::RenderThemeMac::documentViewFor): Added for overriding + (WebCore::RenderThemeMac::paintMenuList): + (WebCore::RenderThemeMac::setPopupButtonCellState): + (WebCore::RenderThemeMac::paintSliderThumb): + (WebCore::RenderThemeMac::paintSearchField): + (WebCore::RenderThemeMac::setSearchCellState): + (WebCore::RenderThemeMac::paintSearchFieldCancelButton): + (WebCore::RenderThemeMac::paintSearchFieldResultsDecoration): + (WebCore::RenderThemeMac::paintSearchFieldResultsButton): + (WebCore::RenderThemeMac::adjustSliderThumbSize): + (WebCore::RenderThemeMac::adjustMediaSliderThumbSize): Added for overriding + (WebCore::RenderThemeMac::extraMediaControlsStyleSheet): + +2010-05-06 Fumitoshi Ukai <ukai@chromium.org> + + Reviewed by Alexey Proskuryakov. + + JavaScriptCore/wtf/RandomNumber.h should provide using WTF::* + https://bugs.webkit.org/show_bug.cgi?id=38719 + + * platform/graphics/wince/FontCustomPlatformData.cpp: + (WebCore::createUniqueFontName): + Remove WTF:: prefix from randomNumber() + * platform/network/FormDataBuilder.cpp: + (WebCore::FormDataBuilder::generateUniqueBoundaryString): + Ditto. + +2010-04-27 Tony Chang <tony@chromium.org> + + Reviewed by Eric Seidel. + + [chromium] clicking a scrollbar in an iframe shouldn't lose the selection + https://bugs.webkit.org/show_bug.cgi?id=38189 + + Test: fast/events/mousedown-in-subframe-scrollbar.html + + * page/chromium/EventHandlerChromium.cpp: + (WebCore::EventHandler::passMousePressEventToSubframe): If clicking on + a scrollbar, pass the event directly to the scrollbar. This matches + mac which passes the event to the NSScroller. + +2010-05-06 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + Compositing layers that are clipped out by an overflow:scroll parent fail to get created on reveal + https://bugs.webkit.org/show_bug.cgi?id=38712 + + When compositing layer creation is testing layer overlap, we need to re-run the + algorithm when an overflow:scroll element scrolls, to create new layers for revealed + elements. + + Test: compositing/layer-creation/overflow-scroll-overlap.html + + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::scrollToOffset): First, move the compositing updates + until after the call to updateWidgetPositions(), so that this order is similar + to what we done when a FrameView scrolls. This change has no known side effects. + Second, if compositingConsultsOverlap() is true, we need to actually do a + compositing layer update to compute whether revealed/hidden layers should + be created/destroyed. + +2010-05-06 Maciej Stachowiak <mjs@apple.com> + + Not reviewed, build fix. + + Try again - with quotes this time. *facepalm* + + * dom/Notation.cpp: + +2010-05-06 Maciej Stachowiak <mjs@apple.com> + + Not reviewed, build fix. + + Speculative fix for Qt and Gtk. + + * dom/Notation.cpp: + +2010-05-06 Maciej Stachowiak <mjs@apple.com> + + Not reviewed, build fix. + + Fix an assert that I failed to update in my earlier change. + + * dom/CharacterData.h: + (WebCore::CharacterData::CharacterData): + +2010-05-06 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Geoff Garen. + + https://bugs.webkit.org/show_bug.cgi?id=38697 + REGRESSION (r58299): Replying on reddit.com no longer works + + * css/CSSSelector.cpp: (WebCore::CSSSelector::extractPseudoType): Don't recognize :first, + :left and :right. The aren't allowed in all contexts, and properly implementing them is out + of scope for this regression fix. + +2010-05-06 Jian Li <jianli@chromium.org> + + Reviewed by Adam Barth. + + Improve code generator scripts to support converting ScriptString. + https://bugs.webkit.org/show_bug.cgi?id=38699 + + Change both JSC and V8 generators to introduce "ConvertScriptString" + attribute to allow converting from ScriptString. Also updated the + bindings test result. + + These changes are necessary in order to avoid adding custom binding codes + when we add the FileReader interface. + + * bindings/scripts/CodeGeneratorJS.pm: + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + (webkit_dom_test_obj_get_script_string_attr): + (webkit_dom_test_obj_get_property): + (webkit_dom_test_obj_class_init): + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::): + (WebCore::jsTestObjScriptStringAttr): + * bindings/scripts/test/JS/JSTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.mm: + (-[DOMTestObj scriptStringAttr]): + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjInternal::scriptStringAttrAttrGetter): + (WebCore::): + +2010-05-06 Jian Li <jianli@chromium.org> + + Reviewed by Adam Barth. + + Improve code generator scripts to pass additional ScriptExecutionContext + argument to the constructor. + https://bugs.webkit.org/show_bug.cgi?id=38687 + + Change both JSC and V8 generators to introduce "CallWith=ScriptExecutionContext" + attribute to allow passing the additional ScriptExecutionContext argument to + the constructor. Also add another test IDL file to test interface-level + features. + + These changes are necessary in order to avoid adding custom binding codes + when we add the FileReader interface. + + * bindings/scripts/CodeGeneratorJS.pm: + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp: Added. + * bindings/scripts/test/GObject/WebKitDOMTestInterface.h: Added. + * bindings/scripts/test/GObject/WebKitDOMTestInterfacePrivate.h: Added. + * bindings/scripts/test/JS/JSTestInterface.cpp: Added. + * bindings/scripts/test/JS/JSTestInterface.h: Added. + * bindings/scripts/test/ObjC/DOMTestInterface.h: Added. + * bindings/scripts/test/ObjC/DOMTestInterface.mm: Added. + * bindings/scripts/test/ObjC/DOMTestInterfaceInternal.h: Added. + * bindings/scripts/test/TestInterface.idl: Added. + * bindings/scripts/test/V8/V8TestInterface.cpp: Added. + * bindings/scripts/test/V8/V8TestInterface.h: Added. + * bindings/v8/V8Proxy.h: + (WebCore::V8Proxy::constructDOMObjectWithScriptExecutionContext): + +2010-05-06 Maciej Stachowiak <mjs@apple.com> + + Build fix, not reviewed. + + Speculative Windows and Debug build fixes for the last change. + + * dom/Node.h: + (WebCore::Node::inDocument): + (WebCore::Node::setFlag): + +2010-05-06 James Robinson <jamesr@chromium.org> + + Reviewed by Eric Seidel. + + Fix warnings emitted by gcc 4.4.1 on linux in chromium-specific platform graphics files. + https://bugs.webkit.org/show_bug.cgi?id=38158 + + Fixes: + - replace NULL with 0 + - remove unusued locals + - add parens around ambiguous looking compound predicates like (a || b && c) + + This also adds a check for x >= 0 to FontLinux.cpp's in this statement: + if (x < walker.width()) + This is more documentation than anything else since walker.width() returns + an unsigned the current behavior is that x is promoted to unsigned and as + long as x + walker.width() is less than 2^31 all negative values of x + end up wrapping around and not being < walker.width(). This behavior is + tested by fast/text/international/khmer-selection.html + + * platform/graphics/chromium/FontLinux.cpp: + (WebCore::adjustTextRenderMode): + (WebCore::TextRunWalker::TextRunWalker): + (WebCore::TextRunWalker::length): + (WebCore::TextRunWalker::width): + (WebCore::TextRunWalker::getTextRun): + (WebCore::TextRunWalker::getNormalizedTextRun): + (WebCore::Font::offsetForPositionForComplexText): + * platform/graphics/chromium/FontPlatformDataLinux.cpp: + (WebCore::FontPlatformData::setupPaint): + * platform/graphics/chromium/HarfbuzzSkia.cpp: + (WebCore::getOutlinePoint): + * platform/graphics/skia/GraphicsContext3DSkia.cpp: + (WebCore::GraphicsContext3D::getImageData): + * platform/graphics/skia/GraphicsContextSkia.cpp: + (WebCore::isCoordinateSkiaSafe): + (WebCore::GraphicsContext::fillRect): + (WebCore::GraphicsContext::strokePath): + (WebCore::GraphicsContext::strokeRect): + +2010-05-06 Ada Chan <adachan@apple.com> + + Reviewed by David Kilzer. + + https://bugs.webkit.org/show_bug.cgi?id=38695 + + Check the result from widget() for NULL before accessing it. + + * rendering/RenderIFrame.cpp: + (WebCore::RenderIFrame::calcHeight): + (WebCore::RenderIFrame::calcWidth): + +2010-05-06 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Darin Adler. + + further fixes towards REGRESSION (r57292): 1% PLT regression from visited link information leak fix + https://bugs.webkit.org/show_bug.cgi?id=38682 + <rdar://problem/7859794> + + Looks like a 1-2% speedup on PLT. + + - Reorder CSS properties. + - Remove short circuit tag check in matchRulesForList which costs more than it saves. + - Inline initForStyleResolve. + - Optimize applyDeclarations to avoid switch and take fewer branches in the inner loop. + + - Change the way Node handles flags - replace bitfield with a uint32_t and explicit masking, + to make it cheaper to initialize the bits and give faster access. + - Added new Node flags to check for isStyledElement, isHTMLElement, isSVGElement, isComment, + and devirtualize those methods. + - Inline constructors for Node, Element, Text, CharacterData, StyledElement, etc since + they are very simple and lots of nodes get constructed. + + * css/CSSPropertyNames.in: Move a few of the properties up front so we can check for them + with < instead of switch statements + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::matchRulesForList): Remove unnecessary preflight check + for tag match before checking selector. This check very rarely short circuits anything, + since most rules with a tag end up in the appropriate tag bucket. So doing the check + cost more time than the time saved. + (WebCore::CSSStyleSelector::initForStyleResolve): Inline. Create RenderStyle in a better way. + (WebCore::CSSStyleSelector::applyDeclarations): Get rid of switch statement and use <= to + check for the high priority properties. Convert to template to avoid checking "applyFirst" + each time through the loop. + (WebCore::CSSStyleSelector::styleForElement): Adjust for new applyDeclarations() signature. + (WebCore::CSSStyleSelector::keyframeStylesForAnimation): ditto + (WebCore::CSSStyleSelector::pseudoStyleForElement): ditto + * css/CSSStyleSelector.h: Adjust for new applyDeclarations() signature. + * rendering/style/RenderStyle.cpp: + (WebCore::RenderStyle::RenderStyle): Inline constructor. + * rendering/style/RenderStyle.h: Make constructor private so it can be inline. + * dom/Node.h: + (WebCore::): See high-level description of changes above. Redid the + way boolean flags work. + (WebCore::Node::isElementNode): + (WebCore::Node::isContainerNode): + (WebCore::Node::isTextNode): + (WebCore::Node::isHTMLElement): + (WebCore::Node::isSVGElement): + (WebCore::Node::isStyledElement): + (WebCore::Node::isCommentNode): + (WebCore::Node::hasID): + (WebCore::Node::hasClass): + (WebCore::Node::active): + (WebCore::Node::inActiveChain): + (WebCore::Node::inDetach): + (WebCore::Node::hovered): + (WebCore::Node::attached): + (WebCore::Node::setAttached): + (WebCore::Node::needsStyleRecalc): + (WebCore::Node::styleChangeType): + (WebCore::Node::childNeedsStyleRecalc): + (WebCore::Node::isLink): + (WebCore::Node::setHasID): + (WebCore::Node::setHasClass): + (WebCore::Node::setChildNeedsStyleRecalc): + (WebCore::Node::clearChildNeedsStyleRecalc): + (WebCore::Node::setInDocument): + (WebCore::Node::clearInDocument): + (WebCore::Node::setInActiveChain): + (WebCore::Node::clearInActiveChain): + (WebCore::Node::setIsLink): + (WebCore::Node::clearIsLink): + (WebCore::Node::setActive): + (WebCore::Node::setHovered): + (WebCore::Node::inDocument): + (WebCore::Node::): + (WebCore::Node::getFlag): + (WebCore::Node::setFlag): + (WebCore::Node::clearFlag): + (WebCore::Node::hasRareData): + (WebCore::Node::isParsingChildrenFinished): + (WebCore::Node::setIsParsingChildrenFinished): + (WebCore::Node::clearIsParsingChildrenFinished): + (WebCore::Node::isStyleAttributeValid): + (WebCore::Node::setIsStyleAttributeValid): + (WebCore::Node::clearIsStyleAttributeValid): + (WebCore::Node::isSynchronizingStyleAttribute): + (WebCore::Node::setIsSynchronizingStyleAttribute): + (WebCore::Node::clearIsSynchronizingStyleAttribute): + (WebCore::Node::areSVGAttributesValid): + (WebCore::Node::setAreSVGAttributesValid): + (WebCore::Node::clearAreSVGAttributesValid): + (WebCore::Node::isSynchronizingSVGAttributes): + (WebCore::Node::setIsSynchronizingSVGAttributes): + (WebCore::Node::clearIsSynchronizingSVGAttributes): + (WebCore::Node::hasRareSVGData): + (WebCore::Node::setHasRareSVGData): + (WebCore::Node::clearHasRareSVGData): + (WebCore::Node::initialRefCount): + * dom/Node.cpp: + (WebCore::Node::trackForDebugging): Adjusted for changes in + flag handling. + (WebCore::Node::ensureRareData): ditto + (WebCore::Node::setStyleChange): ditto + (WebCore::Node::setNeedsStyleRecalc): ditto + (WebCore::Node::lazyAttach): ditto + (WebCore::Node::attach): ditto + (WebCore::Node::detach): ditto + (WebCore::Node::insertedIntoDocument): ditto + (WebCore::Node::removedFromDocument): ditto + * dom/CharacterData.cpp: + * dom/CharacterData.h: + (WebCore::CharacterData::CharacterData): Inline the constructor (moved from .cpp) + * dom/Comment.cpp: + (WebCore::Comment::Comment): Tell the base class that we're a comment. + * dom/Comment.h: Remove isCommentNode override. + * dom/ContainerNode.cpp: + (WebCore::ContainerNode::detach): Adjusted for changes in flag + handling. + (WebCore::ContainerNode::removedFromDocument): ditto + * dom/Document.cpp: + (WebCore::Document::Document): Adjusted for changes in flag handling. + (WebCore::Document::recalcStyle): ditto + (WebCore::Document::setFocusedNode): ditto + * dom/Document.h: + (WebCore::Node::Node): Inline the Node constructor - goes here + because it uses Document. + * dom/DocumentFragment.cpp: include Document.h due to above change + * dom/EditingText.cpp: ditto + * dom/EntityReference.cpp: ditto + * dom/Element.cpp: + (WebCore::Element::getAttribute): Adjusted for changes in flag + handling. + (WebCore::Element::setAttribute): ditto + (WebCore::Element::hasAttributes): ditto + (WebCore::Element::recalcStyle): ditto + (WebCore::Element::finishParsingChildren): ditto + * dom/Element.h: + (WebCore::Element::Element): Inline (moved from .cpp) + (WebCore::Element::isFinishedParsingChildren): + (WebCore::Element::beginParsingChildren): + (WebCore::Element::attributes): Adjusted for changes in flag + handling. + * dom/StyledElement.cpp: + (WebCore::StyledElement::updateStyleAttribute): Adjust for + changes to flag handling. + (WebCore::StyledElement::mapToEntry): ditto + (WebCore::StyledElement::parseMappedAttribute): ditto + (WebCore::StyledElement::copyNonAttributeProperties): ditto + * dom/StyledElement.h: + (WebCore::StyledElement::StyledElement): Inline (moved from.cpp) + (WebCore::StyledElement::invalidateStyleAttribute): Adjust for + changes in flag handling. + * dom/Text.h: + (WebCore::Text::Text): Inline (moved from .cpp) + * dom/Text.cpp: + * html/HTMLAnchorElement.cpp: + (WebCore::HTMLAnchorElement::HTMLAnchorElement): Adjust for changes in + flag handling. + (WebCore::HTMLAnchorElement::parseMappedAttribute): ditto + * html/HTMLElement.cpp: + (WebCore::HTMLElement::create): Tell base class we're an HTML element. + * html/HTMLElement.h: ditto above; remove isHTMLElement override. + * html/HTMLFormControlElement.h: Tell base class we're an HTML element. + * html/HTMLFrameOwnerElement.cpp: + (WebCore::HTMLFrameOwnerElement::HTMLFrameOwnerElement): ditto + * html/HTMLProgressElement.cpp: + (WebCore::HTMLProgressElement::HTMLProgressElement): ditto + * mathml/MathMLElement.cpp: + (WebCore::MathMLElement::MathMLElement): Tell base class we're a styled + element. + * rendering/MediaControlElements.cpp: + (WebCore::MediaControlShadowRootElement::MediaControlShadowRootElement): + Adjust for changes in flag handling. + (WebCore::MediaControlElement::MediaControlElement): ditto + (WebCore::MediaControlInputElement::MediaControlInputElement): ditto + * rendering/RenderFileUploadControl.cpp: + (WebCore::RenderFileUploadControl::updateFromElement): ditto + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::updateHoverActiveState): ditto + * rendering/RenderProgress.cpp: + (WebCore::RenderProgress::updateValuePartState): ditto + * rendering/RenderSlider.cpp: + (WebCore::RenderSlider::updateFromElement): ditto + * rendering/SVGShadowTreeElements.cpp: + (WebCore::SVGShadowTreeRootElement::SVGShadowTreeRootElement): ditto + * rendering/TextControlInnerElements.cpp: + (WebCore::TextControlInnerElement::attachInnerElement): ditto + * svg/SVGAnimatedProperty.h: + (WebCore::SVGAnimatedPropertyTearOff::setBaseVal): ditto + (WebCore::SVGAnimatedPropertyTearOff::setAnimVal): ditto + * svg/SVGElement.cpp: + (WebCore::SVGElement::SVGElement): Tell base class we're + an svg element. + (WebCore::SVGElement::ensureRareSVGData): Adjust for flag handling + changes. + (WebCore::SVGElement::updateAnimatedSVGAttribute): ditto + * svg/SVGElement.h: + (WebCore::SVGElement::invalidateSVGAttributes): ditto + * svg/SVGPolyElement.cpp: + (WebCore::SVGPolyElement::svgAttributeChanged): ditto + * wml/WMLAnchorElement.cpp: + (WebCore::WMLAnchorElement::WMLAnchorElement): ditto + * wml/WMLElement.cpp: + (WebCore::WMLElement::WMLElement): Tell base class we're a styled + element. + +2010-05-06 Adam Barth <abarth@webkit.org> + + Unreviewed. Fix indent. Sorry, my OCD was acting up. + + * page/EventHandler.cpp: + (WebCore::EventHandler::handleMouseReleaseEvent): + +2010-05-06 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Joseph Pecoraro. + + Web Inspector: store selected Headers / Content tab on explicit switch and/or explicit navigate only. + + https://bugs.webkit.org/show_bug.cgi?id=38660 + + * inspector/front-end/ResourceView.js: + (WebInspector.ResourceView): + (WebInspector.ResourceView.prototype._selectHeadersTab): + (WebInspector.ResourceView.prototype.selectContentTab): + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourcesPanel.prototype.showResource): + +2010-05-06 Luiz Agostini <luiz.agostini@openbossa.org> + + Rubber-stamped by Simon Hausmann. + + [Qt] use QT_MOBILE_THEME in Symbian + https://bugs.webkit.org/show_bug.cgi?id=38440 + + Putting QT_MOBILE_THEME into use for Symbian. + + * WebCore.pro: + +2010-05-06 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Unreviewed, build fix WinCE for QtWebKit. + + [Qt] Compilation with Plugins disabled is broken + https://bugs.webkit.org/show_bug.cgi?id=31407 + + Rename platform/qt/TemporaryLinkStubs.cpp to avoid name collition on + Windows. + + Thanks for Ismail "cartman" Donmez for help. + + No new tests, as there is no new functionality. + + * WebCore.gypi: + * WebCore.pro: + * platform/qt/TemporaryLinkStubs.cpp: Removed. + * platform/qt/TemporaryLinkStubsQt.cpp: Copied from WebCore/platform/qt/TemporaryLinkStubs.cpp. + +2010-05-06 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] REGRESSION: Loading of external CSS and JS files over network fails in some cases + https://bugs.webkit.org/show_bug.cgi?id=36755 + + Enable the direct connection between QtNetwork and QtWebKit only for Qt versions + greater than 4.6.2, due to a bug in Qt that's been fixed after 4.6.2. + + * platform/network/qt/QNetworkReplyHandler.cpp: + +2010-05-06 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Xan Lopez. + + Rework where we get page step and line step from, so we do not + depend on scrollbars existing. Caught by API test I forgot to run. + + * platform/gtk/ScrollViewGtk.cpp: + (WebCore::ScrollView::setGtkAdjustments): + +2010-05-06 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Xan Lopez. + + [GTK] Adjustment resetting uses wrong values, and misses page_size and steps + https://bugs.webkit.org/show_bug.cgi?id=38657 + + Fix resetting adjustment values. In the page cache case, we were + confusing page_size and upper, leading to stray scrollbars + sometimes. + + * platform/gtk/ScrollViewGtk.cpp: + (WebCore::ScrollView::setGtkAdjustments): + +2010-05-06 Darin Adler <darin@apple.com> + + Reviewed by Beth Dakin. + + Page::setCanStartMedia does not properly handle the case where a media listener is removed + https://bugs.webkit.org/show_bug.cgi?id=38602 + + We can't find any real case where this causes a crash at this time, but + we want to harden the code anyway. Thus there are no new regression tests. + + * page/Page.cpp: + (WebCore::Page::removeMediaCanStartListener): Removed incorrect assertion. + (WebCore::Page::setCanStartMedia): Change algorithm so we notify listeners + one at a time and don't notify any listener that has already been removed + from the set. + +2010-05-05 Ojan Vafai <ojan@chromium.org> + + Reviewed by Darin Adler. + + shift+click on an existing selection doesn't work right + https://bugs.webkit.org/show_bug.cgi?id=36542 + + NSTextView behavior is to move the end of the selection + closest to the shift-click. Win/Linux behavior is to always + move the focus end of the selection. + + Test: editing/selection/shift-click.html + + * page/EventHandler.cpp: + (WebCore::textDistance): + (WebCore::EventHandler::handleMousePressEventSingleClick): + +2010-05-06 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: implement panels history traversal on Cmd+Left/Right. + + https://bugs.webkit.org/show_bug.cgi?id=38649 + + * inspector/front-end/inspector.js: + (WebInspector.set currentPanel): + (WebInspector.loaded): + (WebInspector.documentKeyDown): + (WebInspector.PanelHistory): + (WebInspector.PanelHistory.prototype.canGoBack): + (WebInspector.PanelHistory.prototype.goBack): + (WebInspector.PanelHistory.prototype.canGoForward): + (WebInspector.PanelHistory.prototype.goForward): + (WebInspector.PanelHistory.prototype.setPanel): + +2010-05-03 Evan Martin <evan@chromium.org> + + Reviewed by Eric Seidel. + + [chromium] use glyphDataForCharacter so we hit the glyphdata cache + https://bugs.webkit.org/show_bug.cgi?id=38500 + + Calling fontDataForCharacters() while rendering text is expensive. + Examining the relevant Mac code in WebKit revealed that calling the + similarly-named glyphDataForCharacters() results in caching the font + data on a per-glyph basis. + + Since we now choose a font based on the first character in a run, we + need to be careful that all the glyphs within the run use the same font. + This is also similar to the WebKit Mac code. We need to remove all of + the script run bits eventually and this is a step in that direction. + + Tests: fast/text/international/danda-space.html spacing changes slightly + (now matches Firefox better) and fast/text/international/thai-baht-space.html + now picks the correct (serif) font for the digits. + + * platform/graphics/chromium/FontLinux.cpp: + (WebCore::TextRunWalker::nextScriptRun): + (WebCore::TextRunWalker::setupFontForScriptRun): + +2010-05-06 Martin Robinson <mrobinson@webkit.org> + + Reviewed by Gustavo Noronha Silva. + + [GTK] Enable DOM clipboard and drag-and-drop access + https://bugs.webkit.org/show_bug.cgi?id=30623 + + Convert dragging portion of drag-and-drop to use DataObjectGtk. + + No new tests, because functionality has not changed. + + * page/gtk/EventHandlerGtk.cpp: + (WebCore::EventHandler::createDraggingClipboard): Pass the DataObjectGtk as a parameter here. + * platform/gtk/ClipboardGtk.h: + (WebCore::ClipboardGtk::create): Take the DataObject as a parameter instead of creating it here. + (WebCore::ClipboardGtk::helper): Added. + (WebCore::ClipboardGtk::dataObject): Added. + * platform/gtk/PasteboardHelper.h: Make targetListForDataObject a public method. + +2010-05-06 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Do not show content tab for resources + not supporting content preview. + + https://bugs.webkit.org/show_bug.cgi?id=38635 + + * English.lproj/localizedStrings.js: + * inspector/front-end/FontView.js: + (WebInspector.FontView.prototype.hasContentTab): + * inspector/front-end/ImageView.js: + (WebInspector.ImageView.prototype.hasContentTab): + * inspector/front-end/ResourceView.js: + (WebInspector.ResourceView): + (WebInspector.ResourceView.prototype._selectTab): + (WebInspector.ResourceView.prototype.hasContentTab): + * inspector/front-end/SourceView.js: + (WebInspector.SourceView.prototype.hasContentTab): + +2010-05-06 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Kenneth Christiansen. + + Spatial Navigation: adapt the logic of {deep}findFocusableNodeInDirection to do traversal starting from Node* not Document* + https://bugs.webkit.org/show_bug.cgi?id=37803 + + Instead of receiving a Document pointer as incoming parameter, patch modifies + findFocusableNodeInDirection and deepFindFocusableNodeInDirection methods to + receive a Node pointer as start for content traversal. + This way we can make good use of deepFindFocusableNodeInDirection to traverse + other scrollable container like scrollable div's, and not only frames or iframes. + + Patch also makes use of 'while' instead of 'for' to loop control, that gives move + flexibility to the incremental step: e.g. if a scrollable div was processed, the incremental + step in the loop does not have to do node->traverseNextNode() but node->traverseNextSibling(). + + No behavior change. It is a preparation for supporting scrollable containers in Spatial + Navigation. + + * page/FocusController.cpp: + (WebCore::FocusController::advanceFocusDirectionally): + (WebCore::FocusController::findFocusableNodeInDirection): + (WebCore::FocusController::deepFindFocusableNodeInDirection): + * page/FocusController.h: + +2010-05-06 Csaba Osztrogonác <ossy@webkit.org> + + Unreviewed WinCE buildfix after r58842. + Preprocessor doesn't understand "true", changed to "1" + + * platform/graphics/MediaPlayer.cpp: + +2010-05-06 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Pavel Feldman. + + Temporarily disable 'console.profiles' until we can distinguish + functions from different frames + + https://bugs.webkit.org/show_bug.cgi?id=38638 + + * bindings/v8/custom/V8ConsoleCustom.cpp: + (WebCore::V8Console::profilesAccessorGetter): + +2010-05-06 Steve Block <steveblock@google.com> + + Reviewed by Eric Seidel. + + MAC_JAVA_BRIDGE should be renamed JAVA_BRIDGE + https://bugs.webkit.org/show_bug.cgi?id=38544 + + No new tests, build fix only. + + * DerivedSources.make: + * bindings/js/ScriptController.cpp: + (WebCore::ScriptController::ScriptController): + * bindings/js/ScriptController.h: + * bindings/js/ScriptControllerMac.mm: + (WebCore::ScriptController::createScriptInstanceForWidget): + * bridge/jni/JNIBridge.cpp: + * bridge/jni/JNIBridge.h: + * bridge/jni/JNIUtility.cpp: + * bridge/jni/JNIUtility.h: + * bridge/jni/jni_jsobject.h: + * bridge/jni/jni_jsobject.mm: + * bridge/jni/jni_objc.mm: + * bridge/jni/jsc/JNIBridgeJSC.cpp: + * bridge/jni/jsc/JNIBridgeJSC.h: + * bridge/jni/jsc/JNIUtilityPrivate.cpp: + * bridge/jni/jsc/JNIUtilityPrivate.h: + * bridge/jni/jsc/JavaClassJSC.cpp: + * bridge/jni/jsc/JavaClassJSC.h: + * bridge/jni/jsc/JavaInstanceJSC.cpp: + * bridge/jni/jsc/JavaInstanceJSC.h: + * loader/FrameLoaderClient.h: + +2010-05-05 Alejandro G. Castro <alex@igalia.com> + + Reviewed by Xan Lopez. + + Fixed the gobject introspection compilation with the new DOM + bindings, we needed to add DOM objects. + + * GNUmakefile.am: + +2010-05-06 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + drop support for sessionStorage in sandbox iframes + https://bugs.webkit.org/show_bug.cgi?id=38151 + + This patch causes us to throw a security exception when a sandboxed + iframe attempts to access sessionStorage, matching our behavior for + localStorage. The letter of the spec asks us to create a separate + storage area for each unique origin. We might want to do that in a + future patch, but throwing a security error seems like a safe move now. + + * page/DOMWindow.cpp: + (WebCore::DOMWindow::sessionStorage): + (WebCore::DOMWindow::localStorage): + * page/DOMWindow.h: + * page/DOMWindow.idl: + * page/SecurityOrigin.h: + (WebCore::SecurityOrigin::canAccessSessionStorage): + * storage/StorageEventDispatcher.cpp: + (WebCore::StorageEventDispatcher::dispatch): + +2010-05-06 Andy Estes <aestes@apple.com> + + Reviewed by Maciej Stachowiak. + + Allow forms submitting to target="_blank" to open popups if the submission + originated from a user gesture. + + https://bugs.webkit.org/show_bug.cgi?id=37335 + <rdar://problem/7884980> + + Test: fast/events/popup-allowed-from-gesture-initiated-form-submit.html + + * bindings/js/ScriptController.cpp: + (WebCore::ScriptController::processingUserGesture): If no DOM event is + being processed, consult UserGestureIndicator to determine return value. + * bindings/js/ScriptController.h: Moved the logic of processingUserGestureEvent() + into processingUserGesture(). + +2010-05-06 Xan Lopez <xlopez@igalia.com> + + Rubber-stamped by Eric Seidel. + + [GTK] Refactor GenerateProperties in CodeGenerationGObject.pm + https://bugs.webkit.org/show_bug.cgi?id=38577 + + Thinko caught while refactoring, $custom variable was not + initialized. + + * bindings/scripts/CodeGeneratorGObject.pm: + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + (webkit_dom_test_obj_set_property): + (webkit_dom_test_obj_get_property): + (webkit_dom_test_obj_class_init): + +2010-05-06 Xan Lopez <xlopez@igalia.com> + + Rubber-stamped by Eric Seidel. + + [GTK] Refactor GenerateProperties in CodeGenerationGObject.pm + https://bugs.webkit.org/show_bug.cgi?id=38577 + + Refactor GenerateProperty out of GenerateProperties. This is in + preparation for EventListeren attributes, which won't generate + normal GObject properties. + + * bindings/scripts/CodeGeneratorGObject.pm: + +2010-05-06 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Joseph Pecoraro. + + Web Inspector: follow up to linkify event listeners. + + https://bugs.webkit.org/show_bug.cgi?id=38257 + + * bindings/js/ScriptEventListener.cpp: + (WebCore::eventListenerHandlerLocation): + * bindings/v8/ScriptEventListener.cpp: + (WebCore::eventListenerHandlerLocation): + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel.prototype.linkifyNodeReference): + * inspector/front-end/EventListenersSidebarPane.js: + +2010-05-05 Charles Wei <charles.wei@torchmobile.com.cn> + + Reviewed by George Staikos + + https://bugs.webkit.org/show_bug.cgi?id=37848 + This patch adds WCSS -wap-input-format and -wap-input-required support to WebKit + + Tests: fast/wcss/wap-input-format.xhtml + fast/wcss/wap-input-required.xhtml + + * css/CSSParser.cpp: + (WebCore::CSSParser::parseValue): + (WebCore::CSSParser::parseWCSSInputProperty): + * css/CSSParser.h: + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::applyProperty): + * css/WCSSPropertyNames.in: + * dom/InputElement.cpp: + (WebCore::InputElement::sanitizeValue): + (WebCore::InputElement::handleBeforeTextInsertedEvent): + (WebCore::InputElementData::InputElementData): + (WebCore::formatCodes): + (WebCore::cursorPositionToMaskIndex): + (WebCore::InputElement::isConformToInputMask): + (WebCore::InputElement::validateInputMask): + * dom/InputElement.h: + (WebCore::InputElementData::inputFormatMask): + (WebCore::InputElementData::setInputFormatMask): + (WebCore::InputElementData::maxInputCharsAllowed): + (WebCore::InputElementData::setMaxInputCharsAllowed): + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::setWapInputFormat): + * html/HTMLInputElement.h: + (WebCore::HTMLInputElement::data): + * wml/WMLInputElement.h: + (WebCore::WMLInputElement::data): + +2010-05-05 MORITA Hajime <morrita@google.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=38150 + Refactoring: webkitEditableContentChangedEvent should be handled by the owner of appropriate the renderer. + + Moved a part of code chunk in HTMLFormControlElementWithState::defaultEventHandler() + which accesses the renderer from foreign node, + to TextControlInnerTextElement::defaultEventHandler() which owns the renderer. + + No new tests. No behavioral change. + + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLFormControlElementWithState::defaultEventHandler): + * html/HTMLFormControlElement.h: + * html/HTMLInputElement.h: + * html/HTMLTextAreaElement.h: + * rendering/TextControlInnerElements.cpp: + (WebCore::TextControlInnerTextElement::defaultEventHandler): + +2010-05-05 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Line Numbers should be Aligned with the Source Code Line + https://bugs.webkit.org/show_bug.cgi?id=38593 + + If there is a message bubble, such as an error message, in a source view + the line number should be in line with the source code line, not centered + between the source and bubble. + + * inspector/front-end/textViewer.css: + (.webkit-line-number): added vertical-align: top + +2010-05-05 Dan Bernstein <mitz@apple.com> + + Fix the decelerated compositing build. + + * page/FrameView.cpp: + (WebCore::FrameView::isEnclosedInCompositingLayer): + * page/FrameView.h: + +2010-05-05 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Darin Adler. + + Bug 38604 - workers-gc2 crashing on Qt + + This appears to be due to a couple of issues. + (1) When the atomic string table is deleted it does not clear the 'inTable' bit + on AtomicStrings - it implicitly assumes that all AtomicStrings have already + been deleted at this point (otherwise they will crash in their destructor when + they try to remove themselves from the atomic string table). + (2) We don't fix the ordering in which WTF::WTFThreadData and + WebCore::ThreadGlobalData are destructed. + + We should make sure that ThreadGlobalData is cleaned up before worker threads + terminate and WTF::WTFThreadData is destroyed, and we should clear the inTable + bit of members on atomic string table destruction. + + WTF changes (fix issue 2, above) - clean up the thread data on worker termination. + + * platform/ThreadGlobalData.cpp: + (WebCore::ThreadGlobalData::~ThreadGlobalData): + (WebCore::ThreadGlobalData::destroy): + * platform/ThreadGlobalData.h: + * workers/WorkerThread.cpp: + (WebCore::WorkerThread::workerThread): + +2010-05-05 Dan Bernstein <mitz@apple.com> + + Reviewed by Simon Fraser. + + <rdar://problem/7932072> Iframes in composited layers don’t repaint correctly (affects Yahoo! Mail with Flash Player 10.1) + https://bugs.webkit.org/show_bug.cgi?id=38427 + + Test: compositing/iframes/iframe-in-composited-layer.html + + * WebCore.base.exp: Export FrameView::isEnclosedInCompositingLayer(). + * page/FrameView.cpp: + (WebCore::FrameView::isEnclosedInCompositingLayer): Added this predicate. + * page/FrameView.h: + +2010-05-05 Chris Marrin <cmarrin@apple.com> + + Reviewed by Simon Fraser. + + Got composited iframes showing up on Mac again + https://bugs.webkit.org/show_bug.cgi?id=38565 + + This was broken by http://trac.webkit.org/changeset/58798. That + change connected iframes through the parent document to the root + of the layer tree. That is correct for Windows, but not for Mac. + So the places where the linkage is made were wrapped in + shouldPropagateCompositingToIFrameParent() calls, which is + always false for Mac. + + Test: compositing/iframes/composited-iframe-alignment.html + + * rendering/RenderLayerCompositor.cpp:Avoid doing composited iframe linkage on Mac + (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree): + (WebCore::RenderLayerCompositor::didMoveOnscreen): + (WebCore::RenderLayerCompositor::willMoveOffscreen): + (WebCore::RenderLayerCompositor::ensureRootPlatformLayer): + +2010-05-05 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=38260 + <rdar://problem/7917548> Fix whitespace removing in deprecatedParseURL(). + + Broken all the way since r4 (yes, that's a revision number). + + Test: http/tests/security/xss-DENIED-javascript-with-spaces.html + + * css/CSSHelper.cpp: (WebCore::deprecatedParseURL): Fixed loop conditions for remaining length. + +2010-05-05 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Beth Dakin. + + Many AXUnknown showing up in the hierarchy + https://bugs.webkit.org/show_bug.cgi?id=38607 + + The RenderTableSection should not be an accessible element. + + Test: platform/mac/accessibility/parent-of-table-row-is-table.html + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::determineAccessibilityRole): + +2010-05-05 Csaba Osztrogonác <ossy@webkit.org> + + Reviewed by Simon Hausmann. + + [Qt]Disable Qt Multimedia backend for HTML 5 Audio and Video elements + Fall back to the Phonon backend until the release situation has been cleared up. + + https://bugs.webkit.org/show_bug.cgi?id=38612 + + Buildfix for QT_VERSION >= 0x040700 after r58810. + + * platform/graphics/MediaPlayer.cpp: + +2010-05-05 Jian Li <jianli@chromium.org> + + Reviewed by David Levin. + + XMLHttpRequestUpload events do not fire when sending a raw file or FormData object. + https://bugs.webkit.org/show_bug.cgi?id=37771 + + Test: http/tests/local/formdata/upload-events.html + + * xml/XMLHttpRequest.cpp: + (WebCore::XMLHttpRequest::createRequest): + +2010-05-05 Csaba Osztrogonác <ossy@webkit.org> + + Reviewed by Simon Hausmann. + + [Qt] Qt port should use its own QUuid class to create UUID string. + https://bugs.webkit.org/show_bug.cgi?id=38581 + + * platform/UUID.cpp: + (WebCore::createCanonicalUUIDString): Added PLATFORM(QT) case. + +2010-05-05 Alexey Proskuryakov <ap@apple.com> + + Roll out r58830 for breaking tests. + + Was: https://bugs.webkit.org/show_bug.cgi?id=38546 + Node.focus() fails to move focus from subframe properly + + * html/HTMLFrameElementBase.cpp: + (WebCore::HTMLFrameElementBase::setFocus): + +2010-05-05 Jian Li <jianli@chromium.org> + + Reviewed by Adam Barth. + + Implement FileReader class. + https://bugs.webkit.org/show_bug.cgi?id=38157 + + This patch only contains the implementation of FileReader class as defined + in the File API spec: http://www.w3.org/TR/file-upload/#dfn-filereader. + + New test will be added when a IDL is exposed and the FILE_READER is turned + on. + + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * dom/EventNames.h: + * dom/EventTarget.cpp: + (WebCore::EventTarget::toFileReader): + * dom/EventTarget.h: + * html/FileError.h: + (WebCore::FileError::FileError): + * html/FileReader.cpp: Added. + * html/FileReader.h: Added. + * html/FileStream.cpp: + (WebCore::FileStream::FileStream): + (WebCore::FileStream::openForRead): + (WebCore::FileStream::close): + (WebCore::FileStream::read): + * html/FileStream.h: + +2010-05-05 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Maciej Stachowiak. + + REGRESSION(r57969) Image decoder is repeatedly destroyed/created in CoreGraphics-based Windows WebKit + https://bugs.webkit.org/show_bug.cgi?id=38595 + + * platform/graphics/cg/ImageSourceCG.cpp: + (WebCore::ImageSource::setData): + +2010-05-05 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Adele Peterson. + + https://bugs.webkit.org/show_bug.cgi?id=38546 + Node.focus() fails to move focus from subframe properly + + Test: fast/frames/take-focus-from-iframe.html + + * html/HTMLFrameElementBase.cpp: (WebCore::HTMLFrameElementBase::setFocus): Don't clear + focus if this frame doesn't have it. This can happen if page's and HTMLFrameElement's ideas + of focused frame get out of sync temporarily. + +2010-05-05 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Adele Peterson. + + https://bugs.webkit.org/show_bug.cgi?id=26824 + <rdar://problem/7018610> EventHandler can operate on a wrong frame if focus changes during + keyboard event dispatch. + + EventHandler object is tied to a frame, so it's wrong for it to continue processing a keyboard + event if focused frame changes between keydown and keypress. + + * manual-tests/focus-change-between-key-events.html: Added. + + * page/EventHandler.cpp: (WebCore::EventHandler::keyEvent): Bail out early if focused frame + changes while dispatching keydown. Also made similar changes for Windows to maintain matching + behavior, even though EventHandler was re-entered anyway due to WM_KEYDOWN and WM_CHAR being + separate events. + +2010-05-05 Steve Block <steveblock@google.com> + + Reviewed by Adam Barth. + + MediaError.h is missing PassRefPtr.h include + https://bugs.webkit.org/show_bug.cgi?id=38575 + + No new tests, build fix only. + + * html/MediaError.h: + +2010-05-05 Alexander Pavlov <apavlov@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: Audits panel: Resource counters get reset when switching panels while reloading page + https://bugs.webkit.org/show_bug.cgi?id=38579 + + * inspector/front-end/AuditLauncherView.js: + (WebInspector.AuditLauncherView.prototype.updateResourceTrackingState): + (WebInspector.AuditLauncherView.prototype._updateResourceProgress): + +2010-05-05 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Joseph Pecoraro. + + Web Inspector: Doubleclick on line number should not trigger source editing. + + https://bugs.webkit.org/show_bug.cgi?id=38588 + + * inspector/front-end/TextViewer.js: + (WebInspector.TextViewer.prototype._handleDoubleClick): + +2010-05-05 Martin Robinson <mrobinson@webkit.org> + + Reviewed by Gustavo Noronha. + + [GTK] Enable DOM clipboard and drag-and-drop access + https://bugs.webkit.org/show_bug.cgi?id=30623 + + Add support in the PasteboardHelper for images, in preparation for drag-and-drop data. + + No new tests as functionality has not changed. + + * platform/gtk/PasteboardHelper.cpp: + (WebCore::PasteboardHelper::fillSelectionData): Add support for images here. + (WebCore::PasteboardHelper::targetListForDataObject): Add support for images here. + +2010-05-05 Stuart Morgan <stuartmorgan@chromium.org> + + Reviewed by Darin Fisher. + + Add a "focused" parameter to Widget::setFocus, and updates Document + so that Widget is informed of focus loss as well as focus gain. + Changes all existing setFocus implementations so that they ignore + the 'false' case, so no behavior is changed until individual + platforms are updated to handle the new case (if they want to). + + https://bugs.webkit.org/show_bug.cgi?id=37961 + + * dom/Document.cpp: + (WebCore::Document::setFocusedNode): + * platform/Widget.h: + * platform/android/WidgetAndroid.cpp: + (WebCore::Widget::setFocus): + * platform/chromium/WidgetChromium.cpp: + (WebCore::Widget::setFocus): + * platform/efl/WidgetEfl.cpp: + (WebCore::Widget::setFocus): + * platform/gtk/WidgetGtk.cpp: + (WebCore::Widget::setFocus): + * platform/haiku/WidgetHaiku.cpp: + (WebCore::Widget::setFocus): + * platform/mac/WidgetMac.mm: + (WebCore::Widget::setFocus): + * platform/qt/WidgetQt.cpp: + (WebCore::Widget::setFocus): + * platform/win/WidgetWin.cpp: + (WebCore::Widget::setFocus): + * platform/wx/WidgetWx.cpp: + (WebCore::Widget::setFocus): + * plugins/PluginView.h: + * plugins/PluginViewNone.cpp: + (WebCore::PluginView::setFocus): + * plugins/gtk/PluginViewGtk.cpp: + (WebCore::PluginView::setFocus): + * plugins/mac/PluginViewMac.cpp: + (WebCore::PluginView::setFocus): + * plugins/qt/PluginViewQt.cpp: + (WebCore::PluginView::setFocus): + * plugins/symbian/PluginViewSymbian.cpp: + (WebCore::PluginView::setFocus): + * plugins/win/PluginViewWin.cpp: + (WebCore::PluginView::setFocus): + +2010-05-05 Steve Block <steveblock@google.com> + + Reviewed by Pavel Feldman. + + Move V8 ScriptDebugServer::topStackFrame() to ScriptCallStack + https://bugs.webkit.org/show_bug.cgi?id=38531 + + ScriptCallStack::create() uses ScriptDebugServer::topStackFrame(), but ScriptDebugServer + is guarded with ENABLE(JAVASCRIPT_DEBUGGER). This prevents ScriptCallStack from being + built on platforms that do not define ENABLE(JAVASCRIPT_DEBUGGER). + + No new tests, build fix only. + + * bindings/v8/ScriptCallStack.cpp: + (WebCore::ScriptCallStack::callLocation): + (WebCore::ScriptCallStack::createUtilityContext): Helper for topStackFrame, moved from ScriptDebugServer + (WebCore::ScriptCallStack::topStackFrame): Moved from ScriptDebugServer + * bindings/v8/ScriptCallStack.h: + (WebCore::ScriptCallStack::utilityContext): Helper for topStackFrame, moved from ScriptDebugServer + * bindings/v8/ScriptDebugServer.cpp: + * bindings/v8/ScriptDebugServer.h: + +2010-05-05 Csaba Osztrogonác <ossy@webkit.org> + + Rubber-stamped by Simon Hausmann. + + [Qt] REGRESSION(r56869): WinCE build is broken + https://bugs.webkit.org/show_bug.cgi?id=36929 + + * WebCore.pro: LIBS += -lOle32 added. + +2010-05-05 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] Disable Qt Multimedia backend for HTML 5 Audio and Video elements + + Fall back to the Phonon backend until the release situation has been cleared up. + + * WebCore.pro: + +2010-05-05 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + WebInspector: Clickable links to resources should be used as 'details' part for the all suitable kinds of records. + https://bugs.webkit.org/show_bug.cgi?id=38542 + + * inspector/front-end/TimelinePanel.js: + (WebInspector.TimelinePanel.prototype._innerAddRecordToTimeline): + (WebInspector.TimelineRecordListRow): + (WebInspector.TimelineRecordListRow.prototype.update): + (WebInspector.TimelinePanel.FormattedRecord): + (WebInspector.TimelinePanel.FormattedRecord.prototype._generatePopupContent): + (WebInspector.TimelinePanel.FormattedRecord.prototype._getRecordDetails): + (WebInspector.TimelinePanel.PopupContentHelper): + (WebInspector.TimelinePanel.PopupContentHelper.prototype._createCell): + (WebInspector.TimelinePanel.PopupContentHelper.prototype._appendTextRow): + (WebInspector.TimelinePanel.PopupContentHelper.prototype._appendElementRow): + (WebInspector.TimelinePanel.PopupContentHelper.prototype._appendLinkRow): + +2010-05-05 Nikolas Zimmermann <nzimmermann@rim.com> + + Not reviewed. Add missing files generated by "run-bindings-test", after the DOMTestCallback.idl addition. + + * bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp: Added. + (WebKit::kit): + (webkit_dom_test_callback_callback_with_class1param): + (webkit_dom_test_callback_callback_with_class2param): + (webkit_dom_test_callback_callback_with_non_bool_return_type): + (WebKit::wrapTestCallback): + (WebKit::core): + (webkit_dom_test_callback_finalize): + (webkit_dom_test_callback_set_property): + (webkit_dom_test_callback_get_property): + (webkit_dom_test_callback_class_init): + (webkit_dom_test_callback_init): + * bindings/scripts/test/GObject/WebKitDOMTestCallback.h: Added. + * bindings/scripts/test/GObject/WebKitDOMTestCallbackPrivate.h: Added. + * bindings/scripts/test/ObjC/DOMTestCallback.h: Added. + * bindings/scripts/test/ObjC/DOMTestCallback.mm: Added. + (-[DOMTestCallback dealloc]): + (-[DOMTestCallback finalize]): + (-[DOMTestCallback callbackWithClass1Param:]): + (-[DOMTestCallback callbackWithClass2Param:strArg:]): + (-[DOMTestCallback callbackWithNonBoolReturnType:]): + (-[DOMTestCallback customCallback:class6Param:]): + (core): + (kit): + * bindings/scripts/test/ObjC/DOMTestCallbackInternal.h: Added. + +2010-05-05 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by Pavel Feldman. + + Web Inspector: FontView needs Cleanup + https://bugs.webkit.org/show_bug.cgi?id=38567 + + FontView was missing some of the newer practices for initialization + that other Resource Views had. Also its width calculations could + result in a single character wrapping. This is general cleanup. + + * inspector/front-end/FontView.js: + (WebInspector.FontView): move initialization into contentTabSelected + (WebInspector.FontView.prototype.contentTabSelected): handle initialization like other Resource Views + (WebInspector.FontView.prototype.updateFontPreviewSize): use a narrower width to prevent text from widowing + +2010-05-05 Dirk Schulze <krit@webkit.org> + + Reviewed by Nikolas Zimmermann. + + SVG hit testing is *way* too slow + https://bugs.webkit.org/show_bug.cgi?id=19312 + + Use the cached stroke and fill boundaries in RenderPath as a heuristik to + speed up SVG's hit testing. + + No new tests added. + + * rendering/RenderPath.cpp: + (WebCore::RenderPath::fillContains): + (WebCore::RenderPath::strokeContains): + +2010-05-04 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Adam Barth. + + Auto-generate all Database callbacks. + https://bugs.webkit.org/show_bug.cgi?id=38503 + + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSBindingsAllInOne.cpp: + * bindings/js/JSCustomSQLStatementCallback.cpp: Removed. + * bindings/js/JSCustomSQLStatementCallback.h: Removed. + * bindings/js/JSCustomSQLStatementErrorCallback.cpp: + (WebCore::JSSQLStatementErrorCallback::handleEvent): + * bindings/js/JSCustomSQLStatementErrorCallback.h: Removed. + * bindings/js/JSCustomSQLTransactionCallback.cpp: Removed. + * bindings/js/JSCustomSQLTransactionCallback.h: Removed. + * bindings/js/JSCustomSQLTransactionErrorCallback.cpp: Removed. + * bindings/js/JSCustomSQLTransactionErrorCallback.h: Removed. + * bindings/js/JSDatabaseCallback.cpp: Removed. + * bindings/js/JSDatabaseCallback.h: Removed. + * bindings/js/JSDatabaseCustom.cpp: + (WebCore::JSDatabase::changeVersion): + (WebCore::createTransaction): + * bindings/js/JSSQLTransactionCustom.cpp: + (WebCore::JSSQLTransaction::executeSql): + * bindings/scripts/CodeGeneratorJS.pm: + * bindings/scripts/test/JS/JSTestCallback.cpp: + * bindings/v8/custom/V8CustomSQLStatementCallback.cpp: Removed. + * bindings/v8/custom/V8CustomSQLStatementCallback.h: Removed. + * bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp: + (WebCore::V8SQLStatementErrorCallback::handleEvent): + * bindings/v8/custom/V8CustomSQLStatementErrorCallback.h: Removed. + * bindings/v8/custom/V8CustomSQLTransactionCallback.cpp: Removed. + * bindings/v8/custom/V8CustomSQLTransactionCallback.h: Removed. + * bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp: Removed. + * bindings/v8/custom/V8CustomSQLTransactionErrorCallback.h: Removed. + * bindings/v8/custom/V8DatabaseCallback.cpp: Removed. + * bindings/v8/custom/V8DatabaseCallback.h: Removed. + * bindings/v8/custom/V8DatabaseCustom.cpp: + (WebCore::V8Database::changeVersionCallback): + (WebCore::createTransaction): + * bindings/v8/custom/V8SQLTransactionCustom.cpp: + (WebCore::V8SQLTransaction::executeSqlCallback): + * storage/DatabaseCallback.h: + * storage/DatabaseCallback.idl: Added. + * storage/SQLStatement.cpp: + (WebCore::SQLStatement::performCallback): + * storage/SQLStatementCallback.h: + * storage/SQLStatementCallback.idl: Added. + * storage/SQLStatementErrorCallback.idl: Added. + * storage/SQLTransaction.cpp: + (WebCore::SQLTransaction::deliverTransactionCallback): + * storage/SQLTransactionCallback.h: + * storage/SQLTransactionCallback.idl: Added. + * storage/SQLTransactionErrorCallback.h: + * storage/SQLTransactionErrorCallback.idl: Added. + +2010-05-04 Chris Marrin <cmarrin@apple.com> + + Reviewed by Simon Fraser. + + Made composited iframes work on Windows + https://bugs.webkit.org/show_bug.cgi?id=32446 + + This completes the work in http://trac.webkit.org/changeset/57919 + to create compositing layers in the parent document when an iframe has + a compositing layer. The parent document has a layer for the iframe + element and builds a layer tree to the page root. The layer tree for the + iframe document is then parented to the iframe element's GraphicsLayer. + + The RenderLayerCompositor for the iframe document (which owns the + root of the layer tree) now has a clippingLayer which is the + parent of the layer tree root so it can be clipped to the parent + iframe's bounds, taking into account borders, padding, etc. in + the parent iframe element. + + I also got rid of a no longer used function: RenderLayerCompositor::parentInRootLayer + + Test: compositing/iframes/composited-parent-iframe.html + + * rendering/RenderLayerBacking.cpp:Make calls to RenderLayerCompositor to set the clipping bounds for iframe content + * rendering/RenderLayerCompositor.cpp:Hook the iframe content to the parent iframe element + * rendering/RenderLayerCompositor.h: + +2010-05-03 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Adam Barth. + + https://bugs.webkit.org/show_bug.cgi?id=38497 + <rdar://problem/7759438> Make sure that http URLs always have a host in SecurityOrigin + + This is a hardening fix, and behavior really depends on what an underlying networking layer + does. So, no test. + + * page/SecurityOrigin.cpp: + (WebCore::schemeRequiresAuthority): List schemes that need an authority for successful loading. + (WebCore::SecurityOrigin::SecurityOrigin): Never let e.g. http origins with empty authorities + have the same security origin. + +2010-05-04 Zhenyao Mo <zmo@google.com> + + Reviewed by Dimitri Glazkov. + + getFramebufferAttachmentParameter should return the original WebGLTexture/WebGLRenderbuffer instead of creating new ones sharing names. + https://bugs.webkit.org/show_bug.cgi?id=38236 + + * html/canvas/CanvasObject.h: Add type check functions. + (WebCore::CanvasObject::isBuffer): + (WebCore::CanvasObject::isFramebuffer): + (WebCore::CanvasObject::isProgram): + (WebCore::CanvasObject::isRenderbuffer): + (WebCore::CanvasObject::isShader): + (WebCore::CanvasObject::isTexture): + * html/canvas/WebGLBuffer.h: Add type check functions. + (WebCore::WebGLBuffer::isBuffer): + * html/canvas/WebGLFramebuffer.h: Add type check functions. + (WebCore::WebGLFramebuffer::isFramebuffer): + * html/canvas/WebGLProgram.h: Add type check functions. + (WebCore::WebGLProgram::isProgram): + * html/canvas/WebGLRenderbuffer.cpp: remove constructor using existing name. + * html/canvas/WebGLRenderbuffer.h: Add type check functions; remove constructor using existing name. + (WebCore::WebGLRenderbuffer::isRenderbuffer): + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::WebGLRenderingContext::getFramebufferAttachmentParameter): Return original Texture/Renderbuffer instead of creating new ones. + (WebCore::WebGLRenderingContext::findTexture): Find a WebGLTexture using a name. + (WebCore::WebGLRenderingContext::findRenderbuffer): Find a WebGLRenderbuffer using a name. + * html/canvas/WebGLRenderingContext.h: Add find* functions. + * html/canvas/WebGLShader.h: Add type check functions. + (WebCore::WebGLShader::isShader): + * html/canvas/WebGLTexture.cpp: remove constructor using existing name. + * html/canvas/WebGLTexture.h: Add type check functions; remove constructor using existing name. + (WebCore::WebGLTexture::isTexture): + +2010-05-04 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Simon Hausmann. + + [Qt] QT_MOBILE_THEME compile time flag + https://bugs.webkit.org/show_bug.cgi?id=38439 + + Replacing preprocessor conditional used in RenderThemeQt from Q_WS_MAEMO_5 to + USE(QT_MOBILE_THEME). + + * WebCore.pro: + * platform/qt/RenderThemeQt.cpp: + (WebCore::RenderThemeQt::RenderThemeQt): + (WebCore::RenderThemeQt::qStyle): + (WebCore::RenderThemeQt::extraDefaultStyleSheet): + (WebCore::RenderThemeQt::adjustMenuListButtonStyle): + (WebCore::RenderThemeQt::setPaletteFromPageClientIfExists): + * platform/qt/RenderThemeQt.h: + +2010-05-04 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by Dan Bernstein. + + SVG fonts trigger GlyphPage::fill with null font + https://bugs.webkit.org/show_bug.cgi?id=38530 + + SVG fonts do not use the glyph page cache. This change detects when + attempting to fill a GlyphPage with an SVG font and indicates that + the glyphs were not available. + + * platform/graphics/GlyphPageTreeNode.cpp: + (WebCore::fill): helper method which handles attempts to fill a GlyphPage with SVG or non-SVG fonts + (WebCore::GlyphPageTreeNode::initializePage): use the helper where appropriate + +2010-05-04 Kent Tamura <tkent@chromium.org> + + Reviewed by David Levin (and unofficially by Enrica Casucci). + + REGRESSION(r54368): Text drag-and-drop from input/textarea doesn't work + if the text is like a URL + https://bugs.webkit.org/show_bug.cgi?id=38374 + + Since r54368, documentFragmentFromDragData() creates an <a> element + with no anchor text for URL-like text dragged from input/textarea + element. If such text is dropped to input/textarea element, the text + is not inserted. + To fix this problem, use the original text or the URL as an anchor + text. + + Test: editing/pasteboard/drag-drop-url-text.html + + * page/DragController.cpp: + (WebCore::documentFragmentFromDragData): + +2010-05-04 Steve Block <steveblock@google.com> + + Reviewed by Darin Adler. + + JavaInstanceJSC.cpp and JNIUtilityPrivate.cpp need to include jni_jsobject.h for jlong_to_pt() and ptr_to_jlong() + https://bugs.webkit.org/show_bug.cgi?id=38525 + + No new tests, build fix only. + + * bridge/jni/jni_jsobject.h: Guard Mac-specific code with PLATFORM(MAC) + * bridge/jni/jsc/JNIUtilityPrivate.cpp: Include jni_jsobject.h + * bridge/jni/jsc/JavaInstanceJSC.cpp: Include jni_jsobject.h + +2010-05-04 Steve Block <steveblock@google.com> + + Reviewed by Darin Adler. + + New FileSystemPOSIX functions cause linker errors on Android + https://bugs.webkit.org/show_bug.cgi?id=38521 + + No new tests, build fix only. + + * platform/android/FileSystemAndroid.cpp: Remove closeFile, which is provided in FileSystemPOSIX.cpp + * platform/posix/FileSystemPOSIX.cpp: Guard writeToFile with !PLATFORM(ANDROID) + +2010-05-04 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: restore main and sidebar scroller positions + when switching between panels. + + https://bugs.webkit.org/show_bug.cgi?id=38522 + + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel.prototype.elementsToRestoreScrollPositionsFor): + * inspector/front-end/Panel.js: + (WebInspector.Panel.prototype.show): + (WebInspector.Panel.prototype.hide): + (WebInspector.Panel.prototype.elementsToRestoreScrollPositionsFor): + (WebInspector.Panel.prototype._storeScrollPositions): + (WebInspector.Panel.prototype._restoreScrollPositions): + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourcesPanel.prototype.elementsToRestoreScrollPositionsFor): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype.elementsToRestoreScrollPositionsFor): + +2010-05-04 Steven Lai <steven_lai@asia.apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=37900 + <rdar://problem/7806164> cloneNode() does not preserve z-index with more than six digits + + Tests: fast/dom/HTMLInputElement/clone-input-checked.html + fast/dom/clone-node-z-index.html + + * dom/Element.cpp: undid the order change of calling copyNonAttributeProperties() before setAttributes() + (WebCore::Element::cloneElementWithoutChildren): uncheck the previous radio button in the same radio button group only when the checked radio box is appended to the dom tree + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::updateCheckedRadioButtons): + (WebCore::HTMLInputElement::attach): + (WebCore::HTMLInputElement::setChecked): + * html/HTMLInputElement.h: + +2010-04-29 John Gregg <johnnyg@google.com> + + Reviewed by Dmitry Titov. + + notifications should have dir and replaceId attributes. + Note that tests are only enabled in Chromium, skipped elsewhere + since notifications aren't implemented. + https://bugs.webkit.org/show_bug.cgi?id=38336 + + Tests: fast/notifications/notifications-replace.html + fast/notifications/notifications-rtl.html + + * notifications/Notification.h: + (WebCore::Notification::dir): + (WebCore::Notification::setDir): + (WebCore::Notification::replaceId): + (WebCore::Notification::setReplaceId): + * notifications/Notification.idl: + +2010-05-04 Alejandro G. Castro <alex@igalia.com> + + Reviewed by Xan Lopez. + + Fixed error defining the float/double minimum in the object + properties, the smallest value of a float/double is + -G_MAXDOUBLE/-G_MAXFLOAT. + + * bindings/scripts/CodeGeneratorGObject.pm: + +2010-05-03 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by Dan Bernstein. + + REGRESSION: Text clipped in absolutely positioned search inputs + https://bugs.webkit.org/show_bug.cgi?id=38468 + + Previously I incorrectly added x() and y() to the tx and ty positioning. + This clips a search input like a text input, respecting the vertically + centered text. + + * rendering/RenderTextControlSingleLine.cpp: + (WebCore::RenderTextControlSingleLine::layout): only the Y changes, so change setLocation to setY + (WebCore::RenderTextControlSingleLine::controlClipRect): + +2010-05-04 Alexander Pavlov <apavlov@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: REGRESSION: Up/Down, PgUp/PgDown keys do not change numeric style properties + https://bugs.webkit.org/show_bug.cgi?id=38516 + + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylePropertyTreeElement.prototype): + +2010-05-04 Ben Murdoch <benm@google.com> + + Reviewed by Simon Hausmann. + + Crash in handleTouchEvent: using dangling node ptrs in hashmap + https://bugs.webkit.org/show_bug.cgi?id=38514 + + When navigating away from a page, if you have your finger still + pressed and then lift it on the new page we see a crash if the + node got deleted as we still have a dangling pointer in the + m_originatingTouchPointTargets hashmap and try to use it as the + receiver to dispatch a touchend event. + + Test: fast/events/touch/touch-stale-node-crash.html + + * page/EventHandler.cpp: + (WebCore::EventHandler::clear): Clear the hashmap of touch targets. + +2010-05-04 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by Pavel Feldman. + + Web Inspector: Drawer Misbehaving when Docking / Undocking in Console Panel + https://bugs.webkit.org/show_bug.cgi?id=38510 + + * inspector/front-end/inspector.js: + (WebInspector.set attached): resize the drawer after docking/undocking + +2010-05-04 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Unreviewed, build fix for Symbian. + + [Symbian] Build fix after r58598. + + Use C99 integer types for the Symbian plugin + implementation. + + No new tests, as there is no new functionality. + + * plugins/symbian/PluginPackageSymbian.cpp: + (WebCore::PluginPackage::NPVersion): + * plugins/symbian/PluginViewSymbian.cpp: + (WebCore::PluginView::handlePostReadFile): + +2010-05-04 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Dirk Schulze. + + Split SVGCharacterLayoutInfo in smaller pieces + https://bugs.webkit.org/show_bug.cgi?id=38513 + + Split SVGCharacterLayoutInfo into SVGCharacterLayoutInfo/SVGCharacterData and SVGTextChunkLayoutInfo. + This is a preparation for more work in the text area. + + * Android.mk: Add SVGCharacterData.(cpp|h) and SVGTextChunkLayoutInfo.h to build. + * GNUmakefile.am: Ditto. + * WebCore.gypi: Ditto. + * WebCore.pro: Ditto + * WebCore.vcproj/WebCore.vcproj: Ditto. + * WebCore.xcodeproj/project.pbxproj: Ditto. + * rendering/SVGCharacterData.cpp: Copied from rendering/SVGCharacterLayoutInfo.cpp. + * rendering/SVGCharacterData.h: Copied from rendering/SVGCharacterLayoutInfo.h. + (WebCore::SVGChar::SVGChar): + * rendering/SVGCharacterLayoutInfo.cpp: + (WebCore::SVGCharacterLayoutInfo::isInitialLayout): Introduced new helper function to share code between addLayoutInformation/addStackContent. + (WebCore::SVGCharacterLayoutInfo::addLayoutInformation): Use new helper function. + (WebCore::SVGCharacterLayoutInfo::addStackContent): Ditto + * rendering/SVGCharacterLayoutInfo.h: + * rendering/SVGRootInlineBox.h: Include new files. + * rendering/SVGTextChunkLayoutInfo.h: Copied from rendering/SVGCharacterLayoutInfo.h. + +2010-05-04 Xan Lopez <xlopez@igalia.com> + + Reviewed by Holger Freyther. + + [GTK] GObject DOM bindings + https://bugs.webkit.org/show_bug.cgi?id=33590 + + Use helper functions from CodeGenerator.pm to figure out whether a + type is "fundamental" or not (basically whether it's anything + other than a string or a non-pointer type). + + * bindings/scripts/CodeGeneratorGObject.pm: + +2010-04-30 Alexander Pavlov <apavlov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: REGRESSION: Disabled style properties are absent in Styles sidebar after WebInspector is re-opened + https://bugs.webkit.org/show_bug.cgi?id=38255 + + Moved stylesheet-related mappings into a separate object stored + in InspectorController rather than InspectorDOMAgent (which gets reset + on every frontend [dis]connect). + + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * inspector/InspectorCSSStore.cpp: Added. + (WebCore::InspectorCSSStore::InspectorCSSStore): + (WebCore::InspectorCSSStore::~InspectorCSSStore): + (WebCore::InspectorCSSStore::reset): + * inspector/InspectorCSSStore.h: Added. + * inspector/InspectorController.cpp: + (WebCore::InspectorController::InspectorController): + (WebCore::InspectorController::setFrontend): + (WebCore::InspectorController::didCommitLoad): + * inspector/InspectorController.h: + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::InspectorDOMAgent): + (WebCore::InspectorDOMAgent::discardBindings): + (WebCore::InspectorDOMAgent::applyStyleText): + (WebCore::InspectorDOMAgent::setStyleText): + (WebCore::InspectorDOMAgent::setStyleProperty): + (WebCore::InspectorDOMAgent::toggleStyleEnabled): + (WebCore::InspectorDOMAgent::setRuleSelector): + (WebCore::InspectorDOMAgent::addRule): + (WebCore::InspectorDOMAgent::bindStyle): + (WebCore::InspectorDOMAgent::bindRule): + (WebCore::InspectorDOMAgent::buildObjectForStyle): + (WebCore::InspectorDOMAgent::buildObjectForRule): + * inspector/InspectorDOMAgent.h: + (WebCore::InspectorDOMAgent::create): + (WebCore::InspectorDOMAgent::cssStore): + +2010-05-04 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Pavel Feldman. + + Display "Recording..." item when recording an user-initiated CPU profile. + + https://bugs.webkit.org/show_bug.cgi?id=38043 + + * English.lproj/localizedStrings.js: + * inspector/front-end/ProfilesPanel.js: + (WebInspector.ProfilesPanel.prototype.addProfileHeader): + (WebInspector.ProfilesPanel.prototype.removeProfileHeader): + (WebInspector.ProfilesPanel.prototype.showProfile): + * inspector/front-end/inspector.js: + (WebInspector.setRecordingProfile): + +2010-05-04 Tucker Jay <jay.tucker@nokia.com> + + Reviewed by Holger Freyther. + + Animated GIF images does not animate 10x as expected by default. + https://bugs.webkit.org/show_bug.cgi?id=36818 + + Added test case to existing manual test to test the + fixed functionality. + + * manual-tests/qt/qt-10loop-anim.gif: Added. + * manual-tests/qt/qt-gif-test.html: + * platform/graphics/qt/ImageDecoderQt.cpp: + (WebCore::ImageDecoderQt::repetitionCount): + +2010-05-04 Dirk Schulze <krit@webkit.org> + + Unreviewed sort of XCodes project file. + + * WebCore.xcodeproj/project.pbxproj: + +2010-05-03 Steven Lai <steven_lai@asia.apple.com> + + Reviewed by Brady Eidson. + + Reverted hashchange() event back to async. + (This change does not update HashChangeEvent to its new proposed interface) + https://bugs.webkit.org/show_bug.cgi?id=36201 + rdar://problem/7780794 + rdar://problem/7761278 (partial fix) + + Tests: fast/loader/hashchange-event-async.html + + * dom/Document.cpp: reverted hashchange() event back to async + (WebCore::Document::enqueueHashchangeEvent): + +2010-05-03 Holger Hans Peter Freyther <zecke@selfish.org> + + Rubber-stamped by Xan Lopez. + + [Cairo,WX] Stop leaking a FontPlatformData. + https://bugs.webkit.org/show_bug.cgi?id=37500 + + Stephan Aßmus pointed out that the pango font backend + is leaking memory and fixed it. The WX font backend + and the Cairo/Fontconfig backend have the same snippet + of code and are leaking memory as well. This commit is + fixing that. + + * platform/graphics/cairo/SimpleFontDataCairo.cpp: + (WebCore::SimpleFontData::smallCapsFontData): + * platform/graphics/wx/SimpleFontDataWx.cpp: + (WebCore::SimpleFontData::smallCapsFontData): + +2010-05-03 James Robinson <jamesr@chromium.org> + + Reviewed by Eric Seidel. + + Clean up a few compiler warnings + https://bugs.webkit.org/show_bug.cgi?id=38073 + + * html/TextMetrics.h: + (WebCore::TextMetrics::width): + * rendering/style/StyleRareInheritedData.h: + * rendering/style/StyleRareNonInheritedData.h: + +2010-05-02 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Adam Barth. + + Add the ability to auto-generate callbacks to all code generators. + https://bugs.webkit.org/show_bug.cgi?id=38414 + + * bindings/scripts/CodeGeneratorJS.pm: + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/scripts/test/JS/JSTestCallback.cpp: Added. + (WebCore::JSTestCallback::JSTestCallback): + (WebCore::JSTestCallback::~JSTestCallback): + (WebCore::JSTestCallback::callbackWithClass1Param): + (WebCore::JSTestCallback::callbackWithClass2Param): + * bindings/scripts/test/JS/JSTestCallback.h: Added. + (WebCore::JSTestCallback::create): + * bindings/scripts/test/V8/JSTestCallback.cpp: Added. + (WebCore::V8TestCallback::V8TestCallback): + (WebCore::V8TestCallback::~V8TestCallback): + (WebCore::V8TestCallback::callbackWithClass1Param): + (WebCore::V8TestCallback::callbackWithClass2Param): + * bindings/scripts/test/V8/V8TestCallback.h: Added. + (WebCore::V8TestCallback::create): + * bindings/scripts/test/TestCallback.idl: Added. + +2010-05-03 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + [wx] Build and use Mac's ComplexTextController to support complex text in wx. + https://bugs.webkit.org/show_bug.cgi?id=38482 + + * platform/graphics/FloatSize.h: + * platform/graphics/GlyphBuffer.h: + (WebCore::GlyphBuffer::advanceAt): + (WebCore::GlyphBuffer::add): + * platform/graphics/SimpleFontData.h: + (WebCore::SimpleFontData::getNSFont): + * platform/graphics/mac/ComplexTextController.cpp: + * platform/graphics/mac/ComplexTextController.h: + * platform/graphics/wx/FontCacheWx.cpp: + (WebCore::FontCache::getFontDataForCharacters): + (WebCore::FontCache::getLastResortFallbackFont): + * platform/graphics/wx/FontPlatformData.h: + (toCTFontRef): + (WebCore::FontPlatformData::FontPlatformData): + (WebCore::FontPlatformData::allowsLigatures): + * platform/graphics/wx/FontPlatformDataWx.cpp: + (WebCore::FontPlatformData::FontPlatformData): + (WebCore::FontPlatformData::cgFont): + * platform/graphics/wx/FontPlatformDataWxMac.mm: Added. + (WebCore::FontPlatformData::nsFont): + (WebCore::FontPlatformData::cacheNSFont): + * platform/graphics/wx/FontWx.cpp: + (WebCore::Font::canReturnFallbackFontsForComplexText): + (WebCore::Font::selectionRectForComplexText): + (WebCore::Font::drawComplexText): + (WebCore::Font::floatWidthForComplexText): + (WebCore::Font::offsetForPositionForComplexText): + * platform/graphics/wx/SimpleFontDataWx.cpp: + (WebCore::SimpleFontData::platformInit): + (WebCore::SimpleFontData::containsCharacters): + (WebCore::SimpleFontData::platformWidthForGlyph): + * platform/wx/wxcode/fontprops.h: + * platform/wx/wxcode/mac/carbon/fontprops.mm: + (wxFontContainsCharacters): + (GetTextExtent): + * platform/wx/wxcode/mac/carbon/non-kerned-drawing.cpp: + (WebCore::drawTextWithSpacing): + * platform/wx/wxcode/win/fontprops.cpp: + (wxFontContainsCharacters): + * wscript: + +2010-05-03 Abhishek Arya <inferno@chromium.org> + + Reviewed by Adam Barth. + + Add support for controlling clipboard access from javascript. + Clipboard access from javascript is disabled by default. + https://bugs.webkit.org/show_bug.cgi?id=27751 + + Test: editing/execCommand/clipboard-access.html + + * WebCore.base.exp: + * editing/EditorCommand.cpp: + (WebCore::supportedCopyCut): + (WebCore::supportedPaste): + (WebCore::createCommandMap): + * page/Settings.cpp: + (WebCore::Settings::Settings): + (WebCore::Settings::setJavaScriptCanAccessClipboard): + * page/Settings.h: + (WebCore::Settings::javaScriptCanAccessClipboard): + +2010-05-03 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Adam Barth. + + https://bugs.webkit.org/show_bug.cgi?id=38285 + <rdar://problem/7903453> REGRESSION: Javascript command window.open does not work in empty tab + + Cannot be tested, because new windows created in DRT always have an opener, and thus inherit + its security origin. Only new windows and tabs created by browser chrome had this problem. + + * loader/FrameLoader.cpp: (WebCore::FrameLoader::init): Moved updateSandboxFlags() call to + the beginning, so that an initial document would get correct flags. + +2010-05-03 Noam Rosenthal <noam.rosenthal@nokia.com> + + Reviewed by Darin Adler. + + WebGL compile issue. + Added ExceptionCode.h to JSWebGLArrayBufferConstructor.cpp, for some reason it was missing. + https://bugs.webkit.org/show_bug.cgi?id=38453 + + No new tests: compile fix. + + * bindings/js/JSWebGLArrayBufferConstructor.cpp: + +2010-05-03 Eric Seidel <eric@webkit.org> + + Unreviewed, rolling out r58685. + http://trac.webkit.org/changeset/58685 + https://bugs.webkit.org/show_bug.cgi?id=38461 + + Broke a test on Gtk + + * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: + (WebCore::MediaPlayerPrivateGStreamer::updateStates): + +2010-05-03 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Darin Adler. + + Use HTML5 number parsing in HTMLProgressElement + https://bugs.webkit.org/show_bug.cgi?id=38434 + + Use parseToDoubleForNumberType instead of toDouble. + Throw an exception when the number is NaN or Infinity. + + * html/HTMLProgressElement.cpp: + (WebCore::HTMLProgressElement::value): + (WebCore::HTMLProgressElement::setValue): + (WebCore::HTMLProgressElement::max): + (WebCore::HTMLProgressElement::setMax): + * html/HTMLProgressElement.h: + * html/HTMLProgressElement.idl: + +2010-05-03 Jens Alfke <snej@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Add "willSendSubmitEvent" hook to WebFrameClient and FrameLoaderClient + https://bugs.webkit.org/show_bug.cgi?id=38397 + + No tests (functionality is exposed only through native WebKit API.) + + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::prepareSubmit): Call frame loader's dispatchWillSendSubmitEvent + * loader/EmptyClients.h: + * loader/FrameLoaderClient.h: + (WebCore::FrameLoaderClient::dispatchWillSendSubmitEvent): New empty method + +2010-05-03 Philippe Normand <pnormand@igalia.com> + + Reviewed by Eric Carlson. + + [GStreamer] forgotten call to durationChanged in updateStates() + https://bugs.webkit.org/show_bug.cgi?id=38461 + + Notify MediaPlayer if duration is known after playback started. + + * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: + (WebCore::MediaPlayerPrivateGStreamer::updateStates): + +2010-05-03 Ryuan Choi <ryuan.choi@gmail.com> + + Reviewed by Darin Adler. + + fixing build break due to clearWatch() when Geolocation feature is + disabled. + + https://bugs.webkit.org/show_bug.cgi?id=38091 + + no test because this is a build fix only + + * page/Geolocation.cpp: + (WebCore::Geolocation::clearWatch): + +2010-05-03 Stephan Aßmus <superstippi@gmx.de> + + Reviewed by Holger Freyther. + + [Gtk] Fix leaking the FontPlatformData instance used to create the the + small caps font data. + https://bugs.webkit.org/show_bug.cgi?id=37500 + + No new tests needed. + + * platform/graphics/gtk/SimpleFontDataPango.cpp: + (WebCore::SimpleFontData::smallCapsFontData): + - Use a stack allocated FontPlatformData instead of a heap allocated + one that is never freed. + +2010-05-03 Jarkko Sakkinen <jarkko.j.sakkinen@gmail.com> + + Reviewed by Simon Hausmann. + + [Qt] GraphicsLayer: support webGL + https://bugs.webkit.org/show_bug.cgi?id=35388 + + Added support GraphicsContext3D to GraphicsLayer. + Added paint method to GraphicsContext3D for Qt platform that + uses drawTexture() when QGLWidget is used as viewport of + QGraphicsWebView. + Fine-tuned texture and handling and image to texture conversion to + work also when drawTexture() blitting is used. + + * platform/graphics/GraphicsContext3D.h: + * platform/graphics/qt/GraphicsContext3DQt.cpp: + (WebCore::GraphicsContext3DInternal::GraphicsContext3DInternal): + (WebCore::GraphicsContext3D::beginPaint): + (WebCore::GraphicsContext3D::paint): + (WebCore::GraphicsContext3D::texImage2D): + (WebCore::GraphicsContext3D::texSubImage2D): + (WebCore::GraphicsContext3D::getImageData): + * platform/graphics/qt/GraphicsLayerQt.cpp: + (WebCore::GraphicsLayerQtImpl::): + (WebCore::GraphicsLayerQtImpl::GraphicsLayerQtImpl): + (WebCore::GraphicsLayerQtImpl::paint): + (WebCore::GraphicsLayerQtImpl::flushChanges): + (WebCore::GraphicsLayerQt::setContentsToGraphicsContext3D): + (WebCore::GraphicsLayerQt::setGraphicsContext3DNeedsDisplay): + * platform/graphics/qt/GraphicsLayerQt.h: + +2010-05-03 Janne Koskinen <janne.p.koskinen@digia.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix qtlibraryinfix not to contain space + + List catenation with += adds whitespace cutting the infix + from the final target. + + * WebCore.pro: + +2010-05-03 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix rendering of <button> elements on Mac OS X + + The <button> element has ButtonPart appearance, not PushButton part, + so we have to include ButtonPart when we decide if we should draw the + button as raised on Mac OS X. + + https://bugs.webkit.org/show_bug.cgi?id=38458 + + * platform/qt/RenderThemeQt.cpp: + (WebCore::RenderThemeQt::initializeCommonQStyleOptions): + +2010-04-30 Philippe Normand <pnormand@igalia.com> + + Reviewed by Eric Seidel. + + [GStreamer] endless loop after playback ended + https://bugs.webkit.org/show_bug.cgi?id=38384 + + At playback end ensure duration() will return a valid duration if + we managed to calculate it based on current position. + + Test: media/video-duration-known-after-eos.html + + * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: + (WebCore::MediaPlayerPrivateGStreamer::didEnd): + +2010-05-03 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Fix build break on Mac OS X + + * plugins/mac/PluginPackageMac.cpp: Use correct type + * WebCore.pro: Remove duplicate symbol, we now have a Qt implementation + +2010-05-03 Thomas Zander <t.zander@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix library infix usage when compiling inside of Qt + + Don't apply the infix when building inside Qt, as that's done through the + inclusion of qbase.pri. + + * WebCore.pro: + +2010-05-02 Dan Bernstein <mitz@apple.com> + + Reviewed by Simon Fraser. + + Another case of <rdar://problem/7552959> REGRESSION: Infinite recursion in Position::getInlineBoxAndOffset() + https://bugs.webkit.org/show_bug.cgi?id=38445 + + Test: editing/selection/mixed-editability-11.html + + * dom/Position.cpp: + (WebCore::downstreamIgnoringEditingBoundaries): Added. Returns the furthest visually equivalent + position downstream, crossing any editability boundaries. + (WebCore::upstreamIgnoringEditingBoundaries): Similarly for upstream. + (WebCore::Position::getInlineBoxAndOffset): Changed the logic for finding an inline box for positions + whose node is a block flow. Instead of traversing the DOM, advance downstream or upstream as far as + possible, crossing any editability boudaries. Infinite recursion is avoided by advancing all the way + and checking that the new position is different from the starting position. Also replaced the specific + test for buttons with the generic and more comprehensive canHaveChildrenForEditing(). + +2010-05-02 Tasuku Suzuki <tasuku.suzuki@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix compilation with QT_NO_BEARERMANAGEMENT + https://bugs.webkit.org/show_bug.cgi?id=38324 + + * platform/network/NetworkStateNotifier.h: + * platform/network/qt/NetworkStateNotifierQt.cpp: + +2010-04-29 Janne Koskinen <janne.p.koskinen@digia.com> + + Reviewed by Simon Hausmann. + + [Qt] QtWebKit versioning added + https://bugs.webkit.org/show_bug.cgi?id=37207 + + QtWebkit releases separated from Qt release cycle. + + * WebCore.pro: + +2010-05-02 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Old Style trimWhitespace() should be trim() + https://bugs.webkit.org/show_bug.cgi?id=38441 + + * inspector/front-end/SourceFrame.js: + (WebInspector.SourceFrame.prototype._evalSelectionInCallFrame): + +2010-05-02 Tasuku Suzuki <tasuku.suzuki@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix compilation with QT_NO_LINEEDIT + https://bugs.webkit.org/show_bug.cgi?id=38324 + + * platform/qt/RenderThemeQt.cpp: + (WebCore::RenderThemeQt::~RenderThemeQt): + (WebCore::RenderThemeQt::findFrameLineWidth): + +2010-05-02 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed: Touch inspector controller to kick windows tests. + + * inspector/InspectorController.cpp: + +2010-05-02 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: IMG nodes are being added to the DOM tree late, sometimes hiding the revealed element. + + https://bugs.webkit.org/show_bug.cgi?id=38432 + + * inspector/front-end/ElementsTreeOutline.js: + (WebInspector.ElementsTreeOutline.prototype._onmousemove): + (WebInspector.ElementsTreeElement.prototype._createTooltipForNode.setTooltip): + (WebInspector.ElementsTreeElement.prototype._createTooltipForNode): + (WebInspector.ElementsTreeElement.prototype.updateTitle): + (WebInspector.ElementsTreeElement.prototype._attributeHTML): + (): + +2010-05-02 Dirk Schulze <krit@webkit.org> + + Reviewed by Nikolas Zimmermann. + + SVG hkern implementation incomplete + https://bugs.webkit.org/show_bug.cgi?id=38407 + + Test: svg/text/text-hkern.svg + + The current SVG hkern implementation is incomplete and partly wrong. We pass the ACID3 test + by accident. + The new implementation supports all glyph and unicode combinations that are allowed by the Spec + and fixes various of bugs. The parser moved from SVGFontElement to the general parsing code in + SVGParserUtilities. + Some clean-up makes the code more readable and reuseable for the upcoming vkern implementation. + hkern support for text on path is missing and will be added by a following patch. + Unicode strings of hkern elements are just parsed once and not on every glyph again anymore. + + * rendering/SVGRootInlineBox.cpp: + (WebCore::calculateCSSKerning): + (WebCore::applySVGKerning): + (WebCore::SVGRootInlineBox::buildLayoutInformationForTextBox): + * svg/SVGFontElement.cpp: + (WebCore::stringMatchesUnicodeRange): + (WebCore::stringMatchesGlyphName): + (WebCore::matches): + (WebCore::SVGFontElement::getHorizontalKerningPairForStringsAndGlyphs): + * svg/SVGFontElement.h: + * svg/SVGHKernElement.cpp: + (WebCore::SVGHKernElement::buildHorizontalKerningPair): + * svg/SVGHKernElement.h: + * svg/SVGParserUtilities.cpp: + (WebCore::parseGlyphName): + (WebCore::parseUnicodeRange): + (WebCore::parseKerningUnicodeString): + * svg/SVGParserUtilities.h: + +2010-05-02 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: debugger shortcuts are processed twice if source frame has focus. + + https://bugs.webkit.org/show_bug.cgi?id=38431 + + * inspector/front-end/SourceFrame.js: + (WebInspector.SourceFrame): + (WebInspector.SourceFrame.prototype._createViewerIfNeeded): + +2010-05-02 Jarkko Sakkinen <jarkko.j.sakkinen@gmail.com> + + Reviewed by Eric Seidel. + + [Qt] Build error in GraphicsContext3DQt.cpp + https://bugs.webkit.org/show_bug.cgi?id=38382 + + Removed duplicate implementation of isGLES2Compliant from + GraphicsContext3DQt.cpp. Removed deprecated API stuff for + texImage2D/texSubImage2D. + * platform/graphics/qt/GraphicsContext3DQt.cpp: + +2010-05-02 Garret Kelly <gdk@chromium.org> + + Reviewed by David Levin. + + Make the Touch RuntimeEnabledFeature disabled by default. + https://bugs.webkit.org/show_bug.cgi?id=38392 + + * bindings/generic/RuntimeEnabledFeatures.cpp: Disable the Touch feature by default. + +2010-05-02 Michael Nordman <michaeln@google.com> + + Reviewed by Dmitry Titov. + + Define two new ResourceRequestBase TargetTypes for worker and shared worker + main resources. Use the new target types where appropiate. Add logic to marshal + the target type specified by requests initiated on a background worker thread. + + https://bugs.webkit.org/show_bug.cgi?id=38295 + + No new tests. This doesn't have script visible artifacts. + + * platform/network/ResourceRequestBase.cpp: marshal the values + (WebCore::ResourceRequestBase::adopt): + (WebCore::ResourceRequestBase::copyData): + * platform/network/ResourceRequestBase.h: define the types + (WebCore::ResourceRequestBase::): + * workers/DefaultSharedWorkerRepository.cpp: use TargetIsSharedWorker + (WebCore::SharedWorkerScriptLoader::load): + * workers/Worker.cpp: use TargetIsWorker + (WebCore::Worker::Worker): + * workers/WorkerContext.cpp: use TargetIsScript for importScripts + (WebCore::WorkerContext::importScripts): + * workers/WorkerScriptLoader.cpp: add a data member for the target type + (WebCore::WorkerScriptLoader::WorkerScriptLoader): + (WebCore::WorkerScriptLoader::createResourceRequest): + * workers/WorkerScriptLoader.h: + +2010-05-02 Noam Rosenthal <noam.rosenthal@nokia.com> + + Reviewed by Adele Peterson. + + Webkit doesn't compile with 3D-canvas enabled and video disabled + https://bugs.webkit.org/show_bug.cgi?id=38297 + + Added a #ifdef ENABLE(VIDEO) to WebGL code + + No new tests: compile fix. + + * bindings/js/JSWebGLRenderingContextCustom.cpp: + (WebCore::JSWebGLRenderingContext::texImage2D): + (WebCore::JSWebGLRenderingContext::texSubImage2D): + +2010-05-01 Evan Stade <estade@chromium.org> + + Reviewed by David Levin. + + [chromium] Skia needs to fade DragImages + https://bugs.webkit.org/show_bug.cgi?id=38008 + + tested by DragImageTest + + * platform/chromium/DragImageChromiumSkia.cpp: + (WebCore::dissolveDragImageToFraction):implement + (WebCore::createDragImageFromImage):deep copy instead of shallow + +2010-05-01 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Sam Weinig. + + REGRESSION (r58273): Visited links do not change color immediately when Cmd-clicked + https://bugs.webkit.org/show_bug.cgi?id=38422 + <rdar://problem/7921778> + + Tests: + manual-tests/visited-link-new-window.html + + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::initElement): Only cache the visited link state + when invoked as part of a helper call to styleForElement or pseudoStyleForElement, + to avoid caching the visited link state beyond the scope of a single style lookup. + (WebCore::CSSStyleSelector::styleForElement): Adjust for above change. + (WebCore::CSSStyleSelector::pseudoStyleForElement): Adjust for above change. + * css/CSSStyleSelector.h: + (WebCore::CSSStyleSelector::styleForElement): Change so "visited link helper mode" + can't accidentally be called from outside CSSStyleSelector itself. + (WebCore::CSSStyleSelector::pseudoStyleForElement): ditto + * manual-tests/visited-link-new-window.html: Added. I could not figure out any way + to make an automated test that supports visited link coloring. + +2010-05-01 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Darin Adler. + + Move number parsing code out of HTMLInputElement. + https://bugs.webkit.org/show_bug.cgi?id=38203 + + The numebr parsing code follows HTML5 parsing rules and should be available outside of HTMLInputElement. + No new tests as no new functionality was introduced. + + * html/HTMLInputElement.cpp: + * html/HTMLInputElement.h: + * html/HTMLParser.cpp: + (WebCore::serializeForNumberType): + (WebCore::parseToDoubleForNumberType): + * html/HTMLParser.h: + * html/StepRange.cpp: + (WebCore::StepRange::clampValue): + (WebCore::StepRange::valueFromElement): + * html/ValidityState.cpp: + (WebCore::ValidityState::typeMismatch): + * rendering/RenderSlider.cpp: + (WebCore::RenderSlider::setValueForPosition): + +2010-05-01 Xan Lopez <xlopez@igalia.com> + + Reviewed by Oliver Hunt. + + [GTK] GObject DOM bindings + https://bugs.webkit.org/show_bug.cgi?id=33590 + + Unify more logic to skip functions into SkipFunction, and + whitelist the two [Custom] methods in HTMLCollection.idl. + + * bindings/scripts/CodeGeneratorGObject.pm: + +2010-05-01 Robert Hogan <robert@webkit.org> + + Reviewed by Simon Hausmann. + + [Qt] Add smart paste support + + https://bugs.webkit.org/show_bug.cgi?id=38136 + + * WebCore.pro: + * editing/qt/SmartReplaceQt.cpp: Added. + (WebCore::isCharacterSmartReplaceExempt): + * platform/qt/PasteboardQt.cpp: + (WebCore::Pasteboard::writeSelection): + (WebCore::Pasteboard::canSmartReplace): + +2010-04-30 Yoshiki Hayashi <yhayashi@google.com> + + Reviewed by Shinichiro Hamaji. + + https://bugs.webkit.org/show_bug.cgi?id=38249 + + Fixes an issue where border height and padding height are ignored when computing vertically shrinking flexbox's height. + + Test: fast/flexbox/child-flexing.html + + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::allowedChildFlex): + +2010-04-30 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Darin Adler. + + Add layoutTestController.setPrinting() + https://bugs.webkit.org/show_bug.cgi?id=37203 + + Use the renderer's width insteead of screen's width as the width of + a screen depends on machines. + + * rendering/RenderTreeAsText.cpp: + (WebCore::externalRepresentation): + +2010-04-30 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Missing INSPECTOR Guard in Console::lastWMLErrorMessage + https://bugs.webkit.org/show_bug.cgi?id=38366 + + Console::lastWMLErrorMessage is only available if WML is enabled, however + its implementation only makes sense as long as INSPECTOR is enabled + as well. So this adds the ENABLE(INSPECTOR) guard in the function. A + browser without ENABLE(INSPECTOR) will always get an empty result. + + * page/Console.cpp: + +2010-04-28 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by Oliver Hunt. + + REGRESSION(r58313): Regression evident in pixel tests: the search icon is always clipped at the bottom. + https://bugs.webkit.org/show_bug.cgi?id=38253 + + Test: fast/css/input-search-padding.html + + An <input type="search"> contains an inner block, which is explicitly + centered in RenderTextControlSingleLine based on the height of the element. + However, the clipping rect was not using the set location, and instead + calculated off of the top border and padding alone. This also vertically + centers the Caps Lock indicator. + + * rendering/RenderTextControl.cpp: moved controlClipRect implementation to RenderTextControlSingleLine + * rendering/RenderTextControl.h: allow a subclass implementation of controlClipRect, removed redundant hasControlClip implementation, and moved controlClipRect + * rendering/RenderTextControlSingleLine.cpp: + (WebCore::RenderTextControlSingleLine::paint): vertically center the Caps Lock indicator + (WebCore::RenderTextControlSingleLine::controlClipRect): use the set location of the anonymous inner block instead + * rendering/RenderTextControlSingleLine.h: allow for an implementation of controlClipRect for <input type="search"> + +2010-04-30 Jon Honeycutt <jhoneycutt@apple.com> + + Caret may fail to blink if a focus handler brings up a modal dialog + https://bugs.webkit.org/show_bug.cgi?id=38372 + + Reviewed by Darin Adler. + + * manual-tests/onfocus-alert-blinking-caret.html: Added. + + * page/EventHandler.cpp: + (WebCore::EventHandler::handleMousePressEvent): + Moved the call to setCaretBlinkingSuspended() from here... + (WebCore::EventHandler::handleMousePressEvent): + ... to here. This makes us suspend caret blinking before dispatching the + mouse down event. If dispatching the mouse down event allows the message + loop to run, we want mouse up events received in that message loop to be + able to resume caret blinking. + (WebCore::EventHandler::lostMouseCapture): + We've lost mouse capture and won't be notified of mouse up events; + resume caret blinking. + + * page/EventHandler.h: + Declare lostMouseCapture(). + +2010-04-30 Dimitri Glazkov <dglazkov@chromium.org> + + Unreviewed, build fix. + + [Chromium] Added a simple IdentifierRep struct and removed dependency on + IdentifierRep.h. + + * bindings/v8/V8NPObject.cpp: Added simple IdentifierRep struct. + +2010-04-30 Dimitri Glazkov <dglazkov@chromium.org> + + Unreviewed, build fix. + + [Chromium] Remove bridge/ from include paths. + + * WebCore.gyp/WebCore.gyp: Removed bridge/ from include path. + +2010-04-30 Abhishek Arya <inferno@chromium.org> + + Reviewed by David Kilzer. + + Convert m_documentUnderMouse, m_dragInitiator to RefPtr. + Eliminated unused m_dragInitiator accessor to prevent dereferencing. + https://bugs.webkit.org/show_bug.cgi?id=37618 + + Test: editing/pasteboard/drag-drop-iframe-refresh-crash.html + + * page/DragController.cpp: + (WebCore::DragController::tryDocumentDrag): + (WebCore::DragController::concludeEditDrag): + * page/DragController.h: + (WebCore::DragController::draggingImageURL): + (WebCore::DragController::documentUnderMouse): + +2010-04-29 James Robinson <jamesr@chromium.org> + + Reviewed by Simon Fraser. + + Calls FrameView::scrollPositionChanged whenever a ScrollView is scrolled + https://bugs.webkit.org/show_bug.cgi?id=38286 + + When a ScrollView's scroll position is changed, we have to call + FrameView::scrollPositionChanged to generate repaint invalidation for + fixed position elements. This ends up getting called indirectly when + the ScrollView has a platformWidget through the port layer + (see WebHTMLView.mm's _frameOrBoundsChanged method for how the mac + port does it) but not when there is no platformWidget. + + This is tested by the fast/repaint/fixed-* tests when run in pixel + mode. + + Test: fast/repaint/fixed-move-after-keyboard-scroll.html + + * page/FrameView.h: + * platform/ScrollView.cpp: + (WebCore::ScrollView::valueChanged): + * platform/ScrollView.h: + (WebCore::ScrollView::scrollPositionChanged): + +2010-04-30 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Use C99 integer types in more places. + + * manual-tests/NPN_Invoke/main.c: + (NPP_New): + (NPP_NewStream): + (NPP_WriteReady): + (NPP_Write): + (NPP_HandleEvent): + (functionPointerForTVector): + * plugins/mac/PluginViewMac.cpp: + (WebCore::PluginView::platformGetValueStatic): + (WebCore::PluginView::handlePostReadFile): + +2010-04-30 Darin Adler <darin@apple.com> + + Reviewed by Oliver Hunt. + + Remove unused scrollRectIntoViewRecursively function + https://bugs.webkit.org/show_bug.cgi?id=38403 + + * page/Chrome.cpp: + (WebCore::Chrome::scrollRectIntoView): Moved comment here that was previously + in the scrollRectIntoViewRecursively function. + + * platform/ScrollView.cpp: Get rid scrollRectIntoViewRecursively. + * platform/ScrollView.h: Ditto. Fix comment that refers to the two functions. + Also correct all uses of the term "method" to use the C++ term "function" and + got rid of double spaces after periods. + +2010-04-30 Anders Carlsson <andersca@apple.com> + + Another Qt build fix. + + * plugins/qt/PluginViewQt.cpp: + (WebCore::PluginView::platformGetValueStatic): + +2010-04-30 Anders Carlsson <andersca@apple.com> + + Add back TRUE, FALSE and NULL macros. They were not meant to be removed! + + * bridge/npapi.h: + +2010-04-30 Anders Carlsson <andersca@apple.com> + + Try to fix the Qt build this time. + + * plugins/qt/PluginPackageQt.cpp: + (WebCore::staticPluginQuirkRequiresGtkToolKit_NPN_GetValue): + (WebCore::PluginPackage::NPVersion): + +2010-04-30 Anders Carlsson <andersca@apple.com> + + Yet another build fix. + + * plugins/gtk/PluginPackageGtk.cpp: + (WebCore::PluginPackage::NPVersion): + +2010-04-30 Anders Carlsson <andersca@apple.com> + + Fix build. + + * bridge/npapi.h: + +2010-04-30 Jian Li <jianli@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Add WebFileSystem interface and hook up with all FileSystem methods. + https://bugs.webkit.org/show_bug.cgi?id=38228 + + * platform/chromium/ChromiumBridge.h: + * platform/chromium/FileSystemChromium.cpp: + (WebCore::openFile): + (WebCore::closeFile): + (WebCore::seekFile): + (WebCore::truncateFile): + (WebCore::readFromFile): + (WebCore::writeToFile): + +2010-04-30 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Final part of + + https://bugs.webkit.org/show_bug.cgi?id=20784 + move npapi.h to C99 integer types + + * bridge/npapi.h: + Remove the old types. + +2010-04-30 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r58569. + http://trac.webkit.org/changeset/58569 + https://bugs.webkit.org/show_bug.cgi?id=38399 + + This broke the GTK bots due to bad GC behavior (Requested by + ericu on #webkit). + + * bindings/js/JSWorkerContextCustom.cpp: + * bindings/v8/custom/V8WorkerContextCustom.cpp: + * storage/Database.idl: + * storage/SQLError.idl: + * storage/SQLResultSet.idl: + * storage/SQLResultSetRowList.idl: + * storage/SQLTransaction.idl: + * workers/WorkerContext.cpp: + (WebCore::WorkerContext::openDatabase): + * workers/WorkerContext.h: + (WebCore::WorkerContext::databaseExceededQuota): + * workers/WorkerContext.idl: + +2010-04-30 Anders Carlsson <andersca@apple.com> + + Fix GTK+ build. + + * plugins/gtk/PluginViewGtk.cpp: + (WebCore::PluginView::handlePostReadFile): + (WebCore::PluginView::platformGetValueStatic): + +2010-04-30 Anders Carlsson <andersca@apple.com> + + Fix Qt build. + + * plugins/qt/PluginViewQt.cpp: + (WebCore::PluginView::handlePostReadFile): + (WebCore::PluginView::platformGetValue): + +2010-04-30 Anders Carlsson <andersca@apple.com> + + Reviewed by Timothy Hatcher. + + Next step towards fixing + + https://bugs.webkit.org/show_bug.cgi?id=20784 + move npapi.h to C99 integer types + + Use the C99 types everywhere. The "old" types are still around but will be removed + in a subsequent commit. + + * bridge/npapi.h: + (_NPCocoaEvent::): + * plugins/PluginPackage.h: + * plugins/PluginStream.cpp: + (WebCore::PluginStream::deliverData): + * plugins/PluginStream.h: + * plugins/PluginView.cpp: + (WebCore::PluginView::postURLNotify): + (WebCore::PluginView::postURL): + (WebCore::PluginView::write): + (WebCore::PluginView::handlePost): + * plugins/PluginView.h: + * plugins/PluginViewNone.cpp: + (WebCore::PluginView::handlePostReadFile): + * plugins/npapi.cpp: + (NPN_MemAlloc): + (NPN_MemFlush): + (NPN_PostURLNotify): + (NPN_PostURL): + (NPN_Write): + * plugins/npfunctions.h: + * plugins/win/PluginPackageWin.cpp: + (WebCore::PluginPackage::NPVersion): + * plugins/win/PluginViewWin.cpp: + (WebCore::PluginView::handlePostReadFile): + +2010-04-30 Peter Kasting <pkasting@google.com> + + Reviewed by David Levin. + + Make all image decoders set the "failed" bit if an image could not be + completely decoded, but no more data is coming. The ICO and BMP + decoders already did this. + https://bugs.webkit.org/show_bug.cgi?id=35411 + + "Failed" does not cause the image to not be displayed, it simply causes + us to not bother to try to decode again if future requests are made, and + for some decoders, lets the decoder clean up some of its temporary + objects. + + No layout tests because this does not change the visible output of decoding in any way. + + * platform/image-decoders/gif/GIFImageDecoder.cpp: + (WebCore::GIFImageDecoder::frameComplete): Return whether the frame could be marked as complete. + (WebCore::GIFImageDecoder::decode): Fail if read() needs more data (and thus returns false) and no more is coming. + * platform/image-decoders/gif/GIFImageDecoder.h: + * platform/image-decoders/gif/GIFImageReader.cpp: + (GIFImageReader::do_lzw): Instead of returning true for buffer underrun and false for failure, return false for both and set the failure flag on failure. + (GIFImageReader::read): Ditto. + * platform/image-decoders/gif/GIFImageReader.h: + * platform/image-decoders/jpeg/JPEGImageDecoder.cpp: + (WebCore::): + (WebCore::JPEGImageReader::decode): See do_lzw() comment above. + (WebCore::JPEGImageDecoder::decode): Fail if decode() needs more data (and thus returns false) and no more is coming. + * platform/image-decoders/jpeg/JPEGImageDecoder.h: + * platform/image-decoders/png/PNGImageDecoder.cpp: + (WebCore::PNGImageReader::decode): Return true for decode success, false for buffer underrun or decode failure, and set the failure flag on decode failure. + (WebCore::PNGImageDecoder::decode): See JPEGImageDecoder::decode() comment above. + * platform/image-decoders/png/PNGImageDecoder.h: + +2010-04-30 Brady Eidson <beidson@apple.com> + + Reviewed by Eric Carlson. + + <rdar://problem/7902467> - Audio plays upon loading of npr.org but shouldn't + + No new tests. (Currently no way to test such site specific hack behavior) + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::HTMLMediaElement): + (WebCore::HTMLMediaElement::asyncEventTimerFired): If the event to be dispatched is the canplay + event, wrap the dispatch with m_dispatchingCanPlayEvent set. + (WebCore::HTMLMediaElement::play): If m_dispatchingCanPlayEvent is true and the site is npr.org, + don't perform the play(). + * html/HTMLMediaElement.h: Add m_dispatchingCanPlayEvent member. + +2010-04-30 Dan Bernstein <mitz@apple.com> + + Reviewed by Adele Peterson. + + Part of <rdar://problem/6649734> Text repainting does not account for glyphs which draw outside the typographic bounds of the font + https://bugs.webkit.org/show_bug.cgi?id=6274 + + Account for glyph overflow of characters in the range U+1E00..U+2000, but without sending them + through the complex text code path. Instead, introduce a variant of the fast path that tracks + glyph overflow. + + * platform/graphics/Font.cpp: + (WebCore::Font::drawText): Use codePath(). + (WebCore::Font::floatWidth): Use codePath(). Pass the GlyphOverflow pointer through to + floatWidthForSimpleText() if the code path is SimpleWithGlyphOverflow. + (WebCore::Font::selectionRectForText): Use codePath(). + (WebCore::Font::offsetForPosition): Ditto. + * platform/graphics/Font.h: Replaced canUseGlyphCache() with codePath(). Added a GlyphOverflow + parameter to floatWidthForSimpleText(). + * platform/graphics/FontFastPath.cpp: + Removed ROMAN_AND_GREEK_DIACRITICS_CAN_USE_GLYPH_CACHE. + (WebCore::Font::codePath): Renamed canUseGlyphCache() to this. Where it used to return false, + it now returns Complex. Where it used to return true, it now returns Simple, except for + the range U+1E00..U+2000, where it now returns SimpleWithGlyphOverflow. + (WebCore::Font::floatWidthForSimpleText): Added a GlyphOverflow parameter. If not 0, have the + width iterator account for glyph bounds, then update the GlyphOverflow accordingly. + * platform/graphics/WidthIterator.cpp: + (WebCore::WidthIterator::WidthIterator): Added boolean parameter telling the width iterator + whether to account for glyph bounds. Initialize m_accountForGlyphBounds accordingly. Initialize + m_maxGlyphBoundingBoxY, m_minGlyphBoundingBoxY, m_firstGlyphOverflow and m_lastGlyphOverflow. + (WebCore::WidthIterator::advance): If accounting for glyph bounds, update the above member variables. + * platform/graphics/WidthIterator.h: + (WebCore::WidthIterator::maxGlyphBoundingBoxY): Added this accessor. + (WebCore::WidthIterator::minGlyphBoundingBoxY): Ditto. + (WebCore::WidthIterator::firstGlyphOverflow): Ditto. + (WebCore::WidthIterator::lastGlyphOverflow): Ditto. + +2010-04-30 Chris Marrin <cmarrin@apple.com> + + Reviewed by Simon Fraser. + + Reversed the order of the CSSMatrix.multiply method + https://bugs.webkit.org/show_bug.cgi?id=38337 + + Test: transforms/svg-vs-css.xhtml + + * css/WebKitCSSMatrix.cpp: + (WebCore::WebKitCSSMatrix::multiply): + * platform/graphics/transforms/TransformationMatrix.cpp: + +2010-04-30 Kevin Ollivier <kevino@theolliviers.com> + + Unreviewed. Attempt to fix the Chromium Mac build after the last commit. + + * WebCore.gypi: + +2010-04-30 Kevin Ollivier <kevino@theolliviers.com> + + Reviewed by Dan Bernstein. + + Allow other ports to compile ATSUI and CoreText functions in SimpleFontData for Mac. + https://bugs.webkit.org/show_bug.cgi?id=38334 + + * WebCore.xcodeproj/project.pbxproj: + * platform/graphics/mac/SimpleFontDataATSUI.mm: Copied from WebCore/platform/graphics/mac/SimpleFontDataMac.mm. + * platform/graphics/mac/SimpleFontDataCoreText.cpp: Copied from WebCore/platform/graphics/mac/SimpleFontDataMac.mm. + * platform/graphics/mac/SimpleFontDataMac.mm: + +2010-04-30 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Simon Fraser. + + SHOULD NEVER BE REACHED assertion loading forbes.com + https://bugs.webkit.org/show_bug.cgi?id=38272 + + Ignore page media related pseudo classes. + + Test: printing/pseudo-class-outside-page.html + + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): + +2010-04-30 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Unreviewed, build fix. + + Fix compiler warning "suggest parentheses around" + + No new tests as there is no new functionality. + + * svg/SVGAnimateElement.cpp: + (WebCore::SVGAnimateElement::calculateFromAndToValues): + +2010-04-30 Kent Tamura <tkent@chromium.org> + + Unreviewed. Regression fix. + + Revert a part of r58564 to be compatible with prior behavior + https://bugs.webkit.org/show_bug.cgi?id=38383 + + * rendering/RenderTextControlSingleLine.cpp: + (WebCore::RenderTextControlSingleLine::forwardEvent): + r58564 made a region check for the cancel button stricter, but it + made some tests failing on Chromium. So, relax the check again. + +2010-04-29 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Darin Fisher. + + Change StorageEvent.uri to StorageEvent.url to match the spec + https://bugs.webkit.org/show_bug.cgi?id=38331 + + As I mentioned in http://www.mail-archive.com/public-webapps@w3.org/msg08495.html + WebKit is the only one who places the document's URL in a 'uri' property + rather than a 'url' property. Even though we've shipped several versions of + browsers with the old name, we probably should change this to comply with the + spec. + + This stuff is covered by existing tests. + + * storage/StorageEvent.cpp: + (WebCore::StorageEvent::create): + (WebCore::StorageEvent::StorageEvent): + (WebCore::StorageEvent::initStorageEvent): + * storage/StorageEvent.h: + (WebCore::StorageEvent::url): + * storage/StorageEvent.idl: + +2010-04-30 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Dirk Schulze. + + REGRESSION: RenderPath does not handle repaints correctly anymore if bounds changed + https://bugs.webkit.org/show_bug.cgi?id=38385 + + The last SVG performance patch broke repainting if bounds of a RenderPath get smaller. + It would only repaint the smaller part, not the original larger bounds. + + Remove all lazy calculation of the repaint rects, instead calculate object/strokeBoundingBox and repaintRectInLocalCoordinates + once in layout - after LayoutRepainter grabbed the initial bounds, before calling repaintAfterLayout(). We can now inline + all these functions, and save a lot of m_path.isEmpty() checks, which are expensive. No need to store a seperated markerBoundingBox(), + combine with strokeBoundingBox() -> save one FloatRect per RenderPath. Move strokeBoundingBox() from SVGRenderBase to RenderObject, + right next to objectBoundingBox() - to save unnecessary toSVGRenderBase() calls. Completly remove this method. + + Overall this is a regression fix, a performance improvement and saves memory. Something for everyone. + + Tests: svg/custom/repaint-stroke-width-changes.svg + + * rendering/RenderObject.cpp: Added strokeBoundingBox() here, to avoid the toSVGRenderBase() dance. + (WebCore::RenderObject::strokeBoundingBox): + * rendering/RenderObject.h: Ditto. + * rendering/RenderPath.cpp: + (WebCore::RenderPath::RenderPath): + (WebCore::RenderPath::layout): Fix regression, do repainting correctly, by recalculating the boundaries, if needed, instead of nulling them. + (WebCore::RenderPath::paint): Cache SVGRenderStyle in local variable, remove no longer valid FIXME. + (WebCore::RenderPath::calculateMarkerBoundsIfNeeded): Return a FloatRect, to avoid having to store the marker bounding box seperated. + (WebCore::RenderPath::styleWillChange): Mark boundaries as dirty. + (WebCore::RenderPath::updateCachedBoundaries): New function to (re-)calculate all cached boundaries, only called from layout(). + * rendering/RenderPath.h: Rename cached rect variables to have more sensible names. + (WebCore::RenderPath::objectBoundingBox): Inlined, just returns the cached value - no more lazy creation. Huge speedup as this is hot code. + (WebCore::RenderPath::strokeBoundingBox): Ditto. + (WebCore::RenderPath::repaintRectInLocalCoordinates): Ditto. + * rendering/RenderSVGBlock.h: Remove toSVGRenderBase() method. + * rendering/RenderSVGImage.h: Ditto. + * rendering/RenderSVGInline.cpp: No need to call toSVGRenderBase() just to get the strokeBoundingBox(). Unifies code to retrieve bounding boxes. + (WebCore::RenderSVGInline::strokeBoundingBox): + * rendering/RenderSVGInline.h: Remove toSVGRenderBase() method. + * rendering/RenderSVGModelObject.h: Ditto. + * rendering/RenderSVGResourceFilter.cpp: No need to call toSVGRenderBase() anymore, just grab the strokeBoundingBox() from the RenderObject. + (WebCore::RenderSVGResourceFilter::applyResource): + * rendering/RenderSVGText.h: Remove toSVGRenderBase() method. + * rendering/SVGRenderSupport.h: Ditto. Remove markerBoundingBox() method, now combined with strokeBoundingBox(). + (WebCore::SVGRenderBase::strokeBoundingBox): + * rendering/SVGRootInlineBox.h: Remove toSVGRenderBase() method. + * rendering/style/SVGRenderStyle.h: Add hasMarkers() helper method, to avoid doing unnecessary work in RenderPath. + (WebCore::SVGRenderStyle::hasMarkers): + +2010-04-30 Eric Uhrhane <ericu@chromium.org> + + Reviewed by Dmitry Titov. + + Add bindings for async DB API in Workers. + https://bugs.webkit.org/show_bug.cgi?id=34992 + + Tests: storage/change-version-handle-reuse-worker.html + storage/execute-sql-args-worker.html + + * bindings/js/JSWorkerContextCustom.cpp: Add openDatabase binding. + (WebCore::JSWorkerContext::openDatabase): + + * bindings/v8/custom/V8WorkerContextCustom.cpp: Add openDatabase stub; Chromium will need work both in V8 and in the browser process before we can turn this on there. + (WebCore::V8WorkerContext::openDatabaseCallback): + + Add NoStaticTables flags to all objects now shared with workers. + * storage/Database.idl: + * storage/SQLError.idl: + * storage/SQLResultSet.idl: + * storage/SQLResultSetRowList.idl: + * storage/SQLTransaction.idl: + + * workers/WorkerContext.h: Add databaseExceededQuota. + * workers/WorkerContext.cpp: + (WebCore::WorkerContext::databaseExceededQuota): Add stub implementation for testing; you just get 5MB for now. + (WebCore::WorkerContext::openDatabase): Remove invalid assertion. + + Add the IDL for the call to openDatabase. + * workers/WorkerContext.idl: + +2010-04-30 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Darin Adler. + + Unnecessary PrintContext::end() calls + https://bugs.webkit.org/show_bug.cgi?id=38247 + + Refactoring only, so no new tests. + + * page/PrintContext.cpp: + (WebCore::PrintContext::pageNumberForElement): + (WebCore::PrintContext::numberOfPages): + +2010-04-30 Kent Tamura <tkent@chromium.org> + + Reviewed by Adele Peterson. + + Implement interactive behavior of spin buttons. + https://bugs.webkit.org/show_bug.cgi?id=35686 + + Introduce SpinButtonElement. It is a shadow element class for + spin buttons. If the upper side of the element is clicked, calls + HTMLInputElement::stepUpFromRenderer(1). If the lower button is + clicked, calls HTMLInputElement::stepUpFromRenderer(-1). + + SpinButtonElement tracks the mouse pointer position, and + RenderTheme sets ControlStates::SpinUpState if the pointer is on + the upper side. + + Test: platform/mac/fast/forms/input-number-click.html + + * dom/Element.h: + (WebCore::Element::isSpinButtonElement): + * editing/VisibleSelection.cpp: + (WebCore::VisibleSelection::adjustSelectionToAvoidCrossingEditingBoundaries): + Remove an assertion. lastEditablePositionBeforePositionInRoot() can + return null in a case that m_end is at a shadow element (a spin button) + and baseRoot is another shadow element (inner text block) in the same + node (an INPUT element). + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::stepUpFromRenderer): + * html/HTMLInputElement.h: + (WebCore::HTMLInputElement::hasSpinButton): + Add types supporting step attribute except RANGE. + * rendering/RenderTextControlSingleLine.cpp: + (WebCore::RenderTextControlSingleLine::nodeAtPoint): + (WebCore::RenderTextControlSingleLine::forwardEvent): + (WebCore::RenderTextControlSingleLine::preferredContentWidth): + (WebCore::RenderTextControlSingleLine::createSubtreeIfNeeded): + * rendering/RenderTextControlSingleLine.h: + * rendering/RenderTheme.cpp: + (WebCore::RenderTheme::controlStatesForRenderer): + (WebCore::RenderTheme::isSpinUpButtonPartPressed): + (WebCore::RenderTheme::isSpinUpButtonPartHovered): + * rendering/RenderTheme.h: + * rendering/TextControlInnerElements.cpp: + (WebCore::SpinButtonElement::SpinButtonElement): + (WebCore::SpinButtonElement::defaultEventHandler): + * rendering/TextControlInnerElements.h: + (WebCore::SpinButtonElement::isSpinButtonElement): + (WebCore::SpinButtonElement::isEnabledFormControl): + (WebCore::SpinButtonElement::onUpButton): + +2010-04-30 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Enable DOMWindow constructor for HTMLProgressElement + https://bugs.webkit.org/show_bug.cgi?id=38333 + + Add ENABLE_PROGRESS_TAG to FEATURES_DEFINES_JAVASCRIPT. + + * WebCore.pri: + +2010-04-30 Kent Tamura <tkent@chromium.org> + + Reviewed by Adele Peterson. + + Mac implementation of outer-spin-button appearance, and anonymous + element generation for <input type=number>. + https://bugs.webkit.org/show_bug.cgi?id=32813 + + The implementation uses NSStepperCell. Like the other Mac + controls, it has only three candidates for sizes. + + The editable block of an input element is shrunk, and the + anonymous block for a spin button is put on the right of the + editable block. + + Tests: platform/mac/fast/forms/input-appearance-spinbutton-size.html + platform/mac/fast/forms/input-appearance-spinbutton.html + + * dom/Element.cpp: + (WebCore::Element::pseudoStyleCacheIsInvalid): + * dom/InputElement.h: + (WebCore::InputElement::hasSpinButton): + * html/HTMLInputElement.h: + (WebCore::HTMLInputElement::hasSpinButton): Return true for NUMBER type. + * platform/mac/ThemeMac.mm: + (WebCore::sizeFromNSControlSize): Split the main part of sizeFromFont() + to this in order to use stepperControlSizeForFont() instead of + controlSizeForFont(). + (WebCore::sizeFromFont): Just calls sizeFromNSControlSize() with + sizeFromFont(). No behavior changes. + (WebCore::stepperSizes): Returns sizes for mini, small, and regular. + (WebCore::stepperControlSizeForFont): + Dedicated version of controlSizeForFont(). + (WebCore::stepper): Returns NSStepperCell object with specified settings. + (WebCore::paintStepper): + (WebCore::ThemeMac::controlSize): Support for OuterSpinButton. + (WebCore::ThemeMac::minimumControlSize): ditto. + (WebCore::ThemeMac::inflateControlPaintRect): ditto. + (WebCore::ThemeMac::paint): ditto. + * rendering/RenderBox.cpp: + (WebCore::RenderBox::paintBoxDecorations): + Move the content to paintBoxDecorationsWithSize(). + (WebCore::RenderBox::paintBoxDecorationsWithSize): + * rendering/RenderBox.h: Declare paintBoxDecorationsWithSize(). + * rendering/RenderTextControlSingleLine.cpp: + (WebCore::RenderTextControlSingleLine::~RenderTextControlSingleLine): + (WebCore::RenderTextControlSingleLine::paintBoxDecorations): + Call paintBoxDecorationsWithSize() with smaller width by decorationWidthRight(). + (WebCore::RenderTextControlSingleLine::addFocusRingRects): + Add a rectangle of which width is smaller by decorationWidthRight(). + (WebCore::RenderTextControlSingleLine::layout): + Adjust m_outerSpinButton position. + (WebCore::RenderTextControlSingleLine::styleDidChange): + (WebCore::RenderTextControlSingleLine::textBlockWidth): + (WebCore::RenderTextControlSingleLine::decorationWidthRight): + (WebCore::RenderTextControlSingleLine::preferredDecorationWidthRight): + (WebCore::RenderTextControlSingleLine::createSubtreeIfNeeded): + Creates an element for m_outerSpinButton if it is needed. + (WebCore::RenderTextControlSingleLine::createInnerTextStyle): + (WebCore::RenderTextControlSingleLine::createOuterSpinButtonStyle): + * rendering/RenderTextControlSingleLine.h: Declare new methods and m_outerSpinButton. + * rendering/RenderThemeMac.mm: + (WebCore::RenderThemeMac::adjustRepaintRect): Support for OuterSpinButton. + +2010-04-29 Adam Barth <abarth@webkit.org> + + Unreviewed. Update JSC CodeGenerator baseline. Not sure how I missed + this one earlier. + + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::jsTestObjPrototypeFunctionSerializedValue): + +2010-04-29 Justin Garcia <justin.garcia@apple.com> + + Reviewed by Adele Peterson. + + Need to updateLayout after typing commands too + https://bugs.webkit.org/show_bug.cgi?id=38352 + + Replaced !m_parent checks in EditCommand.cpp by the more descriptive isTopLevelCommand(). + Move the post editing operation updateLayout() call to {un,re}appliedEditing so that text insertions, + which don't go through EditCommand::{un,re}apply() can benefit from it too. No test case possible + since most platforms have a layout performed as a side effect of post operation selection code. + + * editing/EditCommand.cpp: + (WebCore::EditCommand::apply): + (WebCore::EditCommand::unapply): + (WebCore::EditCommand::reapply): + * editing/EditCommand.h: + (WebCore::EditCommand::isTopLevelCommand): + * editing/Editor.cpp: + (WebCore::Editor::appliedEditing): + (WebCore::Editor::unappliedEditing): + (WebCore::Editor::reappliedEditing): + +2010-04-29 Dan Bernstein <mitz@apple.com> + + Reviewed by Simon Fraser. + + <rdar://problem/7918086> REGRESSION (r57820): Controller is not displayed in window when opening a MP3 file in browser window + https://bugs.webkit.org/show_bug.cgi?id=38350 + + Tests: media/audio-only-video-intrinsic-size.html + media/media-document-audio-size.html + + * rendering/RenderVideo.cpp: + (WebCore::RenderVideo::RenderVideo): Until metadata is available, ignore the natural size + reported by the player. + (WebCore::RenderVideo::videoSizeChanged): Respect a natural size of zero if reported by the + player, except in standalone media documents. + +2010-04-29 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + First part of + https://bugs.webkit.org/show_bug.cgi?id=20784 + move npapi.h to C99 integer types. + + Add nptypes.h to the build. + + * WebCore.xcodeproj/project.pbxproj: + * bridge/npapi.h: + * bridge/npruntime.h: + * bridge/nptypes.h: Added. + +2010-04-29 Xan Lopez <xlopez@igalia.com> + + Rubber-stamped by Adam Barth. + + Update GObject bindings test results. We are actually moving + backwards here, but we'll update them again when we figure out + what broke. + + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + (webkit_dom_test_obj_set_property): + (webkit_dom_test_obj_get_property): + +2010-04-29 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=38277 + MiniBrowser: -[WebCoreFlippedView currentEditor]: unrecognized selector + + * platform/mac/ThemeMac.mm: + (-[WebCoreFlippedView currentEditor]): Added currentEditor nil implementation. + +2010-04-29 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + CodeGeneratorJS.pm should be consistent about castedThis versus castedThisObj + https://bugs.webkit.org/show_bug.cgi?id=38338 + + Currently CodeGeneratorJS.pm uses castThis for methods and + castedThisObj for attributes. This inconsistency makes it difficult to + factor common code genereration code into methods shared by both kinds + of bindings. This match aligns the names so that a future patch (e.g., + in https://bugs.webkit.org/show_bug.cgi?id=38313) can reduce copy/paste + code. + + * bindings/scripts/CodeGeneratorJS.pm: + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::setJSTestObjIntAttr): + (WebCore::setJSTestObjLongLongAttr): + (WebCore::setJSTestObjUnsignedLongLongAttr): + (WebCore::setJSTestObjStringAttr): + (WebCore::setJSTestObjTestObjAttr): + (WebCore::setJSTestObjAttrWithException): + (WebCore::setJSTestObjAttrWithSetterException): + (WebCore::setJSTestObjAttrWithGetterException): + (WebCore::jsTestObjPrototypeFunctionVoidMethod): + (WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs): + (WebCore::jsTestObjPrototypeFunctionIntMethod): + (WebCore::jsTestObjPrototypeFunctionIntMethodWithArgs): + (WebCore::jsTestObjPrototypeFunctionObjMethod): + (WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs): + (WebCore::jsTestObjPrototypeFunctionMethodWithException): + (WebCore::jsTestObjPrototypeFunctionCustomMethod): + (WebCore::jsTestObjPrototypeFunctionCustomMethodWithArgs): + (WebCore::jsTestObjPrototypeFunctionCustomArgsAndException): + (WebCore::jsTestObjPrototypeFunctionAddEventListener): + (WebCore::jsTestObjPrototypeFunctionRemoveEventListener): + (WebCore::jsTestObjPrototypeFunctionWithDynamicFrame): + (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndArg): + (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg): + (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture): + (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD): + (WebCore::jsTestObjPrototypeFunctionWithScriptStateVoid): + (WebCore::jsTestObjPrototypeFunctionWithScriptStateObj): + (WebCore::jsTestObjPrototypeFunctionWithScriptStateVoidException): + (WebCore::jsTestObjPrototypeFunctionWithScriptStateObjException): + (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArg): + (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg): + (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs): + +2010-04-29 Gustavo Noronha Silva <gustavo.noronhaollabora.co.uk> + + Reviewed by Xan Lopez. + + [GTK] pointerCursor should use the default cursor set for the window, not GDK_LEFT_PTR + https://bugs.webkit.org/show_bug.cgi?id=36963 + + Use the default cursor instead of hard-coding left pointer. + + * platform/gtk/CursorGtk.cpp: + (WebCore::Cursor::Cursor): + (WebCore::pointerCursor): + +2010-04-29 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Yury Semikhatsky. + + WebInspector: If Timeline panel is in recording mode and is not visible and has received + new events then these events do not appear in the panel when the panel becomes visible. + Timeline popup may appear in the upper left window corner when you switch to another panel. + https://bugs.webkit.org/show_bug.cgi?id=38322 + + * inspector/front-end/Popover.js: + (WebInspector.PopoverHelper.prototype._mouseMove.doHide): + (WebInspector.PopoverHelper.prototype._mouseMove): + (WebInspector.PopoverHelper.prototype.hidePopup): + (WebInspector.PopoverHelper.prototype._hidePopup): + * inspector/front-end/TimelinePanel.js: + (WebInspector.TimelinePanel.prototype.show): + (WebInspector.TimelinePanel.prototype._scheduleRefresh): + (WebInspector.TimelinePanel.prototype._refresh): + +2010-04-29 Anton Muhin <antonm@chromium.org> + + Reviewed by Darin Adler. + + Let's cache nodelists instead of DynamicNodeList::Caches + https://bugs.webkit.org/show_bug.cgi?id=33696 + + Test: fast/dom/Element/node-list-identity.html + + * bindings/js/JSNodeCustom.cpp: + (WebCore::JSNode::markChildren): Mark all cached node lists as well + * dom/ClassNodeList.cpp: + (WebCore::ClassNodeList::ClassNodeList): Don't need DynamicNodeList::Caches argument any more + (WebCore::ClassNodeList::~ClassNodeList): Remove from the cache + * dom/ClassNodeList.h: Added a field with original class names to be used as a key for removal from the cache + (WebCore::ClassNodeList::create): Don't need DynamicNodeList::Caches argument any more + * dom/NameNodeList.cpp: + (WebCore::NameNodeList::NameNodeList): Don't need DynamicNodeList::Caches argument any more + (WebCore::NameNodeList::~NameNodeList): Remove from the cache + * dom/NameNodeList.h: + (WebCore::NameNodeList::create): Don't need DynamicNodeList::Caches argument any more + * dom/Node.cpp: + (WebCore::Node::removeCachedClassNodeList): Remove ClassNodeList from the cache + (WebCore::Node::removeCachedNameNodeList): Remove NameNodeList from the cache + (WebCore::Node::removeCachedTagNodeList): Remove TagNodeList from the cache + (WebCore::Node::getElementsByTagNameNS): Switch to caching node lists themselves, not the data + (WebCore::Node::getElementsByName): Switch to caching node lists themselves, not the data + (WebCore::Node::getElementsByClassName): Switch to caching node lists themselves, not the data + (WebCore::NodeListsNodeData::invalidateCaches): Switch to caching node lists themselves, not the data + (WebCore::NodeListsNodeData::invalidateCachesThatDependOnAttributes): Switch to caching node lists themselves, not the data + (WebCore::NodeListsNodeData::isEmpty): Switch to caching node lists themselves, not the data + (WebCore::markNodeLists): Helper to mark all the node lists in the cache + (WebCore::Node::markCachedNodeListsSlow): Mark all the cached node lists if any could be present + * dom/Node.h: + (WebCore::Node::markCachedNodeLists): Fast-path marking of cached node lists---bails out if there is no rare data + * dom/NodeRareData.h: Changed type of caches to hold raw pointers to node lists, not RefPtr's to data + * dom/TagNodeList.cpp: + (WebCore::TagNodeList::TagNodeList): Don't need DynamicNodeList::Caches argument any more + (WebCore::TagNodeList::~TagNodeList): Remove from the cache + * dom/TagNodeList.h: + (WebCore::TagNodeList::create): Don't need DynamicNodeList::Caches argument any more + +2010-04-29 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Yury Semikhatsky. + + [Chromium] Update ScriptProfileNode to retrieve execution time in milliseconds. + + https://bugs.webkit.org/show_bug.cgi?id=38330 + + * bindings/v8/ScriptProfileNode.cpp: + (WebCore::ScriptProfileNode::totalTime): + (WebCore::ScriptProfileNode::selfTime): + +2010-04-28 Dimitri Glazkov <dglazkov@chromium.org> + + Reviewed by Darin Adler. + + A form without a submit button unexpectedly performs its action when Return is pressed + https://bugs.webkit.org/show_bug.cgi?id=9756 + + Implemented implicit form submission algorithm as defined in HTML5 spec: + http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#implicit-submission, + falling back to match IE's behavior in the edge cases. + + The underlying rules are: + + * If the form has no enabled submit buttons, submit if Enter/Return is pressed on the only single-line text field. + + * Otherwise, submit form using first enabled submit button if Enter/Return is pressed on a field + that's not a textarea or a select. + + Test: fast/forms/implicit-submission.html + + * dom/SelectElement.cpp: + (WebCore::SelectElement::menuListDefaultEventHandler): Ripped out implicit submission for select elements. + (WebCore::SelectElement::listBoxDefaultEventHandler): Ditto. + (WebCore::SelectElement::defaultEventHandler): Ditto. + * dom/SelectElement.h: Ditto. + (WebCore::HTMLFormElement::submitImplicitly): Renamed submitClick to submitImplicitly to better match HTML5 spec + language, changed the logic to match the rules above. + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::defaultEventHandler): Reamed clickDefaultButton to implicitSubmission to better match + HTML5 spec language, made radio element to trigger implicit submission. + * html/HTMLSelectElement.cpp: + (WebCore::HTMLSelectElement::defaultEventHandler): Removed passing of form() as parameter, because it's no longer + necessary. + +2010-04-29 Paweł Hajdan, Jr. <phajdan.jr@chromium.org> + + Reviewed by Jeremy Orlow. + + Fix building with libpng-1.4. + https://bugs.webkit.org/show_bug.cgi?id=33287 + + No new tests (no behavior change). + + Original patch by John Bowler <jbowler@acm.org> + + * platform/image-encoders/skia/PNGImageEncoder.cpp: + (WebCore::PNGImageEncoder::encode): + +2010-04-29 Adam Langley <agl@chromium.org> + + Reviewed by David Levin. + + This patch adds support for WOFF in Chromium. Since Chromium + already transcodes all OpenType files for security reasons we + are adding WOFF support into the transcoder. + + https://bugs.webkit.org/show_bug.cgi?id=38217 + + * css/CSSFontFaceSrcValue.cpp: + (WebCore::CSSFontFaceSrcValue::isSupportedFormat): + Recognise "woff" as a font-face format value (guarded by + ENABLE(OPENTYPE_SANITIZER) at this point) + * platform/graphics/opentype/OpenTypeSanitizer.cpp: + (WebCore::OpenTypeSanitizer::sanitize): + Change so that the transcoded font can be larger than the original. + (WOFF files are compressed, so the transcoded TTF is typically + larger.) + +2010-04-29 Alex Milowski <alex@milowski.com> + + Reviewed by Kenneth Rohde Christiansen. + + Updates to the Qt build to enable building MathML support. + + * WebCore.pri: + * WebCore.pro: + +2010-04-29 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + [GTK] GObject DOM bindings + https://bugs.webkit.org/show_bug.cgi?id=33590 + + Do not generate unneeded boilerplate in {get,set}_property methods + when there are no properties to generate code for. This gets rid + of lots of compiler warnings. + + * bindings/scripts/CodeGeneratorGObject.pm: + +2010-04-29 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Speed up text layouting + https://bugs.webkit.org/show_bug.cgi?id=31719 + + Use QFontMetrics::width() for the text width calculation instead + of QTextLayout. This avoids expensive bearing calculations and the + line breaking code. + + * platform/graphics/qt/FontQt.cpp: + (WebCore::Font::floatWidthForComplexText): + +2010-04-29 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Simon Hausmann. + + [WINCE] Export g_stackBase with JS_EXPORTDATA + https://bugs.webkit.org/show_bug.cgi?id=37437 + + Declare g_stackBase with JS_EXPORTDATA as it is imported from JavaScriptCore. + + * platform/wince/SharedTimerWince.cpp: + +2010-04-29 Adam Barth <abarth@webkit.org> + + Reviewed by Maciej Stachowiak. + + Remove custom bindings for PopStateEvent.initPopStateEvent + https://bugs.webkit.org/show_bug.cgi?id=38311 + + Our code generation of SerializedScriptValue was slightly buggy, but + it's easy to fix. Notice that the conversion to an atomic string is + handled by the C++ type system and doesn't require logic in the code + generator. + + * bindings/js/JSPopStateEventCustom.cpp: + * bindings/scripts/CodeGeneratorJS.pm: + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + (webkit_dom_test_obj_serialized_value): + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::): + (WebCore::jsTestObjPrototypeFunctionSerializedValue): + * bindings/scripts/test/JS/JSTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.mm: + (-[DOMTestObj serializedValue:]): + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjInternal::serializedValueCallback): + (WebCore::ConfigureV8TestObjTemplate): + * bindings/v8/custom/V8PopStateEventCustom.cpp: + * dom/PopStateEvent.idl: + +2010-04-29 Kent Tamura <tkent@chromium.org> + + Reviewed by Darin Adler. + + Fix a bug that selection drag-and-drop doesn't work for input/textarea. + https://bugs.webkit.org/show_bug.cgi?id=38175 + + The code supposed the selected region was in the destination text + field. It is not true in a case of drag-and-drop. + + Test: editing/pasteboard/drag-drop-input-textarea.html + + * dom/InputElement.cpp: + (WebCore::InputElement::handleBeforeTextInsertedEvent): + * html/HTMLTextAreaElement.cpp: + (WebCore::HTMLTextAreaElement::handleBeforeTextInsertedEvent): + +2010-04-29 Adam Barth <abarth@webkit.org> + + Reviewed by Maciej Stachowiak. + + Remove custom bindings for NodeFilter.acceptNode + https://bugs.webkit.org/show_bug.cgi?id=38309 + + This "custom" code was just an instance of the CallWith=ScriptState + pattern. Also, it looks like V8 just had a garbage implemenation that + did nothing. + + * WebCore.gypi: + * bindings/js/JSNodeFilterCustom.cpp: + * bindings/v8/custom/V8NodeFilterCustom.cpp: Removed. + * dom/NodeFilter.idl: + +2010-04-29 Noam Rosenthal <noam.rosenthal@nokia.com> + + Reviewed by Laszlo Gombos. + + [Qt] QtWebkit doesn't link with 3D canvas + https://bugs.webkit.org/show_bug.cgi?id=38299 + + Added implementation for GraphicsContext3D::isGLES2Compliant, which returns the correct value based on a Qt #define. + + No new tests: build fix + + * platform/graphics/qt/GraphicsContext3DQt.cpp: + (WebCore::GraphicsContext3D::isGLES2Compliant): + +2010-04-29 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] REGRESSION(r57638): tst_qwebframe::objectDeleted() fails + https://bugs.webkit.org/show_bug.cgi?id=38316 + + Accessing properties of a deleted objects doesn't throw an exception + anymore. + + Continue to expose the QObject class wrapper for objects that + previously existed but don't exist anymore. QtClass is safe to + use with a deleted QObject. + + * bridge/qt/qt_instance.cpp: + (JSC::Bindings::QtInstance::getClass): Return null only if m_class + doesn't exist yet and there's no m_object. + +2010-04-29 Noam Rosenthal <noam.rosenthal@nokia.com> + + Reviewed by Simon Hausmann. + + Reverse animations don't work in some use cases + https://bugs.webkit.org/show_bug.cgi?id=38075 + + This was due to a code path special-casing reverse animations, that became obselete when we aligned our animation code + with the CA implementation. That special case code path is now a bug - and this patch removes it. + + http://staff.washington.edu/fmf/2009/03/25/iphone-3d-css-transformations/ now runs the reverse + animation correctly. + + * platform/graphics/qt/GraphicsLayerQt.cpp: + (WebCore::TransformAnimationQt::applyFrame): + +2010-04-29 Jan Hanssen <jhanssen@codeaurora.org> + + Reviewed by Adam Barth. + + HTMLOptionElement::ownerSelectElement() needs to consider keygen elements + https://bugs.webkit.org/show_bug.cgi?id=26016 + + Patch written by Grace Kloba <klobag@gmail.com>, test fixed by me. + + Test: fast/dom/HTMLKeygenElement/keygen-option-select.html + + * html/HTMLOptionElement.cpp: + (WebCore::HTMLOptionElement::ownerSelectElement): + Make HTMLOptionElement::ownerSelectElement() consider the keygen element in addition to the current select element. + +2010-04-29 Gustavo Sverzut Barbieri <barbieri@profusion.mobi> + + Reviewed by Eric Seidel. + + Add EFL-specific code to Widget.h and move the empty + frameRectsChanged() definition to Widget.cpp, since the EFL port + needs to override that. + http://webkit.org/b/36317 + + No new tests required. + + * WebCore.base.exp: + * platform/Widget.cpp: + (WebCore::Widget::frameRectsChanged): + * platform/Widget.h: + +2010-04-29 Jarkko Sakkinen <jarkko.j.sakkinen@gmail.com> + + Reviewed by Simon Hausmann. + + [Qt] GraphicsContext3DQt.cpp does not implement isGLES2Compliant() + https://bugs.webkit.org/show_bug.cgi?id=38216 + + * platform/graphics/qt/GraphicsContext3DQt.cpp: + (WebCore::GraphicsContext3D::isGLES2Compliant): + +2010-04-29 Zhenyao Mo <zmo@google.com> + + Reviewed by Dimitri Glazkov. + + Remove the unnecessary texImage2D function with Image as input in GraphicsContext3D + https://bugs.webkit.org/show_bug.cgi?id=38235 + + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::WebGLRenderingContext::texImage2D): Add extractImageData; add a common entry point for texImage2D with image input. + (WebCore::WebGLRenderingContext::texImage2DBase): Add this function as the common entry point for texImage2D. + (WebCore::WebGLRenderingContext::texSubImage2D): Add extractImageData; add a common entry point for texSubImage2D with image input. + (WebCore::WebGLRenderingContext::texSubImage2DBase): Add this function as the common entry point for texSubImage2D. + * html/canvas/WebGLRenderingContext.h: Add tex*Image{Base/Image} function declaration. + * platform/graphics/GraphicsContext3D.h: Remove tex*Image declaration with Image input. + * platform/graphics/mac/GraphicsContext3DMac.cpp: Remove tex*Image implementation with Image input. + (WebCore::GraphicsContext3D::texImage2D): + (WebCore::GraphicsContext3D::texSubImage2D): + +2010-04-29 Noam Rosenthal <noam.rosenthal@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] GraphicsLayer: flicker when starting an animation before the previous one ended. + https://bugs.webkit.org/show_bug.cgi?id=38076 + + This was due to the cude in the removeAnimations functions, which called deleteLater() without stopping the + animation synchronously. The delay between the call to that function and the actual call to the animation's destructor + is when the flicker occured. We fix this by calling stop() synchronously, and making sure that the value is reverted + upon stop (updateState) and not upon the object's destruction. + + http://staff.washington.edu/fmf/2009/03/25/iphone-3d-css-transformations/ now doesn't flicker when + the animation is toggled frequently. + + * platform/graphics/qt/GraphicsLayerQt.cpp: + (WebCore::TransformAnimationQt::~TransformAnimationQt): + (WebCore::TransformAnimationQt::applyFrame): + (WebCore::TransformAnimationQt::updateState): + (WebCore::OpacityAnimationQt::~OpacityAnimationQt): + (WebCore::OpacityAnimationQt::updateState): + (WebCore::GraphicsLayerQt::removeAnimationsForProperty): + (WebCore::GraphicsLayerQt::removeAnimationsForKeyframes): + +2010-04-28 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Simon Fraser. + + Media queries empty values + https://bugs.webkit.org/show_bug.cgi?id=38116 + + Adding isValid() method to MediaQueryExp to make it possible to differentiate + between queries with empty values and queries with invalid values. + + Test: fast/media/media-query-invalid-value.html + + * css/MediaQueryEvaluator.cpp: + (WebCore::MediaQueryEvaluator::eval): + * css/MediaQueryExp.cpp: + (WebCore::MediaQueryExp::MediaQueryExp): + * css/MediaQueryExp.h: + (WebCore::MediaQueryExp::isValid): + +2010-04-28 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: Allow editing script resources when resource tracking is enabled. + + https://bugs.webkit.org/show_bug.cgi?id=38269 + + * inspector/front-end/ScriptView.js: + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype.canEditScripts): + (WebInspector.ScriptsPanel.prototype.editScriptSource): + * inspector/front-end/SourceFrame.js: + (WebInspector.SourceFrame.prototype.get textModel): + * inspector/front-end/SourceView.js: + (WebInspector.SourceView): + (WebInspector.SourceView.prototype._addBreakpoint): + (WebInspector.SourceView.prototype._editLine): + (WebInspector.SourceView.prototype._editLineComplete): + (WebInspector.SourceView.prototype._sourceIDForLine): + +2010-04-25 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Darin Adler. + + Clicking a scrollbar blurs the currently focused element + https://bugs.webkit.org/show_bug.cgi?id=16809 + + WebKit ports that do not use native (platform) widgets for rendering the scrollbars + are currently mismatching a common behaviour of other browser vendors (including + Firefox and Opera): clicking on a frame scrollbar *should not* steal focus from content. + WebKit browsers based ports that do use WebCore for handling scrollbars, like QtWebKit for + instance, can observe the opposite behaviour. + + Patch fixes this behaviour by checking if current MouseDown event targets a frame scrollbar. + If that is the case, it bails out and do not change focus behavior at all. + + It is important to note that the given way this is implemented by this patch, non-frame + scrollbars (e.g. a vertical scrollbar of an overflowed textareas or divs) will keep working + in the same way as it works currently. + + Tests: scrollbars/scrollbar-click-does-not-blur-content.html + scrollbars/scrollbar-iframe-click-does-not-blur-content.html + + * page/EventHandler.cpp: + (WebCore::EventHandler::dispatchMouseEvent): + +2010-04-28 Dan Bernstein <mitz@apple.com> + + Rubber-stamped by Maciej Stachowiak. + + Try to fix test failures seen on the Leopard build bot after r58467 + + * platform/graphics/SimpleFontData.cpp: + (WebCore::SimpleFontData::platformGlyphInit): Initialize m_zeroWidthSpaceGlyph before + calling widthForGlyph(), as the latter uses the former. + +2010-04-28 Martin Robinson <mrobinson@webkit.org> + + Reviewed by Gustavo Noronha. + + [GTK] Enable DOM clipboard and drag-and-drop access + https://bugs.webkit.org/show_bug.cgi?id=30623 + + Make ClipboardGtk a "live" DataTransfer object, able to modify + the clipboard when setData(...) is called. + + * platform/gtk/ClipboardGtk.cpp: + (WebCore::Editor::newGeneralClipboard): Pass the GtkClipboard into the factory method. + (WebCore::ClipboardGtk::ClipboardGtk): Create two separate constructors, one for DnD data and one for clipboard data. + (WebCore::dataObjectTypeFromHTMLClipboardType): Added. + (WebCore::ClipboardGtk::clearData): Clear the member DataObject, optionally write the clipboard. + (WebCore::ClipboardGtk::clearAllData): Ditto. + (WebCore::joinURIList): Added. + (WebCore::ClipboardGtk::getData): Get the data from the clipboard, if possible. + (WebCore::ClipboardGtk::setData): Write data to the DataObject and maybe the clipboard. + (WebCore::ClipboardGtk::types): Read the clipboard/DataObject to find applicable types. + (WebCore::ClipboardGtk::files): Read the clipboard/DataObject to find the files. + (WebCore::ClipboardGtk::writeURL): Write to the DataObject and maybe the clipboard. + (WebCore::ClipboardGtk::writeRange): Ditto. + (WebCore::ClipboardGtk::writePlainText): Ditto. + (WebCore::ClipboardGtk::hasData): Query the clipboard/DataObject. + * platform/gtk/ClipboardGtk.h: + (WebCore::ClipboardGtk::create): Added one factory for pasteboard-backed DataObjects and one for DnD-backed objects. + * platform/gtk/DataObjectGtk.cpp: + (WebCore::replaceNonBreakingSpaceWithSpace): Added this helper function to clean from plain text. + (WebCore::DataObjectGtk::markup): Actually return the range if it's set. + (WebCore::DataObjectGtk::setText): Clean from plain text. + (WebCore::DataObjectGtk::clearText): Added. + (WebCore::DataObjectGtk::clearMarkup): Added. + * platform/gtk/DataObjectGtk.h: + (WebCore::DataObjectGtk::clearURIList): Added. + (WebCore::DataObjectGtk::clearImage): Added. + * platform/gtk/PasteboardHelper.cpp: + (WebCore::PasteboardHelper::initializeTargetList): Added target ID's for URI list and Netscape URL targets. + (WebCore::urisToKURLVector): Added. + (WebCore::PasteboardHelper::getClipboardContents): Added. + (WebCore::PasteboardHelper::fillSelectionData): Added logic for URI lists and Netscape URLs. + (WebCore::PasteboardHelper::targetListForDataObject): Ditto. + * platform/gtk/PasteboardHelper.h: Added default argument to writeClipboardContents and new method. + +2010-04-28 Martin Robinson <mrobinson@webkit.org> + + Reviewed by Gustavo Noronha. + + [GTK] Enable DOM clipboard and drag-and-drop access + https://bugs.webkit.org/show_bug.cgi?id=30623 + + Use the length of the UTF-8 markup data in bytes when filling GtkSelectionData. + + No new tests, because pasteboard DataTransfer tests will be enabled + with the completion of the GTK+ DataTransfer object. + + * platform/gtk/PasteboardGtk.cpp: + (WebCore::clipboard_get_contents_cb): Use strlen here instead of g_utf8_strlen. + +2010-04-28 Dan Bernstein <mitz@apple.com> + + Reviewed by Adele Peterson. + + More of <rdar://problem/7855777> REGRESSION: Memory usage increase caused by storing glyph bounds in GlyphMetricsMap + https://bugs.webkit.org/show_bug.cgi?id=37936 + + Assigning zero width and empty bounds to the ZERO WIDTH SPACE glyph often allocates a width map + page and a bounds map page for the glyph, each of which pages contains 255 unused entries. Save + this space by not storing the zero width and empty bounds in the metrics maps. + + * platform/graphics/SimpleFontData.cpp: + (WebCore::SimpleFontData::SimpleFontData): Initialize m_zeroWidthSpaceGlyph. + (WebCore::SimpleFontData::platformGlyphInit): Set m_zeroWidthSpaceGlyph. Don’t create entries + for the ZERO WIDTH SPACE glyph in the width map and in the bounds map. + * platform/graphics/SimpleFontData.h: + (WebCore::SimpleFontData::boundsForGlyph): Return empty bounds for the ZERO WIDTH SPACE glyph + without consulting the bounds map. + (WebCore::SimpleFontData::widthForGlyph): Return zero for the ZERO WIDTH SPACE glyph without + consulting the width map. + +2010-04-28 Mark Rowe <mrowe@apple.com> + + Reviewed by Adele Peterson. + + <rdar://problem/7847573> Safari welcome page logs JavaScript exception during page load + + The Safari welcome page runs afoul of the same-origin restriction on access to stylesheet rules + that was added to address <https://bugs.webkit.org/show_bug.cgi?id=20527>. To work around this we're + adding a temporary site-specific quirk that relaxes this restriction for the particular cross-origin + access that occurs on the Safari welcome page. + + * css/CSSStyleSheet.cpp: + (WebCore::CSSStyleSheet::cssRules): + +2010-04-28 Mike Thole <mthole@apple.com> + + Reviewed by Mark Rowe. + + Add separate exports file for symbols dependent on WTF_USE_PROTECTION_SPACE_AUTH_CALLBACK. + + * DerivedSources.make: Updated for WebCore.ProtectionSpaceAuthCallback.exp. + * WebCore.ProtectionSpaceAuthCallback.exp: Added. + * WebCore.xcodeproj/project.pbxproj: + +2010-04-28 Evan Martin <evan@chromium.org> + + Reviewed by David Levin. + + [chromium] revert getFontDataForCharacters change in r58341 + https://bugs.webkit.org/show_bug.cgi?id=38288 + + It caused a performance regression. + + * platform/chromium/ChromiumBridge.h: + * platform/graphics/chromium/FontCacheLinux.cpp: + (WebCore::FontCache::getFontDataForCharacters): + +2010-04-28 Eric Seidel <eric@webkit.org> + + Unreviewed, rolling out r58441. + http://trac.webkit.org/changeset/58441 + https://bugs.webkit.org/show_bug.cgi?id=37618 + + Broke 3 test on Qt. + + * page/DragController.cpp: + (WebCore::DragController::tryDocumentDrag): + (WebCore::DragController::concludeEditDrag): + * page/DragController.h: + (WebCore::DragController::setDragInitiator): + (WebCore::DragController::dragInitiator): + (WebCore::DragController::documentUnderMouse): + +2010-04-28 Darin Adler <darin@apple.com> + + Reviewed by Dan Bernstein. + + Remove some obsolete scrolling code + https://bugs.webkit.org/show_bug.cgi?id=38293 + + * page/Chrome.cpp: + (WebCore::Chrome::scrollRectIntoView): Removed ScrollView* argument. + * page/Chrome.h: Made scrollRectIntoView non-virtual, and removed ScrollView* argument. + + * page/FrameView.cpp: Removed scrollRectIntoViewRecursively. + * page/FrameView.h: Removed scrollRectIntoViewRecursively and made + setScrollPosition non-virtual, since there is no class derived from + this class, and ScrollView's setScrollPosition is non-virtual. + + * platform/HostWindow.h: Removed scrollRectIntoView. + + * platform/ScrollView.cpp: + (WebCore::ScrollView::scrollRectIntoViewRecursively): Updated comment + since I was able to do most of the tasks listed here. + + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::scrollRectToVisible): Removed 0 passed for + ScrollView* argument to Chrome::scrollRectIntoView. + +2010-04-28 Mike Thole <mthole@apple.com> + + Reviewed by David Kilzer. + + Add canAuthenticateAgainstProtectionSpace() to frame loader so that a protection space + can be inspected before attempting to authenticate against it + https://bugs.webkit.org/show_bug.cgi?id=38271 + + * loader/EmptyClients.h: + (WebCore::EmptyFrameLoaderClient::canAuthenticateAgainstProtectionSpace): Added. + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::canAuthenticateAgainstProtectionSpace): Added. + * loader/FrameLoader.h: + * loader/FrameLoaderClient.h: + * loader/ResourceLoader.cpp: + (WebCore::ResourceLoader::canAuthenticateAgainstProtectionSpace): Added. + * loader/ResourceLoader.h: + (WebCore::ResourceLoader::canAuthenticateAgainstProtectionSpace): Added. + * platform/network/ProtectionSpace.h: + (WebCore::): + * platform/network/ResourceHandle.h: + * platform/network/ResourceHandleClient.h: + (WebCore::ResourceHandleClient::canAuthenticateAgainstProtectionSpace): Added. + * platform/network/mac/AuthenticationMac.mm: + (WebCore::mac): + Add cases for case ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested and + ProtectionSpaceAuthenticationSchemeClientCertificateRequested. Guarded with the + #if USE(PROTECTION_SPACE_AUTH_CALLBACK) as the new NSURLProtectionSpace constants don't + exist prior to Mac OS X 10.6. + (WebCore::core): Ditto. + * platform/network/mac/ResourceHandleMac.mm: + (WebCore::ResourceHandle::canAuthenticateAgainstProtectionSpace): Added. + (-[WebCoreResourceHandleAsDelegate connection:canAuthenticateAgainstProtectionSpace:]): Added. + +2010-04-28 Abhishek Arya <inferno@chromium.org> + + Reviewed by Eric Seidel. + + Convert m_documentUnderMouse, m_dragInitiator to RefPtr. + Eliminated unused m_dragInitiator accessor to prevent dereferencing. + https://bugs.webkit.org/show_bug.cgi?id=37618 + + Test: editing/pasteboard/drag-drop-iframe-refresh-crash.html + + * page/DragController.cpp: + (WebCore::DragController::tryDocumentDrag): + (WebCore::DragController::concludeEditDrag): + * page/DragController.h: + (WebCore::DragController::draggingImageURL): + (WebCore::DragController::documentUnderMouse): + +2010-04-28 Dumitru Daniliuc <dumi@chromium.org> + + Unreviewed, fixing a build problem introduced by the previous patch. + + * storage/DatabaseSync.cpp: + (WebCore::DatabaseSync::openDatabaseSync): + +2010-04-23 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Jeremy Orlow. + + Adding some required classes for the sync WebSQLDatabases API. + https://bugs.webkit.org/show_bug.cgi?id=34994 + + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * storage/DatabaseSync.cpp: Added. + (WebCore::DatabaseSync::databaseInfoTableName): + (WebCore::DatabaseSync::setIsAvailable): + (WebCore::DatabaseSync::isAvailable): + (WebCore::DatabaseSync::openDatabaseSync): + (WebCore::DatabaseSync::DatabaseSync): + (WebCore::DatabaseSync::~DatabaseSync): + (WebCore::DatabaseSync::version): + (WebCore::DatabaseSync::changeVersion): + (WebCore::DatabaseSync::transaction): + * storage/DatabaseSync.h: Added. + (WebCore::DatabaseSync::databaseDebugName): + * storage/SQLTransactionSync.cpp: Added. + (WebCore::SQLTransactionSync::create): + (WebCore::SQLTransactionSync::SQLTransactionSync): + (WebCore::SQLTransactionSync::~SQLTransactionSync): + (WebCore::SQLTransactionSync::executeSQL): + * storage/SQLTransactionSync.h: Added. + (WebCore::SQLTransactionSync::database): + (WebCore::SQLTransactionSync::isReadOnly): + * storage/SQLTransactionSyncCallback.h: Added. + (WebCore::SQLTransactionSyncCallback::~SQLTransactionSyncCallback): + +2010-04-28 İsmail Dönmez <ismail@namtrac.org> + + Reviewed by Simon Hausmann. + + Fix compilation with QT_NO_CURSOR defined. + + * platform/qt/QWebPageClient.h: + (QWebPageClient::resetCursor): + (QWebPageClient::setCursor): + +2010-04-28 Abhishek Arya <inferno@chromium.org> + + Reviewed by Alexey Proskuryakov. + + Added a check to make sure that resources from a different https origin are not cached. + https://bugs.webkit.org/show_bug.cgi?id=33456 + + Test: http/tests/appcache/different-https-origin-resource-main.html + + * loader/appcache/ManifestParser.cpp: + (WebCore::parseManifest): + +2010-04-28 Sam Weinig <sam@webkit.org> + + Reviewed by Mark Rowe. + + Only set -allowable_client WebKit2 for engineering builds on SnowLeopard + and later. + + * Configurations/WebCore.xcconfig: + +2010-04-28 Darin Adler <darin@apple.com> + + Reviewed by Adele Peterson. + + REGRESSION: Autoscroll does not work in Mail messages + https://bugs.webkit.org/show_bug.cgi?id=38267 + rdar://problem/7559799 + + Still haven't figured out a good way to test this with DumpRenderTree + or with Safari. Testing has to be done with Mail for now. + + The machinery to make autoscrolling work on Mac OS X when a WebView is embedded in another + view had gotten broken in multiple ways. For some reason, a combination of bugs made it + partly work until around r48064. This brings it back. + + There were three problems: + + 1) Code in EventHandler decided there was nothing to scroll, so didn't start + the autoscroll timer. + 2) The wrong rectangle was passed to Chrome::scrollRectIntoView. + 3) The Mac WebKit implementation of ChromeClient::scrollRectIntoView did incorrect + coordinate conversion. + + I verified that none of these have any effect on regression tests, or behavior in + web browsers, or behavior on platforms other than Mac. + + * page/EventHandler.cpp: + (WebCore::canAutoscroll): Added. Returns true for boxes that can scroll directly + and for the top level box of the top frame. + (WebCore::EventHandler::handleMouseDraggedEvent): Use canAutoscroll. + (WebCore::EventHandler::updateAutoscrollRenderer): Ditto. + + * page/FrameView.cpp: + (WebCore::FrameView::scrollToAnchor): Fixed comment. + + * platform/ScrollView.cpp: + (WebCore::ScrollView::scrollRectIntoViewRecursively): Put ASSERT_NOT_REACHED into this + now-unused function along with some comments about removing some obsolete code. + + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::scrollRectToVisible): Removed call to scrollRectIntoViewRecursively + since from the WebKit point of view this is the topmost scroll view anyway. Instead call + setScrollPosition. Moved the code to call Chrome::scrollRectIntoView here since it needs + to use a different rectangle anyway. + +2010-04-21 Ojan Vafai <ojan@chromium.org> + + Reviewed by Adele Peterson. + + http://trac.webkit.org/changeset/57215 caused perf/memory regressions + https://bugs.webkit.org/show_bug.cgi?id=37292 + + #if out the canUseGlyphCache Changes from r57215 as they caused a + 8% perf regression on Chromium's international page load tests so that + the perf regression can be fixed properly without being left in the tree. + + * platform/graphics/FontFastPath.cpp: + (WebCore::Font::canUseGlyphCache): + +2010-04-28 Beth Dakin <bdakin@apple.com> + + Reviewed by Darin Adler. + + Fix for <rdar://problem/7474349> + + Add a synchronous display mechanism for WKCACFLayerRenderer. + + * platform/graphics/win/WKCACFLayerRenderer.cpp: + (WebCore::WKCACFLayerRenderer::setRootContentsAndDisplay): This is + just like setRootContents(), but it calls paint() instead of + renderSoon(). + * platform/graphics/win/WKCACFLayerRenderer.h: + +2010-04-28 Dmitry Titov <dimich@chromium.org> + + Reviewed by Geoffrey Garen. + + REGRESSION: fast/workers/wrapper-map-gc.html crashes on Snow Leopard Release Bot + https://bugs.webkit.org/show_bug.cgi?id=37554 + + The flaky fast/workers/wrapper-map-gc.html will stop being flaky. + + * bindings/js/JSEventListener.cpp: + (WebCore::JSEventListener::handleEvent): + check if JS execution was terminated, as in cases of Worker.terminate() or WorkerGlobalScope.close(). + * bindings/js/JSWorkerContextBase.cpp: + (WebCore::toJS): ASSERT the value of workerContextWrapper, it should never be 0. + * bindings/js/WorkerScriptController.h: + (WebCore::WorkerScriptController::workerContextWrapper): remove returning 0 if JS execution was forbidden. + (WebCore::WorkerScriptController::isExecutionForbidden): + * bindings/v8/WorkerScriptController.h: + (WebCore::WorkerScriptController::isExecutionForbidden): + + Add ScriptExecutionContext::isJSExecutionTerminated(), it is always 'false' for Document + and 'true' for WorkerContext when script is terminated. + * dom/ScriptExecutionContext.h: + * dom/Document.h: + (WebCore::Document::isJSExecutionTerminated): + * workers/WorkerContext.cpp: + (WebCore::WorkerContext::isJSExecutionTerminated): + * workers/WorkerContext.h: + +2010-04-28 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Yury Semikhatsky. + + WebInspector: Multiple Main Resource Content Loaded marks appear in Resource panel. + https://bugs.webkit.org/show_bug.cgi?id=38270 + + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourcesPanel.prototype.updateGraphDividersIfNeeded): + +2010-04-28 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Yury Semikhatsky. + + WebInspector: Timeline: We can have precise urls in the EvaluateScript records. + https://bugs.webkit.org/show_bug.cgi?id=38264 + + * inspector/front-end/TimelinePanel.js: + (WebInspector.TimelinePanel.FormattedRecord.prototype._generatePopupContent): + (WebInspector.TimelinePanel.FormattedRecord.prototype._getRecordDetails): + +2010-04-28 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Linkify node and function in the event listeners panel. + + https://bugs.webkit.org/show_bug.cgi?id=38251 + + * bindings/js/ScriptEventListener.cpp: + (WebCore::eventListenerHandlerBody): + (WebCore::eventListenerHandlerLocation): + * bindings/js/ScriptEventListener.h: + * bindings/v8/ScriptEventListener.cpp: + (WebCore::eventListenerHandlerBody): + (WebCore::eventListenerHandlerLocation): + * bindings/v8/ScriptEventListener.h: + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::buildObjectForEventListener): + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel.prototype.linkifyNodeReference): + (WebInspector.ElementsPanel.prototype.linkifyNodeReference.preventDefault): + * inspector/front-end/EventListenersSidebarPane.js: + (WebInspector.EventListenersSidebarPane.prototype.update.callback): + (WebInspector.EventListenersSidebarPane.prototype.update): + (): + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylesSidebarPane.prototype._rebuildSectionsForStyleRules): + * inspector/front-end/inspector.css: + (.node-link): + +2010-04-28 Julien Chaffraix <jchaffraix@webkit.org> + + Reviewed by Alexey Proskuryakov. + + [XHR] Cross-Origin synchronous request with credential raises NETWORK_ERR + https://bugs.webkit.org/show_bug.cgi?id=37781 + <rdar://problem/7905150> + + Tests: http/tests/xmlhttprequest/access-control-preflight-credential-async.html + http/tests/xmlhttprequest/access-control-preflight-credential-sync.html + + Rolling the patch in as I could not reproduce Qt results locally. + + * loader/DocumentThreadableLoader.cpp: + (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): Now we remove the + credential from the request here to avoid forgetting to do so in the different code path. + (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest): Just add the + "Origin" header. + (WebCore::DocumentThreadableLoader::loadRequest): Check here the the credential have + been removed so that we don't leak them. Also tweaked a comment to make it clear that + the URL check has issue when credential is involved. + +2010-04-28 Noam Rosenthal <noam.rosenthal@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] GraphicsLayer: preserves-3d and backface visibility + https://bugs.webkit.org/show_bug.cgi?id=35312 + + Implement preserves-3d by maintaining the 3D transformation heirarchy inside GraphicsLayerQt, and extrapolating + the relative QTransform. When the extrapolation fails (un-invertible matrix) we ignore the transformation change. + + WebKitSite/blog-files/3d-transforms test now work with Qt. + + * platform/graphics/qt/GraphicsLayerQt.cpp: + (WebCore::GraphicsLayerQtImpl::updateTransform): + (WebCore::GraphicsLayerQtImpl::opaqueArea): + (WebCore::GraphicsLayerQtImpl::boundingRect): + (WebCore::GraphicsLayerQtImpl::paint): + (WebCore::GraphicsLayerQtImpl::flushChanges): + +2010-04-28 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: View frame selector for Timeline overview panel is redesigned a bit. + Now it is possible to adjust view frame by resizer bars and by click-n-drag in overview pane. + https://bugs.webkit.org/show_bug.cgi?id=38251 + + * inspector/front-end/TimelineOverviewPane.js: + (WebInspector.TimelineOverviewPane): + (WebInspector.TimelineOverviewPane.prototype.reset): + (WebInspector.TimelineOverviewPane.prototype._dragWindow): + (WebInspector.TimelineOverviewPane.prototype._windowSelectorDragging): + (WebInspector.TimelineOverviewPane.prototype._endWindowSelectorDragging): + (WebInspector.TimelineOverviewPane.prototype._resizeWindowLeft): + (WebInspector.TimelineOverviewPane.prototype._resizeWindowRight): + (WebInspector.TimelineOverviewPane.prototype._setWindowPosition): + (WebInspector.TimelinePanel.WindowSelector): + (WebInspector.TimelinePanel.WindowSelector.prototype._createSelectorElement): + (WebInspector.TimelinePanel.WindowSelector.prototype._close): + (WebInspector.TimelinePanel.WindowSelector.prototype._updatePosition): + * inspector/front-end/inspector.css: + (#timeline-overview-grid): + (.timeline-window-selector): + (#timeline-overview-window): + (.timeline-overview-dividers-background): + (.timeline-overview-window-rulers): + (.timeline-window-resizer): + +2010-04-28 Marcus Bulach <bulach@chromium.org> + + Reviewed by Jeremy Orlow. + + Reverts 58340 (https://bugs.webkit.org/show_bug.cgi?id=38158) due to regression on fast/text/international/khmer-selection.html + https://bugs.webkit.org/show_bug.cgi?id=38254 + + * platform/graphics/chromium/FontLinux.cpp: + (WebCore::adjustTextRenderMode): + (WebCore::TextRunWalker::getTextRun): + (WebCore::TextRunWalker::getNormalizedTextRun): + (WebCore::TextRunWalker::setGlyphXPositions): + (WebCore::glyphIndexForXPositionInScriptRun): + (WebCore::Font::offsetForPositionForComplexText): + (WebCore::Font::selectionRectForComplexText): + * platform/graphics/chromium/FontPlatformDataLinux.cpp: + (WebCore::FontPlatformData::setupPaint): + * platform/graphics/chromium/HarfbuzzSkia.cpp: + (WebCore::getOutlinePoint): + * platform/graphics/skia/GraphicsContext3DSkia.cpp: + (WebCore::GraphicsContext3D::getImageData): + * platform/graphics/skia/GraphicsContextSkia.cpp: + (WebCore::isCoordinateSkiaSafe): + (WebCore::GraphicsContext::fillRect): + (WebCore::GraphicsContext::strokePath): + (WebCore::GraphicsContext::strokeRect): + +2010-04-28 Andrey Kosyakov <caseq@chromium.org> + + Reviewed by Yury Semikhatsky. + + Log error message to inspector console if a resource fails to load. + Disable checking of mime-type consistency for failed resources. + https://bugs.webkit.org/show_bug.cgi?id=37215 + + Test: http/tests/inspector/console-resource-errors.html + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::didReceiveResponse): + (WebCore::InspectorController::didFailLoading): + * inspector/front-end/Resource.js: + (WebInspector.Resource.prototype._mimeTypeIsConsistentWithType): + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourcesPanel.prototype.recreateViewForResourceIfNeeded): + +2010-04-28 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Support pause on exceptions in v8 implementation of ScriptDebugServer. + + https://bugs.webkit.org/show_bug.cgi?id=38205 + + * bindings/v8/ScriptDebugServer.cpp: + (WebCore::ScriptDebugServer::addListener): + (WebCore::ScriptDebugServer::pauseOnExceptionsState): + (WebCore::ScriptDebugServer::setPauseOnExceptionsState): + (WebCore::ScriptDebugServer::currentCallFrame): + (WebCore::ScriptDebugServer::handleV8DebugMessage): + (WebCore::ScriptDebugServer::dispatchDidParseSource): + * bindings/v8/ScriptDebugServer.h: + +2010-04-28 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r58313. + http://trac.webkit.org/changeset/58313 + https://bugs.webkit.org/show_bug.cgi?id=38253 + + Regression evident in pixel tests: the search icon is always + clipped at the bottom. (Requested by jorlow on #webkit). + + * rendering/RenderTextControl.cpp: + (WebCore::RenderTextControl::controlClipRect): + * rendering/RenderTextControl.h: + (WebCore::RenderTextControl::hasControlClip): + * rendering/RenderTextControlSingleLine.cpp: + (WebCore::RenderTextControlSingleLine::paint): + * rendering/RenderTextControlSingleLine.h: + +2010-04-28 Justin McPherson <justin.mcpherson@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix detection of Qt 4.7's multimedia libraries + + QtMultimedia has been split into an additional media services library, which + we're using. mediaservices depends on multimedia. + + * WebCore.pro: + +2010-04-28 Shinichiro Hamaji <hamaji@chromium.org> + + Unreviewed attempt to fix the chromium build. + + Add layoutTestController.setPrinting() + https://bugs.webkit.org/show_bug.cgi?id=37203 + + * rendering/RenderTreeAsText.cpp: + +2010-04-27 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Darin Adler and Eric Seidel. + + Add layoutTestController.setPrinting() + https://bugs.webkit.org/show_bug.cgi?id=37203 + + Added RenderAsTextPrintingMode as a behavior of externalRepresentation. + + Now ~PrintContext() calls end() automatically. + + * page/PrintContext.cpp: + (WebCore::PrintContext::~PrintContext): + * rendering/RenderTreeAsText.cpp: + (WebCore::externalRepresentation): + * rendering/RenderTreeAsText.h: + (WebCore::): + +2010-04-27 Yuzo Fujishima <yuzo@google.com> + + Reviewed by Eric Seidel. + + Enhance CSS parser for Paged Media (Iteration 4) + Implement page property parsing as specified at http://dev.w3.org/csswg/css3-page/#using-named-pages. + https://bugs.webkit.org/show_bug.cgi?id=35853 + + * css/CSSParser.cpp: + (WebCore::CSSParser::parseValue): + (WebCore::CSSParser::parsePage): + * css/CSSParser.h: + +2010-04-27 Yuzo Fujishima <yuzo@google.com> + + Reviewed by Dimitri Glazkov. + + Enhance CSS parser for Paged Media (Iteration 3) + Implement size parameter parsing for Paged Media. + https://bugs.webkit.org/show_bug.cgi?id=35851 + + I believe size property hasn't been used so far because (1) it hasn't been properly parsed and + (2) a comment in CSSComputedStyleDeclaration::getPropertyCSSValue says so. + Changing the way of parsing it should not cause any regressions -- no existing tests fail because of this change. + + * css/CSSParser.cpp: + (WebCore::CSSParser::parseValue): + (WebCore::CSSParser::parseSize): + (WebCore::CSSParser::parseSizeParameter): + * css/CSSParser.h: + (WebCore::CSSParser::): + * css/CSSValueKeywords.in: + +2010-04-27 Yuzo Fujishima <yuzo@google.com> + + Reviewed by Eric Seidel. + + Enhance CSS parser for Paged Media (Iteration 2) + Parse and hold paged media rules in CSSStyleSelector. + + https://bugs.webkit.org/show_bug.cgi?id=35782 + + Test: printing/page-rule-css-text.html + + * css/CSSGrammar.y: + * css/CSSPageRule.cpp: + (WebCore::CSSPageRule::CSSPageRule): + (WebCore::CSSPageRule::selectorText): + * css/CSSPageRule.h: + (WebCore::CSSPageRule::create): + (WebCore::CSSPageRule::isPageRule): + * css/CSSParser.cpp: + (WebCore::CSSParser::createPageRule): + * css/CSSStyleRule.h: + * css/CSSStyleSelector.cpp: + (WebCore::CSSRuleSet::getPageRules): + (WebCore::CSSRuleSet::CSSRuleSet): + (WebCore::CSSRuleSet::~CSSRuleSet): + (WebCore::CSSRuleSet::addPageRule): + (WebCore::CSSRuleSet::addRulesFromSheet): + * css/CSSStyleSelector.h: + * css/StyleBase.h: + (WebCore::StyleBase::isPageRule): + +2010-04-27 Daniel Bates <dbates@rim.com> + + Reviewed by Oliver Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=37686 + + Fixes an issue where the canvas method strokeRect will stroke a + rectangle whose dimensions are 0 when lineWidth > 1. + + As per the definition of strokeRect in the HTML Canvas 2D Context + spec. <http://www.w3.org/TR/2dcontext/#dom-context-2d-strokerect>, + this method should have no effect when both the height and width + are zero. + + Tests: fast/canvas/canvas-clearRect.html + fast/canvas/canvas-fillRect.html + + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::validateRectForCanvas): Return false if height, width == 0. + +2010-04-27 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Remove obsolete custom bindings file + https://bugs.webkit.org/show_bug.cgi?id=38223 + + We don't need these files anymore because they are empty. + + * Android.jscbindings.mk: + * GNUmakefile.am: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSAbstractWorkerCustom.cpp: Removed. + * bindings/js/JSBindingsAllInOne.cpp: + * bindings/js/JSDocumentFragmentCustom.cpp: Removed. + * bindings/js/JSEventSourceCustom.cpp: Removed. + +2010-04-27 Daniel Cheng <dcheng@chromium.org> + + Reviewed by Jian Li. + + [Chromium] Filter out URLs with a file scheme from text/uri-list when dragging. + https://bugs.webkit.org/show_bug.cgi?id=38227 + + Unfortunately, the simple fix of not populating the drag data with file URLs doesn't work + since the default drop handling uses the drag data URL to navigate to dropped files/URLs. + For now, we hack around the problem in the Chromium platform, but the proper long term + solution is to change DragController::performDrag to check dragData::asFilenames(). + + No new tests. + + * platform/chromium/ClipboardChromium.cpp: + (WebCore::ClipboardChromium::getData): + (WebCore::ClipboardChromium::types): + +2010-04-27 Simon Fraser <simon.fraser@apple.com> + + Reviewed by the inimitable Dan Bernstein. + + SVG as background image renders incorrectly after zooming + https://bugs.webkit.org/show_bug.cgi?id=38215 + + When doing a partial redraw of an SVGImage used as a CSS background + image, we're limited to drawing the entire Frame, clipped to the dirty rect. + Because of this, we need to fix up the CTM so that the origin is at the + top left of the unclipped image, rather than the top left of the + portion being redrawn. + + Test: fast/images/svg-background-partial-redraw.html + + * svg/graphics/SVGImage.cpp: + (WebCore::SVGImage::draw): + +2010-04-27 Yuzo Fujishima <yuzo@google.com> + + Reviewed by David Hyatt. + + Retry of: Enhance CSS parser for Paged Media (Iteration 1) + + In this change, the grammar is extended and skeletal methods for creating page rules and margin at-rules are defined. + The contents of the methods should be implemented by other changes. + + https://bugs.webkit.org/show_bug.cgi?id=35329 + + Test: fast/css/parsing-page-rule.html + + * css/CSSGrammar.y: + * css/CSSParser.cpp: + (WebCore::CSSParser::CSSParser): + (WebCore::CSSParser::clearProperties): + (WebCore::CSSParser::createPageRule): + (WebCore::CSSParser::createMarginAtRule): + (WebCore::CSSParser::startDeclarationsForMarginBox): + (WebCore::CSSParser::endDeclarationsForMarginBox): + * css/CSSParser.h: + * css/CSSSelector.cpp: + (WebCore::CSSSelector::pseudoId): + (WebCore::nameToPseudoTypeMap): + (WebCore::CSSSelector::extractPseudoType): + * css/CSSSelector.h: + (WebCore::CSSSelector::): + * css/tokenizer.flex: + +2010-04-27 Julien Chaffraix <jchaffraix@webkit.org> + + Unreviewed, rolling out my changes as it rendered the Qt bot unreliable. + + * loader/DocumentThreadableLoader.cpp: + (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): + (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest): + (WebCore::DocumentThreadableLoader::loadRequest): + +2010-04-27 Julien Chaffraix <jchaffraix@webkit.org> + + Reviewed by Alexey Proskuryakov. + + [XHR] Cross-Origin synchronous request with credential raises NETWORK_ERR + https://bugs.webkit.org/show_bug.cgi?id=37781 + <rdar://problem/7905150> + + Tests: http/tests/xmlhttprequest/access-control-preflight-credential-async.html + http/tests/xmlhttprequest/access-control-preflight-credential-sync.html + + * loader/DocumentThreadableLoader.cpp: + (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): Now we remove the + credential from the request here to avoid forgetting to do so in the different code path. + (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest): Just add the + "Origin" header. + (WebCore::DocumentThreadableLoader::loadRequest): Check here the the credential have + been removed so that we don't leak them. Also tweaked a comment to make it clear that + the URL check has issue when credential is involved. + +2010-04-27 Sam Weinig <sam@webkit.org> + + Reviewed by Maciej Stachowiak. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=38238 + Allow both WebKit and WebKit2 to link to the same WebCore.framework + + * Configurations/WebCore.xcconfig: Use -allowable_client WebKit2 to add + WebKit2 to the list of frameworks that can link directly to WebCore. It + is not necessary for it to be an umbrella since we don't need to reexport + any symbols. + +2010-04-27 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by David Levin. + + Turn on AUTO_VACUUM = INCREMENTAL for all HTML5 databases. + https://bugs.webkit.org/show_bug.cgi?id=38191 + + Vacuum all databases when the number of free pages is at least 10% + of the number of total pages. Also, add a guard against a bug that + was fixed in SQLite only starting with version 3.6.16. + + * platform/sql/SQLiteDatabase.cpp: + (WebCore::SQLiteDatabase::maximumSize): + (WebCore::SQLiteDatabase::freeSpaceSize): + (WebCore::SQLiteDatabase::totalSize): + (WebCore::SQLiteDatabase::runIncrementalVacuumCommand): + (WebCore::SQLiteDatabase::turnOnIncrementalAutoVacuum): + * platform/sql/SQLiteDatabase.h: + (WebCore::SQLiteDatabase::): + * platform/sql/SQLiteStatement.cpp: + (WebCore::SQLiteStatement::prepare): + (WebCore::SQLiteStatement::step): + * storage/Database.cpp: + (WebCore::Database::performOpenAndVerify): + (WebCore::Database::incrementalVacuumIfNeeded): + * storage/Database.h: + * storage/SQLTransaction.cpp: + (WebCore::SQLTransaction::postflightAndCommit): + +2010-04-27 Garret Kelly <gdk@chromium.org> + + Reviewed by Darin Fisher. + + Turn all of the touch event handlers into RuntimeEnabledFeatures, and + modify the createEvent methond on Document so that it won't create a + TouchEvent if the feature is disabled. + https://bugs.webkit.org/show_bug.cgi?id=37485 + + * bindings/generic/RuntimeEnabledFeatures.cpp: + * bindings/generic/RuntimeEnabledFeatures.h: + (WebCore::RuntimeEnabledFeatures::touchEnabled): + (WebCore::RuntimeEnabledFeatures::setTouchEnabled): + (WebCore::RuntimeEnabledFeatures::ontouchstartEnabled): + (WebCore::RuntimeEnabledFeatures::ontouchmoveEnabled): + (WebCore::RuntimeEnabledFeatures::ontouchendEnabled): + (WebCore::RuntimeEnabledFeatures::ontouchcancelEnabled): + * dom/Document.cpp: + (WebCore::Document::createEvent): + * dom/Document.idl: + * dom/Element.idl: + * page/DOMWindow.idl: + +2010-04-27 Jens Alfke <snej@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Add some notifications and an accessor to WebKit API + https://bugs.webkit.org/show_bug.cgi?id=37625 + + * dom/Node.cpp: + (WebCore::Node::hasNonEmptyBoundingBox): New method. + * dom/Node.h: + * html/HTMLAnchorElement.cpp: + (WebCore::HTMLAnchorElement::isKeyboardFocusable): Moved part of method into new Node method + +2010-04-27 Jochen Eisinger <jochen@chromium.org> + + Reviewed by Shinichiro Hamaji. + + Fix gyp build on Mac OS X with enable_svg=0. + https://bugs.webkit.org/show_bug.cgi?id=38192 + + * WebCore.gyp/WebCore.gyp: Only generate SVG symbols if enable_svg!=0. + * css/CSSComputedStyleDeclaration.cpp: + (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Add missing unimplemented CSS properties to switch statement. + +2010-04-27 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by Jian Li. + + [V8] Handle OR ('|') conditional in action_derivedsourcesallinone.py + https://bugs.webkit.org/show_bug.cgi?id=38207 + + No new tests. + + * WebCore.gyp/scripts/action_derivedsourcesallinone.py: + +2010-04-27 François Sausset <sausset@gmail.com> + + Reviewed by Kenneth Rohde Christiansen. + + Implementation of the MathML mroot & msqrt elements. + https://bugs.webkit.org/show_bug.cgi?id=37044 + + Test: mathml/presentation/roots.xhtml + + * WebCore.xcodeproj/project.pbxproj: + * css/mathml.css: + (mroot): + (mroot > * + *): + (mroot > * + mrow, mroot > * + mfenced): + * mathml/MathMLInlineContainerElement.cpp: + (WebCore::MathMLInlineContainerElement::createRenderer): + * mathml/RenderMathMLRoot.cpp: Added. + (WebCore::RenderMathMLRoot::RenderMathMLRoot): + (WebCore::RenderMathMLRoot::addChild): + (WebCore::RenderMathMLRoot::paint): + (WebCore::RenderMathMLRoot::layout): + * mathml/RenderMathMLRoot.h: Added. + * mathml/RenderMathMLSquareRoot.cpp: Added. + (WebCore::RenderMathMLSquareRoot::RenderMathMLSquareRoot): + (WebCore::RenderMathMLSquareRoot::paint): + (WebCore::RenderMathMLSquareRoot::layout): + * mathml/RenderMathMLSquareRoot.h: Added. + +2010-04-27 Darin Adler <darin@apple.com> + + Reviewed by Maciej Stachowiak. + + I noticed an unused forwarding header. + + * ForwardingHeaders/runtime/PropertyMap.h: Removed. + +2010-04-27 James Robinson <jamesr@chromium.org> + + Reviewed by Adam Barth. + + Fix gcc 4.4.1 warnings on Linux in the chromium V8 bindings code. + https://bugs.webkit.org/show_bug.cgi?id=38153 + + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/v8/V8Proxy.cpp: + (WebCore::V8Proxy::callFunction): + +2010-04-27 Eric Seidel <eric@webkit.org> + + Unreviewed, rolling out r58318. + http://trac.webkit.org/changeset/58318 + https://bugs.webkit.org/show_bug.cgi?id=37215 + + Broke test on Tiger. Might just need updated results, + unclear. + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::didReceiveResponse): + (WebCore::InspectorController::didFailLoading): + * inspector/front-end/Resource.js: + (WebInspector.Resource.prototype._mimeTypeIsConsistentWithType): + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourcesPanel.prototype.recreateViewForResourceIfNeeded): + +2010-04-27 Evan Martin <evan@chromium.org> + + Reviewed by David Levin. + + [chromium] bold bengali text not rendered properly on Linux + https://bugs.webkit.org/show_bug.cgi?id=37904 + + We must let Skia do font fallback, rather than picking a font name + then handing that to Skia. For example, if we have Bengali text and + choose FreeSans + fake bold, and then later reuse the name, Skia will + helpfully use FreeSansBold (which doesn't cover Bengali). + + Test: fast/text/international/bold-bengali.html + + * platform/graphics/chromium/FontCacheLinux.cpp: + (WebCore::FontCache::getFontDataForCharacters): + +2010-04-27 James Robinson <jamesr@chromium.org> + + Reviewed by Darin Adler. + + Fix warnings emitted by gcc 4.4.1 on linux in chromium-specific platform graphics files. + https://bugs.webkit.org/show_bug.cgi?id=38158 + + Most of the issues are signed/unsigned mismatches, but there are a few unusued variables + and functions mixed in. + + * platform/graphics/chromium/FontLinux.cpp: + (WebCore::adjustTextRenderMode): + (WebCore::TextRunWalker::getTextRun): + (WebCore::TextRunWalker::getNormalizedTextRun): + (WebCore::TextRunWalker::setGlyphXPositions): + (WebCore::glyphIndexForXPositionInScriptRun): + (WebCore::Font::offsetForPositionForComplexText): + (WebCore::Font::selectionRectForComplexText): + * platform/graphics/chromium/FontPlatformDataLinux.cpp: + (WebCore::FontPlatformData::setupPaint): + * platform/graphics/chromium/HarfbuzzSkia.cpp: + (WebCore::getOutlinePoint): + * platform/graphics/skia/GraphicsContext3DSkia.cpp: + (WebCore::GraphicsContext3D::getImageData): + * platform/graphics/skia/GraphicsContextSkia.cpp: + (WebCore::isCoordinateSkiaSafe): + (WebCore::GraphicsContext::fillRect): + (WebCore::GraphicsContext::strokePath): + (WebCore::GraphicsContext::strokeRect): + +2010-04-27 Jian Li <jianli@chromium.org> + + Reviewed by Darin Adler. + + Sending a package file using FormData crashes WebKit on Mac. + https://bugs.webkit.org/show_bug.cgi?id=37882 + + Can't add a layout test because DRT does not support generating the file name. + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::submitForm): + (WebCore::FrameLoader::navigateToDifferentDocument): + * platform/network/FormData.cpp: + (WebCore::FormData::appendDOMFormData): + * platform/network/FormData.h: + * xml/XMLHttpRequest.cpp: + (WebCore::XMLHttpRequest::send): + +2010-04-27 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Remove custom NodeIterator bindings + https://bugs.webkit.org/show_bug.cgi?id=38188 + + Another example of CallWith=ScriptState. This case shows us the right + way to handle the interaction with exception codes. + + In my previous patch, I put the exception code handling after the + ScriptState exception handling. It turns out this was a mistake + (although a harmless one at the time because no IDL caused us to + generate that code). Now that we're generating both kinds of exception + handling, we need to generate them in the right order. + + * WebCore.gypi: + * bindings/js/JSNodeIteratorCustom.cpp: + * bindings/scripts/CodeGeneratorJS.pm: + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + (webkit_dom_test_obj_with_script_state_void_exception): + (webkit_dom_test_obj_with_script_state_obj_exception): + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::): + (WebCore::jsTestObjPrototypeFunctionWithScriptStateVoidException): + (WebCore::jsTestObjPrototypeFunctionWithScriptStateObjException): + * bindings/scripts/test/JS/JSTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.mm: + (-[DOMTestObj withScriptStateVoidException]): + (-[DOMTestObj withScriptStateObjException]): + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjInternal::withScriptStateVoidCallback): + (WebCore::TestObjInternal::withScriptStateObjCallback): + (WebCore::TestObjInternal::withScriptStateVoidExceptionCallback): + (WebCore::TestObjInternal::withScriptStateObjExceptionCallback): + (WebCore::): + * bindings/v8/custom/V8NodeIteratorCustom.cpp: Removed. + * dom/NodeIterator.idl: + +2010-04-27 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Adler. + + Remove copy/paste addEventListener "custom" bindings via code generation + https://bugs.webkit.org/show_bug.cgi?id=38210 + + It's somewhat lame to special case addEventListener and + removeEventListener in the code generator, but it saves a large amount + of boilerplate "custom" bindings code. + + Idea shamelessly stolen from the V8 code generator. + + This patch points to some good refactoring opportunities in + CodeGeneratorJS.pm, but I'm going to hold off on those for a future + patch. By generating test coverage for the code generator, we make + these future refactorings easier. + + * bindings/js/JSAbstractWorkerCustom.cpp: + * bindings/js/JSDOMApplicationCacheCustom.cpp: + * bindings/js/JSDesktopNotificationsCustom.cpp: + * bindings/js/JSEventSourceCustom.cpp: + * bindings/js/JSMessagePortCustom.cpp: + * bindings/js/JSNodeCustom.cpp: + * bindings/js/JSSVGElementInstanceCustom.cpp: + * bindings/js/JSWebSocketCustom.cpp: + * bindings/js/JSWorkerContextCustom.cpp: + * bindings/js/JSXMLHttpRequestCustom.cpp: + * bindings/js/JSXMLHttpRequestUploadCustom.cpp: + * bindings/scripts/CodeGeneratorJS.pm: + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::): + (WebCore::jsTestObjPrototypeFunctionAddEventListener): + (WebCore::jsTestObjPrototypeFunctionRemoveEventListener): + * bindings/scripts/test/JS/JSTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.mm: + (-[DOMTestObj addEventListener:listener:useCapture:]): + (-[DOMTestObj removeEventListener:listener:useCapture:]): + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjInternal::addEventListenerCallback): + (WebCore::TestObjInternal::removeEventListenerCallback): + (WebCore::): + * dom/MessagePort.idl: + * dom/Node.idl: + * loader/appcache/DOMApplicationCache.idl: + * notifications/Notification.idl: + * page/EventSource.idl: + * svg/SVGElementInstance.idl: + * websockets/WebSocket.idl: + * workers/AbstractWorker.idl: + * workers/WorkerContext.idl: + * xml/XMLHttpRequest.idl: + * xml/XMLHttpRequestUpload.idl: + +2010-04-27 Sam Weinig <sam@webkit.org> + + Rubber-stamped by Beth Dakin. + + Remove now unnecessary EXPERIMENTAL_SINGLE_VIEW_MODE #define. + + * page/EventHandler.cpp: + (WebCore::EventHandler::EventHandler): + (WebCore::EventHandler::clearDragState): + * page/EventHandler.h: + * page/mac/DragControllerMac.mm: + * page/mac/EventHandlerMac.mm: + * platform/mac/PopupMenuMac.mm: + +2010-04-27 Ben Murdoch <benm@google.com> + + Reviewed by Simon Hausmann. + + The TouchStationary state of WebCore::PlatformTouchPoint is not handled inside the touch event handler. + https://bugs.webkit.org/show_bug.cgi?id=37609 + + No new tests required, only updating documentation. + + * page/EventHandler.cpp: + (WebCore::EventHandler::handleTouchEvent): Improve the documentation for handling + the TouchStationary state as a result of discussions in bug 37609. + +2010-04-27 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Darin Adler, Maciej Stachowiak. + + REGRESSION (r57919): Some pages opened in background tabs don't render the first time you activate their tab + https://bugs.webkit.org/show_bug.cgi?id=38183 + + Rather than sprinkle PLATFORM #ifdefs around, add a new method, + RenderLayerCompositor::shouldPropagateCompositingToIFrameParent(), that indicates whether + an iframe with composited content should trigger compositing mode in the enclosing document + (a behavior that differs between platforms). + + Use this new method to determine whether to trigger a style recalc in the parent document + when an iframe becomes composited. + + Move the code formerly in RenderView::compositingStateChanged() into RenderLayerCompositor(). + + * manual-tests/compositing/accel-comp-iframe-tab-repaint.html: Added. + * manual-tests/compositing/resources/flash-frame.html: Added. + * manual-tests/compositing/resources/tab-repaint-part-2.html: Added. + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::enableCompositingMode): + (WebCore::RenderLayerCompositor::shouldPropagateCompositingToIFrameParent): + (WebCore::RenderLayerCompositor::requiresCompositingForIFrame): + * rendering/RenderLayerCompositor.h: + * rendering/RenderView.cpp: + * rendering/RenderView.h: + +2010-04-27 Andrey Kosyakov <caseq@chromium.org> + + Reviewed by Yury Semikhatsky. + + Log error message to inspector console if a resource fails to load. + Disable checking of mime-type consistency for failed resources. + https://bugs.webkit.org/show_bug.cgi?id=37215 + + Test: http/tests/inspector/console-resource-errors.html + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::didReceiveResponse): + (WebCore::InspectorController::didFailLoading): + * inspector/front-end/Resource.js: + (WebInspector.Resource.prototype._mimeTypeIsConsistentWithType): + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourcesPanel.prototype.recreateViewForResourceIfNeeded): + +2010-04-27 Vitaly Repeshko <vitalyr@chromium.org> + + Reviewed by Nate Chapin. + + [V8] Fix XHR memory leak in GC controller. + https://bugs.webkit.org/show_bug.cgi?id=38202 + + http://trac.webkit.org/changeset/55798 simplified processing of + active DOM objects but introduced a subtle bug in garbage + collection of XHRs. ActiveDOMObject is not a direct base class of + XHR and so upcasting changes pointer identity and breaks DOM + maps. This leads to forever live persistent handles to XHR that + had pending activity while V8 GC happened. + + * bindings/v8/V8GCController.cpp: + (WebCore::GCEpilogueVisitor::visitDOMWrapper): + +2010-04-27 Adam Barth <abarth@webkit.org> + + Unreviewed. Regenerate reference bindings code generator output. + + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjInternal::withScriptStateVoidCallback): + (WebCore::TestObjInternal::withScriptStateObjCallback): + +2010-04-27 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by Dan Bernstein. + + <input type="search"> with uneven padding causes text clipping + https://bugs.webkit.org/show_bug.cgi?id=38160 + + Test: fast/css/input-search-padding.html + + An <input type="search"> contains an inner block, which is explicitly + centered in RenderTextControlSingleLine based on the height of the element. + However, the clipping rect was not using the set location, and instead + calculated off of the top border and padding alone. This also vertically + centers the Caps Lock indicator. + + * rendering/RenderTextControl.cpp: moved controlClipRect implementation to RenderTextControlSingleLine + * rendering/RenderTextControl.h: allow a subclass implementation of controlClipRect, removed redundant hasControlClip implementation, and moved controlClipRect + * rendering/RenderTextControlSingleLine.cpp: + (WebCore::RenderTextControlSingleLine::paint): vertically center the Caps Lock indicator + (WebCore::RenderTextControlSingleLine::controlClipRect): use the set location of the anonymous inner block instead + * rendering/RenderTextControlSingleLine.h: allow for an implementation of controlClipRect for <input type="search"> + +2010-04-27 Thomas Zander <t.zander@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix linking on Symbian on Linux using the Makefile based mkspec. + + Disable thumb mode due to library size limitations, just like it's done + for the sbs/sbsv2 based build system. + + * WebCore.pro: + +2010-04-21 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Make sure WebKit is not compiled using C++0x. + https://bugs.webkit.org/show_bug.cgi?id=37867 + + As the rest of Qt compiles in the C++0x mode, people might start + compiling it in this mode. WebKit don't support this yet. + + Patch by Thiago Macieira <thiago.macieira@nokia.com> + + * WebCore.pro: + +2010-04-27 Jeremy Orlow <jorlow@chromium.org> + + Unreviewed build fix. + + Revert 58274 and 58269 (WebSQLDatabase changes) + https://bugs.webkit.org/show_bug.cgi?id=38191 + + Chromium bots are hitting ASSERTS when running layout tests. + + * platform/sql/SQLiteDatabase.cpp: + (WebCore::SQLiteDatabase::maximumSize): + (WebCore::SQLiteDatabase::freeSpaceSize): + * platform/sql/SQLiteDatabase.h: + * platform/sql/SQLiteStatement.cpp: + (WebCore::SQLiteStatement::prepare): + * storage/Database.cpp: + (WebCore::Database::performOpenAndVerify): + * storage/Database.h: + * storage/SQLTransaction.cpp: + (WebCore::SQLTransaction::postflightAndCommit): + +2010-04-27 Yuzo Fujishima <yuzo@google.com> + + Unreviewed, fix build breakage by reverting r58299. + + * css/CSSGrammar.y: + * css/CSSParser.cpp: + (WebCore::CSSParser::CSSParser): + (WebCore::CSSParser::clearProperties): + * css/CSSParser.h: + * css/CSSSelector.cpp: + (WebCore::CSSSelector::pseudoId): + (WebCore::nameToPseudoTypeMap): + (WebCore::CSSSelector::extractPseudoType): + * css/CSSSelector.h: + (WebCore::CSSSelector::): + * css/tokenizer.flex: + +2010-04-27 Yuzo Fujishima <yuzo@google.com> + + Reviewed by Shinichiro Hamaji. + + WebCore::CSSSelector::RareData::parseNth doesn't check whether the search for '-' in the argument was successful. + This results in incorrect parsing. + For example, '3n' is parsed as if it were '3n-3'. The code has been working OK just accidentally. + + https://bugs.webkit.org/show_bug.cgi?id=37787 + + No new tests are added because the original behavior is accidentally OK. + + * css/CSSSelector.cpp: + (WebCore::CSSSelector::RareData::parseNth): + +2010-04-27 Yuzo Fujishima <yuzo@google.com> + + Reviewed by David Hyatt. + + Enhance CSS parser for Paged Media (Iteration 1) + + In this change, the grammar is extended and skeletal methods for creating page rules and margin at-rules are defined. + The contents of the methods should be implemented by other changes. + + https://bugs.webkit.org/show_bug.cgi?id=35329 + + Test: fast/css/parsing-page-rule.html + + * css/CSSGrammar.y: + * css/CSSParser.cpp: + (WebCore::CSSParser::CSSParser): + (WebCore::CSSParser::clearProperties): + (WebCore::CSSParser::lex): + (WebCore::CSSParser::text): + (WebCore::CSSParser::createPageRule): + (WebCore::CSSParser::createMarginAtRule): + (WebCore::CSSParser::startDeclarationsForMarginBox): + (WebCore::CSSParser::endDeclarationsForMarginBox): + * css/CSSParser.h: + * css/CSSSelector.cpp: + (WebCore::CSSSelector::extractPseudoType): + * css/CSSSelector.h: + (WebCore::CSSSelector::): + * css/tokenizer.flex: + +2010-04-27 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Remove custom bindings for TreeWalker + https://bugs.webkit.org/show_bug.cgi?id=38182 + + This custom code is just CallWith=ScriptState. + + * WebCore.gypi: + * bindings/js/JSTreeWalkerCustom.cpp: + (WebCore::JSTreeWalker::markChildren): + * bindings/scripts/CodeGeneratorJS.pm: + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/scripts/test/TestObj.idl: + * bindings/v8/custom/V8TreeWalkerCustom.cpp: Removed. + * dom/TreeWalker.idl: + +2010-04-27 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth. + + Move code out of GenerateImplementation to make it more smaller + https://bugs.webkit.org/show_bug.cgi?id=38176 + + * bindings/scripts/CodeGeneratorJS.pm: + - Move some code into a new GenerateAttributesHashTable method. + +2010-04-26 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Add CallWith=DynamicFrame to CodeGenerator + https://bugs.webkit.org/show_bug.cgi?id=38174 + + I've only used this in one instance, but this is infrastructure that I + think will help remove a bunch of custom bindings code. Also, added a + few tests of tricky argument cases. + + * bindings/js/JSHTMLFormElementCustom.cpp: + * bindings/scripts/CodeGeneratorJS.pm: + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + (webkit_dom_test_obj_with_dynamic_frame): + (webkit_dom_test_obj_with_dynamic_frame_and_arg): + (webkit_dom_test_obj_with_dynamic_frame_and_optional_arg): + (webkit_dom_test_obj_with_dynamic_frame_and_user_gesture): + (webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad): + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::): + (WebCore::jsTestObjPrototypeFunctionWithDynamicFrame): + (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndArg): + (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg): + (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture): + (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD): + * bindings/scripts/test/JS/JSTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.mm: + (-[DOMTestObj withDynamicFrame]): + (-[DOMTestObj withDynamicFrameAndArg:]): + (-[DOMTestObj withDynamicFrameAndOptionalArg:optionalArg:]): + (-[DOMTestObj withDynamicFrameAndUserGesture:]): + (-[DOMTestObj withDynamicFrameAndUserGestureASAD:optionalArg:]): + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjInternal::withDynamicFrameCallback): + (WebCore::TestObjInternal::withDynamicFrameAndArgCallback): + (WebCore::TestObjInternal::withDynamicFrameAndOptionalArgCallback): + (WebCore::TestObjInternal::withDynamicFrameAndUserGestureCallback): + (WebCore::TestObjInternal::withDynamicFrameAndUserGestureASADCallback): + (WebCore::): + * bindings/v8/custom/V8HTMLFormElementCustom.cpp: + * html/HTMLFormElement.idl: + +2010-04-26 Adam Barth <abarth@webkit.org> + + Unreviewed. Update comment to better reflect reality. + + * bindings/scripts/test/TestObj.idl: + +2010-04-26 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Add ObjC and GObject to run-bindings-test + https://bugs.webkit.org/show_bug.cgi?id=38168 + + Added expected results. + + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: Added. + (WebKit::kit): + (webkit_dom_test_obj_void_method): + (webkit_dom_test_obj_void_method_with_args): + (webkit_dom_test_obj_int_method): + (webkit_dom_test_obj_int_method_with_args): + (webkit_dom_test_obj_obj_method): + (webkit_dom_test_obj_obj_method_with_args): + (webkit_dom_test_obj_method_with_exception): + (webkit_dom_test_obj_method_with_optional_arg): + (webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg): + (webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args): + (webkit_dom_test_obj_get_read_only_int_attr): + (webkit_dom_test_obj_get_read_only_string_attr): + (webkit_dom_test_obj_get_read_only_test_obj_attr): + (webkit_dom_test_obj_get_int_attr): + (webkit_dom_test_obj_set_int_attr): + (webkit_dom_test_obj_get_string_attr): + (webkit_dom_test_obj_set_string_attr): + (webkit_dom_test_obj_get_test_obj_attr): + (webkit_dom_test_obj_set_test_obj_attr): + (webkit_dom_test_obj_get_attr_with_exception): + (webkit_dom_test_obj_set_attr_with_exception): + (webkit_dom_test_obj_get_attr_with_setter_exception): + (webkit_dom_test_obj_set_attr_with_setter_exception): + (webkit_dom_test_obj_get_attr_with_getter_exception): + (webkit_dom_test_obj_set_attr_with_getter_exception): + (WebKit::wrapTestObj): + (WebKit::core): + (webkit_dom_test_obj_finalize): + (webkit_dom_test_obj_set_property): + (webkit_dom_test_obj_get_property): + (webkit_dom_test_obj_class_init): + (webkit_dom_test_obj_init): + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: Added. + * bindings/scripts/test/GObject/WebKitDOMTestObjPrivate.h: Added. + * bindings/scripts/test/ObjC/DOMTestObj.h: Added. + * bindings/scripts/test/ObjC/DOMTestObj.mm: Added. + (-[DOMTestObj dealloc]): + (-[DOMTestObj finalize]): + (-[DOMTestObj readOnlyIntAttr]): + (-[DOMTestObj readOnlyStringAttr]): + (-[DOMTestObj readOnlyTestObjAttr]): + (-[DOMTestObj intAttr]): + (-[DOMTestObj setIntAttr:]): + (-[DOMTestObj stringAttr]): + (-[DOMTestObj setStringAttr:]): + (-[DOMTestObj testObjAttr]): + (-[DOMTestObj setTestObjAttr:]): + (-[DOMTestObj attrWithException]): + (-[DOMTestObj setAttrWithException:]): + (-[DOMTestObj attrWithSetterException]): + (-[DOMTestObj setAttrWithSetterException:]): + (-[DOMTestObj attrWithGetterException]): + (-[DOMTestObj setAttrWithGetterException:]): + (-[DOMTestObj customAttr]): + (-[DOMTestObj setCustomAttr:]): + (-[DOMTestObj voidMethod]): + (-[DOMTestObj voidMethodWithArgs:strArg:objArg:]): + (-[DOMTestObj intMethod]): + (-[DOMTestObj intMethodWithArgs:strArg:objArg:]): + (-[DOMTestObj objMethod]): + (-[DOMTestObj objMethodWithArgs:strArg:objArg:]): + (-[DOMTestObj methodWithException]): + (-[DOMTestObj customMethod]): + (-[DOMTestObj customMethodWithArgs:strArg:objArg:]): + (-[DOMTestObj methodWithOptionalArg:]): + (-[DOMTestObj methodWithNonOptionalArgAndOptionalArg:opt:]): + (-[DOMTestObj methodWithNonOptionalArgAndTwoOptionalArgs:opt1:opt2:]): + (core): + (kit): + * bindings/scripts/test/ObjC/DOMTestObjInternal.h: Added. + +2010-04-26 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Add testing infrastructure for JSC bindings generator + https://bugs.webkit.org/show_bug.cgi?id=38167 + + This required moving the test files around a bit more. + + * bindings/scripts/test/JS/JSTestObj.cpp: Added. + (WebCore::): + (WebCore::JSTestObjConstructor::JSTestObjConstructor): + (WebCore::JSTestObjConstructor::classInfo): + (WebCore::JSTestObjConstructor::createStructure): + (WebCore::JSTestObjConstructor::getOwnPropertySlot): + (WebCore::JSTestObjConstructor::getOwnPropertyDescriptor): + (WebCore::JSTestObjPrototype::self): + (WebCore::JSTestObjPrototype::getOwnPropertySlot): + (WebCore::JSTestObjPrototype::getOwnPropertyDescriptor): + (WebCore::JSTestObj::JSTestObj): + (WebCore::JSTestObj::~JSTestObj): + (WebCore::JSTestObj::createPrototype): + (WebCore::JSTestObj::getOwnPropertySlot): + (WebCore::JSTestObj::getOwnPropertyDescriptor): + (WebCore::jsTestObjReadOnlyIntAttr): + (WebCore::jsTestObjReadOnlyStringAttr): + (WebCore::jsTestObjReadOnlyTestObjAttr): + (WebCore::jsTestObjIntAttr): + (WebCore::jsTestObjStringAttr): + (WebCore::jsTestObjTestObjAttr): + (WebCore::jsTestObjAttrWithException): + (WebCore::jsTestObjAttrWithSetterException): + (WebCore::jsTestObjAttrWithGetterException): + (WebCore::jsTestObjCustomAttr): + (WebCore::jsTestObjConstructor): + (WebCore::JSTestObj::put): + (WebCore::setJSTestObjIntAttr): + (WebCore::setJSTestObjStringAttr): + (WebCore::setJSTestObjTestObjAttr): + (WebCore::setJSTestObjAttrWithException): + (WebCore::setJSTestObjAttrWithSetterException): + (WebCore::setJSTestObjAttrWithGetterException): + (WebCore::setJSTestObjCustomAttr): + (WebCore::JSTestObj::getConstructor): + (WebCore::jsTestObjPrototypeFunctionVoidMethod): + (WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs): + (WebCore::jsTestObjPrototypeFunctionIntMethod): + (WebCore::jsTestObjPrototypeFunctionIntMethodWithArgs): + (WebCore::jsTestObjPrototypeFunctionObjMethod): + (WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs): + (WebCore::jsTestObjPrototypeFunctionMethodWithException): + (WebCore::jsTestObjPrototypeFunctionCustomMethod): + (WebCore::jsTestObjPrototypeFunctionCustomMethodWithArgs): + (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArg): + (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg): + (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs): + (WebCore::toJS): + (WebCore::toTestObj): + * bindings/scripts/test/JS/JSTestObj.h: Added. + (WebCore::JSTestObj::classInfo): + (WebCore::JSTestObj::createStructure): + (WebCore::JSTestObj::impl): + (WebCore::JSTestObjPrototype::classInfo): + (WebCore::JSTestObjPrototype::createStructure): + (WebCore::JSTestObjPrototype::JSTestObjPrototype): + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/V8/V8TestObj.cpp: Renamed from WebCore/bindings/scripts/test/V8TestObj.cpp. + (WebCore::): + (WebCore::TestObjInternal::V8_USE): + (WebCore::TestObjInternal::readOnlyIntAttrAttrGetter): + (WebCore::TestObjInternal::readOnlyStringAttrAttrGetter): + (WebCore::TestObjInternal::readOnlyTestObjAttrAttrGetter): + (WebCore::TestObjInternal::intAttrAttrGetter): + (WebCore::TestObjInternal::intAttrAttrSetter): + (WebCore::TestObjInternal::stringAttrAttrGetter): + (WebCore::TestObjInternal::stringAttrAttrSetter): + (WebCore::TestObjInternal::testObjAttrAttrGetter): + (WebCore::TestObjInternal::testObjAttrAttrSetter): + (WebCore::TestObjInternal::attrWithExceptionAttrGetter): + (WebCore::TestObjInternal::attrWithExceptionAttrSetter): + (WebCore::TestObjInternal::attrWithSetterExceptionAttrGetter): + (WebCore::TestObjInternal::attrWithSetterExceptionAttrSetter): + (WebCore::TestObjInternal::attrWithGetterExceptionAttrGetter): + (WebCore::TestObjInternal::attrWithGetterExceptionAttrSetter): + (WebCore::TestObjInternal::voidMethodCallback): + (WebCore::TestObjInternal::voidMethodWithArgsCallback): + (WebCore::TestObjInternal::intMethodCallback): + (WebCore::TestObjInternal::intMethodWithArgsCallback): + (WebCore::TestObjInternal::objMethodCallback): + (WebCore::TestObjInternal::objMethodWithArgsCallback): + (WebCore::TestObjInternal::methodWithExceptionCallback): + (WebCore::TestObjInternal::methodWithOptionalArgCallback): + (WebCore::TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback): + (WebCore::TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback): + (WebCore::TestObjInternal::overloadedMethod1Callback): + (WebCore::TestObjInternal::overloadedMethod2Callback): + (WebCore::TestObjInternal::overloadedMethod3Callback): + (WebCore::TestObjInternal::overloadedMethod4Callback): + (WebCore::TestObjInternal::overloadedMethodCallback): + (WebCore::ConfigureV8TestObjTemplate): + (WebCore::V8TestObj::GetRawTemplate): + (WebCore::V8TestObj::GetTemplate): + (WebCore::V8TestObj::toNative): + (WebCore::V8TestObj::HasInstance): + (WebCore::V8TestObj::wrap): + (WebCore::toV8): + (WebCore::V8TestObj::derefObject): + * bindings/scripts/test/V8/V8TestObj.h: Renamed from WebCore/bindings/scripts/test/V8TestObj.h. + +2010-04-26 Oliver Hunt <oliver@apple.com> + + Reviewed by Gavin Barraclough. + + Need to support more efficient dispatch of lightweight builtins + https://bugs.webkit.org/show_bug.cgi?id=38155 + + Update bindings generation to include new thunk generator field + in the property map hash tables. + + * bindings/scripts/CodeGeneratorJS.pm: + +2010-04-26 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Move bindings test directory into the scripts directory + https://bugs.webkit.org/show_bug.cgi?id=38161 + + This test is really of the bindings scripts not of the bindings + themselves. By moving the files into the scripts directory, we'll be + able to test JSC as well. + + * bindings/scripts/test/TestObj.idl: Renamed from WebCore/bindings/v8/test/TestObj.idl. + * bindings/scripts/test/V8TestObj.cpp: Renamed from WebCore/bindings/v8/test/V8TestObj.cpp. + (WebCore::): + (WebCore::TestObjInternal::V8_USE): + (WebCore::TestObjInternal::readOnlyIntAttrAttrGetter): + (WebCore::TestObjInternal::readOnlyStringAttrAttrGetter): + (WebCore::TestObjInternal::readOnlyTestObjAttrAttrGetter): + (WebCore::TestObjInternal::intAttrAttrGetter): + (WebCore::TestObjInternal::intAttrAttrSetter): + (WebCore::TestObjInternal::stringAttrAttrGetter): + (WebCore::TestObjInternal::stringAttrAttrSetter): + (WebCore::TestObjInternal::testObjAttrAttrGetter): + (WebCore::TestObjInternal::testObjAttrAttrSetter): + (WebCore::TestObjInternal::attrWithExceptionAttrGetter): + (WebCore::TestObjInternal::attrWithExceptionAttrSetter): + (WebCore::TestObjInternal::attrWithSetterExceptionAttrGetter): + (WebCore::TestObjInternal::attrWithSetterExceptionAttrSetter): + (WebCore::TestObjInternal::attrWithGetterExceptionAttrGetter): + (WebCore::TestObjInternal::attrWithGetterExceptionAttrSetter): + (WebCore::TestObjInternal::voidMethodCallback): + (WebCore::TestObjInternal::voidMethodWithArgsCallback): + (WebCore::TestObjInternal::intMethodCallback): + (WebCore::TestObjInternal::intMethodWithArgsCallback): + (WebCore::TestObjInternal::objMethodCallback): + (WebCore::TestObjInternal::objMethodWithArgsCallback): + (WebCore::TestObjInternal::methodWithExceptionCallback): + (WebCore::TestObjInternal::methodWithOptionalArgCallback): + (WebCore::TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback): + (WebCore::TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback): + (WebCore::TestObjInternal::overloadedMethod1Callback): + (WebCore::TestObjInternal::overloadedMethod2Callback): + (WebCore::TestObjInternal::overloadedMethod3Callback): + (WebCore::TestObjInternal::overloadedMethod4Callback): + (WebCore::TestObjInternal::overloadedMethodCallback): + (WebCore::ConfigureV8TestObjTemplate): + (WebCore::V8TestObj::GetRawTemplate): + (WebCore::V8TestObj::GetTemplate): + (WebCore::V8TestObj::toNative): + (WebCore::V8TestObj::HasInstance): + (WebCore::V8TestObj::wrap): + (WebCore::toV8): + (WebCore::V8TestObj::derefObject): + * bindings/scripts/test/V8TestObj.h: Renamed from WebCore/bindings/v8/test/V8TestObj.h. + +2010-04-26 Daniel Cheng <dcheng@chromium.org> + + Reviewed by Jian Li. + + [chromium] Fix ChromiumDataObject::setURL to not populate its internal URL list with empty URLs. + https://bugs.webkit.org/show_bug.cgi?id=38159 + + No new tests. + + * platform/chromium/ChromiumDataObject.h: + (WebCore::ChromiumDataObject::setURL): + +2010-04-26 Daniel Cheng <dcheng@chromium.org> + + Reviewed by Jian Li. + + [Chromium] Don't make file paths available in text/uri-list when dragging files. + https://bugs.webkit.org/show_bug.cgi?id=25882 + + Test will be checked in with WebCore/platform/mac fix. + + * platform/chromium/ClipboardChromium.cpp: + (WebCore::ClipboardChromium::getData): + (WebCore::ClipboardChromium::types): + +2010-04-26 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Darin Adler. + + REGRESSION (r57292): 1.5% page load speed regression from visited link information leak fix + https://bugs.webkit.org/show_bug.cgi?id=38131 + + I did a number of separate optimizations which speed up style + resolution enough to more than make up for the regression. This + measures as a total PLT speedup of somewhere between 1.5% and + 3.7%. + + Optimizations done: + - Cache determineLinkState results, to avoid the need to repeatedly compute + the visited link hash for the same element. This directly addresses much + of the slowdown, since all elements get their style computed twice now. + - Added a fast way to get the length of a CSSMutableStyleDeclaration, and use + in CSSStyleSelector::matchRulesForList, since it was hot there. + - Hoist some loop invariant code that's not detected by the compiler out of the + main loop in matchRulesForList + - inline CSSStyleSelector::initElement and locateSharedStyle, + since there is only one call site in each case + - Inline the common non-line fast case of determineLinkState, and split the rest into + out-of-line determineLinkStateSlowCase. + - Added inline versions of the functions called by + visitedLinkHash (the version called by determineLinkState). + + * css/CSSMutableStyleDeclaration.cpp: + (WebCore::CSSMutableStyleDeclaration::length): Implemented in terms of new + inline nonvirtual mutableLength(). + * css/CSSMutableStyleDeclaration.h: + (WebCore::CSSMutableStyleDeclaration::mutableLength): Added new nonvirtual + inline way to get the length if you know you have a mutable style decl. + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::init): Clear cached link state. + (WebCore::CSSStyleSelector::matchRulesForList): hoist some code out of the main + loop and get style decl length more efficiently. + (WebCore::CSSStyleSelector::initElement): inline (only one call site) + (WebCore::CSSStyleSelector::SelectorChecker::determineLinkState): Inline fast + case, call slow case. + (WebCore::CSSStyleSelector::SelectorChecker::determineLinkStateSlowCase): Split + most of the above function into this slow case helper. + (WebCore::CSSStyleSelector::canShareStyleWithElement): Use the cache-enabled + way to get the current link state. + (WebCore::CSSStyleSelector::locateSharedStyle): inline + (WebCore::CSSStyleSelector::styleForElement): Use the cache-enabled way + to get the current link state. + * css/CSSStyleSelector.h: + (WebCore::CSSStyleSelector::currentElementLinkState): inline way to + get link state for the current element; manages the cache + * platform/LinkHash.cpp: + (WebCore::visitedLinkHashInline): inline version of below function + (WebCore::visitedLinkHash): call the inline version + (WebCore::visitedURLInline): inline version of below function + (WebCore::visitedURL): call the inline version + (WebCore::visitedURL): call inline versions of above two functions + +2010-04-26 Sam Weinig <sam@webkit.org> + + Reviewed by Alexey Proskuryakov. + + Remove last use of WEB_THREAD. + + * platform/mac/WebCoreObjCExtras.mm: + (WebCoreObjCScheduleDeallocateOnMainThread): This can always use + isMainThread(). + +2010-04-26 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Dimitri Glazkov. + + Turn on AUTO_VACUUM = INCREMENTAL for all HTML5 databases, and + vacuum all databases when the number of free pages is at least 10% + of the number of total pages. Also, adding a guard against a bug + that was fixed in SQLite only starting with version 3.6.16. + + https://bugs.webkit.org/show_bug.cgi?id=36251 + + * platform/sql/SQLiteDatabase.cpp: + (WebCore::SQLiteDatabase::totalSize): + (WebCore::SQLiteDatabase::runIncrementalVacuumCommand): + (WebCore::SQLiteDatabase::turnOnIncrementalAutoVacuum): + * platform/sql/SQLiteDatabase.h: + * platform/sql/SQLiteStatement.cpp: + (WebCore::SQLiteStatement::prepare): + * storage/Database.cpp: + (WebCore::Database::performOpenAndVerify): + (WebCore::Database::incrementalVacuumIfNeeded): + * storage/Database.h: + * storage/SQLTransaction.cpp: + (WebCore::SQLTransaction::postflightAndCommit): + +2010-04-26 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Sam Weinig. + + <rdar://problem/7766413> + + Fixed a crash seen when using the JavaScriptCore API with WebKit. + + No layout test because DumpRenderTree doesn't use the JavaScriptCore API + in this way. + + * bindings/js/JSEventListener.cpp: + (WebCore::JSEventListener::JSEventListener): Don't assign 0 to a WeakGCPtr. + JavaScriptCore no longer allows this. + + * bindings/js/ScriptWrappable.h: + (WebCore::ScriptWrappable::setWrapper): No need to initialize a WeakGCPtr + to 0, or ASSERT a non-0 value before assigning to a WeakGCPtr -- both are + default behaviors. + +2010-04-25 Sam Weinig <sam@webkit.org> + + Reviewed by Maciej Stachowiak. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=38097 + Disentangle initializing the main thread from initializing threading + + * WebCore.xcodeproj/project.pbxproj: Sort files. + + * accessibility/mac/AccessibilityObjectWrapper.mm: Remove unnessary + +initialize method. The AccessibilityObjectWrapper has no data members + that need to be derefed, so it does not need to be finalized on the main + thread. + + * bindings/js/ScriptController.cpp: + (WebCore::ScriptController::initializeThreading): Add call to initializeMainThread. + * bindings/objc/WebScriptObject.mm: + (+[WebScriptObject initialize]): Add call to initializeMainThreadToProcessMainThread. + * bindings/v8/ScriptController.cpp: + (WebCore::ScriptController::initializeThreading): Add call to initializeMainThread. + * platform/mac/SharedBufferMac.mm: + (+[WebCoreSharedBufferData initialize]): Add call to initializeMainThreadToProcessMainThread. + +2010-04-26 Yongjun Zhang <yongjun_zhang@apple.com> + + Reviewed by Alexey Proskuryakov. + + https://bugs.webkit.org/show_bug.cgi?id=38128 + Don't add empty credential to CredentialStorage. + + An empty credential is currently regarded as a invalid login because it means a missing value in + protectionSpaceToCredentialMap. This change makes it consistent with current WebCore's behavior + by ignoring empty credentials. + + No new tests added since this only affects credential entered by user from credential dialog, + which is not testable in DRT. + + * platform/network/mac/ResourceHandleMac.mm: + (WebCore::ResourceHandle::receivedCredential): + +2010-04-26 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Clean-up WebCore.pro after now that JavaScriptCore is built separately + https://bugs.webkit.org/show_bug.cgi?id=38123 + + HAVE_STDINT_H, and HAVE_PTHREAD_NP_H no longer needs to be defined + for QtWebKit as JavaScriptCore is built separately. These defines are only + used by JavaScriptCore and for JavaScriptCore these are already + properly defined in JavaScriptCore/config.h. + + No new tests, no new functionality. + + * WebCore.pro: + +2010-04-26 Roman Gershman <romange@google.com> + + Reviewed by Adam Barth. + + [Chromium] Font size in suggestions popup menu should be correlated with the font size of its text field. + The following manual test checks for desired behavior. + + https://bugs.webkit.org/show_bug.cgi?id=37977 + + * manual-tests/chromium/suggestions-popup-font-change.html: Added. + +2010-04-26 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Kenneth Rohde Christiansen. + + View modes names in CSSValueKeywords.in + https://bugs.webkit.org/show_bug.cgi?id=38125 + + View mode names has changed in previous patch but CSSValueKeywords.in file was + not updated. + + * css/CSSValueKeywords.in: + +2010-04-26 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Fix compilation with RVCT 4 + https://bugs.webkit.org/show_bug.cgi?id=37727 + + Swap extern and declspec to fix visibility of symbol imported from QtGui. + + * page/qt/EventHandlerQt.cpp: + +2010-04-26 Ruben Van Boxem <vanboxem.ruben@gmail.com> + + Reviewed by Adam Roben. + + Fixes for Win64 compilation under gcc (mingw-w64) + + * WebCore/bridge/npapi.h: for win64 compatibility, mirroring mozilla-central, see Mozilla bug 560298 + * WebCore/platform/Arena.h: uword is used to cast from pointers here. unsigned long is 32-bit on Windows (but 64-bit on mac), and too small to hold a pointer. uintptr_t is 32-bit on 32-bit systems (mac, linux and windows) and 64-bit on all 64-bit systems + * WebCore/platform/graphics/transforms/TransformationMatrix.h: let mingw-w64/w32 use MSVC codepath + * WebCore/platform/text/TextStream.cpp: let mingw-w64 use MSVC codepath + * WebCore/platform/text/TextStream.h: let mingw-w64 use MSVC codepath + * WebCore/plugins/PluginView.cpp: fix pointer casts on WIN64 and let mingw-w64 use MSVC codepath + * WebCore/plugins/win/PluginViewWin.cpp: fix pointer casts on WIN64 + +2010-04-26 Markus Goetz <Markus.Goetz@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] HTTP pipelining efficiency increase + https://bugs.webkit.org/show_bug.cgi?id=38062 + + Increase number of network requests that are fed into + QNetworkAccessManager. + + * platform/network/qt/ResourceRequestQt.cpp: + (WebCore::initializeMaximumHTTPConnectionCountPerHost): + +2010-04-26 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: undefined shows up on inspector. + https://bugs.webkit.org/show_bug.cgi?id=38120 + + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype.hide): + * inspector/front-end/SourceFrame.js: + (WebInspector.SourceFrame.prototype.set visible): + +2010-04-26 Bruno Schmidt <bruno.schmidt@gmail.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Exposing an QVariantMap containing QObjectStar to Javascript + causes Segmentation Fault + https://bugs.webkit.org/show_bug.cgi?id=34729 + + If an QVariantMap containing QObjectStar is added to the to QtWebkit + Javascript, it's use causes Segmentation Fault. + It happens because, in the case QMetaType::QVariantMap, the "root" + object that is inside of a PassRefPtr is passed recursively inside a + loop to recover the content of the map, but the PassRefPtr semantics + prohibit its use inside a loop, so the "root" object mus be passed + using the method "PassRefPtr::get" in order to keep the current + reference. + + * bridge/qt/qt_runtime.cpp: + (JSC::Bindings::convertValueToQVariant): + (JSC::Bindings::convertQVariantToValue): change to root.get() + +2010-04-26 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: Render clip in summary bar using "arc", not "quadraticCurveTo". + + https://bugs.webkit.org/show_bug.cgi?id=38107 + + * inspector/front-end/SummaryBar.js: + (WebInspector.SummaryBar.prototype._drawSummaryGraph.drawPill): + (WebInspector.SummaryBar.prototype._drawSummaryGraph): + +2010-04-26 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] Fix compilation against Qt 4.7 + + Some QtMultimedia things have been moved into QtMediaServices + https://bugs.webkit.org/show_bug.cgi?id=38111 + + * WebCore.pro: + * platform/graphics/qt/MediaPlayerPrivateQt.cpp: + (WebCore::MediaPlayerPrivate::supportsType): + (WebCore::MediaPlayerPrivate::totalBytes): + +2010-04-26 Zoltan Herczeg <zherczeg@webkit.org> + + Reviewed by Dirk Schulze. + + Call setStrokeStyle in applyStrokeStyleToContext + https://bugs.webkit.org/show_bug.cgi?id=37849 + + Not all platforms set the stroke style to solid if they + get an empty line dash array. Some just ignore the operation. + + * rendering/SVGRenderSupport.cpp: + (WebCore::applyStrokeStyleToContext): + +2010-04-23 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + WebInspector: Aggregated stats of time spent in children records should be visible + in the popup panel of parent record. Crash in pushGCEventRecord also was fixed. + https://bugs.webkit.org/show_bug.cgi?id=37820 + + * English.lproj/localizedStrings.js: + * inspector/InspectorTimelineAgent.cpp: + (WebCore::InspectorTimelineAgent::pushGCEventRecords): + * inspector/front-end/TimelinePanel.js: + (WebInspector.TimelinePanel.prototype._innerAddRecordToTimeline): + (WebInspector.TimelinePanel.prototype._createRootRecord): + (WebInspector.TimelinePanel.prototype._showPopover): + (WebInspector.TimelineCalculator.prototype.computeBarGraphPercentages): + (WebInspector.TimelineCalculator.prototype.computeBarGraphWindowPosition): + (WebInspector.TimelineRecordGraphRow): + (WebInspector.TimelineRecordGraphRow.prototype.update): + (WebInspector.TimelinePanel.FormattedRecord): + (WebInspector.TimelinePanel.FormattedRecord.prototype._generateAggregatedInfo): + (WebInspector.TimelinePanel.FormattedRecord.prototype._generatePopupContent): + (WebInspector.TimelinePanel.FormattedRecord.prototype._getRecordDetails): + (WebInspector.TimelinePanel.FormattedRecord.prototype._calculateAggregatedStats): + * inspector/front-end/inspector.css: + (.timeline-graph-bar.with-children): + (.timeline-graph-bar.cpu): + (.timeline-aggregated-category): + (.timeline-loading): + (.timeline-scripting): + (.timeline-rendering): + (.popover .timeline-aggregated-category.timeline-loading): + (.timeline-details-title): + +2010-04-25 Kent Tamura <tkent@chromium.org> + + Reviewed by Darin Adler. + + WebKit crashes with deeply nested divs + https://bugs.webkit.org/show_bug.cgi?id=18282 + + The HTML parser caps a tree depth by MAX_DOM_TREE_DEPTH defined in + TreeDepthLimit.h. This is performance-efficient, but does not work for + DOM operations such as Node.appendChild(). + + Test: fast/parser/element-nesting-cap.html + + * dom/Node.h: + * dom/XMLTokenizer.cpp: + (WebCore::XMLTokenizer::pushCurrentNode): + * html/HTMLParser.cpp: + + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * dom/TreeDepthLimit.h: + Added. Define MAX_DOM_TREE_DEPTH. The default value is 5000. + * dom/XMLTokenizer.cpp: Use maxDOMTreeDepth. + (WebCore::XMLTokenizer::pushCurrentNode): + * html/HTMLParser.cpp: + Introduce m_treeDepth, which counts the depth of the tree. + Unlike m_blocksInStack, it contains the number of non-block nodes. + (WebCore::HTMLParser::HTMLParser): + (WebCore::HTMLParser::reset): + (WebCore::HTMLParser::limitDepth): + Renamed from limitBlockDepth. Add check for m_nodeDepth. + (WebCore::HTMLParser::insertNodeAfterLimitDepth): + Renamed from insertNodeAfterLimitBlockDepth. + (WebCore::HTMLParser::parseToken): + (WebCore::HTMLParser::handleResidualStyleCloseTagAcrossBlocks): + (WebCore::HTMLParser::pushBlock): + (WebCore::HTMLParser::popOneBlockCommon): + (WebCore::HTMLParser::freeBlock): + * html/HTMLParser.h: + +2010-04-25 Andrey Kosyakov <caseq@chromium.org> + + Reviewed by Adam Barth. + + Get context properly when event handler was created on + the main world. + https://bugs.webkit.org/show_bug.cgi?id=37947 + + Test: http/tests/security/isolatedWorld/dispatchEvent.html + + * bindings/v8/WorldContextHandle.cpp: + (WebCore::WorldContextHandle::adjustedContext): + +2010-04-25 yael aharon <yael.aharon@nokia.com> + + Reviewed by Adele Peterson. + + Allow styling of HTMLProgressElement. + https://bugs.webkit.org/show_bug.cgi?id=37901 + + Added a new pseudo element to represent the value portion of the progress element. + Web developers can style this pseudo element separate from the rest of the progress element. + + Test: fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element.html + + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): + * css/CSSSelector.cpp: + (WebCore::CSSSelector::pseudoId): + (WebCore::nameToPseudoTypeMap): + (WebCore::CSSSelector::extractPseudoType): + * css/CSSSelector.h: + * css/CSSValueKeywords.in: + * platform/ThemeTypes.h: + * rendering/RenderProgress.cpp: + (WebCore::ProgressValueElement::isShadowNode): + (WebCore::ProgressValueElement::shadowParentNode): + (WebCore::ProgressValueElement::ProgressValueElement): + (WebCore::RenderProgress::RenderProgress): + (WebCore::RenderProgress::~RenderProgress): + (WebCore::RenderProgress::layout): + (WebCore::RenderProgress::styleDidChange): + (WebCore::RenderProgress::updateFromElement): + (WebCore::RenderProgress::updateValuePartState): + (WebCore::RenderProgress::createStyleForValuePart): + (WebCore::RenderProgress::updateAnimationState): + * rendering/RenderTheme.cpp: + (WebCore::RenderTheme::isControlStyled): + * rendering/RenderProgress.h: + * rendering/style/RenderStyleConstants.h: + +2010-04-24 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + Don't propagate compositing out of iframes on Mac + https://bugs.webkit.org/show_bug.cgi?id=38072 + + Propagating compositing out of iframes caused too many regressions on Mac, + so only do it for other platforms that may need to hook compositing layers + together across iframe boundaries. + + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::requiresCompositingForIFrame): + +2010-04-24 Anton Muhin <antonm@chromium.org> + + Reviewed by Darin Adler. + + Allow to construct HashTraits<WebCore::QualifiedName>::constructDeletedValue + + Former implementation attempted to use AtomicString(HashTableDeletedValue) + however those values cannot be used that way: one cannot construct + QualifiedNameImpl out of such AtomicString as we'll try to lookup this string + in the table, for example. + https://bugs.webkit.org/show_bug.cgi?id=37722 + + * dom/QualifiedName.cpp: + (WebCore::QualifiedName::deref): check that hash table deleted values never derefed + * dom/QualifiedName.h: + (WebCore::QualifiedName::QualifiedName): add a constructor to create hash table deleted values + (WebCore::QualifiedName::isHashTableDeletedValue): add a check if given instance is hash table deleted value + (WTF::): + +2010-04-24 Julien Chaffraix <jchaffraix@webkit.org> + + Reviewed by Alexey Proskuryakov. + + protocolHostAndPortEquals host check makes a wrong assumption + https://bugs.webkit.org/show_bug.cgi?id=37777 + + The host check assumed that both host started at the same position. This is true + if both URL are the same but sometimes one has credential and the other does not. + In this case, the method would compare invalid positions. + + Test: http/tests/appcache/credential-url.html + + * platform/KURL.cpp: + (WebCore::protocolHostAndPortAreEqual): + * platform/KURLGoogle.cpp: + (WebCore::protocolHostAndPortAreEqual): + Fix the host check to take both URL's credential into account. + +2010-04-24 Nikolas Zimmermann <nzimmermann@rim.com> + + Not reviewed. Fix linkage on several bots (no idea, why it worked in a from-scratch rebuild on Leopard on my machine!) -> include NodeRenderStyle.h + Having to include NodeRenderStyle.h just to pull in the renderStyle() is a crazy concept, but I see what it tries to avoid (including RenderObject.h in Node.h) + + * rendering/SVGRenderSupport.cpp: + +2010-04-24 Nikolas Zimmermann <nzimmermann@rim.com> + + Not reviewed. Fix release builds, wrap resourceMode assertion in NDEBUG blocks, use UNUSED_PARAM() otherwhise. + + * rendering/RenderSVGResourceClipper.cpp: + (WebCore::RenderSVGResourceClipper::applyResource): + * rendering/RenderSVGResourceFilter.cpp: + (WebCore::RenderSVGResourceFilter::applyResource): + (WebCore::RenderSVGResourceFilter::postApplyResource): + * rendering/RenderSVGResourceMasker.cpp: + (WebCore::RenderSVGResourceMasker::applyResource): + +2010-04-24 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Dirk Schulze. + + SVGPaintServer needs to be converted to the new RenderSVGResource* system + https://bugs.webkit.org/show_bug.cgi?id=37986 + + Huge speedup for SVG painting using paint servers (gradient/patterns). Cache underlying + WebCore::Gradient/Pattern datastructures, do not rebuild them on every painting. This marks + the finish of the SVGResource -> RenderSVGResource transition. + + Outline of same key changes: + - RenderSVGResource is an abstract base class now, and the previous class is now named RenderSVGResourceContainer + All resources except RenderSVGResourceSolidColor now inherit from RenderSVGResourceContainer, as they are all + associated with a SVG*Element class. RenderSVGResourceSolidColor inherits from RenderSVGResource, and is not + associated with any SVG*Element class. RenderSVGResourceSolidColor is not a render tree object, despite its name. + The reason for that is consistency with all other painting resources. + - RenderSVGResourceSolidColor does not live in the render tree, and exists only as static object, which is shared + and always used when filling/stroking with solid colors - just like the old SVGPaintServerSolid. + - RenderSVGResourceGradient/RenderSVGResourcePattern now store the underlying WebCore::Gradient/Pattern object + instead of rebuilding it everytime we're asked to paint -> this is the main difference with the old concept, leading + to much faster speed. + - SVGResource has vanished. All resources (clipper/filter/marker/masker/gradient/pattern) now share the same codepaths + to handle updates and client invalidation - which is a huge benefit, and makes the code easier to understand. + + * Android.mk: Remove svg/graphics/SVGResource*, svg/graphics/SVGPaintServer.h from build. + * GNUmakefile.am: Ditto. + * WebCore.gypi: Ditto. + * WebCore.pro: Ditto. + * WebCore.vcproj/WebCore.vcproj: Ditto. + * WebCore.xcodeproj/project.pbxproj: Ditto. + * platform/graphics/Gradient.cpp: Add addColorStop() method taking a ColorStop const-reference. + (WebCore::Gradient::addColorStop): + * platform/graphics/Gradient.h: Ditto. + * platform/graphics/TextRun.h: Rename SVGPaintServer to RenderSVGResource + (WebCore::TextRun::TextRun): + (WebCore::TextRun::activePaintingResource): Renamed from activePaintServer. + (WebCore::TextRun::setActivePaintingResource): Renamed from setActivePaintServer. + * platform/graphics/win/GraphicsContextWin.cpp: Remove references to SVGResourceImage, which was removed a long time ago. + * rendering/RenderObject.cpp: + (WebCore::RenderObject::toRenderSVGResourceContainer): Renamed from toRenderSVGResource(). + * rendering/RenderObject.h: + (WebCore::RenderObject::isSVGGradientStop): Added. + (WebCore::RenderObject::isSVGResourceContainer): Renamed from isSVGResource(). + * rendering/RenderPath.cpp: Utilize RenderSVGResource::fill/strokePaintingResource to request paint servers, instead of SVGPaintServer. + (WebCore::RenderPath::fillContains): Adapt to new concept. + (WebCore::RenderPath::strokeContains): Ditto. + (WebCore::fillAndStrokePath): Ditto. + (WebCore::RenderPath::paint): Ditto. + * rendering/RenderSVGGradientStop.cpp: + (WebCore::RenderSVGGradientStop::styleDidChange): Ditto. + * rendering/RenderSVGGradientStop.h: Fixed indention. + * rendering/RenderSVGResource.cpp: Refactored old SVGPaintServer code to request fill/stroke painting resources, splitted up in several methods to aid readability. + (WebCore::registerPendingResource): + (WebCore::adjustColorForPseudoRules): + (WebCore::RenderSVGResource::fillPaintingResource): + (WebCore::RenderSVGResource::strokePaintingResource): + (WebCore::RenderSVGResource::sharedSolidPaintingResource): + (WebCore::RenderSVGResource::markForLayoutAndResourceInvalidation): + * rendering/RenderSVGResource.h: Make RenderSVGResource an abstract base class, see above for the reasoning. + (WebCore::RenderSVGResource::RenderSVGResource): + (WebCore::RenderSVGResource::~RenderSVGResource): + (WebCore::RenderSVGResource::postApplyResource): + * rendering/RenderSVGResourceClipper.cpp: Inherit from RenderSVGResourceContainer instead of RenderSVGResource. + (WebCore::RenderSVGResourceClipper::RenderSVGResourceClipper): + (WebCore::RenderSVGResourceClipper::invalidateClient): + (WebCore::RenderSVGResourceClipper::applyResource): Adapt to signature changes (add RenderStyle* and resource mode parameters) + (WebCore::RenderSVGResourceClipper::applyClippingToContext): + * rendering/RenderSVGResourceClipper.h: + * rendering/RenderSVGResourceContainer.h: Added. Renamed from RenderSVGResource. Now inherits from RenderSVGHiddenContainer and RenderSVGResource. + (WebCore::RenderSVGResourceContainer::RenderSVGResourceContainer): + (WebCore::RenderSVGResourceContainer::~RenderSVGResourceContainer): + (WebCore::RenderSVGResourceContainer::idChanged): + (WebCore::RenderSVGResourceContainer::isSVGResourceContainer): + (WebCore::RenderSVGResourceContainer::drawsContents): + (WebCore::RenderSVGResourceContainer::toRenderSVGResourceContainer): + (WebCore::getRenderSVGResourceContainerById): + (WebCore::getRenderSVGResourceById): + * rendering/RenderSVGResourceFilter.cpp: Inherit from RenderSVGResourceContainer instead of RenderSVGResource. + (WebCore::RenderSVGResourceFilter::RenderSVGResourceFilter): + (WebCore::RenderSVGResourceFilter::invalidateClient): + (WebCore::RenderSVGResourceFilter::applyResource): Adapt to signature changes (add RenderStyle* and resource mode parameters) + (WebCore::RenderSVGResourceFilter::postApplyResource): + * rendering/RenderSVGResourceFilter.h: + * rendering/RenderSVGResourceGradient.cpp: Moved from SVGPaintServerGradient, cleaned up and refactored. + (WebCore::RenderSVGResourceGradient::RenderSVGResourceGradient): + (WebCore::RenderSVGResourceGradient::~RenderSVGResourceGradient): + (WebCore::RenderSVGResourceGradient::invalidateClients): + (WebCore::RenderSVGResourceGradient::invalidateClient): + (WebCore::createMaskAndSwapContextForTextGradient): + (WebCore::clipToTextMask): + (WebCore::RenderSVGResourceGradient::applyResource): + * rendering/RenderSVGResourceGradient.h: + (WebCore::RenderSVGResourceGradient::resourceBoundingBox): + * rendering/RenderSVGResourceLinearGradient.cpp: Moved from SVGPaintServerLinearGradient, cleaned up and refactored. + (WebCore::RenderSVGResourceLinearGradient::RenderSVGResourceLinearGradient): + (WebCore::RenderSVGResourceLinearGradient::~RenderSVGResourceLinearGradient): + (WebCore::RenderSVGResourceLinearGradient::buildGradient): + * rendering/RenderSVGResourceLinearGradient.h: + (WebCore::RenderSVGResourceLinearGradient::renderName): + (WebCore::RenderSVGResourceLinearGradient::resourceType): + * rendering/RenderSVGResourceMarker.cpp: Inherit from RenderSVGResourceContainer instead of RenderSVGResource. + (WebCore::RenderSVGResourceMarker::RenderSVGResourceMarker): + (WebCore::RenderSVGResourceMarker::invalidateClient): + * rendering/RenderSVGResourceMarker.h: + (WebCore::RenderSVGResourceMarker::applyResource): + * rendering/RenderSVGResourceMasker.cpp: Inherit from RenderSVGResourceContainer instead of RenderSVGResource. + (WebCore::RenderSVGResourceMasker::RenderSVGResourceMasker): + (WebCore::RenderSVGResourceMasker::invalidateClient): + (WebCore::RenderSVGResourceMasker::applyResource): + * rendering/RenderSVGResourceMasker.h: + (WebCore::MaskerData::MaskerData): + * rendering/RenderSVGResourcePattern.cpp: Moved from SVGPaintServerPattern, cleaned up and refactored. + (WebCore::RenderSVGResourcePattern::RenderSVGResourcePattern): + (WebCore::RenderSVGResourcePattern::~RenderSVGResourcePattern): + (WebCore::RenderSVGResourcePattern::invalidateClients): + (WebCore::RenderSVGResourcePattern::invalidateClient): + (WebCore::RenderSVGResourcePattern::applyResource): + (WebCore::RenderSVGResourcePattern::postApplyResource): + (WebCore::calculatePatternBoundaries): + (WebCore::RenderSVGResourcePattern::calculatePatternBoundariesIncludingOverflow): + (WebCore::RenderSVGResourcePattern::createTileImage): + (WebCore::RenderSVGResourcePattern::buildPattern): + * rendering/RenderSVGResourcePattern.h: + (WebCore::RenderSVGResourcePattern::renderName): + (WebCore::RenderSVGResourcePattern::resourceBoundingBox): + (WebCore::RenderSVGResourcePattern::resourceType): + * rendering/RenderSVGResourceRadialGradient.cpp: Moved from SVGPaintServerRadialGradient, cleaned up and refactored. + (WebCore::RenderSVGResourceRadialGradient::RenderSVGResourceRadialGradient): + (WebCore::RenderSVGResourceRadialGradient::~RenderSVGResourceRadialGradient): + (WebCore::RenderSVGResourceRadialGradient::buildGradient): + * rendering/RenderSVGResourceRadialGradient.h: + (WebCore::RenderSVGResourceRadialGradient::renderName): + (WebCore::RenderSVGResourceRadialGradient::resourceType): + * rendering/RenderSVGResourceSolidColor.cpp: Moved from SVGPaintServerSolid, cleaned up and refactored. + (WebCore::RenderSVGResourceSolidColor::RenderSVGResourceSolidColor): + (WebCore::RenderSVGResourceSolidColor::~RenderSVGResourceSolidColor): + (WebCore::RenderSVGResourceSolidColor::applyResource): + (WebCore::RenderSVGResourceSolidColor::postApplyResource): + * rendering/RenderSVGResourceSolidColor.h: + (WebCore::RenderSVGResourceSolidColor::invalidateClients): + (WebCore::RenderSVGResourceSolidColor::invalidateClient): + (WebCore::RenderSVGResourceSolidColor::resourceBoundingBox): + (WebCore::RenderSVGResourceSolidColor::resourceType): + (WebCore::RenderSVGResourceSolidColor::color): + (WebCore::RenderSVGResourceSolidColor::setColor): + * rendering/RenderSVGText.cpp: + (WebCore::RenderSVGText::paint): Early exit if painting is disabled. + * rendering/RenderTreeAsText.cpp: + (WebCore::write): Add RenderSVGGradientStop dumping. + (WebCore::externalRepresentation): Remove SVGResource dumping. + * rendering/SVGInlineTextBox.cpp: Adapt to SVGPaintServer changes (paint server request). + (WebCore::SVGInlineTextBox::paintCharacters): + (WebCore::SVGInlineTextBox::paintDecoration): + * rendering/SVGInlineTextBox.h: Ditto. + (WebCore::SVGTextPaintInfo::SVGTextPaintInfo): + * rendering/SVGRenderSupport.cpp: Ditto. + (WebCore::SVGRenderBase::prepareToRenderSVGContent): + (WebCore::SVGRenderBase::finishRenderSVGContent): + (WebCore::invalidatePaintingResource): + (WebCore::deregisterFromResources): + (WebCore::dashArrayFromRenderingStyle): Moved here from SVGPaintServer. + (WebCore::applyStrokeStyleToContext): Ditto. + * rendering/SVGRenderSupport.h: + * rendering/SVGRenderTreeAsText.cpp: Add new gradient/pattern dumping code. Stops are now properly dumped as well! + (WebCore::operator<<): + (WebCore::writeSVGPaintingResource): + (WebCore::writeStyle): + (WebCore::boundingBoxModeString): + (WebCore::writeCommonGradientProperties): + (WebCore::writeSVGResourceContainer): + (WebCore::writeSVGGradientStop): + * rendering/SVGRenderTreeAsText.h: + * rendering/SVGRootInlineBox.cpp: Adapt to SVGPaintServer changes (paint server request). + (WebCore::SVGRootInlineBoxPaintWalker::SVGRootInlineBoxPaintWalker): + (WebCore::SVGRootInlineBoxPaintWalker::~SVGRootInlineBoxPaintWalker): + (WebCore::SVGRootInlineBoxPaintWalker::teardownFillPaintServer): + (WebCore::SVGRootInlineBoxPaintWalker::teardownStrokePaintServer): + (WebCore::SVGRootInlineBoxPaintWalker::setupBackground): + (WebCore::SVGRootInlineBoxPaintWalker::setupFill): + (WebCore::SVGRootInlineBoxPaintWalker::setupFillSelection): + (WebCore::SVGRootInlineBoxPaintWalker::setupStroke): + (WebCore::SVGRootInlineBoxPaintWalker::setupStrokeSelection): + (WebCore::SVGRootInlineBoxPaintWalker::setupForeground): + (WebCore::SVGRootInlineBoxPaintWalker::activePaintingResource): + (WebCore::SVGRootInlineBoxPaintWalker::paintChunk): + * svg/GradientAttributes.h: Remove SVGGradientStop, use Gradient::ColorStop vector. Cleanup. + (WebCore::GradientAttributes::stops): + (WebCore::GradientAttributes::setStops): + * svg/LinearGradientAttributes.h: Move ENABLE(SVG) guard to correct location. + * svg/PatternAttributes.h: Add missing includes and class forwards. + * svg/RadialGradientAttributes.h: Move ENABLE(SVG) guard to correct location. + * svg/SVGClipPathElement.cpp: Rename invalidateCanvasResources() to invalidateResourceClients(). + (WebCore::SVGClipPathElement::svgAttributeChanged): + (WebCore::SVGClipPathElement::childrenChanged): Only call invalidateResourceClients() when !changedByParser is set. + * svg/SVGClipPathElement.h: + * svg/SVGDocumentExtensions.cpp: Change HashMaps to hash AtomicStrings instead of Strings. Rename RenderSVGResource to RenderSVGResourceContainer. + (WebCore::SVGDocumentExtensions::addResource): + (WebCore::SVGDocumentExtensions::removeResource): + (WebCore::SVGDocumentExtensions::resourceById): + (WebCore::SVGDocumentExtensions::addPendingResource): + * svg/SVGDocumentExtensions.h: + * svg/SVGElement.cpp: + (WebCore::SVGElement::insertedIntoDocument): Remove reference to SVGResource::invalidateClients(), handled differently now. + (WebCore::SVGElement::updateAnimatedSVGAttribute): Change assertion, that is incorrect now. + * svg/SVGElement.h: Make updateAnimatedSVGAttribute() public. + * svg/SVGFont.cpp: Adapt to SVGPaintServer changes (paint server request). + (WebCore::Font::drawTextUsingSVGFont): + * svg/SVGGElement.cpp: If style()->display() is NONE, create a RenderSVGHiddenContainer, removing hacks in SVGStopElement for pservers-grad-19-b.svg (yes, SVG is crazy.) + (WebCore::SVGGElement::createRenderer): + * svg/SVGGElement.h: Remove childrenChanged() method which _always_ called renderer->setNeedsLayout(true), which is completly wrong and unnecessary. + (WebCore::SVGGElement::rendererIsNeeded): Always return true. + * svg/SVGGradientElement.cpp: Adapt to new RenderSVGResourceGradient code. + (WebCore::SVGGradientElement::svgAttributeChanged): + (WebCore::SVGGradientElement::childrenChanged): Only call invalidateResourceClients() when !changedByParser is set. + (WebCore::SVGGradientElement::buildStops): + * svg/SVGGradientElement.h: + * svg/SVGLinearGradientElement.cpp: Adapt to new RenderSVGResourceLinearGradient code. + (WebCore::SVGLinearGradientElement::svgAttributeChanged): + (WebCore::SVGLinearGradientElement::createRenderer): + (WebCore::SVGLinearGradientElement::collectGradientProperties): + (WebCore::SVGLinearGradientElement::calculateStartEndPoints): + * svg/SVGLinearGradientElement.h: + * svg/SVGMarkerElement.cpp: Rename invalidateCanvasResources() to invalidateResourceClients(). + (WebCore::SVGMarkerElement::svgAttributeChanged): + (WebCore::SVGMarkerElement::childrenChanged): Only call invalidateResourceClients() when !changedByParser is set. + (WebCore::SVGMarkerElement::setOrientToAuto): + (WebCore::SVGMarkerElement::setOrientToAngle): + * svg/SVGMaskElement.cpp: Rename invalidateCanvasResources() to invalidateResourceClients(). + (WebCore::SVGMaskElement::svgAttributeChanged): + (WebCore::SVGMaskElement::childrenChanged): Only call invalidateResourceClients() when !changedByParser is set. + * svg/SVGPatternElement.cpp: Rename invalidateCanvasResources() to invalidateResourceClients(). + (WebCore::SVGPatternElement::svgAttributeChanged): + (WebCore::SVGPatternElement::childrenChanged): Only call invalidateResourceClients() when !changedByParser is set. + (WebCore::SVGPatternElement::createRenderer): + * svg/SVGPatternElement.h: + * svg/SVGPolyElement.h: Remove unneded rendererIsNeeded() override. + * svg/SVGRadialGradientElement.cpp: Adapt to new RenderSVGResourceRadialGradient code. + (WebCore::SVGRadialGradientElement::svgAttributeChanged): + (WebCore::SVGRadialGradientElement::createRenderer): + (WebCore::SVGRadialGradientElement::collectGradientProperties): + (WebCore::SVGRadialGradientElement::calculateFocalCenterPointsAndRadius): + * svg/SVGRadialGradientElement.h: + * svg/SVGStopElement.cpp: Clean up code, moved stop color calculation from SVGGradientElement to here, where it belongs. + (WebCore::SVGStopElement::parseMappedAttribute): + (WebCore::SVGStopElement::stopColorIncludingOpacity): + * svg/SVGStopElement.h: + * svg/SVGStyledElement.cpp: + (WebCore::SVGStyledElement::~SVGStyledElement): + (WebCore::SVGStyledElement::svgAttributeChanged): Only invalidateResourcesInAncestorChain()/deregisterFromResources() when we're not parsing. + (WebCore::SVGStyledElement::invalidateResourcesInAncestorChain): Early exit if we find a parent resources, there is no resource nesting. + (WebCore::SVGStyledElement::invalidateResourceClients): Renamed from invalidateCanvasResources() + (WebCore::SVGStyledElement::childrenChanged): Only invalidate SVGElementInstances when !changedByParser is set. + * svg/SVGStyledElement.h: Remove canvasResource() logic, remove detach() method. + * svg/SVGTextPathElement.h: + * svg/graphics/SVGPaintServer.h: Removed. + * svg/graphics/SVGResource.cpp: Removed. + * svg/graphics/SVGResource.h: Removed. + +2010-04-23 Zhenyao Mo <zmo@google.com> + + Reviewed by Darin Fisher. + + Add isGLES2Compliant to GraphicsContext3D: make the method const. + https://bugs.webkit.org/show_bug.cgi?id=37872 + + * platform/graphics/GraphicsContext3D.h: Make isGLES2Compliant() const. + * platform/graphics/mac/GraphicsContext3DMac.cpp: Ditto. + (WebCore::GraphicsContext3D::isGLES2Compliant): + +2010-04-23 Qi Zhang <qi.2.zhang@nokia.com> + + Reviewed by Laszlo Gombos. + + [Qt] LayoutTests/fast/canvas/pointInPath.html passed, actually it failed + https://bugs.webkit.org/show_bug.cgi?id=37276 + + QPainterPath::contains doesn't count the point on the bound. + + * platform/graphics/qt/PathQt.cpp: + (WebCore::isPointOnPathBorder): + (WebCore::Path::contains): + +2010-04-23 Sam Weinig <sam@webkit.org> + + Reviewed by David Levin. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=38060 + Split up Threading.h + + Add necessary forwarding headers. + + * ForwardingHeaders/wtf/Atomics.h: Added. + * ForwardingHeaders/wtf/ThreadSafeShared.h: Added. + * ForwardingHeaders/wtf/ThreadingPrimitives.h: Added. + +2010-04-23 Rafael Weinstein <rafaelw@grafaelw.sfo.corp.google.com> + + Reviewed by Darin Fisher. + + This patch adds a vector of additionalFeatures to WindowFeatures + and populates it with any feature strings that evaluate to "yes" + and aren't directly observed in WindowFeatures. This allows + clients to capture experimental window features. + + https://bugs.webkit.org/show_bug.cgi?id=38013 + + * page/WindowFeatures.cpp: + (WebCore::WindowFeatures::setWindowFeature): + * page/WindowFeatures.h: + +2010-04-23 Dan Bernstein <mitz@apple.com> + + Reviewed by Simon Fraser. + + <rdar://problem/7898436> :after content is duplicated + + Test: fast/css-generated-content/after-duplicated-after-split.html + + * rendering/RenderInline.cpp: + (WebCore::RenderInline::splitInlines): Pass the correct owner of the child list. + +2010-04-23 Adele Peterson <adele@apple.com> + + Fixing the Tiger build for real. + + * platform/graphics/mac/SimpleFontDataMac.mm: + +2010-04-23 Adele Peterson <adele@apple.com> + + Fixing the Tiger build. + + * platform/graphics/mac/SimpleFontDataMac.mm: + (WebCore::SimpleFontData::platformBoundsForGlyph): + +2010-04-23 Jian Li <jianli@chromium.org> + + Reviewed by Dmitry Titov. + + Add FileError for File API. + https://bugs.webkit.org/show_bug.cgi?id=37840 + + The test will be added when implementing FileReader and FilerWriter. + + * Android.derived.jscbindings.mk: + * Android.derived.v8bindings.mk: + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * dom/ExceptionCode.h: + (WebCore::): + * html/FileError.h: Added. + * html/FileError.idl: Added. + * page/DOMWindow.idl: + +2010-04-23 Jian Li <jianli@chromium.org> + + Reviewed by Adam Barth. + + Improve code generator scripts to handle OR ('|') condition in the + extended attributes. + https://bugs.webkit.org/show_bug.cgi?id=37998 + + * bindings/scripts/CodeGeneratorJS.pm: + * bindings/scripts/CodeGeneratorObjC.pm: + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/scripts/IDLStructure.pm: + +2010-04-23 Adele Peterson <adele@apple.com> + + Reviewed by Dan Bernstein. + + Fix for <rdar://problem/7855777> REGRESSION: Memory usage increase caused by storing glyph bounds in GlyphMetricsMap + https://bugs.webkit.org/show_bug.cgi?id=37936 + + This change breaks the GlyphMetricsMap into two maps - one for width and one for bounds, so that we don't store + a FloatRect for the glyph bounds unless we need to. + + Covered by existing tests. This should not cause any change in functionality. + + Updated for removal of GlyphMetricsMap.cpp + * Android.mk: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + + Made GlyphMetricsMap a template, so it can be used for separate width and bounds maps. + * platform/graphics/GlyphMetricsMap.cpp: Removed. + * platform/graphics/GlyphMetricsMap.h: + (WebCore::GlyphMetricsMap::metricsForGlyph): + (WebCore::GlyphMetricsMap::setMetricsForGlyph): + (WebCore::GlyphMetricsMap::GlyphMetricsPage::metricsForGlyph): + (WebCore::GlyphMetricsMap::GlyphMetricsPage::setMetricsForGlyph): + (WebCore::GlyphMetricsMap::GlyphMetricsPage::setMetricsForIndex): + (WebCore::::unknownMetrics): + (WebCore::::locatePageSlowCase): + + * platform/graphics/mac/ComplexTextController.cpp: (WebCore::ComplexTextController::adjustGlyphsAndAdvances): + Call boundsForGlyph instead of metricsForGlyph. + * platform/graphics/win/UniscribeController.cpp: (WebCore::UniscribeController::shapeAndPlaceItem): + ditto. + * platform/graphics/SimpleFontData.cpp: (WebCore::SimpleFontData::platformGlyphInit): + Call setMetricsForGlyph for both glyph maps. + + Break getters and setters for metricsForGlyph into widthForGlyph and boundsForGlyph, maintaining present behavior. + * platform/graphics/SimpleFontData.h: + (WebCore::): + (WebCore::SimpleFontData::boundsForGlyph): + (WebCore::SimpleFontData::widthForGlyph): + * platform/graphics/cairo/SimpleFontDataCairo.cpp: + (WebCore::SimpleFontData::platformBoundsForGlyph): + (WebCore::SimpleFontData::platformWidthForGlyph): + * platform/graphics/chromium/SimpleFontDataChromiumWin.cpp: + (WebCore::SimpleFontData::platformBoundsForGlyph): + (WebCore::SimpleFontData::platformWidthForGlyph): + * platform/graphics/chromium/SimpleFontDataLinux.cpp: + (WebCore::SimpleFontData::platformBoundsForGlyph): + (WebCore::SimpleFontData::platformWidthForGlyph): + * platform/graphics/gtk/SimpleFontDataPango.cpp: + (WebCore::SimpleFontData::platformBoundsForGlyph): + (WebCore::SimpleFontData::platformWidthForGlyph): + * platform/graphics/mac/SimpleFontDataMac.mm: + (WebCore::SimpleFontData::platformBoundsForGlyph): + (WebCore::SimpleFontData::platformWidthForGlyph): + * platform/graphics/win/SimpleFontDataCGWin.cpp: + (WebCore::SimpleFontData::platformBoundsForGlyph): + (WebCore::SimpleFontData::platformWidthForGlyph): + * platform/graphics/win/SimpleFontDataCairoWin.cpp: + (WebCore::SimpleFontData::platformBoundsForGlyph): + * platform/graphics/win/SimpleFontDataWin.cpp: + (WebCore::SimpleFontData::boundsForGDIGlyph): + (WebCore::SimpleFontData::widthForGDIGlyph): + * platform/graphics/wince/SimpleFontDataWince.cpp: + (WebCore::SimpleFontData::platformBoundsForGlyph): + * platform/graphics/wx/SimpleFontDataWx.cpp: + (WebCore::SimpleFontData::platformBoundsForGlyph): + (WebCore::SimpleFontData::platformWidthForGlyph): + +2010-04-23 Xiaomei Ji <xji@chromium.org> + + Reviewed by Dan Bernstein and Darin Adler + + Fix issue "caret does not paint after type in characters in right + aligned div or after delete all characters in RTL div or + 0px right padding RTL textarea" + https://bugs.webkit.org/show_bug.cgi?id=25319 + + Test: editing/inserting/caret-position.html + + * rendering/RenderText.cpp: + (WebCore::RenderText::localCaretRect): + +2010-04-23 No'am Rosenthal <noam.rosenthal@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] [Performance] GraphicsLayer: constructing the layers takes too long + https://bugs.webkit.org/show_bug.cgi?id=36365 + + The issue came from using QGraphicsView's cache as is. The problem is that + several code-paths require re-rendering of the item, but not re-rendering + of the web content into the cache. + + The way to solve it is by having GraphicsLayerQt manage the cache directly + via QPixmapCache, instead of using QGraphicsItem cache modes. + + FPS measurement shows significant improvement (20FPS before, 40FPS after) + on several use-cases, including blog-files/leaves on a desktop environment. + + * platform/graphics/qt/GraphicsLayerQt.cpp: + (WebCore::GraphicsLayerQtImpl::GraphicsLayerQtImpl): + (WebCore::GraphicsLayerQtImpl::recache): + (WebCore::GraphicsLayerQtImpl::paint): + (WebCore::GraphicsLayerQtImpl::flushChanges): + +2010-04-23 James Robinson <jamesr@chromium.org> + + Reviewed by Dimitri Glazkov. + + Avoid marking symbols as dllexport in chromium win builds + https://bugs.webkit.org/show_bug.cgi?id=38058 + + No new tests. + + * config.h: + +2010-04-23 MORITA Hajime <morrita@google.com> + + Reviewed by Nikolas Zimmermann. + + https://bugs.webkit.org/show_bug.cgi?id=37187 + SVG <use href="foo"> is interpreted as <use href="#foo"> + + getTarget() did return url parameter as is if doesn't have + fragment identifier. So fixed to return empty string in such case + because we need to distinguish "yyy.html" from "xxx.svg#yyy.html". + + Test: svg/custom/broken-internal-references.svg + + * svg/SVGElement.cpp: + (WebCore::SVGElement::insertedIntoDocument): + * svg/SVGURIReference.cpp: + (WebCore::SVGURIReference::getTarget): + +2010-04-23 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + ASSERT(willBeComposited == needsToBeComposited(layer)); on gmail.com + https://bugs.webkit.org/show_bug.cgi?id=38066 + + When a layer goes into compositing mode because it has a negative z-index child that is going + into compositing mode, then set willBeComposited to true. Also add another assertion to catch + any other cases where the state of willBeComposited is mismanaged. + + Test: compositing/composited-negative-zindex-child.html + + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::computeCompositingRequirements): + +2010-04-23 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + When webkitAnimationEnd event fires, on-screen rendering should show the last frame of animation + https://bugs.webkit.org/show_bug.cgi?id=37955 + + After r37484, animation and transition end events were fired on a timer, after the animation/transition + ended. This opened up one event loop cycle in which the non-animating state of the element was visible + before the event fired, resulting in flashes in content that reset style from the event handler. + + Fix by firing these events in the same event cycle as the animation end, once all animations + have been updated. This also required moving the place that start animations are fixed until + a later state in the state machine, so that animations have their start time set at the point + the event is fired (to avoid an assertion when using the freeze API in DRT). + + Not testable, since the flash is very transitory and cannot be captured in a pixel test. + + * page/animation/AnimationBase.cpp: + (WebCore::AnimationBase::updateStateMachine): Move the firing of 'start' events into the state + where the start time is known. + * page/animation/AnimationControllerPrivate.h: + * page/animation/AnimationController.cpp: + (WebCore::AnimationControllerPrivate::updateStyleIfNeededDispatcherFired): Call the new fireEventsAndUpdateStyle() + method. + (WebCore::AnimationControllerPrivate::fireEventsAndUpdateStyle): New method to share code that used to be in + updateStyleIfNeededDispatcherFired(). + (WebCore::AnimationControllerPrivate::animationTimerFired): Call fireEventsAndUpdateStyle() once we've + processed all animations. + +2010-04-23 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + CompositeAnimation::updateKeyframeAnimations() can make a KeyframeAnimation for animation "none" + https://bugs.webkit.org/show_bug.cgi?id=38017 + + Check to see if the animation name is "none", and don't fire off a keyframe animation in + that case. + + * page/animation/CompositeAnimation.cpp: + (WebCore::CompositeAnimation::updateKeyframeAnimations): + +2010-04-23 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Disable Netscape plugin support for minimal configuration + https://bugs.webkit.org/show_bug.cgi?id=38026 + + No new tests, as there is no new functionality. + + * WebCore.pri: + +2010-04-23 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Darin Adler. + + Need borderAndPadding(Width|Height) + https://bugs.webkit.org/show_bug.cgi?id=38046 + + Refactoring only, so no new tests. + + * rendering/InlineBox.cpp: + (WebCore::InlineBox::height): + * rendering/RenderApplet.cpp: + (WebCore::RenderApplet::createWidgetIfNecessary): + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::isSelfCollapsingBlock): + (WebCore::RenderBlock::calcPrefWidths): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::calcBorderBoxWidth): + (WebCore::RenderBox::calcBorderBoxHeight): + (WebCore::RenderBox::calcContentBoxWidth): + (WebCore::RenderBox::calcContentBoxHeight): + (WebCore::RenderBox::calcWidth): + (WebCore::RenderBox::calcHeight): + (WebCore::RenderBox::calcPercentageHeight): + (WebCore::RenderBox::calcReplacedHeightUsing): + (WebCore::RenderBox::availableHeightUsing): + (WebCore::RenderBox::calcAbsoluteHorizontal): + (WebCore::RenderBox::calcAbsoluteVertical): + (WebCore::RenderBox::calcAbsoluteHorizontalReplaced): + (WebCore::RenderBox::calcAbsoluteVerticalReplaced): + (WebCore::RenderBox::positionForPoint): + * rendering/RenderBoxModelObject.h: + (WebCore::RenderBoxModelObject::borderAndPaddingHeight): + (WebCore::RenderBoxModelObject::borderAndPaddingWidth): + * rendering/RenderDataGrid.cpp: + (WebCore::RenderDataGrid::calcPrefWidths): + * rendering/RenderFieldset.cpp: + (WebCore::RenderFieldset::calcPrefWidths): + * rendering/RenderFileUploadControl.cpp: + (WebCore::RenderFileUploadControl::calcPrefWidths): + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::calcPrefWidths): + (WebCore::RenderFlexibleBox::allowedChildFlex): + * rendering/RenderImage.cpp: + (WebCore::RenderImage::calcPrefWidths): + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::resize): + * rendering/RenderListBox.cpp: + (WebCore::RenderListBox::calcPrefWidths): + (WebCore::RenderListBox::calcHeight): + * rendering/RenderMenuList.cpp: + (WebCore::RenderMenuList::calcPrefWidths): + * rendering/RenderReplaced.cpp: + (WebCore::RenderReplaced::calcPrefWidths): + * rendering/RenderSVGRoot.cpp: + (WebCore::RenderSVGRoot::calcPrefWidths): + * rendering/RenderSlider.cpp: + (WebCore::RenderSlider::calcPrefWidths): + (WebCore::RenderSlider::layout): + * rendering/RenderTableCell.cpp: + (WebCore::RenderTableCell::styleOrColWidth): + * rendering/RenderTextControl.cpp: + (WebCore::RenderTextControl::textBlockHeight): + (WebCore::RenderTextControl::textBlockWidth): + (WebCore::RenderTextControl::calcHeight): + (WebCore::RenderTextControl::calcPrefWidths): + * rendering/RenderTextControlSingleLine.cpp: + (WebCore::RenderTextControlSingleLine::layout): + * rendering/RenderWidget.cpp: + (WebCore::RenderWidget::updateWidgetPosition): + +2010-04-23 David Kilzer <ddkilzer@apple.com> + + Size mismatch between format string and argument in dumpTextEncodingNameMap() + + Reviewed by Darin Adler. + + See Bug 38030 and r58157. + + * platform/text/TextEncodingRegistry.cpp: + (WebCore::dumpTextEncodingNameMap): Assigned + textEncodingNameMap->size() to an unsigned variable before using + it in the fprintf() statement. + +2010-04-23 David Kilzer <ddkilzer@apple.com> + + BUILD FIX: Attempt to fix Windows build after Bug 36187 landed in r58168 + + * DerivedSources.cpp: Changed include of JSMedia.cpp to + JSStyleMedia.cpp. + +2010-04-23 David Kilzer <ddkilzer@apple.com> + + BUILD FIX: Fix Mac build after Bug 36187 landed in r58168 + + * WebCore.xcodeproj/project.pbxproj: Renamed DOMMedia.h, + DOMMedia.mm, DOMMediaInternal.h to DOMStyleMedia.h, + DOMStyleMedia.mm, DOMStyleMediaInternal.h. + +2010-04-23 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Unreviewed build fix. + + Change Media to StyleMedia + + * DerivedSources.make: + +2010-04-23 Xan Lopez <xlopez@igalia.com> + + Try to fix the GTK+ bots. + + * GNUmakefile.am: + +2010-04-22 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Laszlo Gombos. + + Rename window.media to window.styleMedia + https://bugs.webkit.org/show_bug.cgi?id=36187 + + Rename the interface Media to StyleMedia as required by the + new CSSOM View spec. + + * Android.derived.jscbindings.mk: + * Android.derived.v8bindings.mk: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * css/Media.cpp: Removed. + * css/Media.h: Removed. + * css/Media.idl: Removed. + * css/StyleMedia.cpp: Added. + (WebCore::StyleMedia::StyleMedia): + (WebCore::StyleMedia::type): + (WebCore::StyleMedia::matchMedium): + * css/StyleMedia.h: Added. + (WebCore::StyleMedia::create): + (WebCore::StyleMedia::disconnectFrame): + * css/StyleMedia.idl: Added. + * page/DOMWindow.cpp: + (WebCore::DOMWindow::styleMedia): + * page/DOMWindow.h: + (WebCore::DOMWindow::optionalMedia): + * page/DOMWindow.idl: + +2010-04-23 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: provide JSC implementation for scopeType method on + call frame and use same jsvascript code for JSC and v8 when collecting + scope chain data. + + https://bugs.webkit.org/show_bug.cgi?id=37663 + + * bindings/js/JSInjectedScriptHostCustom.cpp: + (WebCore::JSInjectedScriptHost::currentCallFrame): + * bindings/js/JSJavaScriptCallFrameCustom.cpp: + (WebCore::JSJavaScriptCallFrame::scopeType): + * bindings/v8/custom/V8InjectedScriptHostCustom.cpp: + (WebCore::V8InjectedScriptHost::currentCallFrameCallback): + * inspector/InjectedScriptHost.idl: + * inspector/front-end/InjectedScript.js: + (injectedScriptConstructor.): + +2010-04-23 Alexander Pavlov <apavlov@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: Audits (Image Dimensions): full image URLs are prefixed with the hosting page name + https://bugs.webkit.org/show_bug.cgi?id=37988 + + * inspector/front-end/AuditRules.js: + (WebInspector.AuditRules.ImageDimensionsRule.prototype.doRun): + +2010-04-23 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Yury Semikhatsky. + + WebInspector: Flaky Inspector tests. + https://bugs.webkit.org/show_bug.cgi?id=36217 + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::didCommitLoad): + +2010-04-23 Yaar Schnitman <yaar@chromium.org> + + Reviewed by Adam Barth. + + Auto-generate WebGLRenderingContext overloads in V8 + https://bugs.webkit.org/show_bug.cgi?id=37818 + + * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp: + * html/canvas/WebGLRenderingContext.cpp: Added missing overloads for the following:. + (WebCore::WebGLRenderingContext::texImage2D) + (WebCore::WebGLRenderingContext::texSubImage2D) + * html/canvas/WebGLRenderingContext.h: Added missing overloads. + * html/canvas/WebGLRenderingContext.idl: IDL definition of overloads. + +2010-04-23 Jeff Schiller <codedread@gmail.com> + + Reviewed by Nikolas Zimmermann. + + Display tooltips when hovering over SVG elements, Bug 16854 + https://bugs.webkit.org/show_bug.cgi?id=16854 + + Manual test added for verifying tooltips. + + * manual-tests/svg-tooltip.svg: Added. + * svg/SVGAElement.cpp: + (WebCore::SVGAElement::title): xlink:title takes precedence, otherwise SVGStyledElement::title() is used + * svg/SVGStyledElement.cpp: + (WebCore::SVGStyledElement::title): checks for a shadow parent and uses that title, otherwise uses the content's title + * svg/SVGStyledElement.h: add title() method declaration + +2010-04-23 David Kilzer <ddkilzer@apple.com> + + <http://webkit.org/b/38032> No need to content sniff 304 responses + <rdar://problem/7891726> + + Reviewed by Brady Eidson. + + * platform/network/mac/ResourceHandleMac.mm: + (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]): + No need to adjust the MIME type on 304 responses since they're + only used to determine if the resource needs to be refetched. + +2010-04-23 David Kilzer <ddkilzer@apple.com> + + <http://webkit.org/b/38030> Add WebCore::dumpTextEncodingNameMap() to dump text encoding map on debug builds + + Reviewed by Alexey Proskuryakov. + + * platform/text/TextEncodingRegistry.cpp: + (WebCore::dumpTextEncodingNameMap): Added. + * platform/text/TextEncodingRegistry.h: + (WebCore::dumpTextEncodingNameMap): Added declaration. + +2010-04-22 Tony Chang <tony@chromium.org> + + Reviewed by Dan Bernstein. + + Crash in WebCore::TextIterator::handleTextNode() encountered in Google rich-text products + https://bugs.webkit.org/show_bug.cgi?id=37950 + + Test: editing/text-iterator/rtl-selection-crash.html + + * editing/TextIterator.cpp: + (WebCore::TextIterator::handleTextNode): + +2010-04-22 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Dan Bernstein and Beth Dakin. + + Links around blocks (e.g. divs) results in too many VoiceOver call outs + https://bugs.webkit.org/show_bug.cgi?id=37079 + <rdar://problem/7234118> + + The basic change is to modify the AccessibilityRenderObject tree + traversal methods to account for inline continuations in the + render tree and make the accessibility tree look as if + continuations didn't exist - the same as if CSS blocks could just + sit in CSS inlines. This is slightly tricky code but creates a + much saner accessibility tree. + + Tests: accessibility/image-link-inline-cont.html + accessibility/image-link.html + accessibility/inline-continuations.html + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::isInlineWithContinuation): Helper function for traversal functions to use in accounting for continuations. + (WebCore::firstChildInContinuation): ditto + (WebCore::firstChildConsideringContinuation): ditto + (WebCore::lastChildConsideringContinuation): ditto + (WebCore::startOfContinuations): ditto + (WebCore::endOfContinuations): ditto + (WebCore::childBeforeConsideringContinuations): ditto + (WebCore::firstChildIsInlineContinuation): ditto + (WebCore::lastChildHasContinuation): ditto + (WebCore::AccessibilityRenderObject::firstChild): Account for inline continuations. + (WebCore::AccessibilityRenderObject::lastChild): ditto + (WebCore::AccessibilityRenderObject::previousSibling): Account for inline continuations + and their anonymous block parents. + (WebCore::AccessibilityRenderObject::nextSibling): ditto + (WebCore::AccessibilityRenderObject::parentObjectIfExists): Account for inline continuations. + (WebCore::AccessibilityRenderObject::parentObject): Account for inline continuations. + * rendering/RenderInline.h: Make RenderInline::inlineContinuation public. + +2010-04-22 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Darin Adler. + + REGRESSION: TextIterator may use freed memory + https://bugs.webkit.org/show_bug.cgi?id=37973 + + Added TextIterator::m_text to hold the returned String. + + No new tests because there are no behavior change, but + copy-backslash-with-euc.html on chromium-win should test this. + + * editing/TextIterator.cpp: + (WebCore::TextIterator::emitText): + * editing/TextIterator.h: + +2010-04-22 Michael Forney <mforney@mforney.org> + + Reviewed by Adam Barth. + + https://bugs.webkit.org/show_bug.cgi?id=37761 + + Only include JSDatabase.h and JSDatabaseCallback.h when database is + enabled. This partially fixes building with --disable-database. + + * bindings/js/JSDOMWindowCustom.cpp: Add a check for database around + database-related headers. + +2010-04-22 Ray Rischpater <Raymond.Rischpater@Nokia.com> + + Reviewed by Darin Adler. + + In HTMLInputElement.cpp, shouldUseInputMethod does not return true for + some text input types (TELEPHONE, NUMBER, URL, and EMAIL). Addressed + this by changing shouldUseInputMethod to use internal methods to + check that the field is a text field that isn't a password field. + + No new tests. + + Fixes <https://bugs.webkit.org/show_bug.cgi?id=37719> + + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::shouldUseInputMethod): + +2010-04-22 Yaar Schnitman <yaar@chromium.org> + + Reviewed by Adam Barth. + + Integrate v8 testing utility with webkit tests + https://bugs.webkit.org/show_bug.cgi?id=37731 + + * bindings/v8/test/run_tests.py: Removed. + +2010-04-22 Zhenyao Mo <zmo@google.com> + + Reviewed by Darin Fisher. + + Add isGLES2Compliant to GraphicsContext3D + https://bugs.webkit.org/show_bug.cgi?id=37872 + + * html/canvas/WebGLRenderingContext.cpp: Add isGLES2Compliant(). + (WebCore::WebGLRenderingContext::isGLES2Compliant): + * html/canvas/WebGLRenderingContext.h: Ditto. + * platform/graphics/GraphicsContext3D.h: Ditto. + * platform/graphics/mac/GraphicsContext3DMac.cpp: Ditto. + (WebCore::GraphicsContext3D::isGLES2Compliant): + +2010-04-22 Fumitoshi Ukai <ukai@chromium.org> + + Reviewed by Adam Barth. + + MD5 is required for WebSocket new protocol implementation + https://bugs.webkit.org/show_bug.cgi?id=37913 + + * ForwardingHeaders/wtf/MD5.h: Added. + +2010-04-22 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=38012 + REGRESSION: Ctrl- and Option- shortcuts get wrong keyCode on non-QWERTY keyboard + + * platform/mac/KeyEventMac.mm: (WebCore::windowsKeyCodeForKeyEvent): Also look at unmodified + characters, to avoid falling through to virtual key code lookup for Roman characters. + +2010-04-22 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Darin Adler. + + Fix the MSVC 64bit build. + https://bugs.webkit.org/show_bug.cgi?id=37980 + + * platform/text/TextStream.cpp: + * platform/text/TextStream.h: + * plugins/win/PluginViewWin.cpp: + (WebCore::PluginView::platformStart): + +2010-04-22 Dave Moore <davemoore@chromium.org> + + Reviewed by Dimitri Glazkov. + + Added notification when the favicons for a page are changed + from a script. + The Document object will notify the frame loader, which will + notify the client. Implementations of FrameLoaderClient will + have to add one method; dispatchDidChangeIcons(). + + https://bugs.webkit.org/show_bug.cgi?id=33812 + + Test: fast/dom/icon-url-property.html + + * dom/Document.cpp: + (WebCore::Document::setIconURL): + * loader/DocumentLoader.cpp: + (WebCore::DocumentLoader::setIconURL): + * loader/DocumentLoader.h: + (WebCore::DocumentLoader::iconURL): + * loader/EmptyClients.h: + (WebCore::EmptyFrameLoaderClient::dispatchDidChangeIcons): + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::setIconURL): + (WebCore::FrameLoader::didChangeIcons): + * loader/FrameLoader.h: + * loader/FrameLoaderClient.h: + +2010-04-22 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + [GTK] GObject DOM bindings + https://bugs.webkit.org/show_bug.cgi?id=33590 + + Extend the bindings to cover most of Document.idl + + * GNUmakefile.am: + * bindings/gobject/WebKitDOMBinding.cpp: + (WebKit::createWrapper): + (WebKit::kit): + * bindings/gobject/WebKitDOMBinding.h: + * bindings/gobject/WebKitHTMLElementWrapperFactory.cpp: Added. + (WebKit::createAnchorWrapper): + (WebKit::createAppletWrapper): + (WebKit::createAreaWrapper): + (WebKit::createBaseWrapper): + (WebKit::createBaseFontWrapper): + (WebKit::createBlockquoteWrapper): + (WebKit::createBodyWrapper): + (WebKit::createBRWrapper): + (WebKit::createButtonWrapper): + (WebKit::createCanvasWrapper): + (WebKit::createTableCaptionWrapper): + (WebKit::createTableColWrapper): + (WebKit::createModWrapper): + (WebKit::createDirectoryWrapper): + (WebKit::createDivWrapper): + (WebKit::createDListWrapper): + (WebKit::createEmbedWrapper): + (WebKit::createFieldSetWrapper): + (WebKit::createFontWrapper): + (WebKit::createFormWrapper): + (WebKit::createFrameWrapper): + (WebKit::createFrameSetWrapper): + (WebKit::createHeadingWrapper): + (WebKit::createHeadWrapper): + (WebKit::createHRWrapper): + (WebKit::createHtmlWrapper): + (WebKit::createIFrameWrapper): + (WebKit::createImageWrapper): + (WebKit::createInputWrapper): + (WebKit::createIsIndexWrapper): + (WebKit::createLabelWrapper): + (WebKit::createLegendWrapper): + (WebKit::createLIWrapper): + (WebKit::createLinkWrapper): + (WebKit::createMapWrapper): + (WebKit::createMarqueeWrapper): + (WebKit::createMenuWrapper): + (WebKit::createMetaWrapper): + (WebKit::createObjectWrapper): + (WebKit::createOListWrapper): + (WebKit::createOptGroupWrapper): + (WebKit::createOptionWrapper): + (WebKit::createParagraphWrapper): + (WebKit::createParamWrapper): + (WebKit::createPreWrapper): + (WebKit::createQuoteWrapper): + (WebKit::createScriptWrapper): + (WebKit::createSelectWrapper): + (WebKit::createStyleWrapper): + (WebKit::createTableWrapper): + (WebKit::createTableSectionWrapper): + (WebKit::createTableCellWrapper): + (WebKit::createTextAreaWrapper): + (WebKit::createTitleWrapper): + (WebKit::createTableRowWrapper): + (WebKit::createUListWrapper): + (WebKit::createHTMLElementWrapper): + * bindings/gobject/WebKitHTMLElementWrapperFactory.h: Added. + * bindings/scripts/CodeGeneratorGObject.pm: + * dom/Node.idl: + +2010-04-22 Eric Carlson <eric.carlson@apple.com> + + Reviewed by Simon Fraser. + + Do not pause movie when readyState drops below HAVE_FUTURE_DATA + https://bugs.webkit.org/show_bug.cgi?id=37991 + <rdar://problem/7893937> + + No new tests, we don't have infrastructure in DRT to test with streamed + movies. + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::HTMLMediaElement): Initialize m_readyStateMaximum. + (WebCore::HTMLMediaElement::prepareForLoad): Reset m_readyStateMaximum. + (WebCore::HTMLMediaElement::setReadyState): Maintain m_readyStateMaximum. + (WebCore::HTMLMediaElement::potentiallyPlaying): Also return true if the readyState was + previously >= HAVE_FUTURE_DATA. + * html/HTMLMediaElement.h: + +2010-04-22 Zhenyao Mo <zmo@google.com> + + Reviewed by Dimitri Glazkov. + + Regression: framebufferRenderbuffer crashes with null renderBuffer + https://bugs.webkit.org/show_bug.cgi?id=37963 + + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::WebGLRenderingContext::framebufferRenderbuffer): Dealing with null renderbuffer input. + +2010-04-22 Zhenyao Mo <zmo@google.com> + + Reviewed by Dimitri Glazkov. + + Emulate GL_IMPLEMENTATION_COLOR_READ_FORMAT/TYPE for glGet + https://bugs.webkit.org/show_bug.cgi?id=37281 + + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::WebGLRenderingContext::WebGLRenderingContext): Remove error check because two enums are supported now. + (WebCore::WebGLRenderingContext::getParameter): Add two enums. + (WebCore::WebGLRenderingContext::readPixels): Fix a tiny bug. + * platform/graphics/mac/GraphicsContext3DMac.cpp: + (WebCore::GraphicsContext3D::getIntegerv): Emulate two enums. + +2010-04-22 Diego Escalante Urrelo <descalante@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] Mute/unmute button on <video> elements are backwards + https://bugs.webkit.org/show_bug.cgi?id=33967 + + Fix mute/unmute buttons icons-action relation and explain why their + variable names and corresponding icons seem to be misleading but are + actually right. Original patch by Mike Hommey. + + * platform/gtk/RenderThemeGtk.cpp: + (WebCore::RenderThemeGtk::initMediaStyling): + +2010-04-22 Gustavo Sverzut Barbieri <barbieri@profusion.mobi> + + Reviewed by Eric Seidel. + + Fix build if NPAPI support is disabled + https://bugs.webkit.org/show_bug.cgi?id=36621 + + No new tests, this is a build fix. + Re-submit r58043 with fix for EFL. + + * plugins/PluginViewNone.cpp: + +2010-04-22 Diego Escalante Urrelo <descalante@igalia.com> + + Reviewed by Xan Lopez. + + [Gtk] Evaluate and create tests for all the AtkRole's implemented by + WebKitGtk + https://bugs.webkit.org/show_bug.cgi?id=34449 + + Implement ATK_ROLE_COMBO_BOX. + + * accessibility/gtk/AccessibilityObjectAtk.cpp: + (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject): + * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: + (atkRole): + +2010-04-22 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Dirk Schulze. + + SVGPaintServer needs to be converted to the new RenderSVGResource* system + https://bugs.webkit.org/show_bug.cgi?id=37986 + + No functional changes, just move the SVGPaintServer* classes from svg/graphics/ to rendering/, the new location for the RenderSVGResource* classes. + This is a preparation for the real patch which follows soon. + + * Android.mk: Rename files and move to the right location. + * GNUmakefile.am: Ditto. + * WebCore.gypi: Ditto. + * WebCore.pro: Ditto. + * WebCore.vcproj/WebCore.vcproj: Ditto. + * WebCore.xcodeproj/project.pbxproj: Ditto. + * rendering/RenderSVGResource.cpp: Copied from svg/graphics/SVGPaintServer.cpp. + * rendering/RenderSVGResourceGradient.cpp: Copied from svg/graphics/SVGPaintServerGradient.cpp. + * rendering/RenderSVGResourceGradient.h: Copied from svg/graphics/SVGPaintServerGradient.h. + * rendering/RenderSVGResourceLinearGradient.cpp: Copied from svg/graphics/SVGPaintServerLinearGradient.cpp. + * rendering/RenderSVGResourceLinearGradient.h: Copied from svg/graphics/SVGPaintServerLinearGradient.h. + * rendering/RenderSVGResourcePattern.cpp: Copied from svg/graphics/SVGPaintServerPattern.cpp. + * rendering/RenderSVGResourcePattern.h: Copied from svg/graphics/SVGPaintServerPattern.h. + * rendering/RenderSVGResourceRadialGradient.cpp: Copied from svg/graphics/SVGPaintServerRadialGradient.cpp. + * rendering/RenderSVGResourceRadialGradient.h: Copied from svg/graphics/SVGPaintServerRadialGradient.h. + * rendering/RenderSVGResourceSolidColor.cpp: Copied from svg/graphics/SVGPaintServerSolid.cpp. + * rendering/RenderSVGResourceSolidColor.h: Copied from svg/graphics/SVGPaintServerSolid.h. + * rendering/SVGRenderTreeAsText.cpp: Change include file names. + * svg/SVGFont.cpp: Ditto. + * svg/SVGGradientElement.cpp: Ditto. + * svg/SVGGradientElement.h: Ditto. + * svg/SVGLinearGradientElement.cpp: Ditto. + * svg/SVGPatternElement.cpp: Ditto. + * svg/SVGPatternElement.h: Ditto. + * svg/SVGRadialGradientElement.cpp: Ditto. + * svg/graphics/SVGPaintServer.cpp: Removed. + * svg/graphics/SVGPaintServerGradient.cpp: Removed. + * svg/graphics/SVGPaintServerGradient.h: Removed. + * svg/graphics/SVGPaintServerLinearGradient.cpp: Removed. + * svg/graphics/SVGPaintServerLinearGradient.h: Removed. + * svg/graphics/SVGPaintServerPattern.cpp: Removed. + * svg/graphics/SVGPaintServerPattern.h: Removed. + * svg/graphics/SVGPaintServerRadialGradient.cpp: Removed. + * svg/graphics/SVGPaintServerRadialGradient.h: Removed. + * svg/graphics/SVGPaintServerSolid.cpp: Removed. + * svg/graphics/SVGPaintServerSolid.h: Removed. + * svg/graphics/SVGResourceListener.h: Removed. + +2010-04-22 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Hide the OpenGL and QtMultimedia dependencies from syncqt. + + This prevents the dependent headers from being included by + qt/include/QtWebKit/QtWebKit + + * WebCore.pro: + +2010-04-22 Gustavo Sverzut Barbieri <barbieri@profusion.mobi> + + Reviewed by Adam Roben. + + EFL does not support PluginDatabase yet. + http://webkit.org/b/37854 + + No behavior changes, so no new tests were added. + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::defaultObjectContentType): + +2010-04-22 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: Timeline scrolling speed is slow if it has more than 1k timeline marks. + https://bugs.webkit.org/show_bug.cgi?id=37924 + + * inspector/front-end/TimelineGrid.js: + (WebInspector.TimelineGrid.prototype.updateDividers): + (WebInspector.TimelineGrid.prototype.addEventDividers): + * inspector/front-end/TimelineOverviewPane.js: + (WebInspector.TimelineOverviewPane.prototype.updateEventDividers): + * inspector/front-end/TimelinePanel.js: + (WebInspector.TimelinePanel.prototype._updateEventDividers): + (WebInspector.TimelinePanel.prototype._refresh): + +2010-04-22 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Fraser. + + Rename window.media to window.styleMedia + https://bugs.webkit.org/show_bug.cgi?id=36187 + + It has been defined that the AbstractView media extension + defined in the CSSOM View spec should be renamed to styleMedia. + This patch does that and updates the current layout tests + making use of it. + + * page/AbstractView.idl: + * page/DOMWindow.cpp: + (WebCore::DOMWindow::styleMedia): + * page/DOMWindow.h: + * page/DOMWindow.idl: + +2010-04-22 Anton Muhin <antonm@chromium.org> + + Reviewed by Adam Barth. + + [v8] Do not pass empty handle into SetHiddenValue which would crash. + https://bugs.webkit.org/show_bug.cgi?id=37801 + + * bindings/v8/V8AbstractEventListener.cpp: + (WebCore::V8AbstractEventListener::handleEvent): add couple of asserts to check for unexpected paths + (WebCore::V8AbstractEventListener::invokeEventHandler): bail out of jsEvent is empty handle + +2010-04-22 Stephan Aßmus <superstippi@gmx.de> + + Reviewed by David Levin. + + [Haiku] Implement ImageBuffer support + https://bugs.webkit.org/show_bug.cgi?id=35288 + + Covered by existing tests. + + Complete implementation of ImageBuffer for Haiku. Uses StillImage + class to export a WebCore::Image and associated GraphicsContext + to perform arbitrary drawing in the offscreen BBitmap buffer. + + * platform/graphics/haiku/ImageBufferData.h: + * platform/graphics/haiku/ImageBufferHaiku.cpp, + (WebCore::ImageBufferData::ImageBufferData), + (WebCore::ImageBufferData::~ImageBufferData), + (WebCore::ImageBuffer::ImageBuffer), + (WebCore::ImageBuffer::~ImageBuffer), + (WebCore::ImageBuffer::context), + (WebCore::ImageBuffer::image): + Implementation uses offscreen BBitmap and BView, wraps StillImage + around those to provide WebCore::Image interface. + (WebCore::ImageBuffer::platformTransformColorSpace): + (WebCore::convertFromData): + Method just performs BGRA <-> RGBA conversion. + (WebCore::convertFromInternalData): + Method just performs BGRA <-> RGBA conversion and handles + pre-multiplying the color values if requested. + (WebCore::convertToInternalData): + Method just performs BGRA <-> RGBA conversion and handles + de.multiplying the color values if requested. + (WebCore::getImageData): + Common code for the next two methods. + (WebCore::ImageBuffer::getUnmultipliedImageData), + (WebCore::ImageBuffer::getPremultipliedImageData): + Implemented. + (WebCore::putImageData): + Common code for the next two methods. + (WebCore::ImageBuffer::putUnmultipliedImageData), + (WebCore::ImageBuffer::putPremultipliedImageData): + Implemented. + (WebCore::ImageBuffer::toDataURL): + Uses Haiku "Translation Kit" to convert image data to data + of the requested mime type. + +2010-04-22 Adam Barth <abarth@webkit.org> + + Unreviewed, rolling out r58069. + http://trac.webkit.org/changeset/58069 + https://bugs.webkit.org/show_bug.cgi?id=27751 + + Broke compile on Windows. + + * WebCore.base.exp: + * editing/EditorCommand.cpp: + (WebCore::supportedPaste): + (WebCore::createCommandMap): + * page/Settings.cpp: + (WebCore::Settings::Settings): + * page/Settings.h: + +2010-04-22 Abhishek Arya <inferno@chromium.org> + + Reviewed by Adam Barth. + + Add support for controlling clipboard access from javascript. + Clipboard access from javascript is disabled by default. + https://bugs.webkit.org/show_bug.cgi?id=27751 + + Test: editing/execCommand/clipboard-access.html + + * WebCore.base.exp: + * editing/EditorCommand.cpp: + (WebCore::supportedCopyCut): + (WebCore::supportedPaste): + (WebCore::createCommandMap): + * page/Settings.cpp: + (WebCore::Settings::Settings): + (WebCore::Settings::setJavaScriptCanAccessClipboard): + * page/Settings.h: + (WebCore::Settings::javaScriptCanAccessClipboard): + +2010-04-22 Stephan Aßmus <superstippi@gmx.de> + + Reviewed by David Levin. + + [Haiku] Improve SimpleFontDataHaiku + https://bugs.webkit.org/show_bug.cgi?id=37411 + + Covered by existing tests. + + * platform/graphics/haiku/SimpleFontDataHaiku.cpp: + - Cleaned up includes + - Removed prototype "charUnicodeToUTF8HACK" + (WebCore::SimpleFontData::platformInit): + - Use const BFont pointer + (WebCore::SimpleFontData::smallCapsFontData): + - "fontPlatformData" was leaked. It is only + used as the key for the font cache lookup. + (WebCore::SimpleFontData::platformMetricsForGlyph): + - Use existing WebCore encoding infrastructure + instead of adding a hack for Haiku. + +2010-04-21 Steve Block <steveblock@google.com> + + Reviewed by Kenneth Rohde Christiansen. + + Replace Geolocation::suspend()/resume() which are required by Android. + https://bugs.webkit.org/show_bug.cgi?id=37942 + + These methods were removed in Bug 36255. + + Build fix only, no new tests. + + * page/Geolocation.cpp: + (WebCore::Geolocation::suspend): + (WebCore::Geolocation::resume): + * page/Geolocation.h: + +2010-04-21 Ray Rischpater <Raymond.Rischpater@Nokia.com> + + In HTMLInputElement.cpp there are numerous style + violations. + + This patch includes style changes to fix existing style + deviations in this file. + + Rubber stamped by Darin Adler. + + Fixes <https://bugs.webkit.org/show_bug.cgi?id=37881> + + * html/HTMLInputElement.cpp: + +2010-04-21 Gustavo Sverzut Barbieri <barbieri@profusion.mobi> + + Reviewed by Adam Roben. + + Add missing EFL WebCore file. + http://webkit.org/b/37854 + + No behavior changes, so no new tests were added. + + * bindings/js/ScriptControllerEfl.cpp: Added. + (WebCore::ScriptController::createScriptInstanceForWidget): + +2010-04-21 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + Printing Core Animation-based plug-ins is broken + https://bugs.webkit.org/show_bug.cgi?id=37967 + + When we do a "flattening" paint because of printing, we need to stash + the flattening flag in the FrameView's m_paintBehavior, because + WebBaseNetscapePluginView needs to find it there to decide whether + to grab a bitmap for printing, for CA plug-ins. + + * page/FrameView.cpp: + (WebCore::FrameView::paintContents): + +2010-04-21 François Sausset <sausset@gmail.com> + + Reviewed by Kenneth Rohde Christiansen. + + Fix to take into account a change made in "StringImpl". + https://bugs.webkit.org/show_bug.cgi?id=37763 + + * mathml/RenderMathMLOperator.cpp: + (WebCore::RenderMathMLOperator::updateFromElement): + +2010-04-21 Andy Estes <aestes@apple.com> + + Reviewed by Darin Adler. + + Create a template for creating reference-counted Windows GDI handles. + Refactor RefCountedHFONT to use this template. + + https://bugs.webkit.org/show_bug.cgi?id=37952 + + No change in behavior. + + * WebCore.vcproj/WebCore.vcproj: Add RefCountedHFONT.h + * platform/graphics/cairo/FontPlatformData.h: + (WebCore::FontPlatformData::hfont): Refactor to return m_hfont->handle() instead of m_hfont->hfont(). + * platform/graphics/cg/FontPlatformData.h: + (WebCore::FontPlatformData::hfont): Same. + * platform/graphics/win/FontPlatformDataCGWin.cpp: + (WebCore::FontPlatformData::FontPlatformData): Instantiate m_hfont with a RefCountedGDIHandle<HFONT>. + * platform/graphics/win/FontPlatformDataWin.cpp: + (WebCore::FontPlatformData::FontPlatformData): Same. + * platform/graphics/win/RefCountedGDIHandle.h: Added. Interface is identical to RefCountedHFONT with exception of renaming hfont() to handle(). + (WebCore::RefCountedGDIHandle::create): + (WebCore::RefCountedGDIHandle::createDeleted): + (WebCore::RefCountedGDIHandle::~RefCountedGDIHandle): + (WebCore::RefCountedGDIHandle::handle): Return the GDI handle. + (WebCore::RefCountedGDIHandle::hash): + (WebCore::RefCountedGDIHandle::RefCountedGDIHandle): + * platform/graphics/win/RefCountedHFONT.h: Removed. + +2010-04-21 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Darin Adler. + + Fix build if NPAPI support is disabled + https://bugs.webkit.org/show_bug.cgi?id=36621 + + No new tests, this is a build fix. + Re-submit r56585 with fix for Chromium. + + * plugins/PluginView.cpp: Guard getValueStatic() with + NETSCAPE_PLUGIN_API + (WebCore::PluginView::getValue): + * plugins/PluginView.h: Guard getValue() with NETSCAPE_PLUGIN_API + * plugins/PluginViewNone.cpp: Guard platformGetValue() and + platformGetValueStatic with NETSCAPE_PLUGIN_API; + Guard privateBrowsingStateChanged() and setJavaScriptPaused() with + PLATFORM(MAC) or PLATFORM(CHROMIUM) + +2010-04-21 David Yonge-Mallo <davinci@chromium.org> + + Reviewed by Dan Bernstein. + + ZWNJ - Display non-printing, invisible character + https://bugs.webkit.org/show_bug.cgi?id=16131 + + Fix the (non)display of glyphs for ZWJ and ZWNJ in simple font code path. + + Tests: fast/text/format-control.html + fast/text/zero-width-characters.html + + * platform/graphics/Font.h: + (WebCore::Font::operator!=): + (WebCore::Font::treatAsZeroWidthSpace): treat ZWNJ and ZWJ as ZWSP. + * platform/graphics/GlyphPageTreeNode.cpp: + (WebCore::GlyphPageTreeNode::initializePage): added ZWNJ and ZWJ. + * platform/text/CharacterNames.h: added ZWNJ and ZWJ. + +2010-04-21 Charles Wei <charles.wei@torchmobile.com.cn> + + Reviewed by George Staikos. + + Fix webkit build problem when xhtmlmp enabled, which is introduced by revision 57927, for + bug fix of 37175 , which seperates DocumentWriter from FrameLoader + https://bugs.webkit.org/show_bug.cgi?id=37915 + + No new tests since this only fixes the build problem. + + * dom/Document.cpp: + (WebCore::Document::isXHTMLMPDocument): + +2010-04-21 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Darin Adler. + + Call sites of TextIterator constructor are difficult to read + https://bugs.webkit.org/show_bug.cgi?id=37909 + + Now we use enum parameters instead of boolean parameters and + boolean version of constructors are eliminated. + + This change also changes the names of boolean members so they are + now third person singular. + + No new tests because this is just a refactoring. + + * WebCore.base.exp: + * editing/TextIterator.cpp: + (WebCore::TextIterator::TextIterator): + (WebCore::TextIterator::advance): + (WebCore::TextIterator::handleReplacedElement): + (WebCore::TextIterator::shouldRepresentNodeOffsetZero): + (WebCore::TextIterator::shouldEmitSpaceBeforeAndAfterNode): + (WebCore::TextIterator::handleNonTextNode): + (WebCore::TextIterator::exitNode): + (WebCore::TextIterator::emitCharacter): + (WebCore::TextIterator::emitText): + (WebCore::CharacterIterator::CharacterIterator): + (WebCore::TextIterator::rangeLength): + (WebCore::TextIterator::rangeFromLocationAndLength): + (WebCore::findPlainText): + * editing/TextIterator.h: + (WebCore::): + * editing/VisibleSelection.cpp: + (WebCore::VisibleSelection::appendTrailingWhitespace): + * editing/visible_units.cpp: + (WebCore::nextBoundary): + +2010-04-21 Jesus Sanchez-Palencia <jesus@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + Add PageClientQt files. + + [Qt] PageClientQt specific implementation for QWidget + https://bugs.webkit.org/show_bug.cgi?id=37858 + + * WebCore.pro: + +2010-04-21 Diego Escalante Urrelo <descalante@igalia.com> + + Reviewed by Xan Lopez. + + [Gtk] Evaluate and create tests for all the AtkRole's implemented by + WebKitGtk + https://bugs.webkit.org/show_bug.cgi?id=34449 + + Implement ATK_ROLE_SEPARATOR. + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::determineAccessibilityRole): + * accessibility/gtk/AccessibilityObjectAtk.cpp: + (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject): + +2010-04-21 David Leong <david.leong@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Symbian apps crash on exit due to a bad qObject_cast. + + https://bugs.webkit.org/show_bug.cgi?id=37303 + + Added check for NULL to avoid the crash. Reworked to fix memory leak + + * plugins/symbian/PluginViewSymbian.cpp: + (WebCore::PluginView::platformDestroy): + 2009-04-21 Chris Fleizach <cfleizach@apple.com> Reviewed by Alexey Proskuryakov. @@ -833,8 +8571,8 @@ declaration ( e.g. every "namespace WebCore { class String; }" much change to "namespace WTF { class String; }"). - Moving the files, but leaving the classes logically in the WebCore namespace – - which is technically a layering violation – I'll come back and fix this up in a + Moving the files, but leaving the classes logically in the WebCore namespace - + which is technically a layering violation - I'll come back and fix this up in a subsequent patch. * Android.mk: @@ -29869,7 +37607,7 @@ https://bugs.webkit.org/show_bug.cgi?id=34728 addressed the symptoms of this problem, and it is probably cleaner to make the client data's normal world no longer be a member (since it is a ref-counted object), however they should be - no requirement to 'detatch' – it makes no sense for anyone to be referencing + no requirement to 'detatch' - it makes no sense for anyone to be referencing the world after the JSGlobalData has gone away (the world's purpose is to hold wrapper objects in the JSGlobalData's heap). Keep the restructuring that makes the normal world no longer be a member, but remove the detach mechanism this @@ -35769,7 +43507,7 @@ https://bugs.webkit.org/show_bug.cgi?id=34335 * bindings/js/ScriptCallStack.cpp: - (WebCore::ScriptCallStack::ScriptCallStack): If the caller is unknown, the line number and source information is still availble so pass it to the ScriptCallFrame being constructed. + (WebCore::ScriptCallStack::ScriptCallStack): If the caller is unknown, the line number and source information is still available so pass it to the ScriptCallFrame being constructed. 2010-02-01 Dirk Schulze <krit@webkit.org> diff --git a/WebCore/Configurations/Version.xcconfig b/WebCore/Configurations/Version.xcconfig index 6aeb263..cc5943e 100644 --- a/WebCore/Configurations/Version.xcconfig +++ b/WebCore/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 533; -MINOR_VERSION = 6; +MINOR_VERSION = 9; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/WebCore/Configurations/WebCore.xcconfig b/WebCore/Configurations/WebCore.xcconfig index c678bce..b9b37fd 100644 --- a/WebCore/Configurations/WebCore.xcconfig +++ b/WebCore/Configurations/WebCore.xcconfig @@ -39,9 +39,14 @@ INSTALL_PATH = $(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Versions/A/Fram INSTALLHDRS_COPY_PHASE = YES; INSTALLHDRS_SCRIPT_PHASE = YES; PRODUCT_NAME = WebCore; -UMBRELLA_LDFLAGS = -umbrella WebKit; -VISIBILITY_LDFLAGS = ; -OTHER_LDFLAGS = -l$(SQLITE3_LIBRARY) -lobjc -sub_library libobjc $(UMBRELLA_LDFLAGS) $(VISIBILITY_LDFLAGS); + +OTHER_LDFLAGS = -l$(SQLITE3_LIBRARY) -lobjc -sub_library libobjc -umbrella WebKit $(WEBKIT2_LDFLAGS); + +WEBKIT2_LDFLAGS = $(WEBKIT2_LDFLAGS_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +WEBKIT2_LDFLAGS_1060 = $(WEBKIT2_LDFLAGS_$(CONFIGURATION)); +WEBKIT2_LDFLAGS_1070 = $(WEBKIT2_LDFLAGS_$(CONFIGURATION)); +WEBKIT2_LDFLAGS_Release = -allowable_client WebKit2; +WEBKIT2_LDFLAGS_Debug = -allowable_client WebKit2; JAVASCRIPTCORE_PRIVATE_HEADERS_DIR = $(JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_$(REAL_PLATFORM_NAME)_$(CONFIGURATION)); JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_macosx_Release = $(JAVASCRIPTCORE_PRIVATE_HEADERS_engineering); diff --git a/WebCore/DerivedSources.cpp b/WebCore/DerivedSources.cpp index 72c5d47..c8be33f 100644 --- a/WebCore/DerivedSources.cpp +++ b/WebCore/DerivedSources.cpp @@ -64,6 +64,7 @@ #include "JSCSSVariablesRule.cpp" #include "JSCustomEvent.cpp" #include "JSDatabase.cpp" +#include "JSDatabaseCallback.cpp" #include "JSDataGridColumn.cpp" #include "JSDataGridColumnList.cpp" #include "JSDedicatedWorkerContext.cpp" @@ -85,6 +86,7 @@ #include "JSEventException.cpp" #include "JSEventSource.cpp" #include "JSFile.cpp" +#include "JSFileError.cpp" #include "JSFileList.cpp" #include "JSGeolocation.cpp" #include "JSGeoposition.cpp" @@ -165,7 +167,6 @@ #include "JSJavaScriptCallFrame.cpp" #include "JSKeyboardEvent.cpp" #include "JSLocation.cpp" -#include "JSMedia.cpp" #include "JSMediaError.cpp" #include "JSMediaList.cpp" #include "JSMessageChannel.cpp" @@ -204,9 +205,14 @@ #include "JSSQLError.cpp" #include "JSSQLResultSet.cpp" #include "JSSQLResultSetRowList.cpp" +#include "JSSQLStatementCallback.cpp" +#include "JSSQLStatementErrorCallback.cpp" #include "JSSQLTransaction.cpp" +#include "JSSQLTransactionCallback.cpp" +#include "JSSQLTransactionErrorCallback.cpp" #include "JSStorage.cpp" #include "JSStorageEvent.cpp" +#include "JSStyleMedia.cpp" #include "JSStyleSheet.cpp" #include "JSStyleSheetList.cpp" #include "JSSVGAElement.cpp" diff --git a/WebCore/DerivedSources.make b/WebCore/DerivedSources.make index 1aaa066..b4120f9 100644 --- a/WebCore/DerivedSources.make +++ b/WebCore/DerivedSources.make @@ -115,6 +115,7 @@ DOM_CLASSES = \ DOMSelection \ DOMWindow \ Database \ + DatabaseCallback \ Document \ DocumentFragment \ DocumentType \ @@ -129,6 +130,7 @@ DOM_CLASSES = \ EventSource \ EventTarget \ File \ + FileError \ FileList \ Geolocation \ Geoposition \ @@ -210,7 +212,6 @@ DOM_CLASSES = \ InspectorFrontendHost \ KeyboardEvent \ Location \ - Media \ MediaError \ MediaList \ MessageChannel \ @@ -248,7 +249,11 @@ DOM_CLASSES = \ SQLError \ SQLResultSet \ SQLResultSetRowList \ + SQLStatementCallback \ + SQLStatementErrorCallback \ SQLTransaction \ + SQLTransactionCallback \ + SQLTransactionErrorCallback \ Storage \ StorageEvent \ SVGAElement \ @@ -397,6 +402,7 @@ DOM_CLASSES = \ SVGZoomAndPan \ SVGZoomEvent \ Screen \ + StyleMedia \ StyleSheet \ StyleSheetList \ Text \ @@ -821,7 +827,7 @@ CharsetData.cpp : platform/text/mac/make-charset-table.pl platform/text/mac/char # export file -ifeq ($(shell gcc -E -P -dM $(FRAMEWORK_FLAGS) WebCore/ForwardingHeaders/wtf/Platform.h | grep ENABLE_MAC_JAVA_BRIDGE | cut -d' ' -f3), 1) +ifeq ($(shell gcc -E -P -dM $(FRAMEWORK_FLAGS) WebCore/ForwardingHeaders/wtf/Platform.h | grep ENABLE_JAVA_BRIDGE | cut -d' ' -f3), 1) WEBCORE_EXPORT_DEPENDENCIES := $(WEBCORE_EXPORT_DEPENDENCIES) WebCore.JNI.exp endif @@ -881,6 +887,10 @@ ifeq ($(findstring ENABLE_GEOLOCATION,$(FEATURE_DEFINES)), ENABLE_GEOLOCATION) WEBCORE_EXPORT_DEPENDENCIES := $(WEBCORE_EXPORT_DEPENDENCIES) WebCore.Geolocation.exp endif +ifeq ($(shell gcc -E -P -dM $(FRAMEWORK_FLAGS) WebCore/ForwardingHeaders/wtf/Platform.h | grep WTF_USE_PROTECTION_SPACE_AUTH_CALLBACK | cut -d' ' -f3), 1) + WEBCORE_EXPORT_DEPENDENCIES := $(WEBCORE_EXPORT_DEPENDENCIES) WebCore.ProtectionSpaceAuthCallback.exp +endif + WebCore.exp : WebCore.base.exp $(WEBCORE_EXPORT_DEPENDENCIES) cat $^ > $@ diff --git a/WebCore/English.lproj/localizedStrings.js b/WebCore/English.lproj/localizedStrings.js Binary files differindex a59ba83..720e09c 100644 --- a/WebCore/English.lproj/localizedStrings.js +++ b/WebCore/English.lproj/localizedStrings.js diff --git a/WebCore/ForwardingHeaders/runtime/PropertyMap.h b/WebCore/ForwardingHeaders/runtime/PropertyMap.h deleted file mode 100644 index fc40963..0000000 --- a/WebCore/ForwardingHeaders/runtime/PropertyMap.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef WebCore_FWD_PropertyMap_h -#define WebCore_FWD_PropertyMap_h -#include <JavaScriptCore/PropertyMap.h> -#endif - diff --git a/WebCore/ForwardingHeaders/wtf/Atomics.h b/WebCore/ForwardingHeaders/wtf/Atomics.h new file mode 100644 index 0000000..2fee175 --- /dev/null +++ b/WebCore/ForwardingHeaders/wtf/Atomics.h @@ -0,0 +1,4 @@ +#ifndef WebCore_FWD_Atomics_h +#define WebCore_FWD_Atomics_h +#include <JavaScriptCore/Atomics.h> +#endif diff --git a/WebCore/ForwardingHeaders/wtf/MD5.h b/WebCore/ForwardingHeaders/wtf/MD5.h new file mode 100644 index 0000000..0c65786 --- /dev/null +++ b/WebCore/ForwardingHeaders/wtf/MD5.h @@ -0,0 +1,5 @@ +#ifndef WebCore_FWD_MD5_h +#define WebCore_FWD_MD5_h +#include <JavaScriptCore/MD5.h> +#endif + diff --git a/WebCore/ForwardingHeaders/wtf/ThreadSafeShared.h b/WebCore/ForwardingHeaders/wtf/ThreadSafeShared.h new file mode 100644 index 0000000..50c2bf4 --- /dev/null +++ b/WebCore/ForwardingHeaders/wtf/ThreadSafeShared.h @@ -0,0 +1,4 @@ +#ifndef WebCore_FWD_ThreadSafeShared_h +#define WebCore_FWD_ThreadSafeShared_h +#include <JavaScriptCore/ThreadSafeShared.h> +#endif diff --git a/WebCore/ForwardingHeaders/wtf/ThreadingPrimitives.h b/WebCore/ForwardingHeaders/wtf/ThreadingPrimitives.h new file mode 100644 index 0000000..5dd2e03 --- /dev/null +++ b/WebCore/ForwardingHeaders/wtf/ThreadingPrimitives.h @@ -0,0 +1,4 @@ +#ifndef WebCore_FWD_ThreadingPrimitives_h +#define WebCore_FWD_ThreadingPrimitives_h +#include <JavaScriptCore/ThreadingPrimitives.h> +#endif diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am index 93b685e..d8cfc3a 100644 --- a/WebCore/GNUmakefile.am +++ b/WebCore/GNUmakefile.am @@ -115,10 +115,10 @@ IDL_BINDINGS += \ WebCore/css/CSSVariablesDeclaration.idl \ WebCore/css/CSSVariablesRule.idl \ WebCore/css/Counter.idl \ - WebCore/css/Media.idl \ WebCore/css/MediaList.idl \ - WebCore/css/RGBColor.idl \ WebCore/css/Rect.idl \ + WebCore/css/RGBColor.idl \ + WebCore/css/StyleMedia.idl \ WebCore/css/StyleSheet.idl \ WebCore/css/StyleSheetList.idl \ WebCore/css/WebKitCSSKeyframeRule.idl \ @@ -194,6 +194,7 @@ IDL_BINDINGS += \ WebCore/html/DataGridColumnList.idl \ WebCore/html/DOMFormData.idl \ WebCore/html/File.idl \ + WebCore/html/FileError.idl \ WebCore/html/FileList.idl \ WebCore/html/HTMLAllCollection.idl \ WebCore/html/HTMLAnchorElement.idl \ @@ -318,6 +319,8 @@ webcoregtk_dom_sources = \ WebCore/bindings/gobject/ConvertToUTF8String.h \ WebCore/bindings/gobject/WebKitDOMBinding.cpp \ WebCore/bindings/gobject/WebKitDOMBinding.h \ + WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.cpp \ + WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.h \ WebCore/bindings/gobject/WebKitDOMObject.cpp \ WebCore/bindings/gobject/WebKitDOMObject.h @@ -417,14 +420,12 @@ webcore_sources += \ WebCore/bindings/js/JSDOMWrapper.cpp \ WebCore/bindings/js/JSDOMWrapper.h \ WebCore/bindings/js/JSDocumentCustom.cpp \ - WebCore/bindings/js/JSDocumentFragmentCustom.cpp \ WebCore/bindings/js/JSElementCustom.cpp \ WebCore/bindings/js/JSEventCustom.cpp \ WebCore/bindings/js/JSEventListener.cpp \ WebCore/bindings/js/JSEventListener.h \ WebCore/bindings/js/JSEventSourceConstructor.cpp \ WebCore/bindings/js/JSEventSourceConstructor.h \ - WebCore/bindings/js/JSEventSourceCustom.cpp \ WebCore/bindings/js/JSEventTarget.cpp \ WebCore/bindings/js/JSEventTarget.h \ WebCore/bindings/js/JSExceptionBase.cpp \ @@ -682,26 +683,26 @@ webcore_sources += \ WebCore/css/FontValue.h \ WebCore/css/MediaFeatureNames.cpp \ WebCore/css/MediaFeatureNames.h \ - WebCore/css/Media.cpp \ - WebCore/css/Media.h \ WebCore/css/MediaList.cpp \ WebCore/css/MediaList.h \ WebCore/css/MediaQuery.cpp \ - WebCore/css/MediaQuery.h \ WebCore/css/MediaQueryEvaluator.cpp \ WebCore/css/MediaQueryEvaluator.h \ WebCore/css/MediaQueryExp.cpp \ WebCore/css/MediaQueryExp.h \ + WebCore/css/MediaQuery.h \ WebCore/css/Pair.h \ + WebCore/css/Rect.h \ WebCore/css/RGBColor.cpp \ WebCore/css/RGBColor.h \ - WebCore/css/Rect.h \ WebCore/css/ShadowValue.cpp \ WebCore/css/ShadowValue.h \ WebCore/css/StyleBase.cpp \ WebCore/css/StyleBase.h \ WebCore/css/StyleList.cpp \ WebCore/css/StyleList.h \ + WebCore/css/StyleMedia.cpp \ + WebCore/css/StyleMedia.h \ WebCore/css/StyleSheet.cpp \ WebCore/css/StyleSheet.h \ WebCore/css/StyleSheetList.cpp \ @@ -885,6 +886,7 @@ webcore_sources += \ WebCore/dom/Tokenizer.h \ WebCore/dom/Traversal.cpp \ WebCore/dom/Traversal.h \ + WebCore/dom/TreeDepthLimit.h \ WebCore/dom/TreeWalker.cpp \ WebCore/dom/TreeWalker.h \ WebCore/dom/UIEvent.cpp \ @@ -1048,8 +1050,11 @@ webcore_sources += \ WebCore/html/DOMFormData.h \ WebCore/html/File.cpp \ WebCore/html/File.h \ + WebCore/html/FileError.h \ WebCore/html/FileList.cpp \ WebCore/html/FileList.h \ + WebCore/html/FileReader.cpp \ + WebCore/html/FileReader.h \ WebCore/html/FileStream.cpp \ WebCore/html/FileStream.h \ WebCore/html/FileStreamClient.h \ @@ -1271,6 +1276,8 @@ webcore_sources += \ WebCore/inspector/InjectedScriptHost.h \ WebCore/inspector/InspectorBackend.cpp \ WebCore/inspector/InspectorBackend.h \ + WebCore/inspector/InspectorCSSStore.cpp \ + WebCore/inspector/InspectorCSSStore.h \ WebCore/inspector/InspectorDatabaseResource.cpp \ WebCore/inspector/InspectorDatabaseResource.h \ WebCore/inspector/InspectorDOMAgent.cpp \ @@ -1639,10 +1646,9 @@ webcore_sources += \ WebCore/platform/graphics/GeneratedImage.h \ WebCore/platform/graphics/Generator.h \ WebCore/platform/graphics/GlyphBuffer.h \ + WebCore/platform/graphics/GlyphMetricsMap.h \ WebCore/platform/graphics/GlyphPageTreeNode.cpp \ WebCore/platform/graphics/GlyphPageTreeNode.h \ - WebCore/platform/graphics/GlyphMetricsMap.cpp \ - WebCore/platform/graphics/GlyphMetricsMap.h \ WebCore/platform/graphics/Gradient.cpp \ WebCore/platform/graphics/Gradient.h \ WebCore/platform/graphics/GraphicsContext.cpp \ @@ -2300,25 +2306,21 @@ FEATURE_DEFINES += ENABLE_DATABASE=1 IDL_BINDINGS += \ WebCore/storage/Database.idl \ + WebCore/storage/DatabaseCallback.idl \ WebCore/storage/SQLError.idl \ WebCore/storage/SQLResultSet.idl \ WebCore/storage/SQLResultSetRowList.idl \ - WebCore/storage/SQLTransaction.idl + WebCore/storage/SQLStatementCallback.idl \ + WebCore/storage/SQLStatementErrorCallback.idl \ + WebCore/storage/SQLTransaction.idl \ + WebCore/storage/SQLTransactionCallback.idl \ + WebCore/storage/SQLTransactionErrorCallback.idl webcore_cppflags += \ -DENABLE_DATABASE=1 webcore_sources += \ - WebCore/bindings/js/JSCustomSQLStatementCallback.cpp \ - WebCore/bindings/js/JSCustomSQLStatementCallback.h \ WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp \ - WebCore/bindings/js/JSCustomSQLStatementErrorCallback.h \ - WebCore/bindings/js/JSCustomSQLTransactionCallback.cpp \ - WebCore/bindings/js/JSCustomSQLTransactionCallback.h \ - WebCore/bindings/js/JSCustomSQLTransactionErrorCallback.cpp \ - WebCore/bindings/js/JSCustomSQLTransactionErrorCallback.h \ - WebCore/bindings/js/JSDatabaseCallback.cpp \ - WebCore/bindings/js/JSDatabaseCallback.h \ WebCore/bindings/js/JSDatabaseCustom.cpp \ WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp \ WebCore/bindings/js/JSSQLTransactionCustom.cpp \ @@ -2341,6 +2343,8 @@ webcore_sources += \ WebCore/storage/DatabaseAuthorizer.h \ WebCore/storage/DatabaseCallback.h \ WebCore/storage/DatabaseDetails.h \ + WebCore/storage/DatabaseSync.cpp \ + WebCore/storage/DatabaseSync.h \ WebCore/storage/DatabaseTask.cpp \ WebCore/storage/DatabaseTask.h \ WebCore/storage/DatabaseThread.cpp \ @@ -2368,7 +2372,10 @@ webcore_sources += \ WebCore/storage/SQLTransactionClient.h \ WebCore/storage/SQLTransactionCoordinator.h \ WebCore/storage/SQLTransactionCoordinator.cpp \ - WebCore/storage/SQLTransactionErrorCallback.h + WebCore/storage/SQLTransactionErrorCallback.h \ + WebCore/storage/SQLTransactionSync.cpp \ + WebCore/storage/SQLTransactionSync.h \ + WebCore/storage/SQLTransactionSyncCallback.h else webcore_cppflags += -DENABLE_DATABASE=0 @@ -2670,7 +2677,6 @@ webcore_cppflags += \ -DENABLE_WORKERS=1 webcore_sources += \ - WebCore/bindings/js/JSAbstractWorkerCustom.cpp \ WebCore/bindings/js/JSDedicatedWorkerContextCustom.cpp \ WebCore/bindings/js/JSWorkerConstructor.cpp \ WebCore/bindings/js/JSWorkerConstructor.h \ @@ -3119,15 +3125,26 @@ webcore_sources += \ WebCore/rendering/RenderSVGInlineText.h \ WebCore/rendering/RenderSVGModelObject.cpp \ WebCore/rendering/RenderSVGModelObject.h \ + WebCore/rendering/RenderSVGResource.cpp \ WebCore/rendering/RenderSVGResource.h \ WebCore/rendering/RenderSVGResourceClipper.cpp \ WebCore/rendering/RenderSVGResourceClipper.h \ WebCore/rendering/RenderSVGResourceFilter.cpp \ WebCore/rendering/RenderSVGResourceFilter.h \ + WebCore/rendering/RenderSVGResourceGradient.cpp \ + WebCore/rendering/RenderSVGResourceGradient.h \ + WebCore/rendering/RenderSVGResourceLinearGradient.cpp \ + WebCore/rendering/RenderSVGResourceLinearGradient.h \ WebCore/rendering/RenderSVGResourceMarker.cpp \ WebCore/rendering/RenderSVGResourceMarker.h \ WebCore/rendering/RenderSVGResourceMasker.cpp \ WebCore/rendering/RenderSVGResourceMasker.h \ + WebCore/rendering/RenderSVGResourcePattern.cpp \ + WebCore/rendering/RenderSVGResourcePattern.h \ + WebCore/rendering/RenderSVGResourceRadialGradient.cpp \ + WebCore/rendering/RenderSVGResourceRadialGradient.h \ + WebCore/rendering/RenderSVGResourceSolidColor.cpp \ + WebCore/rendering/RenderSVGResourceSolidColor.h \ WebCore/rendering/RenderSVGRoot.cpp \ WebCore/rendering/RenderSVGRoot.h \ WebCore/rendering/RenderSVGShadowTreeRootContainer.cpp \ @@ -3142,6 +3159,8 @@ webcore_sources += \ WebCore/rendering/RenderSVGTransformableContainer.h \ WebCore/rendering/RenderSVGViewportContainer.cpp \ WebCore/rendering/RenderSVGViewportContainer.h \ + WebCore/rendering/SVGCharacterData.cpp \ + WebCore/rendering/SVGCharacterData.h \ WebCore/rendering/SVGCharacterLayoutInfo.cpp \ WebCore/rendering/SVGCharacterLayoutInfo.h \ WebCore/rendering/SVGInlineFlowBox.cpp \ @@ -3159,6 +3178,7 @@ webcore_sources += \ WebCore/rendering/SVGRootInlineBox.h \ WebCore/rendering/SVGShadowTreeElements.cpp \ WebCore/rendering/SVGShadowTreeElements.h \ + WebCore/rendering/SVGTextChunkLayoutInfo.h \ WebCore/rendering/style/SVGRenderStyle.cpp \ WebCore/rendering/style/SVGRenderStyle.h \ WebCore/rendering/style/SVGRenderStyleDefs.cpp \ @@ -3449,21 +3469,6 @@ webcore_sources += \ WebCore/svg/animation/SVGSMILElement.h \ WebCore/svg/graphics/SVGImage.cpp \ WebCore/svg/graphics/SVGImage.h \ - WebCore/svg/graphics/SVGPaintServer.cpp \ - WebCore/svg/graphics/SVGPaintServer.h \ - WebCore/svg/graphics/SVGPaintServerGradient.cpp \ - WebCore/svg/graphics/SVGPaintServerGradient.h \ - WebCore/svg/graphics/SVGPaintServerLinearGradient.cpp \ - WebCore/svg/graphics/SVGPaintServerLinearGradient.h \ - WebCore/svg/graphics/SVGPaintServerPattern.cpp \ - WebCore/svg/graphics/SVGPaintServerPattern.h \ - WebCore/svg/graphics/SVGPaintServerRadialGradient.cpp \ - WebCore/svg/graphics/SVGPaintServerRadialGradient.h \ - WebCore/svg/graphics/SVGPaintServerSolid.cpp \ - WebCore/svg/graphics/SVGPaintServerSolid.h \ - WebCore/svg/graphics/SVGResource.cpp \ - WebCore/svg/graphics/SVGResource.h \ - WebCore/svg/graphics/SVGResourceListener.h \ WebCore/svg/graphics/filters/SVGDistantLightSource.h \ WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp \ WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h \ @@ -3790,33 +3795,134 @@ $(top_builddir)/DerivedSources/webkit/WebKitDOMObject.h: cp -f $(WebCore)/bindings/gobject/WebKitDOMObject.h $@ # Start with a subset of all the DOM bindings -IDL_BINDINGS_GDOM := \ +IDL_BINDINGS_GDOM += \ WebCore/css/CSSRule.idl \ WebCore/css/CSSRuleList.idl \ WebCore/css/CSSStyleDeclaration.idl \ WebCore/css/CSSStyleSheet.idl \ WebCore/css/CSSValue.idl \ WebCore/css/MediaList.idl \ + WebCore/css/StyleMedia.idl \ WebCore/css/StyleSheet.idl \ + WebCore/css/StyleSheetList.idl \ WebCore/dom/Attr.idl \ + WebCore/dom/CDATASection.idl \ + WebCore/dom/CharacterData.idl \ + WebCore/dom/Comment.idl \ + WebCore/dom/Document.idl \ + WebCore/dom/DocumentFragment.idl \ + WebCore/dom/DocumentType.idl \ + WebCore/dom/DOMImplementation.idl \ WebCore/dom/Element.idl \ + WebCore/dom/EntityReference.idl \ + WebCore/dom/MessagePort.idl \ WebCore/dom/NamedNodeMap.idl \ WebCore/dom/Node.idl \ - WebCore/dom/NodeList.idl + WebCore/dom/NodeFilter.idl \ + WebCore/dom/NodeIterator.idl \ + WebCore/dom/NodeList.idl \ + WebCore/dom/ProcessingInstruction.idl \ + WebCore/dom/Range.idl \ + WebCore/dom/Text.idl \ + WebCore/dom/TreeWalker.idl \ + WebCore/html/Blob.idl \ + WebCore/html/File.idl \ + WebCore/html/FileList.idl \ + WebCore/html/HTMLAnchorElement.idl \ + WebCore/html/HTMLAppletElement.idl \ + WebCore/html/HTMLAreaElement.idl \ + WebCore/html/HTMLBaseElement.idl \ + WebCore/html/HTMLBaseFontElement.idl \ + WebCore/html/HTMLBlockquoteElement.idl \ + WebCore/html/HTMLBodyElement.idl \ + WebCore/html/HTMLBRElement.idl \ + WebCore/html/HTMLButtonElement.idl \ + WebCore/html/HTMLCanvasElement.idl \ + WebCore/html/HTMLCollection.idl \ + WebCore/html/HTMLDirectoryElement.idl \ + WebCore/html/HTMLDivElement.idl \ + WebCore/html/HTMLDListElement.idl \ + WebCore/html/HTMLDocument.idl \ + WebCore/html/HTMLElement.idl \ + WebCore/html/HTMLEmbedElement.idl \ + WebCore/html/HTMLFieldSetElement.idl \ + WebCore/html/HTMLFontElement.idl \ + WebCore/html/HTMLFormElement.idl \ + WebCore/html/HTMLFrameElement.idl \ + WebCore/html/HTMLFrameSetElement.idl \ + WebCore/html/HTMLHeadElement.idl \ + WebCore/html/HTMLHeadingElement.idl \ + WebCore/html/HTMLHRElement.idl \ + WebCore/html/HTMLHtmlElement.idl \ + WebCore/html/HTMLIFrameElement.idl \ + WebCore/html/HTMLImageElement.idl \ + WebCore/html/HTMLInputElement.idl \ + WebCore/html/HTMLIsIndexElement.idl \ + WebCore/html/HTMLLabelElement.idl \ + WebCore/html/HTMLLegendElement.idl \ + WebCore/html/HTMLLIElement.idl \ + WebCore/html/HTMLLinkElement.idl \ + WebCore/html/HTMLMapElement.idl \ + WebCore/html/HTMLMarqueeElement.idl \ + WebCore/html/HTMLMenuElement.idl \ + WebCore/html/HTMLMetaElement.idl \ + WebCore/html/HTMLModElement.idl \ + WebCore/html/HTMLObjectElement.idl \ + WebCore/html/HTMLOListElement.idl \ + WebCore/html/HTMLOptGroupElement.idl \ + WebCore/html/HTMLOptionElement.idl \ + WebCore/html/HTMLOptionsCollection.idl \ + WebCore/html/HTMLParagraphElement.idl \ + WebCore/html/HTMLParamElement.idl \ + WebCore/html/HTMLPreElement.idl \ + WebCore/html/HTMLQuoteElement.idl \ + WebCore/html/HTMLScriptElement.idl \ + WebCore/html/HTMLSelectElement.idl \ + WebCore/html/HTMLStyleElement.idl \ + WebCore/html/HTMLTableElement.idl \ + WebCore/html/HTMLTableCaptionElement.idl \ + WebCore/html/HTMLTableColElement.idl \ + WebCore/html/HTMLTableSectionElement.idl \ + WebCore/html/HTMLTableCellElement.idl \ + WebCore/html/HTMLTextAreaElement.idl \ + WebCore/html/HTMLTitleElement.idl \ + WebCore/html/HTMLTableRowElement.idl \ + WebCore/html/HTMLUListElement.idl \ + WebCore/html/ValidityState.idl \ + WebCore/loader/appcache/DOMApplicationCache.idl \ + WebCore/page/BarInfo.idl \ + WebCore/page/Console.idl \ + WebCore/page/DOMWindow.idl \ + WebCore/page/DOMSelection.idl \ + WebCore/page/Geolocation.idl \ + WebCore/page/History.idl \ + WebCore/page/Location.idl \ + WebCore/page/Navigator.idl \ + WebCore/page/Screen.idl \ + WebCore/page/WebKitPoint.idl \ + WebCore/plugins/MimeType.idl \ + WebCore/plugins/MimeTypeArray.idl \ + WebCore/plugins/Plugin.idl \ + WebCore/plugins/PluginArray.idl \ + WebCore/storage/Database.idl \ + WebCore/storage/Storage.idl \ + WebCore/xml/XPathExpression.idl \ + WebCore/xml/XPathNSResolver.idl \ + WebCore/xml/XPathResult.idl # All classes autogenerated in the GObject DOM bindings -GDOM_AUTO_CLASSES := $(basename $(notdir $(IDL_BINDINGS_GDOM))) +GDOM_AUTO_CLASSES += $(basename $(notdir $(IDL_BINDINGS_GDOM))) # The classes implemented manually -GDOM_FIXED_CLASSES := Object +GDOM_FIXED_CLASSES += Object -GDOM_CLASSES := $(GDOM_AUTO_CLASSES) $(GDOM_FIXED_CLASSES) +GDOM_CLASSES += $(GDOM_AUTO_CLASSES) $(GDOM_FIXED_CLASSES) # Filter out SVG for now FEATURE_DEFINES_GDOM := $(filter-out ENABLE-SVG%, $(FEATURE_DEFINES)) # Autogenerated header files -GDOM_HEADERS_BUILT := $(patsubst %,DerivedSources/webkit/WebKitDOM%.h,$(GDOM_AUTO_CLASSES)) \ +GDOM_HEADERS_BUILT += $(patsubst %,$(top_builddir)/DerivedSources/webkit/WebKitDOM%.h,$(GDOM_AUTO_CLASSES)) \ $(top_builddir)/DerivedSources/webkit/webkitdom.h \ $(top_builddir)/DerivedSources/webkit/webkitdomdefines.h \ $(top_builddir)/DerivedSources/webkit/WebKitDOMObject.h @@ -3825,10 +3931,10 @@ GDOM_HEADERS_BUILT := $(patsubst %,DerivedSources/webkit/WebKitDOM%.h,$(GDOM_AUT GDOM_SOURCES_BUILT := $(patsubst %,DerivedSources/webkit/WebKitDOM%.cpp,$(GDOM_AUTO_CLASSES)) # Hand-coded header files -GDOM_HEADERS_FIXED := $(patsubst %,$(srcdir)/WebCore/bindings/gobject/WebKitDOM%.h,$(GDOM_FIXED_CLASSES)) +GDOM_HEADERS_FIXED += $(patsubst %,$(srcdir)/WebCore/bindings/gobject/WebKitDOM%.h,$(GDOM_FIXED_CLASSES)) # All header files that get installed -libgdom_h_api := $(GDOM_HEADERS_FIXED) $(GDOM_HEADERS_BUILT) +libgdom_h_api += $(GDOM_HEADERS_FIXED) $(GDOM_HEADERS_BUILT) DerivedSources/webkit/webkitdom.h: $(WebCore)/bindings/scripts/gobject-generate-headers.pl echo $(GDOM_CLASSES) | $(PERL) $< gdom > $@ diff --git a/WebCore/WebCore.ProtectionSpaceAuthCallback.exp b/WebCore/WebCore.ProtectionSpaceAuthCallback.exp new file mode 100644 index 0000000..4c27ed9 --- /dev/null +++ b/WebCore/WebCore.ProtectionSpaceAuthCallback.exp @@ -0,0 +1,2 @@ +__ZN7WebCore3macERKNS_15ProtectionSpaceE +__ZNK7WebCore15ProtectionSpace20authenticationSchemeEv diff --git a/WebCore/WebCore.base.exp b/WebCore/WebCore.base.exp index fed064d..bcf4fd3 100644 --- a/WebCore/WebCore.base.exp +++ b/WebCore/WebCore.base.exp @@ -261,7 +261,7 @@ __ZN7WebCore12TextEncodingC1ERKNS_6StringE __ZN7WebCore12TextIterator11rangeLengthEPKNS_5RangeEb __ZN7WebCore12TextIterator26rangeFromLocationAndLengthEPNS_7ElementEiib __ZN7WebCore12TextIterator7advanceEv -__ZN7WebCore12TextIteratorC1EPKNS_5RangeEbb +__ZN7WebCore12TextIteratorC1EPKNS_5RangeENS_20TextIteratorBehaviorE __ZN7WebCore12WorkerThread17workerThreadCountEv __ZN7WebCore12applyCommandEN3WTF10PassRefPtrINS_11EditCommandEEE __ZN7WebCore12cacheStorageEv @@ -599,12 +599,13 @@ __ZN7WebCore6StringC1EP8NSString __ZN7WebCore6StringC1EPK10__CFString __ZN7WebCore6Widget12setFrameRectERKNS_7IntRectE __ZN7WebCore6Widget16removeFromParentEv +__ZN7WebCore6Widget17frameRectsChangedEv __ZN7WebCore6Widget20retainPlatformWidgetEv __ZN7WebCore6Widget21releasePlatformWidgetEv __ZN7WebCore6Widget4hideEv __ZN7WebCore6Widget4showEv __ZN7WebCore6Widget5paintEPNS_15GraphicsContextERKNS_7IntRectE -__ZN7WebCore6Widget8setFocusEv +__ZN7WebCore6Widget8setFocusEb __ZN7WebCore6Widget9setParentEPNS_10ScrollViewE __ZN7WebCore6WidgetC1EP6NSView __ZN7WebCore6WidgetC2EP6NSView @@ -677,6 +678,7 @@ __ZN7WebCore8Settings28setForceFTPDirectoryListingsEb __ZN7WebCore8Settings29setAuthorAndUserStylesEnabledEb __ZN7WebCore8Settings29setWebArchiveDebugModeEnabledEb __ZN7WebCore8Settings30setAllowFileAccessFromFileURLsEb +__ZN7WebCore8Settings31setJavaScriptCanAccessClipboardEb __ZN7WebCore8Settings31setShrinksStandaloneImagesToFitEb __ZN7WebCore8Settings32setAcceleratedCompositingEnabledEb __ZN7WebCore8Settings32setNeedsAdobeFrameReloadingQuirkEb @@ -996,6 +998,7 @@ __ZNK7WebCore9FrameTree6parentEb __ZNK7WebCore9FrameView11needsLayoutEv __ZNK7WebCore9FrameView13paintBehaviorEv __ZNK7WebCore9FrameView20isSoftwareRenderableEv +__ZNK7WebCore9FrameView28isEnclosedInCompositingLayerEv __ZNK7WebCore9PageCache10frameCountEv __ZNK7WebCore9PageCache21autoreleasedPageCountEv __ZTVN7WebCore12ChromeClientE diff --git a/WebCore/WebCore.gyp/WebCore.gyp b/WebCore/WebCore.gyp/WebCore.gyp index c564aff..e9ab1d7 100644 --- a/WebCore/WebCore.gyp/WebCore.gyp +++ b/WebCore/WebCore.gyp/WebCore.gyp @@ -115,7 +115,6 @@ '../bindings/v8', '../bindings/v8/custom', '../bindings/v8/specialization', - '../bridge', '../css', '../dom', '../dom/default', @@ -288,7 +287,6 @@ 'inputs': [ '../css/makeprop.pl', '../css/CSSPropertyNames.in', - '../css/SVGCSSPropertyNames.in', ], 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/webkit/CSSPropertyNames.cpp', @@ -301,13 +299,19 @@ '--', '<@(_inputs)' ], + 'conditions': [ + ['enable_svg!=0', { + 'inputs': [ + '../css/SVGCSSPropertyNames.in', + ], + }], + ], }, { 'action_name': 'CSSValueKeywords', 'inputs': [ '../css/makevalues.pl', '../css/CSSValueKeywords.in', - '../css/SVGCSSValueKeywords.in', ], 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/webkit/CSSValueKeywords.c', @@ -320,6 +324,13 @@ '--', '<@(_inputs)' ], + 'conditions': [ + ['enable_svg!=0', { + 'inputs': [ + '../css/SVGCSSValueKeywords.in', + ], + }], + ], }, { 'action_name': 'HTMLNames', @@ -988,6 +999,7 @@ # Cherry-pick some files that can't be included by broader regexps. # Some of these are used instead of Chromium platform files, see # the specific exclusions in the "sources!" list below. + ['include', 'rendering/RenderThemeMac\\.mm$'], ['include', 'loader/archive/cf/LegacyWebArchive\\.cpp$'], ['include', 'platform/graphics/mac/ColorMac\\.mm$'], ['include', 'platform/graphics/mac/FloatPointMac\\.mm$'], diff --git a/WebCore/WebCore.gyp/scripts/action_derivedsourcesallinone.py b/WebCore/WebCore.gyp/scripts/action_derivedsourcesallinone.py index 6a11414..c9c5bf5 100644 --- a/WebCore/WebCore.gyp/scripts/action_derivedsourcesallinone.py +++ b/WebCore/WebCore.gyp/scripts/action_derivedsourcesallinone.py @@ -49,7 +49,7 @@ import subprocess import sys # A regexp for finding Conditional attributes in interface definitions. -conditionalPattern = re.compile('interface[\s]*\[[^\]]*Conditional=([\_0-9a-zA-Z&]*)') +conditionalPattern = re.compile('interface[\s]*\[[^\]]*Conditional=([\_0-9a-zA-Z&|]*)') copyrightTemplate = """/* * THIS FILE WAS AUTOMATICALLY GENERATED, DO NOT EDIT. @@ -82,11 +82,13 @@ copyrightTemplate = """/* """ -# Wraps conditional with ENABLE() and && if more than one conditional is specified. +# Wraps conditional with ENABLE() and replace '&','|' with '&&','||' if more than one conditional is specified. def formatConditional(conditional): def wrapWithEnable(s): + if re.match('[|&]$', s): + return s * 2 return 'ENABLE(' + s + ')' - return ' && '.join(map(wrapWithEnable, conditional)) + return ' '.join(map(wrapWithEnable, conditional)) # Find the conditional interface attribute. @@ -101,7 +103,7 @@ def extractConditional(idlFilePath): match = conditionalPattern.search(idlContents) if match: conditional = match.group(1) - conditional = conditional.split('&') + conditional = re.split('([|&])', conditional) return conditional diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi index d4d6767..263bde2 100644 --- a/WebCore/WebCore.gypi +++ b/WebCore/WebCore.gypi @@ -18,10 +18,10 @@ 'css/CSSVariablesDeclaration.idl', 'css/CSSVariablesRule.idl', 'css/Counter.idl', - 'css/Media.idl', 'css/MediaList.idl', - 'css/RGBColor.idl', 'css/Rect.idl', + 'css/RGBColor.idl', + 'css/StyleMedia.idl', 'css/StyleSheet.idl', 'css/StyleSheetList.idl', 'css/WebKitCSSKeyframeRule.idl', @@ -109,6 +109,7 @@ 'html/DataGridColumnList.idl', 'html/DOMFormData.idl', 'html/File.idl', + 'html/FileError.idl', 'html/FileList.idl', 'html/HTMLAllCollection.idl', 'html/HTMLAnchorElement.idl', @@ -217,6 +218,7 @@ 'plugins/Plugin.idl', 'plugins/PluginArray.idl', 'storage/Database.idl', + 'storage/DatabaseCallback.idl', 'storage/IDBDatabaseError.idl', 'storage/IDBDatabaseException.idl', 'storage/IDBDatabaseRequest.idl', @@ -224,7 +226,11 @@ 'storage/SQLError.idl', 'storage/SQLResultSet.idl', 'storage/SQLResultSetRowList.idl', + 'storage/SQLStatementCallback.idl', + 'storage/SQLStatementErrorCallback.idl', 'storage/SQLTransaction.idl', + 'storage/SQLTransactionCallback.idl', + 'storage/SQLTransactionErrorCallback.idl', 'storage/Storage.idl', 'storage/StorageEvent.idl', 'websockets/WebSocket.idl', @@ -495,14 +501,7 @@ 'bindings/js/JSCustomPositionCallback.h', 'bindings/js/JSCustomPositionErrorCallback.cpp', 'bindings/js/JSCustomPositionErrorCallback.h', - 'bindings/js/JSCustomSQLStatementCallback.cpp', - 'bindings/js/JSCustomSQLStatementCallback.h', 'bindings/js/JSCustomSQLStatementErrorCallback.cpp', - 'bindings/js/JSCustomSQLStatementErrorCallback.h', - 'bindings/js/JSCustomSQLTransactionCallback.cpp', - 'bindings/js/JSCustomSQLTransactionCallback.h', - 'bindings/js/JSCustomSQLTransactionErrorCallback.cpp', - 'bindings/js/JSCustomSQLTransactionErrorCallback.h', 'bindings/js/JSCustomVoidCallback.cpp', 'bindings/js/JSCustomVoidCallback.h', 'bindings/js/JSCustomXPathNSResolver.cpp', @@ -515,7 +514,6 @@ 'bindings/js/JSDebugWrapperSet.cpp', 'bindings/js/JSDebugWrapperSet.h', 'bindings/js/JSDocumentCustom.cpp', - 'bindings/js/JSDocumentFragmentCustom.cpp', 'bindings/js/JSDOMApplicationCacheCustom.cpp', 'bindings/js/JSDOMBinding.cpp', 'bindings/js/JSDOMBinding.h', @@ -708,20 +706,11 @@ 'bindings/v8/custom/V8CustomPositionCallback.h', 'bindings/v8/custom/V8CustomPositionErrorCallback.cpp', 'bindings/v8/custom/V8CustomPositionErrorCallback.h', - 'bindings/v8/custom/V8CustomSQLStatementCallback.cpp', - 'bindings/v8/custom/V8CustomSQLStatementCallback.h', 'bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp', - 'bindings/v8/custom/V8CustomSQLStatementErrorCallback.h', - 'bindings/v8/custom/V8CustomSQLTransactionCallback.cpp', - 'bindings/v8/custom/V8CustomSQLTransactionCallback.h', - 'bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp', - 'bindings/v8/custom/V8CustomSQLTransactionErrorCallback.h', 'bindings/v8/custom/V8CustomVoidCallback.cpp', 'bindings/v8/custom/V8CustomVoidCallback.h', 'bindings/v8/custom/V8CustomXPathNSResolver.cpp', 'bindings/v8/custom/V8CustomXPathNSResolver.h', - 'bindings/v8/custom/V8DatabaseCallback.cpp', - 'bindings/v8/custom/V8DatabaseCallback.h', 'bindings/v8/custom/V8DatabaseCustom.cpp', 'bindings/v8/custom/V8DataGridColumnListCustom.cpp', 'bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp', @@ -768,8 +757,6 @@ 'bindings/v8/custom/V8NamedNodesCollection.cpp', 'bindings/v8/custom/V8NamedNodesCollection.h', 'bindings/v8/custom/V8NodeCustom.cpp', - 'bindings/v8/custom/V8NodeFilterCustom.cpp', - 'bindings/v8/custom/V8NodeIteratorCustom.cpp', 'bindings/v8/custom/V8NodeListCustom.cpp', 'bindings/v8/custom/V8NotificationCenterCustom.cpp', 'bindings/v8/custom/V8PopStateEventCustom.cpp', @@ -786,7 +773,6 @@ 'bindings/v8/custom/V8SharedWorkerCustom.cpp', 'bindings/v8/custom/V8StyleSheetCustom.cpp', 'bindings/v8/custom/V8StyleSheetListCustom.cpp', - 'bindings/v8/custom/V8TreeWalkerCustom.cpp', 'bindings/v8/custom/V8WebKitCSSMatrixConstructor.cpp', 'bindings/v8/custom/V8WebKitPointConstructor.cpp', 'bindings/v8/custom/V8WebSocketCustom.cpp', @@ -1015,33 +1001,33 @@ 'css/FontValue.h', 'css/MediaFeatureNames.cpp', 'css/MediaFeatureNames.h', - 'css/Media.cpp', - 'css/Media.h', 'css/MediaList.cpp', 'css/MediaList.h', 'css/MediaQuery.cpp', - 'css/MediaQuery.h', 'css/MediaQueryEvaluator.cpp', 'css/MediaQueryEvaluator.h', 'css/MediaQueryExp.cpp', 'css/MediaQueryExp.h', + 'css/MediaQuery.h', 'css/Pair.h', 'css/Rect.h', 'css/RGBColor.cpp', 'css/RGBColor.h', - 'css/SVGCSSComputedStyleDeclaration.cpp', - 'css/SVGCSSParser.cpp', - 'css/SVGCSSStyleSelector.cpp', 'css/ShadowValue.cpp', 'css/ShadowValue.h', 'css/StyleBase.cpp', 'css/StyleBase.h', 'css/StyleList.cpp', 'css/StyleList.h', + 'css/StyleMedia.cpp', + 'css/StyleMedia.h', 'css/StyleSheet.cpp', 'css/StyleSheet.h', 'css/StyleSheetList.cpp', 'css/StyleSheetList.h', + 'css/SVGCSSComputedStyleDeclaration.cpp', + 'css/SVGCSSParser.cpp', + 'css/SVGCSSStyleSelector.cpp', 'css/WebKitCSSKeyframeRule.cpp', 'css/WebKitCSSKeyframeRule.h', 'css/WebKitCSSKeyframesRule.cpp', @@ -1232,6 +1218,7 @@ 'dom/TransformSource.h', 'dom/Traversal.cpp', 'dom/Traversal.h', + 'dom/TreeDepthLimit.h', 'dom/TreeWalker.cpp', 'dom/TreeWalker.h', 'dom/UIEvent.cpp', @@ -1442,8 +1429,11 @@ 'html/DateComponents.h', 'html/File.cpp', 'html/File.h', + 'html/FileError.h', 'html/FileList.cpp', 'html/FileList.h', + 'html/FileReader.cpp', + 'html/FileReader.h', 'html/FileStream.cpp', 'html/FileStream.h', 'html/FileStreamClient.h', @@ -1650,6 +1640,8 @@ 'inspector/InspectorBackend.h', 'inspector/InspectorController.cpp', 'inspector/InspectorController.h', + 'inspector/InspectorCSSStore.cpp', + 'inspector/InspectorCSSStore.h', 'inspector/InspectorDatabaseResource.cpp', 'inspector/InspectorDatabaseResource.h', 'inspector/InspectorDOMAgent.cpp', @@ -2163,6 +2155,8 @@ 'platform/graphics/mac/MediaPlayerPrivateQTKit.h', 'platform/graphics/mac/MediaPlayerPrivateQTKit.mm', 'platform/graphics/mac/MediaPlayerProxy.h', + 'platform/graphics/mac/SimpleFontDataATSUI.mm', + 'platform/graphics/mac/SimpleFontDataCoreText.cpp', 'platform/graphics/mac/SimpleFontDataMac.mm', 'platform/graphics/mac/WebLayer.h', 'platform/graphics/mac/WebLayer.mm', @@ -2341,10 +2335,9 @@ 'platform/graphics/GeneratedImage.h', 'platform/graphics/Generator.h', 'platform/graphics/GlyphBuffer.h', + 'platform/graphics/GlyphMetricsMap.h', 'platform/graphics/GlyphPageTreeNode.cpp', 'platform/graphics/GlyphPageTreeNode.h', - 'platform/graphics/GlyphMetricsMap.cpp', - 'platform/graphics/GlyphMetricsMap.h', 'platform/graphics/Gradient.cpp', 'platform/graphics/Gradient.h', 'platform/graphics/GraphicsContext.cpp', @@ -2661,7 +2654,7 @@ 'platform/qt/SharedBufferQt.cpp', 'platform/qt/SharedTimerQt.cpp', 'platform/qt/SoundQt.cpp', - 'platform/qt/TemporaryLinkStubs.cpp', + 'platform/qt/TemporaryLinkStubsQt.cpp', 'platform/qt/WheelEventQt.cpp', 'platform/qt/WidgetQt.cpp', 'platform/sql/SQLValue.cpp', @@ -3169,15 +3162,26 @@ 'rendering/RenderSVGInlineText.h', 'rendering/RenderSVGModelObject.cpp', 'rendering/RenderSVGModelObject.h', + 'rendering/RenderSVGResource.cpp', 'rendering/RenderSVGResource.h', 'rendering/RenderSVGResourceClipper.cpp', 'rendering/RenderSVGResourceClipper.h', 'rendering/RenderSVGResourceFilter.cpp', 'rendering/RenderSVGResourceFilter.h', + 'rendering/RenderSVGResourceGradient.cpp', + 'rendering/RenderSVGResourceGradient.h', + 'rendering/RenderSVGResourceLinearGradient.cpp', + 'rendering/RenderSVGResourceLinearGradient.h', 'rendering/RenderSVGResourceMarker.cpp', 'rendering/RenderSVGResourceMarker.h', 'rendering/RenderSVGResourceMasker.cpp', 'rendering/RenderSVGResourceMasker.h', + 'rendering/RenderSVGResourcePattern.cpp', + 'rendering/RenderSVGResourcePattern.h', + 'rendering/RenderSVGResourceRadialGradient.cpp', + 'rendering/RenderSVGResourceRadialGradient.h', + 'rendering/RenderSVGResourceSolidColor.cpp', + 'rendering/RenderSVGResourceSolidColor.h', 'rendering/RenderSVGRoot.cpp', 'rendering/RenderSVGRoot.h', 'rendering/RenderSVGShadowTreeRootContainer.cpp', @@ -3251,6 +3255,8 @@ 'rendering/RootInlineBox.h', 'rendering/ScrollBehavior.cpp', 'rendering/ScrollBehavior.h', + 'rendering/SVGCharacterData.cpp', + 'rendering/SVGCharacterData.h', 'rendering/SVGCharacterLayoutInfo.cpp', 'rendering/SVGCharacterLayoutInfo.h', 'rendering/SVGInlineFlowBox.cpp', @@ -3268,6 +3274,7 @@ 'rendering/SVGRootInlineBox.h', 'rendering/SVGShadowTreeElements.cpp', 'rendering/SVGShadowTreeElements.h', + 'rendering/SVGTextChunkLayoutInfo.h', 'rendering/TableLayout.h', 'rendering/TextControlInnerElements.cpp', 'rendering/TextControlInnerElements.h', @@ -3289,6 +3296,8 @@ 'storage/DatabaseAuthorizer.h', 'storage/DatabaseCallback.h', 'storage/DatabaseDetails.h', + 'storage/DatabaseSync.cpp', + 'storage/DatabaseSync.h', 'storage/DatabaseTask.cpp', 'storage/DatabaseTask.h', 'storage/DatabaseThread.cpp', @@ -3334,6 +3343,9 @@ 'storage/SQLTransactionCoordinator.h', 'storage/SQLTransactionCoordinator.cpp', 'storage/SQLTransactionErrorCallback.h', + 'storage/SQLTransactionSync.cpp', + 'storage/SQLTransactionSync.h', + 'storage/SQLTransactionSyncCallback.h', 'storage/Storage.cpp', 'storage/Storage.h', 'storage/StorageArea.h', @@ -3392,21 +3404,6 @@ 'svg/graphics/filters/SVGSpotLightSource.h', 'svg/graphics/SVGImage.cpp', 'svg/graphics/SVGImage.h', - 'svg/graphics/SVGPaintServer.cpp', - 'svg/graphics/SVGPaintServer.h', - 'svg/graphics/SVGPaintServerGradient.cpp', - 'svg/graphics/SVGPaintServerGradient.h', - 'svg/graphics/SVGPaintServerLinearGradient.cpp', - 'svg/graphics/SVGPaintServerLinearGradient.h', - 'svg/graphics/SVGPaintServerPattern.cpp', - 'svg/graphics/SVGPaintServerPattern.h', - 'svg/graphics/SVGPaintServerRadialGradient.cpp', - 'svg/graphics/SVGPaintServerRadialGradient.h', - 'svg/graphics/SVGPaintServerSolid.cpp', - 'svg/graphics/SVGPaintServerSolid.h', - 'svg/graphics/SVGResource.cpp', - 'svg/graphics/SVGResource.h', - 'svg/graphics/SVGResourceListener.h', 'svg/ColorDistance.cpp', 'svg/ColorDistance.h', 'svg/ElementTimeControl.h', diff --git a/WebCore/WebCore.pri b/WebCore/WebCore.pri index e45bd99..0581dae 100644 --- a/WebCore/WebCore.pri +++ b/WebCore/WebCore.pri @@ -4,6 +4,10 @@ CONFIG(standalone_package) { isEmpty(WC_GENERATED_SOURCES_DIR):WC_GENERATED_SOURCES_DIR = generated } +CONFIG(minimal) { + DEFINES += ENABLE_NETSCAPE_PLUGIN_API=0 +} + ## Define default features macros for optional components ## (look for defs in config.h and included files!) # Try to locate sqlite3 source @@ -159,9 +163,12 @@ contains(DEFINES, ENABLE_WEB_SOCKETS=1): FEATURE_DEFINES_JAVASCRIPT += ENABLE_WE contains(DEFINES, ENABLE_TOUCH_EVENTS=1): FEATURE_DEFINES_JAVASCRIPT += ENABLE_TOUCH_EVENTS=1 contains(DEFINES, ENABLE_TILED_BACKING_STORE=1): FEATURE_DEFINES_JAVASCRIPT += ENABLE_TILED_BACKING_STORE=1 contains(DEFINES, ENABLE_NOTIFICATIONS=1): FEATURE_DEFINES_JAVASCRIPT += ENABLE_NOTIFICATIONS=1 +contains(DEFINES, ENABLE_PROGRESS_TAG=1): FEATURE_DEFINES_JAVASCRIPT += ENABLE_PROGRESS_TAG=1 ## Derived source generators +MATHML_NAMES = $$PWD/mathml/mathtags.in + WML_NAMES = $$PWD/wml/WMLTagNames.in SVG_NAMES = $$PWD/svg/svgtags.in @@ -205,6 +212,7 @@ contains(DEFINES, ENABLE_WCSS=1) { STYLESHEETS_EMBED = \ $$PWD/css/html.css \ $$PWD/css/quirks.css \ + $$PWD/css/mathml.css \ $$PWD/css/svg.css \ $$PWD/css/view-source.css \ $$PWD/css/wml.css \ @@ -230,10 +238,10 @@ IDL_BINDINGS += \ css/CSSValueList.idl \ css/CSSVariablesDeclaration.idl \ css/CSSVariablesRule.idl \ - css/Media.idl \ css/MediaList.idl \ - css/RGBColor.idl \ css/Rect.idl \ + css/RGBColor.idl \ + css/StyleMedia.idl \ css/StyleSheet.idl \ css/StyleSheetList.idl \ css/WebKitCSSKeyframeRule.idl \ @@ -320,6 +328,7 @@ IDL_BINDINGS += \ html/DataGridColumnList.idl \ html/DOMFormData.idl \ html/File.idl \ + html/FileError.idl \ html/FileList.idl \ html/HTMLAllCollection.idl \ html/HTMLAudioElement.idl \ @@ -427,12 +436,17 @@ IDL_BINDINGS += \ plugins/PluginArray.idl \ plugins/MimeTypeArray.idl \ storage/Database.idl \ + storage/DatabaseCallback.idl \ storage/Storage.idl \ storage/StorageEvent.idl \ storage/SQLError.idl \ storage/SQLResultSet.idl \ storage/SQLResultSetRowList.idl \ + storage/SQLStatementCallback.idl \ + storage/SQLStatementErrorCallback.idl \ storage/SQLTransaction.idl \ + storage/SQLTransactionCallback.idl \ + storage/SQLTransactionErrorCallback.idl \ svg/SVGZoomEvent.idl \ svg/SVGAElement.idl \ svg/SVGAltGlyphElement.idl \ @@ -587,6 +601,15 @@ IDL_BINDINGS += \ xml/XPathEvaluator.idl \ xml/XSLTProcessor.idl +contains(DEFINES, ENABLE_MATHML=1) { + mathmlnames.output = $${WC_GENERATED_SOURCES_DIR}/MathMLNames.cpp + mathmlnames.input = MATHML_NAMES + mathmlnames.wkScript = $$PWD/dom/make_names.pl + mathmlnames.commands = perl -I$$PWD/bindings/scripts $$mathmlnames.wkScript --tags $$PWD/mathml/mathtags.in --attrs $$PWD/mathml/mathattrs.in --extraDefines \"$${DEFINES}\" --preprocessor \"$${QMAKE_MOC} -E\" --factory --wrapperFactory --outputDir $$WC_GENERATED_SOURCES_DIR + mathmlnames.wkExtraSources = $${WC_GENERATED_SOURCES_DIR}/MathMLElementFactory.cpp + addExtraCompiler(mathmlnames) +} + contains(DEFINES, ENABLE_WML=1) { wmlnames.output = $${WC_GENERATED_SOURCES_DIR}/WMLNames.cpp wmlnames.input = WML_NAMES diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro index 8d90003..b17f12c 100644 --- a/WebCore/WebCore.pro +++ b/WebCore/WebCore.pro @@ -35,6 +35,9 @@ symbian: { # Move RW-section base address to start from 0xE00000 instead of the toolchain default 0x400000. QMAKE_LFLAGS.ARMCC += --rw-base 0xE00000 MMP_RULES += ALWAYS_BUILD_AS_ARM + } else { + QMAKE_CFLAGS -= --thumb + QMAKE_CXXFLAGS -= --thumb } CONFIG(release, debug|release): QMAKE_CXXFLAGS.ARMCC += -OTime -O3 } @@ -52,8 +55,6 @@ CONFIG(standalone_package) { isEmpty(JSC_GENERATED_SOURCES_DIR):JSC_GENERATED_SOURCES_DIR = $$PWD/../JavaScriptCore/generated PRECOMPILED_HEADER = $$PWD/../WebKit/qt/WebKit_pch.h - - symbian: TARGET += $${QT_LIBINFIX} } else { isEmpty(WC_GENERATED_SOURCES_DIR):WC_GENERATED_SOURCES_DIR = generated isEmpty(JSC_GENERATED_SOURCES_DIR):JSC_GENERATED_SOURCES_DIR = ../JavaScriptCore/generated @@ -68,12 +69,13 @@ CONFIG(standalone_package) { CONFIG(QTDIR_build) { include($$QT_SOURCE_TREE/src/qbase.pri) - # Qt will set the version for us when building in Qt's tree } else { - VERSION = $${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} DESTDIR = $$OUTPUT_DIR/lib !static: DEFINES += QT_MAKEDLL + symbian: TARGET =$$TARGET$${QT_LIBINFIX} } +include($$PWD/../WebKit/qt/qtwebkit_version.pri) +VERSION = $${QT_WEBKIT_MAJOR_VERSION}.$${QT_WEBKIT_MINOR_VERSION}.$${QT_WEBKIT_PATCH_VERSION} unix { QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtNetwork @@ -88,9 +90,6 @@ CONFIG(release):!CONFIG(standalone_package) { unix:contains(QT_CONFIG, reduce_relocations):CONFIG += bsymbolic_functions } -linux-*: DEFINES += HAVE_STDINT_H -freebsd-*: DEFINES += HAVE_PTHREAD_NP_H - DEFINES += BUILD_WEBKIT # Remove whole program optimizations due to miscompilations @@ -123,7 +122,11 @@ maemo5|symbian|embedded { DEFINES += ENABLE_FAST_MOBILE_SCROLLING=1 } -maemo5 { +maemo5|symbian { + DEFINES += WTF_USE_QT_MOBILE_THEME=1 +} + +contains(DEFINES, WTF_USE_QT_MOBILE_THEME=1) { DEFINES += ENABLE_NO_LISTBOX_RENDERING=1 } @@ -132,17 +135,12 @@ addJavaScriptCoreLib(../JavaScriptCore) # HTML5 Media Support -# We require phonon for versions of Qt < 4.7 -# We require QtMultimedia for versions of Qt >= 4.7 +# We require phonon. QtMultimedia support is disabled currently. !contains(DEFINES, ENABLE_VIDEO=.) { DEFINES -= ENABLE_VIDEO=1 DEFINES += ENABLE_VIDEO=0 - lessThan(QT_MINOR_VERSION, 7):contains(QT_CONFIG, phonon) { - DEFINES -= ENABLE_VIDEO=0 - DEFINES += ENABLE_VIDEO=1 - } - !lessThan(QT_MINOR_VERSION, 7):contains(QT_CONFIG, multimedia) { + contains(QT_CONFIG, phonon) { DEFINES -= ENABLE_VIDEO=0 DEFINES += ENABLE_VIDEO=1 } @@ -188,6 +186,7 @@ INCLUDEPATH = \ $$PWD/loader/appcache \ $$PWD/loader/archive \ $$PWD/loader/icon \ + $$PWD/mathml \ $$PWD/notifications \ $$PWD/page \ $$PWD/page/animation \ @@ -289,7 +288,6 @@ SOURCES += \ bindings/js/JSDebugWrapperSet.cpp \ bindings/js/JSDesktopNotificationsCustom.cpp \ bindings/js/JSDocumentCustom.cpp \ - bindings/js/JSDocumentFragmentCustom.cpp \ bindings/js/JSDOMFormDataCustom.cpp \ bindings/js/JSDOMGlobalObject.cpp \ bindings/js/JSDOMWindowBase.cpp \ @@ -299,7 +297,6 @@ SOURCES += \ bindings/js/JSElementCustom.cpp \ bindings/js/JSEventCustom.cpp \ bindings/js/JSEventSourceConstructor.cpp \ - bindings/js/JSEventSourceCustom.cpp \ bindings/js/JSEventTarget.cpp \ bindings/js/JSExceptionBase.cpp \ bindings/js/JSGeolocationCustom.cpp \ @@ -429,7 +426,6 @@ SOURCES += \ css/FontFamilyValue.cpp \ css/FontValue.cpp \ css/MediaFeatureNames.cpp \ - css/Media.cpp \ css/MediaList.cpp \ css/MediaQuery.cpp \ css/MediaQueryEvaluator.cpp \ @@ -438,6 +434,7 @@ SOURCES += \ css/ShadowValue.cpp \ css/StyleBase.cpp \ css/StyleList.cpp \ + css/StyleMedia.cpp \ css/StyleSheet.cpp \ css/StyleSheetList.cpp \ css/WebKitCSSKeyframeRule.cpp \ @@ -570,7 +567,6 @@ SOURCES += \ editing/ReplaceSelectionCommand.cpp \ editing/SelectionController.cpp \ editing/SetNodeAttributeCommand.cpp \ - editing/SmartReplace.cpp \ editing/SmartReplaceICU.cpp \ editing/SplitElementCommand.cpp \ editing/SplitTextNodeCommand.cpp \ @@ -603,6 +599,7 @@ SOURCES += \ html/DOMFormData.cpp \ html/File.cpp \ html/FileList.cpp \ + html/FileReader.cpp \ html/FileStream.cpp \ html/FileStreamProxy.cpp \ html/FileThread.cpp \ @@ -697,6 +694,7 @@ SOURCES += \ inspector/InjectedScript.cpp \ inspector/InjectedScriptHost.cpp \ inspector/InspectorBackend.cpp \ + inspector/InspectorCSSStore.cpp \ inspector/InspectorController.cpp \ inspector/InspectorDatabaseResource.cpp \ inspector/InspectorDOMAgent.cpp \ @@ -1027,13 +1025,8 @@ HEADERS += \ bindings/js/JSCSSStyleDeclarationCustom.h \ bindings/js/JSCustomPositionCallback.h \ bindings/js/JSCustomPositionErrorCallback.h \ - bindings/js/JSCustomSQLStatementCallback.h \ - bindings/js/JSCustomSQLStatementErrorCallback.h \ - bindings/js/JSCustomSQLTransactionCallback.h \ - bindings/js/JSCustomSQLTransactionErrorCallback.h \ bindings/js/JSCustomVoidCallback.h \ bindings/js/JSCustomXPathNSResolver.h \ - bindings/js/JSDatabaseCallback.h \ bindings/js/JSDataGridDataSource.h \ bindings/js/JSDebugWrapperSet.h \ bindings/js/JSDOMBinding.h \ @@ -1155,7 +1148,6 @@ HEADERS += \ css/FontFamilyValue.h \ css/FontValue.h \ css/MediaFeatureNames.h \ - css/Media.h \ css/MediaList.h \ css/MediaQueryEvaluator.h \ css/MediaQueryExp.h \ @@ -1164,6 +1156,7 @@ HEADERS += \ css/ShadowValue.h \ css/StyleBase.h \ css/StyleList.h \ + css/StyleMedia.h \ css/StyleSheet.h \ css/StyleSheetList.h \ css/WebKitCSSKeyframeRule.h \ @@ -1248,6 +1241,7 @@ HEADERS += \ dom/TouchList.h \ dom/TransformSource.h \ dom/Traversal.h \ + dom/TreeDepthLimit.h \ dom/TreeWalker.h \ dom/UIEvent.h \ dom/UIEventWithKeyState.h \ @@ -1321,7 +1315,9 @@ HEADERS += \ html/DOMDataGridDataSource.h \ html/DOMFormData.h \ html/File.h \ + html/FileError.h \ html/FileList.h \ + html/FileReader.h \ html/FileStream.h \ html/FileStreamClient.h \ html/FileStreamProxy.h \ @@ -1483,6 +1479,19 @@ HEADERS += \ loader/TextResourceDecoder.h \ loader/ThreadableLoader.h \ loader/WorkerThreadableLoader.h \ + mathml/MathMLElement.h \ + mathml/MathMLInlineContainerElement.h \ + mathml/MathMLMathElement.h \ + mathml/MathMLTextElement.h \ + mathml/RenderMathMLBlock.h \ + mathml/RenderMathMLFraction.h \ + mathml/RenderMathMLMath.h \ + mathml/RenderMathMLOperator.h \ + mathml/RenderMathMLRoot.h \ + mathml/RenderMathMLRow.h \ + mathml/RenderMathMLSquareRoot.h \ + mathml/RenderMathMLSubSup.h \ + mathml/RenderMathMLUnderOver.h \ notifications/Notification.h \ notifications/NotificationCenter.h \ notifications/NotificationPresenter.h \ @@ -1730,9 +1739,14 @@ HEADERS += \ rendering/RenderSVGModelObject.h \ rendering/RenderSVGResource.h \ rendering/RenderSVGResourceClipper.h \ - rendering/RenderSVGResourceFilter.h \ + rendering/RenderSVGResourceFilter.h \ + rendering/RenderSVGResourceGradient.h \ + rendering/RenderSVGResourceLinearGradient.h \ rendering/RenderSVGResourceMarker.h \ rendering/RenderSVGResourceMasker.h \ + rendering/RenderSVGResourcePattern.h \ + rendering/RenderSVGResourceRadialGradient.h \ + rendering/RenderSVGResourceSolidColor.h \ rendering/RenderSVGRoot.h \ rendering/RenderSVGShadowTreeRootContainer.h \ rendering/RenderSVGText.h \ @@ -1784,6 +1798,7 @@ HEADERS += \ rendering/style/StyleVisualData.h \ rendering/style/SVGRenderStyleDefs.h \ rendering/style/SVGRenderStyle.h \ + rendering/SVGCharacterData.h \ rendering/SVGCharacterLayoutInfo.h \ rendering/SVGInlineFlowBox.h \ rendering/SVGInlineTextBox.h \ @@ -1793,6 +1808,7 @@ HEADERS += \ rendering/SVGRenderTreeAsText.h \ rendering/SVGRootInlineBox.h \ rendering/SVGShadowTreeElements.h \ + rendering/SVGTextChunkLayoutInfo.h \ rendering/TextControlInnerElements.h \ rendering/TransformState.h \ svg/animation/SMILTimeContainer.h \ @@ -1814,13 +1830,6 @@ HEADERS += \ svg/graphics/filters/SVGFilter.h \ svg/graphics/filters/SVGLightSource.h \ svg/graphics/SVGImage.h \ - svg/graphics/SVGPaintServerGradient.h \ - svg/graphics/SVGPaintServer.h \ - svg/graphics/SVGPaintServerLinearGradient.h \ - svg/graphics/SVGPaintServerPattern.h \ - svg/graphics/SVGPaintServerRadialGradient.h \ - svg/graphics/SVGPaintServerSolid.h \ - svg/graphics/SVGResource.h \ svg/SVGAElement.h \ svg/SVGAltGlyphElement.h \ svg/SVGAngle.h \ @@ -2031,6 +2040,7 @@ HEADERS += \ $$PWD/../WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h \ $$PWD/../WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h \ $$PWD/../WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h \ + $$PWD/../WebKit/qt/WebCoreSupport/PageClientQt.h \ $$PWD/platform/network/qt/DnsPrefetchHelper.h SOURCES += \ @@ -2066,6 +2076,7 @@ SOURCES += \ platform/network/qt/DnsPrefetchHelper.cpp \ platform/network/qt/QNetworkReplyHandler.cpp \ editing/qt/EditorQt.cpp \ + editing/qt/SmartReplaceQt.cpp \ platform/qt/ClipboardQt.cpp \ platform/qt/ContextMenuItemQt.cpp \ platform/qt/ContextMenuQt.cpp \ @@ -2101,7 +2112,7 @@ SOURCES += \ platform/qt/SharedTimerQt.cpp \ platform/qt/SoundQt.cpp \ platform/qt/LoggingQt.cpp \ - platform/qt/TemporaryLinkStubs.cpp \ + platform/qt/TemporaryLinkStubsQt.cpp \ platform/text/qt/TextBoundariesQt.cpp \ platform/text/qt/TextBreakIteratorQt.cpp \ platform/text/qt/TextCodecQt.cpp \ @@ -2118,6 +2129,7 @@ SOURCES += \ ../WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp \ ../WebKit/qt/WebCoreSupport/InspectorClientQt.cpp \ ../WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp \ + ../WebKit/qt/WebCoreSupport/PageClientQt.cpp \ ../WebKit/qt/Api/qwebframe.cpp \ ../WebKit/qt/Api/qgraphicswebview.cpp \ ../WebKit/qt/Api/qwebpage.cpp \ @@ -2133,13 +2145,15 @@ SOURCES += \ ../WebKit/qt/Api/qwebinspector.cpp \ ../WebKit/qt/Api/qwebkitversion.cpp + +contains(DEFINES, WTF_USE_QT_MOBILE_THEME=1) { + HEADERS += platform/qt/Maemo5Webstyle.h + SOURCES += platform/qt/Maemo5Webstyle.cpp +} + maemo5 { - HEADERS += \ - ../WebKit/qt/WebCoreSupport/QtMaemoWebPopup.h \ - platform/qt/Maemo5Webstyle.h - SOURCES += \ - ../WebKit/qt/WebCoreSupport/QtMaemoWebPopup.cpp \ - platform/qt/Maemo5Webstyle.cpp + HEADERS += ../WebKit/qt/WebCoreSupport/QtMaemoWebPopup.h + SOURCES += ../WebKit/qt/WebCoreSupport/QtMaemoWebPopup.cpp } @@ -2150,8 +2164,7 @@ maemo5 { SOURCES += \ platform/text/cf/StringCF.cpp \ platform/text/cf/StringImplCF.cpp \ - platform/cf/SharedBufferCF.cpp \ - editing/SmartReplaceCF.cpp + platform/cf/SharedBufferCF.cpp LIBS_PRIVATE += -framework Carbon -framework AppKit } @@ -2160,7 +2173,10 @@ maemo5 { LIBS += -lOle32 LIBS += -luser32 } - wince*: LIBS += -lmmtimer + wince* { + LIBS += -lmmtimer + LIBS += -lOle32 + } contains(DEFINES, ENABLE_NETSCAPE_PLUGIN_API=1) { @@ -2262,7 +2278,8 @@ contains(DEFINES, ENABLE_SQLITE=1) { platform/sql/SQLiteTransaction.cpp \ platform/sql/SQLValue.cpp \ storage/Database.cpp \ - storage/DatabaseAuthorizer.cpp + storage/DatabaseAuthorizer.cpp \ + storage/DatabaseSync.cpp } @@ -2280,11 +2297,8 @@ contains(DEFINES, ENABLE_DATABASE=1) { storage/SQLTransaction.cpp \ storage/SQLTransactionClient.cpp \ storage/SQLTransactionCoordinator.cpp \ - bindings/js/JSCustomSQLStatementCallback.cpp \ + storage/SQLTransactionSync.cpp \ bindings/js/JSCustomSQLStatementErrorCallback.cpp \ - bindings/js/JSCustomSQLTransactionCallback.cpp \ - bindings/js/JSCustomSQLTransactionErrorCallback.cpp \ - bindings/js/JSDatabaseCallback.cpp \ bindings/js/JSDatabaseCustom.cpp \ bindings/js/JSSQLResultSetRowListCustom.cpp \ bindings/js/JSSQLTransactionCustom.cpp @@ -2296,6 +2310,7 @@ contains(DEFINES, ENABLE_DOM_STORAGE=1) { storage/DatabaseAuthorizer.h \ storage/Database.h \ storage/DatabaseCallback.h \ + storage/DatabaseSync.h \ storage/DatabaseTask.h \ storage/DatabaseThread.h \ storage/DatabaseTracker.h \ @@ -2309,6 +2324,7 @@ contains(DEFINES, ENABLE_DOM_STORAGE=1) { storage/SQLTransaction.h \ storage/SQLTransactionClient.h \ storage/SQLTransactionCoordinator.h \ + storage/SQLTransactionSync.h \ storage/StorageArea.h \ storage/StorageAreaImpl.h \ storage/StorageAreaSync.h \ @@ -2347,7 +2363,6 @@ contains(DEFINES, ENABLE_ICONDATABASE=1) { contains(DEFINES, ENABLE_WORKERS=1) { SOURCES += \ - bindings/js/JSAbstractWorkerCustom.cpp \ bindings/js/JSDedicatedWorkerContextCustom.cpp \ bindings/js/JSWorkerConstructor.cpp \ bindings/js/JSWorkerContextBase.cpp \ @@ -2391,12 +2406,12 @@ contains(DEFINES, ENABLE_VIDEO=1) { rendering/RenderMedia.cpp \ bindings/js/JSAudioConstructor.cpp - # QtMultimedia since 4.7 - greaterThan(QT_MINOR_VERSION, 6) { + # QtMultimedia disabled currently + false:greaterThan(QT_MINOR_VERSION, 6) { HEADERS += platform/graphics/qt/MediaPlayerPrivateQt.h SOURCES += platform/graphics/qt/MediaPlayerPrivateQt.cpp - QT += multimedia + tobe|!tobe: QT += mediaservices } else { HEADERS += \ platform/graphics/qt/MediaPlayerPrivatePhonon.h @@ -2464,6 +2479,23 @@ contains(DEFINES, ENABLE_FILTERS=1) { platform/graphics/filters/SourceGraphic.cpp } +contains(DEFINES, ENABLE_MATHML=1) { + SOURCES += \ + mathml/MathMLElement.cpp \ + mathml/MathMLInlineContainerElement.cpp \ + mathml/MathMLMathElement.cpp \ + mathml/MathMLTextElement.cpp \ + mathml/RenderMathMLBlock.cpp \ + mathml/RenderMathMLFraction.cpp \ + mathml/RenderMathMLMath.cpp \ + mathml/RenderMathMLOperator.cpp \ + mathml/RenderMathMLRoot.cpp \ + mathml/RenderMathMLRow.cpp \ + mathml/RenderMathMLSquareRoot.cpp \ + mathml/RenderMathMLSubSup.cpp \ + mathml/RenderMathMLUnderOver.cpp +} + contains(DEFINES, ENABLE_WML=1) { SOURCES += \ wml/WMLAElement.cpp \ @@ -2683,13 +2715,6 @@ contains(DEFINES, ENABLE_SVG=1) { svg/graphics/filters/SVGFilterBuilder.cpp \ svg/graphics/filters/SVGLightSource.cpp \ svg/graphics/SVGImage.cpp \ - svg/graphics/SVGPaintServer.cpp \ - svg/graphics/SVGPaintServerGradient.cpp \ - svg/graphics/SVGPaintServerLinearGradient.cpp \ - svg/graphics/SVGPaintServerPattern.cpp \ - svg/graphics/SVGPaintServerRadialGradient.cpp \ - svg/graphics/SVGPaintServerSolid.cpp \ - svg/graphics/SVGResource.cpp \ rendering/RenderForeignObject.cpp \ rendering/RenderPath.cpp \ rendering/RenderSVGBlock.cpp \ @@ -2700,10 +2725,16 @@ contains(DEFINES, ENABLE_SVG=1) { rendering/RenderSVGInline.cpp \ rendering/RenderSVGInlineText.cpp \ rendering/RenderSVGModelObject.cpp \ + rendering/RenderSVGResource.cpp \ rendering/RenderSVGResourceClipper.cpp \ rendering/RenderSVGResourceFilter.cpp \ + rendering/RenderSVGResourceGradient.cpp \ + rendering/RenderSVGResourceLinearGradient.cpp \ rendering/RenderSVGResourceMarker.cpp \ rendering/RenderSVGResourceMasker.cpp \ + rendering/RenderSVGResourcePattern.cpp \ + rendering/RenderSVGResourceRadialGradient.cpp \ + rendering/RenderSVGResourceSolidColor.cpp \ rendering/RenderSVGRoot.cpp \ rendering/RenderSVGShadowTreeRootContainer.cpp \ rendering/RenderSVGText.cpp \ @@ -2711,6 +2742,7 @@ contains(DEFINES, ENABLE_SVG=1) { rendering/RenderSVGTransformableContainer.cpp \ rendering/RenderSVGTSpan.cpp \ rendering/RenderSVGViewportContainer.cpp \ + rendering/SVGCharacterData.cpp \ rendering/SVGCharacterLayoutInfo.cpp \ rendering/SVGInlineFlowBox.cpp \ rendering/SVGInlineTextBox.cpp \ @@ -2772,7 +2804,7 @@ contains(DEFINES, ENABLE_WEB_SOCKETS=1) { } contains(DEFINES, ENABLE_3D_CANVAS=1) { -QT += opengl +tobe|!tobe: QT += opengl HEADERS += \ bindings/js/JSWebGLArrayBufferConstructor.h \ bindings/js/JSWebGLArrayHelper.h \ @@ -2973,3 +3005,6 @@ symbian { } } } + +# Disable C++0x mode in WebCore for those who enabled it in their Qt's mkspec +*-g++*:QMAKE_CXXFLAGS -= -std=c++0x -std=gnu++0x diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj index 0c624c2..eeb9d7f 100644 --- a/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/WebCore/WebCore.vcproj/WebCore.vcproj @@ -3693,6 +3693,14 @@ >
</File>
<File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSFileError.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSFileError.h"
+ >
+ </File>
+ <File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSFileList.cpp"
>
<FileConfiguration
@@ -8141,7 +8149,7 @@ >
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSMedia.cpp"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSStyleMedia.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -8193,7 +8201,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSMedia.h"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSStyleMedia.h"
>
</File>
<File
@@ -22862,10 +22870,6 @@ >
</File>
<File
- RelativePath="..\platform\graphics\GlyphMetricsMap.cpp"
- >
- </File>
- <File
RelativePath="..\platform\graphics\GlyphMetricsMap.h"
>
</File>
@@ -23505,7 +23509,7 @@ >
</File>
<File
- RelativePath="..\platform\graphics\win\RefCountedHFONT.h"
+ RelativePath="..\platform\graphics\win\RefCountedGDIHandle.h"
>
</File>
<File
@@ -27171,11 +27175,11 @@ >
</File>
<File
- RelativePath="..\css\Media.cpp"
+ RelativePath="..\css\StyleMedia.cpp"
>
</File>
<File
- RelativePath="..\css\Media.h"
+ RelativePath="..\css\StyleMedia.h"
>
</File>
<File
@@ -27939,6 +27943,10 @@ >
</File>
<File
+ RelativePath="..\rendering\RenderSVGResource.cpp"
+ >
+ </File>
+ <File
RelativePath="..\rendering\RenderSVGResource.h"
>
</File>
@@ -27959,6 +27967,22 @@ >
</File>
<File
+ RelativePath="..\rendering\RenderSVGResourceGradient.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\rendering\RenderSVGResourceGradient.h"
+ >
+ </File>
+ <File
+ RelativePath="..\rendering\RenderSVGResourceLinearGradient.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\rendering\RenderSVGResourceLinearGradient.h"
+ >
+ </File>
+ <File
RelativePath="..\rendering\RenderSVGResourceMarker.cpp"
>
</File>
@@ -27975,6 +27999,30 @@ >
</File>
<File
+ RelativePath="..\rendering\RenderSVGResourcePattern.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\rendering\RenderSVGResourcePattern.h"
+ >
+ </File>
+ <File
+ RelativePath="..\rendering\RenderSVGResourceRadialGradient.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\rendering\RenderSVGResourceRadialGradient.h"
+ >
+ </File>
+ <File
+ RelativePath="..\rendering\RenderSVGResourceSolidColor.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\rendering\RenderSVGResourceSolidColor.h"
+ >
+ </File>
+ <File
RelativePath="..\rendering\RenderSVGRoot.cpp"
>
</File>
@@ -28261,6 +28309,14 @@ >
</File>
<File
+ RelativePath="..\rendering\SVGCharacterData.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\rendering\SVGCharacterData.h"
+ >
+ </File>
+ <File
RelativePath="..\rendering\SVGCharacterLayoutInfo.cpp"
>
</File>
@@ -28329,6 +28385,10 @@ >
</File>
<File
+ RelativePath="..\rendering\SVGTextChunkLayoutInfo.h"
+ >
+ </File>
+ <File
RelativePath="..\rendering\TableLayout.h"
>
</File>
@@ -29555,6 +29615,10 @@ >
</File>
<File
+ RelativePath="..\dom\TreeDepthLimit.h"
+ >
+ </File>
+ <File
RelativePath="..\dom\TreeWalker.cpp"
>
</File>
@@ -30331,6 +30395,10 @@ >
</File>
<File
+ RelativePath="..\html\FileError.h"
+ >
+ </File>
+ <File
RelativePath="..\html\FileList.cpp"
>
</File>
@@ -30339,6 +30407,14 @@ >
</File>
<File
+ RelativePath="..\html\FileReader.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\FileReader.h"
+ >
+ </File>
+ <File
RelativePath="..\html\FileStream.cpp"
>
</File>
@@ -34731,58 +34807,6 @@ >
</File>
<File
- RelativePath="..\bindings\js\JSAbstractWorkerCustom.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_Internal|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_Cairo|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_Cairo|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_All|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
RelativePath="..\bindings\js\JSAttrCustom.cpp"
>
<FileConfiguration
@@ -35479,62 +35503,6 @@ >
</File>
<File
- RelativePath="..\bindings\js\JSCustomSQLStatementCallback.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_Internal|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_Cairo|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_Cairo|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_All|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\bindings\js\JSCustomSQLStatementCallback.h"
- >
- </File>
- <File
RelativePath="..\bindings\js\JSCustomSQLStatementErrorCallback.cpp"
>
<FileConfiguration
@@ -35587,122 +35555,6 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSCustomSQLStatementErrorCallback.h"
- >
- </File>
- <File
- RelativePath="..\bindings\js\JSCustomSQLTransactionCallback.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_Internal|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_Cairo|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_Cairo|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_All|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\bindings\js\JSCustomSQLTransactionCallback.h"
- >
- </File>
- <File
- RelativePath="..\bindings\js\JSCustomSQLTransactionErrorCallback.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_Internal|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_Cairo|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_Cairo|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_All|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\bindings\js\JSCustomSQLTransactionErrorCallback.h"
- >
- </File>
- <File
RelativePath="..\bindings\js\JSCustomVoidCallback.cpp"
>
<FileConfiguration
@@ -35815,14 +35667,6 @@ >
</File>
<File
- RelativePath="..\bindings\js\JSDatabaseCallback.cpp"
- >
- </File>
- <File
- RelativePath="..\bindings\js\JSDatabaseCallback.h"
- >
- </File>
- <File
RelativePath="..\bindings\js\JSDatabaseCustom.cpp"
>
<FileConfiguration
@@ -36143,58 +35987,6 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\bindings\js\JSDocumentFragmentCustom.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_Internal|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_Cairo|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_Cairo|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_All|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
RelativePath="..\bindings\js\JSDOMApplicationCacheCustom.cpp"
>
<FileConfiguration
@@ -36755,58 +36547,6 @@ >
</File>
<File
- RelativePath="..\bindings\js\JSEventSourceCustom.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_Internal|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_Cairo|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_Cairo|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_All|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
RelativePath="..\bindings\js\JSEventTarget.cpp"
>
<FileConfiguration
@@ -42329,66 +42069,6 @@ RelativePath="..\svg\graphics\SVGImage.h"
>
</File>
- <File
- RelativePath="..\svg\graphics\SVGPaintServer.cpp"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\SVGPaintServer.h"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\SVGPaintServerGradient.cpp"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\SVGPaintServerGradient.h"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\SVGPaintServerLinearGradient.cpp"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\SVGPaintServerLinearGradient.h"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\SVGPaintServerPattern.cpp"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\SVGPaintServerPattern.h"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\SVGPaintServerRadialGradient.cpp"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\SVGPaintServerRadialGradient.h"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\SVGPaintServerSolid.cpp"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\SVGPaintServerSolid.h"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\SVGResource.cpp"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\SVGResource.h"
- >
- </File>
- <File
- RelativePath="..\svg\graphics\SVGResourceListener.h"
- >
- </File>
<Filter
Name="filters"
>
@@ -42871,6 +42551,14 @@ >
</File>
<File
+ RelativePath="..\storage\DatabaseSync.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\DatabaseSync.h"
+ >
+ </File>
+ <File
RelativePath="..\storage\DatabaseTask.h"
>
</File>
@@ -42995,6 +42683,18 @@ >
</File>
<File
+ RelativePath="..\storage\SQLTransactionSync.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\SQLTransactionSync.h"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\SQLTransactionSyncCallback.h"
+ >
+ </File>
+ <File
RelativePath="..\storage\Storage.cpp"
>
</File>
@@ -43239,6 +42939,14 @@ >
</File>
<File
+ RelativePath="..\inspector\InspectorCSSStore.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\inspector\InspectorCSSStore.h"
+ >
+ </File>
+ <File
RelativePath="..\inspector\InspectorClient.h"
>
</File>
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj index fe6d457..450c3fd 100644 --- a/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/WebCore/WebCore.xcodeproj/project.pbxproj @@ -46,6 +46,7 @@ 080081970ED3B2DD00C53BC0 /* WMLAnchorElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 080081950ED3B2DD00C53BC0 /* WMLAnchorElement.h */; }; 0804BF6E0EE09C3B0006C000 /* WMLDoElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0804BF6C0EE09C3B0006C000 /* WMLDoElement.cpp */; }; 0804BF6F0EE09C3B0006C000 /* WMLDoElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 0804BF6D0EE09C3B0006C000 /* WMLDoElement.h */; }; + 08082373117987C100241DE8 /* RenderSVGResourceContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = 08082372117987C100241DE8 /* RenderSVGResourceContainer.h */; }; 080AEC810ED8708B00DF4CCE /* WMLIntrinsicEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 080AEC7D0ED8708A00DF4CCE /* WMLIntrinsicEvent.cpp */; }; 080AEC820ED8708B00DF4CCE /* WMLIntrinsicEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 080AEC7E0ED8708B00DF4CCE /* WMLIntrinsicEvent.h */; }; 080AEC830ED8708B00DF4CCE /* WMLIntrinsicEventHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 080AEC7F0ED8708B00DF4CCE /* WMLIntrinsicEventHandler.cpp */; }; @@ -74,6 +75,9 @@ 083DAEA70F01A7FB00342754 /* RenderTextControlMultiLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 083DAEA30F01A7FB00342754 /* RenderTextControlMultiLine.h */; }; 083DAEA80F01A7FB00342754 /* RenderTextControlSingleLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 083DAEA40F01A7FB00342754 /* RenderTextControlSingleLine.cpp */; }; 083DAEA90F01A7FB00342754 /* RenderTextControlSingleLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 083DAEA50F01A7FB00342754 /* RenderTextControlSingleLine.h */; }; + 0842BC721190144000C7D08F /* SVGCharacterData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0842BC701190144000C7D08F /* SVGCharacterData.cpp */; }; + 0842BC731190144000C7D08F /* SVGCharacterData.h in Headers */ = {isa = PBXBuildFile; fileRef = 0842BC711190144000C7D08F /* SVGCharacterData.h */; }; + 0842BC811190147200C7D08F /* SVGTextChunkLayoutInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 0842BC801190147200C7D08F /* SVGTextChunkLayoutInfo.h */; }; 084AEBE40FB505FA0038483E /* SelectElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 084AEBE20FB505FA0038483E /* SelectElement.cpp */; }; 084AEBE50FB505FA0038483E /* SelectElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 084AEBE30FB505FA0038483E /* SelectElement.h */; }; 084CE5CB0F27DADC00E6240E /* WMLOptGroupElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 084CE5C70F27DADC00E6240E /* WMLOptGroupElement.cpp */; }; @@ -84,6 +88,9 @@ 084D2834110A7FCB0038239A /* SVGAnimatedPropertyTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = 084D2832110A7FCB0038239A /* SVGAnimatedPropertyTraits.h */; settings = {ATTRIBUTES = (Private, ); }; }; 084DBAA10ED39D360038C226 /* WMLVariables.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 084DBA9D0ED39D350038C226 /* WMLVariables.cpp */; }; 084DBAA20ED39D360038C226 /* WMLVariables.h in Headers */ = {isa = PBXBuildFile; fileRef = 084DBA9E0ED39D360038C226 /* WMLVariables.h */; }; + 08563BB4117861780012B578 /* RenderSVGResourcePattern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08563BB2117861770012B578 /* RenderSVGResourcePattern.cpp */; }; + 08563BB5117861780012B578 /* RenderSVGResourcePattern.h in Headers */ = {isa = PBXBuildFile; fileRef = 08563BB3117861770012B578 /* RenderSVGResourcePattern.h */; }; + 08563BD0117865F50012B578 /* RenderSVGResource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08563BCF117865F50012B578 /* RenderSVGResource.cpp */; }; 08591AA50F085C4E009BACB1 /* InputElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 08591AA40F085C4E009BACB1 /* InputElement.h */; settings = {ATTRIBUTES = (Private, ); }; }; 085AFDC80F2977350061F2B3 /* WMLFormControlElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 085AFDC60F2977350061F2B3 /* WMLFormControlElement.cpp */; }; 085AFDC90F2977350061F2B3 /* WMLFormControlElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 085AFDC70F2977350061F2B3 /* WMLFormControlElement.h */; settings = {ATTRIBUTES = (); }; }; @@ -139,10 +146,18 @@ 08A484770E5272C500C3FE76 /* ScriptElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08A484750E5272C500C3FE76 /* ScriptElement.cpp */; }; 08A484780E5272C500C3FE76 /* ScriptElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 08A484760E5272C500C3FE76 /* ScriptElement.h */; }; 08A48A6E0E86CF6D00E225DD /* JSSVGElementInstanceCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08A48A6D0E86CF6D00E225DD /* JSSVGElementInstanceCustom.cpp */; }; + 08C34AF51179C057002D7456 /* RenderSVGResourceGradient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08C34AF11179C056002D7456 /* RenderSVGResourceGradient.cpp */; }; + 08C34AF61179C057002D7456 /* RenderSVGResourceGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = 08C34AF21179C057002D7456 /* RenderSVGResourceGradient.h */; }; + 08C34AF71179C057002D7456 /* RenderSVGResourceLinearGradient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08C34AF31179C057002D7456 /* RenderSVGResourceLinearGradient.cpp */; }; + 08C34AF81179C057002D7456 /* RenderSVGResourceLinearGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = 08C34AF41179C057002D7456 /* RenderSVGResourceLinearGradient.h */; }; + 08C34AFD1179C072002D7456 /* RenderSVGResourceRadialGradient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08C34AFB1179C072002D7456 /* RenderSVGResourceRadialGradient.cpp */; }; + 08C34AFE1179C072002D7456 /* RenderSVGResourceRadialGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = 08C34AFC1179C072002D7456 /* RenderSVGResourceRadialGradient.h */; }; 08C4C5180EF19A4000E4840F /* WMLImageElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08C4C5140EF19A4000E4840F /* WMLImageElement.cpp */; }; 08C4C5190EF19A4000E4840F /* WMLImageElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 08C4C5150EF19A4000E4840F /* WMLImageElement.h */; }; 08C4C51A0EF19A4000E4840F /* WMLImageLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08C4C5160EF19A4000E4840F /* WMLImageLoader.cpp */; }; 08C4C51B0EF19A4000E4840F /* WMLImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 08C4C5170EF19A4000E4840F /* WMLImageLoader.h */; }; + 08C6A7AB117DFBAB00FEA1A2 /* RenderSVGResourceSolidColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08C6A7A9117DFBAB00FEA1A2 /* RenderSVGResourceSolidColor.cpp */; }; + 08C6A7AC117DFBAB00FEA1A2 /* RenderSVGResourceSolidColor.h in Headers */ = {isa = PBXBuildFile; fileRef = 08C6A7AA117DFBAB00FEA1A2 /* RenderSVGResourceSolidColor.h */; }; 08C7A2C710DC7462002D368B /* SVGNames.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 656581E909D1508D000E61D7 /* SVGNames.h */; }; 08C925190FCC7C4A00480DEC /* FilterEffect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08C925170FCC7C4A00480DEC /* FilterEffect.cpp */; }; 08C9251A0FCC7C4A00480DEC /* FilterEffect.h in Headers */ = {isa = PBXBuildFile; fileRef = 08C925180FCC7C4A00480DEC /* FilterEffect.h */; }; @@ -208,13 +223,17 @@ 0FD308D6117D168500A791F7 /* RenderIFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD308D4117D168400A791F7 /* RenderIFrame.h */; }; 0FD723820EC8BD9300CA5DD7 /* FloatQuad.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD723800EC8BD9300CA5DD7 /* FloatQuad.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0FD723830EC8BD9300CA5DD7 /* FloatQuad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FD723810EC8BD9300CA5DD7 /* FloatQuad.cpp */; }; - 0FF5025B102BA9010066F39A /* DOMMedia.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FF50259102BA9010066F39A /* DOMMedia.h */; }; - 0FF5025C102BA9010066F39A /* DOMMedia.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FF5025A102BA9010066F39A /* DOMMedia.mm */; }; - 0FF50263102BA92C0066F39A /* DOMMediaInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FF50262102BA92B0066F39A /* DOMMediaInternal.h */; }; - 0FF50269102BA9430066F39A /* JSMedia.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FF50267102BA9430066F39A /* JSMedia.cpp */; }; - 0FF5026A102BA9430066F39A /* JSMedia.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FF50268102BA9430066F39A /* JSMedia.h */; }; - 0FF50271102BA96A0066F39A /* Media.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FF5026E102BA9660066F39A /* Media.cpp */; }; - 0FF50272102BA96A0066F39A /* Media.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FF5026F102BA96A0066F39A /* Media.h */; }; + 0FF2859011864052007B7CD6 /* RenderMathMLRoot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FF2813211821CB6007B7CD6 /* RenderMathMLRoot.cpp */; }; + 0FF2859111864053007B7CD6 /* RenderMathMLRoot.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FF2813311821CB6007B7CD6 /* RenderMathMLRoot.h */; }; + 0FF2859211864054007B7CD6 /* RenderMathMLSquareRoot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FF2813411821CB6007B7CD6 /* RenderMathMLSquareRoot.cpp */; }; + 0FF2859311864055007B7CD6 /* RenderMathMLSquareRoot.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FF2813511821CB6007B7CD6 /* RenderMathMLSquareRoot.h */; }; + 0FF5025B102BA9010066F39A /* DOMStyleMedia.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FF50259102BA9010066F39A /* DOMStyleMedia.h */; }; + 0FF5025C102BA9010066F39A /* DOMStyleMedia.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FF5025A102BA9010066F39A /* DOMStyleMedia.mm */; }; + 0FF50263102BA92C0066F39A /* DOMStyleMediaInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FF50262102BA92B0066F39A /* DOMStyleMediaInternal.h */; }; + 0FF50269102BA9430066F39A /* JSStyleMedia.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FF50267102BA9430066F39A /* JSStyleMedia.cpp */; }; + 0FF5026A102BA9430066F39A /* JSStyleMedia.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FF50268102BA9430066F39A /* JSStyleMedia.h */; }; + 0FF50271102BA96A0066F39A /* StyleMedia.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FF5026E102BA9660066F39A /* StyleMedia.cpp */; }; + 0FF50272102BA96A0066F39A /* StyleMedia.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FF5026F102BA96A0066F39A /* StyleMedia.h */; }; 1402645E0AFDC19B005919E2 /* LoggingMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1402645D0AFDC19B005919E2 /* LoggingMac.mm */; }; 1403B99709EB13AF00797C7F /* DOMWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 1403B99509EB13AF00797C7F /* DOMWindow.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1403B99809EB13AF00797C7F /* DOMWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1403B99609EB13AF00797C7F /* DOMWindow.cpp */; }; @@ -265,6 +284,8 @@ 15C77094100D3CA8005BA267 /* JSValidityState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15C77092100D3CA8005BA267 /* JSValidityState.cpp */; }; 15C770A5100D41CD005BA267 /* DOMValidityState.mm in Sources */ = {isa = PBXBuildFile; fileRef = 15C770A3100D41CD005BA267 /* DOMValidityState.mm */; }; 15C770A6100D41CD005BA267 /* DOMValidityState.h in Headers */ = {isa = PBXBuildFile; fileRef = 15C770A4100D41CD005BA267 /* DOMValidityState.h */; }; + 163E88F7118A39D200ED9231 /* SimpleFontDataCoreText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 163E88F5118A39D200ED9231 /* SimpleFontDataCoreText.cpp */; }; + 163E8B13118B3ADD00ED9231 /* SimpleFontDataATSUI.mm in Sources */ = {isa = PBXBuildFile; fileRef = 163E8B12118B3ADD00ED9231 /* SimpleFontDataATSUI.mm */; }; 185BCF280F3279CE000EA262 /* ThreadTimers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 185BCF260F3279CE000EA262 /* ThreadTimers.cpp */; }; 185BCF290F3279CE000EA262 /* ThreadTimers.h in Headers */ = {isa = PBXBuildFile; fileRef = 185BCF270F3279CE000EA262 /* ThreadTimers.h */; }; 188604B30F2E654A000B6443 /* DOMTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 188604B10F2E654A000B6443 /* DOMTimer.cpp */; }; @@ -283,6 +304,7 @@ 1A22464C0CC98DDB00C05240 /* SQLiteStatement.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2246460CC98DDB00C05240 /* SQLiteStatement.h */; }; 1A22464D0CC98DDB00C05240 /* SQLiteTransaction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2246470CC98DDB00C05240 /* SQLiteTransaction.cpp */; }; 1A22464E0CC98DDB00C05240 /* SQLiteTransaction.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2246480CC98DDB00C05240 /* SQLiteTransaction.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1A27CF97118A354C0041D632 /* nptypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A27CF96118A354C0041D632 /* nptypes.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1A2A68230B5BEDE70002A480 /* ProgressTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2A68210B5BEDE70002A480 /* ProgressTracker.cpp */; }; 1A2A68240B5BEDE70002A480 /* ProgressTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2A68220B5BEDE70002A480 /* ProgressTracker.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1A2AAC580DC2A3B100A20D9A /* ApplicationCacheStorage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2AAC560DC2A3B100A20D9A /* ApplicationCacheStorage.cpp */; }; @@ -612,6 +634,12 @@ 2E2D99EC10E2BD3900496337 /* DOMBlobInternal.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 2E2D99E910E2BC3800496337 /* DOMBlobInternal.h */; }; 2E3BBF071162DA1100B9409A /* UUID.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E3BBF051162DA1100B9409A /* UUID.cpp */; }; 2E3BBF081162DA1100B9409A /* UUID.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E3BBF061162DA1100B9409A /* UUID.h */; }; + 2E3BC0BD117D3A4F00B9409A /* FileError.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E3BC0BB117D3A4F00B9409A /* FileError.h */; }; + 2E3BC0CA117D3E0800B9409A /* JSFileError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E3BC0C8117D3E0800B9409A /* JSFileError.cpp */; }; + 2E3BC0CB117D3E0800B9409A /* JSFileError.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E3BC0C9117D3E0800B9409A /* JSFileError.h */; }; + 2E3BC108117D479800B9409A /* DOMFileError.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E3BC106117D479800B9409A /* DOMFileError.h */; }; + 2E3BC109117D479800B9409A /* DOMFileError.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E3BC107117D479800B9409A /* DOMFileError.mm */; }; + 2E3BC10B117D47C800B9409A /* DOMFileErrorInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E3BC10A117D47C800B9409A /* DOMFileErrorInternal.h */; }; 2E4346440F546A8200B0F1BA /* GenericWorkerTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E4346320F546A8200B0F1BA /* GenericWorkerTask.h */; }; 2E4346450F546A8200B0F1BA /* Worker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E4346330F546A8200B0F1BA /* Worker.cpp */; }; 2E4346460F546A8200B0F1BA /* Worker.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E4346340F546A8200B0F1BA /* Worker.h */; }; @@ -721,13 +749,13 @@ 37C28A6810F659CC008C7813 /* TypesettingFeatures.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C28A6710F659CC008C7813 /* TypesettingFeatures.h */; settings = {ATTRIBUTES = (Private, ); }; }; 37F818FD0D657606005E1F05 /* WebCoreURLResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 37F818FB0D657606005E1F05 /* WebCoreURLResponse.h */; settings = {ATTRIBUTES = (Private, ); }; }; 37F818FE0D657606005E1F05 /* WebCoreURLResponse.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37F818FC0D657606005E1F05 /* WebCoreURLResponse.mm */; }; + 37FD4298118368460093C029 /* TreeDepthLimit.h in Headers */ = {isa = PBXBuildFile; fileRef = 37FD4297118368460093C029 /* TreeDepthLimit.h */; }; 41002CCD0F66EDEF009E660D /* ScriptFunctionCall.h in Headers */ = {isa = PBXBuildFile; fileRef = 41002CCB0F66EDEF009E660D /* ScriptFunctionCall.h */; }; 41002CCE0F66EDEF009E660D /* ScriptFunctionCall.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41002CCC0F66EDEF009E660D /* ScriptFunctionCall.cpp */; }; 410B7E721045FAB000D8224F /* JSMessageEventCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 410B7E711045FAB000D8224F /* JSMessageEventCustom.cpp */; }; 411046410FA222A600BA436A /* ScriptEventListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 4110463F0FA222A600BA436A /* ScriptEventListener.h */; }; 411046420FA222A600BA436A /* ScriptEventListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 411046400FA222A600BA436A /* ScriptEventListener.cpp */; }; 4127D5370F8AAB1D00E424F5 /* ScriptState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */; }; - 415B7C570FF598E6006770F7 /* JSAbstractWorkerCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 415B7C540FF598E6006770F7 /* JSAbstractWorkerCustom.cpp */; }; 415B7C580FF598E6006770F7 /* JSSharedWorkerConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 415B7C550FF598E6006770F7 /* JSSharedWorkerConstructor.cpp */; }; 415B7C630FF5A767006770F7 /* JSSharedWorkerConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 415B7C620FF5A767006770F7 /* JSSharedWorkerConstructor.h */; }; 4162A450101145AE00DFF3ED /* DedicatedWorkerContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4162A44D101145AE00DFF3ED /* DedicatedWorkerContext.cpp */; }; @@ -1119,14 +1147,7 @@ 51E4ADB60C42B4CF0042BC55 /* FTPDirectoryDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51E4ADB20C42B4CF0042BC55 /* FTPDirectoryDocument.cpp */; }; 51E4ADB70C42B4CF0042BC55 /* FTPDirectoryDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E4ADB30C42B4CF0042BC55 /* FTPDirectoryDocument.h */; }; 51EC92590CE90DB400F90308 /* SQLError.h in Headers */ = {isa = PBXBuildFile; fileRef = 51EC92570CE90DB400F90308 /* SQLError.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 51EC92630CE90DD400F90308 /* JSCustomSQLStatementCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51EC925B0CE90DD400F90308 /* JSCustomSQLStatementCallback.cpp */; }; - 51EC92640CE90DD400F90308 /* JSCustomSQLStatementCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 51EC925C0CE90DD400F90308 /* JSCustomSQLStatementCallback.h */; }; 51EC92650CE90DD400F90308 /* JSCustomSQLStatementErrorCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51EC925D0CE90DD400F90308 /* JSCustomSQLStatementErrorCallback.cpp */; }; - 51EC92660CE90DD400F90308 /* JSCustomSQLStatementErrorCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 51EC925E0CE90DD400F90308 /* JSCustomSQLStatementErrorCallback.h */; }; - 51EC92670CE90DD400F90308 /* JSCustomSQLTransactionCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51EC925F0CE90DD400F90308 /* JSCustomSQLTransactionCallback.cpp */; }; - 51EC92680CE90DD400F90308 /* JSCustomSQLTransactionCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 51EC92600CE90DD400F90308 /* JSCustomSQLTransactionCallback.h */; }; - 51EC92690CE90DD400F90308 /* JSCustomSQLTransactionErrorCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51EC92610CE90DD400F90308 /* JSCustomSQLTransactionErrorCallback.cpp */; }; - 51EC926A0CE90DD400F90308 /* JSCustomSQLTransactionErrorCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 51EC92620CE90DD400F90308 /* JSCustomSQLTransactionErrorCallback.h */; }; 51FAFE340CECBF2D00BB3F24 /* DatabaseTrackerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FAFE330CECBF2D00BB3F24 /* DatabaseTrackerClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; 54C50F7B0E801DF3009832A0 /* XMLTokenizerLibxml2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 54C50F7A0E801DF3009832A0 /* XMLTokenizerLibxml2.cpp */; }; 550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 550A0BC7085F6039007353D6 /* QualifiedName.cpp */; }; @@ -1326,6 +1347,8 @@ 7AED3E060FBB1EAA00D2B03C /* InspectorFrontend.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AED3E040FBB1EAA00D2B03C /* InspectorFrontend.h */; }; 7AFD4A8B1131C2760035B883 /* ScriptBreakpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AFD4A8A1131C2760035B883 /* ScriptBreakpoint.h */; settings = {ATTRIBUTES = (Private, ); }; }; 7AFD4FF4113277B60035B883 /* ScriptDebugListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AFD4FF3113277B60035B883 /* ScriptDebugListener.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 82B658981189E39200E052A1 /* InspectorCSSStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 82B658971189E39200E052A1 /* InspectorCSSStore.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 82B6589A1189E47600E052A1 /* InspectorCSSStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 82B658991189E47600E052A1 /* InspectorCSSStore.cpp */; }; 841FDC261178C9BE00F8AC9B /* RenderSVGResourceFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 841FDC241178C9BE00F8AC9B /* RenderSVGResourceFilter.cpp */; }; 841FDC271178C9BE00F8AC9B /* RenderSVGResourceFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 841FDC251178C9BE00F8AC9B /* RenderSVGResourceFilter.h */; }; 84224183107E77F400766A87 /* JSSVGFEMorphologyElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84224181107E77F400766A87 /* JSSVGFEMorphologyElement.cpp */; }; @@ -3731,21 +3754,6 @@ B25599A30D00D8BA00BB825C /* SVGImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B255990B0D00D8B900BB825C /* SVGImage.cpp */; }; B25599A40D00D8BA00BB825C /* SVGImage.h in Headers */ = {isa = PBXBuildFile; fileRef = B255990C0D00D8B900BB825C /* SVGImage.h */; }; B25599A50D00D8BA00BB825C /* EmptyClients.h in Headers */ = {isa = PBXBuildFile; fileRef = B255990D0D00D8B900BB825C /* EmptyClients.h */; }; - B25599A60D00D8BA00BB825C /* SVGPaintServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B255990E0D00D8B900BB825C /* SVGPaintServer.cpp */; }; - B25599A70D00D8BA00BB825C /* SVGPaintServer.h in Headers */ = {isa = PBXBuildFile; fileRef = B255990F0D00D8B900BB825C /* SVGPaintServer.h */; }; - B25599A80D00D8BA00BB825C /* SVGPaintServerGradient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B25599100D00D8B900BB825C /* SVGPaintServerGradient.cpp */; }; - B25599A90D00D8BA00BB825C /* SVGPaintServerGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = B25599110D00D8B900BB825C /* SVGPaintServerGradient.h */; }; - B25599AA0D00D8BA00BB825C /* SVGPaintServerLinearGradient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B25599120D00D8B900BB825C /* SVGPaintServerLinearGradient.cpp */; }; - B25599AB0D00D8BA00BB825C /* SVGPaintServerLinearGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = B25599130D00D8B900BB825C /* SVGPaintServerLinearGradient.h */; }; - B25599AC0D00D8BA00BB825C /* SVGPaintServerPattern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B25599140D00D8B900BB825C /* SVGPaintServerPattern.cpp */; }; - B25599AD0D00D8BA00BB825C /* SVGPaintServerPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = B25599150D00D8B900BB825C /* SVGPaintServerPattern.h */; }; - B25599AE0D00D8BA00BB825C /* SVGPaintServerRadialGradient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B25599160D00D8B900BB825C /* SVGPaintServerRadialGradient.cpp */; }; - B25599AF0D00D8BA00BB825C /* SVGPaintServerRadialGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = B25599170D00D8B900BB825C /* SVGPaintServerRadialGradient.h */; }; - B25599B00D00D8BA00BB825C /* SVGPaintServerSolid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B25599180D00D8B900BB825C /* SVGPaintServerSolid.cpp */; }; - B25599B10D00D8BA00BB825C /* SVGPaintServerSolid.h in Headers */ = {isa = PBXBuildFile; fileRef = B25599190D00D8B900BB825C /* SVGPaintServerSolid.h */; }; - B25599B20D00D8BA00BB825C /* SVGResource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B255991A0D00D8B900BB825C /* SVGResource.cpp */; }; - B25599B30D00D8BA00BB825C /* SVGResource.h in Headers */ = {isa = PBXBuildFile; fileRef = B255991B0D00D8B900BB825C /* SVGResource.h */; }; - B25599B80D00D8BA00BB825C /* SVGResourceListener.h in Headers */ = {isa = PBXBuildFile; fileRef = B25599200D00D8B900BB825C /* SVGResourceListener.h */; }; B25DFAAF0B2E2929000E6510 /* JSSVGMatrixCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B25DFAAE0B2E2929000E6510 /* JSSVGMatrixCustom.cpp */; }; B262B8040D1F32D000158F09 /* SVGFont.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B262B8030D1F32D000158F09 /* SVGFont.cpp */; }; B26554EA0B80D74900A50EC3 /* RenderSVGTextPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B26554E80B80D74900A50EC3 /* RenderSVGTextPath.cpp */; }; @@ -4155,13 +4163,26 @@ B50F5B810E96CD9900AD71A6 /* WebCoreObjCExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = B50F5B800E96CD9900AD71A6 /* WebCoreObjCExtras.mm */; settings = {COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; }; B51BF6F0102C9E590002C15A /* SQLTransactionClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B51BF6EE102C9E590002C15A /* SQLTransactionClient.cpp */; }; B51BF6F1102C9E590002C15A /* SQLTransactionClient.h in Headers */ = {isa = PBXBuildFile; fileRef = B51BF6EF102C9E590002C15A /* SQLTransactionClient.h */; }; + B523CF061182675400EBB29C /* SQLTransactionSyncCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = B523CEFF1182675400EBB29C /* SQLTransactionSyncCallback.h */; }; + B523CF081182675400EBB29C /* SQLTransactionSync.h in Headers */ = {isa = PBXBuildFile; fileRef = B523CF011182675400EBB29C /* SQLTransactionSync.h */; }; + B523CF091182675400EBB29C /* SQLTransactionSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B523CF021182675400EBB29C /* SQLTransactionSync.cpp */; }; + B523CF0A1182675400EBB29C /* DatabaseSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B523CF031182675400EBB29C /* DatabaseSync.cpp */; }; + B523CF0B1182675400EBB29C /* DatabaseSync.h in Headers */ = {isa = PBXBuildFile; fileRef = B523CF041182675400EBB29C /* DatabaseSync.h */; }; + B59DD699119029E5007E9684 /* JSDatabaseCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = B59DD697119029E5007E9684 /* JSDatabaseCallback.h */; }; + B59DD69A119029E5007E9684 /* JSDatabaseCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B59DD698119029E5007E9684 /* JSDatabaseCallback.cpp */; }; + B59DD69D11902A42007E9684 /* JSSQLTransactionCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = B59DD69B11902A42007E9684 /* JSSQLTransactionCallback.h */; }; + B59DD69E11902A42007E9684 /* JSSQLTransactionCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B59DD69C11902A42007E9684 /* JSSQLTransactionCallback.cpp */; }; + B59DD6A111902A52007E9684 /* JSSQLTransactionErrorCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = B59DD69F11902A52007E9684 /* JSSQLTransactionErrorCallback.h */; }; + B59DD6A211902A52007E9684 /* JSSQLTransactionErrorCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B59DD6A011902A52007E9684 /* JSSQLTransactionErrorCallback.cpp */; }; + B59DD6A511902A62007E9684 /* JSSQLStatementCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = B59DD6A311902A62007E9684 /* JSSQLStatementCallback.h */; }; + B59DD6A611902A62007E9684 /* JSSQLStatementCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B59DD6A411902A62007E9684 /* JSSQLStatementCallback.cpp */; }; + B59DD6A911902A71007E9684 /* JSSQLStatementErrorCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = B59DD6A711902A71007E9684 /* JSSQLStatementErrorCallback.h */; }; + B59DD6AA11902A71007E9684 /* JSSQLStatementErrorCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B59DD6A811902A71007E9684 /* JSSQLStatementErrorCallback.cpp */; }; B5A684220FFABE9800D24689 /* SQLiteFileSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = B5A684210FFABE9800D24689 /* SQLiteFileSystem.h */; }; B5A684240FFABEAA00D24689 /* SQLiteFileSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5A684230FFABEAA00D24689 /* SQLiteFileSystem.cpp */; }; B5C1123B102B6C4600096578 /* SQLTransactionCoordinator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5C11239102B6C4600096578 /* SQLTransactionCoordinator.cpp */; }; B5C1123C102B6C4600096578 /* SQLTransactionCoordinator.h in Headers */ = {isa = PBXBuildFile; fileRef = B5C1123A102B6C4600096578 /* SQLTransactionCoordinator.h */; }; B5D3601A112F8B560048DEA8 /* DatabaseCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = B5D36019112F8B560048DEA8 /* DatabaseCallback.h */; }; - B5D3601D112F8BA00048DEA8 /* JSDatabaseCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = B5D3601C112F8BA00048DEA8 /* JSDatabaseCallback.h */; }; - B5D3601F112F8BA80048DEA8 /* JSDatabaseCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5D3601E112F8BA80048DEA8 /* JSDatabaseCallback.cpp */; }; B71FE6DF11091CB300DAEF77 /* PrintContext.h in Headers */ = {isa = PBXBuildFile; fileRef = B776D43A1104525D00BEB0EC /* PrintContext.h */; settings = {ATTRIBUTES = (Private, ); }; }; B776D43D1104527500BEB0EC /* PrintContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B776D43C1104527500BEB0EC /* PrintContext.cpp */; }; BC00F0040E0A185500FD04E3 /* DOMFile.h in Headers */ = {isa = PBXBuildFile; fileRef = BC00EFFE0E0A185500FD04E3 /* DOMFile.h */; }; @@ -4570,7 +4591,6 @@ BCCD74DC0A4C8D35005FDA6D /* HTMLViewSourceDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCD74DB0A4C8D35005FDA6D /* HTMLViewSourceDocument.h */; }; BCCD74E50A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCD74E40A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp */; }; BCCE58AC1061E8CF008FB35A /* JSDatabaseCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCE58AB1061E8CF008FB35A /* JSDatabaseCustom.cpp */; }; - BCCE58AF1061E90C008FB35A /* JSDocumentFragmentCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCE58AE1061E90C008FB35A /* JSDocumentFragmentCustom.cpp */; }; BCCFBAE80B5152ED0001F1D7 /* Tokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCFBAE70B5152ED0001F1D7 /* Tokenizer.h */; settings = {ATTRIBUTES = (Private, ); }; }; BCD0E0FA0E972C3500265DEA /* SecurityOrigin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD0E0F70E972C3500265DEA /* SecurityOrigin.cpp */; }; BCD0E0FB0E972C3500265DEA /* SecurityOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD0E0F80E972C3500265DEA /* SecurityOrigin.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -4709,7 +4729,6 @@ C5160EEB1004543A00A7CEE2 /* StorageAreaImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = C5160EE91004543A00A7CEE2 /* StorageAreaImpl.h */; }; C55E38BF10040D5D00A56BDB /* StorageNamespaceImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = C55E38BB10040D5D00A56BDB /* StorageNamespaceImpl.h */; }; C55E38C010040D5D00A56BDB /* StorageNamespaceImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C55E38BC10040D5D00A56BDB /* StorageNamespaceImpl.cpp */; }; - C5D4AA79116BAFB60069CA93 /* GlyphMetricsMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C5D4AA77116BAFB60069CA93 /* GlyphMetricsMap.cpp */; }; C5D4AA7A116BAFB60069CA93 /* GlyphMetricsMap.h in Headers */ = {isa = PBXBuildFile; fileRef = C5D4AA78116BAFB60069CA93 /* GlyphMetricsMap.h */; settings = {ATTRIBUTES = (Private, ); }; }; C5E9B67710697E1300C7BB1A /* StorageEventDispatcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C5E9B67610697E1300C7BB1A /* StorageEventDispatcher.cpp */; }; C5EBDD84105EDDEC0056816F /* StorageEventDispatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = C5EBDD81105EDDEC0056816F /* StorageEventDispatcher.h */; }; @@ -4747,7 +4766,6 @@ E0FEF372B27C53EAC1C1FBEE /* EventSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E0FEF371B27C53EAC1C1FBEE /* EventSource.cpp */; }; E0FEF372B37C53EAC1C1FBEE /* JSEventSource.h in Headers */ = {isa = PBXBuildFile; fileRef = E0FEF371B37C53EAC1C1FBEE /* JSEventSource.h */; }; E0FEF372B47C53EAC1C1FBEE /* JSEventSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E0FEF371B47C53EAC1C1FBEE /* JSEventSource.cpp */; }; - E0FEF372B57C53EAC1C1FBEE /* JSEventSourceCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E0FEF371B57C53EAC1C1FBEE /* JSEventSourceCustom.cpp */; }; E0FEF372B67C53EAC1C1FBEE /* JSEventSourceConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = E0FEF371B67C53EAC1C1FBEE /* JSEventSourceConstructor.h */; }; E0FEF372B77C53EAC1C1FBEE /* JSEventSourceConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E0FEF371B77C53EAC1C1FBEE /* JSEventSourceConstructor.cpp */; }; E107400D0E77BDC00033AF24 /* JSMessageChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E107400B0E77BDC00033AF24 /* JSMessageChannel.cpp */; }; @@ -5431,6 +5449,7 @@ 080081950ED3B2DD00C53BC0 /* WMLAnchorElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLAnchorElement.h; sourceTree = "<group>"; }; 0804BF6C0EE09C3B0006C000 /* WMLDoElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLDoElement.cpp; sourceTree = "<group>"; }; 0804BF6D0EE09C3B0006C000 /* WMLDoElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLDoElement.h; sourceTree = "<group>"; }; + 08082372117987C100241DE8 /* RenderSVGResourceContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGResourceContainer.h; sourceTree = "<group>"; }; 080AEC7D0ED8708A00DF4CCE /* WMLIntrinsicEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLIntrinsicEvent.cpp; sourceTree = "<group>"; }; 080AEC7E0ED8708B00DF4CCE /* WMLIntrinsicEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLIntrinsicEvent.h; sourceTree = "<group>"; }; 080AEC7F0ED8708B00DF4CCE /* WMLIntrinsicEventHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLIntrinsicEventHandler.cpp; sourceTree = "<group>"; }; @@ -5457,6 +5476,9 @@ 083DAEA30F01A7FB00342754 /* RenderTextControlMultiLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderTextControlMultiLine.h; sourceTree = "<group>"; }; 083DAEA40F01A7FB00342754 /* RenderTextControlSingleLine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTextControlSingleLine.cpp; sourceTree = "<group>"; }; 083DAEA50F01A7FB00342754 /* RenderTextControlSingleLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderTextControlSingleLine.h; sourceTree = "<group>"; }; + 0842BC701190144000C7D08F /* SVGCharacterData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGCharacterData.cpp; sourceTree = "<group>"; }; + 0842BC711190144000C7D08F /* SVGCharacterData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGCharacterData.h; sourceTree = "<group>"; }; + 0842BC801190147200C7D08F /* SVGTextChunkLayoutInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTextChunkLayoutInfo.h; sourceTree = "<group>"; }; 084AEBE20FB505FA0038483E /* SelectElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SelectElement.cpp; sourceTree = "<group>"; }; 084AEBE30FB505FA0038483E /* SelectElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectElement.h; sourceTree = "<group>"; }; 084CE5C70F27DADC00E6240E /* WMLOptGroupElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLOptGroupElement.cpp; sourceTree = "<group>"; }; @@ -5467,6 +5489,9 @@ 084D2832110A7FCB0038239A /* SVGAnimatedPropertyTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyTraits.h; sourceTree = "<group>"; }; 084DBA9D0ED39D350038C226 /* WMLVariables.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLVariables.cpp; sourceTree = "<group>"; }; 084DBA9E0ED39D360038C226 /* WMLVariables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLVariables.h; sourceTree = "<group>"; }; + 08563BB2117861770012B578 /* RenderSVGResourcePattern.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGResourcePattern.cpp; sourceTree = "<group>"; }; + 08563BB3117861770012B578 /* RenderSVGResourcePattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGResourcePattern.h; sourceTree = "<group>"; }; + 08563BCF117865F50012B578 /* RenderSVGResource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGResource.cpp; sourceTree = "<group>"; }; 08591AA40F085C4E009BACB1 /* InputElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InputElement.h; sourceTree = "<group>"; }; 085AFDC60F2977350061F2B3 /* WMLFormControlElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLFormControlElement.cpp; sourceTree = "<group>"; }; 085AFDC70F2977350061F2B3 /* WMLFormControlElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLFormControlElement.h; sourceTree = "<group>"; }; @@ -5510,10 +5535,18 @@ 08A484750E5272C500C3FE76 /* ScriptElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptElement.cpp; sourceTree = "<group>"; }; 08A484760E5272C500C3FE76 /* ScriptElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptElement.h; sourceTree = "<group>"; }; 08A48A6D0E86CF6D00E225DD /* JSSVGElementInstanceCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGElementInstanceCustom.cpp; sourceTree = "<group>"; }; + 08C34AF11179C056002D7456 /* RenderSVGResourceGradient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGResourceGradient.cpp; sourceTree = "<group>"; }; + 08C34AF21179C057002D7456 /* RenderSVGResourceGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGResourceGradient.h; sourceTree = "<group>"; }; + 08C34AF31179C057002D7456 /* RenderSVGResourceLinearGradient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGResourceLinearGradient.cpp; sourceTree = "<group>"; }; + 08C34AF41179C057002D7456 /* RenderSVGResourceLinearGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGResourceLinearGradient.h; sourceTree = "<group>"; }; + 08C34AFB1179C072002D7456 /* RenderSVGResourceRadialGradient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGResourceRadialGradient.cpp; sourceTree = "<group>"; }; + 08C34AFC1179C072002D7456 /* RenderSVGResourceRadialGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGResourceRadialGradient.h; sourceTree = "<group>"; }; 08C4C5140EF19A4000E4840F /* WMLImageElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLImageElement.cpp; sourceTree = "<group>"; }; 08C4C5150EF19A4000E4840F /* WMLImageElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLImageElement.h; sourceTree = "<group>"; }; 08C4C5160EF19A4000E4840F /* WMLImageLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLImageLoader.cpp; sourceTree = "<group>"; }; 08C4C5170EF19A4000E4840F /* WMLImageLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLImageLoader.h; sourceTree = "<group>"; }; + 08C6A7A9117DFBAB00FEA1A2 /* RenderSVGResourceSolidColor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGResourceSolidColor.cpp; sourceTree = "<group>"; }; + 08C6A7AA117DFBAB00FEA1A2 /* RenderSVGResourceSolidColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGResourceSolidColor.h; sourceTree = "<group>"; }; 08C925170FCC7C4A00480DEC /* FilterEffect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FilterEffect.cpp; path = filters/FilterEffect.cpp; sourceTree = "<group>"; }; 08C925180FCC7C4A00480DEC /* FilterEffect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FilterEffect.h; path = filters/FilterEffect.h; sourceTree = "<group>"; }; 08CD61B80ED3929C002DDF51 /* WMLTaskElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLTaskElement.cpp; sourceTree = "<group>"; }; @@ -5582,14 +5615,18 @@ 0FD308D4117D168400A791F7 /* RenderIFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderIFrame.h; sourceTree = "<group>"; }; 0FD723800EC8BD9300CA5DD7 /* FloatQuad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FloatQuad.h; sourceTree = "<group>"; }; 0FD723810EC8BD9300CA5DD7 /* FloatQuad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FloatQuad.cpp; sourceTree = "<group>"; }; - 0FF50259102BA9010066F39A /* DOMMedia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMMedia.h; sourceTree = "<group>"; }; - 0FF5025A102BA9010066F39A /* DOMMedia.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMMedia.mm; sourceTree = "<group>"; }; - 0FF50262102BA92B0066F39A /* DOMMediaInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMMediaInternal.h; sourceTree = "<group>"; }; - 0FF50267102BA9430066F39A /* JSMedia.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMedia.cpp; sourceTree = "<group>"; }; - 0FF50268102BA9430066F39A /* JSMedia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMedia.h; sourceTree = "<group>"; }; - 0FF5026E102BA9660066F39A /* Media.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Media.cpp; sourceTree = "<group>"; }; - 0FF5026F102BA96A0066F39A /* Media.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Media.h; sourceTree = "<group>"; }; - 0FF50270102BA96A0066F39A /* Media.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Media.idl; sourceTree = "<group>"; }; + 0FF2813211821CB6007B7CD6 /* RenderMathMLRoot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMathMLRoot.cpp; sourceTree = "<group>"; }; + 0FF2813311821CB6007B7CD6 /* RenderMathMLRoot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMathMLRoot.h; sourceTree = "<group>"; }; + 0FF2813411821CB6007B7CD6 /* RenderMathMLSquareRoot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMathMLSquareRoot.cpp; sourceTree = "<group>"; }; + 0FF2813511821CB6007B7CD6 /* RenderMathMLSquareRoot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMathMLSquareRoot.h; sourceTree = "<group>"; }; + 0FF50259102BA9010066F39A /* DOMStyleMedia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMStyleMedia.h; sourceTree = "<group>"; }; + 0FF5025A102BA9010066F39A /* DOMStyleMedia.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMStyleMedia.mm; sourceTree = "<group>"; }; + 0FF50262102BA92B0066F39A /* DOMStyleMediaInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMStyleMediaInternal.h; sourceTree = "<group>"; }; + 0FF50267102BA9430066F39A /* JSStyleMedia.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSStyleMedia.cpp; sourceTree = "<group>"; }; + 0FF50268102BA9430066F39A /* JSStyleMedia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStyleMedia.h; sourceTree = "<group>"; }; + 0FF5026E102BA9660066F39A /* StyleMedia.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleMedia.cpp; sourceTree = "<group>"; }; + 0FF5026F102BA96A0066F39A /* StyleMedia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleMedia.h; sourceTree = "<group>"; }; + 0FF50270102BA96A0066F39A /* StyleMedia.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = StyleMedia.idl; sourceTree = "<group>"; }; 1402645D0AFDC19B005919E2 /* LoggingMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = LoggingMac.mm; sourceTree = "<group>"; }; 1403B90C09EB124500797C7F /* DOMWindow.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMWindow.idl; sourceTree = "<group>"; }; 1403B99509EB13AF00797C7F /* DOMWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWindow.h; sourceTree = "<group>"; }; @@ -5652,6 +5689,8 @@ 15C77092100D3CA8005BA267 /* JSValidityState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSValidityState.cpp; sourceTree = "<group>"; }; 15C770A3100D41CD005BA267 /* DOMValidityState.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMValidityState.mm; sourceTree = "<group>"; }; 15C770A4100D41CD005BA267 /* DOMValidityState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMValidityState.h; sourceTree = "<group>"; }; + 163E88F5118A39D200ED9231 /* SimpleFontDataCoreText.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleFontDataCoreText.cpp; sourceTree = "<group>"; }; + 163E8B12118B3ADD00ED9231 /* SimpleFontDataATSUI.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SimpleFontDataATSUI.mm; sourceTree = "<group>"; }; 185BCF260F3279CE000EA262 /* ThreadTimers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadTimers.cpp; sourceTree = "<group>"; }; 185BCF270F3279CE000EA262 /* ThreadTimers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadTimers.h; sourceTree = "<group>"; }; 188604B10F2E654A000B6443 /* DOMTimer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMTimer.cpp; sourceTree = "<group>"; }; @@ -5671,6 +5710,7 @@ 1A2246460CC98DDB00C05240 /* SQLiteStatement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SQLiteStatement.h; path = sql/SQLiteStatement.h; sourceTree = "<group>"; }; 1A2246470CC98DDB00C05240 /* SQLiteTransaction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SQLiteTransaction.cpp; path = sql/SQLiteTransaction.cpp; sourceTree = "<group>"; }; 1A2246480CC98DDB00C05240 /* SQLiteTransaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SQLiteTransaction.h; path = sql/SQLiteTransaction.h; sourceTree = "<group>"; }; + 1A27CF96118A354C0041D632 /* nptypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = nptypes.h; path = bridge/nptypes.h; sourceTree = "<group>"; }; 1A2A68210B5BEDE70002A480 /* ProgressTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ProgressTracker.cpp; sourceTree = "<group>"; }; 1A2A68220B5BEDE70002A480 /* ProgressTracker.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ProgressTracker.h; sourceTree = "<group>"; }; 1A2AAC560DC2A3B100A20D9A /* ApplicationCacheStorage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ApplicationCacheStorage.cpp; sourceTree = "<group>"; }; @@ -5979,6 +6019,7 @@ 24F54EAB101FE914000AE741 /* ApplicationCacheHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplicationCacheHost.h; sourceTree = "<group>"; }; 2542F4D81166C25A00E89A86 /* UserGestureIndicator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserGestureIndicator.cpp; sourceTree = "<group>"; }; 2542F4D91166C25A00E89A86 /* UserGestureIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserGestureIndicator.h; sourceTree = "<group>"; }; + 271245D311890AB70083E852 /* WebCore.ProtectionSpaceAuthCallback.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = WebCore.ProtectionSpaceAuthCallback.exp; sourceTree = "<group>"; }; 29A812080FBB9C1D00510293 /* AccessibilityRenderObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityRenderObject.cpp; sourceTree = "<group>"; }; 29A812090FBB9C1D00510293 /* AccessibilityTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityTable.cpp; sourceTree = "<group>"; }; 29A8120A0FBB9C1D00510293 /* AccessibilityARIAGrid.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityARIAGrid.cpp; sourceTree = "<group>"; }; @@ -6028,6 +6069,13 @@ 2E2D99E910E2BC3800496337 /* DOMBlobInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMBlobInternal.h; sourceTree = "<group>"; }; 2E3BBF051162DA1100B9409A /* UUID.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UUID.cpp; sourceTree = "<group>"; }; 2E3BBF061162DA1100B9409A /* UUID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UUID.h; sourceTree = "<group>"; }; + 2E3BC0BB117D3A4F00B9409A /* FileError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileError.h; sourceTree = "<group>"; }; + 2E3BC0BC117D3A4F00B9409A /* FileError.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FileError.idl; sourceTree = "<group>"; }; + 2E3BC0C8117D3E0800B9409A /* JSFileError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFileError.cpp; sourceTree = "<group>"; }; + 2E3BC0C9117D3E0800B9409A /* JSFileError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFileError.h; sourceTree = "<group>"; }; + 2E3BC106117D479800B9409A /* DOMFileError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMFileError.h; sourceTree = "<group>"; }; + 2E3BC107117D479800B9409A /* DOMFileError.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMFileError.mm; sourceTree = "<group>"; }; + 2E3BC10A117D47C800B9409A /* DOMFileErrorInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMFileErrorInternal.h; sourceTree = "<group>"; }; 2E4346320F546A8200B0F1BA /* GenericWorkerTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GenericWorkerTask.h; path = workers/GenericWorkerTask.h; sourceTree = "<group>"; }; 2E4346330F546A8200B0F1BA /* Worker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Worker.cpp; path = workers/Worker.cpp; sourceTree = "<group>"; }; 2E4346340F546A8200B0F1BA /* Worker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Worker.h; path = workers/Worker.h; sourceTree = "<group>"; }; @@ -6048,6 +6096,8 @@ 2E4346430F546A8200B0F1BA /* WorkerThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WorkerThread.h; path = workers/WorkerThread.h; sourceTree = "<group>"; }; 2E4346560F546A9900B0F1BA /* CrossThreadCopier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CrossThreadCopier.cpp; sourceTree = "<group>"; }; 2E4346570F546A9900B0F1BA /* CrossThreadCopier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CrossThreadCopier.h; sourceTree = "<group>"; }; + 2E94F3CB118B908E00B7F75D /* FileReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileReader.cpp; sourceTree = "<group>"; }; + 2E94F3CC118B908E00B7F75D /* FileReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileReader.h; sourceTree = "<group>"; }; 2EA768030FE7126400AB9C8A /* WorkerScriptLoaderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WorkerScriptLoaderClient.h; path = workers/WorkerScriptLoaderClient.h; sourceTree = "<group>"; }; 2EAFAF0B10E2AF2D007ED3D6 /* Blob.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Blob.cpp; sourceTree = "<group>"; }; 2EAFAF0C10E2AF2D007ED3D6 /* Blob.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Blob.h; sourceTree = "<group>"; }; @@ -6151,13 +6201,13 @@ 37F818FB0D657606005E1F05 /* WebCoreURLResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreURLResponse.h; sourceTree = "<group>"; }; 37F818FC0D657606005E1F05 /* WebCoreURLResponse.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreURLResponse.mm; sourceTree = "<group>"; }; 37FC96DA1104ED71003E1FAD /* TrailingFloatsRootInlineBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TrailingFloatsRootInlineBox.h; sourceTree = "<group>"; }; + 37FD4297118368460093C029 /* TreeDepthLimit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TreeDepthLimit.h; sourceTree = "<group>"; }; 41002CCB0F66EDEF009E660D /* ScriptFunctionCall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptFunctionCall.h; sourceTree = "<group>"; }; 41002CCC0F66EDEF009E660D /* ScriptFunctionCall.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptFunctionCall.cpp; sourceTree = "<group>"; }; 410B7E711045FAB000D8224F /* JSMessageEventCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMessageEventCustom.cpp; sourceTree = "<group>"; }; 4110463F0FA222A600BA436A /* ScriptEventListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptEventListener.h; sourceTree = "<group>"; }; 411046400FA222A600BA436A /* ScriptEventListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptEventListener.cpp; sourceTree = "<group>"; }; 4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptState.cpp; sourceTree = "<group>"; }; - 415B7C540FF598E6006770F7 /* JSAbstractWorkerCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAbstractWorkerCustom.cpp; sourceTree = "<group>"; }; 415B7C550FF598E6006770F7 /* JSSharedWorkerConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSharedWorkerConstructor.cpp; sourceTree = "<group>"; }; 415B7C620FF5A767006770F7 /* JSSharedWorkerConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSharedWorkerConstructor.h; sourceTree = "<group>"; }; 4162A44D101145AE00DFF3ED /* DedicatedWorkerContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DedicatedWorkerContext.cpp; path = workers/DedicatedWorkerContext.cpp; sourceTree = "<group>"; }; @@ -6616,14 +6666,7 @@ 51E4ADB30C42B4CF0042BC55 /* FTPDirectoryDocument.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FTPDirectoryDocument.h; sourceTree = "<group>"; }; 51EC92570CE90DB400F90308 /* SQLError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLError.h; sourceTree = "<group>"; }; 51EC92580CE90DB400F90308 /* SQLError.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SQLError.idl; sourceTree = "<group>"; }; - 51EC925B0CE90DD400F90308 /* JSCustomSQLStatementCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCustomSQLStatementCallback.cpp; sourceTree = "<group>"; }; - 51EC925C0CE90DD400F90308 /* JSCustomSQLStatementCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCustomSQLStatementCallback.h; sourceTree = "<group>"; }; 51EC925D0CE90DD400F90308 /* JSCustomSQLStatementErrorCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCustomSQLStatementErrorCallback.cpp; sourceTree = "<group>"; }; - 51EC925E0CE90DD400F90308 /* JSCustomSQLStatementErrorCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCustomSQLStatementErrorCallback.h; sourceTree = "<group>"; }; - 51EC925F0CE90DD400F90308 /* JSCustomSQLTransactionCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCustomSQLTransactionCallback.cpp; sourceTree = "<group>"; }; - 51EC92600CE90DD400F90308 /* JSCustomSQLTransactionCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCustomSQLTransactionCallback.h; sourceTree = "<group>"; }; - 51EC92610CE90DD400F90308 /* JSCustomSQLTransactionErrorCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCustomSQLTransactionErrorCallback.cpp; sourceTree = "<group>"; }; - 51EC92620CE90DD400F90308 /* JSCustomSQLTransactionErrorCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCustomSQLTransactionErrorCallback.h; sourceTree = "<group>"; }; 51F6A3D50663BF04004D2919 /* HTMLCanvasElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLCanvasElement.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 51F6A3D60663BF04004D2919 /* HTMLCanvasElement.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HTMLCanvasElement.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 51FAFE330CECBF2D00BB3F24 /* DatabaseTrackerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatabaseTrackerClient.h; sourceTree = "<group>"; }; @@ -6842,6 +6885,8 @@ 7AED3E040FBB1EAA00D2B03C /* InspectorFrontend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorFrontend.h; sourceTree = "<group>"; }; 7AFD4A8A1131C2760035B883 /* ScriptBreakpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptBreakpoint.h; sourceTree = "<group>"; }; 7AFD4FF3113277B60035B883 /* ScriptDebugListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptDebugListener.h; sourceTree = "<group>"; }; + 82B658971189E39200E052A1 /* InspectorCSSStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorCSSStore.h; sourceTree = "<group>"; }; + 82B658991189E47600E052A1 /* InspectorCSSStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorCSSStore.cpp; sourceTree = "<group>"; }; 841FDC241178C9BE00F8AC9B /* RenderSVGResourceFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGResourceFilter.cpp; sourceTree = "<group>"; }; 841FDC251178C9BE00F8AC9B /* RenderSVGResourceFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGResourceFilter.h; sourceTree = "<group>"; }; 84224181107E77F400766A87 /* JSSVGFEMorphologyElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGFEMorphologyElement.cpp; sourceTree = "<group>"; }; @@ -9066,21 +9111,6 @@ B255990B0D00D8B900BB825C /* SVGImage.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGImage.cpp; sourceTree = "<group>"; }; B255990C0D00D8B900BB825C /* SVGImage.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGImage.h; sourceTree = "<group>"; }; B255990D0D00D8B900BB825C /* EmptyClients.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = EmptyClients.h; sourceTree = "<group>"; }; - B255990E0D00D8B900BB825C /* SVGPaintServer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPaintServer.cpp; sourceTree = "<group>"; }; - B255990F0D00D8B900BB825C /* SVGPaintServer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGPaintServer.h; sourceTree = "<group>"; }; - B25599100D00D8B900BB825C /* SVGPaintServerGradient.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPaintServerGradient.cpp; sourceTree = "<group>"; }; - B25599110D00D8B900BB825C /* SVGPaintServerGradient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGPaintServerGradient.h; sourceTree = "<group>"; }; - B25599120D00D8B900BB825C /* SVGPaintServerLinearGradient.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPaintServerLinearGradient.cpp; sourceTree = "<group>"; }; - B25599130D00D8B900BB825C /* SVGPaintServerLinearGradient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGPaintServerLinearGradient.h; sourceTree = "<group>"; }; - B25599140D00D8B900BB825C /* SVGPaintServerPattern.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPaintServerPattern.cpp; sourceTree = "<group>"; }; - B25599150D00D8B900BB825C /* SVGPaintServerPattern.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGPaintServerPattern.h; sourceTree = "<group>"; }; - B25599160D00D8B900BB825C /* SVGPaintServerRadialGradient.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPaintServerRadialGradient.cpp; sourceTree = "<group>"; }; - B25599170D00D8B900BB825C /* SVGPaintServerRadialGradient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGPaintServerRadialGradient.h; sourceTree = "<group>"; }; - B25599180D00D8B900BB825C /* SVGPaintServerSolid.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPaintServerSolid.cpp; sourceTree = "<group>"; }; - B25599190D00D8B900BB825C /* SVGPaintServerSolid.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGPaintServerSolid.h; sourceTree = "<group>"; }; - B255991A0D00D8B900BB825C /* SVGResource.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGResource.cpp; sourceTree = "<group>"; }; - B255991B0D00D8B900BB825C /* SVGResource.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGResource.h; sourceTree = "<group>"; }; - B25599200D00D8B900BB825C /* SVGResourceListener.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGResourceListener.h; sourceTree = "<group>"; }; B25DFAAE0B2E2929000E6510 /* JSSVGMatrixCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGMatrixCustom.cpp; sourceTree = "<group>"; }; B262B8030D1F32D000158F09 /* SVGFont.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFont.cpp; sourceTree = "<group>"; }; B26554E80B80D74900A50EC3 /* RenderSVGTextPath.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGTextPath.cpp; sourceTree = "<group>"; }; @@ -9495,13 +9525,31 @@ B50F5B800E96CD9900AD71A6 /* WebCoreObjCExtras.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreObjCExtras.mm; sourceTree = "<group>"; }; B51BF6EE102C9E590002C15A /* SQLTransactionClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SQLTransactionClient.cpp; sourceTree = "<group>"; }; B51BF6EF102C9E590002C15A /* SQLTransactionClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLTransactionClient.h; sourceTree = "<group>"; }; + B523CEFF1182675400EBB29C /* SQLTransactionSyncCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLTransactionSyncCallback.h; sourceTree = "<group>"; }; + B523CF011182675400EBB29C /* SQLTransactionSync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLTransactionSync.h; sourceTree = "<group>"; }; + B523CF021182675400EBB29C /* SQLTransactionSync.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SQLTransactionSync.cpp; sourceTree = "<group>"; }; + B523CF031182675400EBB29C /* DatabaseSync.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DatabaseSync.cpp; sourceTree = "<group>"; }; + B523CF041182675400EBB29C /* DatabaseSync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatabaseSync.h; sourceTree = "<group>"; }; + B59DD68D1190298E007E9684 /* DatabaseCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DatabaseCallback.idl; sourceTree = "<group>"; }; + B59DD68E1190298E007E9684 /* SQLStatementCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SQLStatementCallback.idl; sourceTree = "<group>"; }; + B59DD68F1190298E007E9684 /* SQLStatementErrorCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SQLStatementErrorCallback.idl; sourceTree = "<group>"; }; + B59DD6901190298E007E9684 /* SQLTransactionCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SQLTransactionCallback.idl; sourceTree = "<group>"; }; + B59DD6911190298E007E9684 /* SQLTransactionErrorCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SQLTransactionErrorCallback.idl; sourceTree = "<group>"; }; + B59DD697119029E5007E9684 /* JSDatabaseCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDatabaseCallback.h; sourceTree = "<group>"; }; + B59DD698119029E5007E9684 /* JSDatabaseCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDatabaseCallback.cpp; sourceTree = "<group>"; }; + B59DD69B11902A42007E9684 /* JSSQLTransactionCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSQLTransactionCallback.h; sourceTree = "<group>"; }; + B59DD69C11902A42007E9684 /* JSSQLTransactionCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLTransactionCallback.cpp; sourceTree = "<group>"; }; + B59DD69F11902A52007E9684 /* JSSQLTransactionErrorCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSQLTransactionErrorCallback.h; sourceTree = "<group>"; }; + B59DD6A011902A52007E9684 /* JSSQLTransactionErrorCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLTransactionErrorCallback.cpp; sourceTree = "<group>"; }; + B59DD6A311902A62007E9684 /* JSSQLStatementCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSQLStatementCallback.h; sourceTree = "<group>"; }; + B59DD6A411902A62007E9684 /* JSSQLStatementCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLStatementCallback.cpp; sourceTree = "<group>"; }; + B59DD6A711902A71007E9684 /* JSSQLStatementErrorCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSQLStatementErrorCallback.h; sourceTree = "<group>"; }; + B59DD6A811902A71007E9684 /* JSSQLStatementErrorCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLStatementErrorCallback.cpp; sourceTree = "<group>"; }; B5A684210FFABE9800D24689 /* SQLiteFileSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SQLiteFileSystem.h; path = sql/SQLiteFileSystem.h; sourceTree = "<group>"; }; B5A684230FFABEAA00D24689 /* SQLiteFileSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SQLiteFileSystem.cpp; path = sql/SQLiteFileSystem.cpp; sourceTree = "<group>"; }; B5C11239102B6C4600096578 /* SQLTransactionCoordinator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SQLTransactionCoordinator.cpp; sourceTree = "<group>"; }; B5C1123A102B6C4600096578 /* SQLTransactionCoordinator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLTransactionCoordinator.h; sourceTree = "<group>"; }; B5D36019112F8B560048DEA8 /* DatabaseCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatabaseCallback.h; sourceTree = "<group>"; }; - B5D3601C112F8BA00048DEA8 /* JSDatabaseCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDatabaseCallback.h; sourceTree = "<group>"; }; - B5D3601E112F8BA80048DEA8 /* JSDatabaseCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDatabaseCallback.cpp; sourceTree = "<group>"; }; B776D43A1104525D00BEB0EC /* PrintContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrintContext.h; sourceTree = "<group>"; }; B776D43C1104527500BEB0EC /* PrintContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrintContext.cpp; sourceTree = "<group>"; }; BC00EFFE0E0A185500FD04E3 /* DOMFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMFile.h; sourceTree = "<group>"; }; @@ -9937,7 +9985,6 @@ BCCD74DB0A4C8D35005FDA6D /* HTMLViewSourceDocument.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLViewSourceDocument.h; sourceTree = "<group>"; }; BCCD74E40A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLViewSourceDocument.cpp; sourceTree = "<group>"; }; BCCE58AB1061E8CF008FB35A /* JSDatabaseCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDatabaseCustom.cpp; sourceTree = "<group>"; }; - BCCE58AE1061E90C008FB35A /* JSDocumentFragmentCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDocumentFragmentCustom.cpp; sourceTree = "<group>"; }; BCCFBAE70B5152ED0001F1D7 /* Tokenizer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Tokenizer.h; sourceTree = "<group>"; }; BCD0E0F70E972C3500265DEA /* SecurityOrigin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SecurityOrigin.cpp; sourceTree = "<group>"; }; BCD0E0F80E972C3500265DEA /* SecurityOrigin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecurityOrigin.h; sourceTree = "<group>"; }; @@ -10085,7 +10132,6 @@ C5160EE91004543A00A7CEE2 /* StorageAreaImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageAreaImpl.h; sourceTree = "<group>"; }; C55E38BB10040D5D00A56BDB /* StorageNamespaceImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageNamespaceImpl.h; sourceTree = "<group>"; }; C55E38BC10040D5D00A56BDB /* StorageNamespaceImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageNamespaceImpl.cpp; sourceTree = "<group>"; }; - C5D4AA77116BAFB60069CA93 /* GlyphMetricsMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GlyphMetricsMap.cpp; sourceTree = "<group>"; }; C5D4AA78116BAFB60069CA93 /* GlyphMetricsMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GlyphMetricsMap.h; sourceTree = "<group>"; }; C5E9B67610697E1300C7BB1A /* StorageEventDispatcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageEventDispatcher.cpp; sourceTree = "<group>"; }; C5EBDD81105EDDEC0056816F /* StorageEventDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageEventDispatcher.h; sourceTree = "<group>"; }; @@ -10123,7 +10169,6 @@ E0FEF371B27C53EAC1C1FBEE /* EventSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventSource.cpp; sourceTree = "<group>"; }; E0FEF371B37C53EAC1C1FBEE /* JSEventSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEventSource.h; sourceTree = "<group>"; }; E0FEF371B47C53EAC1C1FBEE /* JSEventSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEventSource.cpp; sourceTree = "<group>"; }; - E0FEF371B57C53EAC1C1FBEE /* JSEventSourceCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEventSourceCustom.cpp; sourceTree = "<group>"; }; E0FEF371B67C53EAC1C1FBEE /* JSEventSourceConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEventSourceConstructor.h; sourceTree = "<group>"; }; E0FEF371B77C53EAC1C1FBEE /* JSEventSourceConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEventSourceConstructor.cpp; sourceTree = "<group>"; }; E107400B0E77BDC00033AF24 /* JSMessageChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMessageChannel.cpp; sourceTree = "<group>"; }; @@ -10603,6 +10648,7 @@ 1A569CDF0D7E2B82007C3983 /* npruntime_impl.h */, 1A569CE00D7E2B82007C3983 /* npruntime_internal.h */, 1A569CE10D7E2B82007C3983 /* npruntime_priv.h */, + 1A27CF96118A354C0041D632 /* nptypes.h */, 1A569CEF0D7E2B82007C3983 /* runtime_array.cpp */, 1A569CF00D7E2B82007C3983 /* runtime_array.h */, 1A569CF10D7E2B82007C3983 /* runtime_method.cpp */, @@ -10726,7 +10772,10 @@ 51A45B550CAD7FD7000D2BE9 /* DatabaseAuthorizer.cpp */, 51A45B540CAD7FD7000D2BE9 /* DatabaseAuthorizer.h */, B5D36019112F8B560048DEA8 /* DatabaseCallback.h */, + B59DD68D1190298E007E9684 /* DatabaseCallback.idl */, 5116D9750CF177BD00C2B84D /* DatabaseDetails.h */, + B523CF031182675400EBB29C /* DatabaseSync.cpp */, + B523CF041182675400EBB29C /* DatabaseSync.h */, 519611E90CAC749C0010A80C /* DatabaseTask.cpp */, 519611E80CAC749C0010A80C /* DatabaseTask.h */, 519611610CAC56570010A80C /* DatabaseThread.cpp */, @@ -10753,16 +10802,23 @@ 515B03980CD1642A00B7EA9C /* SQLStatement.cpp */, 515B03970CD1642A00B7EA9C /* SQLStatement.h */, 1A7CCB150CD9469A00B7B64E /* SQLStatementCallback.h */, + B59DD68E1190298E007E9684 /* SQLStatementCallback.idl */, 1A7CCB160CD9469A00B7B64E /* SQLStatementErrorCallback.h */, + B59DD68F1190298E007E9684 /* SQLStatementErrorCallback.idl */, 1ABFE7520CD968D000FE4834 /* SQLTransaction.cpp */, 1A7CCB220CD946FD00B7B64E /* SQLTransaction.h */, 1A7CCB230CD946FD00B7B64E /* SQLTransaction.idl */, 1A7CCB170CD9469A00B7B64E /* SQLTransactionCallback.h */, + B59DD6901190298E007E9684 /* SQLTransactionCallback.idl */, B51BF6EE102C9E590002C15A /* SQLTransactionClient.cpp */, B51BF6EF102C9E590002C15A /* SQLTransactionClient.h */, B5C11239102B6C4600096578 /* SQLTransactionCoordinator.cpp */, B5C1123A102B6C4600096578 /* SQLTransactionCoordinator.h */, 1A7CCB180CD9469A00B7B64E /* SQLTransactionErrorCallback.h */, + B59DD6911190298E007E9684 /* SQLTransactionErrorCallback.idl */, + B523CF021182675400EBB29C /* SQLTransactionSync.cpp */, + B523CF011182675400EBB29C /* SQLTransactionSync.h */, + B523CEFF1182675400EBB29C /* SQLTransactionSyncCallback.h */, 51E3F9C50DA059DC00250911 /* Storage.cpp */, 51E3F9C40DA059DC00250911 /* Storage.h */, 51E3F9D10DA05D7100250911 /* Storage.idl */, @@ -10854,6 +10910,8 @@ 9FA37EF01172FD4100C4CD55 /* ScriptProfileNode.idl */, 7553CFE7108F473F00EA281E /* TimelineRecordFactory.cpp */, 7553CFE6108F473F00EA281E /* TimelineRecordFactory.h */, + 82B658971189E39200E052A1 /* InspectorCSSStore.h */, + 82B658991189E47600E052A1 /* InspectorCSSStore.cpp */, ); path = inspector; sourceTree = "<group>"; @@ -11044,6 +11102,7 @@ 4491959A0FBE17D700D9F824 /* WebCore.NPAPI.exp */, FE136AE710643BE50078CF6D /* WebCore.OrientationEvents.exp */, 4491959B0FBE17D700D9F824 /* WebCore.PluginHostProcess.exp */, + 271245D311890AB70083E852 /* WebCore.ProtectionSpaceAuthCallback.exp */, 449195990FBE17D700D9F824 /* WebCore.SVG.Animation.exp */, 449195980FBE17D700D9F824 /* WebCore.SVG.exp */, 449195970FBE17D700D9F824 /* WebCore.SVG.Filters.exp */, @@ -11761,10 +11820,10 @@ 850657040AAB476C002D15C0 /* StyleSheets */ = { isa = PBXGroup; children = ( - 0FF50259102BA9010066F39A /* DOMMedia.h */, - 0FF5025A102BA9010066F39A /* DOMMedia.mm */, 850656F80AAB4763002D15C0 /* DOMMediaList.h */, 850656F90AAB4763002D15C0 /* DOMMediaList.mm */, + 0FF50259102BA9010066F39A /* DOMStyleMedia.h */, + 0FF5025A102BA9010066F39A /* DOMStyleMedia.mm */, 850656FA0AAB4763002D15C0 /* DOMStyleSheet.h */, 850656FB0AAB4763002D15C0 /* DOMStyleSheet.mm */, 850656FC0AAB4763002D15C0 /* DOMStyleSheetList.h */, @@ -12447,6 +12506,8 @@ 2E2D99E610E2BC1C00496337 /* DOMBlob.mm */, BC00EFFE0E0A185500FD04E3 /* DOMFile.h */, BC00EFFF0E0A185500FD04E3 /* DOMFile.mm */, + 2E3BC106117D479800B9409A /* DOMFileError.h */, + 2E3BC107117D479800B9409A /* DOMFileError.mm */, BC00F0010E0A185500FD04E3 /* DOMFileList.h */, BC00F0020E0A185500FD04E3 /* DOMFileList.mm */, 85DF81210AA7787200486AD7 /* DOMHTMLAnchorElement.h */, @@ -12617,6 +12678,7 @@ 85E7114A0AC5D5340053270F /* DOMEntityInternal.h */, 85E7114B0AC5D5340053270F /* DOMEntityReferenceInternal.h */, 85B498F40ADB337A00925CBB /* DOMEventInternal.h */, + 2E3BC10A117D47C800B9409A /* DOMFileErrorInternal.h */, BC00F0000E0A185500FD04E3 /* DOMFileInternal.h */, BC00F0030E0A185500FD04E3 /* DOMFileListInternal.h */, 85E7114C0AC5D5340053270F /* DOMHTMLAnchorElementInternal.h */, @@ -12680,7 +12742,6 @@ 85E711800AC5D5350053270F /* DOMHTMLTitleElementInternal.h */, 85E711810AC5D5350053270F /* DOMHTMLUListElementInternal.h */, 85989DC50ACC8BBD00A0BC51 /* DOMKeyboardEventInternal.h */, - 0FF50262102BA92B0066F39A /* DOMMediaInternal.h */, 85E711820AC5D5350053270F /* DOMMediaListInternal.h */, 75793ED20D0CE85B007FC0AC /* DOMMessageEventInternal.h */, E1ADEDD40E76BD60004A1A5E /* DOMMessagePortInternal.h */, @@ -12697,6 +12758,7 @@ 8538F05A0AD722F1006A81D1 /* DOMRangeInternal.h */, 85E711870AC5D5350053270F /* DOMRectInternal.h */, BCD0FC4E0DBD720B00B2F630 /* DOMRGBColorInternal.h */, + 0FF50262102BA92B0066F39A /* DOMStyleMediaInternal.h */, 85B498FE0ADB348100925CBB /* DOMStyleSheetInternal.h */, 85E711880AC5D5350053270F /* DOMStyleSheetListInternal.h */, 85ACEF850ACDD04A001214FF /* DOMSVGAElementInternal.h */, @@ -12988,14 +13050,6 @@ 93EEC1EC09C2877700C515D1 /* html */ = { isa = PBXGroup; children = ( - 895253DE116C4F0600CABF00 /* FileThreadTask.h */, - 895253DA116C4EF500CABF00 /* FileStreamProxy.cpp */, - 895253DB116C4EF500CABF00 /* FileStreamProxy.h */, - 895253D4116C4C6800CABF00 /* FileStream.cpp */, - 895253D5116C4C6800CABF00 /* FileStream.h */, - 895253D6116C4C6800CABF00 /* FileStreamClient.h */, - 8952535011641B3400CABF00 /* FileThread.cpp */, - 8952535111641B3400CABF00 /* FileThread.h */, 49484FAE102CF01E00187DD3 /* canvas */, 2EAFAF0B10E2AF2D007ED3D6 /* Blob.cpp */, 2EAFAF0C10E2AF2D007ED3D6 /* Blob.h */, @@ -13020,9 +13074,21 @@ BCDBB8CC0E08958400C60FF6 /* File.cpp */, BCDBB8CB0E08958400C60FF6 /* File.h */, BC1881D90E08C4ED00048C13 /* File.idl */, + 2E3BC0BB117D3A4F00B9409A /* FileError.h */, + 2E3BC0BC117D3A4F00B9409A /* FileError.idl */, BCDBB8AB0E088CA500C60FF6 /* FileList.cpp */, BCDBB8AA0E088CA500C60FF6 /* FileList.h */, BC1881DC0E08C54300048C13 /* FileList.idl */, + 2E94F3CB118B908E00B7F75D /* FileReader.cpp */, + 2E94F3CC118B908E00B7F75D /* FileReader.h */, + 895253D4116C4C6800CABF00 /* FileStream.cpp */, + 895253D5116C4C6800CABF00 /* FileStream.h */, + 895253D6116C4C6800CABF00 /* FileStreamClient.h */, + 895253DA116C4EF500CABF00 /* FileStreamProxy.cpp */, + 895253DB116C4EF500CABF00 /* FileStreamProxy.h */, + 8952535011641B3400CABF00 /* FileThread.cpp */, + 8952535111641B3400CABF00 /* FileThread.h */, + 895253DE116C4F0600CABF00 /* FileThreadTask.h */, A8136D370973A8E700D74463 /* FormDataList.cpp */, A8136D360973A8E700D74463 /* FormDataList.h */, BC97E239109144950010D361 /* HTMLAllCollection.cpp */, @@ -13361,6 +13427,8 @@ 2E0888D31148848A00AF4265 /* JSDOMFormData.h */, BC00F0100E0A189500FD04E3 /* JSFile.cpp */, BC00F0110E0A189500FD04E3 /* JSFile.h */, + 2E3BC0C8117D3E0800B9409A /* JSFileError.cpp */, + 2E3BC0C9117D3E0800B9409A /* JSFileError.h */, BC00F0120E0A189500FD04E3 /* JSFileList.cpp */, BC00F0130E0A189500FD04E3 /* JSFileList.h */, BC97E410109154FA0010D361 /* JSHTMLAllCollection.cpp */, @@ -13884,14 +13952,14 @@ BC686C790E0C330100DE8A08 /* JSCSSVariablesDeclaration.h */, BC686C7A0E0C330100DE8A08 /* JSCSSVariablesRule.cpp */, BC686C7B0E0C330100DE8A08 /* JSCSSVariablesRule.h */, - 0FF50267102BA9430066F39A /* JSMedia.cpp */, - 0FF50268102BA9430066F39A /* JSMedia.h */, BC3C39B40C0D3D8D005F4D7A /* JSMediaList.cpp */, BC3C39B50C0D3D8D005F4D7A /* JSMediaList.h */, BCFE2F0F0C1B58370020235F /* JSRect.cpp */, BCFE2F100C1B58370020235F /* JSRect.h */, BC74DA461013F468007987AD /* JSRGBColor.cpp */, BC74DA471013F468007987AD /* JSRGBColor.h */, + 0FF50267102BA9430066F39A /* JSStyleMedia.cpp */, + 0FF50268102BA9430066F39A /* JSStyleMedia.h */, BCE013980C0BEF180043860A /* JSStyleSheet.cpp */, BCE013990C0BEF180043860A /* JSStyleSheet.h */, A84EBD820CB8C97700079609 /* JSStyleSheetList.cpp */, @@ -14027,6 +14095,16 @@ 51E3F9D50DA05E1D00250911 /* JSStorage.h */, 51E0BAE80DA55D4A00A9E417 /* JSStorageEvent.cpp */, 51E0BAE90DA55D4A00A9E417 /* JSStorageEvent.h */, + B59DD697119029E5007E9684 /* JSDatabaseCallback.h */, + B59DD698119029E5007E9684 /* JSDatabaseCallback.cpp */, + B59DD69B11902A42007E9684 /* JSSQLTransactionCallback.h */, + B59DD69C11902A42007E9684 /* JSSQLTransactionCallback.cpp */, + B59DD69F11902A52007E9684 /* JSSQLTransactionErrorCallback.h */, + B59DD6A011902A52007E9684 /* JSSQLTransactionErrorCallback.cpp */, + B59DD6A311902A62007E9684 /* JSSQLStatementCallback.h */, + B59DD6A411902A62007E9684 /* JSSQLStatementCallback.cpp */, + B59DD6A711902A71007E9684 /* JSSQLStatementErrorCallback.h */, + B59DD6A811902A71007E9684 /* JSSQLStatementErrorCallback.cpp */, ); name = Storage; sourceTree = "<group>"; @@ -14510,21 +14588,6 @@ B255989C0D00D8B800BB825C /* filters */, B255990B0D00D8B900BB825C /* SVGImage.cpp */, B255990C0D00D8B900BB825C /* SVGImage.h */, - B255990E0D00D8B900BB825C /* SVGPaintServer.cpp */, - B255990F0D00D8B900BB825C /* SVGPaintServer.h */, - B25599100D00D8B900BB825C /* SVGPaintServerGradient.cpp */, - B25599110D00D8B900BB825C /* SVGPaintServerGradient.h */, - B25599120D00D8B900BB825C /* SVGPaintServerLinearGradient.cpp */, - B25599130D00D8B900BB825C /* SVGPaintServerLinearGradient.h */, - B25599140D00D8B900BB825C /* SVGPaintServerPattern.cpp */, - B25599150D00D8B900BB825C /* SVGPaintServerPattern.h */, - B25599160D00D8B900BB825C /* SVGPaintServerRadialGradient.cpp */, - B25599170D00D8B900BB825C /* SVGPaintServerRadialGradient.h */, - B25599180D00D8B900BB825C /* SVGPaintServerSolid.cpp */, - B25599190D00D8B900BB825C /* SVGPaintServerSolid.h */, - B255991A0D00D8B900BB825C /* SVGResource.cpp */, - B255991B0D00D8B900BB825C /* SVGResource.h */, - B25599200D00D8B900BB825C /* SVGResourceListener.h */, ); path = graphics; sourceTree = "<group>"; @@ -14629,6 +14692,8 @@ E4B41E100CBF90EF00AF2ECE /* MediaPlayerPrivateQTKit.h */, E4B41E110CBF90EF00AF2ECE /* MediaPlayerPrivateQTKit.mm */, 0735EE690F40C5E4004A2604 /* MediaPlayerProxy.h */, + 163E8B12118B3ADD00ED9231 /* SimpleFontDataATSUI.mm */, + 163E88F5118A39D200ED9231 /* SimpleFontDataCoreText.cpp */, B2AFFC770D00A5C10030074D /* SimpleFontDataMac.mm */, 0FCF332B0F2B9A25004B6795 /* WebLayer.h */, 0FCF332A0F2B9A25004B6795 /* WebLayer.mm */, @@ -14683,7 +14748,6 @@ BC23F0DA0DAFF4A4009FDC91 /* GeneratedImage.h */, BCE04C890DAFF7A0007A0F41 /* Generator.h */, B2C3DA5B0D006CD600EF6F26 /* GlyphBuffer.h */, - C5D4AA77116BAFB60069CA93 /* GlyphMetricsMap.cpp */, C5D4AA78116BAFB60069CA93 /* GlyphMetricsMap.h */, B2C3DA5C0D006CD600EF6F26 /* GlyphPageTreeNode.cpp */, B2C3DA5D0D006CD600EF6F26 /* GlyphPageTreeNode.h */, @@ -14864,8 +14928,8 @@ BC53DA2D1143121E000D817E /* DOMWrapperWorld.h */, 1432E8480C51493F00B1500F /* GCController.cpp */, 1432E8460C51493800B1500F /* GCController.h */, - B5D3601E112F8BA80048DEA8 /* JSDatabaseCallback.cpp */, - B5D3601C112F8BA00048DEA8 /* JSDatabaseCallback.h */, + 1C81BA030E97348300266E07 /* JavaScriptCallFrame.cpp */, + 1C81BA040E97348300266E07 /* JavaScriptCallFrame.h */, BC53DAC411432FD9000D817E /* JSDebugWrapperSet.cpp */, BC53DAC111432EEE000D817E /* JSDebugWrapperSet.h */, 93B70D4709EB0C7C009D8468 /* JSDOMBinding.cpp */, @@ -14892,8 +14956,6 @@ E1C36D330EB0A094007410BC /* JSWorkerContextBase.h */, F3D461461161D53200CA0D09 /* JSWorkerContextErrorHandler.cpp */, F3D461471161D53200CA0D09 /* JSWorkerContextErrorHandler.h */, - 1C81BA030E97348300266E07 /* JavaScriptCallFrame.cpp */, - 1C81BA040E97348300266E07 /* JavaScriptCallFrame.h */, BCA378BA0D15F64200B793D6 /* ScheduledAction.cpp */, BCA378BB0D15F64200B793D6 /* ScheduledAction.h */, 7A1E88F3101CC384000C4DF5 /* ScriptArray.cpp */, @@ -14987,7 +15049,6 @@ BC4EDEF70C08F414007EDD49 /* Custom */ = { isa = PBXGroup; children = ( - 415B7C540FF598E6006770F7 /* JSAbstractWorkerCustom.cpp */, BC2ED6BB0C6BD2F000920BFF /* JSAttrCustom.cpp */, 49EED14B1051971900099FAB /* JSCanvasRenderingContext2DCustom.cpp */, 49EED14D1051971A00099FAB /* JSCanvasRenderingContextCustom.cpp */, @@ -15004,14 +15065,12 @@ 4162A453101145E300DFF3ED /* JSDedicatedWorkerContextCustom.cpp */, 33503CBF10179C1A003B47E1 /* JSDesktopNotificationsCustom.cpp */, 49C7BA8C1042F5B10009D447 /* JSDocumentCustom.cpp */, - BCCE58AE1061E90C008FB35A /* JSDocumentFragmentCustom.cpp */, 1AC226160DB69F740089B669 /* JSDOMApplicationCacheCustom.cpp */, 2E0888E5114884E200AF4265 /* JSDOMFormDataCustom.cpp */, BCD9C25E0C17AA67005C90A2 /* JSDOMWindowCustom.cpp */, 652FBBBB0DE27CB60001D386 /* JSDOMWindowCustom.h */, BC2ED5540C6B9BD300920BFF /* JSElementCustom.cpp */, BCEFAF4D0C317E6900FA81F6 /* JSEventCustom.cpp */, - E0FEF371B57C53EAC1C1FBEE /* JSEventSourceCustom.cpp */, FE80D7A60E9C1ED2000D6F75 /* JSGeolocationCustom.cpp */, BCE7B1920D4E86960075A539 /* JSHistoryCustom.cpp */, BC97E42B10915B060010D361 /* JSHTMLAllCollectionCustom.cpp */, @@ -15051,6 +15110,7 @@ A9C6E64A0D7465E7006442E9 /* JSPluginArrayCustom.cpp */, A9C6E64B0D7465E7006442E9 /* JSPluginCustom.cpp */, 5189F01710B3781300F3C739 /* JSPopStateEventCustom.cpp */, + 9FA37EE61172FCF000C4CD55 /* JSScriptProfileNodeCustom.cpp */, 51DCE8010CAC9F1C00488358 /* JSSQLResultSetRowListCustom.cpp */, 1AD2316D0CD269E700C1F194 /* JSSQLTransactionCustom.cpp */, 51D0C5150DAA90B7003B3831 /* JSStorageCustom.cpp */, @@ -15063,7 +15123,6 @@ B2C96D8C0B3AF2B7005E80EC /* JSSVGPathSegCustom.cpp */, B297BC6F0B3C14CF0045A590 /* JSSVGPathSegListCustom.cpp */, 087D97BE10FB8D7700C00874 /* JSSVGPODListCustom.h */, - 9FA37EE61172FCF000C4CD55 /* JSScriptProfileNodeCustom.cpp */, 1A2C40AA0DEB55AA005AF19E /* JSTextCustom.cpp */, 516BB7920CE91E6800512F79 /* JSTreeWalkerCustom.cpp */, 492273A21083B3B100EE5C84 /* JSWebGLArrayCustom.cpp */, @@ -15318,14 +15377,7 @@ FE80D7A30E9C1ED2000D6F75 /* JSCustomPositionCallback.h */, FE80D7A40E9C1ED2000D6F75 /* JSCustomPositionErrorCallback.cpp */, FE80D7A50E9C1ED2000D6F75 /* JSCustomPositionErrorCallback.h */, - 51EC925B0CE90DD400F90308 /* JSCustomSQLStatementCallback.cpp */, - 51EC925C0CE90DD400F90308 /* JSCustomSQLStatementCallback.h */, 51EC925D0CE90DD400F90308 /* JSCustomSQLStatementErrorCallback.cpp */, - 51EC925E0CE90DD400F90308 /* JSCustomSQLStatementErrorCallback.h */, - 51EC925F0CE90DD400F90308 /* JSCustomSQLTransactionCallback.cpp */, - 51EC92600CE90DD400F90308 /* JSCustomSQLTransactionCallback.h */, - 51EC92610CE90DD400F90308 /* JSCustomSQLTransactionErrorCallback.cpp */, - 51EC92620CE90DD400F90308 /* JSCustomSQLTransactionErrorCallback.h */, 1A3417C80CECFF250049CBDE /* JSCustomVoidCallback.cpp */, 1A3417C70CECFF250049CBDE /* JSCustomVoidCallback.h */, E10B93C20B73C291003ED890 /* JSCustomXPathNSResolver.cpp */, @@ -15764,9 +15816,6 @@ 93CA4C9B09DF93FA00DF8677 /* makeprop.pl */, 93CA4C9D09DF93FA00DF8677 /* makevalues.pl */, FA654A631108ABB7002615E0 /* mathml.css */, - 0FF5026E102BA9660066F39A /* Media.cpp */, - 0FF5026F102BA96A0066F39A /* Media.h */, - 0FF50270102BA96A0066F39A /* Media.idl */, 070DD8F50F01868000727DEB /* mediaControls.css */, 07AFE5900F1446BD00841617 /* mediaControlsQuickTime.css */, 4E19591F0A39DABA00220FE5 /* MediaFeatureNames.cpp */, @@ -15793,6 +15842,9 @@ A80E73490A199C77007FB8C5 /* StyleBase.h */, A80E73460A199C77007FB8C5 /* StyleList.cpp */, A80E734A0A199C77007FB8C5 /* StyleList.h */, + 0FF5026E102BA9660066F39A /* StyleMedia.cpp */, + 0FF5026F102BA96A0066F39A /* StyleMedia.h */, + 0FF50270102BA96A0066F39A /* StyleMedia.idl */, A8EA80050A19516E00A8EF5F /* StyleSheet.cpp */, A8EA80040A19516E00A8EF5F /* StyleSheet.h */, 850656DC0AAB44D9002D15C0 /* StyleSheet.idl */, @@ -15829,8 +15881,6 @@ F523D2F302DE443B018635CA /* rendering */ = { isa = PBXGroup; children = ( - 841FDC241178C9BE00F8AC9B /* RenderSVGResourceFilter.cpp */, - 841FDC251178C9BE00F8AC9B /* RenderSVGResourceFilter.h */, BC8C8FAA0DDCD2F200B592F4 /* style */, A8CFF04B0A154F09000A4234 /* AutoTableLayout.cpp */, A8CFF0490A154F09000A4234 /* AutoTableLayout.h */, @@ -15975,13 +16025,27 @@ 853CA9D10AEEC5E9002372DC /* RenderSVGInlineText.h */, A8F5C0B70F9285AC0098E06B /* RenderSVGModelObject.cpp */, A8F5C0B60F9285AC0098E06B /* RenderSVGModelObject.h */, + 08563BCF117865F50012B578 /* RenderSVGResource.cpp */, 083192A7112B43050083C3B9 /* RenderSVGResource.h */, 84BDA16911358D2A00DBF64C /* RenderSVGResourceClipper.cpp */, 84BDA16A11358D2A00DBF64C /* RenderSVGResourceClipper.h */, + 08082372117987C100241DE8 /* RenderSVGResourceContainer.h */, + 841FDC241178C9BE00F8AC9B /* RenderSVGResourceFilter.cpp */, + 841FDC251178C9BE00F8AC9B /* RenderSVGResourceFilter.h */, + 08C34AF11179C056002D7456 /* RenderSVGResourceGradient.cpp */, + 08C34AF21179C057002D7456 /* RenderSVGResourceGradient.h */, + 08C34AF31179C057002D7456 /* RenderSVGResourceLinearGradient.cpp */, + 08C34AF41179C057002D7456 /* RenderSVGResourceLinearGradient.h */, 8499A512115FB33000F566E3 /* RenderSVGResourceMarker.cpp */, 8499A513115FB33000F566E3 /* RenderSVGResourceMarker.h */, 083192A8112B43050083C3B9 /* RenderSVGResourceMasker.cpp */, 083192A9112B43050083C3B9 /* RenderSVGResourceMasker.h */, + 08563BB2117861770012B578 /* RenderSVGResourcePattern.cpp */, + 08563BB3117861770012B578 /* RenderSVGResourcePattern.h */, + 08C34AFB1179C072002D7456 /* RenderSVGResourceRadialGradient.cpp */, + 08C34AFC1179C072002D7456 /* RenderSVGResourceRadialGradient.h */, + 08C6A7A9117DFBAB00FEA1A2 /* RenderSVGResourceSolidColor.cpp */, + 08C6A7AA117DFBAB00FEA1A2 /* RenderSVGResourceSolidColor.h */, AA31B5B20C1DFD1000AE7083 /* RenderSVGRoot.cpp */, AA31B5B30C1DFD1000AE7083 /* RenderSVGRoot.h */, 08DAB9B81103D9A5003E7ABA /* RenderSVGShadowTreeRootContainer.cpp */, @@ -16034,6 +16098,8 @@ A8CFF5DA0A155A05000A4234 /* RootInlineBox.h */, 5D925B650F64D4DD00B847F0 /* ScrollBehavior.cpp */, 5D925B660F64D4DD00B847F0 /* ScrollBehavior.h */, + 0842BC701190144000C7D08F /* SVGCharacterData.cpp */, + 0842BC711190144000C7D08F /* SVGCharacterData.h */, B2B33A5D0B887CEF00C15984 /* SVGCharacterLayoutInfo.cpp */, B2B33A5E0B887CEF00C15984 /* SVGCharacterLayoutInfo.h */, 853CA9E20AEEC608002372DC /* SVGInlineFlowBox.cpp */, @@ -16051,6 +16117,7 @@ 853CA9E50AEEC608002372DC /* SVGRootInlineBox.h */, 08DAB9C01103D9C1003E7ABA /* SVGShadowTreeElements.cpp */, 08DAB9C11103D9C1003E7ABA /* SVGShadowTreeElements.h */, + 0842BC801190147200C7D08F /* SVGTextChunkLayoutInfo.h */, A8CFF04C0A154F09000A4234 /* TableLayout.h */, AB014DE10E689A4300E10445 /* TextControlInnerElements.cpp */, AB014DE20E689A4300E10445 /* TextControlInnerElements.h */, @@ -16285,6 +16352,7 @@ 5DB1BC6910715A6400EFAA49 /* TransformSourceLibxslt.cpp */, 854FE72C0A2297BE0058D7AD /* Traversal.cpp */, 854FE72D0A2297BE0058D7AD /* Traversal.h */, + 37FD4297118368460093C029 /* TreeDepthLimit.h */, 854FE72E0A2297BE0058D7AD /* TreeWalker.cpp */, 854FE72F0A2297BE0058D7AD /* TreeWalker.h */, 1A750D3C0A90DE35000FF215 /* TreeWalker.idl */, @@ -16338,8 +16406,12 @@ FA0B1F8311125CEE007F9839 /* RenderMathMLMath.h */, FA5FAE4011126A5D00D3750F /* RenderMathMLOperator.cpp */, FA5FAE4111126A5D00D3750F /* RenderMathMLOperator.h */, + 0FF2813211821CB6007B7CD6 /* RenderMathMLRoot.cpp */, + 0FF2813311821CB6007B7CD6 /* RenderMathMLRoot.h */, FA0B1F8411125CEE007F9839 /* RenderMathMLRow.cpp */, FA0B1F8511125CEE007F9839 /* RenderMathMLRow.h */, + 0FF2813411821CB6007B7CD6 /* RenderMathMLSquareRoot.cpp */, + 0FF2813511821CB6007B7CD6 /* RenderMathMLSquareRoot.h */, FAC12CC21120DA6900DACC36 /* RenderMathMLSubSup.cpp */, FAC12CC31120DA6900DACC36 /* RenderMathMLSubSup.h */, FA7EFB031120D25400CF79C7 /* RenderMathMLUnderOver.cpp */, @@ -16368,6 +16440,7 @@ 76CDD2F51103DA6600680521 /* AccessibilityMenuListPopup.h in Headers */, 29A812360FBB9C1D00510293 /* AccessibilityObject.h in Headers */, 29A812490FBB9CA900510293 /* AccessibilityObjectWrapper.h in Headers */, + A409C985116D0DDD007197BD /* AccessibilityProgressIndicator.h in Headers */, 29A812390FBB9C1D00510293 /* AccessibilityRenderObject.h in Headers */, 93C4F6EB1108F9A50099D0DB /* AccessibilityScrollbar.h in Headers */, 0709FC4E1025DEE30059CDBA /* AccessibilitySlider.h in Headers */, @@ -16567,12 +16640,14 @@ 93F1992F08245E59001E9ABC /* Cursor.h in Headers */, BC2272A20E82E87C00E7F975 /* CursorData.h in Headers */, BC2272AD0E82E8F300E7F975 /* CursorList.h in Headers */, + 62CD325A1157E57C0063B0A7 /* CustomEvent.h in Headers */, A8CB413E0E8633FD0032C4F0 /* DashArray.h in Headers */, A80E6D0B0A1989CA007FB8C5 /* DashboardRegion.h in Headers */, 5196116B0CAC56570010A80C /* Database.h in Headers */, 51A45B560CAD7FD7000D2BE9 /* DatabaseAuthorizer.h in Headers */, B5D3601A112F8B560048DEA8 /* DatabaseCallback.h in Headers */, 5116D9770CF177BD00C2B84D /* DatabaseDetails.h in Headers */, + B523CF0B1182675400EBB29C /* DatabaseSync.h in Headers */, 519611EA0CAC749C0010A80C /* DatabaseTask.h in Headers */, 519611780CAC56A80010A80C /* DatabaseThread.h in Headers */, 1AD51A140CB59CD300953D11 /* DatabaseTracker.h in Headers */, @@ -16599,6 +16674,7 @@ ED2BA83C09A24B91006C0AC4 /* DocumentMarker.h in Headers */, 0B90561A0F2578BF0095FF6A /* DocumentThreadableLoader.h in Headers */, A8185F3909765766005826D9 /* DocumentType.h in Headers */, + 973889A1116EA9DC00ADF313 /* DocumentWriter.h in Headers */, BC1A37AD097C715F0019F3D8 /* DOM.h in Headers */, 8538F0190AD718D8006A81D1 /* DOMAbstractView.h in Headers */, BC99812E0DBE807A008CE9EF /* DOMAbstractViewFrame.h in Headers */, @@ -16677,6 +16753,8 @@ 85C78A680ABDE1B40044FC16 /* DOMException.h in Headers */, BC1A37B5097C715F0019F3D8 /* DOMExtensions.h in Headers */, BC00F0040E0A185500FD04E3 /* DOMFile.h in Headers */, + 2E3BC108117D479800B9409A /* DOMFileError.h in Headers */, + 2E3BC10B117D47C800B9409A /* DOMFileErrorInternal.h in Headers */, BC00F0060E0A185500FD04E3 /* DOMFileInternal.h in Headers */, BC00F0070E0A185500FD04E3 /* DOMFileList.h in Headers */, BC00F0090E0A185500FD04E3 /* DOMFileListInternal.h in Headers */, @@ -16777,6 +16855,8 @@ 85E711C20AC5D5350053270F /* DOMHTMLParamElementInternal.h in Headers */, 85183B480AA6926100F19FA3 /* DOMHTMLPreElement.h in Headers */, 85E711C30AC5D5350053270F /* DOMHTMLPreElementInternal.h in Headers */, + A4226E951163D73A008B8397 /* DOMHTMLProgressElement.h in Headers */, + A4226E991163D7CC008B8397 /* DOMHTMLProgressElementInternal.h in Headers */, 85183B4A0AA6926100F19FA3 /* DOMHTMLQuoteElement.h in Headers */, 85E711C40AC5D5350053270F /* DOMHTMLQuoteElementInternal.h in Headers */, 85DF819B0AA77E4B00486AD7 /* DOMHTMLScriptElement.h in Headers */, @@ -16808,8 +16888,6 @@ BC1A37B9097C715F0019F3D8 /* DOMInternal.h in Headers */, 85FF315A0AAFBFCB00374F38 /* DOMKeyboardEvent.h in Headers */, 85989DCC0ACC8BBD00A0BC51 /* DOMKeyboardEventInternal.h in Headers */, - 0FF5025B102BA9010066F39A /* DOMMedia.h in Headers */, - 0FF50263102BA92C0066F39A /* DOMMediaInternal.h in Headers */, 850656FE0AAB4763002D15C0 /* DOMMediaList.h in Headers */, 85E711D10AC5D5350053270F /* DOMMediaListInternal.h in Headers */, 75793ED30D0CE85B007FC0AC /* DOMMessageEvent.h in Headers */, @@ -16851,6 +16929,8 @@ 855D358A0AD707310019AAC7 /* DOMRGBColor.h in Headers */, BCD0FC4F0DBD720B00B2F630 /* DOMRGBColorInternal.h in Headers */, BC5A86850C33676000EEA649 /* DOMSelection.h in Headers */, + 0FF5025B102BA9010066F39A /* DOMStyleMedia.h in Headers */, + 0FF50263102BA92C0066F39A /* DOMStyleMediaInternal.h in Headers */, 850657000AAB4763002D15C0 /* DOMStyleSheet.h in Headers */, 85B498FF0ADB348100925CBB /* DOMStyleSheetInternal.h in Headers */, 850657020AAB4763002D15C0 /* DOMStyleSheetList.h in Headers */, @@ -17354,6 +17434,7 @@ E415F1840D9A1A830033CE97 /* ElementTimeControl.h in Headers */, A8CFF6BE0A156118000A4234 /* EllipsisBox.h in Headers */, B25599A50D00D8BA00BB825C /* EmptyClients.h in Headers */, + 5DC87EF011716DF2001C0E6D /* EmptyProtocolDefinitions.h in Headers */, A8EA7EC20A1945D000A8EF5F /* Entity.h in Headers */, A8EA7EC00A1945D000A8EF5F /* EntityReference.h in Headers */, 2ECF7AE210162B5800427DE7 /* ErrorEvent.h in Headers */, @@ -17375,8 +17456,14 @@ 84801955108BAFB300CB2B1F /* FEGaussianBlur.h in Headers */, BCDBB8CD0E08958400C60FF6 /* File.h in Headers */, 066C772B0AB603B700238CC4 /* FileChooser.h in Headers */, + 2E3BC0BD117D3A4F00B9409A /* FileError.h in Headers */, BCDBB8AC0E088CA500C60FF6 /* FileList.h in Headers */, + 895253D8116C4C6800CABF00 /* FileStream.h in Headers */, + 895253D9116C4C6800CABF00 /* FileStreamClient.h in Headers */, + 895253DD116C4EF500CABF00 /* FileStreamProxy.h in Headers */, 514B3F730C722047000530DF /* FileSystem.h in Headers */, + 8952535311641B3400CABF00 /* FileThread.h in Headers */, + 895253DF116C4F0600CABF00 /* FileThreadTask.h in Headers */, BC5EB69F0E81DAEB00B25965 /* FillLayer.h in Headers */, 845E72F80FD261EE00A87D79 /* Filter.h in Headers */, 08C9251A0FCC7C4A00480DEC /* FilterEffect.h in Headers */, @@ -17436,6 +17523,7 @@ 59C77F2B10545B3B00506104 /* GeolocationServiceMock.h in Headers */, FE80D7C90E9C1F25000D6F75 /* Geoposition.h in Headers */, B2C3DA6C0D006CD600EF6F26 /* GlyphBuffer.h in Headers */, + C5D4AA7A116BAFB60069CA93 /* GlyphMetricsMap.h in Headers */, B2C3DA6E0D006CD600EF6F26 /* GlyphPageTreeNode.h in Headers */, BC53C5F50DA56B920021EB5D /* Gradient.h in Headers */, B22279640D00BF220071B782 /* GradientAttributes.h in Headers */, @@ -17526,6 +17614,7 @@ A871D4560A127CBC00B12A68 /* HTMLPlugInElement.h in Headers */, 4415292E0E1AE8A000C4A2D0 /* HTMLPlugInImageElement.h in Headers */, A8EA7CB00A192B9C00A8EF5F /* HTMLPreElement.h in Headers */, + A43BF5991149290A00C643CA /* HTMLProgressElement.h in Headers */, A8CFF7A30A156978000A4234 /* HTMLQuoteElement.h in Headers */, A871DC250A15205700B12A68 /* HTMLScriptElement.h in Headers */, A81369D8097374F600D74463 /* HTMLSelectElement.h in Headers */, @@ -17592,6 +17681,7 @@ 7A0E770F10C00A8800A0276E /* InspectorFrontendHost.h in Headers */, 41F062010F5F0B6600A07EAC /* InspectorResource.h in Headers */, 754133A8102E00E800075D00 /* InspectorTimelineAgent.h in Headers */, + F375CC071150D300008DDB81 /* InspectorWorkerResource.h in Headers */, B27535720B053814002CE64F /* IntPoint.h in Headers */, E462A4A1113E71BE004A4220 /* IntPointHash.h in Headers */, B27535740B053814002CE64F /* IntRect.h in Headers */, @@ -17644,16 +17734,12 @@ A8D05FAC0A23B30F005E7203 /* JSCSSValueList.h in Headers */, BC686C7D0E0C330100DE8A08 /* JSCSSVariablesDeclaration.h in Headers */, BC686C7F0E0C330100DE8A08 /* JSCSSVariablesRule.h in Headers */, + E4778B80115A581A00B5D372 /* JSCustomEvent.h in Headers */, FE80D7A80E9C1ED2000D6F75 /* JSCustomPositionCallback.h in Headers */, FE80D7AA0E9C1ED2000D6F75 /* JSCustomPositionErrorCallback.h in Headers */, - 51EC92640CE90DD400F90308 /* JSCustomSQLStatementCallback.h in Headers */, - 51EC92660CE90DD400F90308 /* JSCustomSQLStatementErrorCallback.h in Headers */, - 51EC92680CE90DD400F90308 /* JSCustomSQLTransactionCallback.h in Headers */, - 51EC926A0CE90DD400F90308 /* JSCustomSQLTransactionErrorCallback.h in Headers */, 1A3417C90CECFF250049CBDE /* JSCustomVoidCallback.h in Headers */, E10B937C0B73C00A003ED890 /* JSCustomXPathNSResolver.h in Headers */, 1AE82F900CAAFA9D002237AE /* JSDatabase.h in Headers */, - B5D3601D112F8BA00048DEA8 /* JSDatabaseCallback.h in Headers */, BC77D16A0FF19F560070887B /* JSDataGridColumn.h in Headers */, BC77D16C0FF19F560070887B /* JSDataGridColumnList.h in Headers */, BCBCAE3D0FF19399000762AE /* JSDataGridDataSource.h in Headers */, @@ -17686,6 +17772,7 @@ BC60901F0E91B8EC000C68B5 /* JSEventTarget.h in Headers */, 3314ACEC10892086000F0E56 /* JSExceptionBase.h in Headers */, BC00F0150E0A189500FD04E3 /* JSFile.h in Headers */, + 2E3BC0CB117D3E0800B9409A /* JSFileError.h in Headers */, BC00F0170E0A189500FD04E3 /* JSFileList.h in Headers */, FE80DA640E9C4703000D6F75 /* JSGeolocation.h in Headers */, FE80DA660E9C4703000D6F75 /* JSGeoposition.h in Headers */, @@ -17746,6 +17833,7 @@ 1AE2ABA70A1CE90500B42B25 /* JSHTMLParagraphElement.h in Headers */, 1AE2ABA90A1CE90500B42B25 /* JSHTMLParamElement.h in Headers */, 1AE2ABAB0A1CE90500B42B25 /* JSHTMLPreElement.h in Headers */, + A4226E5C1163D695008B8397 /* JSHTMLProgressElement.h in Headers */, 1AE2AEC80A1D297B00B42B25 /* JSHTMLQuoteElement.h in Headers */, 1AE2ABAD0A1CE90500B42B25 /* JSHTMLScriptElement.h in Headers */, E1E6EEA80B628DB3005F2F70 /* JSHTMLSelectElement.h in Headers */, @@ -17771,7 +17859,6 @@ A86629D309DA2B48009633A5 /* JSKeyboardEvent.h in Headers */, 935F45430F7C3B5F00D7C1FB /* JSLazyEventListener.h in Headers */, BCE1C43C0D9830D3003B02F2 /* JSLocation.h in Headers */, - 0FF5026A102BA9430066F39A /* JSMedia.h in Headers */, E44614190CD6826900FADA75 /* JSMediaError.h in Headers */, BC3C39B70C0D3D8D005F4D7A /* JSMediaList.h in Headers */, E107400E0E77BDC00033AF24 /* JSMessageChannel.h in Headers */, @@ -17785,6 +17872,7 @@ 65DF31FC09D1CC60000BE325 /* JSMutationEvent.h in Headers */, BCD9C2C10C17B69E005C90A2 /* JSNamedNodeMap.h in Headers */, A9D247F80D757E3400FDF959 /* JSNavigator.h in Headers */, + BC9439C3116CF4940048C750 /* JSNodeCustom.h in Headers */, 14115B7309F84CD600CA4FC1 /* JSNodeFilter.h in Headers */, BCB773620C17853D00132BA4 /* JSNodeFilterCondition.h in Headers */, 1A750D8E0A90E521000FF215 /* JSNodeIterator.h in Headers */, @@ -17807,6 +17895,8 @@ BCFE2F120C1B58380020235F /* JSRect.h in Headers */, BC74DA491013F468007987AD /* JSRGBColor.h in Headers */, BCEC01C30C274DDD009F4EC9 /* JSScreen.h in Headers */, + 9FA37EFB1172FDA600C4CD55 /* JSScriptProfile.h in Headers */, + 9FA37EFD1172FDA600C4CD55 /* JSScriptProfileNode.h in Headers */, 41D07A7F0FF935CA0095EDCE /* JSSharedWorker.h in Headers */, 415B7C630FF5A767006770F7 /* JSSharedWorkerConstructor.h in Headers */, 41D1690610238B66009BC827 /* JSSharedWorkerContext.h in Headers */, @@ -17815,6 +17905,7 @@ 1AFE119A0CBFFCC4003017FA /* JSSQLResultSetRowList.h in Headers */, BC82432A0D0CE8A200460C8F /* JSSQLTransaction.h in Headers */, 51E0BAEB0DA55D4A00A9E417 /* JSStorageEvent.h in Headers */, + 0FF5026A102BA9430066F39A /* JSStyleMedia.h in Headers */, BCE0139B0C0BEF180043860A /* JSStyleSheet.h in Headers */, A84EBD830CB8C97700079609 /* JSStyleSheetList.h in Headers */, B20111080AB7740500DB0E68 /* JSSVGAElement.h in Headers */, @@ -18020,6 +18111,8 @@ BCEFE1EB0DCA5F6400739219 /* JSXSLTProcessor.h in Headers */, BCE99EC40DCA624100182683 /* JSXSLTProcessorConstructor.h in Headers */, 85031B440A44EFC700F992E0 /* KeyboardEvent.h in Headers */, + A513B3D7114B1666001C429B /* KeyEventCocoa.h in Headers */, + A59E3C1E11580F510072928E /* KeyEventCodesIPhone.h in Headers */, 316FE11A0E6E1DA700BF6088 /* KeyframeAnimation.h in Headers */, BC5EBA110E823E4700B25965 /* KeyframeList.h in Headers */, 6593923809AE4346002C531F /* KURL.h in Headers */, @@ -18052,7 +18145,6 @@ FA654A6C1108ABED002615E0 /* MathMLTextElement.h in Headers */, 49D5DC2C0F423A73008F20FD /* Matrix3DTransformOperation.h in Headers */, 49E911C70EF86D47009D0CAF /* MatrixTransformOperation.h in Headers */, - 0FF50272102BA96A0066F39A /* Media.h in Headers */, 931BCC611124DFCB00BE70DD /* MediaCanStartListener.h in Headers */, ABFE7E130D32FAF60066F4D2 /* MediaControlElements.h in Headers */, AB40484E0E083FA8007D6920 /* MediaDocument.h in Headers */, @@ -18109,6 +18201,7 @@ 1A569D0F0D7E2B82007C3983 /* npruntime_impl.h in Headers */, 1A569D100D7E2B82007C3983 /* npruntime_internal.h in Headers */, 1A569D110D7E2B82007C3983 /* npruntime_priv.h in Headers */, + 1A27CF97118A354C0041D632 /* nptypes.h in Headers */, 1A569D120D7E2B82007C3983 /* objc_class.h in Headers */, 1A569D140D7E2B82007C3983 /* objc_header.h in Headers */, 1A569D150D7E2B82007C3983 /* objc_instance.h in Headers */, @@ -18209,8 +18302,10 @@ BCEA486E097D93020094C9E4 /* RenderFlexibleBox.h in Headers */, 853CA9ED0AEEC63C002372DC /* RenderForeignObject.h in Headers */, A871DED30A1530C700B12A68 /* RenderFrame.h in Headers */, + 0FD3080F117CF7E700A791F7 /* RenderFrameBase.h in Headers */, A871DED10A1530C700B12A68 /* RenderFrameSet.h in Headers */, BCEA486A097D93020094C9E4 /* RenderHTMLCanvas.h in Headers */, + 0FD308D6117D168500A791F7 /* RenderIFrame.h in Headers */, BCEA4876097D93020094C9E4 /* RenderImage.h in Headers */, BCB4F8900DB28DD60039139B /* RenderImageGeneratedContent.h in Headers */, BCEA4878097D93020094C9E4 /* RenderInline.h in Headers */, @@ -18223,9 +18318,12 @@ A8EA7A500A191A5200A8EF5F /* RenderListMarker.h in Headers */, 0F56028F0E4B76580065B038 /* RenderMarquee.h in Headers */, FA654A701108ABFF002615E0 /* RenderMathMLBlock.h in Headers */, + FAA10571114C2DF700940A01 /* RenderMathMLFraction.h in Headers */, FA0B1F8711125CEE007F9839 /* RenderMathMLMath.h in Headers */, FA5FAE4311126A5D00D3750F /* RenderMathMLOperator.h in Headers */, + 0FF2859111864053007B7CD6 /* RenderMathMLRoot.h in Headers */, FA0B1F8911125CEE007F9839 /* RenderMathMLRow.h in Headers */, + 0FF2859311864055007B7CD6 /* RenderMathMLSquareRoot.h in Headers */, FAC12CC51120DA6900DACC36 /* RenderMathMLSubSup.h in Headers */, FA7EFB061120D25400CF79C7 /* RenderMathMLUnderOver.h in Headers */, E4C279590CF9741900E97B98 /* RenderMedia.h in Headers */, @@ -18235,6 +18333,7 @@ BCFA930810333193007B25D1 /* RenderOverflow.h in Headers */, A871DED70A1530C700B12A68 /* RenderPart.h in Headers */, 853CA9F10AEEC657002372DC /* RenderPath.h in Headers */, + A43BF59D1149292800C643CA /* RenderProgress.h in Headers */, A871DFE30A15376B00B12A68 /* RenderReplaced.h in Headers */, BCA846D70DC67A350026C309 /* RenderReplica.h in Headers */, 1479FAEE109AE37500DED655 /* RenderRuby.h in Headers */, @@ -18258,8 +18357,15 @@ A8F5C0B80F9285AC0098E06B /* RenderSVGModelObject.h in Headers */, 083192AA112B43050083C3B9 /* RenderSVGResource.h in Headers */, 84BDA16C11358D2A00DBF64C /* RenderSVGResourceClipper.h in Headers */, + 08082373117987C100241DE8 /* RenderSVGResourceContainer.h in Headers */, 841FDC271178C9BE00F8AC9B /* RenderSVGResourceFilter.h in Headers */, + 08C34AF61179C057002D7456 /* RenderSVGResourceGradient.h in Headers */, + 08C34AF81179C057002D7456 /* RenderSVGResourceLinearGradient.h in Headers */, + 8499A515115FB33000F566E3 /* RenderSVGResourceMarker.h in Headers */, 083192AC112B43050083C3B9 /* RenderSVGResourceMasker.h in Headers */, + 08563BB5117861780012B578 /* RenderSVGResourcePattern.h in Headers */, + 08C34AFE1179C072002D7456 /* RenderSVGResourceRadialGradient.h in Headers */, + 08C6A7AC117DFBAB00FEA1A2 /* RenderSVGResourceSolidColor.h in Headers */, AA31B5B50C1DFD1000AE7083 /* RenderSVGRoot.h in Headers */, 08DAB9BB1103D9A5003E7ABA /* RenderSVGShadowTreeRootContainer.h in Headers */, 853CA9DF0AEEC5E9002372DC /* RenderSVGText.h in Headers */, @@ -18326,6 +18432,7 @@ 934CC1170EDCAC7300A658F2 /* ScriptInstance.h in Headers */, 41F066E40F64BCF600A07EAC /* ScriptObject.h in Headers */, 9F72304F11184B4100AD0126 /* ScriptProfile.h in Headers */, + 9FA37EE41172FC8000C4CD55 /* ScriptProfileNode.h in Headers */, 9F72305111184B4100AD0126 /* ScriptProfiler.h in Headers */, 934CC10A0EDB223900A658F2 /* ScriptSourceCode.h in Headers */, CE54FD381016D9A6008B44C8 /* ScriptSourceProvider.h in Headers */, @@ -18396,9 +18503,12 @@ B51BF6F1102C9E590002C15A /* SQLTransactionClient.h in Headers */, B5C1123C102B6C4600096578 /* SQLTransactionCoordinator.h in Headers */, 1A7CCB1C0CD9469A00B7B64E /* SQLTransactionErrorCallback.h in Headers */, + B523CF081182675400EBB29C /* SQLTransactionSync.h in Headers */, + B523CF061182675400EBB29C /* SQLTransactionSyncCallback.h in Headers */, 1A2E6E5A0CC55213004A2062 /* SQLValue.h in Headers */, 93F1996308245E59001E9ABC /* SSLKeyGenerator.h in Headers */, BC7FA62D0D1F0EFF00DB22A9 /* StaticNodeList.h in Headers */, + A5AFB350115151A700B045CB /* StepRange.h in Headers */, 51BE37E00DAEE00E001085FC /* StorageArea.h in Headers */, C5160EEB1004543A00A7CEE2 /* StorageAreaImpl.h in Headers */, C5102ECF0FD9EF8C00FAFF04 /* StorageAreaSync.h in Headers */, @@ -18428,6 +18538,7 @@ BC2273040E82F1E600E7F975 /* StyleInheritedData.h in Headers */, A80E73510A199C77007FB8C5 /* StyleList.h in Headers */, BC5EB72A0E81DE8100B25965 /* StyleMarqueeData.h in Headers */, + 0FF50272102BA96A0066F39A /* StyleMedia.h in Headers */, BC5EB74E0E81E06700B25965 /* StyleMultiColData.h in Headers */, BC2272E40E82EE9B00E7F975 /* StyleRareInheritedData.h in Headers */, BC2272BD0E82EAAE00E7F975 /* StyleRareNonInheritedData.h in Headers */, @@ -18442,6 +18553,7 @@ 659A7D130B6DB4D9001155B3 /* SubstituteData.h in Headers */, 1A8F6B020DB53006001DB794 /* SubstituteResource.h in Headers */, 93B2D8160F9920D2006AE6B2 /* SuddenTermination.h in Headers */, + 97C078501165D5BE003A32EF /* SuffixTree.h in Headers */, B22279740D00BF220071B782 /* SVGAElement.h in Headers */, 65653F2E0D9727D200CA9723 /* SVGAltGlyphElement.h in Headers */, B22279770D00BF220071B782 /* SVGAngle.h in Headers */, @@ -18456,6 +18568,7 @@ B22279930D00BF220071B782 /* SVGAnimateMotionElement.h in Headers */, B22279950D00BF220071B782 /* SVGAnimateTransformElement.h in Headers */, B22279980D00BF220071B782 /* SVGAnimationElement.h in Headers */, + 0842BC731190144000C7D08F /* SVGCharacterData.h in Headers */, B2B33A600B887CEF00C15984 /* SVGCharacterLayoutInfo.h in Headers */, B222799C0D00BF220071B782 /* SVGCircleElement.h in Headers */, B222799F0D00BF220071B782 /* SVGClipPathElement.h in Headers */, @@ -18551,12 +18664,6 @@ B2227A4E0D00BF220071B782 /* SVGMPathElement.h in Headers */, B2227A510D00BF220071B782 /* SVGNumberList.h in Headers */, B2227A540D00BF220071B782 /* SVGPaint.h in Headers */, - B25599A70D00D8BA00BB825C /* SVGPaintServer.h in Headers */, - B25599A90D00D8BA00BB825C /* SVGPaintServerGradient.h in Headers */, - B25599AB0D00D8BA00BB825C /* SVGPaintServerLinearGradient.h in Headers */, - B25599AD0D00D8BA00BB825C /* SVGPaintServerPattern.h in Headers */, - B25599AF0D00D8BA00BB825C /* SVGPaintServerRadialGradient.h in Headers */, - B25599B10D00D8BA00BB825C /* SVGPaintServerSolid.h in Headers */, B2227A570D00BF220071B782 /* SVGParserUtilities.h in Headers */, B2227A590D00BF220071B782 /* SVGPathElement.h in Headers */, B2227A5B0D00BF220071B782 /* SVGPathSeg.h in Headers */, @@ -18585,8 +18692,6 @@ BC22747B0E8366E200E7F975 /* SVGRenderStyleDefs.h in Headers */, A8F4FB940C169E7B002AFED5 /* SVGRenderSupport.h in Headers */, B2EBDC9D0AF77E3400AE4A68 /* SVGRenderTreeAsText.h in Headers */, - B25599B30D00D8BA00BB825C /* SVGResource.h in Headers */, - B25599B80D00D8BA00BB825C /* SVGResourceListener.h in Headers */, 853CA9E90AEEC608002372DC /* SVGRootInlineBox.h in Headers */, B2227AA30D00BF220071B782 /* SVGScriptElement.h in Headers */, B2227AA60D00BF220071B782 /* SVGSetElement.h in Headers */, @@ -18604,6 +18709,7 @@ B2227ABE0D00BF220071B782 /* SVGSwitchElement.h in Headers */, B2227AC10D00BF220071B782 /* SVGSymbolElement.h in Headers */, B2227AC50D00BF220071B782 /* SVGTests.h in Headers */, + 0842BC811190147200C7D08F /* SVGTextChunkLayoutInfo.h in Headers */, B2227AC80D00BF220071B782 /* SVGTextContentElement.h in Headers */, B2227ACB0D00BF220071B782 /* SVGTextElement.h in Headers */, B2227ACE0D00BF220071B782 /* SVGTextPathElement.h in Headers */, @@ -18672,6 +18778,7 @@ 0F500AAF0F54DB1B00EEF928 /* TransformState.h in Headers */, 49E911D20EF86D47009D0CAF /* TranslateTransformOperation.h in Headers */, 854FE7370A2297BE0058D7AD /* Traversal.h in Headers */, + 37FD4298118368460093C029 /* TreeDepthLimit.h in Headers */, 1419D2C50CEA6F6100FF507A /* TreeShared.h in Headers */, 854FE7390A2297BE0058D7AD /* TreeWalker.h in Headers */, 37C28A6810F659CC008C7813 /* TypesettingFeatures.h in Headers */, @@ -18683,11 +18790,14 @@ D086FE9809D53AAB005BC74D /* UnlinkCommand.h in Headers */, 656581B209D14EE6000E61D7 /* UserAgentStyleSheets.h in Headers */, BCACF3BD1072921A00C0C8A3 /* UserContentURLPattern.h in Headers */, + 2542F4DB1166C25A00E89A86 /* UserGestureIndicator.h in Headers */, BCA2B061105047600043BD1C /* UserScript.h in Headers */, BCA2B08B10505BCD0043BD1C /* UserScriptTypes.h in Headers */, BC8BF151105813BF00A40A07 /* UserStyleSheet.h in Headers */, BC8BF15A1058141800A40A07 /* UserStyleSheetTypes.h in Headers */, + 2E3BBF081162DA1100B9409A /* UUID.h in Headers */, 15C7708D100D3C6B005BA267 /* ValidityState.h in Headers */, + CEF418CF1179678C009D112C /* ViewportArguments.h in Headers */, 93309E1E099E64920056E581 /* visible_units.h in Headers */, 93309E20099E64920056E581 /* VisiblePosition.h in Headers */, A883DF280F3D045D00F19BF6 /* VisibleSelection.h in Headers */, @@ -18746,6 +18856,7 @@ 9380F47409A11AB4001FDB34 /* Widget.h in Headers */, 939B02EF0EA2DBC400C54570 /* WidthIterator.h in Headers */, BC8243E90D0CFD7500460C8F /* WindowFeatures.h in Headers */, + E1E1BF00115FF6FB006F52CA /* WindowsKeyboardCodes.h in Headers */, 08203AA00ED8C35300B8B61A /* WMLAccessElement.h in Headers */, 088C97520ECB6E28000534BA /* WMLAElement.h in Headers */, 080081970ED3B2DD00C53BC0 /* WMLAnchorElement.h in Headers */, @@ -18833,42 +18944,15 @@ 93F199EC08245E59001E9ABC /* XSLStyleSheet.h in Headers */, E1F1E8300C3C2BB9006DB391 /* XSLTExtensions.h in Headers */, 93F199ED08245E59001E9ABC /* XSLTProcessor.h in Headers */, + 82B658981189E39200E052A1 /* InspectorCSSStore.h in Headers */, E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */, 97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */, CE172E011136E8CE0062A533 /* ZoomMode.h in Headers */, - FAA10571114C2DF700940A01 /* RenderMathMLFraction.h in Headers */, - A43BF5991149290A00C643CA /* HTMLProgressElement.h in Headers */, - A43BF59D1149292800C643CA /* RenderProgress.h in Headers */, - F375CC071150D300008DDB81 /* InspectorWorkerResource.h in Headers */, - A5AFB350115151A700B045CB /* StepRange.h in Headers */, - A59E3C1E11580F510072928E /* KeyEventCodesIPhone.h in Headers */, - A513B3D7114B1666001C429B /* KeyEventCocoa.h in Headers */, - 62CD325A1157E57C0063B0A7 /* CustomEvent.h in Headers */, - E4778B80115A581A00B5D372 /* JSCustomEvent.h in Headers */, - E1E1BF00115FF6FB006F52CA /* WindowsKeyboardCodes.h in Headers */, - 8499A515115FB33000F566E3 /* RenderSVGResourceMarker.h in Headers */, - A4226E5C1163D695008B8397 /* JSHTMLProgressElement.h in Headers */, - A4226E951163D73A008B8397 /* DOMHTMLProgressElement.h in Headers */, - A4226E991163D7CC008B8397 /* DOMHTMLProgressElementInternal.h in Headers */, - 2E3BBF081162DA1100B9409A /* UUID.h in Headers */, - 8952535311641B3400CABF00 /* FileThread.h in Headers */, - 97C078501165D5BE003A32EF /* SuffixTree.h in Headers */, - 2542F4DB1166C25A00E89A86 /* UserGestureIndicator.h in Headers */, - BC9439C3116CF4940048C750 /* JSNodeCustom.h in Headers */, - C5D4AA7A116BAFB60069CA93 /* GlyphMetricsMap.h in Headers */, - A409C985116D0DDD007197BD /* AccessibilityProgressIndicator.h in Headers */, - 895253D8116C4C6800CABF00 /* FileStream.h in Headers */, - 973889A1116EA9DC00ADF313 /* DocumentWriter.h in Headers */, - 895253D9116C4C6800CABF00 /* FileStreamClient.h in Headers */, - 5DC87EF011716DF2001C0E6D /* EmptyProtocolDefinitions.h in Headers */, - 9FA37EE41172FC8000C4CD55 /* ScriptProfileNode.h in Headers */, - 9FA37EFB1172FDA600C4CD55 /* JSScriptProfile.h in Headers */, - 9FA37EFD1172FDA600C4CD55 /* JSScriptProfileNode.h in Headers */, - 895253DD116C4EF500CABF00 /* FileStreamProxy.h in Headers */, - 895253DF116C4F0600CABF00 /* FileThreadTask.h in Headers */, - CEF418CF1179678C009D112C /* ViewportArguments.h in Headers */, - 0FD3080F117CF7E700A791F7 /* RenderFrameBase.h in Headers */, - 0FD308D6117D168500A791F7 /* RenderIFrame.h in Headers */, + B59DD699119029E5007E9684 /* JSDatabaseCallback.h in Headers */, + B59DD69D11902A42007E9684 /* JSSQLTransactionCallback.h in Headers */, + B59DD6A111902A52007E9684 /* JSSQLTransactionErrorCallback.h in Headers */, + B59DD6A511902A62007E9684 /* JSSQLStatementCallback.h in Headers */, + B59DD6A911902A71007E9684 /* JSSQLStatementErrorCallback.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -19135,6 +19219,7 @@ 29A8123C0FBB9C1D00510293 /* AccessibilityObject.cpp in Sources */, 29A812480FBB9CA900510293 /* AccessibilityObjectMac.mm in Sources */, 29A8124A0FBB9CA900510293 /* AccessibilityObjectWrapper.mm in Sources */, + A409C984116D0DDD007197BD /* AccessibilityProgressIndicator.cpp in Sources */, 29A812260FBB9C1D00510293 /* AccessibilityRenderObject.cpp in Sources */, 93C4F6EA1108F9A50099D0DB /* AccessibilityScrollbar.cpp in Sources */, 0709FC4C1025DED80059CDBA /* AccessibilitySlider.cpp in Sources */, @@ -19300,8 +19385,10 @@ BCCBE69B0E06F51000EAFA8E /* CSSVariablesDeclaration.cpp in Sources */, BCCBE68B0E06E60D00EAFA8E /* CSSVariablesRule.cpp in Sources */, 93F19A2608245E59001E9ABC /* CursorMac.mm in Sources */, + 62CD32591157E57C0063B0A7 /* CustomEvent.cpp in Sources */, 5196116A0CAC56570010A80C /* Database.cpp in Sources */, 51A45B570CAD7FD7000D2BE9 /* DatabaseAuthorizer.cpp in Sources */, + B523CF0A1182675400EBB29C /* DatabaseSync.cpp in Sources */, 519611EB0CAC749C0010A80C /* DatabaseTask.cpp in Sources */, 5196116D0CAC56570010A80C /* DatabaseThread.cpp in Sources */, 1AD51A150CB59CD300953D11 /* DatabaseTracker.cpp in Sources */, @@ -19324,6 +19411,7 @@ 1C26497A0D7E248A00BD10F2 /* DocumentLoaderMac.cpp in Sources */, 0B9056190F2578BE0095FF6A /* DocumentThreadableLoader.cpp in Sources */, A8185F3A09765766005826D9 /* DocumentType.cpp in Sources */, + 973889A0116EA9DC00ADF313 /* DocumentWriter.cpp in Sources */, BC1A37AE097C715F0019F3D8 /* DOM.mm in Sources */, BCD0FBD00DBD625E00B2F630 /* DOMAbstractView.mm in Sources */, 1A8F6BC20DB55CDC001DB794 /* DOMApplicationCache.cpp in Sources */, @@ -19363,6 +19451,7 @@ 85AFA8230AAF528A00E84305 /* DOMEvent.mm in Sources */, BC1A37B3097C715F0019F3D8 /* DOMEvents.mm in Sources */, BC00F0050E0A185500FD04E3 /* DOMFile.mm in Sources */, + 2E3BC109117D479800B9409A /* DOMFileError.mm in Sources */, BC00F0080E0A185500FD04E3 /* DOMFileList.mm in Sources */, 2ED609BC1145B07100C8684E /* DOMFormData.cpp in Sources */, BC1A37B7097C715F0019F3D8 /* DOMHTML.mm in Sources */, @@ -19413,6 +19502,7 @@ 85183B470AA6926100F19FA3 /* DOMHTMLParagraphElement.mm in Sources */, 85ECBEF80AA7626900544F0B /* DOMHTMLParamElement.mm in Sources */, 85183B490AA6926100F19FA3 /* DOMHTMLPreElement.mm in Sources */, + A4226E961163D73A008B8397 /* DOMHTMLProgressElement.mm in Sources */, 85183B4B0AA6926100F19FA3 /* DOMHTMLQuoteElement.mm in Sources */, 85DF819C0AA77E4B00486AD7 /* DOMHTMLScriptElement.mm in Sources */, 85F32AF10AA63B8700FF3184 /* DOMHTMLSelectElement.mm in Sources */, @@ -19430,7 +19520,6 @@ 93C841FF09CE858300DFF5E5 /* DOMImplementationFront.cpp in Sources */, BC1A37BA097C715F0019F3D8 /* DOMInternal.mm in Sources */, 85FF315B0AAFBFCB00374F38 /* DOMKeyboardEvent.mm in Sources */, - 0FF5025C102BA9010066F39A /* DOMMedia.mm in Sources */, 850656FF0AAB4763002D15C0 /* DOMMediaList.mm in Sources */, 75793ED40D0CE85B007FC0AC /* DOMMessageEvent.mm in Sources */, E1ACAF4C0E791AAF0087D12B /* DOMMessagePort.mm in Sources */, @@ -19452,6 +19541,7 @@ 858C38A80AA8F20400B187A4 /* DOMRect.mm in Sources */, BCAEFCAE1016CE4A0040D34E /* DOMRGBColor.mm in Sources */, BC5A86840C33676000EEA649 /* DOMSelection.cpp in Sources */, + 0FF5025C102BA9010066F39A /* DOMStyleMedia.mm in Sources */, 850657010AAB4763002D15C0 /* DOMStyleSheet.mm in Sources */, 850657030AAB4763002D15C0 /* DOMStyleSheetList.mm in Sources */, 85ACEF7D0ACDCFCE001214FF /* DOMSVGAElement.mm in Sources */, @@ -19641,9 +19731,12 @@ 934FE9E50B5CA539003E4A73 /* FileChooser.cpp in Sources */, 066C772D0AB603D200238CC4 /* FileChooserMac.mm in Sources */, BCDBB8AD0E088CA500C60FF6 /* FileList.cpp in Sources */, + 895253D7116C4C6800CABF00 /* FileStream.cpp in Sources */, + 895253DC116C4EF500CABF00 /* FileStreamProxy.cpp in Sources */, 5160306C0CC4362300C8AC25 /* FileSystemCF.cpp in Sources */, 514B3F760C722055000530DF /* FileSystemMac.mm in Sources */, 5160300B0CC4251200C8AC25 /* FileSystemPOSIX.cpp in Sources */, + 8952535211641B3400CABF00 /* FileThread.cpp in Sources */, BC5EB69E0E81DAEB00B25965 /* FillLayer.cpp in Sources */, 08C925190FCC7C4A00480DEC /* FilterEffect.cpp in Sources */, A8CFF04D0A154F09000A4234 /* FixedTableLayout.cpp in Sources */, @@ -19784,6 +19877,7 @@ A871D4570A127CBC00B12A68 /* HTMLPlugInElement.cpp in Sources */, 4415292F0E1AE8A000C4A2D0 /* HTMLPlugInImageElement.cpp in Sources */, A8EA7CAD0A192B9C00A8EF5F /* HTMLPreElement.cpp in Sources */, + A43BF5981149290A00C643CA /* HTMLProgressElement.cpp in Sources */, A8CFF7A50A156978000A4234 /* HTMLQuoteElement.cpp in Sources */, A871DC220A15205700B12A68 /* HTMLScriptElement.cpp in Sources */, A81369D9097374F600D74463 /* HTMLSelectElement.cpp in Sources */, @@ -19864,7 +19958,6 @@ 59EE122C1106080500885116 /* JNIUtilityPrivate.cpp in Sources */, 93309DF3099E64920056E581 /* JoinTextNodesCommand.cpp in Sources */, 418F88040FF957AE0080F045 /* JSAbstractWorker.cpp in Sources */, - 415B7C570FF598E6006770F7 /* JSAbstractWorkerCustom.cpp in Sources */, 65DF31DA09D1C123000BE325 /* JSAttr.cpp in Sources */, BC2ED6BC0C6BD2F000920BFF /* JSAttrCustom.cpp in Sources */, E4EEFFC80D34550C00469A58 /* JSAudioConstructor.cpp in Sources */, @@ -19911,16 +20004,13 @@ A8D05FAB0A23B30F005E7203 /* JSCSSValueList.cpp in Sources */, BC686C7C0E0C330100DE8A08 /* JSCSSVariablesDeclaration.cpp in Sources */, BC686C7E0E0C330100DE8A08 /* JSCSSVariablesRule.cpp in Sources */, + E4778B7F115A581A00B5D372 /* JSCustomEvent.cpp in Sources */, FE80D7A70E9C1ED2000D6F75 /* JSCustomPositionCallback.cpp in Sources */, FE80D7A90E9C1ED2000D6F75 /* JSCustomPositionErrorCallback.cpp in Sources */, - 51EC92630CE90DD400F90308 /* JSCustomSQLStatementCallback.cpp in Sources */, 51EC92650CE90DD400F90308 /* JSCustomSQLStatementErrorCallback.cpp in Sources */, - 51EC92670CE90DD400F90308 /* JSCustomSQLTransactionCallback.cpp in Sources */, - 51EC92690CE90DD400F90308 /* JSCustomSQLTransactionErrorCallback.cpp in Sources */, 1A3417CA0CECFF250049CBDE /* JSCustomVoidCallback.cpp in Sources */, E10B93C30B73C291003ED890 /* JSCustomXPathNSResolver.cpp in Sources */, 1AE82F8F0CAAFA9D002237AE /* JSDatabase.cpp in Sources */, - B5D3601F112F8BA80048DEA8 /* JSDatabaseCallback.cpp in Sources */, BCCE58AC1061E8CF008FB35A /* JSDatabaseCustom.cpp in Sources */, BC77D1690FF19F560070887B /* JSDataGridColumn.cpp in Sources */, BC77D16B0FF19F560070887B /* JSDataGridColumnList.cpp in Sources */, @@ -19933,7 +20023,6 @@ 659DDC8209E198BA001BF3C6 /* JSDocument.cpp in Sources */, 49C7BA8D1042F5B10009D447 /* JSDocumentCustom.cpp in Sources */, 1A494EDE0A123F4C00FDAFC1 /* JSDocumentFragment.cpp in Sources */, - BCCE58AF1061E90C008FB35A /* JSDocumentFragmentCustom.cpp in Sources */, 65DF31F509D1CC60000BE325 /* JSDocumentType.cpp in Sources */, 1AC2260C0DB69F190089B669 /* JSDOMApplicationCache.cpp in Sources */, 1AC226170DB69F740089B669 /* JSDOMApplicationCacheCustom.cpp in Sources */, @@ -19961,10 +20050,10 @@ 93B70D6909EB0C7C009D8468 /* JSEventListener.cpp in Sources */, E0FEF372B47C53EAC1C1FBEE /* JSEventSource.cpp in Sources */, E0FEF372B77C53EAC1C1FBEE /* JSEventSourceConstructor.cpp in Sources */, - E0FEF372B57C53EAC1C1FBEE /* JSEventSourceCustom.cpp in Sources */, BC6090200E91B8EC000C68B5 /* JSEventTarget.cpp in Sources */, 3314ACEB10892086000F0E56 /* JSExceptionBase.cpp in Sources */, BC00F0140E0A189500FD04E3 /* JSFile.cpp in Sources */, + 2E3BC0CA117D3E0800B9409A /* JSFileError.cpp in Sources */, BC00F0160E0A189500FD04E3 /* JSFileList.cpp in Sources */, FE80DA630E9C4703000D6F75 /* JSGeolocation.cpp in Sources */, FE80D7AB0E9C1ED2000D6F75 /* JSGeolocationCustom.cpp in Sources */, @@ -20042,6 +20131,7 @@ 1AE2ABA60A1CE90500B42B25 /* JSHTMLParagraphElement.cpp in Sources */, 1AE2ABA80A1CE90500B42B25 /* JSHTMLParamElement.cpp in Sources */, 1AE2ABAA0A1CE90500B42B25 /* JSHTMLPreElement.cpp in Sources */, + A4226E5A1163D667008B8397 /* JSHTMLProgressElement.cpp in Sources */, 1AE2AEC70A1D297B00B42B25 /* JSHTMLQuoteElement.cpp in Sources */, 1AE2ABAC0A1CE90500B42B25 /* JSHTMLScriptElement.cpp in Sources */, E1E6EEA40B628DA8005F2F70 /* JSHTMLSelectElement.cpp in Sources */, @@ -20072,7 +20162,6 @@ 935F45420F7C3B5F00D7C1FB /* JSLazyEventListener.cpp in Sources */, BCE1C43B0D9830D3003B02F2 /* JSLocation.cpp in Sources */, BCE1C4400D9830F4003B02F2 /* JSLocationCustom.cpp in Sources */, - 0FF50269102BA9430066F39A /* JSMedia.cpp in Sources */, E44614180CD6826900FADA75 /* JSMediaError.cpp in Sources */, BC3C39B60C0D3D8D005F4D7A /* JSMediaList.cpp in Sources */, E107400D0E77BDC00033AF24 /* JSMessageChannel.cpp in Sources */, @@ -20121,6 +20210,9 @@ BCFE2F110C1B58370020235F /* JSRect.cpp in Sources */, BC74DA481013F468007987AD /* JSRGBColor.cpp in Sources */, BCEC01C20C274DDD009F4EC9 /* JSScreen.cpp in Sources */, + 9FA37EFA1172FDA600C4CD55 /* JSScriptProfile.cpp in Sources */, + 9FA37EFC1172FDA600C4CD55 /* JSScriptProfileNode.cpp in Sources */, + 9FA37EE71172FCF000C4CD55 /* JSScriptProfileNodeCustom.cpp in Sources */, 41D07A7E0FF935CA0095EDCE /* JSSharedWorker.cpp in Sources */, 415B7C580FF598E6006770F7 /* JSSharedWorkerConstructor.cpp in Sources */, 41D1690510238B66009BC827 /* JSSharedWorkerContext.cpp in Sources */, @@ -20134,6 +20226,7 @@ 51E3F9D60DA05E1D00250911 /* JSStorage.cpp in Sources */, 51D0C5160DAA90B7003B3831 /* JSStorageCustom.cpp in Sources */, 51E0BAEA0DA55D4A00A9E417 /* JSStorageEvent.cpp in Sources */, + 0FF50269102BA9430066F39A /* JSStyleMedia.cpp in Sources */, BCE0139A0C0BEF180043860A /* JSStyleSheet.cpp in Sources */, BC98A27D0C0C9950004BEBF7 /* JSStyleSheetCustom.cpp in Sources */, A84EBD840CB8C97700079609 /* JSStyleSheetList.cpp in Sources */, @@ -20360,6 +20453,8 @@ BCE99EC30DCA624100182683 /* JSXSLTProcessorConstructor.cpp in Sources */, BCEFE1E50DCA5F3300739219 /* JSXSLTProcessorCustom.cpp in Sources */, 85031B430A44EFC700F992E0 /* KeyboardEvent.cpp in Sources */, + A513B3D8114B166A001C429B /* KeyEventCocoa.mm in Sources */, + A59E3C1F11580F510072928E /* KeyEventIPhone.mm in Sources */, 935C477009AC4D7300A6AAB4 /* KeyEventMac.mm in Sources */, 316FE1190E6E1DA700BF6088 /* KeyframeAnimation.cpp in Sources */, BC5EBA100E823E4700B25965 /* KeyframeList.cpp in Sources */, @@ -20393,7 +20488,6 @@ FA654A6B1108ABED002615E0 /* MathMLTextElement.cpp in Sources */, 49D5DC2B0F423A73008F20FD /* Matrix3DTransformOperation.cpp in Sources */, 49E911C60EF86D47009D0CAF /* MatrixTransformOperation.cpp in Sources */, - 0FF50271102BA96A0066F39A /* Media.cpp in Sources */, ABFE7E120D32FAF60066F4D2 /* MediaControlElements.cpp in Sources */, AB40484D0E083FA8007D6920 /* MediaDocument.cpp in Sources */, 4E1959210A39DABA00220FE5 /* MediaFeatureNames.cpp in Sources */, @@ -20520,8 +20614,10 @@ BCEA486D097D93020094C9E4 /* RenderFlexibleBox.cpp in Sources */, 853CA9EC0AEEC63C002372DC /* RenderForeignObject.cpp in Sources */, A871DED40A1530C700B12A68 /* RenderFrame.cpp in Sources */, + 0FD3080E117CF7E700A791F7 /* RenderFrameBase.cpp in Sources */, A871DED20A1530C700B12A68 /* RenderFrameSet.cpp in Sources */, BCEA4869097D93020094C9E4 /* RenderHTMLCanvas.cpp in Sources */, + 0FD308D5117D168500A791F7 /* RenderIFrame.cpp in Sources */, BCEA4875097D93020094C9E4 /* RenderImage.cpp in Sources */, BCB4F8930DB28E530039139B /* RenderImageGeneratedContent.cpp in Sources */, BCEA4877097D93020094C9E4 /* RenderInline.cpp in Sources */, @@ -20534,9 +20630,12 @@ A8EA7A510A191A5200A8EF5F /* RenderListMarker.cpp in Sources */, 0F5602900E4B76580065B038 /* RenderMarquee.cpp in Sources */, FA654A6F1108ABFF002615E0 /* RenderMathMLBlock.cpp in Sources */, + FAA10570114C2DF700940A01 /* RenderMathMLFraction.cpp in Sources */, FA0B1F8611125CEE007F9839 /* RenderMathMLMath.cpp in Sources */, FA5FAE4211126A5D00D3750F /* RenderMathMLOperator.cpp in Sources */, + 0FF2859011864052007B7CD6 /* RenderMathMLRoot.cpp in Sources */, FA0B1F8811125CEE007F9839 /* RenderMathMLRow.cpp in Sources */, + 0FF2859211864054007B7CD6 /* RenderMathMLSquareRoot.cpp in Sources */, FAC12CC41120DA6900DACC36 /* RenderMathMLSubSup.cpp in Sources */, FA7EFB051120D25400CF79C7 /* RenderMathMLUnderOver.cpp in Sources */, E4C279580CF9741900E97B98 /* RenderMedia.cpp in Sources */, @@ -20545,6 +20644,7 @@ BC60EFB70F33A0E700812A93 /* RenderObjectChildList.cpp in Sources */, A871DED00A1530C700B12A68 /* RenderPart.cpp in Sources */, 853CA9F00AEEC657002372DC /* RenderPath.cpp in Sources */, + A43BF59C1149292800C643CA /* RenderProgress.cpp in Sources */, A871DFE20A15376B00B12A68 /* RenderReplaced.cpp in Sources */, BCA846D60DC67A350026C309 /* RenderReplica.cpp in Sources */, 1479FAED109AE37500DED655 /* RenderRuby.cpp in Sources */, @@ -20564,9 +20664,16 @@ 853CA9DA0AEEC5E9002372DC /* RenderSVGInline.cpp in Sources */, 853CA9DC0AEEC5E9002372DC /* RenderSVGInlineText.cpp in Sources */, A8F5C0B90F9285AC0098E06B /* RenderSVGModelObject.cpp in Sources */, + 08563BD0117865F50012B578 /* RenderSVGResource.cpp in Sources */, 84BDA16B11358D2A00DBF64C /* RenderSVGResourceClipper.cpp in Sources */, 841FDC261178C9BE00F8AC9B /* RenderSVGResourceFilter.cpp in Sources */, + 08C34AF51179C057002D7456 /* RenderSVGResourceGradient.cpp in Sources */, + 08C34AF71179C057002D7456 /* RenderSVGResourceLinearGradient.cpp in Sources */, + 8499A514115FB33000F566E3 /* RenderSVGResourceMarker.cpp in Sources */, 083192AB112B43050083C3B9 /* RenderSVGResourceMasker.cpp in Sources */, + 08563BB4117861780012B578 /* RenderSVGResourcePattern.cpp in Sources */, + 08C34AFD1179C072002D7456 /* RenderSVGResourceRadialGradient.cpp in Sources */, + 08C6A7AB117DFBAB00FEA1A2 /* RenderSVGResourceSolidColor.cpp in Sources */, AA31B5B40C1DFD1000AE7083 /* RenderSVGRoot.cpp in Sources */, 08DAB9BA1103D9A5003E7ABA /* RenderSVGShadowTreeRootContainer.cpp in Sources */, 853CA9DE0AEEC5E9002372DC /* RenderSVGText.cpp in Sources */, @@ -20664,6 +20771,8 @@ 41D168E710226E89009BC827 /* SharedWorkerContext.cpp in Sources */, 41D168ED10226E89009BC827 /* SharedWorkerThread.cpp in Sources */, B2C3DA640D006CD600EF6F26 /* SimpleFontData.cpp in Sources */, + 163E8B13118B3ADD00ED9231 /* SimpleFontDataATSUI.mm in Sources */, + 163E88F7118A39D200ED9231 /* SimpleFontDataCoreText.cpp in Sources */, B2AFFC7F0D00A5C10030074D /* SimpleFontDataMac.mm in Sources */, 49E911CC0EF86D47009D0CAF /* SkewTransformOperation.cpp in Sources */, 4B6FA6F50C39E48C00087011 /* SmartReplace.cpp in Sources */, @@ -20692,9 +20801,11 @@ 1ABFE7530CD968D000FE4834 /* SQLTransaction.cpp in Sources */, B51BF6F0102C9E590002C15A /* SQLTransactionClient.cpp in Sources */, B5C1123B102B6C4600096578 /* SQLTransactionCoordinator.cpp in Sources */, + B523CF091182675400EBB29C /* SQLTransactionSync.cpp in Sources */, 1A2E6E590CC55213004A2062 /* SQLValue.cpp in Sources */, 93F19AE608245E59001E9ABC /* SSLKeyGeneratorMac.mm in Sources */, BC7FA62E0D1F0EFF00DB22A9 /* StaticNodeList.cpp in Sources */, + A5AFB34F115151A700B045CB /* StepRange.cpp in Sources */, 51E3F9C70DA059DC00250911 /* Storage.cpp in Sources */, C5160EEA1004543A00A7CEE2 /* StorageAreaImpl.cpp in Sources */, C5102ED00FD9EF8C00FAFF04 /* StorageAreaSync.cpp in Sources */, @@ -20722,6 +20833,7 @@ BC2273030E82F1E600E7F975 /* StyleInheritedData.cpp in Sources */, A80E734D0A199C77007FB8C5 /* StyleList.cpp in Sources */, BC5EB7290E81DE8100B25965 /* StyleMarqueeData.cpp in Sources */, + 0FF50271102BA96A0066F39A /* StyleMedia.cpp in Sources */, BC5EB74D0E81E06700B25965 /* StyleMultiColData.cpp in Sources */, BC2272E30E82EE9B00E7F975 /* StyleRareInheritedData.cpp in Sources */, BC2272BC0E82EAAE00E7F975 /* StyleRareNonInheritedData.cpp in Sources */, @@ -20742,6 +20854,7 @@ B22279920D00BF220071B782 /* SVGAnimateMotionElement.cpp in Sources */, B22279940D00BF220071B782 /* SVGAnimateTransformElement.cpp in Sources */, B22279970D00BF220071B782 /* SVGAnimationElement.cpp in Sources */, + 0842BC721190144000C7D08F /* SVGCharacterData.cpp in Sources */, B2B33A5F0B887CEF00C15984 /* SVGCharacterLayoutInfo.cpp in Sources */, B222799B0D00BF220071B782 /* SVGCircleElement.cpp in Sources */, B222799E0D00BF220071B782 /* SVGClipPathElement.cpp in Sources */, @@ -20835,12 +20948,6 @@ A833C7CA0A2CF06B00D57664 /* SVGNames.cpp in Sources */, B2227A500D00BF220071B782 /* SVGNumberList.cpp in Sources */, B2227A530D00BF220071B782 /* SVGPaint.cpp in Sources */, - B25599A60D00D8BA00BB825C /* SVGPaintServer.cpp in Sources */, - B25599A80D00D8BA00BB825C /* SVGPaintServerGradient.cpp in Sources */, - B25599AA0D00D8BA00BB825C /* SVGPaintServerLinearGradient.cpp in Sources */, - B25599AC0D00D8BA00BB825C /* SVGPaintServerPattern.cpp in Sources */, - B25599AE0D00D8BA00BB825C /* SVGPaintServerRadialGradient.cpp in Sources */, - B25599B00D00D8BA00BB825C /* SVGPaintServerSolid.cpp in Sources */, B2227A560D00BF220071B782 /* SVGParserUtilities.cpp in Sources */, B2227A580D00BF220071B782 /* SVGPathElement.cpp in Sources */, B2227A5D0D00BF220071B782 /* SVGPathSegArc.cpp in Sources */, @@ -20866,7 +20973,6 @@ BC22747A0E8366E200E7F975 /* SVGRenderStyleDefs.cpp in Sources */, A8F4FB960C169E85002AFED5 /* SVGRenderSupport.cpp in Sources */, B2EBDC9C0AF77E3400AE4A68 /* SVGRenderTreeAsText.cpp in Sources */, - B25599B20D00D8BA00BB825C /* SVGResource.cpp in Sources */, 853CA9E80AEEC608002372DC /* SVGRootInlineBox.cpp in Sources */, B2227AA20D00BF220071B782 /* SVGScriptElement.cpp in Sources */, B2227AA50D00BF220071B782 /* SVGSetElement.cpp in Sources */, @@ -20946,7 +21052,10 @@ D086FE9909D53AAB005BC74D /* UnlinkCommand.cpp in Sources */, 65DF326109D1E199000BE325 /* UserAgentStyleSheetsData.cpp in Sources */, BCACF3BC1072921A00C0C8A3 /* UserContentURLPattern.cpp in Sources */, + 2542F4DA1166C25A00E89A86 /* UserGestureIndicator.cpp in Sources */, + 2E3BBF071162DA1100B9409A /* UUID.cpp in Sources */, 15C7708E100D3C6B005BA267 /* ValidityState.cpp in Sources */, + CEF418CE1179678C009D112C /* ViewportArguments.cpp in Sources */, 93309E1D099E64920056E581 /* visible_units.cpp in Sources */, 93309E1F099E64920056E581 /* VisiblePosition.cpp in Sources */, A883DF270F3D045D00F19BF6 /* VisibleSelection.cpp in Sources */, @@ -21049,8 +21158,8 @@ 93309E23099E64920056E581 /* WrapContentsInDummySpanCommand.cpp in Sources */, A833C7CC0A2CF07400D57664 /* XLinkNames.cpp in Sources */, BC772C460C4EB2C60083285F /* XMLHttpRequest.cpp in Sources */, - BCDFD48F0E305290009D10AD /* XMLHttpRequestUpload.cpp in Sources */, A136A00C1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp in Sources */, + BCDFD48F0E305290009D10AD /* XMLHttpRequestUpload.cpp in Sources */, A833C80C0A2CF25600D57664 /* XMLNames.cpp in Sources */, E15A36D91104572700B7B639 /* XMLNSNames.cpp in Sources */, 1ACE53EA0A8D18E70022947D /* XMLSerializer.cpp in Sources */, @@ -21076,35 +21185,16 @@ 85217E020A5ECD4700DB8D00 /* XSLImportRule.cpp in Sources */, 93F19B0308245E59001E9ABC /* XSLStyleSheetLibxslt.cpp in Sources */, E1F1E82F0C3C2BB9006DB391 /* XSLTExtensions.cpp in Sources */, + 82B6589A1189E47600E052A1 /* InspectorCSSStore.cpp in Sources */, 93F19B0408245E59001E9ABC /* XSLTProcessor.cpp in Sources */, 93F19B0508245E59001E9ABC /* XSLTProcessorLibxslt.cpp in Sources */, E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */, 97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */, - FAA10570114C2DF700940A01 /* RenderMathMLFraction.cpp in Sources */, - A43BF5981149290A00C643CA /* HTMLProgressElement.cpp in Sources */, - A43BF59C1149292800C643CA /* RenderProgress.cpp in Sources */, - A5AFB34F115151A700B045CB /* StepRange.cpp in Sources */, - A59E3C1F11580F510072928E /* KeyEventIPhone.mm in Sources */, - A513B3D8114B166A001C429B /* KeyEventCocoa.mm in Sources */, - 62CD32591157E57C0063B0A7 /* CustomEvent.cpp in Sources */, - E4778B7F115A581A00B5D372 /* JSCustomEvent.cpp in Sources */, - 8499A514115FB33000F566E3 /* RenderSVGResourceMarker.cpp in Sources */, - A4226E5A1163D667008B8397 /* JSHTMLProgressElement.cpp in Sources */, - A4226E961163D73A008B8397 /* DOMHTMLProgressElement.mm in Sources */, - 2E3BBF071162DA1100B9409A /* UUID.cpp in Sources */, - 8952535211641B3400CABF00 /* FileThread.cpp in Sources */, - 2542F4DA1166C25A00E89A86 /* UserGestureIndicator.cpp in Sources */, - C5D4AA79116BAFB60069CA93 /* GlyphMetricsMap.cpp in Sources */, - A409C984116D0DDD007197BD /* AccessibilityProgressIndicator.cpp in Sources */, - 895253D7116C4C6800CABF00 /* FileStream.cpp in Sources */, - 9FA37EE71172FCF000C4CD55 /* JSScriptProfileNodeCustom.cpp in Sources */, - 9FA37EFA1172FDA600C4CD55 /* JSScriptProfile.cpp in Sources */, - 9FA37EFC1172FDA600C4CD55 /* JSScriptProfileNode.cpp in Sources */, - 895253DC116C4EF500CABF00 /* FileStreamProxy.cpp in Sources */, - CEF418CE1179678C009D112C /* ViewportArguments.cpp in Sources */, - 0FD3080E117CF7E700A791F7 /* RenderFrameBase.cpp in Sources */, - 0FD308D5117D168500A791F7 /* RenderIFrame.cpp in Sources */, - 973889A0116EA9DC00ADF313 /* DocumentWriter.cpp in Sources */, + B59DD69A119029E5007E9684 /* JSDatabaseCallback.cpp in Sources */, + B59DD69E11902A42007E9684 /* JSSQLTransactionCallback.cpp in Sources */, + B59DD6A211902A52007E9684 /* JSSQLTransactionErrorCallback.cpp in Sources */, + B59DD6A611902A62007E9684 /* JSSQLStatementCallback.cpp in Sources */, + B59DD6AA11902A71007E9684 /* JSSQLStatementErrorCallback.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/WebCore/accessibility/AccessibilityRenderObject.cpp b/WebCore/accessibility/AccessibilityRenderObject.cpp index 3463546..071bf5d 100644 --- a/WebCore/accessibility/AccessibilityRenderObject.cpp +++ b/WebCore/accessibility/AccessibilityRenderObject.cpp @@ -118,12 +118,72 @@ void AccessibilityRenderObject::detach() m_renderer = 0; } +static inline bool isInlineWithContinuation(RenderObject* renderer) +{ + if (!renderer->isRenderInline()) + return false; + + return toRenderInline(renderer)->continuation(); +} + +static inline RenderObject* firstChildInContinuation(RenderObject* renderer) +{ + RenderObject* r = toRenderInline(renderer)->continuation(); + + while (r) { + if (r->isRenderBlock()) + return r; + if (RenderObject* child = r->firstChild()) + return child; + r = toRenderInline(r)->continuation(); + } + + return 0; +} + +static inline RenderObject* firstChildConsideringContinuation(RenderObject* renderer) +{ + RenderObject* firstChild = renderer->firstChild(); + + if (!firstChild && isInlineWithContinuation(renderer)) + firstChild = firstChildInContinuation(renderer); + + return firstChild; +} + + +static inline RenderObject* lastChildConsideringContinuation(RenderObject* renderer) +{ + RenderObject* lastChild = renderer->lastChild(); + RenderObject* prev = renderer; + RenderObject* cur = renderer; + + if (!cur->isRenderInline() && !cur->isRenderBlock()) + return renderer; + + while (cur) { + prev = cur; + + if (RenderObject* lc = cur->lastChild()) + lastChild = lc; + + if (cur->isRenderInline()) { + cur = toRenderInline(cur)->inlineContinuation(); + ASSERT(cur || !toRenderInline(prev)->continuation()); + } else + cur = toRenderBlock(cur)->inlineContinuation(); + } + + return lastChild; +} + AccessibilityObject* AccessibilityRenderObject::firstChild() const { if (!m_renderer) return 0; - RenderObject* firstChild = m_renderer->firstChild(); + RenderObject* firstChild = firstChildConsideringContinuation(m_renderer); + if (!firstChild) return 0; @@ -134,32 +194,161 @@ AccessibilityObject* AccessibilityRenderObject::lastChild() const { if (!m_renderer) return 0; - - RenderObject* lastChild = m_renderer->lastChild(); + + RenderObject* lastChild = lastChildConsideringContinuation(m_renderer); + if (!lastChild) return 0; return m_renderer->document()->axObjectCache()->getOrCreate(lastChild); } +static inline RenderInline* startOfContinuations(RenderObject* r) +{ + if (r->isInlineContinuation()) + return toRenderInline(r->node()->renderer()); + + // Blocks with a previous continuation always have a next continuation + if (r->isRenderBlock() && toRenderBlock(r)->inlineContinuation()) + return toRenderInline(toRenderBlock(r)->inlineContinuation()->node()->renderer()); + + return 0; +} + +static inline RenderObject* endOfContinuations(RenderObject* renderer) +{ + RenderObject* prev = renderer; + RenderObject* cur = renderer; + + if (!cur->isRenderInline() && !cur->isRenderBlock()) + return renderer; + + while (cur) { + prev = cur; + if (cur->isRenderInline()) { + cur = toRenderInline(cur)->inlineContinuation(); + ASSERT(cur || !toRenderInline(prev)->continuation()); + } else + cur = toRenderBlock(cur)->inlineContinuation(); + } + + return prev; +} + + +static inline RenderObject* childBeforeConsideringContinuations(RenderInline* r, RenderObject* child) +{ + RenderBoxModelObject* curContainer = r; + RenderObject* cur = 0; + RenderObject* prev = 0; + + while (curContainer) { + if (curContainer->isRenderInline()) { + cur = curContainer->firstChild(); + while (cur) { + if (cur == child) + return prev; + prev = cur; + cur = cur->nextSibling(); + } + + curContainer = toRenderInline(curContainer)->continuation(); + } else if (curContainer->isRenderBlock()) { + if (curContainer == child) + return prev; + + prev = curContainer; + curContainer = toRenderBlock(curContainer)->inlineContinuation(); + } + } + + ASSERT_NOT_REACHED(); + + return 0; +} + +static inline bool firstChildIsInlineContinuation(RenderObject* renderer) +{ + return renderer->firstChild() && renderer->firstChild()->isInlineContinuation(); +} + AccessibilityObject* AccessibilityRenderObject::previousSibling() const { if (!m_renderer) return 0; - - RenderObject* previousSibling = m_renderer->previousSibling(); + + RenderObject* previousSibling = 0; + + // Case 1: The node is a block and is an inline's continuation. In that case, the inline's + // last child is our previous sibling (or further back in the continuation chain) + RenderInline* startOfConts; + if (m_renderer->isRenderBlock() && (startOfConts = startOfContinuations(m_renderer))) + previousSibling = childBeforeConsideringContinuations(startOfConts, m_renderer); + + // Case 2: Anonymous block parent of the end of a continuation - skip all the way to before + // the parent of the start, since everything in between will be linked up via the continuation. + else if (m_renderer->isAnonymousBlock() && firstChildIsInlineContinuation(m_renderer)) + previousSibling = startOfContinuations(m_renderer->firstChild())->parent()->previousSibling(); + + // Case 3: The node has an actual previous sibling + else if (RenderObject* ps = m_renderer->previousSibling()) + previousSibling = ps; + + // Case 4: This node has no previous siblings, but its parent is an inline, + // and is another node's inline continutation. Follow the continuation chain. + else if (m_renderer->parent()->isRenderInline() && (startOfConts = startOfContinuations(m_renderer->parent()))) + previousSibling = childBeforeConsideringContinuations(startOfConts, m_renderer->parent()->firstChild()); + if (!previousSibling) return 0; return m_renderer->document()->axObjectCache()->getOrCreate(previousSibling); } +static inline bool lastChildHasContinuation(RenderObject* renderer) +{ + return renderer->lastChild() && isInlineWithContinuation(renderer->lastChild()); +} + AccessibilityObject* AccessibilityRenderObject::nextSibling() const { if (!m_renderer) return 0; - - RenderObject* nextSibling = m_renderer->nextSibling(); + + RenderObject* nextSibling = 0; + + // Case 1: node is a block and has an inline continuation. Next sibling is the inline continuation's + // first child. + RenderInline* inlineContinuation; + if (m_renderer->isRenderBlock() && (inlineContinuation = toRenderBlock(m_renderer)->inlineContinuation())) + nextSibling = firstChildConsideringContinuation(inlineContinuation); + + // Case 2: Anonymous block parent of the start of a continuation - skip all the way to + // after the parent of the end, since everything in between will be linked up via the continuation. + else if (m_renderer->isAnonymousBlock() && lastChildHasContinuation(m_renderer)) + nextSibling = endOfContinuations(m_renderer->lastChild())->parent()->nextSibling(); + + // Case 3: node has an actual next sibling + else if (RenderObject* ns = m_renderer->nextSibling()) + nextSibling = ns; + + // Case 4: node is an inline with a continuation. Next sibling is the next sibling of the end + // of the continuation chain. + else if (isInlineWithContinuation(m_renderer)) + nextSibling = endOfContinuations(m_renderer)->nextSibling(); + + // Case 5: node has no next sibling, and its parent is an inline with a continuation. + else if (isInlineWithContinuation(m_renderer->parent())) { + RenderObject* continuation = toRenderInline(m_renderer->parent())->continuation(); + + // Case 4a: continuation is a block - in this case the block itself is the next sibling. + if (continuation->isRenderBlock()) + nextSibling = continuation; + // Case 4b: continuation is an inline - in this case the inline's first child is the next sibling + else + nextSibling = firstChildConsideringContinuation(continuation); + } + if (!nextSibling) return 0; @@ -170,8 +359,20 @@ AccessibilityObject* AccessibilityRenderObject::parentObjectIfExists() const { if (!m_renderer) return 0; - + RenderObject* parent = m_renderer->parent(); + + // Case 1: node is a block and is an inline's continuation. Parent + // is the start of the continuation chain. + RenderInline* startOfConts = 0; + if (m_renderer->isRenderBlock() && (startOfConts = startOfContinuations(m_renderer))) + parent = startOfConts; + + // Case 2: node's parent is an inline which is some node's continuation; parent is + // the earliest node in the continuation chain. + else if (parent && parent->isRenderInline() && (startOfConts = startOfContinuations(parent))) + parent = startOfConts; + if (!parent) return 0; @@ -184,6 +385,18 @@ AccessibilityObject* AccessibilityRenderObject::parentObject() const return 0; RenderObject* parent = m_renderer->parent(); + + // Case 1: node is a block and is an inline's continuation. Parent + // is the start of the continuation chain. + RenderInline* startOfConts = 0; + if (m_renderer->isRenderBlock() && (startOfConts = startOfContinuations(m_renderer))) + parent = startOfConts; + + // Case 2: node's parent is an inline which is some node's continuation; parent is + // the earliest node in the continuation chain. + else if (parent && parent->isRenderInline() && (startOfConts = startOfContinuations(parent))) + parent = startOfConts; + if (!parent) return 0; @@ -2800,7 +3013,16 @@ AccessibilityRole AccessibilityRenderObject::determineAccessibilityRole() if (node && node->hasTagName(tableTag)) return TableRole; -#endif +#endif + + // Table sections should be ignored. + if (m_renderer->isTableSection()) + return IgnoredRole; + +#if PLATFORM(GTK) + if (m_renderer->isHR()) + return SplitterRole; +#endif if (m_renderer->isBlockFlow() || (node && node->hasTagName(labelTag))) return GroupRole; diff --git a/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp b/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp index ca3e8cc..e32340a 100644 --- a/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp +++ b/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp @@ -38,8 +38,8 @@ AccessibilityObjectInclusion AccessibilityObject::accessibilityPlatformIncludesO if (!parent) return DefaultBehavior; - if (isMenuListPopup() || isMenuListOption()) - return IgnoreObject; + if (roleValue() == SplitterRole) + return IncludeObject; if (isGroup()) { // When a list item is made up entirely of children (e.g. paragraphs) diff --git a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp index ffef2a8..d09877f 100644 --- a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp +++ b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp @@ -360,8 +360,10 @@ static AtkRole atkRole(AccessibilityRole role) return ATK_ROLE_TREE; case MenuBarRole: return ATK_ROLE_MENU_BAR; + case MenuListPopupRole: case MenuRole: return ATK_ROLE_MENU; + case MenuListOptionRole: case MenuItemRole: return ATK_ROLE_MENU_ITEM; case ColumnRole: @@ -379,6 +381,7 @@ static AtkRole atkRole(AccessibilityRole role) return ATK_ROLE_PROGRESS_BAR; case WindowRole: return ATK_ROLE_WINDOW; + case PopUpButtonRole: case ComboBoxRole: return ATK_ROLE_COMBO_BOX; case SplitGroupRole: diff --git a/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm b/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm index f13968d..97aaaf2 100644 --- a/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm +++ b/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm @@ -59,7 +59,6 @@ #import "WebCoreViewFactory.h" #import "htmlediting.h" #import "visible_units.h" -#import <runtime/InitializeThreading.h> using namespace WebCore; using namespace HTMLNames; @@ -172,14 +171,6 @@ typedef unsigned NSUInteger; @implementation AccessibilityObjectWrapper -+ (void)initialize -{ - JSC::initializeThreading(); -#ifndef BUILDING_ON_TIGER - WebCoreObjCFinalizeOnMainThread(self); -#endif -} - - (id)initWithAccessibilityObject:(AccessibilityObject*)axObject { [super init]; diff --git a/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp b/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp index 6ba85da..a4cb57d 100644 --- a/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp +++ b/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp @@ -46,6 +46,7 @@ bool RuntimeEnabledFeatures::isGeolocationEnabled = true; bool RuntimeEnabledFeatures::isIndexedDBEnabled = false; bool RuntimeEnabledFeatures::isWebGLEnabled = false; bool RuntimeEnabledFeatures::isPushStateEnabled = false; +bool RuntimeEnabledFeatures::isTouchEnabled = false; #if ENABLE(VIDEO) diff --git a/WebCore/bindings/generic/RuntimeEnabledFeatures.h b/WebCore/bindings/generic/RuntimeEnabledFeatures.h index 37dceff..1534353 100644 --- a/WebCore/bindings/generic/RuntimeEnabledFeatures.h +++ b/WebCore/bindings/generic/RuntimeEnabledFeatures.h @@ -94,6 +94,15 @@ public: static bool pushStateEnabled() { return isPushStateEnabled; } static bool replaceStateEnabled() { return isPushStateEnabled; } +#if ENABLE(TOUCH_EVENTS) + static bool touchEnabled() { return isTouchEnabled; } + static void setTouchEnabled(bool isEnabled) { isTouchEnabled = isEnabled; } + static bool ontouchstartEnabled() { return isTouchEnabled; } + static bool ontouchmoveEnabled() { return isTouchEnabled; } + static bool ontouchendEnabled() { return isTouchEnabled; } + static bool ontouchcancelEnabled() { return isTouchEnabled; } +#endif + private: // Never instantiate. RuntimeEnabledFeatures() { } @@ -106,6 +115,7 @@ private: static bool isIndexedDBEnabled; static bool isWebGLEnabled; static bool isPushStateEnabled; + static bool isTouchEnabled; }; } // namespace WebCore diff --git a/WebCore/bindings/gobject/WebKitDOMBinding.cpp b/WebCore/bindings/gobject/WebKitDOMBinding.cpp index 1f900c3..b8fbdda 100644 --- a/WebCore/bindings/gobject/WebKitDOMBinding.cpp +++ b/WebCore/bindings/gobject/WebKitDOMBinding.cpp @@ -27,8 +27,10 @@ #include "Event.h" #include "EventException.h" #include "HTMLNames.h" +#include "WebKitDOMElementPrivate.h" #include "WebKitDOMNode.h" #include "WebKitDOMNodePrivate.h" +#include "WebKitHTMLElementWrapperFactory.h" namespace WebKit { @@ -66,11 +68,21 @@ void DOMObjectCache::forget(void* objectHandle) static gpointer createWrapper(Node* node) { ASSERT(node); + ASSERT(node->nodeType()); gpointer wrappedNode = 0; - if (node->nodeType()) + switch (node->nodeType()) { + case Node::ELEMENT_NODE: + if (node->isHTMLElement()) + wrappedNode = createHTMLElementWrapper(static_cast<HTMLElement*>(node)); + else + wrappedNode = wrapNode(node); + break; + default: wrappedNode = wrapNode(node); + break; + } return DOMObjectCache::put(node, wrappedNode); } @@ -87,4 +99,23 @@ gpointer kit(Node* node) return createWrapper(node); } +gpointer kit(Element* element) +{ + if (!element) + return 0; + + gpointer kitElement = DOMObjectCache::get(element); + if (kitElement) + return kitElement; + + gpointer wrappedElement; + + if (element->isHTMLElement()) + wrappedElement = createHTMLElementWrapper(static_cast<HTMLElement*>(element)); + else + wrappedElement = wrapElement(element); + + return DOMObjectCache::put(element, wrappedElement); +} + } // namespace WebKit diff --git a/WebCore/bindings/gobject/WebKitDOMBinding.h b/WebCore/bindings/gobject/WebKitDOMBinding.h index f6efa46..d27bdda 100644 --- a/WebCore/bindings/gobject/WebKitDOMBinding.h +++ b/WebCore/bindings/gobject/WebKitDOMBinding.h @@ -28,10 +28,12 @@ namespace WebCore { class Node; +class Element; } // namespace WebCore namespace WebKit { gpointer kit(WebCore::Node* node); +gpointer kit(WebCore::Element* element); class DOMObjectCache { public: diff --git a/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.cpp b/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.cpp new file mode 100644 index 0000000..1513b66 --- /dev/null +++ b/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.cpp @@ -0,0 +1,526 @@ +/* + * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2008 Luke Kenneth Casson Leighton <lkcl@lkcl.net> + * Copyright (C) 2008 Martin Soto <soto@freedesktop.org> + * Copyright (C) 2010 Igalia S.L. + * + * This file is derived by hand from an automatically generated file. + * Keeping it up-to-date could potentially be done by adding + * a make_names.pl generator, or by writing a separate + * generater which takes JSHTMLElementWrapperFactory.h as input. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 "WebKitHTMLElementWrapperFactory.h" + +#include "HTMLAnchorElement.h" +#include "HTMLAppletElement.h" +#include "HTMLAreaElement.h" +#include "HTMLBRElement.h" +#include "HTMLBaseElement.h" +#include "HTMLBaseFontElement.h" +#include "HTMLBlockquoteElement.h" +#include "HTMLBodyElement.h" +#include "HTMLButtonElement.h" +#include "HTMLCanvasElement.h" +#include "HTMLDListElement.h" +#include "HTMLDirectoryElement.h" +#include "HTMLDivElement.h" +#include "HTMLEmbedElement.h" +#include "HTMLFieldSetElement.h" +#include "HTMLFontElement.h" +#include "HTMLFormElement.h" +#include "HTMLFrameElement.h" +#include "HTMLFrameSetElement.h" +#include "HTMLHRElement.h" +#include "HTMLHeadElement.h" +#include "HTMLHeadingElement.h" +#include "HTMLHtmlElement.h" +#include "HTMLIFrameElement.h" +#include "HTMLImageElement.h" +#include "HTMLInputElement.h" +#include "HTMLIsIndexElement.h" +#include "HTMLLIElement.h" +#include "HTMLLabelElement.h" +#include "HTMLLegendElement.h" +#include "HTMLLinkElement.h" +#include "HTMLMapElement.h" +#include "HTMLMarqueeElement.h" +#include "HTMLMenuElement.h" +#include "HTMLMetaElement.h" +#include "HTMLModElement.h" +#include "HTMLNames.h" +#include "HTMLOListElement.h" +#include "HTMLObjectElement.h" +#include "HTMLOptGroupElement.h" +#include "HTMLOptionElement.h" +#include "HTMLParagraphElement.h" +#include "HTMLParamElement.h" +#include "HTMLPreElement.h" +#include "HTMLQuoteElement.h" +#include "HTMLScriptElement.h" +#include "HTMLSelectElement.h" +#include "HTMLStyleElement.h" +#include "HTMLTableCaptionElement.h" +#include "HTMLTableCellElement.h" +#include "HTMLTableColElement.h" +#include "HTMLTableElement.h" +#include "HTMLTableRowElement.h" +#include "HTMLTableSectionElement.h" +#include "HTMLTextAreaElement.h" +#include "HTMLTitleElement.h" +#include "HTMLUListElement.h" + +#include "webkit/WebKitDOMHTMLAnchorElementPrivate.h" +#include "webkit/WebKitDOMHTMLAppletElementPrivate.h" +#include "webkit/WebKitDOMHTMLAreaElementPrivate.h" +#include "webkit/WebKitDOMHTMLBRElementPrivate.h" +#include "webkit/WebKitDOMHTMLBaseElementPrivate.h" +#include "webkit/WebKitDOMHTMLBaseFontElementPrivate.h" +#include "webkit/WebKitDOMHTMLBlockquoteElementPrivate.h" +#include "webkit/WebKitDOMHTMLBodyElementPrivate.h" +#include "webkit/WebKitDOMHTMLButtonElementPrivate.h" +#include "webkit/WebKitDOMHTMLCanvasElementPrivate.h" +#include "webkit/WebKitDOMHTMLDListElementPrivate.h" +#include "webkit/WebKitDOMHTMLDirectoryElementPrivate.h" +#include "webkit/WebKitDOMHTMLDivElementPrivate.h" +#include "webkit/WebKitDOMHTMLElementPrivate.h" +#include "webkit/WebKitDOMHTMLEmbedElementPrivate.h" +#include "webkit/WebKitDOMHTMLFieldSetElementPrivate.h" +#include "webkit/WebKitDOMHTMLFontElementPrivate.h" +#include "webkit/WebKitDOMHTMLFormElementPrivate.h" +#include "webkit/WebKitDOMHTMLFrameElementPrivate.h" +#include "webkit/WebKitDOMHTMLFrameSetElementPrivate.h" +#include "webkit/WebKitDOMHTMLHRElementPrivate.h" +#include "webkit/WebKitDOMHTMLHeadElementPrivate.h" +#include "webkit/WebKitDOMHTMLHeadingElementPrivate.h" +#include "webkit/WebKitDOMHTMLHtmlElementPrivate.h" +#include "webkit/WebKitDOMHTMLIFrameElementPrivate.h" +#include "webkit/WebKitDOMHTMLImageElementPrivate.h" +#include "webkit/WebKitDOMHTMLInputElementPrivate.h" +#include "webkit/WebKitDOMHTMLIsIndexElementPrivate.h" +#include "webkit/WebKitDOMHTMLLIElementPrivate.h" +#include "webkit/WebKitDOMHTMLLabelElementPrivate.h" +#include "webkit/WebKitDOMHTMLLegendElementPrivate.h" +#include "webkit/WebKitDOMHTMLLinkElementPrivate.h" +#include "webkit/WebKitDOMHTMLMapElementPrivate.h" +#include "webkit/WebKitDOMHTMLMarqueeElementPrivate.h" +#include "webkit/WebKitDOMHTMLMenuElementPrivate.h" +#include "webkit/WebKitDOMHTMLMetaElementPrivate.h" +#include "webkit/WebKitDOMHTMLModElementPrivate.h" +#include "webkit/WebKitDOMHTMLOListElementPrivate.h" +#include "webkit/WebKitDOMHTMLObjectElementPrivate.h" +#include "webkit/WebKitDOMHTMLOptGroupElementPrivate.h" +#include "webkit/WebKitDOMHTMLOptionElementPrivate.h" +#include "webkit/WebKitDOMHTMLParagraphElementPrivate.h" +#include "webkit/WebKitDOMHTMLParamElementPrivate.h" +#include "webkit/WebKitDOMHTMLPreElementPrivate.h" +#include "webkit/WebKitDOMHTMLQuoteElementPrivate.h" +#include "webkit/WebKitDOMHTMLScriptElementPrivate.h" +#include "webkit/WebKitDOMHTMLSelectElementPrivate.h" +#include "webkit/WebKitDOMHTMLStyleElementPrivate.h" +#include "webkit/WebKitDOMHTMLTableCaptionElementPrivate.h" +#include "webkit/WebKitDOMHTMLTableCellElementPrivate.h" +#include "webkit/WebKitDOMHTMLTableColElementPrivate.h" +#include "webkit/WebKitDOMHTMLTableElementPrivate.h" +#include "webkit/WebKitDOMHTMLTableRowElementPrivate.h" +#include "webkit/WebKitDOMHTMLTableSectionElementPrivate.h" +#include "webkit/WebKitDOMHTMLTextAreaElementPrivate.h" +#include "webkit/WebKitDOMHTMLTitleElementPrivate.h" +#include "webkit/WebKitDOMHTMLUListElementPrivate.h" +#include "webkit/webkitdom.h" + +#include <wtf/text/CString.h> + +namespace WebKit { + +using namespace WebCore; +using namespace WebCore::HTMLNames; + +typedef gpointer (*CreateHTMLElementWrapperFunction)(PassRefPtr<HTMLElement>); + +static gpointer createAnchorWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLAnchorElement(static_cast<HTMLAnchorElement*>(element.get())); +} + +static gpointer createAppletWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLAppletElement(static_cast<HTMLAppletElement*>(element.get())); +} + +static gpointer createAreaWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLAreaElement(static_cast<HTMLAreaElement*>(element.get())); +} + +static gpointer createBaseWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLBaseElement(static_cast<HTMLBaseElement*>(element.get())); +} + +static gpointer createBaseFontWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLBaseFontElement(static_cast<HTMLBaseFontElement*>(element.get())); +} + +static gpointer createBlockquoteWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLBlockquoteElement(static_cast<HTMLBlockquoteElement*>(element.get())); +} + +static gpointer createBodyWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLBodyElement(static_cast<HTMLBodyElement*>(element.get())); +} + +static gpointer createBRWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLBRElement(static_cast<HTMLBRElement*>(element.get())); +} + +static gpointer createButtonWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLButtonElement(static_cast<HTMLButtonElement*>(element.get())); +} + +static gpointer createCanvasWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLCanvasElement(static_cast<HTMLCanvasElement*>(element.get())); +} + +static gpointer createTableCaptionWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLTableCaptionElement(static_cast<HTMLTableCaptionElement*>(element.get())); +} + +static gpointer createTableColWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLTableColElement(static_cast<HTMLTableColElement*>(element.get())); +} + +static gpointer createModWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLModElement(static_cast<HTMLModElement*>(element.get())); +} + +static gpointer createDirectoryWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLDirectoryElement(static_cast<HTMLDirectoryElement*>(element.get())); +} + +static gpointer createDivWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLDivElement(static_cast<HTMLDivElement*>(element.get())); +} + +static gpointer createDListWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLDListElement(static_cast<HTMLDListElement*>(element.get())); +} + +static gpointer createEmbedWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLEmbedElement(static_cast<HTMLEmbedElement*>(element.get())); +} + +static gpointer createFieldSetWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLFieldSetElement(static_cast<HTMLFieldSetElement*>(element.get())); +} + +static gpointer createFontWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLFontElement(static_cast<HTMLFontElement*>(element.get())); +} + +static gpointer createFormWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLFormElement(static_cast<HTMLFormElement*>(element.get())); +} + +static gpointer createFrameWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLFrameElement(static_cast<HTMLFrameElement*>(element.get())); +} + +static gpointer createFrameSetWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLFrameSetElement(static_cast<HTMLFrameSetElement*>(element.get())); +} + +static gpointer createHeadingWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLHeadingElement(static_cast<HTMLHeadingElement*>(element.get())); +} + +static gpointer createHeadWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLHeadElement(static_cast<HTMLHeadElement*>(element.get())); +} + +static gpointer createHRWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLHRElement(static_cast<HTMLHRElement*>(element.get())); +} + +static gpointer createHtmlWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLHtmlElement(static_cast<HTMLHtmlElement*>(element.get())); +} + +static gpointer createIFrameWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLIFrameElement(static_cast<HTMLIFrameElement*>(element.get())); +} + +static gpointer createImageWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLImageElement(static_cast<HTMLImageElement*>(element.get())); +} + +static gpointer createInputWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLInputElement(static_cast<HTMLInputElement*>(element.get())); +} + +static gpointer createIsIndexWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLIsIndexElement(static_cast<HTMLIsIndexElement*>(element.get())); +} + +static gpointer createLabelWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLLabelElement(static_cast<HTMLLabelElement*>(element.get())); +} + +static gpointer createLegendWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLLegendElement(static_cast<HTMLLegendElement*>(element.get())); +} + +static gpointer createLIWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLLIElement(static_cast<HTMLLIElement*>(element.get())); +} + +static gpointer createLinkWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLLinkElement(static_cast<HTMLLinkElement*>(element.get())); +} + +static gpointer createMapWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLMapElement(static_cast<HTMLMapElement*>(element.get())); +} + +static gpointer createMarqueeWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLMarqueeElement(static_cast<HTMLMarqueeElement*>(element.get())); +} + +static gpointer createMenuWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLMenuElement(static_cast<HTMLMenuElement*>(element.get())); +} + +static gpointer createMetaWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLMetaElement(static_cast<HTMLMetaElement*>(element.get())); +} + +static gpointer createObjectWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLObjectElement(static_cast<HTMLObjectElement*>(element.get())); +} + +static gpointer createOListWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLOListElement(static_cast<HTMLOListElement*>(element.get())); +} + +static gpointer createOptGroupWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLOptGroupElement(static_cast<HTMLOptGroupElement*>(element.get())); +} + +static gpointer createOptionWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLOptionElement(static_cast<HTMLOptionElement*>(element.get())); +} + +static gpointer createParagraphWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLParagraphElement(static_cast<HTMLParagraphElement*>(element.get())); +} + +static gpointer createParamWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLParamElement(static_cast<HTMLParamElement*>(element.get())); +} + +static gpointer createPreWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLPreElement(static_cast<HTMLPreElement*>(element.get())); +} + +static gpointer createQuoteWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLQuoteElement(static_cast<HTMLQuoteElement*>(element.get())); +} + +static gpointer createScriptWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLScriptElement(static_cast<HTMLScriptElement*>(element.get())); +} + +static gpointer createSelectWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLSelectElement(static_cast<HTMLSelectElement*>(element.get())); +} + +static gpointer createStyleWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLStyleElement(static_cast<HTMLStyleElement*>(element.get())); +} + +static gpointer createTableWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLTableElement(static_cast<HTMLTableElement*>(element.get())); +} + +static gpointer createTableSectionWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLTableSectionElement(static_cast<HTMLTableSectionElement*>(element.get())); +} + +static gpointer createTableCellWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLTableCellElement(static_cast<HTMLTableCellElement*>(element.get())); +} + +static gpointer createTextAreaWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLTextAreaElement(static_cast<HTMLTextAreaElement*>(element.get())); +} + +static gpointer createTitleWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLTitleElement(static_cast<HTMLTitleElement*>(element.get())); +} + +static gpointer createTableRowWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLTableRowElement(static_cast<HTMLTableRowElement*>(element.get())); +} + +static gpointer createUListWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLUListElement(static_cast<HTMLUListElement*>(element.get())); +} + +gpointer createHTMLElementWrapper(PassRefPtr<WebCore::HTMLElement> element) +{ + static HashMap<WebCore::AtomicStringImpl*, CreateHTMLElementWrapperFunction> map; + if (map.isEmpty()) { + map.set(aTag.localName().impl(), createAnchorWrapper); + map.set(appletTag.localName().impl(), createAppletWrapper); + map.set(areaTag.localName().impl(), createAreaWrapper); + map.set(baseTag.localName().impl(), createBaseWrapper); + map.set(basefontTag.localName().impl(), createBaseFontWrapper); + map.set(blockquoteTag.localName().impl(), createBlockquoteWrapper); + map.set(bodyTag.localName().impl(), createBodyWrapper); + map.set(brTag.localName().impl(), createBRWrapper); + map.set(buttonTag.localName().impl(), createButtonWrapper); + map.set(canvasTag.localName().impl(), createCanvasWrapper); + map.set(captionTag.localName().impl(), createTableCaptionWrapper); + map.set(colTag.localName().impl(), createTableColWrapper); + map.set(delTag.localName().impl(), createModWrapper); + map.set(dirTag.localName().impl(), createDirectoryWrapper); + map.set(divTag.localName().impl(), createDivWrapper); + map.set(dlTag.localName().impl(), createDListWrapper); + map.set(embedTag.localName().impl(), createEmbedWrapper); + map.set(fieldsetTag.localName().impl(), createFieldSetWrapper); + map.set(fontTag.localName().impl(), createFontWrapper); + map.set(formTag.localName().impl(), createFormWrapper); + map.set(frameTag.localName().impl(), createFrameWrapper); + map.set(framesetTag.localName().impl(), createFrameSetWrapper); + map.set(h1Tag.localName().impl(), createHeadingWrapper); + map.set(headTag.localName().impl(), createHeadWrapper); + map.set(hrTag.localName().impl(), createHRWrapper); + map.set(htmlTag.localName().impl(), createHtmlWrapper); + map.set(iframeTag.localName().impl(), createIFrameWrapper); + map.set(imgTag.localName().impl(), createImageWrapper); + map.set(inputTag.localName().impl(), createInputWrapper); + map.set(isindexTag.localName().impl(), createIsIndexWrapper); + map.set(labelTag.localName().impl(), createLabelWrapper); + map.set(legendTag.localName().impl(), createLegendWrapper); + map.set(liTag.localName().impl(), createLIWrapper); + map.set(linkTag.localName().impl(), createLinkWrapper); + map.set(mapTag.localName().impl(), createMapWrapper); + map.set(marqueeTag.localName().impl(), createMarqueeWrapper); + map.set(menuTag.localName().impl(), createMenuWrapper); + map.set(metaTag.localName().impl(), createMetaWrapper); + map.set(objectTag.localName().impl(), createObjectWrapper); + map.set(olTag.localName().impl(), createOListWrapper); + map.set(optgroupTag.localName().impl(), createOptGroupWrapper); + map.set(optionTag.localName().impl(), createOptionWrapper); + map.set(pTag.localName().impl(), createParagraphWrapper); + map.set(paramTag.localName().impl(), createParamWrapper); + map.set(preTag.localName().impl(), createPreWrapper); + map.set(qTag.localName().impl(), createQuoteWrapper); + map.set(scriptTag.localName().impl(), createScriptWrapper); + map.set(selectTag.localName().impl(), createSelectWrapper); + map.set(styleTag.localName().impl(), createStyleWrapper); + map.set(tableTag.localName().impl(), createTableWrapper); + map.set(tbodyTag.localName().impl(), createTableSectionWrapper); + map.set(tdTag.localName().impl(), createTableCellWrapper); + map.set(textareaTag.localName().impl(), createTextAreaWrapper); + map.set(titleTag.localName().impl(), createTitleWrapper); + map.set(trTag.localName().impl(), createTableRowWrapper); + map.set(ulTag.localName().impl(), createUListWrapper); + map.set(colgroupTag.localName().impl(), createTableColWrapper); + map.set(h2Tag.localName().impl(), createHeadingWrapper); + map.set(h3Tag.localName().impl(), createHeadingWrapper); + map.set(h4Tag.localName().impl(), createHeadingWrapper); + map.set(h5Tag.localName().impl(), createHeadingWrapper); + map.set(h6Tag.localName().impl(), createHeadingWrapper); + map.set(imageTag.localName().impl(), createImageWrapper); + map.set(insTag.localName().impl(), createModWrapper); + map.set(keygenTag.localName().impl(), createSelectWrapper); + map.set(listingTag.localName().impl(), createPreWrapper); + map.set(tfootTag.localName().impl(), createTableSectionWrapper); + map.set(thTag.localName().impl(), createTableCellWrapper); + map.set(theadTag.localName().impl(), createTableSectionWrapper); + map.set(xmpTag.localName().impl(), createPreWrapper); + } + + CreateHTMLElementWrapperFunction createWrapperFunction = + map.get(element->localName().impl()); + if (createWrapperFunction) + return createWrapperFunction(element); + return wrapHTMLElement(element.get()); +} + +} diff --git a/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.h b/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.h new file mode 100644 index 0000000..2677891 --- /dev/null +++ b/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2010 Igalia S.L. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef WebKitHTMLElementWrapperFactory_h +#define WebKitHTMLElementWrapperFactory_h + +#include "HTMLElement.h" +#include "glib-object.h" + +#include <wtf/Forward.h> + +namespace WebCore { +class HTMLElement; +} + +namespace WebKit { +gpointer createHTMLElementWrapper(PassRefPtr<WebCore::HTMLElement>); +} + +#endif // WebKitHTMLElementWrapperFactory_h diff --git a/WebCore/bindings/js/JSAbstractWorkerCustom.cpp b/WebCore/bindings/js/JSAbstractWorkerCustom.cpp deleted file mode 100644 index 1f843f9..0000000 --- a/WebCore/bindings/js/JSAbstractWorkerCustom.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * 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: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(WORKERS) - -#include "JSAbstractWorker.h" - -#include "AbstractWorker.h" -#include "JSDOMGlobalObject.h" -#include "JSEventListener.h" -#include "JSEventTarget.h" - -using namespace JSC; - -namespace WebCore { - -JSValue JSAbstractWorker::addEventListener(ExecState* exec, const ArgList& args) -{ - JSValue listener = args.at(1); - if (!listener.isObject()) - return jsUndefined(); - - impl()->addEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec)); - return jsUndefined(); -} - -JSValue JSAbstractWorker::removeEventListener(ExecState* exec, const ArgList& args) -{ - JSValue listener = args.at(1); - if (!listener.isObject()) - return jsUndefined(); - - impl()->removeEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); - return jsUndefined(); -} - -} // namespace WebCore - -#endif // ENABLE(WORKERS) diff --git a/WebCore/bindings/js/JSBindingsAllInOne.cpp b/WebCore/bindings/js/JSBindingsAllInOne.cpp index 2e05350..e275397 100644 --- a/WebCore/bindings/js/JSBindingsAllInOne.cpp +++ b/WebCore/bindings/js/JSBindingsAllInOne.cpp @@ -26,7 +26,6 @@ // This all-in-one cpp file cuts down on template bloat to allow us to build our Windows release build. #include "GCController.cpp" -#include "JSAbstractWorkerCustom.cpp" #include "JSAttrCustom.cpp" #include "JSAudioConstructor.cpp" #include "JSCDATASectionCustom.cpp" @@ -40,10 +39,7 @@ #include "JSClipboardCustom.cpp" #include "JSConsoleCustom.cpp" #include "JSCoordinatesCustom.cpp" -#include "JSCustomSQLStatementCallback.cpp" #include "JSCustomSQLStatementErrorCallback.cpp" -#include "JSCustomSQLTransactionCallback.cpp" -#include "JSCustomSQLTransactionErrorCallback.cpp" #include "JSCustomVoidCallback.cpp" #include "JSCustomXPathNSResolver.cpp" #include "JSDOMApplicationCacheCustom.cpp" @@ -58,12 +54,10 @@ #include "JSDedicatedWorkerContextCustom.cpp" #include "JSDesktopNotificationsCustom.cpp" #include "JSDocumentCustom.cpp" -#include "JSDocumentFragmentCustom.cpp" #include "JSElementCustom.cpp" #include "JSEventCustom.cpp" #include "JSEventListener.cpp" #include "JSEventSourceConstructor.cpp" -#include "JSEventSourceCustom.cpp" #include "JSEventTarget.cpp" #include "JSExceptionBase.cpp" #include "JSHTMLAllCollectionCustom.cpp" diff --git a/WebCore/bindings/js/JSCustomSQLStatementCallback.cpp b/WebCore/bindings/js/JSCustomSQLStatementCallback.cpp deleted file mode 100644 index 46a7ae5..0000000 --- a/WebCore/bindings/js/JSCustomSQLStatementCallback.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "JSCustomSQLStatementCallback.h" - -#if ENABLE(DATABASE) - -#include "Frame.h" -#include "JSSQLResultSet.h" -#include "JSSQLTransaction.h" -#include "ScriptExecutionContext.h" -#include <runtime/JSLock.h> -#include <wtf/MainThread.h> - -namespace WebCore { - -using namespace JSC; - -JSCustomSQLStatementCallback::JSCustomSQLStatementCallback(JSObject* callback, JSDOMGlobalObject* globalObject) - : m_data(new JSCallbackData(callback, globalObject)) - , m_isolatedWorld(globalObject->world()) -{ -} - -JSCustomSQLStatementCallback::~JSCustomSQLStatementCallback() -{ - callOnMainThread(JSCallbackData::deleteData, m_data); -#ifndef NDEBUG - m_data = 0; -#endif -} - -void JSCustomSQLStatementCallback::handleEvent(ScriptExecutionContext* context, SQLTransaction* transaction, SQLResultSet* resultSet, bool& raisedException) -{ - ASSERT(m_data); - ASSERT(context); - - RefPtr<JSCustomSQLStatementCallback> protect(this); - - JSC::JSLock lock(SilenceAssertionsOnly); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, m_isolatedWorld.get()); - if (!globalObject) - return; - - ExecState* exec = globalObject->globalExec(); - MarkedArgumentBuffer args; - args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), transaction)); - args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), resultSet)); - - m_data->invokeCallback(args, &raisedException); -} - -} - -#endif // ENABLE(DATABASE) diff --git a/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp b/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp index a2ba52a..3026a33 100644 --- a/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp +++ b/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp @@ -27,42 +27,26 @@ */ #include "config.h" -#include "JSCustomSQLStatementErrorCallback.h" +#include "JSSQLStatementErrorCallback.h" #if ENABLE(DATABASE) #include "Frame.h" -#include "JSCallbackData.h" #include "JSSQLError.h" #include "JSSQLTransaction.h" #include "ScriptExecutionContext.h" #include <runtime/JSLock.h> -#include <wtf/MainThread.h> namespace WebCore { using namespace JSC; -JSCustomSQLStatementErrorCallback::JSCustomSQLStatementErrorCallback(JSObject* callback, JSDOMGlobalObject* globalObject) - : m_data(new JSCallbackData(callback, globalObject)) - , m_isolatedWorld(globalObject->world()) -{ -} - -JSCustomSQLStatementErrorCallback::~JSCustomSQLStatementErrorCallback() -{ - callOnMainThread(JSCallbackData::deleteData, m_data); -#ifndef NDEBUG - m_data = 0; -#endif -} - -bool JSCustomSQLStatementErrorCallback::handleEvent(ScriptExecutionContext* context, SQLTransaction* transaction, SQLError* error) +bool JSSQLStatementErrorCallback::handleEvent(ScriptExecutionContext* context, SQLTransaction* transaction, SQLError* error) { ASSERT(m_data); ASSERT(context); - RefPtr<JSCustomSQLStatementErrorCallback> protect(this); + RefPtr<JSSQLStatementErrorCallback> protect(this); JSC::JSLock lock(SilenceAssertionsOnly); JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, m_isolatedWorld.get()); diff --git a/WebCore/bindings/js/JSCustomSQLTransactionCallback.cpp b/WebCore/bindings/js/JSCustomSQLTransactionCallback.cpp deleted file mode 100644 index d5e9754..0000000 --- a/WebCore/bindings/js/JSCustomSQLTransactionCallback.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - */ - -#include "config.h" -#include "JSCustomSQLTransactionCallback.h" - -#if ENABLE(DATABASE) - -#include "Frame.h" -#include "JSCallbackData.h" -#include "JSSQLTransaction.h" -#include "ScriptExecutionContext.h" -#include <runtime/JSLock.h> -#include <wtf/MainThread.h> -#include <wtf/RefCountedLeakCounter.h> - -namespace WebCore { - -using namespace JSC; - -#ifndef NDEBUG -static WTF::RefCountedLeakCounter counter("JSCustomSQLTransactionCallback"); -#endif - -JSCustomSQLTransactionCallback::JSCustomSQLTransactionCallback(JSObject* callback, JSDOMGlobalObject* globalObject) - : m_data(new JSCallbackData(callback, globalObject)) - , m_isolatedWorld(globalObject->world()) -{ -#ifndef NDEBUG - counter.increment(); -#endif -} - -JSCustomSQLTransactionCallback::~JSCustomSQLTransactionCallback() -{ - callOnMainThread(JSCallbackData::deleteData, m_data); -#ifndef NDEBUG - m_data = 0; - counter.decrement(); -#endif -} - -void JSCustomSQLTransactionCallback::handleEvent(ScriptExecutionContext* context, SQLTransaction* transaction, bool& raisedException) -{ - ASSERT(m_data); - ASSERT(context); - - RefPtr<JSCustomSQLTransactionCallback> protect(this); - - JSC::JSLock lock(SilenceAssertionsOnly); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, m_isolatedWorld.get()); - if (!globalObject) - return; - - ExecState* exec = globalObject->globalExec(); - MarkedArgumentBuffer args; - args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), transaction)); - m_data->invokeCallback(args, &raisedException); -} - -} - -#endif // ENABLE(DATABASE) diff --git a/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp b/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp index 6198d6e..b1f82a8 100644 --- a/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp +++ b/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp @@ -85,26 +85,6 @@ JSValue JSDOMApplicationCache::remove(ExecState* exec, const ArgList& args) #endif // ENABLE(APPLICATION_CACHE_DYNAMIC_ENTRIES) -JSValue JSDOMApplicationCache::addEventListener(ExecState* exec, const ArgList& args) -{ - JSValue listener = args.at(1); - if (!listener.isObject()) - return jsUndefined(); - - impl()->addEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec)); - return jsUndefined(); -} - -JSValue JSDOMApplicationCache::removeEventListener(ExecState* exec, const ArgList& args) -{ - JSValue listener = args.at(1); - if (!listener.isObject()) - return jsUndefined(); - - impl()->removeEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); - return jsUndefined(); -} - } // namespace WebCore #endif // ENABLE(OFFLINE_WEB_APPLICATIONS) diff --git a/WebCore/bindings/js/JSDOMWindowCustom.cpp b/WebCore/bindings/js/JSDOMWindowCustom.cpp index f5f2ae2..05ea9b1 100644 --- a/WebCore/bindings/js/JSDOMWindowCustom.cpp +++ b/WebCore/bindings/js/JSDOMWindowCustom.cpp @@ -36,8 +36,10 @@ #include "HTMLDocument.h" #include "History.h" #include "JSAudioConstructor.h" +#if ENABLE(DATABASE) #include "JSDatabase.h" #include "JSDatabaseCallback.h" +#endif #include "JSDOMWindowShell.h" #include "JSEvent.h" #include "JSEventListener.h" diff --git a/WebCore/bindings/js/JSDatabaseCallback.cpp b/WebCore/bindings/js/JSDatabaseCallback.cpp deleted file mode 100644 index 6887c86..0000000 --- a/WebCore/bindings/js/JSDatabaseCallback.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "JSDatabaseCallback.h" - -#if ENABLE(DATABASE) - -#include "Frame.h" -#include "JSDatabase.h" -#include "ScriptExecutionContext.h" -#include <runtime/JSLock.h> -#include <wtf/MainThread.h> - -namespace WebCore { - -using namespace JSC; - -JSDatabaseCallback::JSDatabaseCallback(JSObject* callback, JSDOMGlobalObject* globalObject) - : m_data(new JSCallbackData(callback, globalObject)) - , m_isolatedWorld(globalObject->world()) -{ -} - -JSDatabaseCallback::~JSDatabaseCallback() -{ - callOnMainThread(JSCallbackData::deleteData, m_data); -#ifndef NDEBUG - m_data = 0; -#endif -} - -void JSDatabaseCallback::handleEvent(ScriptExecutionContext* context, Database* database) -{ - ASSERT(m_data); - ASSERT(context); - - RefPtr<JSDatabaseCallback> protect(this); - - JSC::JSLock lock(SilenceAssertionsOnly); - - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, m_isolatedWorld.get()); - if (!globalObject) - return; - - ExecState* exec = globalObject->globalExec(); - MarkedArgumentBuffer args; - args.append(toJS(exec, database)); - - bool ignored; - m_data->invokeCallback(args, &ignored); -} - -} - -#endif // ENABLE(DATABASE) diff --git a/WebCore/bindings/js/JSDatabaseCustom.cpp b/WebCore/bindings/js/JSDatabaseCustom.cpp index 50f1d17..ccc5c0d 100644 --- a/WebCore/bindings/js/JSDatabaseCustom.cpp +++ b/WebCore/bindings/js/JSDatabaseCustom.cpp @@ -35,8 +35,8 @@ #include "Database.h" #include "Document.h" #include "ExceptionCode.h" -#include "JSCustomSQLTransactionCallback.h" -#include "JSCustomSQLTransactionErrorCallback.h" +#include "JSSQLTransactionCallback.h" +#include "JSSQLTransactionErrorCallback.h" #include "JSCustomVoidCallback.h" #include "JSDOMWindowCustom.h" #include "PlatformString.h" @@ -58,7 +58,7 @@ JSValue JSDatabase::changeVersion(ExecState* exec, const ArgList& args) return jsUndefined(); } - RefPtr<SQLTransactionCallback> callback(JSCustomSQLTransactionCallback::create(object, static_cast<JSDOMGlobalObject*>(exec->dynamicGlobalObject()))); + RefPtr<SQLTransactionCallback> callback(JSSQLTransactionCallback::create(object, static_cast<JSDOMGlobalObject*>(exec->dynamicGlobalObject()))); RefPtr<SQLTransactionErrorCallback> errorCallback; if (!args.at(3).isNull()) { @@ -67,7 +67,7 @@ JSValue JSDatabase::changeVersion(ExecState* exec, const ArgList& args) return jsUndefined(); } - errorCallback = JSCustomSQLTransactionErrorCallback::create(object, static_cast<JSDOMGlobalObject*>(exec->dynamicGlobalObject())); + errorCallback = JSSQLTransactionErrorCallback::create(object, static_cast<JSDOMGlobalObject*>(exec->dynamicGlobalObject())); } RefPtr<VoidCallback> successCallback; @@ -94,16 +94,15 @@ static JSValue createTransaction(ExecState* exec, const ArgList& args, Database* return jsUndefined(); } - RefPtr<SQLTransactionCallback> callback(JSCustomSQLTransactionCallback::create(object, globalObject)); + RefPtr<SQLTransactionCallback> callback(JSSQLTransactionCallback::create(object, globalObject)); RefPtr<SQLTransactionErrorCallback> errorCallback; - if (args.size() > 1 && !args.at(1).isNull()) { if (!(object = args.at(1).getObject())) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); } - errorCallback = JSCustomSQLTransactionErrorCallback::create(object, globalObject); + errorCallback = JSSQLTransactionErrorCallback::create(object, globalObject); } RefPtr<VoidCallback> successCallback; diff --git a/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp b/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp index f86bae5..387f5f5 100644 --- a/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp +++ b/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp @@ -61,27 +61,6 @@ JSValue JSNotificationCenter::requestPermission(ExecState* exec, const ArgList& return jsUndefined(); } -JSValue JSNotification::addEventListener(ExecState* exec, const ArgList& args) -{ - JSValue listener = args.at(1); - if (!listener.isObject()) - return jsUndefined(); - - impl()->addEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec)); - return jsUndefined(); -} - -JSValue JSNotification::removeEventListener(ExecState* exec, const ArgList& args) -{ - JSValue listener = args.at(1); - if (!listener.isObject()) - return jsUndefined(); - - impl()->removeEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); - return jsUndefined(); -} - - } // namespace #endif // ENABLE(NOTIFICATIONS) diff --git a/WebCore/bindings/js/JSEventListener.cpp b/WebCore/bindings/js/JSEventListener.cpp index 3853cfc..c64aa29 100644 --- a/WebCore/bindings/js/JSEventListener.cpp +++ b/WebCore/bindings/js/JSEventListener.cpp @@ -34,10 +34,11 @@ namespace WebCore { JSEventListener::JSEventListener(JSObject* function, JSObject* wrapper, bool isAttribute, DOMWrapperWorld* isolatedWorld) : EventListener(JSEventListenerType) , m_jsFunction(function) - , m_wrapper(wrapper) , m_isAttribute(isAttribute) , m_isolatedWorld(isolatedWorld) { + if (wrapper) + m_wrapper = wrapper; } JSEventListener::~JSEventListener() @@ -59,7 +60,7 @@ void JSEventListener::markJSFunction(MarkStack& markStack) void JSEventListener::handleEvent(ScriptExecutionContext* scriptExecutionContext, Event* event) { ASSERT(scriptExecutionContext); - if (!scriptExecutionContext) + if (!scriptExecutionContext || scriptExecutionContext->isJSExecutionTerminated()) return; JSLock lock(SilenceAssertionsOnly); diff --git a/WebCore/bindings/js/JSEventSourceCustom.cpp b/WebCore/bindings/js/JSEventSourceCustom.cpp deleted file mode 100644 index 86db431..0000000 --- a/WebCore/bindings/js/JSEventSourceCustom.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2009 Ericsson AB - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 Ericsson nor the names of its contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(EVENTSOURCE) - -#include "JSEventSource.h" - -#include "EventSource.h" -#include "JSDOMGlobalObject.h" -#include "JSEventListener.h" - -using namespace JSC; - -namespace WebCore { - -JSValue JSEventSource::addEventListener(ExecState* exec, const ArgList& args) -{ - JSValue listener = args.at(1); - if (!listener.isObject()) - return jsUndefined(); - - impl()->addEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); - return jsUndefined(); -} - -JSValue JSEventSource::removeEventListener(ExecState* exec, const ArgList& args) -{ - JSValue listener = args.at(1); - if (!listener.isObject()) - return jsUndefined(); - - impl()->removeEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); - return jsUndefined(); -} - -} // namespace WebCore - -#endif // ENABLE(EVENTSOURCE) diff --git a/WebCore/bindings/js/JSHTMLFormElementCustom.cpp b/WebCore/bindings/js/JSHTMLFormElementCustom.cpp index 2e7522c..4dd0b81 100644 --- a/WebCore/bindings/js/JSHTMLFormElementCustom.cpp +++ b/WebCore/bindings/js/JSHTMLFormElementCustom.cpp @@ -61,13 +61,4 @@ JSValue JSHTMLFormElement::nameGetter(ExecState* exec, JSValue slotBase, const I return toJS(exec, jsForm->globalObject(), StaticNodeList::adopt(namedItems).get()); } -JSValue JSHTMLFormElement::submit(ExecState* exec, const ArgList&) -{ - Frame* activeFrame = asJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame(); - if (!activeFrame) - return jsUndefined(); - static_cast<HTMLFormElement*>(impl())->submit(activeFrame); - return jsUndefined(); -} - } diff --git a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp index 8bfb8a3..1fedd7e 100644 --- a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp +++ b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp @@ -129,12 +129,6 @@ JSValue JSInjectedScriptHost::currentCallFrame(ExecState* exec, const ArgList&) JSLock lock(SilenceAssertionsOnly); return toJS(exec, callFrame); } - -JSValue JSInjectedScriptHost::isActivation(ExecState*, const ArgList& args) -{ - JSObject* object = args.at(0).getObject(); - return jsBoolean(object && object->isActivationObject()); -} #endif JSValue JSInjectedScriptHost::nodeForId(ExecState* exec, const ArgList& args) diff --git a/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp b/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp index 080f730..f45abf6 100644 --- a/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp +++ b/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp @@ -85,10 +85,41 @@ JSValue JSJavaScriptCallFrame::scopeChain(ExecState* exec) const return constructArray(exec, list); } -JSValue JSJavaScriptCallFrame::scopeType(ExecState*, const ArgList&) +JSValue JSJavaScriptCallFrame::scopeType(ExecState* exec, const ArgList& args) { - // FIXME(37663): implement this method the way it's done in the InjectedScipt.js - return jsNull(); + if (!impl()->scopeChain()) + return jsUndefined(); + + if (!args.at(0).isInt32()) + return jsUndefined(); + int index = args.at(0).asInt32(); + + const ScopeChainNode* scopeChain = impl()->scopeChain(); + ScopeChainIterator end = scopeChain->end(); + + bool foundLocalScope = false; + for (ScopeChainIterator iter = scopeChain->begin(); iter != end; ++iter) { + JSObject* scope = *iter; + if (scope->isActivationObject()) { + if (!foundLocalScope) { + // First activation object is local scope, each successive activation object is closure. + if (!index) + return jsJavaScriptCallFrameLOCAL_SCOPE(exec, JSValue(), Identifier()); + foundLocalScope = true; + } else if (!index) + return jsJavaScriptCallFrameCLOSURE_SCOPE(exec, JSValue(), Identifier()); + } + + if (!index) { + // Last in the chain is global scope. + if (++iter == end) + return jsJavaScriptCallFrameGLOBAL_SCOPE(exec, JSValue(), Identifier()); + return jsJavaScriptCallFrameWITH_SCOPE(exec, JSValue(), Identifier()); + } + + --index; + } + return jsUndefined(); } } // namespace WebCore diff --git a/WebCore/bindings/js/JSMessagePortCustom.cpp b/WebCore/bindings/js/JSMessagePortCustom.cpp index f7c0160..4c1491d 100644 --- a/WebCore/bindings/js/JSMessagePortCustom.cpp +++ b/WebCore/bindings/js/JSMessagePortCustom.cpp @@ -52,26 +52,6 @@ void JSMessagePort::markChildren(MarkStack& markStack) m_impl->markJSEventListeners(markStack); } -JSValue JSMessagePort::addEventListener(ExecState* exec, const ArgList& args) -{ - JSValue listener = args.at(1); - if (!listener.isObject()) - return jsUndefined(); - - impl()->addEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); - return jsUndefined(); -} - -JSValue JSMessagePort::removeEventListener(ExecState* exec, const ArgList& args) -{ - JSValue listener = args.at(1); - if (!listener.isObject()) - return jsUndefined(); - - impl()->removeEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); - return jsUndefined(); -} - JSC::JSValue JSMessagePort::postMessage(JSC::ExecState* exec, const JSC::ArgList& args) { return handlePostMessage(exec, args, impl()); diff --git a/WebCore/bindings/js/JSNodeCustom.cpp b/WebCore/bindings/js/JSNodeCustom.cpp index 3a07b29..6d61037 100644 --- a/WebCore/bindings/js/JSNodeCustom.cpp +++ b/WebCore/bindings/js/JSNodeCustom.cpp @@ -169,26 +169,6 @@ JSValue JSNode::appendChild(ExecState* exec, const ArgList& args) return jsNull(); } -JSValue JSNode::addEventListener(ExecState* exec, const ArgList& args) -{ - JSValue listener = args.at(1); - if (!listener.isObject()) - return jsUndefined(); - - impl()->addEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec)); - return jsUndefined(); -} - -JSValue JSNode::removeEventListener(ExecState* exec, const ArgList& args) -{ - JSValue listener = args.at(1); - if (!listener.isObject()) - return jsUndefined(); - - impl()->removeEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); - return jsUndefined(); -} - void JSNode::pushEventHandlerScope(ExecState*, ScopeChain&) const { } @@ -199,6 +179,7 @@ void JSNode::markChildren(MarkStack& markStack) Node* node = m_impl.get(); node->markJSEventListeners(markStack); + node->markCachedNodeLists(markStack, *Heap::heap(this)->globalData()); // Nodes in the document are kept alive by JSDocument::mark, so, if we're in // the document, we need to mark the document, but we don't need to explicitly diff --git a/WebCore/bindings/js/JSNodeFilterCustom.cpp b/WebCore/bindings/js/JSNodeFilterCustom.cpp index 2a99a93..bb90c4f 100644 --- a/WebCore/bindings/js/JSNodeFilterCustom.cpp +++ b/WebCore/bindings/js/JSNodeFilterCustom.cpp @@ -41,11 +41,6 @@ void JSNodeFilter::markChildren(MarkStack& markStack) impl()->markAggregate(markStack); } -JSValue JSNodeFilter::acceptNode(ExecState* exec, const ArgList& args) -{ - return jsNumber(exec, impl()->acceptNode(exec, toNode(args.at(0)))); -} - PassRefPtr<NodeFilter> toNodeFilter(JSValue value) { if (value.inherits(&JSNodeFilter::s_info)) diff --git a/WebCore/bindings/js/JSNodeIteratorCustom.cpp b/WebCore/bindings/js/JSNodeIteratorCustom.cpp index 6a09abf..7c858e5 100644 --- a/WebCore/bindings/js/JSNodeIteratorCustom.cpp +++ b/WebCore/bindings/js/JSNodeIteratorCustom.cpp @@ -37,34 +37,4 @@ void JSNodeIterator::markChildren(MarkStack& markStack) filter->markAggregate(markStack); } -JSValue JSNodeIterator::nextNode(ExecState* exec, const ArgList&) -{ - ExceptionCode ec = 0; - RefPtr<Node> node = impl()->nextNode(exec, ec); - if (ec) { - setDOMException(exec, ec); - return jsUndefined(); - } - - if (exec->hadException()) - return jsUndefined(); - - return toJS(exec, node.get()); -} - -JSValue JSNodeIterator::previousNode(ExecState* exec, const ArgList&) -{ - ExceptionCode ec = 0; - RefPtr<Node> node = impl()->previousNode(exec, ec); - if (ec) { - setDOMException(exec, ec); - return jsUndefined(); - } - - if (exec->hadException()) - return jsUndefined(); - - return toJS(exec, node.get()); -} - } diff --git a/WebCore/bindings/js/JSPopStateEventCustom.cpp b/WebCore/bindings/js/JSPopStateEventCustom.cpp index ce430ab..14fc9d9 100644 --- a/WebCore/bindings/js/JSPopStateEventCustom.cpp +++ b/WebCore/bindings/js/JSPopStateEventCustom.cpp @@ -33,16 +33,6 @@ using namespace JSC; namespace WebCore { -JSValue JSPopStateEvent::initPopStateEvent(ExecState* exec, const ArgList& args) -{ - const UString& typeArg = args.at(0).toString(exec); - bool canBubbleArg = args.at(1).toBoolean(exec); - bool cancelableArg = args.at(2).toBoolean(exec); - RefPtr<SerializedScriptValue> stateObjectArg = SerializedScriptValue::create(exec, args.at(3)); - - PopStateEvent* event = static_cast<PopStateEvent*>(impl()); - event->initPopStateEvent(ustringToAtomicString(typeArg), canBubbleArg, cancelableArg, stateObjectArg.release()); - return jsUndefined(); -} +// FIXME: Remove this file. } // namespace WebCore diff --git a/WebCore/bindings/js/JSSQLTransactionCustom.cpp b/WebCore/bindings/js/JSSQLTransactionCustom.cpp index 81e6c63..802a384 100644 --- a/WebCore/bindings/js/JSSQLTransactionCustom.cpp +++ b/WebCore/bindings/js/JSSQLTransactionCustom.cpp @@ -33,8 +33,8 @@ #include "DOMWindow.h" #include "ExceptionCode.h" -#include "JSCustomSQLStatementCallback.h" -#include "JSCustomSQLStatementErrorCallback.h" +#include "JSSQLStatementCallback.h" +#include "JSSQLStatementErrorCallback.h" #include "JSDOMWindowCustom.h" #include "SQLTransaction.h" @@ -95,7 +95,7 @@ JSValue JSSQLTransaction::executeSql(ExecState* exec, const ArgList& args) return jsUndefined(); } - callback = JSCustomSQLStatementCallback::create(object, static_cast<JSDOMGlobalObject*>(exec->dynamicGlobalObject())); + callback = JSSQLStatementCallback::create(object, static_cast<JSDOMGlobalObject*>(exec->dynamicGlobalObject())); } RefPtr<SQLStatementErrorCallback> errorCallback; @@ -106,7 +106,7 @@ JSValue JSSQLTransaction::executeSql(ExecState* exec, const ArgList& args) return jsUndefined(); } - errorCallback = JSCustomSQLStatementErrorCallback::create(object, static_cast<JSDOMGlobalObject*>(exec->dynamicGlobalObject())); + errorCallback = JSSQLStatementErrorCallback::create(object, static_cast<JSDOMGlobalObject*>(exec->dynamicGlobalObject())); } ExceptionCode ec = 0; diff --git a/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp b/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp index fdcab06..ccf5ccd 100644 --- a/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp +++ b/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp @@ -46,26 +46,6 @@ void JSSVGElementInstance::markChildren(MarkStack& markStack) markDOMNodeWrapper(markStack, impl()->correspondingElement()->document(), impl()->correspondingElement()); } -JSValue JSSVGElementInstance::addEventListener(ExecState* exec, const ArgList& args) -{ - JSValue listener = args.at(1); - if (!listener.isObject()) - return jsUndefined(); - - impl()->addEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec)); - return jsUndefined(); -} - -JSValue JSSVGElementInstance::removeEventListener(ExecState* exec, const ArgList& args) -{ - JSValue listener = args.at(1); - if (!listener.isObject()) - return jsUndefined(); - - impl()->removeEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); - return jsUndefined(); -} - void JSSVGElementInstance::pushEventHandlerScope(ExecState*, ScopeChain&) const { } diff --git a/WebCore/bindings/js/JSTreeWalkerCustom.cpp b/WebCore/bindings/js/JSTreeWalkerCustom.cpp index f879cf4..0c1947f 100644 --- a/WebCore/bindings/js/JSTreeWalkerCustom.cpp +++ b/WebCore/bindings/js/JSTreeWalkerCustom.cpp @@ -36,61 +36,5 @@ void JSTreeWalker::markChildren(MarkStack& markStack) if (NodeFilter* filter = m_impl->filter()) filter->markAggregate(markStack); } - -JSValue JSTreeWalker::parentNode(ExecState* exec, const ArgList&) -{ - Node* node = impl()->parentNode(exec); - if (exec->hadException()) - return jsUndefined(); - return toJS(exec, node); -} - -JSValue JSTreeWalker::firstChild(ExecState* exec, const ArgList&) -{ - Node* node = impl()->firstChild(exec); - if (exec->hadException()) - return jsUndefined(); - return toJS(exec, node); -} - -JSValue JSTreeWalker::lastChild(ExecState* exec, const ArgList&) -{ - Node* node = impl()->lastChild(exec); - if (exec->hadException()) - return jsUndefined(); - return toJS(exec, node); -} - -JSValue JSTreeWalker::nextSibling(ExecState* exec, const ArgList&) -{ - Node* node = impl()->nextSibling(exec); - if (exec->hadException()) - return jsUndefined(); - return toJS(exec, node); -} - -JSValue JSTreeWalker::previousSibling(ExecState* exec, const ArgList&) -{ - Node* node = impl()->previousSibling(exec); - if (exec->hadException()) - return jsUndefined(); - return toJS(exec, node); -} - -JSValue JSTreeWalker::previousNode(ExecState* exec, const ArgList&) -{ - Node* node = impl()->previousNode(exec); - if (exec->hadException()) - return jsUndefined(); - return toJS(exec, node); -} - -JSValue JSTreeWalker::nextNode(ExecState* exec, const ArgList&) -{ - Node* node = impl()->nextNode(exec); - if (exec->hadException()) - return jsUndefined(); - return toJS(exec, node); -} } diff --git a/WebCore/bindings/js/JSWebGLArrayBufferConstructor.cpp b/WebCore/bindings/js/JSWebGLArrayBufferConstructor.cpp index 8671908..5f1f643 100644 --- a/WebCore/bindings/js/JSWebGLArrayBufferConstructor.cpp +++ b/WebCore/bindings/js/JSWebGLArrayBufferConstructor.cpp @@ -30,6 +30,7 @@ #include "JSWebGLArrayBufferConstructor.h" #include "Document.h" +#include "ExceptionCode.h" #include "JSWebGLArrayBuffer.h" namespace WebCore { diff --git a/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp b/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp index e336027..41000fd 100644 --- a/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp +++ b/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp @@ -32,10 +32,8 @@ #include "ExceptionCode.h" #include "HTMLCanvasElement.h" #include "HTMLImageElement.h" -#include "HTMLVideoElement.h" #include "JSHTMLCanvasElement.h" #include "JSHTMLImageElement.h" -#include "JSHTMLVideoElement.h" #include "JSImageData.h" #include "JSWebGLBuffer.h" #include "JSWebGLFloatArray.h" @@ -60,6 +58,11 @@ #include <wtf/FastMalloc.h> #include <wtf/OwnFastMallocPtr.h> +#if ENABLE(VIDEO) +#include "HTMLVideoElement.h" +#include "JSHTMLVideoElement.h" +#endif + using namespace JSC; namespace WebCore { @@ -352,9 +355,11 @@ JSValue JSWebGLRenderingContext::texImage2D(ExecState* exec, const ArgList& args } else if (o->inherits(&JSHTMLCanvasElement::s_info)) { HTMLCanvasElement* element = static_cast<HTMLCanvasElement*>(static_cast<JSHTMLCanvasElement*>(o)->impl()); context->texImage2D(target, level, element, flipY, premultiplyAlpha, ec); +#if ENABLE(VIDEO) } else if (o->inherits(&JSHTMLVideoElement::s_info)) { HTMLVideoElement* element = static_cast<HTMLVideoElement*>(static_cast<JSHTMLVideoElement*>(o)->impl()); context->texImage2D(target, level, element, flipY, premultiplyAlpha, ec); +#endif } else ec = TYPE_MISMATCH_ERR; } else { @@ -461,9 +466,11 @@ JSValue JSWebGLRenderingContext::texSubImage2D(ExecState* exec, const ArgList& a } else if (o->inherits(&JSHTMLCanvasElement::s_info)) { HTMLCanvasElement* element = static_cast<HTMLCanvasElement*>(static_cast<JSHTMLCanvasElement*>(o)->impl()); context->texSubImage2D(target, level, xoff, yoff, element, flipY, premultiplyAlpha, ec); +#if ENABLE(VIDEO) } else if (o->inherits(&JSHTMLVideoElement::s_info)) { HTMLVideoElement* element = static_cast<HTMLVideoElement*>(static_cast<JSHTMLVideoElement*>(o)->impl()); context->texSubImage2D(target, level, xoff, yoff, element, flipY, premultiplyAlpha, ec); +#endif } else ec = TYPE_MISMATCH_ERR; } else { diff --git a/WebCore/bindings/js/JSWebSocketCustom.cpp b/WebCore/bindings/js/JSWebSocketCustom.cpp index 18f4183..149ac5d 100644 --- a/WebCore/bindings/js/JSWebSocketCustom.cpp +++ b/WebCore/bindings/js/JSWebSocketCustom.cpp @@ -59,26 +59,6 @@ JSValue JSWebSocket::send(ExecState* exec, const ArgList& args) return ret; } -JSValue JSWebSocket::addEventListener(ExecState* exec, const ArgList& args) -{ - JSValue listener = args.at(1); - if (!listener.isObject()) - return jsUndefined(); - - impl()->addEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec)); - return jsUndefined(); -} - -JSValue JSWebSocket::removeEventListener(ExecState* exec, const ArgList& args) -{ - JSValue listener = args.at(1); - if (!listener.isObject()) - return jsUndefined(); - - impl()->removeEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); - return jsUndefined(); -} - } // namespace WebCore #endif diff --git a/WebCore/bindings/js/JSWorkerContextBase.cpp b/WebCore/bindings/js/JSWorkerContextBase.cpp index 2491f4d..effe488 100644 --- a/WebCore/bindings/js/JSWorkerContextBase.cpp +++ b/WebCore/bindings/js/JSWorkerContextBase.cpp @@ -71,7 +71,9 @@ JSValue toJS(ExecState*, WorkerContext* workerContext) WorkerScriptController* script = workerContext->script(); if (!script) return jsNull(); - return script->workerContextWrapper(); + JSWorkerContext* contextWrapper = script->workerContextWrapper(); + ASSERT(contextWrapper); + return contextWrapper; } JSDedicatedWorkerContext* toJSDedicatedWorkerContext(JSValue value) diff --git a/WebCore/bindings/js/JSWorkerContextCustom.cpp b/WebCore/bindings/js/JSWorkerContextCustom.cpp index 0a9489b..a70c1b3 100644 --- a/WebCore/bindings/js/JSWorkerContextCustom.cpp +++ b/WebCore/bindings/js/JSWorkerContextCustom.cpp @@ -116,26 +116,6 @@ JSValue JSWorkerContext::importScripts(ExecState* exec, const ArgList& args) return jsUndefined(); } -JSValue JSWorkerContext::addEventListener(ExecState* exec, const ArgList& args) -{ - JSValue listener = args.at(1); - if (!listener.isObject()) - return jsUndefined(); - - impl()->addEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec)); - return jsUndefined(); -} - -JSValue JSWorkerContext::removeEventListener(ExecState* exec, const ArgList& args) -{ - JSValue listener = args.at(1); - if (!listener.isObject()) - return jsUndefined(); - - impl()->removeEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); - return jsUndefined(); -} - JSValue JSWorkerContext::setTimeout(ExecState* exec, const ArgList& args) { OwnPtr<ScheduledAction> action = ScheduledAction::create(exec, args, currentWorld(exec)); diff --git a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp index da83801..fc72154 100644 --- a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp +++ b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp @@ -153,26 +153,6 @@ JSValue JSXMLHttpRequest::overrideMimeType(ExecState* exec, const ArgList& args) return jsUndefined(); } -JSValue JSXMLHttpRequest::addEventListener(ExecState* exec, const ArgList& args) -{ - JSValue listener = args.at(1); - if (!listener.isObject()) - return jsUndefined(); - - impl()->addEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec)); - return jsUndefined(); -} - -JSValue JSXMLHttpRequest::removeEventListener(ExecState* exec, const ArgList& args) -{ - JSValue listener = args.at(1); - if (!listener.isObject()) - return jsUndefined(); - - impl()->removeEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); - return jsUndefined(); -} - JSValue JSXMLHttpRequest::responseText(ExecState* exec) const { return jsOwnedStringOrNull(exec, impl()->responseText()); diff --git a/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp b/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp index 42d4eb9..091c380 100644 --- a/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp +++ b/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp @@ -51,24 +51,4 @@ void JSXMLHttpRequestUpload::markChildren(MarkStack& markStack) m_impl->markJSEventListeners(markStack); } -JSValue JSXMLHttpRequestUpload::addEventListener(ExecState* exec, const ArgList& args) -{ - JSValue listener = args.at(1); - if (!listener.isObject()) - return jsUndefined(); - - impl()->addEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec)); - return jsUndefined(); -} - -JSValue JSXMLHttpRequestUpload::removeEventListener(ExecState* exec, const ArgList& args) -{ - JSValue listener = args.at(1); - if (!listener.isObject()) - return jsUndefined(); - - impl()->removeEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); - return jsUndefined(); -} - } // namespace WebCore diff --git a/WebCore/bindings/js/ScriptController.cpp b/WebCore/bindings/js/ScriptController.cpp index b3695b4..508b2f8 100644 --- a/WebCore/bindings/js/ScriptController.cpp +++ b/WebCore/bindings/js/ScriptController.cpp @@ -36,6 +36,7 @@ #include "ScriptValue.h" #include "Settings.h" #include "StorageNamespace.h" +#include "UserGestureIndicator.h" #include "WebCoreJSClientData.h" #include "XSSAuditor.h" #include "npruntime_impl.h" @@ -43,6 +44,7 @@ #include <debugger/Debugger.h> #include <runtime/InitializeThreading.h> #include <runtime/JSLock.h> +#include <wtf/Threading.h> using namespace JSC; using namespace std; @@ -52,6 +54,7 @@ namespace WebCore { void ScriptController::initializeThreading() { JSC::initializeThreading(); + WTF::initializeMainThread(); } ScriptController::ScriptController(Frame* frame) @@ -70,7 +73,7 @@ ScriptController::ScriptController(Frame* frame) #endif , m_XSSAuditor(new XSSAuditor(frame)) { -#if PLATFORM(MAC) && ENABLE(MAC_JAVA_BRIDGE) +#if PLATFORM(MAC) && ENABLE(JAVA_BRIDGE) static bool initializedJavaJSBindings; if (!initializedJavaJSBindings) { initializedJavaJSBindings = true; @@ -226,19 +229,16 @@ JSDOMWindowShell* ScriptController::initScript(DOMWrapperWorld* world) bool ScriptController::processingUserGesture(DOMWrapperWorld* world) const { - return m_allowPopupsFromPlugin || processingUserGestureEvent(world) || isJavaScriptAnchorNavigation(); -} + if (m_allowPopupsFromPlugin || isJavaScriptAnchorNavigation()) + return true; -bool ScriptController::processingUserGestureEvent(DOMWrapperWorld* world) const -{ - JSDOMWindowShell* shell = existingWindowShell(world); - if (!shell) - return false; + // If a DOM event is being processed, check that it was initiated by the user + // and that it is in the whitelist of event types allowed to generate pop-ups. + if (JSDOMWindowShell* shell = existingWindowShell(world)) + if (Event* event = shell->window()->currentEvent()) + return event->fromUserGesture(); - if (Event* event = shell->window()->currentEvent()) - return event->fromUserGesture(); - - return false; + return UserGestureIndicator::processingUserGesture(); } // FIXME: This seems like an insufficient check to verify a click on a javascript: anchor. diff --git a/WebCore/bindings/js/ScriptController.h b/WebCore/bindings/js/ScriptController.h index d096c2e..468ac5c 100644 --- a/WebCore/bindings/js/ScriptController.h +++ b/WebCore/bindings/js/ScriptController.h @@ -152,7 +152,7 @@ public: PassRefPtr<JSC::Bindings::RootObject> createRootObject(void* nativeHandle); #if PLATFORM(MAC) -#if ENABLE(MAC_JAVA_BRIDGE) +#if ENABLE(JAVA_BRIDGE) static void initJavaJSBindings(); #endif WebScriptObject* windowScriptObject(); @@ -172,7 +172,6 @@ private: void disconnectPlatformScriptObjects(); - bool processingUserGestureEvent(DOMWrapperWorld*) const; bool isJavaScriptAnchorNavigation() const; ShellMap m_windowShells; diff --git a/WebCore/bindings/js/ScriptControllerEfl.cpp b/WebCore/bindings/js/ScriptControllerEfl.cpp new file mode 100644 index 0000000..950c11e --- /dev/null +++ b/WebCore/bindings/js/ScriptControllerEfl.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com + * Copyright (C) 2007 Holger Hans Peter Freyther + * Copyright (C) 2008 Collabora Ltd. All rights reserved. + * Copyright (C) 2008 Eric Seidel <eric@webkit.org> + * Copyright (C) 2009,2010 ProFUSION embedded systems + * Copyright (C) 2009,2010 Samsung Electronics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 "ScriptController.h" + +#include "PluginView.h" + +namespace WebCore { + +PassRefPtr<JSC::Bindings::Instance> ScriptController::createScriptInstanceForWidget(Widget* widget) +{ + return 0; + +#if 0 // FIXME: disabled until we have Plugin system done. + if (!widget->isPluginView()) + return 0; + + return static_cast<PluginView*>(widget)->bindingInstance(); +#endif +} + +} diff --git a/WebCore/bindings/js/ScriptControllerMac.mm b/WebCore/bindings/js/ScriptControllerMac.mm index a895489..7c29bfc 100644 --- a/WebCore/bindings/js/ScriptControllerMac.mm +++ b/WebCore/bindings/js/ScriptControllerMac.mm @@ -49,7 +49,7 @@ #import "npruntime_impl.h" #endif -#if ENABLE(MAC_JAVA_BRIDGE) +#if ENABLE(JAVA_BRIDGE) #import "JavaInstanceJSC.h" #endif @@ -95,7 +95,7 @@ PassScriptInstance ScriptController::createScriptInstanceForWidget(Widget* widge #endif } -#if ENABLE(MAC_JAVA_BRIDGE) +#if ENABLE(JAVA_BRIDGE) jobject applet = m_frame->loader()->client()->javaApplet(widgetView); if (!applet) return 0; @@ -136,7 +136,7 @@ void ScriptController::disconnectPlatformScriptObjects() } } -#if ENABLE(MAC_JAVA_BRIDGE) +#if ENABLE(JAVA_BRIDGE) static pthread_t mainThread; diff --git a/WebCore/bindings/js/ScriptEventListener.cpp b/WebCore/bindings/js/ScriptEventListener.cpp index 01b9060..467f16b 100644 --- a/WebCore/bindings/js/ScriptEventListener.cpp +++ b/WebCore/bindings/js/ScriptEventListener.cpp @@ -105,7 +105,7 @@ PassRefPtr<JSLazyEventListener> createAttributeEventListener(Frame* frame, Attri return JSLazyEventListener::create(attr->localName().string(), eventParameterName(frame->document()->isSVGDocument()), attr->value(), 0, sourceURL, lineNumber, wrapper, mainThreadNormalWorld()); } -String getEventListenerHandlerBody(ScriptExecutionContext* context, ScriptState* scriptState, EventListener* eventListener) +String eventListenerHandlerBody(ScriptExecutionContext* context, ScriptState* scriptState, EventListener* eventListener) { const JSEventListener* jsListener = JSEventListener::cast(eventListener); if (!jsListener) @@ -116,4 +116,10 @@ String getEventListenerHandlerBody(ScriptExecutionContext* context, ScriptState* return ustringToString(jsFunction->toString(scriptState)); } +bool eventListenerHandlerLocation(ScriptExecutionContext*, ScriptState*, EventListener*, String&, int&) +{ + // FIXME: Add support for getting function location. + return false; +} + } // namespace WebCore diff --git a/WebCore/bindings/js/ScriptEventListener.h b/WebCore/bindings/js/ScriptEventListener.h index 3396541..f1f203c 100644 --- a/WebCore/bindings/js/ScriptEventListener.h +++ b/WebCore/bindings/js/ScriptEventListener.h @@ -45,8 +45,8 @@ namespace WebCore { PassRefPtr<JSLazyEventListener> createAttributeEventListener(Node*, Attribute*); PassRefPtr<JSLazyEventListener> createAttributeEventListener(Frame*, Attribute*); - String getEventListenerHandlerBody(ScriptExecutionContext*, ScriptState*, EventListener*); - + String eventListenerHandlerBody(ScriptExecutionContext*, ScriptState*, EventListener*); + bool eventListenerHandlerLocation(ScriptExecutionContext*, ScriptState*, EventListener*, String& sourceName, int& lineNumber); } // namespace WebCore #endif // ScriptEventListener_h diff --git a/WebCore/bindings/js/ScriptWrappable.h b/WebCore/bindings/js/ScriptWrappable.h index 5e99c1c..c57796c 100644 --- a/WebCore/bindings/js/ScriptWrappable.h +++ b/WebCore/bindings/js/ScriptWrappable.h @@ -38,8 +38,6 @@ namespace WebCore { class ScriptWrappable { public: - ScriptWrappable() : m_wrapper(0) { } - DOMObject* wrapper() const { return m_wrapper.get(); @@ -47,7 +45,6 @@ public: void setWrapper(DOMObject* wrapper) { - ASSERT(wrapper); m_wrapper = wrapper; } diff --git a/WebCore/bindings/js/WorkerScriptController.h b/WebCore/bindings/js/WorkerScriptController.h index 38c3c30..60c3b04 100644 --- a/WebCore/bindings/js/WorkerScriptController.h +++ b/WebCore/bindings/js/WorkerScriptController.h @@ -52,9 +52,6 @@ namespace WebCore { JSWorkerContext* workerContextWrapper() { - if (m_executionForbidden) - return 0; - initScriptIfNeeded(); return m_workerContextWrapper; } @@ -66,6 +63,7 @@ namespace WebCore { enum ForbidExecutionOption { TerminateRunningScript, LetRunningScriptFinish }; void forbidExecution(ForbidExecutionOption); + bool isExecutionForbidden() const { return m_executionForbidden; } JSC::JSGlobalData* globalData() { return m_globalData.get(); } diff --git a/WebCore/bindings/objc/WebScriptObject.mm b/WebCore/bindings/objc/WebScriptObject.mm index 618459a..1cec41c 100644 --- a/WebCore/bindings/objc/WebScriptObject.mm +++ b/WebCore/bindings/objc/WebScriptObject.mm @@ -49,6 +49,7 @@ #import <runtime/JSLock.h> #import <runtime/Completion.h> #import <runtime/Completion.h> +#import <wtf/Threading.h> #ifdef BUILDING_ON_TIGER typedef unsigned NSUInteger; @@ -109,6 +110,7 @@ static void addExceptionToConsole(ExecState* exec) + (void)initialize { JSC::initializeThreading(); + WTF::initializeMainThreadToProcessMainThread(); #ifndef BUILDING_ON_TIGER WebCoreObjCFinalizeOnMainThread(self); #endif diff --git a/WebCore/bindings/scripts/CodeGeneratorGObject.pm b/WebCore/bindings/scripts/CodeGeneratorGObject.pm index 2a38eff..1d03f08 100644 --- a/WebCore/bindings/scripts/CodeGeneratorGObject.pm +++ b/WebCore/bindings/scripts/CodeGeneratorGObject.pm @@ -26,6 +26,10 @@ package CodeGeneratorGObject; my %implIncludes = (); my %hdrIncludes = (); +my @txtInstallProps = (); +my @txtSetProps = (); +my @txtGetProps = (); + my $className = ""; # Default constructor @@ -95,6 +99,16 @@ sub decamelize $s; } +sub FixUpDecamelizedName { + my $classname = shift; + + # FIXME: try to merge this somehow with the fixes in ClassNameToGobjectType + $classname =~ s/x_path/xpath/; + $classname =~ s/web_kit/webkit/; + + return $classname; +} + sub ClassNameToGObjectType { my $className = shift; my $CLASS_NAME = uc(decamelize($className)); @@ -102,6 +116,11 @@ sub ClassNameToGObjectType { # WebKitDOMCSS right, so we have to fix it manually (and there # might be more like this in the future) $CLASS_NAME =~ s/DOMCSS/DOM_CSS/; + $CLASS_NAME =~ s/DOMHTML/DOM_HTML/; + $CLASS_NAME =~ s/DOMDOM/DOM_DOM/; + $CLASS_NAME =~ s/DOMCDATA/DOM_CDATA/; + $CLASS_NAME =~ s/DOMX_PATH/DOM_XPATH/; + $CLASS_NAME =~ s/DOM_WEB_KIT/DOM_WEBKIT/; return $CLASS_NAME; } @@ -128,7 +147,8 @@ sub SkipAttribute { my $attribute = shift; if ($attribute->signature->extendedAttributes->{"CustomGetter"} || - $attribute->signature->extendedAttributes->{"CustomSetter"}) { + $attribute->signature->extendedAttributes->{"CustomSetter"} || + $attribute->signature->extendedAttributes->{"Replaceable"}) { return 1; } @@ -141,6 +161,55 @@ sub SkipAttribute { return 1; } + # This is for DOMWindow.idl location attribute + if ($attribute->signature->name eq "location") { + return 1; + } + + # This is for HTMLInput.idl valueAsDate + if ($attribute->signature->name eq "valueAsDate") { + return 1; + } + + # This is for DOMWindow.idl Crypto attribute + if ($attribute->signature->type eq "Crypto") { + return 1; + } + + return 0; +} + +sub SkipFunction { + my $function = shift; + my $decamelize = shift; + my $prefix = shift; + + my $functionName = "webkit_dom_" . $decamelize . "_" . $prefix . decamelize($function->signature->name); + my $isCustomFunction = $function->signature->extendedAttributes->{"Custom"} || + $function->signature->extendedAttributes->{"CustomArgumentHandling"}; + + if ($isCustomFunction && + $functionName ne "webkit_dom_node_replace_child" && + $functionName ne "webkit_dom_node_insert_before" && + $functionName ne "webkit_dom_node_replace_child" && + $functionName ne "webkit_dom_node_append_child" && + $functionName ne "webkit_dom_html_collection_item" && + $functionName ne "webkit_dom_html_collection_named_item") { + return 1; + } + + if ($function->signature->type eq "Event") { + return 1; + } + + if ($function->signature->name eq "getSVGDocument") { + return 1; + } + + if ($function->signature->name eq "getCSSCanvasContext") { + return 1; + } + return 0; } @@ -154,6 +223,7 @@ sub GetGValueTypeName { "boolean", "boolean", "char", "char", "long", "long", + "long long", "int64", "short", "int", "uchar", "uchar", "unsigned", "uint", @@ -172,11 +242,13 @@ sub GetGlibTypeName { my $name = GetClassName($type); my %types = ("DOMString", "gchar* ", + "CompareHow", "gushort", "float", "gfloat", "double", "gdouble", "boolean", "gboolean", "char", "gchar", "long", "glong", + "long long", "gint64", "short", "gshort", "uchar", "guchar", "unsigned", "guint", @@ -193,30 +265,192 @@ sub GetGlibTypeName { sub IsGDOMClassType { my $type = shift; - return 0 if $type eq "DOMString"; - return 0 if $type eq "float"; - return 0 if $type eq "double"; - return 0 if $type eq "boolean"; - return 0 if $type eq "char"; - return 0 if $type eq "long"; - return 0 if $type eq "short"; - return 0 if $type eq "uchar"; - return 0 if $type eq "unsigned"; - return 0 if $type eq "int"; - return 0 if $type eq "unsigned int"; - return 0 if $type eq "unsigned long"; - return 0 if $type eq "unsigned long long"; - return 0 if $type eq "unsigned short"; - return 0 if $type eq "void"; - + return 0 if $codeGenerator->IsNonPointerType($type) || $codeGenerator->IsStringType($type); return 1; } +sub GetReadableProperties { + my $properties = shift; + + my @result = (); + + foreach my $property (@{$properties}) { + if (!SkipAttribute($property)) { + push(@result, $property); + } + } + + return @result; +} + +sub GetWriteableProperties { + my $properties = shift; + my @result = (); + + foreach my $property (@{$properties}) { + my $writeable = $property->type !~ /^readonly/; + my $gtype = GetGValueTypeName($property->signature->type); + my $hasGtypeSignature = ($gtype eq "boolean" || $gtype eq "float" || $gtype eq "double" || + $gtype eq "uint64" || $gtype eq "ulong" || $gtype eq "long" || + $gtype eq "uint" || $gtype eq "ushort" || $gtype eq "uchar" || + $gtype eq "char" || $gtype eq "string"); + if ($writeable && $hasGtypeSignature) { + push(@result, $property); + } + } + + return @result; +} + +sub GenerateProperty { + my $attribute = shift; + my $interfaceName = shift; + my @writeableProperties = @{shift @_}; + + my $camelPropName = $attribute->signature->name; + my $setPropNameFunction = $codeGenerator->WK_ucfirst($camelPropName); + my $getPropNameFunction = $codeGenerator->WK_lcfirst($camelPropName); + + my $propName = decamelize($camelPropName); + my $propNameCaps = uc($propName); + $propName =~ s/_/-/g; + my ${propEnum} = "PROP_${propNameCaps}"; + push(@cBodyPriv, " ${propEnum},\n"); + + my $propType = $attribute->signature->type; + my ${propGType} = decamelize($propType); + if ($propGType eq "event_target") { + $propGType = "event_target_node"; + } + my ${ucPropGType} = uc($propGType); + + my $gtype = GetGValueTypeName($propType); + my $gparamflag = "WEBKIT_PARAM_READABLE"; + my $writeable = $attribute->type !~ /^readonly/; + my $const = "read-only "; + my $custom = $attribute->signature->extendedAttributes->{"Custom"}; + if ($writeable && $custom) { + $const = "read-only (due to custom functions needed in webkitdom)"; + return; + } + if ($writeable && !$custom) { + $gparamflag = "WEBKIT_PARAM_READWRITE"; + $const = "read-write "; + } + + my $type = GetGlibTypeName($propType); + $nick = decamelize("${interfaceName}_${propName}"); + $long = "${const} ${type} ${interfaceName}.${propName}"; + + my $convertFunction = ""; + if ($gtype eq "string") { + $convertFunction = "WebCore::String::fromUTF8"; + } elsif ($attribute->signature->extendedAttributes->{"ConvertFromString"}) { + $convertFunction = "WebCore::String::number"; + } + + my $setterContentHead; + my $getterContentHead; + my $reflect = $attribute->signature->extendedAttributes->{"Reflect"}; + my $reflectURL = $attribute->signature->extendedAttributes->{"ReflectURL"}; + if ($reflect || $reflectURL) { + my $contentAttributeName = (($reflect || $reflectURL) eq "1") ? $camelPropName : ($reflect || $reflectURL); + my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); + $implIncludes{"${namespace}.h"} = 1; + my $getAttributeFunctionName = $reflectURL ? "getURLAttribute" : "getAttribute"; + $setterContentHead = "coreSelf->setAttribute(WebCore::${namespace}::${contentAttributeName}Attr, ${convertFunction}(g_value_get_$gtype(value))"; + $getterContentHead = "coreSelf->${getAttributeFunctionName}(WebCore::${namespace}::${contentAttributeName}Attr"; + } else { + $setterContentHead = "coreSelf->set${setPropNameFunction}(${convertFunction}(g_value_get_$gtype(value))"; + $getterContentHead = "coreSelf->${getPropNameFunction}("; + } + + if (grep {$_ eq $attribute} @writeableProperties) { + push(@txtSetProps, " case ${propEnum}:\n {\n"); + push(@txtSetProps, " WebCore::ExceptionCode ec = 0;\n") if @{$attribute->setterExceptions}; + push(@txtSetProps, " ${setterContentHead}"); + push(@txtSetProps, ", ec") if @{$attribute->setterExceptions}; + push(@txtSetProps, ");\n"); + push(@txtSetProps, " break;\n }\n"); + } + + push(@txtGetProps, " case ${propEnum}:\n {\n"); + + my $exception = ""; + if (@{$attribute->getterExceptions}) { + $exception = "ec"; + push(@txtGetProps, " WebCore::ExceptionCode ec = 0;\n"); + } + + my $postConvertFunction = ""; + my $done = 0; + if ($gtype eq "string") { + push(@txtGetProps, " g_value_take_string(value, convertToUTF8String(${getterContentHead}${exception})));\n"); + $done = 1; + } elsif ($gtype eq "object") { + $txtGetProp = << "EOF"; + RefPtr<WebCore::${propType}> ptr = coreSelf->${getPropNameFunction}(${exception}); + g_value_set_object(value, WebKit::kit(ptr.get())); +EOF + push(@txtGetProps, $txtGetProp); + $done = 1; + } + + if($attribute->signature->extendedAttributes->{"ConvertFromString"}) { + # TODO: Add other conversion functions for different types. Current + # IDLs only list longs. + if($gtype eq "long") { + $convertFunction = ""; + $postConvertFunction = ".toInt()"; + } else { + die "Can't convert to type ${gtype}."; + } + } + + # FIXME: get rid of this glitch? + my $_gtype = $gtype; + if ($gtype eq "ushort") { + $_gtype = "uint"; + } + + if (!$done) { + push(@txtGetProps, " g_value_set_$_gtype(value, ${convertFunction}coreSelf->${getPropNameFunction}(${exception})${postConvertFunction});\n"); + } + + push(@txtGetProps, " break;\n }\n"); + + my %param_spec_options = ("int", "G_MININT, /* min */\nG_MAXINT, /* max */\n0, /* default */", + "boolean", "FALSE, /* default */", + "float", "-G_MAXFLOAT, /* min */\nG_MAXFLOAT, /* max */\n0.0, /* default */", + "double", "-G_MAXDOUBLE, /* min */\nG_MAXDOUBLE, /* max */\n0.0, /* default */", + "uint64", "0, /* min */\nG_MAXUINT64, /* min */\n0, /* default */", + "long", "G_MINLONG, /* min */\nG_MAXLONG, /* max */\n0, /* default */", + "int64", "G_MININT64, /* min */\nG_MAXINT64, /* max */\n0, /* default */", + "ulong", "0, /* min */\nG_MAXULONG, /* max */\n0, /* default */", + "uint", "0, /* min */\nG_MAXUINT, /* max */\n0, /* default */", + "ushort", "0, /* min */\nG_MAXUINT16, /* max */\n0, /* default */", + "uchar", "G_MININT8, /* min */\nG_MAXINT8, /* max */\n0, /* default */", + "char", "0, /* min */\nG_MAXUINT8, /* max */\n0, /* default */", + "string", "\"\", /* default */", + "object", "WEBKIT_TYPE_DOM_${ucPropGType}, /* gobject type */"); + + my $txtInstallProp = << "EOF"; + g_object_class_install_property(gobjectClass, + ${propEnum}, + g_param_spec_${_gtype}("${propName}", /* name */ + "$nick", /* short description */ + "$long", /* longer - could do with some extra doc stuff here */ + $param_spec_options{$gtype} + ${gparamflag})); +EOF + push(@txtInstallProps, $txtInstallProp); +} + sub GenerateProperties { my ($object, $interfaceName, $dataNode) = @_; my $clsCaps = substr(ClassNameToGObjectType($className), 12); - my $lowerCaseIfaceName = "webkit_dom_" . (decamelize($interfaceName)); + my $lowerCaseIfaceName = "webkit_dom_" . (FixUpDecamelizedName(decamelize($interfaceName))); # Properties my $implContent = ""; @@ -228,169 +462,51 @@ enum { EOF push(@cBodyPriv, $implContent); - my @txtInstallProps = (); - my @txtSetProps = (); - my @txtGetProps = (); + my @readableProperties = GetReadableProperties($dataNode->attributes); my $privFunction = GetCoreObject($interfaceName, "coreSelf", "self"); my $txtGetProp = << "EOF"; static void ${lowerCaseIfaceName}_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) { +EOF + push(@txtGetProps, $txtGetProp); + if (scalar @readableProperties > 0) { + $txtGetProp = << "EOF"; ${className}* self = WEBKIT_DOM_${clsCaps}(object); $privFunction +EOF + push(@txtGetProps, $txtGetProp); + } + $txtGetProp = << "EOF"; switch (prop_id) { EOF push(@txtGetProps, $txtGetProp); + my @writeableProperties = GetWriteableProperties(\@readableProperties); + my $txtSetProps = << "EOF"; static void ${lowerCaseIfaceName}_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec) { +EOF + push(@txtSetProps, $txtSetProps); + + if (scalar @writeableProperties > 0) { + $txtSetProps = << "EOF"; ${className} *self = WEBKIT_DOM_${clsCaps}(object); $privFunction +EOF + push(@txtSetProps, $txtSetProps); + } + $txtSetProps = << "EOF"; switch (prop_id) { EOF push(@txtSetProps, $txtSetProps); - # Iterate over the interface attributes and generate a property for - # each one of them. - SKIPENUM: - foreach my $attribute (@{$dataNode->attributes}) { - if (SkipAttribute($attribute)) { - next SKIPENUM; - } - - my $camelPropName = $attribute->signature->name; - my $setPropNameFunction = $codeGenerator->WK_ucfirst($camelPropName); - my $getPropNameFunction = $codeGenerator->WK_lcfirst($camelPropName); - - my $propName = decamelize($camelPropName); - my $propNameCaps = uc($propName); - $propName =~ s/_/-/g; - my ${propEnum} = "PROP_${propNameCaps}"; - push(@cBodyPriv, " ${propEnum},\n"); - - my $propType = $attribute->signature->type; - my ${propGType} = decamelize($propType); - if ($propGType eq "event_target") { - $propGType = "event_target_node"; - } - my ${ucPropGType} = uc($propGType); - - my $gtype = GetGValueTypeName($propType); - my $gparamflag = "WEBKIT_PARAM_READABLE"; - my $writeable = $attribute->type !~ /^readonly/; - my $const = "read-only "; - if ($writeable && $custom) { - $const = "read-only (due to custom functions needed in webkitdom)"; - next SKIPENUM; - } - if ($writeable && !$custom) { - $gparamflag = "WEBKIT_PARAM_READWRITE"; - $const = "read-write "; - } - - my $type = GetGlibTypeName($propType); - $nick = decamelize("${interfaceName}_${propName}"); - $long = "${const} ${type} ${interfaceName}.${propName}"; - - my $convertFunction = ""; - - if ($writeable && ($gtype eq "boolean" || $gtype eq "float" || $gtype eq "double" || - $gtype eq "uint64" || $gtype eq "ulong" || $gtype eq "long" || - $gtype eq "uint" || $gtype eq "ushort" || $gtype eq "uchar" || - $gtype eq "char" || $gtype eq "string")) { - - push(@txtSetProps, " case ${propEnum}:\n {\n"); - push(@txtSetProps, " WebCore::ExceptionCode ec = 0;\n") if @{$attribute->setterExceptions}; - - if ($gtype eq "string") { - $convertFunction = "WebCore::String::fromUTF8"; - } elsif ($attribute->signature->extendedAttributes->{"ConvertFromString"}) { - $convertFunction = "WebCore::String::number"; - } - - push(@txtSetProps, " coreSelf->set${setPropNameFunction}(${convertFunction}(g_value_get_$gtype(value))"); - push(@txtSetProps, ", ec") if @{$attribute->setterExceptions}; - push(@txtSetProps, ");\n"); - - push(@txtSetProps, " break;\n }\n"); - } - - push(@txtGetProps, " case ${propEnum}:\n {\n"); - - my $exception = ""; - if (@{$attribute->getterExceptions}) { - $exception = "ec"; - push(@txtGetProps, " WebCore::ExceptionCode ec = 0;\n"); - } - - my $postConvertFunction = ""; - my $done = 0; - if ($gtype eq "string") { - push(@txtGetProps, " g_value_take_string(value, convertToUTF8String(coreSelf->${getPropNameFunction}(${exception})));\n"); - $done = 1; - } elsif ($gtype eq "object") { - - $txtGetProp = << "EOF"; - RefPtr<WebCore::${propType}> ptr = coreSelf->${getPropNameFunction}(${exception}); - g_value_set_object(value, WebKit::kit(ptr.get())); -EOF - push(@txtGetProps, $txtGetProp); - - $done = 1; - } - - if($attribute->signature->extendedAttributes->{"ConvertFromString"}) { - # TODO: Add other conversion functions for different types. Current - # IDLs only list longs. - if($gtype eq "long") { - $convertFunction = ""; - $postConvertFunction = ".toInt()"; - } else { - die "Can't convert to type ${gtype}."; - } - } - - # FIXME: get rid of this glitch? - my $_gtype = $gtype; - if ($gtype eq "ushort") { - $_gtype = "uint"; - } - - if (!$done) { - push(@txtGetProps, " g_value_set_$_gtype(value, ${convertFunction}coreSelf->${getPropNameFunction}(${exception})${postConvertFunction});\n"); - } - - push(@txtGetProps, " break;\n }\n"); - -my %param_spec_options = ("int", "G_MININT, /* min */\nG_MAXINT, /* max */\n0, /* default */", - "boolean", "FALSE, /* default */", - "float", "G_MINFLOAT, /* min */\nG_MAXFLOAT, /* max */\n0.0, /* default */", - "double", "G_MINDOUBLE, /* min */\nG_MAXDOUBLE, /* max */\n0.0, /* default */", - "uint64", "0, /* min */\nG_MAXUINT64, /* min */\n0, /* default */", - "long", "G_MINLONG, /* min */\nG_MAXLONG, /* max */\n0, /* default */", - "ulong", "0, /* min */\nG_MAXULONG, /* max */\n0, /* default */", - "uint", "0, /* min */\nG_MAXUINT, /* max */\n0, /* default */", - "ushort", "0, /* min */\nG_MAXUINT16, /* max */\n0, /* default */", - "uchar", "G_MININT8, /* min */\nG_MAXINT8, /* max */\n0, /* default */", - "char", "0, /* min */\nG_MAXUINT8, /* max */\n0, /* default */", - "string", "\"\", /* default */", - "object", "WEBKIT_TYPE_DOM_${ucPropGType}, /* gobject type */"); - - my $txtInstallProp = << "EOF"; - g_object_class_install_property(gobjectClass, - ${propEnum}, - g_param_spec_${_gtype}("${propName}", /* name */ - "$nick", /* short description */ - "$long", /* longer - could do with some extra doc stuff here */ - $param_spec_options{$gtype} - ${gparamflag})); -EOF - push(@txtInstallProps, $txtInstallProp); - $txtInstallProp = "/* TODO! $gtype */\n"; + foreach my $attribute (@readableProperties) { + GenerateProperty($attribute, $interfaceName, \@writeableProperties); } push(@cBodyPriv, "};\n\n"); @@ -483,11 +599,11 @@ EOF push(@hBodyPre, $implContent); - my $clsCaps = uc(decamelize($interfaceName)); - my $lowerCaseIfaceName = "webkit_dom_" . (decamelize($interfaceName)); + my $decamelize = FixUpDecamelizedName(decamelize($interfaceName)); + my $clsCaps = uc($decamelize); + my $lowerCaseIfaceName = "webkit_dom_" . ($decamelize); $implContent = << "EOF"; - #define WEBKIT_TYPE_DOM_${clsCaps} (${lowerCaseIfaceName}_get_type()) #define WEBKIT_DOM_${clsCaps}(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_DOM_${clsCaps}, ${className})) #define WEBKIT_DOM_${clsCaps}_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_DOM_${clsCaps}, ${className}Class) @@ -517,6 +633,7 @@ sub getIncludeHeader { return "" if $type eq "int"; return "" if $type eq "long"; + return "" if $type eq "long long"; return "" if $type eq "short"; return "" if $type eq "char"; return "" if $type eq "float"; @@ -533,6 +650,7 @@ sub getIncludeHeader { return "" if $type eq "float"; return "" if $type eq "boolean"; return "" if $type eq "void"; + return "" if $type eq "CompareHow"; return "$name.h"; } @@ -540,6 +658,10 @@ sub getIncludeHeader { sub addIncludeInBody { my $type = shift; + if ($type eq "DOMObject") { + return; + } + my $header = getIncludeHeader($type); if ($header eq "") { return; @@ -555,9 +677,15 @@ sub addIncludeInBody { sub GenerateFunction { my ($object, $interfaceName, $function, $prefix) = @_; + my $decamelize = FixUpDecamelizedName(decamelize($interfaceName)); + + if (SkipFunction($function, $decamelize, $prefix)) { + return; + } + my $functionSigName = $function->signature->name; my $functionSigType = $function->signature->type; - my $functionName = "webkit_dom_" . decamelize($interfaceName) . "_" . $prefix . decamelize($functionSigName); + my $functionName = "webkit_dom_" . $decamelize . "_" . $prefix . decamelize($functionSigName); my $returnType = GetGlibTypeName($functionSigType); my $returnValueIsGDOMType = IsGDOMClassType($functionSigType); @@ -571,7 +699,7 @@ sub GenerateFunction { foreach my $param (@{$function->parameters}) { my $paramIDLType = $param->type; - if ($paramIDLType eq "Event") { + if ($paramIDLType eq "Event" || $paramIDLType eq "EventListener") { push(@hBody, "\n/* TODO: event function ${functionName} */\n\n"); push(@cBody, "\n/* TODO: event function ${functionName} */\n\n"); return; @@ -588,7 +716,7 @@ sub GenerateFunction { $implIncludes{"webkit/WebKitDOM${paramIDLType}Private.h"} = 1; } } - if ($paramIsGDOMType || ($paramIDLType eq "DOMString")) { + if ($paramIsGDOMType || ($paramIDLType eq "DOMString") || ($paramIDLType eq "CompareHow")) { $paramName = "_g_" . $paramName; } if ($callImplParams) { @@ -598,13 +726,7 @@ sub GenerateFunction { } } - if ($functionSigType eq "Event") { - push(@hBody, "\n/* TODO: event function ${functionName} */\n\n"); - push(@cBody, "\n/* TODO: event function ${functionName} */\n\n"); - return; - } - - if ($returnType ne "void" && $returnValueIsGDOMType) { + if ($returnType ne "void" && $returnValueIsGDOMType && $functionSigType ne "DOMObject") { if ($functionSigType ne "EventTarget") { $implIncludes{"webkit/WebKitDOM${functionSigType}Private.h"} = 1; $implIncludes{"webkit/WebKitDOM${functionSigType}.h"} = 1; @@ -613,19 +735,6 @@ sub GenerateFunction { $implIncludes{"${functionSigType}.h"} = 1; } - # skip custom functions for now - # but skip from here to allow some headers to be created - # for a successful compile. - if ($isCustomFunction && - $functionName ne "webkit_dom_node_remove_child" && - $functionName ne "webkit_dom_node_insert_before" && - $functionName ne "webkit_dom_node_replace_child" && - $functionName ne "webkit_dom_node_append_child") { - push(@hBody, "\n/* TODO: custom function ${functionName} */\n\n"); - push(@cBody, "\n/* TODO: custom function ${functionName} */\n\n"); - return; - } - if(@{$function->raisesExceptions}) { $functionSig .= ", GError **error"; } @@ -667,8 +776,9 @@ sub GenerateFunction { my $paramIsGDOMType = IsGDOMClassType($paramIDLType); if ($paramIDLType eq "DOMString") { push(@cBody, " WebCore::String _g_${paramName} = WebCore::String::fromUTF8($paramName);\n"); - } - if ($paramIsGDOMType) { + } elsif ($paramIDLType eq "CompareHow") { + push(@cBody, " WebCore::Range::CompareHow _g_${paramName} = static_cast<WebCore::Range::CompareHow>($paramName);\n"); + } elsif ($paramIsGDOMType) { push(@cBody, " WebCore::${paramIDLType} * _g_${paramName} = WebKit::core($paramName);\n"); if ($returnType ne "void") { # TODO: return proper default result @@ -684,7 +794,15 @@ sub GenerateFunction { my $assignPre = ""; my $assignPost = ""; - if ($returnType ne "void" && !$isCustomFunction) { + # We need to special-case these Node methods because their C++ + # signature is different from what we'd expect given their IDL + # description; see Node.h. + my $functionHasCustomReturn = $functionName eq "webkit_dom_node_append_child" || + $functionName eq "webkit_dom_node_insert_before" || + $functionName eq "webkit_dom_node_replace_child" || + $functionName eq "webkit_dom_node_remove_child"; + + if ($returnType ne "void" && !$functionHasCustomReturn) { if ($returnValueIsGDOMType) { $assign = "PassRefPtr<WebCore::${functionSigType}> g_res = "; $assignPre = "WTF::getPtr("; @@ -703,12 +821,7 @@ sub GenerateFunction { } } - # We need to special-case these Node methods because their C++ signature is different - # from what we'd expect given their IDL description; see Node.h. - if ($functionName eq "webkit_dom_node_append_child" || - $functionName eq "webkit_dom_node_insert_before" || - $functionName eq "webkit_dom_node_replace_child" || - $functionName eq "webkit_dom_node_remove_child") { + if ($functionHasCustomReturn) { my $customNodeAppendChild = << "EOF"; bool ok = item->${functionSigName}(${callImplParams}${exceptions}); if (ok) @@ -732,13 +845,40 @@ EOF push(@cBody, "}\n\n"); return; } elsif ($functionSigType eq "DOMString") { - push(@cBody, " ${assign}convertToUTF8String(item->${functionSigName}(${callImplParams}${exceptions}));\n" ); + my $getterContentHead; + my $reflect = $function->signature->extendedAttributes->{"Reflect"}; + my $reflectURL = $function->signature->extendedAttributes->{"ReflectURL"}; + if ($reflect || $reflectURL) { + my $contentAttributeName = (($reflect || $reflectURL) eq "1") ? $functionSigName : ($reflect || $reflectURL); + my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); + $implIncludes{"${namespace}.h"} = 1; + my $getAttributeFunctionName = $reflectURL ? "getURLAttribute" : "getAttribute"; + $getterContentHead = "${assign}convertToUTF8String(item->${getAttributeFunctionName}(WebCore::${namespace}::${contentAttributeName}Attr));\n"; + } else { + $getterContentHead = "${assign}convertToUTF8String(item->${functionSigName}(${callImplParams}${exceptions}));\n"; + } + + push(@cBody, " ${getterContentHead}"); } else { - push(@cBody, " ${assign}${assignPre}item->${functionSigName}(${callImplParams}${exceptions}${assignPost});\n" ); + my $setterContentHead; + my $reflect = $function->signature->extendedAttributes->{"Reflect"}; + my $reflectURL = $function->signature->extendedAttributes->{"ReflectURL"}; + if ($reflect || $reflectURL) { + my $contentAttributeName = (($reflect || $reflectURL) eq "1") ? $functionSigName : ($reflect || $reflectURL); + $contentAttributeName =~ s/set//; + $contentAttributeName = $codeGenerator->WK_lcfirst($contentAttributeName); + my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); + $implIncludes{"${namespace}.h"} = 1; + $setterContentHead = "${assign}${assignPre}item->setAttribute(WebCore::${namespace}::${contentAttributeName}Attr, ${callImplParams}${exceptions}${assignPost});\n"; + } else { + $setterContentHead = "${assign}${assignPre}item->${functionSigName}(${callImplParams}${exceptions}${assignPost});\n"; + } + + push(@cBody, " ${setterContentHead}"); if(@{$function->raisesExceptions}) { my $exceptionHandling = << "EOF"; - if(ec) { + if (ec) { WebCore::ExceptionCodeDescription ecdesc; WebCore::getExceptionCodeDescription(ec, ecdesc); g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); @@ -748,7 +888,7 @@ EOF } } - if ($returnType ne "void" && !$isCustomFunction) { + if ($returnType ne "void" && !$functionHasCustomReturn) { if ($functionSigType ne "DOMObject") { if ($returnValueIsGDOMType) { push(@cBody, " ${returnType} res = static_cast<${returnType}>(WebKit::kit(g_res.get()));\n"); @@ -813,9 +953,7 @@ sub GenerateFunctions { $function->raisesExceptions($attribute->getterExceptions); $object->GenerateFunction($interfaceName, $function, "get_"); - if ($attribute->type =~ /^readonly/ || - $attribute->signature->extendedAttributes->{"Replaceable"} # can't handle this yet - ) { + if ($attribute->type =~ /^readonly/) { next TOP; } @@ -846,8 +984,8 @@ sub GenerateCFile { my ($object, $interfaceName, $parentClassName, $parentGObjType, $dataNode) = @_; my $implContent = ""; - my $clsCaps = uc(decamelize($interfaceName)); - my $lowerCaseIfaceName = "webkit_dom_" . decamelize($interfaceName); + my $clsCaps = uc(FixUpDecamelizedName(decamelize($interfaceName))); + my $lowerCaseIfaceName = "webkit_dom_" . FixUpDecamelizedName(decamelize($interfaceName)); $implContent = << "EOF"; G_DEFINE_TYPE(${className}, ${lowerCaseIfaceName}, ${parentGObjType}) @@ -962,12 +1100,10 @@ EOF close(PRIVHEADER); } -sub UsesManualToJSImplementation { +sub UsesManualKitImplementation { my $type = shift; - return 1 if $type eq "Node" or $type eq "Document" or $type eq "HTMLCollection" or - $type eq "SVGPathSeg" or $type eq "StyleSheet" or $type eq "CSSRule" or $type eq "CSSValue" or - $type eq "Event" or $type eq "Element" or $type eq "Text"; + return 1 if $type eq "Node" or $type eq "Element"; return 0; } @@ -996,7 +1132,7 @@ sub Generate { $hdrIncludes{"webkit/${parentClassName}.h"} = 1; - if ($className ne "WebKitDOMNode") { + if (!UsesManualKitImplementation($interfaceName)) { my $converter = << "EOF"; namespace WebKit { diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm index 919e321..dc21314 100644 --- a/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -101,8 +101,13 @@ sub GenerateInterface my $defines = shift; # Start actual generation - $object->GenerateHeader($dataNode); - $object->GenerateImplementation($dataNode); + if ($dataNode->extendedAttributes->{"Callback"}) { + $object->GenerateCallbackHeader($dataNode); + $object->GenerateCallbackImplementation($dataNode); + } else { + $object->GenerateHeader($dataNode); + $object->GenerateImplementation($dataNode); + } my $name = $dataNode->name; @@ -121,6 +126,25 @@ sub GenerateInterface } } +sub GenerateEventListenerCall +{ + my $className = shift; + my $functionName = shift; + my $passRefPtrHandling = ($functionName eq "add") ? "" : ".get()"; + + $implIncludes{"JSEventListener.h"} = 1; + + my @GenerateEventListenerImpl = (); + push(@GenerateEventListenerImpl, <<END); + JSValue listener = args.at(1); + if (!listener.isObject()) + return jsUndefined(); + imp->${functionName}EventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec))$passRefPtrHandling, args.at(2).toBoolean(exec)); + return jsUndefined(); +END + return @GenerateEventListenerImpl; +} + # Params: 'idlDocument' struct sub GenerateModule { @@ -168,6 +192,7 @@ sub IndexGetterReturnsStrings sub AddIncludesForType { my $type = $codeGenerator->StripModule(shift); + my $isCallback = @_ ? shift : 0; # When we're finished with the one-file-per-class # reorganization, we won't need these special cases. @@ -180,6 +205,8 @@ sub AddIncludesForType } elsif ($type eq "XPathNSResolver") { $implIncludes{"JSXPathNSResolver.h"} = 1; $implIncludes{"JSCustomXPathNSResolver.h"} = 1; + } elsif ($isCallback) { + $implIncludes{"JS${type}.h"} = 1; } else { # default, include the same named file $implIncludes{"${type}.h"} = 1; @@ -290,6 +317,29 @@ sub prototypeHashTableAccessor } } +sub GenerateConditionalStringFromAttributeValue +{ + my $conditional = shift; + if ($conditional =~ /&/) { + return "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")"; + } elsif ($conditional =~ /\|/) { + return "ENABLE(" . join(") || ENABLE(", split(/\|/, $conditional)) . ")"; + } else { + return "ENABLE(" . $conditional . ")"; + } +} + +sub GenerateConditionalString +{ + my $node = shift; + my $conditional = $node->extendedAttributes->{"Conditional"}; + if ($conditional) { + return GenerateConditionalStringFromAttributeValue($conditional); + } else { + return ""; + } +} + sub GenerateGetOwnPropertySlotBody { my ($dataNode, $interfaceName, $className, $implClassName, $hasAttributes, $inlined) = @_; @@ -475,6 +525,36 @@ sub GenerateGetOwnPropertyDescriptorBody return @getOwnPropertyDescriptorImpl; } +sub GenerateHeaderContentHeader +{ + my $dataNode = shift; + my $className = "JS" . $dataNode->name; + + my @headerContentHeader = split("\r", $headerTemplate); + + # - Add header protection + push(@headerContentHeader, "\n#ifndef $className" . "_h"); + push(@headerContentHeader, "\n#define $className" . "_h\n\n"); + + my $conditionalString = GenerateConditionalString($dataNode); + push(@headerContentHeader, "#if ${conditionalString}\n\n") if $conditionalString; + return @headerContentHeader; +} + +sub GenerateImplementationContentHeader +{ + my $dataNode = shift; + my $className = "JS" . $dataNode->name; + + my @implContentHeader = split("\r", $headerTemplate); + + push(@implContentHeader, "\n#include \"config.h\"\n"); + my $conditionalString = GenerateConditionalString($dataNode); + push(@implContentHeader, "\n#if ${conditionalString}\n\n") if $conditionalString; + push(@implContentHeader, "#include \"$className.h\"\n\n"); + return @implContentHeader; +} + sub GenerateHeader { my $object = shift; @@ -496,22 +576,11 @@ sub GenerateHeader my $hasRealParent = @{$dataNode->parents} > 0; my $hasParent = $hasLegacyParent || $hasRealParent; my $parentClassName = GetParentClassName($dataNode); - my $conditional = $dataNode->extendedAttributes->{"Conditional"}; my $eventTarget = $dataNode->extendedAttributes->{"EventTarget"}; my $needsMarkChildren = $dataNode->extendedAttributes->{"CustomMarkFunction"} || $dataNode->extendedAttributes->{"EventTarget"}; - # - Add default header template - @headerContentHeader = split("\r", $headerTemplate); - - # - Add header protection - push(@headerContentHeader, "\n#ifndef $className" . "_h"); - push(@headerContentHeader, "\n#define $className" . "_h\n\n"); - - my $conditionalString; - if ($conditional) { - $conditionalString = "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")"; - push(@headerContentHeader, "#if ${conditionalString}\n\n"); - } + # - Add default header template and header protection + push(@headerContentHeader, GenerateHeaderContentHeader($dataNode)); if ($hasParent) { $headerIncludes{"$parentClassName.h"} = 1; @@ -905,8 +974,9 @@ sub GenerateHeader } } + my $conditionalString = GenerateConditionalString($dataNode); push(@headerContent, "\n} // namespace WebCore\n\n"); - push(@headerContent, "#endif // ${conditionalString}\n\n") if $conditional; + push(@headerContent, "#endif // ${conditionalString}\n\n") if $conditionalString; push(@headerContent, "#endif\n"); # - Generate dependencies. @@ -916,6 +986,73 @@ sub GenerateHeader } } +sub GenerateAttributesHashTable($$) +{ + my ($object, $dataNode) = @_; + + # FIXME: These should be functions on $dataNode. + my $interfaceName = $dataNode->name; + my $className = "JS$interfaceName"; + + # - Add all attributes in a hashtable definition + my $numAttributes = @{$dataNode->attributes}; + $numAttributes++ if (!($dataNode->extendedAttributes->{"OmitConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"})); + + return 0 if !$numAttributes; + + my $hashSize = $numAttributes; + my $hashName = $className . "Table"; + + my @hashKeys = (); + my @hashSpecials = (); + my @hashValue1 = (); + my @hashValue2 = (); + my %conditionals = (); + + my @entries = (); + + foreach my $attribute (@{$dataNode->attributes}) { + my $name = $attribute->signature->name; + push(@hashKeys, $name); + + my @specials = (); + push(@specials, "DontDelete") unless $attribute->signature->extendedAttributes->{"Deletable"}; + push(@specials, "DontEnum") if $attribute->signature->extendedAttributes->{"DontEnum"}; + push(@specials, "ReadOnly") if $attribute->type =~ /readonly/; + my $special = (@specials > 0) ? join("|", @specials) : "0"; + push(@hashSpecials, $special); + + my $getter = "js" . $interfaceName . $codeGenerator->WK_ucfirst($attribute->signature->name) . ($attribute->signature->type =~ /Constructor$/ ? "Constructor" : ""); + push(@hashValue1, $getter); + + if ($attribute->type =~ /readonly/) { + push(@hashValue2, "0"); + } else { + my $setter = "setJS" . $interfaceName . $codeGenerator->WK_ucfirst($attribute->signature->name) . ($attribute->signature->type =~ /Constructor$/ ? "Constructor" : ""); + push(@hashValue2, $setter); + } + + my $conditional = $attribute->signature->extendedAttributes->{"Conditional"}; + if ($conditional) { + $conditionals{$name} = $conditional; + } + } + + if (!($dataNode->extendedAttributes->{"OmitConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"})) { + push(@hashKeys, "constructor"); + my $getter = "js" . $interfaceName . "Constructor"; + push(@hashValue1, $getter); + push(@hashValue2, "0"); + push(@hashSpecials, "DontEnum|ReadOnly"); # FIXME: Setting the constructor should be possible. + } + + $object->GenerateHashTable($hashName, $hashSize, + \@hashKeys, \@hashSpecials, + \@hashValue1, \@hashValue2, + \%conditionals); + return $numAttributes; +} + sub GenerateImplementation { my ($object, $dataNode) = @_; @@ -928,21 +1065,12 @@ sub GenerateImplementation my $hasRealParent = @{$dataNode->parents} > 0; my $hasParent = $hasLegacyParent || $hasRealParent; my $parentClassName = GetParentClassName($dataNode); - my $conditional = $dataNode->extendedAttributes->{"Conditional"}; my $visibleClassName = GetVisibleClassName($interfaceName); my $eventTarget = $dataNode->extendedAttributes->{"EventTarget"}; my $needsMarkChildren = $dataNode->extendedAttributes->{"CustomMarkFunction"} || $dataNode->extendedAttributes->{"EventTarget"}; # - Add default header template - @implContentHeader = split("\r", $headerTemplate); - - push(@implContentHeader, "\n#include \"config.h\"\n"); - my $conditionalString; - if ($conditional) { - $conditionalString = "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")"; - push(@implContentHeader, "\n#if ${conditionalString}\n\n"); - } - push(@implContentHeader, "#include \"$className.h\"\n\n"); + push(@implContentHeader, GenerateImplementationContentHeader($dataNode)); AddIncludesForSVGAnimatedType($interfaceName) if $className =~ /^JSSVGAnimated/; @@ -958,62 +1086,7 @@ sub GenerateImplementation push(@implContent, "ASSERT_CLASS_FITS_IN_CELL($className);\n\n"); - # - Add all attributes in a hashtable definition - my $numAttributes = @{$dataNode->attributes}; - $numAttributes++ if (!($dataNode->extendedAttributes->{"OmitConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"})); - - if ($numAttributes > 0) { - my $hashSize = $numAttributes; - my $hashName = $className . "Table"; - - my @hashKeys = (); - my @hashSpecials = (); - my @hashValue1 = (); - my @hashValue2 = (); - my %conditionals = (); - - my @entries = (); - - foreach my $attribute (@{$dataNode->attributes}) { - my $name = $attribute->signature->name; - push(@hashKeys, $name); - - my @specials = (); - push(@specials, "DontDelete") unless $attribute->signature->extendedAttributes->{"Deletable"}; - push(@specials, "DontEnum") if $attribute->signature->extendedAttributes->{"DontEnum"}; - push(@specials, "ReadOnly") if $attribute->type =~ /readonly/; - my $special = (@specials > 0) ? join("|", @specials) : "0"; - push(@hashSpecials, $special); - - my $getter = "js" . $interfaceName . $codeGenerator->WK_ucfirst($attribute->signature->name) . ($attribute->signature->type =~ /Constructor$/ ? "Constructor" : ""); - push(@hashValue1, $getter); - - if ($attribute->type =~ /readonly/) { - push(@hashValue2, "0"); - } else { - my $setter = "setJS" . $interfaceName . $codeGenerator->WK_ucfirst($attribute->signature->name) . ($attribute->signature->type =~ /Constructor$/ ? "Constructor" : ""); - push(@hashValue2, $setter); - } - - my $conditional = $attribute->signature->extendedAttributes->{"Conditional"}; - if ($conditional) { - $conditionals{$name} = $conditional; - } - } - - if (!($dataNode->extendedAttributes->{"OmitConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"})) { - push(@hashKeys, "constructor"); - my $getter = "js" . $interfaceName . "Constructor"; - push(@hashValue1, $getter); - push(@hashValue2, "0"); - push(@hashSpecials, "DontEnum|ReadOnly"); # FIXME: Setting the constructor should be possible. - } - - $object->GenerateHashTable($hashName, $hashSize, - \@hashKeys, \@hashSpecials, - \@hashValue1, \@hashValue2, - \%conditionals); - } + my $numAttributes = GenerateAttributesHashTable($object, $dataNode); my $numConstants = @{$dataNode->constants}; my $numFunctions = @{$dataNode->functions}; @@ -1044,7 +1117,7 @@ sub GenerateImplementation my $protoClassName; $protoClassName = "${className}Prototype"; - push(@implContent, constructorFor($className, $protoClassName, $interfaceName, $visibleClassName, $dataNode->extendedAttributes->{"CanBeConstructed"})); + push(@implContent, constructorFor($className, $protoClassName, $interfaceName, $visibleClassName, $dataNode)); } # - Add functions and constants to a hashtable definition @@ -1305,11 +1378,8 @@ sub GenerateImplementation my $getFunctionName = "js" . $interfaceName . $codeGenerator->WK_ucfirst($attribute->signature->name) . ($attribute->signature->type =~ /Constructor$/ ? "Constructor" : ""); my $implGetterFunctionName = $codeGenerator->WK_lcfirst($name); - my $conditional = $attribute->signature->extendedAttributes->{"Conditional"}; - if ($conditional) { - $conditionalString = "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")"; - push(@implContent, "#if ${conditionalString}\n"); - } + my $attributeConditionalString = GenerateConditionalString($attribute->signature); + push(@implContent, "#if ${attributeConditionalString}\n") if $attributeConditionalString; push(@implContent, "JSValue ${getFunctionName}(ExecState* exec, JSValue slotBase, const Identifier&)\n"); push(@implContent, "{\n"); @@ -1417,9 +1487,7 @@ sub GenerateImplementation push(@implContent, "}\n"); - if ($conditional) { - push(@implContent, "#endif\n"); - } + push(@implContent, "#endif\n") if $attributeConditionalString; push(@implContent, "\n"); } @@ -1486,11 +1554,8 @@ sub GenerateImplementation my $putFunctionName = "setJS" . $interfaceName . $codeGenerator->WK_ucfirst($name) . ($attribute->signature->type =~ /Constructor$/ ? "Constructor" : ""); my $implSetterFunctionName = $codeGenerator->WK_ucfirst($name); - my $conditional = $attribute->signature->extendedAttributes->{"Conditional"}; - if ($conditional) { - $conditionalString = "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")"; - push(@implContent, "#if ${conditionalString}\n"); - } + my $attributeConditionalString = GenerateConditionalString($attribute->signature); + push(@implContent, "#if ${attributeConditionalString}\n") if $attributeConditionalString; push(@implContent, "void ${putFunctionName}(ExecState* exec, JSObject* thisObject, JSValue value)\n"); push(@implContent, "{\n"); @@ -1537,8 +1602,8 @@ sub GenerateImplementation push(@implContent, " // Shadowing a built-in object\n"); push(@implContent, " static_cast<$className*>(thisObject)->putDirect(Identifier(exec, \"$name\"), value);\n"); } else { - push(@implContent, " $className* castedThisObj = static_cast<$className*>(thisObject);\n"); - push(@implContent, " $implType* imp = static_cast<$implType*>(castedThisObj->impl());\n"); + push(@implContent, " $className* castedThis = static_cast<$className*>(thisObject);\n"); + push(@implContent, " $implType* imp = static_cast<$implType*>(castedThis->impl());\n"); if ($podType) { push(@implContent, " $podType podImp(*imp);\n"); if ($podType eq "float") { # Special case for JSSVGNumber @@ -1546,7 +1611,7 @@ sub GenerateImplementation } else { push(@implContent, " podImp.set$implSetterFunctionName(" . JSValueToNative($attribute->signature, "value") . ");\n"); } - push(@implContent, " imp->commitChange(podImp, castedThisObj);\n"); + push(@implContent, " imp->commitChange(podImp, castedThis);\n"); } else { my $nativeValue = JSValueToNative($attribute->signature, "value"); push(@implContent, " ExceptionCode ec = 0;\n") if @{$attribute->setterExceptions}; @@ -1564,16 +1629,14 @@ sub GenerateImplementation push(@implContent, ");\n"); push(@implContent, " setDOMException(exec, ec);\n") if @{$attribute->setterExceptions}; if (IsSVGTypeNeedingContextParameter($implClassName)) { - push(@implContent, " JSSVGContextCache::propagateSVGDOMChange(castedThisObj, imp->associatedAttributeName());\n"); + push(@implContent, " JSSVGContextCache::propagateSVGDOMChange(castedThis, imp->associatedAttributeName());\n"); } } } push(@implContent, "}\n"); - if ($conditional) { - push(@implContent, "#endif\n"); - } + push(@implContent, "#endif\n") if $attributeConditionalString; push(@implContent, "\n"); } @@ -1614,22 +1677,22 @@ sub GenerateImplementation $implIncludes{"<runtime/Error.h>"} = 1; if ($interfaceName eq "DOMWindow") { - push(@implContent, " $className* castedThisObj = toJSDOMWindow(thisValue.toThisObject(exec));\n"); - push(@implContent, " if (!castedThisObj)\n"); + push(@implContent, " $className* castedThis = toJSDOMWindow(thisValue.toThisObject(exec));\n"); + push(@implContent, " if (!castedThis)\n"); push(@implContent, " return throwError(exec, TypeError);\n"); } elsif ($dataNode->extendedAttributes->{"IsWorkerContext"}) { - push(@implContent, " $className* castedThisObj = to${className}(thisValue.toThisObject(exec));\n"); - push(@implContent, " if (!castedThisObj)\n"); + push(@implContent, " $className* castedThis = to${className}(thisValue.toThisObject(exec));\n"); + push(@implContent, " if (!castedThis)\n"); push(@implContent, " return throwError(exec, TypeError);\n"); } else { push(@implContent, " if (!thisValue.inherits(&${className}::s_info))\n"); push(@implContent, " return throwError(exec, TypeError);\n"); - push(@implContent, " $className* castedThisObj = static_cast<$className*>(asObject(thisValue));\n"); + push(@implContent, " $className* castedThis = static_cast<$className*>(asObject(thisValue));\n"); } if ($dataNode->extendedAttributes->{"CheckDomainSecurity"} && !$function->signature->extendedAttributes->{"DoNotCheckDomainSecurity"}) { - push(@implContent, " if (!castedThisObj->allowsAccessFrom(exec))\n"); + push(@implContent, " if (!castedThis->allowsAccessFrom(exec))\n"); push(@implContent, " return jsUndefined();\n"); } @@ -1649,14 +1712,14 @@ sub GenerateImplementation } if ($function->signature->extendedAttributes->{"Custom"} || $function->signature->extendedAttributes->{"JSCCustom"}) { - push(@implContent, " return castedThisObj->" . $functionImplementationName . "(exec, args);\n"); + push(@implContent, " return castedThis->" . $functionImplementationName . "(exec, args);\n"); } elsif ($svgPODListType) { $implIncludes{"JS${svgPODListType}.h"} = 1; $implIncludes{"JSSVGPODListCustom.h"} = 1; push(@implContent, " return JSSVGPODListCustom::$functionImplementationName<$className, " . GetNativeType($svgPODListType) - . ">(castedThisObj, exec, args, to" . $svgPODListType . ");\n"); + . ">(castedThis, exec, args, to" . $svgPODListType . ");\n"); } else { - push(@implContent, " $implType* imp = static_cast<$implType*>(castedThisObj->impl());\n"); + push(@implContent, " $implType* imp = static_cast<$implType*>(castedThis->impl());\n"); push(@implContent, " $podType podImp(*imp);\n") if $podType; my $numParameters = @{$function->parameters}; @@ -1676,72 +1739,94 @@ sub GenerateImplementation $implIncludes{"JSDOMBinding.h"} = 1; } - my $paramIndex = 0; - my $functionString = ($podType ? "podImp." : "imp->") . $functionImplementationName . "("; + if ($function->signature->name eq "addEventListener") { + push(@implContent, GenerateEventListenerCall($className, "add")); + } elsif ($function->signature->name eq "removeEventListener") { + push(@implContent, GenerateEventListenerCall($className, "remove")); + } else { + my $paramIndex = 0; + my $functionString = ($podType ? "podImp." : "imp->") . $functionImplementationName . "("; - my $hasOptionalArguments = 0; + my $hasOptionalArguments = 0; - if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) { - push(@implContent, " ScriptCallStack callStack(exec, args, $numParameters);\n"); - $implIncludes{"ScriptCallStack.h"} = 1; - } - - foreach my $parameter (@{$function->parameters}) { - if (!$hasOptionalArguments && $parameter->extendedAttributes->{"Optional"}) { - push(@implContent, "\n int argsCount = args.size();\n"); - $hasOptionalArguments = 1; + if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) { + push(@implContent, " ScriptCallStack callStack(exec, args, $numParameters);\n"); + $implIncludes{"ScriptCallStack.h"} = 1; } - if ($hasOptionalArguments) { - push(@implContent, " if (argsCount < " . ($paramIndex + 1) . ") {\n"); - GenerateImplementationFunctionCall($function, $functionString, $paramIndex, " " x 2, $podType, $implClassName); - push(@implContent, " }\n\n"); + my $callWith = $function->signature->extendedAttributes->{"CallWith"}; + if ($callWith) { + my $callWithArg = "COMPILE_ASSERT(false)"; + if ($callWith eq "DynamicFrame") { + push(@implContent, " Frame* dynamicFrame = toDynamicFrame(exec);\n"); + push(@implContent, " if (!dynamicFrame)\n"); + push(@implContent, " return jsUndefined();\n"); + $callWithArg = "dynamicFrame"; + } elsif ($callWith eq "ScriptState") { + $callWithArg = "exec"; + } + $functionString .= ", " if $paramIndex; + $functionString .= $callWithArg; + $paramIndex++; } - my $name = $parameter->name; + foreach my $parameter (@{$function->parameters}) { + if (!$hasOptionalArguments && $parameter->extendedAttributes->{"Optional"}) { + push(@implContent, "\n int argsCount = args.size();\n"); + $hasOptionalArguments = 1; + } + + if ($hasOptionalArguments) { + push(@implContent, " if (argsCount < " . ($paramIndex + 1) . ") {\n"); + GenerateImplementationFunctionCall($function, $functionString, $paramIndex, " " x 2, $podType, $implClassName); + push(@implContent, " }\n\n"); + } + + my $name = $parameter->name; - if ($parameter->type eq "XPathNSResolver") { - push(@implContent, " RefPtr<XPathNSResolver> customResolver;\n"); - push(@implContent, " XPathNSResolver* resolver = toXPathNSResolver(args.at($paramIndex));\n"); - push(@implContent, " if (!resolver) {\n"); - push(@implContent, " customResolver = JSCustomXPathNSResolver::create(exec, args.at($paramIndex));\n"); - push(@implContent, " if (exec->hadException())\n"); - push(@implContent, " return jsUndefined();\n"); - push(@implContent, " resolver = customResolver.get();\n"); - push(@implContent, " }\n"); - } else { - push(@implContent, " " . GetNativeTypeFromSignature($parameter) . " $name = " . JSValueToNative($parameter, "args.at($paramIndex)") . ";\n"); - - # If a parameter is "an index" and it's negative it should throw an INDEX_SIZE_ERR exception. - # But this needs to be done in the bindings, because the type is unsigned and the fact that it - # was negative will be lost by the time we're inside the DOM. - if ($parameter->extendedAttributes->{"IsIndex"}) { - $implIncludes{"ExceptionCode.h"} = 1; - push(@implContent, " if ($name < 0) {\n"); - push(@implContent, " setDOMException(exec, INDEX_SIZE_ERR);\n"); - push(@implContent, " return jsUndefined();\n"); + if ($parameter->type eq "XPathNSResolver") { + push(@implContent, " RefPtr<XPathNSResolver> customResolver;\n"); + push(@implContent, " XPathNSResolver* resolver = toXPathNSResolver(args.at($paramIndex));\n"); + push(@implContent, " if (!resolver) {\n"); + push(@implContent, " customResolver = JSCustomXPathNSResolver::create(exec, args.at($paramIndex));\n"); + push(@implContent, " if (exec->hadException())\n"); + push(@implContent, " return jsUndefined();\n"); + push(@implContent, " resolver = customResolver.get();\n"); push(@implContent, " }\n"); + } else { + push(@implContent, " " . GetNativeTypeFromSignature($parameter) . " $name = " . JSValueToNative($parameter, "args.at($paramIndex)") . ";\n"); + + # If a parameter is "an index" and it's negative it should throw an INDEX_SIZE_ERR exception. + # But this needs to be done in the bindings, because the type is unsigned and the fact that it + # was negative will be lost by the time we're inside the DOM. + if ($parameter->extendedAttributes->{"IsIndex"}) { + $implIncludes{"ExceptionCode.h"} = 1; + push(@implContent, " if ($name < 0) {\n"); + push(@implContent, " setDOMException(exec, INDEX_SIZE_ERR);\n"); + push(@implContent, " return jsUndefined();\n"); + push(@implContent, " }\n"); + } } - } - $functionString .= ", " if $paramIndex; + $functionString .= ", " if $paramIndex; - if ($parameter->type eq "NodeFilter") { - $functionString .= "$name.get()"; - } else { - $functionString .= $name; + if ($parameter->type eq "NodeFilter") { + $functionString .= "$name.get()"; + } else { + $functionString .= $name; + } + $paramIndex++; } - $paramIndex++; - } - if ($function->signature->extendedAttributes->{"NeedsUserGestureCheck"}) { - $functionString .= ", " if $paramIndex; - $functionString .= "processingUserGesture(exec)"; - $paramIndex++; - } + if ($function->signature->extendedAttributes->{"NeedsUserGestureCheck"}) { + $functionString .= ", " if $paramIndex; + $functionString .= "processingUserGesture(exec)"; + $paramIndex++; + } - push(@implContent, "\n"); - GenerateImplementationFunctionCall($function, $functionString, $paramIndex, " ", $podType, $implClassName); + push(@implContent, "\n"); + GenerateImplementationFunctionCall($function, $functionString, $paramIndex, " ", $podType, $implClassName); + } } push(@implContent, "}\n\n"); } @@ -1827,7 +1912,156 @@ sub GenerateImplementation push(@implContent, "\n}\n"); - push(@implContent, "\n#endif // ${conditionalString}\n") if $conditional; + my $conditionalString = GenerateConditionalString($dataNode); + push(@implContent, "\n#endif // ${conditionalString}\n") if $conditionalString; +} + +sub GenerateCallbackHeader +{ + my $object = shift; + my $dataNode = shift; + + my $interfaceName = $dataNode->name; + my $className = "JS$interfaceName"; + + # - Add default header template and header protection + push(@headerContentHeader, GenerateHeaderContentHeader($dataNode)); + + $headerIncludes{"$interfaceName.h"} = 1; + $headerIncludes{"JSCallbackData.h"} = 1; + $headerIncludes{"<wtf/Forward.h>"} = 1; + + push(@headerContent, "\nnamespace WebCore {\n\n"); + push(@headerContent, "class $className : public $interfaceName {\n"); + push(@headerContent, "public:\n"); + + # The static create() method. + push(@headerContent, " static PassRefPtr<$className> create(JSC::JSObject* callback, JSDOMGlobalObject* globalObject)\n"); + push(@headerContent, " {\n"); + push(@headerContent, " return adoptRef(new $className(callback, globalObject));\n"); + push(@headerContent, " }\n\n"); + + # Destructor + push(@headerContent, " virtual ~$className();\n"); + + # Functions + my $numFunctions = @{$dataNode->functions}; + if ($numFunctions > 0) { + push(@headerContent, "\n // Functions\n"); + foreach my $function (@{$dataNode->functions}) { + my @params = @{$function->parameters}; + if (!$function->signature->extendedAttributes->{"Custom"} && + !(GetNativeType($function->signature->type) eq "bool")) { + push(@headerContent, " COMPILE_ASSERT(false)"); + } + + push(@headerContent, " virtual " . GetNativeType($function->signature->type) . " " . $function->signature->name . "(ScriptExecutionContext*"); + foreach my $param (@params) { + push(@headerContent, ", " . GetNativeType($param->type) . " " . $param->name); + } + + push(@headerContent, ");\n"); + } + } + + push(@headerContent, "\nprivate:\n"); + + # Constructor + push(@headerContent, " $className(JSC::JSObject* callback, JSDOMGlobalObject*);\n\n"); + + # Private members + push(@headerContent, " JSCallbackData* m_data;\n"); + push(@headerContent, " RefPtr<DOMWrapperWorld> m_isolatedWorld;\n"); + push(@headerContent, "};\n\n"); + + push(@headerContent, "} // namespace WebCore\n\n"); + my $conditionalString = GenerateConditionalString($dataNode); + push(@headerContent, "#endif // ${conditionalString}\n\n") if $conditionalString; + push(@headerContent, "#endif\n"); +} + +sub GenerateCallbackImplementation +{ + my ($object, $dataNode) = @_; + + my $interfaceName = $dataNode->name; + my $className = "JS$interfaceName"; + + # - Add default header template + push(@implContentHeader, GenerateImplementationContentHeader($dataNode)); + + $implIncludes{"ScriptExecutionContext.h"} = 1; + $implIncludes{"<runtime/JSLock.h>"} = 1; + $implIncludes{"<wtf/MainThread.h>"} = 1; + + @implContent = (); + + push(@implContent, "\nusing namespace JSC;\n\n"); + push(@implContent, "namespace WebCore {\n\n"); + + # Constructor + push(@implContent, "${className}::${className}(JSObject* callback, JSDOMGlobalObject* globalObject)\n"); + push(@implContent, " : m_data(new JSCallbackData(callback, globalObject))\n"); + push(@implContent, " , m_isolatedWorld(globalObject->world())\n"); + push(@implContent, "{\n"); + push(@implContent, "}\n\n"); + + # Destructor + push(@implContent, "${className}::~${className}()\n"); + push(@implContent, "{\n"); + push(@implContent, " callOnMainThread(JSCallbackData::deleteData, m_data);\n"); + push(@implContent, "#ifndef NDEBUG\n"); + push(@implContent, " m_data = 0;\n"); + push(@implContent, "#endif\n"); + push(@implContent, "}\n"); + + # Functions + my $numFunctions = @{$dataNode->functions}; + if ($numFunctions > 0) { + push(@implContent, "\n// Functions\n"); + foreach my $function (@{$dataNode->functions}) { + my @params = @{$function->parameters}; + if ($function->signature->extendedAttributes->{"Custom"} || + !(GetNativeType($function->signature->type) eq "bool")) { + next; + } + + AddIncludesForType($function->signature->type); + push(@implContent, "\n" . GetNativeType($function->signature->type) . " ${className}::" . $function->signature->name . "(ScriptExecutionContext* context"); + + foreach my $param (@params) { + AddIncludesForType($param->type, 1); + push(@implContent, ", " . GetNativeType($param->type) . " " . $param->name); + } + + push(@implContent, ")\n"); + + push(@implContent, "{\n"); + push(@implContent, " ASSERT(m_data);\n"); + push(@implContent, " ASSERT(context);\n\n"); + push(@implContent, " RefPtr<$className> protect(this);\n\n"); + push(@implContent, " JSLock lock(SilenceAssertionsOnly);\n\n"); + push(@implContent, " JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, m_isolatedWorld.get());\n"); + push(@implContent, " if (!globalObject)\n"); + push(@implContent, " return true;\n\n"); + push(@implContent, " ExecState* exec = globalObject->globalExec();\n"); + push(@implContent, " MarkedArgumentBuffer args;\n"); + + foreach my $param (@params) { + my $paramName = $param->name; + push(@implContent, " args.append(toJS(exec, ${paramName}));\n"); + } + + push(@implContent, "\n bool raisedException = false;\n"); + push(@implContent, " m_data->invokeCallback(args, &raisedException);\n"); + push(@implContent, " return !raisedException;\n"); + push(@implContent, "}\n"); + } + } + + push(@implContent, "\n}\n"); + my $conditionalString = GenerateConditionalString($dataNode); + push(@implContent, "\n#endif // ${conditionalString}\n") if $conditionalString; } sub GenerateImplementationFunctionCall() @@ -1854,16 +2088,22 @@ sub GenerateImplementationFunctionCall() if ($function->signature->type eq "void") { push(@implContent, $indent . "$functionString;\n"); push(@implContent, $indent . "setDOMException(exec, ec);\n") if @{$function->raisesExceptions}; - push(@implContent, $indent . "imp->commitChange(podImp, castedThisObj);\n") if $podType; + push(@implContent, $indent . "imp->commitChange(podImp, castedThis);\n") if $podType; push(@implContent, $indent . "return jsUndefined();\n"); } else { - push(@implContent, "\n" . $indent . "JSC::JSValue result = " . NativeToJSValue($function->signature, 1, $implClassName, "", $functionString, "castedThisObj") . ";\n"); + push(@implContent, "\n" . $indent . "JSC::JSValue result = " . NativeToJSValue($function->signature, 1, $implClassName, "", $functionString, "castedThis") . ";\n"); push(@implContent, $indent . "setDOMException(exec, ec);\n") if @{$function->raisesExceptions}; + $callWith = $function->signature->extendedAttributes->{"CallWith"}; + if ($callWith and $callWith eq "ScriptState") { + push(@implContent, $indent . "if (exec->hadException())\n"); + push(@implContent, $indent . " return jsUndefined();\n"); + } + if ($podType and not $function->signature->extendedAttributes->{"Immutable"}) { # Immutable methods do not commit changes back to the instance, thus producing # a new instance rather than mutating existing one. - push(@implContent, $indent . "imp->commitChange(podImp, castedThisObj);\n"); + push(@implContent, $indent . "imp->commitChange(podImp, castedThis);\n"); } push(@implContent, $indent . "return result;\n"); @@ -1888,6 +2128,7 @@ my %nativeType = ( "DOMString" => "const String&", "DOMObject" => "ScriptValue", "NodeFilter" => "RefPtr<NodeFilter>", + "SerializedScriptValue" => "RefPtr<SerializedScriptValue>", "SVGAngle" => "SVGAngle", "SVGLength" => "SVGLength", "SVGMatrix" => "AffineTransform", @@ -1992,6 +2233,8 @@ sub NativeToJSValue die "Unknown value for ConvertNullStringTo extended attribute"; } + $conv = $signature->extendedAttributes->{"ConvertScriptString"}; + return "jsOwnedStringOrNull(exec, $value)" if $conv; $implIncludes{"<runtime/JSString.h>"} = 1; return "jsString(exec, $value)"; } @@ -2181,6 +2424,11 @@ tableSizeLoop: # Dump the hash table my $count = scalar @{$keys} + 1; + push(@implContent, "#if ENABLE(JIT)\n"); + push(@implContent, "#define THUNK_GENERATOR(generator) , generator\n"); + push(@implContent, "#else\n"); + push(@implContent, "#define THUNK_GENERATOR(generator)\n"); + push(@implContent, "#endif\n"); push(@implContent, "\nstatic const HashTableValue $nameEntries\[$count\] =\n\{\n"); $i = 0; foreach my $key (@{$keys}) { @@ -2191,7 +2439,7 @@ tableSizeLoop: $conditional = $conditionals->{$key}; } if ($conditional) { - my $conditionalString = "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")"; + my $conditionalString = GenerateConditionalStringFromAttributeValue($conditional); push(@implContent, "#if ${conditionalString}\n"); } @@ -2200,14 +2448,15 @@ tableSizeLoop: } else { $targetType = "static_cast<PropertySlot::GetValueFunc>"; } - push(@implContent, " { \"$key\", @$specials[$i], (intptr_t)" . $targetType . "(@$value1[$i]), (intptr_t)@$value2[$i] },\n"); + push(@implContent, " { \"$key\", @$specials[$i], (intptr_t)" . $targetType . "(@$value1[$i]), (intptr_t)@$value2[$i] THUNK_GENERATOR(0) },\n"); if ($conditional) { push(@implContent, "#endif\n"); } ++$i; } - push(@implContent, " { 0, 0, 0, 0 }\n"); + push(@implContent, " { 0, 0, 0, 0 THUNK_GENERATOR(0) }\n"); push(@implContent, "};\n\n"); + push(@implContent, "#undef THUNK_GENERATOR\n"); my $perfectSizeMask = $perfectSize - 1; my $compactSizeMask = $numEntries - 1; push(@implContent, "static JSC_CONST_HASHTABLE HashTable $name =\n"); @@ -2350,8 +2599,10 @@ sub constructorFor my $protoClassName = shift; my $interfaceName = shift; my $visibleClassName = shift; - my $canConstruct = shift; + my $dataNode = shift; my $constructorClassName = "${className}Constructor"; + my $canConstruct = $dataNode->extendedAttributes->{"CanBeConstructed"}; + my $callWith = $dataNode->extendedAttributes->{"CallWith"}; my $implContent = << "EOF"; class ${constructorClassName} : public DOMConstructorObject { @@ -2379,7 +2630,20 @@ EOF $implContent .= << "EOF"; static JSObject* construct${interfaceName}(ExecState* exec, JSObject* constructor, const ArgList&) { - return asObject(toJS(exec, static_cast<${constructorClassName}*>(constructor)->globalObject(), ${interfaceName}::create())); +EOF + + my $constructorArg = ""; + if ($callWith and $callWith eq "ScriptExecutionContext") { + $constructorArg = "context"; +$implContent .= << "EOF"; + ScriptExecutionContext* context = static_cast<${constructorClassName}*>(constructor)->scriptExecutionContext(); + if (!context) + return throwError(exec, ReferenceError); +EOF + } + +$implContent .= << "EOF"; + return asObject(toJS(exec, static_cast<${constructorClassName}*>(constructor)->globalObject(), ${interfaceName}::create(${constructorArg}))); } virtual ConstructType getConstructData(ConstructData& constructData) { diff --git a/WebCore/bindings/scripts/CodeGeneratorObjC.pm b/WebCore/bindings/scripts/CodeGeneratorObjC.pm index 3c5fe45..7132e22 100644 --- a/WebCore/bindings/scripts/CodeGeneratorObjC.pm +++ b/WebCore/bindings/scripts/CodeGeneratorObjC.pm @@ -269,6 +269,23 @@ sub ReadPublicInterfaces $interfaceAvailabilityVersion = "WEBKIT_VERSION_LATEST" if $newPublicClass; } +sub GenerateConditionalString +{ + my $node = shift; + my $conditional = $node->extendedAttributes->{"Conditional"}; + if ($conditional) { + if ($conditional =~ /&/) { + return "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")"; + } elsif ($conditional =~ /\|/) { + return "ENABLE(" . join(") || ENABLE(", split(/\|/, $conditional)) . ")"; + } else { + return "ENABLE(" . $conditional . ")"; + } + } else { + return ""; + } +} + # Params: 'domClass' struct sub GenerateInterface { @@ -1014,7 +1031,6 @@ sub GenerateImplementation my $implClassNameWithNamespace = "WebCore::" . $implClassName; my $baseClass = GetBaseClass($parentImplClassName); my $classHeaderName = GetClassHeaderName($className); - my $conditional = $dataNode->extendedAttributes->{"Conditional"}; my $numAttributes = @{$dataNode->attributes}; my $numFunctions = @{$dataNode->functions}; @@ -1032,11 +1048,8 @@ sub GenerateImplementation # - INCLUDES - push(@implContentHeader, "\n#import \"config.h\"\n"); - my $conditionalString; - if ($conditional) { - $conditionalString = "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")"; - push(@implContentHeader, "\n#if ${conditionalString}\n\n"); - } + my $conditionalString = GenerateConditionalString($dataNode); + push(@implContentHeader, "\n#if ${conditionalString}\n\n") if $conditionalString; push(@implContentHeader, "#import \"DOMInternal.h\"\n\n"); push(@implContentHeader, "#import \"$classHeaderName.h\"\n\n"); @@ -1585,7 +1598,7 @@ sub GenerateImplementation } # - End the ifdef conditional if necessary - push(@implContent, "\n#endif // ${conditionalString}\n") if $conditional; + push(@implContent, "\n#endif // ${conditionalString}\n") if $conditionalString; # - Generate dependencies. if ($writeDependencies && @ancestorInterfaceNames) { diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm index 1c5f398..9553b8b 100644 --- a/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -99,8 +99,13 @@ sub GenerateInterface my $defines = shift; # Start actual generation - $object->GenerateHeader($dataNode); - $object->GenerateImplementation($dataNode); + if ($dataNode->extendedAttributes->{"Callback"}) { + $object->GenerateCallbackHeader($dataNode); + $object->GenerateCallbackImplementation($dataNode); + } else { + $object->GenerateHeader($dataNode); + $object->GenerateImplementation($dataNode); + } my $name = $dataNode->name; @@ -189,7 +194,13 @@ sub GenerateConditionalString my $node = shift; my $conditional = $node->extendedAttributes->{"Conditional"}; if ($conditional) { - return "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")"; + if ($conditional =~ /&/) { + return "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")"; + } elsif ($conditional =~ /\|/) { + return "ENABLE(" . join(") || ENABLE(", split(/\|/, $conditional)) . ")"; + } else { + return "ENABLE(" . $conditional . ")"; + } } else { return ""; } @@ -226,14 +237,9 @@ sub GenerateHeader $codeGenerator->AddMethodsConstantsAndAttributesFromParentClasses($dataNode, \@allParents, 1); my $hasLegacyParent = $dataNode->extendedAttributes->{"LegacyParent"}; - my $conditionalString = GenerateConditionalString($dataNode); # - Add default header template - @headerContent = split("\r", $headerTemplate); - - push(@headerContent, "\n#if ${conditionalString}\n\n") if $conditionalString; - push(@headerContent, "\n#ifndef $className" . "_h"); - push(@headerContent, "\n#define $className" . "_h\n\n"); + push(@headerContent, GenerateHeaderContentHeader($dataNode)); # Get correct pass/store types respecting PODType flag my $podType = $dataNode->extendedAttributes->{"PODType"}; @@ -351,6 +357,7 @@ END push(@headerContent, "}\n\n"); push(@headerContent, "#endif // $className" . "_h\n"); + my $conditionalString = GenerateConditionalString($dataNode); push(@headerContent, "#endif // ${conditionalString}\n\n") if $conditionalString; } @@ -1218,7 +1225,8 @@ END if ($parameter->type eq "SerializedScriptValue") { push(@implContentDecls, "SerializedScriptValue::create(args[$paramIndex], ${parameterName}DidThrow);\n"); - push(@implContentDecls, " if (${parameterName}DidThrow)\n return v8::Undefined();\n"); + push(@implContentDecls, " if (${parameterName}DidThrow)\n"); + push(@implContentDecls, " return v8::Undefined();\n"); } else { push(@implContentDecls, JSValueToNative($parameter, "args[$paramIndex]", BasicTypeCanFailConversion($parameter) ? "${parameterName}Ok" : undef) . ";\n"); @@ -1570,16 +1578,9 @@ sub GenerateImplementation my $implClassName = $interfaceName; my $hasLegacyParent = $dataNode->extendedAttributes->{"LegacyParent"}; - my $conditionalString = GenerateConditionalString($dataNode); # - Add default header template - @implContentHeader = split("\r", $headerTemplate); - - push(@implFixedHeader, - "\n#include \"config.h\"\n" . - "#include \"${className}.h\"\n\n"); - - push(@implFixedHeader, "\n#if ${conditionalString}\n\n") if $conditionalString; + push(@implFixedHeader, GenerateImplementationContentHeader($dataNode)); $implIncludes{"RuntimeEnabledFeatures.h"} = 1; $implIncludes{"V8Proxy.h"} = 1; @@ -1780,11 +1781,18 @@ END # In namespace WebCore, add generated implementation for 'CanBeConstructed'. if ($dataNode->extendedAttributes->{"CanBeConstructed"} && !$dataNode->extendedAttributes->{"CustomConstructor"}) { + my $v8ConstructFunction; + my $callWith = $dataNode->extendedAttributes->{"CallWith"}; + if ($callWith and $callWith eq "ScriptExecutionContext") { + $v8ConstructFunction = "constructDOMObjectWithScriptExecutionContext"; + } else { + $v8ConstructFunction = "constructDOMObject"; + } push(@implContent, <<END); v8::Handle<v8::Value> ${className}::constructorCallback(const v8::Arguments& args) { INC_STATS("DOM.${interfaceName}.Contructor"); - return V8Proxy::constructDOMObject<$interfaceName>(args, &info); + return V8Proxy::${v8ConstructFunction}<$interfaceName>(args, &info); } END } @@ -2087,6 +2095,7 @@ END } // namespace WebCore END + my $conditionalString = GenerateConditionalString($dataNode); push(@implContent, "\n#endif // ${conditionalString}\n") if $conditionalString; # We've already added the header for this file in implFixedHeader, so remove @@ -2094,6 +2103,190 @@ END delete $implIncludes{"${className}.h"}; } +sub GenerateHeaderContentHeader +{ + my $dataNode = shift; + my $className = "V8" . $dataNode->name; + my $conditionalString = GenerateConditionalString($dataNode); + + my @headerContentHeader = split("\r", $headerTemplate); + + push(@headerContentHeader, "\n#if ${conditionalString}\n") if $conditionalString; + push(@headerContentHeader, "\n#ifndef ${className}" . "_h"); + push(@headerContentHeader, "\n#define ${className}" . "_h\n\n"); + return @headerContentHeader; +} + +sub GenerateImplementationContentHeader +{ + my $dataNode = shift; + my $className = "V8" . $dataNode->name; + my $conditionalString = GenerateConditionalString($dataNode); + + my @implContentHeader = split("\r", $headerTemplate); + + push(@implContentHeader, "\n#include \"config.h\"\n"); + push(@implContentHeader, "#include \"${className}.h\"\n\n"); + push(@implContentHeader, "#if ${conditionalString}\n\n") if $conditionalString; + return @implContentHeader; +} + +sub GenerateCallbackHeader +{ + my $object = shift; + my $dataNode = shift; + + my $interfaceName = $dataNode->name; + my $className = "V8$interfaceName"; + + + # - Add default header template + push(@headerContent, GenerateHeaderContentHeader($dataNode)); + + if ("$interfaceName.h" lt "WorldContextHandle.h") { + push(@headerContent, "#include \"$interfaceName.h\"\n"); + push(@headerContent, "#include \"WorldContextHandle.h\"\n"); + } else { + push(@headerContent, "#include \"WorldContextHandle.h\"\n"); + push(@headerContent, "#include \"$interfaceName.h\"\n"); + } + push(@headerContent, "#include <v8.h>\n"); + push(@headerContent, "#include <wtf/Forward.h>\n"); + + push(@headerContent, "\nnamespace WebCore {\n\n"); + push(@headerContent, "class Frame;\n\n"); + push(@headerContent, "class $className : public $interfaceName {\n"); + + push(@headerContent, <<END); +public: + static PassRefPtr<${className}> create(v8::Local<v8::Value> value, Frame* frame) + { + ASSERT(value->IsObject()); + return adoptRef(new ${className}(value->ToObject(), frame)); + } + + virtual ~${className}(); + +END + + # Functions + my $numFunctions = @{$dataNode->functions}; + if ($numFunctions > 0) { + push(@headerContent, " // Functions\n"); + foreach my $function (@{$dataNode->functions}) { + my @params = @{$function->parameters}; + if (!$function->signature->extendedAttributes->{"Custom"} && + !(GetNativeType($function->signature->type) eq "bool")) { + push(@headerContent, " COMPILE_ASSERT(false)"); + } + + push(@headerContent, " virtual " . GetNativeTypeForCallbacks($function->signature->type) . " " . $function->signature->name . "(ScriptExecutionContext*"); + foreach my $param (@params) { + push(@headerContent, ", " . GetNativeTypeForCallbacks($param->type) . " " . $param->name); + } + + push(@headerContent, ");\n"); + } + } + + push(@headerContent, <<END); + +private: + ${className}(v8::Local<v8::Object>, Frame*); + + v8::Persistent<v8::Object> m_callback; + RefPtr<Frame> m_frame; + WorldContextHandle m_worldContext; +}; + +END + + push(@headerContent, "}\n\n"); + push(@headerContent, "#endif // $className" . "_h\n\n"); + + my $conditionalString = GenerateConditionalString($dataNode); + push(@headerContent, "#endif // ${conditionalString}\n") if $conditionalString; +} + +sub GenerateCallbackImplementation +{ + my $object = shift; + my $dataNode = shift; + my $interfaceName = $dataNode->name; + my $className = "V8$interfaceName"; + + # - Add default header template + push(@implFixedHeader, GenerateImplementationContentHeader($dataNode)); + + $implIncludes{"Frame.h"} = 1; + $implIncludes{"ScriptExecutionContext.h"} = 1; + $implIncludes{"V8CustomVoidCallback.h"} = 1; + + push(@implContent, "namespace WebCore {\n\n"); + push(@implContent, <<END); +${className}::${className}(v8::Local<v8::Object> callback, Frame* frame) + : m_callback(v8::Persistent<v8::Object>::New(callback)) + , m_frame(frame) + , m_worldContext(UseCurrentWorld) +{ +} + +${className}::~${className}() +{ + m_callback.Dispose(); +} + +END + + # Functions + my $numFunctions = @{$dataNode->functions}; + if ($numFunctions > 0) { + push(@implContent, "// Functions\n"); + foreach my $function (@{$dataNode->functions}) { + my @params = @{$function->parameters}; + if ($function->signature->extendedAttributes->{"Custom"} || + !(GetNativeTypeForCallbacks($function->signature->type) eq "bool")) { + next; + } + + AddIncludesForType($function->signature->type); + push(@implContent, "\n" . GetNativeTypeForCallbacks($function->signature->type) . " ${className}::" . $function->signature->name . "(ScriptExecutionContext* context"); + + foreach my $param (@params) { + AddIncludesForType($param->type); + push(@implContent, ", " . GetNativeTypeForCallbacks($param->type) . " " . $param->name); + } + + push(@implContent, ")\n"); + push(@implContent, "{\n"); + push(@implContent, " v8::HandleScope handleScope;\n\n"); + push(@implContent, " v8::Handle<v8::Context> v8Context = toV8Context(context, m_worldContext);\n"); + push(@implContent, " if (v8Context.IsEmpty())\n"); + push(@implContent, " return true;\n\n"); + push(@implContent, " v8::Context::Scope scope(v8Context);\n\n"); + push(@implContent, " v8::Handle<v8::Value> argv[] = {\n"); + + my @argvs = (); + foreach my $param (@params) { + my $paramName = $param->name; + push(@argvs, " toV8(${paramName})"); + } + push(@implContent, join(",\n", @argvs)); + + push(@implContent, "\n };\n\n"); + push(@implContent, " RefPtr<Frame> protect(m_frame);\n\n"); + push(@implContent, " bool callbackReturnValue = false;\n"); + push(@implContent, " return !invokeCallback(m_callback, " . scalar(@params). ", argv, callbackReturnValue);\n"); + push(@implContent, "}\n"); + } + } + + push(@implContent, "\n} // namespace WebCore\n\n"); + + my $conditionalString = GenerateConditionalString($dataNode); + push(@implContent, "#endif // ${conditionalString}\n") if $conditionalString; +} + sub GenerateToV8Converters { my $dataNode = shift; @@ -2326,15 +2519,33 @@ sub GenerateFunctionCallString() $functionString = "listImp->${name}("; } - my $first = 1; my $index = 0; + my $hasScriptState = 0; + + my $callWith = $function->signature->extendedAttributes->{"CallWith"}; + if ($callWith) { + my $callWithArg = "COMPILE_ASSERT(false)"; + if ($callWith eq "DynamicFrame") { + $result .= $indent . "Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();\n"; + $result .= $indent . "if (!enteredFrame)\n"; + $result .= $indent . " return v8::Undefined();\n"; + $callWithArg = "enteredFrame"; + } elsif ($callWith eq "ScriptState") { + $result .= $indent . "EmptyScriptState state;\n"; + $callWithArg = "&state"; + $hasScriptState = 1; + } + $functionString .= ", " if $index; + $functionString .= $callWithArg; + $index++; + $numberOfParameters++ + } foreach my $parameter (@{$function->parameters}) { if ($index eq $numberOfParameters) { last; } - if ($first) { $first = 0; } - else { $functionString .= ", "; } + $functionString .= ", " if $index; my $paramName = $parameter->name; my $paramType = $parameter->type; @@ -2353,22 +2564,23 @@ sub GenerateFunctionCallString() } if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) { - $functionString .= ", " if not $first; + $functionString .= ", " if $index; $functionString .= "callStack.get()"; - if ($first) { $first = 0; } + $index++; } if ($function->signature->extendedAttributes->{"NeedsUserGestureCheck"}) { - $functionString .= ", " if not $first; + $functionString .= ", " if $index; # FIXME: We need to pass DOMWrapperWorld as a parameter. # See http://trac.webkit.org/changeset/54182 $functionString .= "processingUserGesture()"; - if ($first) { $first = 0; } + $index++; } if (@{$function->raisesExceptions}) { - $functionString .= ", " if not $first; + $functionString .= ", " if $index; $functionString .= "ec"; + $index++; } $functionString .= ")"; @@ -2381,7 +2593,7 @@ sub GenerateFunctionCallString() $result .= $indent . GetNativeType($returnType, 0) . " result = *imp;\n" . $indent . "$functionString;\n"; } elsif ($returnsListItemPodType) { $result .= $indent . "RefPtr<SVGPODListItem<$nativeReturnType> > result = $functionString;\n"; - } elsif (@{$function->raisesExceptions} or $returnsPodType or $isPodType or IsSVGTypeNeedingContextParameter($returnType)) { + } elsif ($hasScriptState or @{$function->raisesExceptions} or $returnsPodType or $isPodType or IsSVGTypeNeedingContextParameter($returnType)) { $result .= $indent . $nativeReturnType . " result = $functionString;\n"; } else { # Can inline the function call into the return statement to avoid overhead of using a Ref<> temporary @@ -2390,7 +2602,13 @@ sub GenerateFunctionCallString() } if (@{$function->raisesExceptions}) { - $result .= $indent . "if (UNLIKELY(ec))\n" . $indent . " goto fail;\n"; + $result .= $indent . "if (UNLIKELY(ec))\n"; + $result .= $indent . " goto fail;\n"; + } + + if ($hasScriptState) { + $result .= $indent . "if (state.hadException())\n"; + $result .= $indent . " return throwError(state.exception());\n" } # If the return type is a POD type, separate out the wrapper generation @@ -2537,6 +2755,8 @@ sub GetNativeType # temporary hack return "RefPtr<NodeFilter>" if $type eq "NodeFilter"; + return "RefPtr<SerializedScriptValue>" if $type eq "SerializedScriptValue"; + # necessary as resolvers could be constructed on fly. return "RefPtr<XPathNSResolver>" if $type eq "XPathNSResolver"; @@ -2546,6 +2766,15 @@ sub GetNativeType return "${type}*"; } +sub GetNativeTypeForCallbacks +{ + my $type = shift; + return "const String&" if $type eq "DOMString"; + + # Callbacks use raw pointers, so pass isParameter = 1 + return GetNativeType($type, 1); +} + sub TranslateParameter { my $signature = shift; @@ -2735,6 +2964,7 @@ sub RequiresCustomSignature } +# FIXME: Sort this array. my %non_wrapper_types = ( 'float' => 1, 'double' => 1, @@ -2749,6 +2979,7 @@ my %non_wrapper_types = ( 'unsigned long long' => 1, 'DOMString' => 1, 'CompareHow' => 1, + 'SerializedScriptValue' => 1, 'SVGAngle' => 1, 'SVGRect' => 1, 'SVGPoint' => 1, @@ -2821,6 +3052,8 @@ sub ReturnNativeToJSValue return "return v8::Integer::NewFromUnsigned($value)" if $nativeType eq "unsigned"; return "return v8DateOrNull($value)" if $type eq "Date"; + # long long and unsigned long long are not representable in ECMAScript. + return "return v8::Number::New(static_cast<double>($value))" if $type eq "long long" or $type eq "unsigned long long"; return "return v8::Number::New($value)" if $codeGenerator->IsPrimitiveType($type) or $type eq "SVGPaintType"; return "return $value.v8Value()" if $nativeType eq "ScriptValue"; @@ -2833,6 +3066,8 @@ sub ReturnNativeToJSValue die "Unknown value for ConvertNullStringTo extended attribute"; } + $conv = $signature->extendedAttributes->{"ConvertScriptString"}; + return "v8StringOrNull(exec, $value)" if $conv; return "return v8String($value)"; } diff --git a/WebCore/bindings/scripts/IDLParser.pm b/WebCore/bindings/scripts/IDLParser.pm index 7db7747..c6742dc 100644 --- a/WebCore/bindings/scripts/IDLParser.pm +++ b/WebCore/bindings/scripts/IDLParser.pm @@ -80,10 +80,11 @@ sub Parse print " | *** Starting to parse $fileName...\n |\n" unless $beQuiet; - open2(\*PP_OUT, \*PP_IN, split(' ', $preprocessor), (map { "-D$_" } split(' ', $defines)), $fileName); + $pid = open2(\*PP_OUT, \*PP_IN, split(' ', $preprocessor), (map { "-D$_" } split(' ', $defines)), $fileName); close PP_IN; my @documentContent = <PP_OUT>; close PP_OUT; + waitpid($pid, 0); my $dataAvailable = 0; diff --git a/WebCore/bindings/scripts/IDLStructure.pm b/WebCore/bindings/scripts/IDLStructure.pm index 6224e54..e060252 100644 --- a/WebCore/bindings/scripts/IDLStructure.pm +++ b/WebCore/bindings/scripts/IDLStructure.pm @@ -96,7 +96,7 @@ $typeNamespaceSelector = '((?:' . $idlId . '*::)*)\s*(' . $idlDataType . '*)'; $exceptionSelector = 'exception\s*(' . $idlIdNs . '*)\s*([a-zA-Z\s{;]*};)'; $exceptionSubSelector = '{\s*' . $supportedTypes . '\s*(' . $idlType . '*)\s*;\s*}'; -$interfaceSelector = 'interface\s*((?:' . $extendedAttributeSyntax . ' )?)(' . $idlIdNs . '*)\s*(?::(\s*[^{]*))?{([a-zA-Z0-9_=\s(),;:\[\]]*)'; +$interfaceSelector = 'interface\s*((?:' . $extendedAttributeSyntax . ' )?)(' . $idlIdNs . '*)\s*(?::(\s*[^{]*))?{([a-zA-Z0-9_=\s(),;:\[\]&\|]*)'; $interfaceMethodSelector = '\s*((?:' . $extendedAttributeSyntax . ' )?)' . $supportedTypes . '\s*(' . $idlIdNs . '*)\s*\(\s*([a-zA-Z0-9:\s,=\[\]]*)'; $interfaceParameterSelector = 'in\s*((?:' . $extendedAttributeSyntax . ' )?)' . $supportedTypes . '\s*(' . $idlIdNs . '*)'; diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp new file mode 100644 index 0000000..6cfec74 --- /dev/null +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp @@ -0,0 +1,186 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include <glib-object.h> +#include "config.h" + +#include <wtf/GetPtr.h> +#include <wtf/RefPtr.h> +#include "ExceptionCode.h" +#include "TestCallback.h" +#include "WebKitDOMBinding.h" +#include "gobject/ConvertToUTF8String.h" +#include "webkit/WebKitDOMClass1.h" +#include "webkit/WebKitDOMClass1Private.h" +#include "webkit/WebKitDOMClass2.h" +#include "webkit/WebKitDOMClass2Private.h" +#include "webkit/WebKitDOMClass3.h" +#include "webkit/WebKitDOMClass3Private.h" +#include "webkit/WebKitDOMTestCallback.h" +#include "webkit/WebKitDOMTestCallbackPrivate.h" +#include "webkitmarshal.h" +#include "webkitprivate.h" + +namespace WebKit { + +gpointer kit(WebCore::TestCallback* obj) +{ + g_return_val_if_fail(obj != 0, 0); + + if (gpointer ret = DOMObjectCache::get(obj)) + return ret; + + return DOMObjectCache::put(obj, WebKit::wrapTestCallback(obj)); +} + +} // namespace WebKit // + +gboolean +webkit_dom_test_callback_callback_with_class1param (WebKitDOMTestCallback *self, WebKitDOMClass1* class1param) +{ + g_return_val_if_fail (self, 0); + WebCore::TestCallback * item = WebKit::core(self); + g_return_val_if_fail (class1param, 0); + WebCore::Class1 * _g_class1param = WebKit::core(class1param); + g_return_val_if_fail (_g_class1param, 0); + gboolean res = item->callbackWithClass1Param(_g_class1param); + return res; + +} + +gboolean +webkit_dom_test_callback_callback_with_class2param (WebKitDOMTestCallback *self, WebKitDOMClass2* class2param, gchar* str_arg) +{ + g_return_val_if_fail (self, 0); + WebCore::TestCallback * item = WebKit::core(self); + g_return_val_if_fail (class2param, 0); + g_return_val_if_fail (str_arg, 0); + WebCore::Class2 * _g_class2param = WebKit::core(class2param); + g_return_val_if_fail (_g_class2param, 0); + WebCore::String _g_str_arg = WebCore::String::fromUTF8(str_arg); + gboolean res = item->callbackWithClass2Param(_g_class2param, _g_str_arg); + return res; + +} + +glong +webkit_dom_test_callback_callback_with_non_bool_return_type (WebKitDOMTestCallback *self, WebKitDOMClass3* class3param) +{ + g_return_val_if_fail (self, 0); + WebCore::TestCallback * item = WebKit::core(self); + g_return_val_if_fail (class3param, 0); + WebCore::Class3 * _g_class3param = WebKit::core(class3param); + g_return_val_if_fail (_g_class3param, 0); + glong res = item->callbackWithNonBoolReturnType(_g_class3param); + return res; + +} + + +G_DEFINE_TYPE(WebKitDOMTestCallback, webkit_dom_test_callback, WEBKIT_TYPE_DOM_OBJECT) + +namespace WebKit { + +WebKitDOMTestCallback* wrapTestCallback(WebCore::TestCallback* coreObject) +{ + g_return_val_if_fail(coreObject != 0, 0); + + WebKitDOMTestCallback* wrapper = WEBKIT_DOM_TEST_CALLBACK(g_object_new(WEBKIT_TYPE_DOM_TEST_CALLBACK, NULL)); + g_return_val_if_fail(wrapper != 0, 0); + + /* We call ref() rather than using a C++ smart pointer because we can't store a C++ object + * in a C-allocated GObject structure. See the finalize() code for the + * matching deref(). + */ + + coreObject->ref(); + WEBKIT_DOM_OBJECT(wrapper)->coreObject = coreObject; + + return wrapper; +} + +WebCore::TestCallback* core(WebKitDOMTestCallback* request) +{ + g_return_val_if_fail(request != 0, 0); + + WebCore::TestCallback* coreObject = static_cast<WebCore::TestCallback*>(WEBKIT_DOM_OBJECT(request)->coreObject); + g_return_val_if_fail(coreObject != 0, 0); + + return coreObject; +} + +} // namespace WebKit +enum { + PROP_0, +}; + + +static void webkit_dom_test_callback_finalize(GObject* object) +{ + WebKitDOMObject* dom_object = WEBKIT_DOM_OBJECT(object); + + if (dom_object->coreObject != NULL) { + WebCore::TestCallback* coreObject = static_cast<WebCore::TestCallback *>(dom_object->coreObject); + + WebKit::DOMObjectCache::forget(coreObject); + coreObject->deref(); + + dom_object->coreObject = NULL; + } + + G_OBJECT_CLASS(webkit_dom_test_callback_parent_class)->finalize(object); +} + +static void webkit_dom_test_callback_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec) +{ + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } +} + + +static void webkit_dom_test_callback_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) +{ + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } +} + + +static void webkit_dom_test_callback_class_init(WebKitDOMTestCallbackClass* requestClass) +{ + GObjectClass *gobjectClass = G_OBJECT_CLASS(requestClass); + gobjectClass->finalize = webkit_dom_test_callback_finalize; + gobjectClass->set_property = webkit_dom_test_callback_set_property; + gobjectClass->get_property = webkit_dom_test_callback_get_property; + + + + +} + +static void webkit_dom_test_callback_init(WebKitDOMTestCallback* request) +{ +} + diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h new file mode 100644 index 0000000..088c457 --- /dev/null +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h @@ -0,0 +1,60 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef WebKitDOMTestCallback_h +#define WebKitDOMTestCallback_h + +#include "webkit/webkitdomdefines.h" +#include <glib-object.h> +#include <webkit/webkitdefines.h> +#include "webkit/WebKitDOMObject.h" + + +G_BEGIN_DECLS +#define WEBKIT_TYPE_DOM_TEST_CALLBACK (webkit_dom_test_callback_get_type()) +#define WEBKIT_DOM_TEST_CALLBACK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_DOM_TEST_CALLBACK, WebKitDOMTestCallback)) +#define WEBKIT_DOM_TEST_CALLBACK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_DOM_TEST_CALLBACK, WebKitDOMTestCallbackClass) +#define WEBKIT_DOM_IS_TEST_CALLBACK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_DOM_TEST_CALLBACK)) +#define WEBKIT_DOM_IS_TEST_CALLBACK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_DOM_TEST_CALLBACK)) +#define WEBKIT_DOM_TEST_CALLBACK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_DOM_TEST_CALLBACK, WebKitDOMTestCallbackClass)) + +struct _WebKitDOMTestCallback { + WebKitDOMObject parent_instance; +}; + +struct _WebKitDOMTestCallbackClass { + WebKitDOMObjectClass parent_class; +}; + +WEBKIT_API GType +webkit_dom_test_callback_get_type (void); + +WEBKIT_API gboolean +webkit_dom_test_callback_callback_with_class1param (WebKitDOMTestCallback *self, WebKitDOMClass1* class1param); + +WEBKIT_API gboolean +webkit_dom_test_callback_callback_with_class2param (WebKitDOMTestCallback *self, WebKitDOMClass2* class2param, gchar* str_arg); + +WEBKIT_API glong +webkit_dom_test_callback_callback_with_non_bool_return_type (WebKitDOMTestCallback *self, WebKitDOMClass3* class3param); + +G_END_DECLS + +#endif /* WebKitDOMTestCallback_h */ diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallbackPrivate.h b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallbackPrivate.h new file mode 100644 index 0000000..45884b2 --- /dev/null +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallbackPrivate.h @@ -0,0 +1,39 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef WEB_KIT_DOM_TEST_CALLBACK_PRIVATE_H +#define WEB_KIT_DOM_TEST_CALLBACK_PRIVATE_H + +#include <glib-object.h> +#include <webkit/WebKitDOMObject.h> +#include "TestCallback.h" +namespace WebKit { + WebKitDOMTestCallback * + wrapTestCallback(WebCore::TestCallback *coreObject); + + WebCore::TestCallback * + core(WebKitDOMTestCallback *request); + + gpointer + kit(WebCore::TestCallback* node); + +} // namespace WebKit + +#endif /* WEB_KIT_DOM_TEST_CALLBACK_PRIVATE_H */ diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp new file mode 100644 index 0000000..2be0277 --- /dev/null +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp @@ -0,0 +1,139 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include <glib-object.h> +#include "config.h" + +#include <wtf/GetPtr.h> +#include <wtf/RefPtr.h> +#include "ExceptionCode.h" +#include "TestInterface.h" +#include "WebKitDOMBinding.h" +#include "gobject/ConvertToUTF8String.h" +#include "webkit/WebKitDOMTestInterface.h" +#include "webkit/WebKitDOMTestInterfacePrivate.h" +#include "webkitmarshal.h" +#include "webkitprivate.h" + +namespace WebKit { + +gpointer kit(WebCore::TestInterface* obj) +{ + g_return_val_if_fail(obj != 0, 0); + + if (gpointer ret = DOMObjectCache::get(obj)) + return ret; + + return DOMObjectCache::put(obj, WebKit::wrapTestInterface(obj)); +} + +} // namespace WebKit // + + +G_DEFINE_TYPE(WebKitDOMTestInterface, webkit_dom_test_interface, WEBKIT_TYPE_DOM_OBJECT) + +namespace WebKit { + +WebKitDOMTestInterface* wrapTestInterface(WebCore::TestInterface* coreObject) +{ + g_return_val_if_fail(coreObject != 0, 0); + + WebKitDOMTestInterface* wrapper = WEBKIT_DOM_TEST_INTERFACE(g_object_new(WEBKIT_TYPE_DOM_TEST_INTERFACE, NULL)); + g_return_val_if_fail(wrapper != 0, 0); + + /* We call ref() rather than using a C++ smart pointer because we can't store a C++ object + * in a C-allocated GObject structure. See the finalize() code for the + * matching deref(). + */ + + coreObject->ref(); + WEBKIT_DOM_OBJECT(wrapper)->coreObject = coreObject; + + return wrapper; +} + +WebCore::TestInterface* core(WebKitDOMTestInterface* request) +{ + g_return_val_if_fail(request != 0, 0); + + WebCore::TestInterface* coreObject = static_cast<WebCore::TestInterface*>(WEBKIT_DOM_OBJECT(request)->coreObject); + g_return_val_if_fail(coreObject != 0, 0); + + return coreObject; +} + +} // namespace WebKit +enum { + PROP_0, +}; + + +static void webkit_dom_test_interface_finalize(GObject* object) +{ + WebKitDOMObject* dom_object = WEBKIT_DOM_OBJECT(object); + + if (dom_object->coreObject != NULL) { + WebCore::TestInterface* coreObject = static_cast<WebCore::TestInterface *>(dom_object->coreObject); + + WebKit::DOMObjectCache::forget(coreObject); + coreObject->deref(); + + dom_object->coreObject = NULL; + } + + G_OBJECT_CLASS(webkit_dom_test_interface_parent_class)->finalize(object); +} + +static void webkit_dom_test_interface_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec) +{ + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } +} + + +static void webkit_dom_test_interface_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) +{ + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } +} + + +static void webkit_dom_test_interface_class_init(WebKitDOMTestInterfaceClass* requestClass) +{ + GObjectClass *gobjectClass = G_OBJECT_CLASS(requestClass); + gobjectClass->finalize = webkit_dom_test_interface_finalize; + gobjectClass->set_property = webkit_dom_test_interface_set_property; + gobjectClass->get_property = webkit_dom_test_interface_get_property; + + + + +} + +static void webkit_dom_test_interface_init(WebKitDOMTestInterface* request) +{ +} + diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.h b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.h new file mode 100644 index 0000000..f9af866 --- /dev/null +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.h @@ -0,0 +1,51 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef WebKitDOMTestInterface_h +#define WebKitDOMTestInterface_h + +#include "webkit/webkitdomdefines.h" +#include <glib-object.h> +#include <webkit/webkitdefines.h> +#include "webkit/WebKitDOMObject.h" + + +G_BEGIN_DECLS +#define WEBKIT_TYPE_DOM_TEST_INTERFACE (webkit_dom_test_interface_get_type()) +#define WEBKIT_DOM_TEST_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_DOM_TEST_INTERFACE, WebKitDOMTestInterface)) +#define WEBKIT_DOM_TEST_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_DOM_TEST_INTERFACE, WebKitDOMTestInterfaceClass) +#define WEBKIT_DOM_IS_TEST_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_DOM_TEST_INTERFACE)) +#define WEBKIT_DOM_IS_TEST_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_DOM_TEST_INTERFACE)) +#define WEBKIT_DOM_TEST_INTERFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_DOM_TEST_INTERFACE, WebKitDOMTestInterfaceClass)) + +struct _WebKitDOMTestInterface { + WebKitDOMObject parent_instance; +}; + +struct _WebKitDOMTestInterfaceClass { + WebKitDOMObjectClass parent_class; +}; + +WEBKIT_API GType +webkit_dom_test_interface_get_type (void); + +G_END_DECLS + +#endif /* WebKitDOMTestInterface_h */ diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfacePrivate.h b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfacePrivate.h new file mode 100644 index 0000000..45fb949 --- /dev/null +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfacePrivate.h @@ -0,0 +1,39 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef WEB_KIT_DOM_TEST_INTERFACE_PRIVATE_H +#define WEB_KIT_DOM_TEST_INTERFACE_PRIVATE_H + +#include <glib-object.h> +#include <webkit/WebKitDOMObject.h> +#include "TestInterface.h" +namespace WebKit { + WebKitDOMTestInterface * + wrapTestInterface(WebCore::TestInterface *coreObject); + + WebCore::TestInterface * + core(WebKitDOMTestInterface *request); + + gpointer + kit(WebCore::TestInterface* node); + +} // namespace WebKit + +#endif /* WEB_KIT_DOM_TEST_INTERFACE_PRIVATE_H */ diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp new file mode 100644 index 0000000..8c1bae2 --- /dev/null +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp @@ -0,0 +1,779 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include <glib-object.h> +#include "config.h" + +#include <wtf/GetPtr.h> +#include <wtf/RefPtr.h> +#include "ExceptionCode.h" +#include "TestObj.h" +#include "WebKitDOMBinding.h" +#include "gobject/ConvertToUTF8String.h" +#include "webkit/WebKitDOMSerializedScriptValue.h" +#include "webkit/WebKitDOMSerializedScriptValuePrivate.h" +#include "webkit/WebKitDOMTestObj.h" +#include "webkit/WebKitDOMTestObjPrivate.h" +#include "webkitmarshal.h" +#include "webkitprivate.h" + +namespace WebKit { + +gpointer kit(WebCore::TestObj* obj) +{ + g_return_val_if_fail(obj != 0, 0); + + if (gpointer ret = DOMObjectCache::get(obj)) + return ret; + + return DOMObjectCache::put(obj, WebKit::wrapTestObj(obj)); +} + +} // namespace WebKit // + +void +webkit_dom_test_obj_void_method (WebKitDOMTestObj *self) +{ + g_return_if_fail (self); + WebCore::TestObj * item = WebKit::core(self); + item->voidMethod(); + +} + +void +webkit_dom_test_obj_void_method_with_args (WebKitDOMTestObj *self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg) +{ + g_return_if_fail (self); + WebCore::TestObj * item = WebKit::core(self); + g_return_if_fail (str_arg); + g_return_if_fail (obj_arg); + WebCore::String _g_str_arg = WebCore::String::fromUTF8(str_arg); + WebCore::TestObj * _g_obj_arg = WebKit::core(obj_arg); + g_return_if_fail (_g_obj_arg); + item->voidMethodWithArgs(int_arg, _g_str_arg, _g_obj_arg); + +} + +glong +webkit_dom_test_obj_int_method (WebKitDOMTestObj *self) +{ + g_return_val_if_fail (self, 0); + WebCore::TestObj * item = WebKit::core(self); + glong res = item->intMethod(); + return res; + +} + +glong +webkit_dom_test_obj_int_method_with_args (WebKitDOMTestObj *self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg) +{ + g_return_val_if_fail (self, 0); + WebCore::TestObj * item = WebKit::core(self); + g_return_val_if_fail (str_arg, 0); + g_return_val_if_fail (obj_arg, 0); + WebCore::String _g_str_arg = WebCore::String::fromUTF8(str_arg); + WebCore::TestObj * _g_obj_arg = WebKit::core(obj_arg); + g_return_val_if_fail (_g_obj_arg, 0); + glong res = item->intMethodWithArgs(int_arg, _g_str_arg, _g_obj_arg); + return res; + +} + +WebKitDOMTestObj* +webkit_dom_test_obj_obj_method (WebKitDOMTestObj *self) +{ + g_return_val_if_fail (self, 0); + WebCore::TestObj * item = WebKit::core(self); + PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->objMethod()); + WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); + return res; + +} + +WebKitDOMTestObj* +webkit_dom_test_obj_obj_method_with_args (WebKitDOMTestObj *self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg) +{ + g_return_val_if_fail (self, 0); + WebCore::TestObj * item = WebKit::core(self); + g_return_val_if_fail (str_arg, 0); + g_return_val_if_fail (obj_arg, 0); + WebCore::String _g_str_arg = WebCore::String::fromUTF8(str_arg); + WebCore::TestObj * _g_obj_arg = WebKit::core(obj_arg); + g_return_val_if_fail (_g_obj_arg, 0); + PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->objMethodWithArgs(int_arg, _g_str_arg, _g_obj_arg)); + WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); + return res; + +} + +void +webkit_dom_test_obj_serialized_value (WebKitDOMTestObj *self, WebKitDOMSerializedScriptValue* serialized_arg) +{ + g_return_if_fail (self); + WebCore::TestObj * item = WebKit::core(self); + g_return_if_fail (serialized_arg); + WebCore::SerializedScriptValue * _g_serialized_arg = WebKit::core(serialized_arg); + g_return_if_fail (_g_serialized_arg); + item->serializedValue(_g_serialized_arg); + +} + +void +webkit_dom_test_obj_method_with_exception (WebKitDOMTestObj *self, GError **error) +{ + g_return_if_fail (self); + WebCore::TestObj * item = WebKit::core(self); + WebCore::ExceptionCode ec = 0; + item->methodWithException(ec); + if (ec) { + WebCore::ExceptionCodeDescription ecdesc; + WebCore::getExceptionCodeDescription(ec, ecdesc); + g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); + } + +} + + +/* TODO: event function webkit_dom_test_obj_add_event_listener */ + + +/* TODO: event function webkit_dom_test_obj_remove_event_listener */ + +void +webkit_dom_test_obj_with_dynamic_frame (WebKitDOMTestObj *self) +{ + g_return_if_fail (self); + WebCore::TestObj * item = WebKit::core(self); + item->withDynamicFrame(); + +} + +void +webkit_dom_test_obj_with_dynamic_frame_and_arg (WebKitDOMTestObj *self, glong int_arg) +{ + g_return_if_fail (self); + WebCore::TestObj * item = WebKit::core(self); + item->withDynamicFrameAndArg(int_arg); + +} + +void +webkit_dom_test_obj_with_dynamic_frame_and_optional_arg (WebKitDOMTestObj *self, glong int_arg, glong optional_arg) +{ + g_return_if_fail (self); + WebCore::TestObj * item = WebKit::core(self); + item->withDynamicFrameAndOptionalArg(int_arg, optional_arg); + +} + +void +webkit_dom_test_obj_with_dynamic_frame_and_user_gesture (WebKitDOMTestObj *self, glong int_arg) +{ + g_return_if_fail (self); + WebCore::TestObj * item = WebKit::core(self); + item->withDynamicFrameAndUserGesture(int_arg); + +} + +void +webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad (WebKitDOMTestObj *self, glong int_arg, glong optional_arg) +{ + g_return_if_fail (self); + WebCore::TestObj * item = WebKit::core(self); + item->withDynamicFrameAndUserGestureASAD(int_arg, optional_arg); + +} + +void +webkit_dom_test_obj_with_script_state_void (WebKitDOMTestObj *self) +{ + g_return_if_fail (self); + WebCore::TestObj * item = WebKit::core(self); + item->withScriptStateVoid(); + +} + +WebKitDOMTestObj* +webkit_dom_test_obj_with_script_state_obj (WebKitDOMTestObj *self) +{ + g_return_val_if_fail (self, 0); + WebCore::TestObj * item = WebKit::core(self); + PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->withScriptStateObj()); + WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); + return res; + +} + +void +webkit_dom_test_obj_with_script_state_void_exception (WebKitDOMTestObj *self, GError **error) +{ + g_return_if_fail (self); + WebCore::TestObj * item = WebKit::core(self); + WebCore::ExceptionCode ec = 0; + item->withScriptStateVoidException(ec); + if (ec) { + WebCore::ExceptionCodeDescription ecdesc; + WebCore::getExceptionCodeDescription(ec, ecdesc); + g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); + } + +} + +WebKitDOMTestObj* +webkit_dom_test_obj_with_script_state_obj_exception (WebKitDOMTestObj *self, GError **error) +{ + g_return_val_if_fail (self, 0); + WebCore::TestObj * item = WebKit::core(self); + WebCore::ExceptionCode ec = 0; + PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->withScriptStateObjException(ec)); + if (ec) { + WebCore::ExceptionCodeDescription ecdesc; + WebCore::getExceptionCodeDescription(ec, ecdesc); + g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); + } + WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); + return res; + +} + +void +webkit_dom_test_obj_method_with_optional_arg (WebKitDOMTestObj *self, glong opt) +{ + g_return_if_fail (self); + WebCore::TestObj * item = WebKit::core(self); + item->methodWithOptionalArg(opt); + +} + +void +webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg (WebKitDOMTestObj *self, glong non_opt, glong opt) +{ + g_return_if_fail (self); + WebCore::TestObj * item = WebKit::core(self); + item->methodWithNonOptionalArgAndOptionalArg(non_opt, opt); + +} + +void +webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args (WebKitDOMTestObj *self, glong non_opt, glong opt1, glong opt2) +{ + g_return_if_fail (self); + WebCore::TestObj * item = WebKit::core(self); + item->methodWithNonOptionalArgAndTwoOptionalArgs(non_opt, opt1, opt2); + +} + +glong +webkit_dom_test_obj_get_read_only_int_attr (WebKitDOMTestObj *self) +{ + g_return_val_if_fail (self, 0); + WebCore::TestObj * item = WebKit::core(self); + glong res = item->readOnlyIntAttr(); + return res; + +} + +gchar* +webkit_dom_test_obj_get_read_only_string_attr (WebKitDOMTestObj *self) +{ + g_return_val_if_fail (self, 0); + WebCore::TestObj * item = WebKit::core(self); + gchar* res = convertToUTF8String(item->readOnlyStringAttr()); + return res; + +} + +WebKitDOMTestObj* +webkit_dom_test_obj_get_read_only_test_obj_attr (WebKitDOMTestObj *self) +{ + g_return_val_if_fail (self, 0); + WebCore::TestObj * item = WebKit::core(self); + PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->readOnlyTestObjAttr()); + WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); + return res; + +} + +glong +webkit_dom_test_obj_get_int_attr (WebKitDOMTestObj *self) +{ + g_return_val_if_fail (self, 0); + WebCore::TestObj * item = WebKit::core(self); + glong res = item->intAttr(); + return res; + +} + +void +webkit_dom_test_obj_set_int_attr (WebKitDOMTestObj *self, glong value) +{ + g_return_if_fail (self); + WebCore::TestObj * item = WebKit::core(self); + item->setIntAttr(value); + +} + +gint64 +webkit_dom_test_obj_get_long_long_attr (WebKitDOMTestObj *self) +{ + g_return_val_if_fail (self, 0); + WebCore::TestObj * item = WebKit::core(self); + gint64 res = item->longLongAttr(); + return res; + +} + +void +webkit_dom_test_obj_set_long_long_attr (WebKitDOMTestObj *self, gint64 value) +{ + g_return_if_fail (self); + WebCore::TestObj * item = WebKit::core(self); + item->setLongLongAttr(value); + +} + +guint64 +webkit_dom_test_obj_get_unsigned_long_long_attr (WebKitDOMTestObj *self) +{ + g_return_val_if_fail (self, 0); + WebCore::TestObj * item = WebKit::core(self); + guint64 res = item->unsignedLongLongAttr(); + return res; + +} + +void +webkit_dom_test_obj_set_unsigned_long_long_attr (WebKitDOMTestObj *self, guint64 value) +{ + g_return_if_fail (self); + WebCore::TestObj * item = WebKit::core(self); + item->setUnsignedLongLongAttr(value); + +} + +gchar* +webkit_dom_test_obj_get_string_attr (WebKitDOMTestObj *self) +{ + g_return_val_if_fail (self, 0); + WebCore::TestObj * item = WebKit::core(self); + gchar* res = convertToUTF8String(item->stringAttr()); + return res; + +} + +void +webkit_dom_test_obj_set_string_attr (WebKitDOMTestObj *self, gchar* value) +{ + g_return_if_fail (self); + WebCore::TestObj * item = WebKit::core(self); + g_return_if_fail (value); + WebCore::String _g_value = WebCore::String::fromUTF8(value); + item->setStringAttr(_g_value); + +} + +WebKitDOMTestObj* +webkit_dom_test_obj_get_test_obj_attr (WebKitDOMTestObj *self) +{ + g_return_val_if_fail (self, 0); + WebCore::TestObj * item = WebKit::core(self); + PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->testObjAttr()); + WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); + return res; + +} + +void +webkit_dom_test_obj_set_test_obj_attr (WebKitDOMTestObj *self, WebKitDOMTestObj* value) +{ + g_return_if_fail (self); + WebCore::TestObj * item = WebKit::core(self); + g_return_if_fail (value); + WebCore::TestObj * _g_value = WebKit::core(value); + g_return_if_fail (_g_value); + item->setTestObjAttr(_g_value); + +} + +glong +webkit_dom_test_obj_get_attr_with_exception (WebKitDOMTestObj *self) +{ + g_return_val_if_fail (self, 0); + WebCore::TestObj * item = WebKit::core(self); + glong res = item->attrWithException(); + return res; + +} + +void +webkit_dom_test_obj_set_attr_with_exception (WebKitDOMTestObj *self, glong value) +{ + g_return_if_fail (self); + WebCore::TestObj * item = WebKit::core(self); + item->setAttrWithException(value); + +} + +glong +webkit_dom_test_obj_get_attr_with_setter_exception (WebKitDOMTestObj *self) +{ + g_return_val_if_fail (self, 0); + WebCore::TestObj * item = WebKit::core(self); + glong res = item->attrWithSetterException(); + return res; + +} + +void +webkit_dom_test_obj_set_attr_with_setter_exception (WebKitDOMTestObj *self, glong value) +{ + g_return_if_fail (self); + WebCore::TestObj * item = WebKit::core(self); + item->setAttrWithSetterException(value); + +} + +glong +webkit_dom_test_obj_get_attr_with_getter_exception (WebKitDOMTestObj *self) +{ + g_return_val_if_fail (self, 0); + WebCore::TestObj * item = WebKit::core(self); + glong res = item->attrWithGetterException(); + return res; + +} + +void +webkit_dom_test_obj_set_attr_with_getter_exception (WebKitDOMTestObj *self, glong value) +{ + g_return_if_fail (self); + WebCore::TestObj * item = WebKit::core(self); + item->setAttrWithGetterException(value); + +} + +gchar* +webkit_dom_test_obj_get_script_string_attr (WebKitDOMTestObj *self) +{ + g_return_val_if_fail (self, 0); + WebCore::TestObj * item = WebKit::core(self); + gchar* res = convertToUTF8String(item->scriptStringAttr()); + return res; + +} + + +G_DEFINE_TYPE(WebKitDOMTestObj, webkit_dom_test_obj, WEBKIT_TYPE_DOM_OBJECT) + +namespace WebKit { + +WebKitDOMTestObj* wrapTestObj(WebCore::TestObj* coreObject) +{ + g_return_val_if_fail(coreObject != 0, 0); + + WebKitDOMTestObj* wrapper = WEBKIT_DOM_TEST_OBJ(g_object_new(WEBKIT_TYPE_DOM_TEST_OBJ, NULL)); + g_return_val_if_fail(wrapper != 0, 0); + + /* We call ref() rather than using a C++ smart pointer because we can't store a C++ object + * in a C-allocated GObject structure. See the finalize() code for the + * matching deref(). + */ + + coreObject->ref(); + WEBKIT_DOM_OBJECT(wrapper)->coreObject = coreObject; + + return wrapper; +} + +WebCore::TestObj* core(WebKitDOMTestObj* request) +{ + g_return_val_if_fail(request != 0, 0); + + WebCore::TestObj* coreObject = static_cast<WebCore::TestObj*>(WEBKIT_DOM_OBJECT(request)->coreObject); + g_return_val_if_fail(coreObject != 0, 0); + + return coreObject; +} + +} // namespace WebKit +enum { + PROP_0, + PROP_READ_ONLY_INT_ATTR, + PROP_READ_ONLY_STRING_ATTR, + PROP_READ_ONLY_TEST_OBJ_ATTR, + PROP_INT_ATTR, + PROP_LONG_LONG_ATTR, + PROP_UNSIGNED_LONG_LONG_ATTR, + PROP_STRING_ATTR, + PROP_TEST_OBJ_ATTR, + PROP_ATTR_WITH_EXCEPTION, + PROP_ATTR_WITH_SETTER_EXCEPTION, + PROP_ATTR_WITH_GETTER_EXCEPTION, + PROP_CUSTOM_ATTR, + PROP_SCRIPT_STRING_ATTR, +}; + + +static void webkit_dom_test_obj_finalize(GObject* object) +{ + WebKitDOMObject* dom_object = WEBKIT_DOM_OBJECT(object); + + if (dom_object->coreObject != NULL) { + WebCore::TestObj* coreObject = static_cast<WebCore::TestObj *>(dom_object->coreObject); + + WebKit::DOMObjectCache::forget(coreObject); + coreObject->deref(); + + dom_object->coreObject = NULL; + } + + G_OBJECT_CLASS(webkit_dom_test_obj_parent_class)->finalize(object); +} + +static void webkit_dom_test_obj_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec) +{ + WebKitDOMTestObj *self = WEBKIT_DOM_TEST_OBJ(object); + WebCore::TestObj* coreSelf = WebKit::core(self); + switch (prop_id) { + case PROP_INT_ATTR: + { + coreSelf->setIntAttr((g_value_get_long(value)) ); + break; + } + case PROP_UNSIGNED_LONG_LONG_ATTR: + { + coreSelf->setUnsignedLongLongAttr((g_value_get_uint64(value)) ); + break; + } + case PROP_STRING_ATTR: + { + coreSelf->setStringAttr(WebCore::String::fromUTF8(g_value_get_string(value)) ); + break; + } + case PROP_ATTR_WITH_EXCEPTION: + { + coreSelf->setAttrWithException((g_value_get_long(value)) ); + break; + } + case PROP_ATTR_WITH_SETTER_EXCEPTION: + { + coreSelf->setAttrWithSetterException((g_value_get_long(value)) ); + break; + } + case PROP_ATTR_WITH_GETTER_EXCEPTION: + { + coreSelf->setAttrWithGetterException((g_value_get_long(value)) ); + break; + } + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } +} + + +static void webkit_dom_test_obj_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) +{ + WebKitDOMTestObj* self = WEBKIT_DOM_TEST_OBJ(object); + WebCore::TestObj* coreSelf = WebKit::core(self); + switch (prop_id) { + case PROP_READ_ONLY_INT_ATTR: + { + g_value_set_long(value, coreSelf->readOnlyIntAttr()); + break; + } + case PROP_READ_ONLY_STRING_ATTR: + { + g_value_take_string(value, convertToUTF8String(coreSelf->readOnlyStringAttr())); + break; + } + case PROP_READ_ONLY_TEST_OBJ_ATTR: + { + RefPtr<WebCore::TestObj> ptr = coreSelf->readOnlyTestObjAttr(); + g_value_set_object(value, WebKit::kit(ptr.get())); + break; + } + case PROP_INT_ATTR: + { + g_value_set_long(value, coreSelf->intAttr()); + break; + } + case PROP_LONG_LONG_ATTR: + { + g_value_set_int64(value, coreSelf->longLongAttr()); + break; + } + case PROP_UNSIGNED_LONG_LONG_ATTR: + { + g_value_set_uint64(value, coreSelf->unsignedLongLongAttr()); + break; + } + case PROP_STRING_ATTR: + { + g_value_take_string(value, convertToUTF8String(coreSelf->stringAttr())); + break; + } + case PROP_TEST_OBJ_ATTR: + { + RefPtr<WebCore::TestObj> ptr = coreSelf->testObjAttr(); + g_value_set_object(value, WebKit::kit(ptr.get())); + break; + } + case PROP_ATTR_WITH_EXCEPTION: + { + g_value_set_long(value, coreSelf->attrWithException()); + break; + } + case PROP_ATTR_WITH_SETTER_EXCEPTION: + { + g_value_set_long(value, coreSelf->attrWithSetterException()); + break; + } + case PROP_ATTR_WITH_GETTER_EXCEPTION: + { + g_value_set_long(value, coreSelf->attrWithGetterException()); + break; + } + case PROP_SCRIPT_STRING_ATTR: + { + g_value_take_string(value, convertToUTF8String(coreSelf->scriptStringAttr())); + break; + } + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } +} + + +static void webkit_dom_test_obj_class_init(WebKitDOMTestObjClass* requestClass) +{ + GObjectClass *gobjectClass = G_OBJECT_CLASS(requestClass); + gobjectClass->finalize = webkit_dom_test_obj_finalize; + gobjectClass->set_property = webkit_dom_test_obj_set_property; + gobjectClass->get_property = webkit_dom_test_obj_get_property; + + g_object_class_install_property(gobjectClass, + PROP_READ_ONLY_INT_ATTR, + g_param_spec_long("read-only-int-attr", /* name */ + "test_obj_read-only-int-attr", /* short description */ + "read-only glong TestObj.read-only-int-attr", /* longer - could do with some extra doc stuff here */ + G_MINLONG, /* min */ +G_MAXLONG, /* max */ +0, /* default */ + WEBKIT_PARAM_READABLE)); + g_object_class_install_property(gobjectClass, + PROP_READ_ONLY_STRING_ATTR, + g_param_spec_string("read-only-string-attr", /* name */ + "test_obj_read-only-string-attr", /* short description */ + "read-only gchar* TestObj.read-only-string-attr", /* longer - could do with some extra doc stuff here */ + "", /* default */ + WEBKIT_PARAM_READABLE)); + g_object_class_install_property(gobjectClass, + PROP_READ_ONLY_TEST_OBJ_ATTR, + g_param_spec_object("read-only-test-obj-attr", /* name */ + "test_obj_read-only-test-obj-attr", /* short description */ + "read-only WebKitDOMTestObj* TestObj.read-only-test-obj-attr", /* longer - could do with some extra doc stuff here */ + WEBKIT_TYPE_DOM_TEST_OBJ, /* gobject type */ + WEBKIT_PARAM_READABLE)); + g_object_class_install_property(gobjectClass, + PROP_INT_ATTR, + g_param_spec_long("int-attr", /* name */ + "test_obj_int-attr", /* short description */ + "read-write glong TestObj.int-attr", /* longer - could do with some extra doc stuff here */ + G_MINLONG, /* min */ +G_MAXLONG, /* max */ +0, /* default */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, + PROP_LONG_LONG_ATTR, + g_param_spec_int64("long-long-attr", /* name */ + "test_obj_long-long-attr", /* short description */ + "read-write gint64 TestObj.long-long-attr", /* longer - could do with some extra doc stuff here */ + G_MININT64, /* min */ +G_MAXINT64, /* max */ +0, /* default */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, + PROP_UNSIGNED_LONG_LONG_ATTR, + g_param_spec_uint64("unsigned-long-long-attr", /* name */ + "test_obj_unsigned-long-long-attr", /* short description */ + "read-write guint64 TestObj.unsigned-long-long-attr", /* longer - could do with some extra doc stuff here */ + 0, /* min */ +G_MAXUINT64, /* min */ +0, /* default */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, + PROP_STRING_ATTR, + g_param_spec_string("string-attr", /* name */ + "test_obj_string-attr", /* short description */ + "read-write gchar* TestObj.string-attr", /* longer - could do with some extra doc stuff here */ + "", /* default */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, + PROP_TEST_OBJ_ATTR, + g_param_spec_object("test-obj-attr", /* name */ + "test_obj_test-obj-attr", /* short description */ + "read-write WebKitDOMTestObj* TestObj.test-obj-attr", /* longer - could do with some extra doc stuff here */ + WEBKIT_TYPE_DOM_TEST_OBJ, /* gobject type */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, + PROP_ATTR_WITH_EXCEPTION, + g_param_spec_long("attr-with-exception", /* name */ + "test_obj_attr-with-exception", /* short description */ + "read-write glong TestObj.attr-with-exception", /* longer - could do with some extra doc stuff here */ + G_MINLONG, /* min */ +G_MAXLONG, /* max */ +0, /* default */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, + PROP_ATTR_WITH_SETTER_EXCEPTION, + g_param_spec_long("attr-with-setter-exception", /* name */ + "test_obj_attr-with-setter-exception", /* short description */ + "read-write glong TestObj.attr-with-setter-exception", /* longer - could do with some extra doc stuff here */ + G_MINLONG, /* min */ +G_MAXLONG, /* max */ +0, /* default */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, + PROP_ATTR_WITH_GETTER_EXCEPTION, + g_param_spec_long("attr-with-getter-exception", /* name */ + "test_obj_attr-with-getter-exception", /* short description */ + "read-write glong TestObj.attr-with-getter-exception", /* longer - could do with some extra doc stuff here */ + G_MINLONG, /* min */ +G_MAXLONG, /* max */ +0, /* default */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, + PROP_SCRIPT_STRING_ATTR, + g_param_spec_string("script-string-attr", /* name */ + "test_obj_script-string-attr", /* short description */ + "read-only gchar* TestObj.script-string-attr", /* longer - could do with some extra doc stuff here */ + "", /* default */ + WEBKIT_PARAM_READABLE)); + + + +} + +static void webkit_dom_test_obj_init(WebKitDOMTestObj* request) +{ +} + diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h new file mode 100644 index 0000000..f8ad9c4 --- /dev/null +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h @@ -0,0 +1,177 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef WebKitDOMTestObj_h +#define WebKitDOMTestObj_h + +#include "webkit/webkitdomdefines.h" +#include <glib-object.h> +#include <webkit/webkitdefines.h> +#include "webkit/WebKitDOMObject.h" + + +G_BEGIN_DECLS +#define WEBKIT_TYPE_DOM_TEST_OBJ (webkit_dom_test_obj_get_type()) +#define WEBKIT_DOM_TEST_OBJ(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_DOM_TEST_OBJ, WebKitDOMTestObj)) +#define WEBKIT_DOM_TEST_OBJ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_DOM_TEST_OBJ, WebKitDOMTestObjClass) +#define WEBKIT_DOM_IS_TEST_OBJ(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_DOM_TEST_OBJ)) +#define WEBKIT_DOM_IS_TEST_OBJ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_DOM_TEST_OBJ)) +#define WEBKIT_DOM_TEST_OBJ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_DOM_TEST_OBJ, WebKitDOMTestObjClass)) + +struct _WebKitDOMTestObj { + WebKitDOMObject parent_instance; +}; + +struct _WebKitDOMTestObjClass { + WebKitDOMObjectClass parent_class; +}; + +WEBKIT_API GType +webkit_dom_test_obj_get_type (void); + +WEBKIT_API void +webkit_dom_test_obj_void_method (WebKitDOMTestObj *self); + +WEBKIT_API void +webkit_dom_test_obj_void_method_with_args (WebKitDOMTestObj *self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg); + +WEBKIT_API glong +webkit_dom_test_obj_int_method (WebKitDOMTestObj *self); + +WEBKIT_API glong +webkit_dom_test_obj_int_method_with_args (WebKitDOMTestObj *self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg); + +WEBKIT_API WebKitDOMTestObj* +webkit_dom_test_obj_obj_method (WebKitDOMTestObj *self); + +WEBKIT_API WebKitDOMTestObj* +webkit_dom_test_obj_obj_method_with_args (WebKitDOMTestObj *self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg); + +WEBKIT_API void +webkit_dom_test_obj_serialized_value (WebKitDOMTestObj *self, WebKitDOMSerializedScriptValue* serialized_arg); + +WEBKIT_API void +webkit_dom_test_obj_method_with_exception (WebKitDOMTestObj *self, GError **error); + + +/* TODO: event function webkit_dom_test_obj_add_event_listener */ + + +/* TODO: event function webkit_dom_test_obj_remove_event_listener */ + +WEBKIT_API void +webkit_dom_test_obj_with_dynamic_frame (WebKitDOMTestObj *self); + +WEBKIT_API void +webkit_dom_test_obj_with_dynamic_frame_and_arg (WebKitDOMTestObj *self, glong int_arg); + +WEBKIT_API void +webkit_dom_test_obj_with_dynamic_frame_and_optional_arg (WebKitDOMTestObj *self, glong int_arg, glong optional_arg); + +WEBKIT_API void +webkit_dom_test_obj_with_dynamic_frame_and_user_gesture (WebKitDOMTestObj *self, glong int_arg); + +WEBKIT_API void +webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad (WebKitDOMTestObj *self, glong int_arg, glong optional_arg); + +WEBKIT_API void +webkit_dom_test_obj_with_script_state_void (WebKitDOMTestObj *self); + +WEBKIT_API WebKitDOMTestObj* +webkit_dom_test_obj_with_script_state_obj (WebKitDOMTestObj *self); + +WEBKIT_API void +webkit_dom_test_obj_with_script_state_void_exception (WebKitDOMTestObj *self, GError **error); + +WEBKIT_API WebKitDOMTestObj* +webkit_dom_test_obj_with_script_state_obj_exception (WebKitDOMTestObj *self, GError **error); + +WEBKIT_API void +webkit_dom_test_obj_method_with_optional_arg (WebKitDOMTestObj *self, glong opt); + +WEBKIT_API void +webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg (WebKitDOMTestObj *self, glong non_opt, glong opt); + +WEBKIT_API void +webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args (WebKitDOMTestObj *self, glong non_opt, glong opt1, glong opt2); + +WEBKIT_API glong +webkit_dom_test_obj_get_read_only_int_attr (WebKitDOMTestObj *self); + +WEBKIT_API gchar* +webkit_dom_test_obj_get_read_only_string_attr (WebKitDOMTestObj *self); + +WEBKIT_API WebKitDOMTestObj* +webkit_dom_test_obj_get_read_only_test_obj_attr (WebKitDOMTestObj *self); + +WEBKIT_API glong +webkit_dom_test_obj_get_int_attr (WebKitDOMTestObj *self); + +WEBKIT_API void +webkit_dom_test_obj_set_int_attr (WebKitDOMTestObj *self, glong value); + +WEBKIT_API gint64 +webkit_dom_test_obj_get_long_long_attr (WebKitDOMTestObj *self); + +WEBKIT_API void +webkit_dom_test_obj_set_long_long_attr (WebKitDOMTestObj *self, gint64 value); + +WEBKIT_API guint64 +webkit_dom_test_obj_get_unsigned_long_long_attr (WebKitDOMTestObj *self); + +WEBKIT_API void +webkit_dom_test_obj_set_unsigned_long_long_attr (WebKitDOMTestObj *self, guint64 value); + +WEBKIT_API gchar* +webkit_dom_test_obj_get_string_attr (WebKitDOMTestObj *self); + +WEBKIT_API void +webkit_dom_test_obj_set_string_attr (WebKitDOMTestObj *self, gchar* value); + +WEBKIT_API WebKitDOMTestObj* +webkit_dom_test_obj_get_test_obj_attr (WebKitDOMTestObj *self); + +WEBKIT_API void +webkit_dom_test_obj_set_test_obj_attr (WebKitDOMTestObj *self, WebKitDOMTestObj* value); + +WEBKIT_API glong +webkit_dom_test_obj_get_attr_with_exception (WebKitDOMTestObj *self); + +WEBKIT_API void +webkit_dom_test_obj_set_attr_with_exception (WebKitDOMTestObj *self, glong value); + +WEBKIT_API glong +webkit_dom_test_obj_get_attr_with_setter_exception (WebKitDOMTestObj *self); + +WEBKIT_API void +webkit_dom_test_obj_set_attr_with_setter_exception (WebKitDOMTestObj *self, glong value); + +WEBKIT_API glong +webkit_dom_test_obj_get_attr_with_getter_exception (WebKitDOMTestObj *self); + +WEBKIT_API void +webkit_dom_test_obj_set_attr_with_getter_exception (WebKitDOMTestObj *self, glong value); + +WEBKIT_API gchar* +webkit_dom_test_obj_get_script_string_attr (WebKitDOMTestObj *self); + +G_END_DECLS + +#endif /* WebKitDOMTestObj_h */ diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObjPrivate.h b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObjPrivate.h new file mode 100644 index 0000000..78cd87f --- /dev/null +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObjPrivate.h @@ -0,0 +1,39 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef WEB_KIT_DOM_TEST_OBJ_PRIVATE_H +#define WEB_KIT_DOM_TEST_OBJ_PRIVATE_H + +#include <glib-object.h> +#include <webkit/WebKitDOMObject.h> +#include "TestObj.h" +namespace WebKit { + WebKitDOMTestObj * + wrapTestObj(WebCore::TestObj *coreObject); + + WebCore::TestObj * + core(WebKitDOMTestObj *request); + + gpointer + kit(WebCore::TestObj* node); + +} // namespace WebKit + +#endif /* WEB_KIT_DOM_TEST_OBJ_PRIVATE_H */ diff --git a/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp b/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp new file mode 100644 index 0000000..2d0cfae --- /dev/null +++ b/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp @@ -0,0 +1,100 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "config.h" + +#if ENABLE(DATABASE) + +#include "JSTestCallback.h" + +#include "JSClass1.h" +#include "JSClass2.h" +#include "ScriptExecutionContext.h" +#include <runtime/JSLock.h> +#include <wtf/MainThread.h> + +using namespace JSC; + +namespace WebCore { + +JSTestCallback::JSTestCallback(JSObject* callback, JSDOMGlobalObject* globalObject) + : m_data(new JSCallbackData(callback, globalObject)) + , m_isolatedWorld(globalObject->world()) +{ +} + +JSTestCallback::~JSTestCallback() +{ + callOnMainThread(JSCallbackData::deleteData, m_data); +#ifndef NDEBUG + m_data = 0; +#endif +} + +// Functions + +bool JSTestCallback::callbackWithClass1Param(ScriptExecutionContext* context, Class1* class1Param) +{ + ASSERT(m_data); + ASSERT(context); + + RefPtr<JSTestCallback> protect(this); + + JSLock lock(SilenceAssertionsOnly); + + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, m_isolatedWorld.get()); + if (!globalObject) + return true; + + ExecState* exec = globalObject->globalExec(); + MarkedArgumentBuffer args; + args.append(toJS(exec, class1Param)); + + bool raisedException = false; + m_data->invokeCallback(args, &raisedException); + return !raisedException; +} + +bool JSTestCallback::callbackWithClass2Param(ScriptExecutionContext* context, Class2* class2Param, const String& strArg) +{ + ASSERT(m_data); + ASSERT(context); + + RefPtr<JSTestCallback> protect(this); + + JSLock lock(SilenceAssertionsOnly); + + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, m_isolatedWorld.get()); + if (!globalObject) + return true; + + ExecState* exec = globalObject->globalExec(); + MarkedArgumentBuffer args; + args.append(toJS(exec, class2Param)); + args.append(toJS(exec, strArg)); + + bool raisedException = false; + m_data->invokeCallback(args, &raisedException); + return !raisedException; +} + +} + +#endif // ENABLE(DATABASE) diff --git a/WebCore/bindings/scripts/test/JS/JSTestCallback.h b/WebCore/bindings/scripts/test/JS/JSTestCallback.h new file mode 100644 index 0000000..6e8f083 --- /dev/null +++ b/WebCore/bindings/scripts/test/JS/JSTestCallback.h @@ -0,0 +1,58 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef JSTestCallback_h +#define JSTestCallback_h + +#if ENABLE(DATABASE) + +#include "JSCallbackData.h" +#include "TestCallback.h" +#include <wtf/Forward.h> + +namespace WebCore { + +class JSTestCallback : public TestCallback { +public: + static PassRefPtr<JSTestCallback> create(JSC::JSObject* callback, JSDOMGlobalObject* globalObject) + { + return adoptRef(new JSTestCallback(callback, globalObject)); + } + + virtual ~JSTestCallback(); + + // Functions + virtual bool callbackWithClass1Param(ScriptExecutionContext*, Class1* class1Param); + virtual bool callbackWithClass2Param(ScriptExecutionContext*, Class2* class2Param, const String& strArg); + COMPILE_ASSERT(false) virtual int callbackWithNonBoolReturnType(ScriptExecutionContext*, Class3* class3Param); + virtual int customCallback(ScriptExecutionContext*, Class5* class5Param, Class6* class6Param); + +private: + JSTestCallback(JSC::JSObject* callback, JSDOMGlobalObject*); + + JSCallbackData* m_data; + RefPtr<DOMWrapperWorld> m_isolatedWorld; +}; + +} // namespace WebCore + +#endif // ENABLE(DATABASE) + +#endif diff --git a/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp b/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp new file mode 100644 index 0000000..8855481 --- /dev/null +++ b/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp @@ -0,0 +1,193 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "config.h" +#include "JSTestInterface.h" + +#include "TestInterface.h" +#include <wtf/GetPtr.h> + +using namespace JSC; + +namespace WebCore { + +ASSERT_CLASS_FITS_IN_CELL(JSTestInterface); + +/* Hash table */ +#if ENABLE(JIT) +#define THUNK_GENERATOR(generator) , generator +#else +#define THUNK_GENERATOR(generator) +#endif + +static const HashTableValue JSTestInterfaceTableValues[2] = +{ + { "constructor", DontEnum|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, + { 0, 0, 0, 0 THUNK_GENERATOR(0) } +}; + +#undef THUNK_GENERATOR +static JSC_CONST_HASHTABLE HashTable JSTestInterfaceTable = +#if ENABLE(PERFECT_HASH_SIZE) + { 0, JSTestInterfaceTableValues, 0 }; +#else + { 2, 1, JSTestInterfaceTableValues, 0 }; +#endif + +/* Hash table for constructor */ +#if ENABLE(JIT) +#define THUNK_GENERATOR(generator) , generator +#else +#define THUNK_GENERATOR(generator) +#endif + +static const HashTableValue JSTestInterfaceConstructorTableValues[1] = +{ + { 0, 0, 0, 0 THUNK_GENERATOR(0) } +}; + +#undef THUNK_GENERATOR +static JSC_CONST_HASHTABLE HashTable JSTestInterfaceConstructorTable = +#if ENABLE(PERFECT_HASH_SIZE) + { 0, JSTestInterfaceConstructorTableValues, 0 }; +#else + { 1, 0, JSTestInterfaceConstructorTableValues, 0 }; +#endif + +class JSTestInterfaceConstructor : public DOMConstructorObject { +public: + JSTestInterfaceConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) + : DOMConstructorObject(JSTestInterfaceConstructor::createStructure(globalObject->objectPrototype()), globalObject) + { + putDirect(exec->propertyNames().prototype, JSTestInterfacePrototype::self(exec, globalObject), None); + } + virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); + virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); + virtual const ClassInfo* classInfo() const { return &s_info; } + static const ClassInfo s_info; + + static PassRefPtr<Structure> createStructure(JSValue proto) + { + return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); + } + +protected: + static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | DOMConstructorObject::StructureFlags; + static JSObject* constructTestInterface(ExecState* exec, JSObject* constructor, const ArgList&) + { + ScriptExecutionContext* context = static_cast<JSTestInterfaceConstructor*>(constructor)->scriptExecutionContext(); + if (!context) + return throwError(exec, ReferenceError); + return asObject(toJS(exec, static_cast<JSTestInterfaceConstructor*>(constructor)->globalObject(), TestInterface::create(context))); + } + virtual ConstructType getConstructData(ConstructData& constructData) + { + constructData.native.function = constructTestInterface; + return ConstructTypeHost; + } +}; + +const ClassInfo JSTestInterfaceConstructor::s_info = { "TestInterfaceConstructor", 0, &JSTestInterfaceConstructorTable, 0 }; + +bool JSTestInterfaceConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot<JSTestInterfaceConstructor, DOMObject>(exec, &JSTestInterfaceConstructorTable, this, propertyName, slot); +} + +bool JSTestInterfaceConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor<JSTestInterfaceConstructor, DOMObject>(exec, &JSTestInterfaceConstructorTable, this, propertyName, descriptor); +} + +/* Hash table for prototype */ +#if ENABLE(JIT) +#define THUNK_GENERATOR(generator) , generator +#else +#define THUNK_GENERATOR(generator) +#endif + +static const HashTableValue JSTestInterfacePrototypeTableValues[1] = +{ + { 0, 0, 0, 0 THUNK_GENERATOR(0) } +}; + +#undef THUNK_GENERATOR +static JSC_CONST_HASHTABLE HashTable JSTestInterfacePrototypeTable = +#if ENABLE(PERFECT_HASH_SIZE) + { 0, JSTestInterfacePrototypeTableValues, 0 }; +#else + { 1, 0, JSTestInterfacePrototypeTableValues, 0 }; +#endif + +const ClassInfo JSTestInterfacePrototype::s_info = { "TestInterfacePrototype", 0, &JSTestInterfacePrototypeTable, 0 }; + +JSObject* JSTestInterfacePrototype::self(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMPrototype<JSTestInterface>(exec, globalObject); +} + +const ClassInfo JSTestInterface::s_info = { "TestInterface", 0, &JSTestInterfaceTable, 0 }; + +JSTestInterface::JSTestInterface(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestInterface> impl) + : DOMObjectWithGlobalPointer(structure, globalObject) + , m_impl(impl) +{ +} + +JSTestInterface::~JSTestInterface() +{ + forgetDOMObject(this, impl()); +} + +JSObject* JSTestInterface::createPrototype(ExecState* exec, JSGlobalObject* globalObject) +{ + return new (exec) JSTestInterfacePrototype(JSTestInterfacePrototype::createStructure(globalObject->objectPrototype())); +} + +bool JSTestInterface::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot<JSTestInterface, Base>(exec, &JSTestInterfaceTable, this, propertyName, slot); +} + +bool JSTestInterface::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor<JSTestInterface, Base>(exec, &JSTestInterfaceTable, this, propertyName, descriptor); +} + +JSValue jsTestInterfaceConstructor(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestInterface* domObject = static_cast<JSTestInterface*>(asObject(slotBase)); + return JSTestInterface::getConstructor(exec, domObject->globalObject()); +} +JSValue JSTestInterface::getConstructor(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMConstructor<JSTestInterfaceConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); +} + +JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestInterface* object) +{ + return getDOMObjectWrapper<JSTestInterface>(exec, globalObject, object); +} +TestInterface* toTestInterface(JSC::JSValue value) +{ + return value.inherits(&JSTestInterface::s_info) ? static_cast<JSTestInterface*>(asObject(value))->impl() : 0; +} + +} diff --git a/WebCore/bindings/scripts/test/JS/JSTestInterface.h b/WebCore/bindings/scripts/test/JS/JSTestInterface.h new file mode 100644 index 0000000..c076dbd --- /dev/null +++ b/WebCore/bindings/scripts/test/JS/JSTestInterface.h @@ -0,0 +1,81 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef JSTestInterface_h +#define JSTestInterface_h + +#include "JSDOMBinding.h" +#include <runtime/JSGlobalObject.h> +#include <runtime/ObjectPrototype.h> + +namespace WebCore { + +class TestInterface; + +class JSTestInterface : public DOMObjectWithGlobalPointer { + typedef DOMObjectWithGlobalPointer Base; +public: + JSTestInterface(NonNullPassRefPtr<JSC::Structure>, JSDOMGlobalObject*, PassRefPtr<TestInterface>); + virtual ~JSTestInterface(); + static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); + virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); + virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); + virtual const JSC::ClassInfo* classInfo() const { return &s_info; } + static const JSC::ClassInfo s_info; + + static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) + { + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); + } + + static JSC::JSValue getConstructor(JSC::ExecState*, JSC::JSGlobalObject*); + TestInterface* impl() const { return m_impl.get(); } + +private: + RefPtr<TestInterface> m_impl; +protected: + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; +}; + +JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestInterface*); +TestInterface* toTestInterface(JSC::JSValue); + +class JSTestInterfacePrototype : public JSC::JSObject { + typedef JSC::JSObject Base; +public: + static JSC::JSObject* self(JSC::ExecState*, JSC::JSGlobalObject*); + virtual const JSC::ClassInfo* classInfo() const { return &s_info; } + static const JSC::ClassInfo s_info; + static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) + { + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); + } + JSTestInterfacePrototype(NonNullPassRefPtr<JSC::Structure> structure) : JSC::JSObject(structure) { } +protected: + static const unsigned StructureFlags = Base::StructureFlags; +}; + +// Attributes + +JSC::JSValue jsTestInterfaceConstructor(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); + +} // namespace WebCore + +#endif diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp new file mode 100644 index 0000000..da99de2 --- /dev/null +++ b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp @@ -0,0 +1,813 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "config.h" +#include "JSTestObj.h" + +#include "JSEventListener.h" +#include "JSTestObj.h" +#include "JSlog.h" +#include "KURL.h" +#include "ScriptCallStack.h" +#include "SerializedScriptValue.h" +#include "TestObj.h" +#include <runtime/Error.h> +#include <runtime/JSNumberCell.h> +#include <runtime/JSString.h> +#include <wtf/GetPtr.h> + +using namespace JSC; + +namespace WebCore { + +ASSERT_CLASS_FITS_IN_CELL(JSTestObj); + +/* Hash table */ +#if ENABLE(JIT) +#define THUNK_GENERATOR(generator) , generator +#else +#define THUNK_GENERATOR(generator) +#endif + +static const HashTableValue JSTestObjTableValues[15] = +{ + { "readOnlyIntAttr", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyIntAttr), (intptr_t)0 THUNK_GENERATOR(0) }, + { "readOnlyStringAttr", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyStringAttr), (intptr_t)0 THUNK_GENERATOR(0) }, + { "readOnlyTestObjAttr", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyTestObjAttr), (intptr_t)0 THUNK_GENERATOR(0) }, + { "intAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjIntAttr), (intptr_t)setJSTestObjIntAttr THUNK_GENERATOR(0) }, + { "longLongAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjLongLongAttr), (intptr_t)setJSTestObjLongLongAttr THUNK_GENERATOR(0) }, + { "unsignedLongLongAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjUnsignedLongLongAttr), (intptr_t)setJSTestObjUnsignedLongLongAttr THUNK_GENERATOR(0) }, + { "stringAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjStringAttr), (intptr_t)setJSTestObjStringAttr THUNK_GENERATOR(0) }, + { "testObjAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjTestObjAttr), (intptr_t)setJSTestObjTestObjAttr THUNK_GENERATOR(0) }, + { "attrWithException", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttrWithException), (intptr_t)setJSTestObjAttrWithException THUNK_GENERATOR(0) }, + { "attrWithSetterException", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttrWithSetterException), (intptr_t)setJSTestObjAttrWithSetterException THUNK_GENERATOR(0) }, + { "attrWithGetterException", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttrWithGetterException), (intptr_t)setJSTestObjAttrWithGetterException THUNK_GENERATOR(0) }, + { "customAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCustomAttr), (intptr_t)setJSTestObjCustomAttr THUNK_GENERATOR(0) }, + { "scriptStringAttr", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjScriptStringAttr), (intptr_t)0 THUNK_GENERATOR(0) }, + { "constructor", DontEnum|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, + { 0, 0, 0, 0 THUNK_GENERATOR(0) } +}; + +#undef THUNK_GENERATOR +static JSC_CONST_HASHTABLE HashTable JSTestObjTable = +#if ENABLE(PERFECT_HASH_SIZE) + { 127, JSTestObjTableValues, 0 }; +#else + { 34, 31, JSTestObjTableValues, 0 }; +#endif + +/* Hash table for constructor */ +#if ENABLE(JIT) +#define THUNK_GENERATOR(generator) , generator +#else +#define THUNK_GENERATOR(generator) +#endif + +static const HashTableValue JSTestObjConstructorTableValues[1] = +{ + { 0, 0, 0, 0 THUNK_GENERATOR(0) } +}; + +#undef THUNK_GENERATOR +static JSC_CONST_HASHTABLE HashTable JSTestObjConstructorTable = +#if ENABLE(PERFECT_HASH_SIZE) + { 0, JSTestObjConstructorTableValues, 0 }; +#else + { 1, 0, JSTestObjConstructorTableValues, 0 }; +#endif + +class JSTestObjConstructor : public DOMConstructorObject { +public: + JSTestObjConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) + : DOMConstructorObject(JSTestObjConstructor::createStructure(globalObject->objectPrototype()), globalObject) + { + putDirect(exec->propertyNames().prototype, JSTestObjPrototype::self(exec, globalObject), None); + } + virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); + virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); + virtual const ClassInfo* classInfo() const { return &s_info; } + static const ClassInfo s_info; + + static PassRefPtr<Structure> createStructure(JSValue proto) + { + return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); + } + +protected: + static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | DOMConstructorObject::StructureFlags; +}; + +const ClassInfo JSTestObjConstructor::s_info = { "TestObjConstructor", 0, &JSTestObjConstructorTable, 0 }; + +bool JSTestObjConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot<JSTestObjConstructor, DOMObject>(exec, &JSTestObjConstructorTable, this, propertyName, slot); +} + +bool JSTestObjConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor<JSTestObjConstructor, DOMObject>(exec, &JSTestObjConstructorTable, this, propertyName, descriptor); +} + +/* Hash table for prototype */ +#if ENABLE(JIT) +#define THUNK_GENERATOR(generator) , generator +#else +#define THUNK_GENERATOR(generator) +#endif + +static const HashTableValue JSTestObjPrototypeTableValues[26] = +{ + { "voidMethod", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionVoidMethod), (intptr_t)0 THUNK_GENERATOR(0) }, + { "voidMethodWithArgs", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionVoidMethodWithArgs), (intptr_t)3 THUNK_GENERATOR(0) }, + { "intMethod", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionIntMethod), (intptr_t)0 THUNK_GENERATOR(0) }, + { "intMethodWithArgs", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionIntMethodWithArgs), (intptr_t)3 THUNK_GENERATOR(0) }, + { "objMethod", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionObjMethod), (intptr_t)0 THUNK_GENERATOR(0) }, + { "objMethodWithArgs", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionObjMethodWithArgs), (intptr_t)3 THUNK_GENERATOR(0) }, + { "serializedValue", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionSerializedValue), (intptr_t)1 THUNK_GENERATOR(0) }, + { "methodWithException", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithException), (intptr_t)0 THUNK_GENERATOR(0) }, + { "customMethod", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionCustomMethod), (intptr_t)0 THUNK_GENERATOR(0) }, + { "customMethodWithArgs", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionCustomMethodWithArgs), (intptr_t)3 THUNK_GENERATOR(0) }, + { "customArgsAndException", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionCustomArgsAndException), (intptr_t)1 THUNK_GENERATOR(0) }, + { "addEventListener", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionAddEventListener), (intptr_t)3 THUNK_GENERATOR(0) }, + { "removeEventListener", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionRemoveEventListener), (intptr_t)3 THUNK_GENERATOR(0) }, + { "withDynamicFrame", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrame), (intptr_t)0 THUNK_GENERATOR(0) }, + { "withDynamicFrameAndArg", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrameAndArg), (intptr_t)1 THUNK_GENERATOR(0) }, + { "withDynamicFrameAndOptionalArg", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg), (intptr_t)2 THUNK_GENERATOR(0) }, + { "withDynamicFrameAndUserGesture", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture), (intptr_t)1 THUNK_GENERATOR(0) }, + { "withDynamicFrameAndUserGestureASAD", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD), (intptr_t)2 THUNK_GENERATOR(0) }, + { "withScriptStateVoid", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateVoid), (intptr_t)0 THUNK_GENERATOR(0) }, + { "withScriptStateObj", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateObj), (intptr_t)0 THUNK_GENERATOR(0) }, + { "withScriptStateVoidException", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateVoidException), (intptr_t)0 THUNK_GENERATOR(0) }, + { "withScriptStateObjException", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateObjException), (intptr_t)0 THUNK_GENERATOR(0) }, + { "methodWithOptionalArg", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalArg), (intptr_t)1 THUNK_GENERATOR(0) }, + { "methodWithNonOptionalArgAndOptionalArg", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg), (intptr_t)2 THUNK_GENERATOR(0) }, + { "methodWithNonOptionalArgAndTwoOptionalArgs", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs), (intptr_t)3 THUNK_GENERATOR(0) }, + { 0, 0, 0, 0 THUNK_GENERATOR(0) } +}; + +#undef THUNK_GENERATOR +static JSC_CONST_HASHTABLE HashTable JSTestObjPrototypeTable = +#if ENABLE(PERFECT_HASH_SIZE) + { 8191, JSTestObjPrototypeTableValues, 0 }; +#else + { 67, 63, JSTestObjPrototypeTableValues, 0 }; +#endif + +const ClassInfo JSTestObjPrototype::s_info = { "TestObjPrototype", 0, &JSTestObjPrototypeTable, 0 }; + +JSObject* JSTestObjPrototype::self(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMPrototype<JSTestObj>(exec, globalObject); +} + +bool JSTestObjPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticFunctionSlot<JSObject>(exec, &JSTestObjPrototypeTable, this, propertyName, slot); +} + +bool JSTestObjPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticFunctionDescriptor<JSObject>(exec, &JSTestObjPrototypeTable, this, propertyName, descriptor); +} + +const ClassInfo JSTestObj::s_info = { "TestObj", 0, &JSTestObjTable, 0 }; + +JSTestObj::JSTestObj(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestObj> impl) + : DOMObjectWithGlobalPointer(structure, globalObject) + , m_impl(impl) +{ +} + +JSTestObj::~JSTestObj() +{ + forgetDOMObject(this, impl()); +} + +JSObject* JSTestObj::createPrototype(ExecState* exec, JSGlobalObject* globalObject) +{ + return new (exec) JSTestObjPrototype(JSTestObjPrototype::createStructure(globalObject->objectPrototype())); +} + +bool JSTestObj::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot<JSTestObj, Base>(exec, &JSTestObjTable, this, propertyName, slot); +} + +bool JSTestObj::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor<JSTestObj, Base>(exec, &JSTestObjTable, this, propertyName, descriptor); +} + +JSValue jsTestObjReadOnlyIntAttr(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsNumber(exec, imp->readOnlyIntAttr()); + return result; +} + +JSValue jsTestObjReadOnlyStringAttr(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsString(exec, imp->readOnlyStringAttr()); + return result; +} + +JSValue jsTestObjReadOnlyTestObjAttr(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->readOnlyTestObjAttr())); + return result; +} + +JSValue jsTestObjIntAttr(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsNumber(exec, imp->intAttr()); + return result; +} + +JSValue jsTestObjLongLongAttr(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsNumber(exec, imp->longLongAttr()); + return result; +} + +JSValue jsTestObjUnsignedLongLongAttr(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsNumber(exec, imp->unsignedLongLongAttr()); + return result; +} + +JSValue jsTestObjStringAttr(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsString(exec, imp->stringAttr()); + return result; +} + +JSValue jsTestObjTestObjAttr(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->testObjAttr())); + return result; +} + +JSValue jsTestObjAttrWithException(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsNumber(exec, imp->attrWithException()); + return result; +} + +JSValue jsTestObjAttrWithSetterException(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsNumber(exec, imp->attrWithSetterException()); + return result; +} + +JSValue jsTestObjAttrWithGetterException(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsNumber(exec, imp->attrWithGetterException()); + return result; +} + +JSValue jsTestObjCustomAttr(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + return castedThis->customAttr(exec); +} + +JSValue jsTestObjScriptStringAttr(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsOwnedStringOrNull(exec, imp->scriptStringAttr()); + return result; +} + +JSValue jsTestObjConstructor(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* domObject = static_cast<JSTestObj*>(asObject(slotBase)); + return JSTestObj::getConstructor(exec, domObject->globalObject()); +} +void JSTestObj::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +{ + lookupPut<JSTestObj, Base>(exec, propertyName, value, &JSTestObjTable, this, slot); +} + +void setJSTestObjIntAttr(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setIntAttr(value.toInt32(exec)); +} + +void setJSTestObjLongLongAttr(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setLongLongAttr(static_cast<long long>(value.toInteger(exec))); +} + +void setJSTestObjUnsignedLongLongAttr(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setUnsignedLongLongAttr(static_cast<unsigned long long>(value.toInteger(exec))); +} + +void setJSTestObjStringAttr(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setStringAttr(ustringToString(value.toString(exec))); +} + +void setJSTestObjTestObjAttr(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setTestObjAttr(toTestObj(value)); +} + +void setJSTestObjAttrWithException(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setAttrWithException(value.toInt32(exec)); +} + +void setJSTestObjAttrWithSetterException(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setAttrWithSetterException(value.toInt32(exec)); +} + +void setJSTestObjAttrWithGetterException(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setAttrWithGetterException(value.toInt32(exec)); +} + +void setJSTestObjCustomAttr(ExecState* exec, JSObject* thisObject, JSValue value) +{ + static_cast<JSTestObj*>(thisObject)->setCustomAttr(exec, value); +} + +JSValue JSTestObj::getConstructor(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMConstructor<JSTestObjConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); +} + +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethod(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwError(exec, TypeError); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + + imp->voidMethod(); + return jsUndefined(); +} + +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwError(exec, TypeError); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + int intArg = args.at(0).toInt32(exec); + const String& strArg = ustringToString(args.at(1).toString(exec)); + TestObj* objArg = toTestObj(args.at(2)); + + imp->voidMethodWithArgs(intArg, strArg, objArg); + return jsUndefined(); +} + +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwError(exec, TypeError); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + + + JSC::JSValue result = jsNumber(exec, imp->intMethod()); + return result; +} + +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwError(exec, TypeError); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + int intArg = args.at(0).toInt32(exec); + const String& strArg = ustringToString(args.at(1).toString(exec)); + TestObj* objArg = toTestObj(args.at(2)); + + + JSC::JSValue result = jsNumber(exec, imp->intMethodWithArgs(intArg, strArg, objArg)); + return result; +} + +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethod(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwError(exec, TypeError); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + + + JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->objMethod())); + return result; +} + +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwError(exec, TypeError); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + int intArg = args.at(0).toInt32(exec); + const String& strArg = ustringToString(args.at(1).toString(exec)); + TestObj* objArg = toTestObj(args.at(2)); + + + JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->objMethodWithArgs(intArg, strArg, objArg))); + return result; +} + +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwError(exec, TypeError); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + RefPtr<SerializedScriptValue> serializedArg = SerializedScriptValue::create(exec, args.at(0)); + + imp->serializedValue(serializedArg); + return jsUndefined(); +} + +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwError(exec, TypeError); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + ExceptionCode ec = 0; + + imp->methodWithException(ec); + setDOMException(exec, ec); + return jsUndefined(); +} + +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwError(exec, TypeError); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + return castedThis->customMethod(exec, args); +} + +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwError(exec, TypeError); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + return castedThis->customMethodWithArgs(exec, args); +} + +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwError(exec, TypeError); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + ExceptionCode ec = 0; + ScriptCallStack callStack(exec, args, 1); + log* intArg = tolog(args.at(0)); + + imp->customArgsAndException(intArg, &callStack, ec); + setDOMException(exec, ec); + return jsUndefined(); +} + +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwError(exec, TypeError); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue listener = args.at(1); + if (!listener.isObject()) + return jsUndefined(); + imp->addEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), args.at(2).toBoolean(exec)); + return jsUndefined(); +} + +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionRemoveEventListener(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwError(exec, TypeError); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue listener = args.at(1); + if (!listener.isObject()) + return jsUndefined(); + imp->removeEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); + return jsUndefined(); +} + +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwError(exec, TypeError); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + Frame* dynamicFrame = toDynamicFrame(exec); + if (!dynamicFrame) + return jsUndefined(); + + imp->withDynamicFrame(dynamicFrame); + return jsUndefined(); +} + +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwError(exec, TypeError); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + Frame* dynamicFrame = toDynamicFrame(exec); + if (!dynamicFrame) + return jsUndefined(); + int intArg = args.at(1).toInt32(exec); + + imp->withDynamicFrameAndArg(dynamicFrame, intArg); + return jsUndefined(); +} + +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwError(exec, TypeError); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + Frame* dynamicFrame = toDynamicFrame(exec); + if (!dynamicFrame) + return jsUndefined(); + int intArg = args.at(1).toInt32(exec); + + int argsCount = args.size(); + if (argsCount < 3) { + imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg); + return jsUndefined(); + } + + int optionalArg = args.at(2).toInt32(exec); + + imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg, optionalArg); + return jsUndefined(); +} + +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwError(exec, TypeError); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + Frame* dynamicFrame = toDynamicFrame(exec); + if (!dynamicFrame) + return jsUndefined(); + int intArg = args.at(1).toInt32(exec); + + imp->withDynamicFrameAndUserGesture(dynamicFrame, intArg, processingUserGesture(exec)); + return jsUndefined(); +} + +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwError(exec, TypeError); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + Frame* dynamicFrame = toDynamicFrame(exec); + if (!dynamicFrame) + return jsUndefined(); + int intArg = args.at(1).toInt32(exec); + + int argsCount = args.size(); + if (argsCount < 3) { + imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg); + return jsUndefined(); + } + + int optionalArg = args.at(2).toInt32(exec); + + imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg, optionalArg, processingUserGesture(exec)); + return jsUndefined(); +} + +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwError(exec, TypeError); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + + imp->withScriptStateVoid(exec); + return jsUndefined(); +} + +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwError(exec, TypeError); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + + + JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->withScriptStateObj(exec))); + if (exec->hadException()) + return jsUndefined(); + return result; +} + +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoidException(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwError(exec, TypeError); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + ExceptionCode ec = 0; + + imp->withScriptStateVoidException(exec, ec); + setDOMException(exec, ec); + return jsUndefined(); +} + +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwError(exec, TypeError); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + ExceptionCode ec = 0; + + + JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->withScriptStateObjException(exec, ec))); + setDOMException(exec, ec); + if (exec->hadException()) + return jsUndefined(); + return result; +} + +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwError(exec, TypeError); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + + int argsCount = args.size(); + if (argsCount < 1) { + imp->methodWithOptionalArg(); + return jsUndefined(); + } + + int opt = args.at(0).toInt32(exec); + + imp->methodWithOptionalArg(opt); + return jsUndefined(); +} + +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwError(exec, TypeError); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + int nonOpt = args.at(0).toInt32(exec); + + int argsCount = args.size(); + if (argsCount < 2) { + imp->methodWithNonOptionalArgAndOptionalArg(nonOpt); + return jsUndefined(); + } + + int opt = args.at(1).toInt32(exec); + + imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt); + return jsUndefined(); +} + +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwError(exec, TypeError); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + int nonOpt = args.at(0).toInt32(exec); + + int argsCount = args.size(); + if (argsCount < 2) { + imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt); + return jsUndefined(); + } + + int opt1 = args.at(1).toInt32(exec); + if (argsCount < 3) { + imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1); + return jsUndefined(); + } + + int opt2 = args.at(2).toInt32(exec); + + imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2); + return jsUndefined(); +} + +JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestObj* object) +{ + return getDOMObjectWrapper<JSTestObj>(exec, globalObject, object); +} +TestObj* toTestObj(JSC::JSValue value) +{ + return value.inherits(&JSTestObj::s_info) ? static_cast<JSTestObj*>(asObject(value))->impl() : 0; +} + +} diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.h b/WebCore/bindings/scripts/test/JS/JSTestObj.h new file mode 100644 index 0000000..f726efb --- /dev/null +++ b/WebCore/bindings/scripts/test/JS/JSTestObj.h @@ -0,0 +1,141 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef JSTestObj_h +#define JSTestObj_h + +#include "JSDOMBinding.h" +#include <runtime/JSGlobalObject.h> +#include <runtime/ObjectPrototype.h> + +namespace WebCore { + +class TestObj; + +class JSTestObj : public DOMObjectWithGlobalPointer { + typedef DOMObjectWithGlobalPointer Base; +public: + JSTestObj(NonNullPassRefPtr<JSC::Structure>, JSDOMGlobalObject*, PassRefPtr<TestObj>); + virtual ~JSTestObj(); + static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); + virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); + virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); + virtual void put(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&); + virtual const JSC::ClassInfo* classInfo() const { return &s_info; } + static const JSC::ClassInfo s_info; + + static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) + { + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); + } + + static JSC::JSValue getConstructor(JSC::ExecState*, JSC::JSGlobalObject*); + + // Custom attributes + JSC::JSValue customAttr(JSC::ExecState*) const; + void setCustomAttr(JSC::ExecState*, JSC::JSValue); + + // Custom functions + JSC::JSValue customMethod(JSC::ExecState*, const JSC::ArgList&); + JSC::JSValue customMethodWithArgs(JSC::ExecState*, const JSC::ArgList&); + TestObj* impl() const { return m_impl.get(); } + +private: + RefPtr<TestObj> m_impl; +protected: + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; +}; + +JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestObj*); +TestObj* toTestObj(JSC::JSValue); + +class JSTestObjPrototype : public JSC::JSObject { + typedef JSC::JSObject Base; +public: + static JSC::JSObject* self(JSC::ExecState*, JSC::JSGlobalObject*); + virtual const JSC::ClassInfo* classInfo() const { return &s_info; } + static const JSC::ClassInfo s_info; + virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); + virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); + static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) + { + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); + } + JSTestObjPrototype(NonNullPassRefPtr<JSC::Structure> structure) : JSC::JSObject(structure) { } +protected: + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; +}; + +// Functions + +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethod(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethod(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionRemoveEventListener(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoidException(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +// Attributes + +JSC::JSValue jsTestObjReadOnlyIntAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +JSC::JSValue jsTestObjReadOnlyStringAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +JSC::JSValue jsTestObjReadOnlyTestObjAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +JSC::JSValue jsTestObjIntAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjIntAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjLongLongAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjLongLongAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjUnsignedLongLongAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjUnsignedLongLongAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjStringAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjStringAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjTestObjAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjTestObjAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjAttrWithException(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjAttrWithException(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjAttrWithSetterException(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjAttrWithSetterException(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjAttrWithGetterException(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjAttrWithGetterException(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjCustomAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjCustomAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjScriptStringAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +JSC::JSValue jsTestObjConstructor(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); + +} // namespace WebCore + +#endif diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.h b/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.h new file mode 100644 index 0000000..1213c6f --- /dev/null +++ b/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <WebCore/DOMObject.h> + +#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_LATEST + +@class DOMClass1; +@class DOMClass2; +@class DOMClass3; +@class DOMClass5; +@class DOMClass6; +@class NSString; + +@interface DOMTestCallback : DOMObject +- (BOOL)callbackWithClass1Param:(DOMClass1 *)class1Param; +- (BOOL)callbackWithClass2Param:(DOMClass2 *)class2Param strArg:(NSString *)strArg; +- (int)callbackWithNonBoolReturnType:(DOMClass3 *)class3Param; +- (int)customCallback:(DOMClass5 *)class5Param class6Param:(DOMClass6 *)class6Param; +@end + +#endif diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.mm b/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.mm new file mode 100644 index 0000000..5201a91 --- /dev/null +++ b/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.mm @@ -0,0 +1,122 @@ +/* + * This file is part of the WebKit open source project. + * This file has been generated by generate-bindings.pl. DO NOT MODIFY! + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 "config.h" + +#if ENABLE(DATABASE) + +#import "DOMInternal.h" + +#import "DOMTestCallback.h" + +#import "Class1.h" +#import "Class2.h" +#import "Class3.h" +#import "Class5.h" +#import "Class6.h" +#import "DOMBlobInternal.h" +#import "DOMCSSRuleInternal.h" +#import "DOMCSSValueInternal.h" +#import "DOMClass1Internal.h" +#import "DOMClass2Internal.h" +#import "DOMClass3Internal.h" +#import "DOMClass5Internal.h" +#import "DOMClass6Internal.h" +#import "DOMEventInternal.h" +#import "DOMNodeInternal.h" +#import "DOMStyleSheetInternal.h" +#import "DOMTestCallbackInternal.h" +#import "ExceptionHandlers.h" +#import "KURL.h" +#import "TestCallback.h" +#import "ThreadCheck.h" +#import "WebCoreObjCExtras.h" +#import "WebScriptObjectPrivate.h" +#import <wtf/GetPtr.h> + +#define IMPL reinterpret_cast<WebCore::TestCallback*>(_internal) + +@implementation DOMTestCallback + +- (void)dealloc +{ + if (WebCoreObjCScheduleDeallocateOnMainThread([DOMTestCallback class], self)) + return; + + if (_internal) + IMPL->deref(); + [super dealloc]; +} + +- (void)finalize +{ + if (_internal) + IMPL->deref(); + [super finalize]; +} + +- (BOOL)callbackWithClass1Param:(DOMClass1 *)class1Param +{ + return IMPL->callbackWithClass1Param(core(class1Param)); +} + +- (BOOL)callbackWithClass2Param:(DOMClass2 *)class2Param strArg:(NSString *)strArg +{ + return IMPL->callbackWithClass2Param(core(class2Param), strArg); +} + +- (int)callbackWithNonBoolReturnType:(DOMClass3 *)class3Param +{ + return IMPL->callbackWithNonBoolReturnType(core(class3Param)); +} + +- (int)customCallback:(DOMClass5 *)class5Param class6Param:(DOMClass6 *)class6Param +{ + return IMPL->customCallback(core(class5Param), core(class6Param)); +} + +@end + +WebCore::TestCallback* core(DOMTestCallback *wrapper) +{ + return wrapper ? reinterpret_cast<WebCore::TestCallback*>(wrapper->_internal) : 0; +} + +DOMTestCallback *kit(WebCore::TestCallback* value) +{ + { DOM_ASSERT_MAIN_THREAD(); WebCoreThreadViolationCheckRoundOne(); }; + if (!value) + return nil; + if (DOMTestCallback *wrapper = getDOMWrapper(value)) + return [[wrapper retain] autorelease]; + DOMTestCallback *wrapper = [[DOMTestCallback alloc] _init]; + wrapper->_internal = reinterpret_cast<DOMObjectInternal*>(value); + value->ref(); + addDOMWrapper(wrapper, value); + return [wrapper autorelease]; +} + +#endif // ENABLE(DATABASE) diff --git a/WebCore/svg/graphics/SVGPaintServerSolid.h b/WebCore/bindings/scripts/test/ObjC/DOMTestCallbackInternal.h index 680b0fe..d8ea940 100644 --- a/WebCore/svg/graphics/SVGPaintServerSolid.h +++ b/WebCore/bindings/scripts/test/ObjC/DOMTestCallbackInternal.h @@ -1,5 +1,6 @@ /* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> + * This file is part of the WebKit open source project. + * This file has been generated by generate-bindings.pl. DO NOT MODIFY! * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,38 +24,15 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SVGPaintServerSolid_h -#define SVGPaintServerSolid_h +#import <WebCore/DOMTestCallback.h> -#if ENABLE(SVG) - -#include "Color.h" -#include "SVGPaintServer.h" +#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_LATEST namespace WebCore { + class TestCallback; +} - class SVGPaintServerSolid : public SVGPaintServer { - public: - static PassRefPtr<SVGPaintServerSolid> create() { return adoptRef(new SVGPaintServerSolid); } - virtual ~SVGPaintServerSolid(); - - virtual SVGPaintServerType type() const { return SolidPaintServer; } - - Color color() const; - void setColor(const Color&); - - virtual TextStream& externalRepresentation(TextStream&) const; - - virtual bool setup(GraphicsContext*&, const RenderObject*, const RenderStyle*, SVGPaintTargetType, bool isPaintingText) const; - - private: - SVGPaintServerSolid(); - - Color m_color; - }; - -} // namespace WebCore +WebCore::TestCallback* core(DOMTestCallback *); +DOMTestCallback *kit(WebCore::TestCallback*); #endif - -#endif // SVGPaintServerSolid_h diff --git a/WebCore/bindings/js/JSDocumentFragmentCustom.cpp b/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.h index 7bc7d68..db7be28 100644 --- a/WebCore/bindings/js/JSDocumentFragmentCustom.cpp +++ b/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.h @@ -1,5 +1,6 @@ /* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,10 +11,10 @@ * notice, this 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 + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED 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 + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -23,18 +24,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" -#include "JSDocumentFragment.h" +#import <WebCore/DOMObject.h> -#include "DocumentFragment.h" -#include "Element.h" -#include "ExceptionCode.h" -#include "JSElement.h" -#include "JSNodeList.h" -#include "NodeList.h" +#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_LATEST -using namespace JSC; +@interface DOMTestInterface : DOMObject +@end -namespace WebCore { - -} // namespace WebCore +#endif diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm b/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm new file mode 100644 index 0000000..a88b366 --- /dev/null +++ b/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm @@ -0,0 +1,86 @@ +/* + * This file is part of the WebKit open source project. + * This file has been generated by generate-bindings.pl. DO NOT MODIFY! + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 "config.h" +#import "DOMInternal.h" + +#import "DOMTestInterface.h" + +#import "DOMBlobInternal.h" +#import "DOMCSSRuleInternal.h" +#import "DOMCSSValueInternal.h" +#import "DOMEventInternal.h" +#import "DOMNodeInternal.h" +#import "DOMStyleSheetInternal.h" +#import "DOMTestInterfaceInternal.h" +#import "ExceptionHandlers.h" +#import "TestInterface.h" +#import "ThreadCheck.h" +#import "WebCoreObjCExtras.h" +#import "WebScriptObjectPrivate.h" +#import <wtf/GetPtr.h> + +#define IMPL reinterpret_cast<WebCore::TestInterface*>(_internal) + +@implementation DOMTestInterface + +- (void)dealloc +{ + if (WebCoreObjCScheduleDeallocateOnMainThread([DOMTestInterface class], self)) + return; + + if (_internal) + IMPL->deref(); + [super dealloc]; +} + +- (void)finalize +{ + if (_internal) + IMPL->deref(); + [super finalize]; +} + +@end + +WebCore::TestInterface* core(DOMTestInterface *wrapper) +{ + return wrapper ? reinterpret_cast<WebCore::TestInterface*>(wrapper->_internal) : 0; +} + +DOMTestInterface *kit(WebCore::TestInterface* value) +{ + { DOM_ASSERT_MAIN_THREAD(); WebCoreThreadViolationCheckRoundOne(); }; + if (!value) + return nil; + if (DOMTestInterface *wrapper = getDOMWrapper(value)) + return [[wrapper retain] autorelease]; + DOMTestInterface *wrapper = [[DOMTestInterface alloc] _init]; + wrapper->_internal = reinterpret_cast<DOMObjectInternal*>(value); + value->ref(); + addDOMWrapper(wrapper, value); + return [wrapper autorelease]; +} diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestInterfaceInternal.h b/WebCore/bindings/scripts/test/ObjC/DOMTestInterfaceInternal.h new file mode 100644 index 0000000..fef60a3 --- /dev/null +++ b/WebCore/bindings/scripts/test/ObjC/DOMTestInterfaceInternal.h @@ -0,0 +1,38 @@ +/* + * This file is part of the WebKit open source project. + * This file has been generated by generate-bindings.pl. DO NOT MODIFY! + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <WebCore/DOMTestInterface.h> + +#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_LATEST + +namespace WebCore { + class TestInterface; +} + +WebCore::TestInterface* core(DOMTestInterface *); +DOMTestInterface *kit(WebCore::TestInterface*); + +#endif diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h new file mode 100644 index 0000000..dd9d2ee --- /dev/null +++ b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <WebCore/DOMObject.h> + +#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_LATEST + +@class DOMTestObj; +@class DOMlog; +@class NSString; +@protocol DOMEventListener; + +@interface DOMTestObj : DOMObject +- (int)readOnlyIntAttr; +- (NSString *)readOnlyStringAttr; +- (DOMTestObj *)readOnlyTestObjAttr; +- (int)intAttr; +- (void)setIntAttr:(int)newIntAttr; +- (long long)longLongAttr; +- (void)setLongLongAttr:(long long)newLongLongAttr; +- (unsigned long long)unsignedLongLongAttr; +- (void)setUnsignedLongLongAttr:(unsigned long long)newUnsignedLongLongAttr; +- (NSString *)stringAttr; +- (void)setStringAttr:(NSString *)newStringAttr; +- (DOMTestObj *)testObjAttr; +- (void)setTestObjAttr:(DOMTestObj *)newTestObjAttr; +- (int)attrWithException; +- (void)setAttrWithException:(int)newAttrWithException; +- (int)attrWithSetterException; +- (void)setAttrWithSetterException:(int)newAttrWithSetterException; +- (int)attrWithGetterException; +- (void)setAttrWithGetterException:(int)newAttrWithGetterException; +- (int)customAttr; +- (void)setCustomAttr:(int)newCustomAttr; +- (NSString *)scriptStringAttr; +- (void)voidMethod; +- (void)voidMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg; +- (int)intMethod; +- (int)intMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg; +- (DOMTestObj *)objMethod; +- (DOMTestObj *)objMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg; +- (void)serializedValue:(NSString *)serializedArg; +- (void)methodWithException; +- (void)customMethod; +- (void)customMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg; +- (void)customArgsAndException:(DOMlog *)intArg; +- (void)addEventListener:(NSString *)type listener:(id <DOMEventListener>)listener useCapture:(BOOL)useCapture; +- (void)removeEventListener:(NSString *)type listener:(id <DOMEventListener>)listener useCapture:(BOOL)useCapture; +- (void)withDynamicFrame; +- (void)withDynamicFrameAndArg:(int)intArg; +- (void)withDynamicFrameAndOptionalArg:(int)intArg optionalArg:(int)optionalArg; +- (void)withDynamicFrameAndUserGesture:(int)intArg; +- (void)withDynamicFrameAndUserGestureASAD:(int)intArg optionalArg:(int)optionalArg; +- (void)withScriptStateVoid; +- (DOMTestObj *)withScriptStateObj; +- (void)withScriptStateVoidException; +- (DOMTestObj *)withScriptStateObjException; +- (void)methodWithOptionalArg:(int)opt; +- (void)methodWithNonOptionalArgAndOptionalArg:(int)nonOpt opt:(int)opt; +- (void)methodWithNonOptionalArgAndTwoOptionalArgs:(int)nonOpt opt1:(int)opt1 opt2:(int)opt2; +@end + +#endif diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm new file mode 100644 index 0000000..b964e36 --- /dev/null +++ b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm @@ -0,0 +1,340 @@ +/* + * This file is part of the WebKit open source project. + * This file has been generated by generate-bindings.pl. DO NOT MODIFY! + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 "config.h" +#import "DOMInternal.h" + +#import "DOMTestObj.h" + +#import "DOMBlobInternal.h" +#import "DOMCSSRuleInternal.h" +#import "DOMCSSValueInternal.h" +#import "DOMEventInternal.h" +#import "DOMNodeInternal.h" +#import "DOMStyleSheetInternal.h" +#import "DOMTestObjInternal.h" +#import "DOMlogInternal.h" +#import "EventListener.h" +#import "ExceptionHandlers.h" +#import "KURL.h" +#import "ObjCEventListener.h" +#import "SerializedScriptValue.h" +#import "TestObj.h" +#import "ThreadCheck.h" +#import "WebCoreObjCExtras.h" +#import "WebScriptObjectPrivate.h" +#import "log.h" +#import <wtf/GetPtr.h> + +#define IMPL reinterpret_cast<WebCore::TestObj*>(_internal) + +@implementation DOMTestObj + +- (void)dealloc +{ + if (WebCoreObjCScheduleDeallocateOnMainThread([DOMTestObj class], self)) + return; + + if (_internal) + IMPL->deref(); + [super dealloc]; +} + +- (void)finalize +{ + if (_internal) + IMPL->deref(); + [super finalize]; +} + +- (int)readOnlyIntAttr +{ + return IMPL->readOnlyIntAttr(); +} + +- (NSString *)readOnlyStringAttr +{ + return IMPL->readOnlyStringAttr(); +} + +- (DOMTestObj *)readOnlyTestObjAttr +{ + return kit(WTF::getPtr(IMPL->readOnlyTestObjAttr())); +} + +- (int)intAttr +{ + return IMPL->intAttr(); +} + +- (void)setIntAttr:(int)newIntAttr +{ + IMPL->setIntAttr(newIntAttr); +} + +- (long long)longLongAttr +{ + return IMPL->longLongAttr(); +} + +- (void)setLongLongAttr:(long long)newLongLongAttr +{ + IMPL->setLongLongAttr(newLongLongAttr); +} + +- (unsigned long long)unsignedLongLongAttr +{ + return IMPL->unsignedLongLongAttr(); +} + +- (void)setUnsignedLongLongAttr:(unsigned long long)newUnsignedLongLongAttr +{ + IMPL->setUnsignedLongLongAttr(newUnsignedLongLongAttr); +} + +- (NSString *)stringAttr +{ + return IMPL->stringAttr(); +} + +- (void)setStringAttr:(NSString *)newStringAttr +{ + IMPL->setStringAttr(newStringAttr); +} + +- (DOMTestObj *)testObjAttr +{ + return kit(WTF::getPtr(IMPL->testObjAttr())); +} + +- (void)setTestObjAttr:(DOMTestObj *)newTestObjAttr +{ + ASSERT(newTestObjAttr); + + IMPL->setTestObjAttr(core(newTestObjAttr)); +} + +- (int)attrWithException +{ + return IMPL->attrWithException(); +} + +- (void)setAttrWithException:(int)newAttrWithException +{ + IMPL->setAttrWithException(newAttrWithException); +} + +- (int)attrWithSetterException +{ + return IMPL->attrWithSetterException(); +} + +- (void)setAttrWithSetterException:(int)newAttrWithSetterException +{ + IMPL->setAttrWithSetterException(newAttrWithSetterException); +} + +- (int)attrWithGetterException +{ + return IMPL->attrWithGetterException(); +} + +- (void)setAttrWithGetterException:(int)newAttrWithGetterException +{ + IMPL->setAttrWithGetterException(newAttrWithGetterException); +} + +- (int)customAttr +{ + return IMPL->customAttr(); +} + +- (void)setCustomAttr:(int)newCustomAttr +{ + IMPL->setCustomAttr(newCustomAttr); +} + +- (NSString *)scriptStringAttr +{ + return IMPL->scriptStringAttr(); +} + +- (void)voidMethod +{ + IMPL->voidMethod(); +} + +- (void)voidMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg +{ + IMPL->voidMethodWithArgs(intArg, strArg, core(objArg)); +} + +- (int)intMethod +{ + return IMPL->intMethod(); +} + +- (int)intMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg +{ + return IMPL->intMethodWithArgs(intArg, strArg, core(objArg)); +} + +- (DOMTestObj *)objMethod +{ + return kit(WTF::getPtr(IMPL->objMethod())); +} + +- (DOMTestObj *)objMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg +{ + return kit(WTF::getPtr(IMPL->objMethodWithArgs(intArg, strArg, core(objArg)))); +} + +- (void)serializedValue:(NSString *)serializedArg +{ + IMPL->serializedValue(WebCore::SerializedScriptValue::create(WebCore::String(serializedArg))); +} + +- (void)methodWithException +{ + WebCore::ExceptionCode ec = 0; + IMPL->methodWithException(ec); + WebCore::raiseOnDOMError(ec); +} + +- (void)customMethod +{ + IMPL->customMethod(); +} + +- (void)customMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg +{ + IMPL->customMethodWithArgs(intArg, strArg, core(objArg)); +} + +- (void)customArgsAndException:(DOMlog *)intArg +{ + WebCore::ExceptionCode ec = 0; + IMPL->customArgsAndException(core(intArg), ec); + WebCore::raiseOnDOMError(ec); +} + +- (void)addEventListener:(NSString *)type listener:(id <DOMEventListener>)listener useCapture:(BOOL)useCapture +{ + RefPtr<WebCore::EventListener> nativeEventListener = WebCore::ObjCEventListener::wrap(listener); + IMPL->addEventListener(type, WTF::getPtr(nativeEventListener), useCapture); +} + +- (void)removeEventListener:(NSString *)type listener:(id <DOMEventListener>)listener useCapture:(BOOL)useCapture +{ + RefPtr<WebCore::EventListener> nativeEventListener = WebCore::ObjCEventListener::wrap(listener); + IMPL->removeEventListener(type, WTF::getPtr(nativeEventListener), useCapture); +} + +- (void)withDynamicFrame +{ + IMPL->withDynamicFrame(); +} + +- (void)withDynamicFrameAndArg:(int)intArg +{ + IMPL->withDynamicFrameAndArg(intArg); +} + +- (void)withDynamicFrameAndOptionalArg:(int)intArg optionalArg:(int)optionalArg +{ + IMPL->withDynamicFrameAndOptionalArg(intArg, optionalArg); +} + +- (void)withDynamicFrameAndUserGesture:(int)intArg +{ + IMPL->withDynamicFrameAndUserGesture(intArg); +} + +- (void)withDynamicFrameAndUserGestureASAD:(int)intArg optionalArg:(int)optionalArg +{ + IMPL->withDynamicFrameAndUserGestureASAD(intArg, optionalArg); +} + +- (void)withScriptStateVoid +{ + IMPL->withScriptStateVoid(); +} + +- (DOMTestObj *)withScriptStateObj +{ + return kit(WTF::getPtr(IMPL->withScriptStateObj())); +} + +- (void)withScriptStateVoidException +{ + WebCore::ExceptionCode ec = 0; + IMPL->withScriptStateVoidException(ec); + WebCore::raiseOnDOMError(ec); +} + +- (DOMTestObj *)withScriptStateObjException +{ + WebCore::ExceptionCode ec = 0; + DOMTestObj *result = kit(WTF::getPtr(IMPL->withScriptStateObjException(ec))); + WebCore::raiseOnDOMError(ec); + return result; +} + +- (void)methodWithOptionalArg:(int)opt +{ + IMPL->methodWithOptionalArg(opt); +} + +- (void)methodWithNonOptionalArgAndOptionalArg:(int)nonOpt opt:(int)opt +{ + IMPL->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt); +} + +- (void)methodWithNonOptionalArgAndTwoOptionalArgs:(int)nonOpt opt1:(int)opt1 opt2:(int)opt2 +{ + IMPL->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2); +} + +@end + +WebCore::TestObj* core(DOMTestObj *wrapper) +{ + return wrapper ? reinterpret_cast<WebCore::TestObj*>(wrapper->_internal) : 0; +} + +DOMTestObj *kit(WebCore::TestObj* value) +{ + { DOM_ASSERT_MAIN_THREAD(); WebCoreThreadViolationCheckRoundOne(); }; + if (!value) + return nil; + if (DOMTestObj *wrapper = getDOMWrapper(value)) + return [[wrapper retain] autorelease]; + DOMTestObj *wrapper = [[DOMTestObj alloc] _init]; + wrapper->_internal = reinterpret_cast<DOMObjectInternal*>(value); + value->ref(); + addDOMWrapper(wrapper, value); + return [wrapper autorelease]; +} diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestObjInternal.h b/WebCore/bindings/scripts/test/ObjC/DOMTestObjInternal.h new file mode 100644 index 0000000..c24ea84 --- /dev/null +++ b/WebCore/bindings/scripts/test/ObjC/DOMTestObjInternal.h @@ -0,0 +1,38 @@ +/* + * This file is part of the WebKit open source project. + * This file has been generated by generate-bindings.pl. DO NOT MODIFY! + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <WebCore/DOMTestObj.h> + +#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_LATEST + +namespace WebCore { + class TestObj; +} + +WebCore::TestObj* core(DOMTestObj *); +DOMTestObj *kit(WebCore::TestObj*); + +#endif diff --git a/WebCore/bindings/scripts/test/TestCallback.idl b/WebCore/bindings/scripts/test/TestCallback.idl new file mode 100644 index 0000000..25db4c6 --- /dev/null +++ b/WebCore/bindings/scripts/test/TestCallback.idl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary formstrArg, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must 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 WARRANTIEstrArg, 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. + */ + +// This IDL file is for testing the bindings code generator with an interface +// that has the "Callback" attribute and for tracking changes in its ouput. +module test { + interface [ + Conditional=DATABASE, + Callback + ] TestCallback { + boolean callbackWithClass1Param(in Class1 class1Param); + boolean callbackWithClass2Param(in Class2 class2Param, in DOMString strArg); + long callbackWithNonBoolReturnType(in Class3 class3Param); + [Custom] long customCallback(in Class5 class5Param, in Class6 class6Param); + }; +} diff --git a/WebCore/bindings/scripts/test/TestInterface.idl b/WebCore/bindings/scripts/test/TestInterface.idl new file mode 100644 index 0000000..5a8b008 --- /dev/null +++ b/WebCore/bindings/scripts/test/TestInterface.idl @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary formstrArg, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must 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 WARRANTIEstrArg, 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. + */ + +// This IDL file is for testing the bindings code generator and for tracking +// changes in its ouput. +module test { + interface [ + CanBeConstructed, + CallWith=ScriptExecutionContext + ] TestInterface { + }; +} diff --git a/WebCore/bindings/v8/test/TestObj.idl b/WebCore/bindings/scripts/test/TestObj.idl index 662ac64..b14328d 100644 --- a/WebCore/bindings/v8/test/TestObj.idl +++ b/WebCore/bindings/scripts/test/TestObj.idl @@ -26,8 +26,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// This IDL file is for testing the V8 generator and for tracking changes -// in its ouput. +// This IDL file is for testing the bindings code generator and for tracking +// changes in its ouput. module test { interface TestObj { // Attributes @@ -35,6 +35,8 @@ module test { readonly attribute DOMString readOnlyStringAttr; readonly attribute TestObj readOnlyTestObjAttr; attribute long intAttr; + attribute long long longLongAttr; + attribute unsigned long long unsignedLongLongAttr; attribute DOMString stringAttr; attribute TestObj testObjAttr; @@ -46,6 +48,8 @@ module test { TestObj objMethod(); TestObj objMethodWithArgs(in long intArg, in DOMString strArg, in TestObj objArg); + void serializedValue(in SerializedScriptValue serializedArg); + // Exceptions void methodWithException() raises(DOMException); attribute long attrWithException raises(DOMException); @@ -57,15 +61,43 @@ module test { [Custom] void customMethod(); [Custom] void customMethodWithArgs(in long intArg, in DOMString strArg, in TestObj objArg); + [CustomArgumentHandling] void customArgsAndException(in log intArg) + raises(DOMException); + + void addEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); + void removeEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); + + // 'CallWith' extended attribute + [CallWith=DynamicFrame] void withDynamicFrame(); + [CallWith=DynamicFrame] void withDynamicFrameAndArg(in long intArg); + [CallWith=DynamicFrame] void withDynamicFrameAndOptionalArg(in long intArg, in [Optional] long optionalArg); + [NeedsUserGestureCheck, CallWith=DynamicFrame] void withDynamicFrameAndUserGesture(in long intArg); + [NeedsUserGestureCheck, CallWith=DynamicFrame] void withDynamicFrameAndUserGestureASAD(in long intArg, in [Optional] long optionalArg); + [CallWith=ScriptState] void withScriptStateVoid(); + [CallWith=ScriptState] TestObj withScriptStateObj(); + [CallWith=ScriptState] void withScriptStateVoidException() + raises(DOMException); + [CallWith=ScriptState] TestObj withScriptStateObjException() + raises(DOMException); + // 'Optional' extended attribute void methodWithOptionalArg(in [Optional] long opt); void methodWithNonOptionalArgAndOptionalArg(in long nonOpt, in [Optional] long opt); void methodWithNonOptionalArgAndTwoOptionalArgs(in long nonOpt, in [Optional] long opt1, in long opt2); + // 'ConvertScriptString' extended attribute + readonly attribute [ConvertScriptString] DOMString scriptStringAttr; + +#ifdef TESTING_V8 // Overloads void overloadedMethod(in TestObj objArg, in DOMString strArg); void overloadedMethod(in TestObj objArg, in [Optional] long intArg); void overloadedMethod(in DOMString strArg); void overloadedMethod(in long intArg); +#endif }; } diff --git a/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp b/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp new file mode 100644 index 0000000..e72330d --- /dev/null +++ b/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp @@ -0,0 +1,92 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of 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. +*/ + +#include "config.h" +#include "V8TestCallback.h" + +#if ENABLE(DATABASE) + +#include "Frame.h" +#include "ScriptExecutionContext.h" +#include "V8Class1.h" +#include "V8Class2.h" +#include "V8CustomVoidCallback.h" +#include "V8DOMString.h" + +namespace WebCore { + +V8TestCallback::V8TestCallback(v8::Local<v8::Object> callback, Frame* frame) + : m_callback(v8::Persistent<v8::Object>::New(callback)) + , m_frame(frame) + , m_worldContext(UseCurrentWorld) +{ +} + +V8TestCallback::~V8TestCallback() +{ + m_callback.Dispose(); +} + +// Functions + +bool V8TestCallback::callbackWithClass1Param(ScriptExecutionContext* context, Class1* class1Param) +{ + v8::HandleScope handleScope; + + v8::Handle<v8::Context> v8Context = toV8Context(context, m_worldContext); + if (v8Context.IsEmpty()) + return true; + + v8::Context::Scope scope(v8Context); + + v8::Handle<v8::Value> argv[] = { + toV8(class1Param) + }; + + RefPtr<Frame> protect(m_frame); + + bool callbackReturnValue = false; + return !invokeCallback(m_callback, 1, argv, callbackReturnValue); +} + +bool V8TestCallback::callbackWithClass2Param(ScriptExecutionContext* context, Class2* class2Param, const String& strArg) +{ + v8::HandleScope handleScope; + + v8::Handle<v8::Context> v8Context = toV8Context(context, m_worldContext); + if (v8Context.IsEmpty()) + return true; + + v8::Context::Scope scope(v8Context); + + v8::Handle<v8::Value> argv[] = { + toV8(class2Param), + toV8(strArg) + }; + + RefPtr<Frame> protect(m_frame); + + bool callbackReturnValue = false; + return !invokeCallback(m_callback, 2, argv, callbackReturnValue); +} + +} // namespace WebCore + +#endif // ENABLE(DATABASE) diff --git a/WebCore/bindings/scripts/test/V8/V8TestCallback.h b/WebCore/bindings/scripts/test/V8/V8TestCallback.h new file mode 100644 index 0000000..f58f3f0 --- /dev/null +++ b/WebCore/bindings/scripts/test/V8/V8TestCallback.h @@ -0,0 +1,63 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of 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. +*/ + +#if ENABLE(DATABASE) + +#ifndef V8TestCallback_h +#define V8TestCallback_h + +#include "TestCallback.h" +#include "WorldContextHandle.h" +#include <v8.h> +#include <wtf/Forward.h> + +namespace WebCore { + +class Frame; + +class V8TestCallback : public TestCallback { +public: + static PassRefPtr<V8TestCallback> create(v8::Local<v8::Value> value, Frame* frame) + { + ASSERT(value->IsObject()); + return adoptRef(new V8TestCallback(value->ToObject(), frame)); + } + + virtual ~V8TestCallback(); + + // Functions + virtual bool callbackWithClass1Param(ScriptExecutionContext*, Class1* class1Param); + virtual bool callbackWithClass2Param(ScriptExecutionContext*, Class2* class2Param, const String& strArg); + COMPILE_ASSERT(false) virtual int callbackWithNonBoolReturnType(ScriptExecutionContext*, Class3* class3Param); + virtual int customCallback(ScriptExecutionContext*, Class5* class5Param, Class6* class6Param); + +private: + V8TestCallback(v8::Local<v8::Object>, Frame*); + + v8::Persistent<v8::Object> m_callback; + RefPtr<Frame> m_frame; + WorldContextHandle m_worldContext; +}; + +} + +#endif // V8TestCallback_h + +#endif // ENABLE(DATABASE) diff --git a/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp b/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp new file mode 100644 index 0000000..f0bfb86 --- /dev/null +++ b/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp @@ -0,0 +1,115 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of 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. +*/ + +#include "config.h" +#include "V8TestInterface.h" + +#include "RuntimeEnabledFeatures.h" +#include "V8Binding.h" +#include "V8BindingState.h" +#include "V8DOMWrapper.h" +#include "V8IsolatedContext.h" +#include "V8Proxy.h" + +namespace WebCore { + +WrapperTypeInfo V8TestInterface::info = { V8TestInterface::GetTemplate, V8TestInterface::derefObject, 0 }; + +namespace TestInterfaceInternal { + +template <typename T> void V8_USE(T) { } + +} // namespace TestInterfaceInternal + +v8::Handle<v8::Value> V8TestInterface::constructorCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestInterface.Contructor"); + return V8Proxy::constructDOMObjectWithScriptExecutionContext<TestInterface>(args, &info); +} +static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestInterfaceTemplate(v8::Persistent<v8::FunctionTemplate> desc) +{ + v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "TestInterface", v8::Persistent<v8::FunctionTemplate>(), V8TestInterface::internalFieldCount, + 0, 0, + 0, 0); + desc->SetCallHandler(V8TestInterface::constructorCallback); + + + // Custom toString template + desc->Set(getToStringName(), getToStringTemplate()); + return desc; +} + +v8::Persistent<v8::FunctionTemplate> V8TestInterface::GetRawTemplate() +{ + static v8::Persistent<v8::FunctionTemplate> V8TestInterfaceRawCache = createRawTemplate(); + return V8TestInterfaceRawCache; +} + +v8::Persistent<v8::FunctionTemplate> V8TestInterface::GetTemplate() +{ + static v8::Persistent<v8::FunctionTemplate> V8TestInterfaceCache = ConfigureV8TestInterfaceTemplate(GetRawTemplate()); + return V8TestInterfaceCache; +} + +TestInterface* V8TestInterface::toNative(v8::Handle<v8::Object> object) +{ + return reinterpret_cast<TestInterface*>(object->GetPointerFromInternalField(v8DOMWrapperObjectIndex)); +} + +bool V8TestInterface::HasInstance(v8::Handle<v8::Value> value) +{ + return GetRawTemplate()->HasInstance(value); +} + + +v8::Handle<v8::Object> V8TestInterface::wrap(TestInterface* impl) +{ + v8::Handle<v8::Object> wrapper; + V8Proxy* proxy = 0; + wrapper = getDOMObjectMap().get(impl); + if (!wrapper.IsEmpty()) + return wrapper; + wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl); + if (wrapper.IsEmpty()) + return wrapper; + + impl->ref(); + getDOMObjectMap().set(impl, v8::Persistent<v8::Object>::New(wrapper)); + return wrapper; +} + +v8::Handle<v8::Value> toV8(PassRefPtr<TestInterface > impl) +{ + return toV8(impl.get()); +} + +v8::Handle<v8::Value> toV8(TestInterface* impl) +{ + if (!impl) + return v8::Null(); + return V8TestInterface::wrap(impl); +} + +void V8TestInterface::derefObject(void* object) +{ + static_cast<TestInterface*>(object)->deref(); +} + +} // namespace WebCore diff --git a/WebCore/bindings/scripts/test/V8/V8TestInterface.h b/WebCore/bindings/scripts/test/V8/V8TestInterface.h new file mode 100644 index 0000000..ce1310e --- /dev/null +++ b/WebCore/bindings/scripts/test/V8/V8TestInterface.h @@ -0,0 +1,50 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of 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 V8TestInterface_h +#define V8TestInterface_h + +#include "StringHash.h" +#include "TestInterface.h" +#include "WrapperTypeInfo.h" +#include <v8.h> +#include <wtf/HashMap.h> + +namespace WebCore { + +class V8TestInterface { + +public: + static bool HasInstance(v8::Handle<v8::Value> value); + static v8::Persistent<v8::FunctionTemplate> GetRawTemplate(); + static v8::Persistent<v8::FunctionTemplate> GetTemplate(); + static TestInterface* toNative(v8::Handle<v8::Object>); + static v8::Handle<v8::Object> wrap(TestInterface*); + static void derefObject(void*); + static WrapperTypeInfo info; + static v8::Handle<v8::Value> constructorCallback(const v8::Arguments& args); + static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0; +}; + +v8::Handle<v8::Value> toV8(TestInterface*); +v8::Handle<v8::Value> toV8(PassRefPtr<TestInterface >); +} + +#endif // V8TestInterface_h diff --git a/WebCore/bindings/v8/test/V8TestObj.cpp b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp index d51884e..94dcd5e 100644 --- a/WebCore/bindings/v8/test/V8TestObj.cpp +++ b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp @@ -23,11 +23,14 @@ #include "ExceptionCode.h" #include "RuntimeEnabledFeatures.h" +#include "ScriptCallStack.h" +#include "SerializedScriptValue.h" #include "V8Binding.h" #include "V8BindingState.h" #include "V8DOMWrapper.h" #include "V8IsolatedContext.h" #include "V8Proxy.h" +#include "V8log.h" #include <wtf/GetPtr.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> @@ -84,6 +87,38 @@ static void intAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> v return; } +static v8::Handle<v8::Value> longLongAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.longLongAttr._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8::Number::New(static_cast<double>(imp->longLongAttr())); +} + +static void longLongAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.longLongAttr._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + long long v = toInt64(value); + imp->setLongLongAttr(WTF::getPtr(v)); + return; +} + +static v8::Handle<v8::Value> unsignedLongLongAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.unsignedLongLongAttr._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8::Number::New(static_cast<double>(imp->unsignedLongLongAttr())); +} + +static void unsignedLongLongAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.unsignedLongLongAttr._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + unsigned long long v = toInt64(value); + imp->setUnsignedLongLongAttr(WTF::getPtr(v)); + return; +} + static v8::Handle<v8::Value> stringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.TestObj.stringAttr._get"); @@ -164,6 +199,13 @@ static void attrWithGetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Lo return; } +static v8::Handle<v8::Value> scriptStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.scriptStringAttr._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + v8StringOrNull(exec, imp->scriptStringAttr()); +} + static v8::Handle<v8::Value> voidMethodCallback(const v8::Arguments& args) { INC_STATS("DOM.TestObj.voidMethod"); @@ -217,6 +259,18 @@ static v8::Handle<v8::Value> objMethodWithArgsCallback(const v8::Arguments& args return toV8(imp->objMethodWithArgs(intArg, strArg, objArg)); } +static v8::Handle<v8::Value> serializedValueCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.serializedValue"); + TestObj* imp = V8TestObj::toNative(args.Holder()); + bool serializedArgDidThrow = false; + RefPtr<SerializedScriptValue> serializedArg = SerializedScriptValue::create(args[0], serializedArgDidThrow); + if (serializedArgDidThrow) + return v8::Undefined(); + imp->serializedValue(serializedArg); + return v8::Handle<v8::Value>(); +} + static v8::Handle<v8::Value> methodWithExceptionCallback(const v8::Arguments& args) { INC_STATS("DOM.TestObj.methodWithException"); @@ -233,6 +287,183 @@ static v8::Handle<v8::Value> methodWithExceptionCallback(const v8::Arguments& ar return v8::Handle<v8::Value>(); } +static v8::Handle<v8::Value> customArgsAndExceptionCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.customArgsAndException"); + TestObj* imp = V8TestObj::toNative(args.Holder()); + ExceptionCode ec = 0; + { + OwnPtr<ScriptCallStack> callStack(ScriptCallStack::create(args, 1)); + if (!callStack) + return v8::Undefined(); + log* intArg = V8log::HasInstance(args[0]) ? V8log::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0; + imp->customArgsAndException(intArg, callStack.get(), ec); + if (UNLIKELY(ec)) + goto fail; + return v8::Handle<v8::Value>(); + } + fail: + V8Proxy::setDOMException(ec); + return v8::Handle<v8::Value>(); +} + +static v8::Handle<v8::Value> addEventListenerCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.addEventListener()"); + RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(args[1], false, ListenerFindOrCreate); + if (listener) { + V8TestObj::toNative(args.Holder())->addEventListener(v8ValueToAtomicWebCoreString(args[0]), listener, args[2]->BooleanValue()); + createHiddenDependency(args.Holder(), args[1], V8TestObj::eventListenerCacheIndex); + } + return v8::Undefined(); +} + +static v8::Handle<v8::Value> removeEventListenerCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.removeEventListener()"); + RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(args[1], false, ListenerFindOnly); + if (listener) { + V8TestObj::toNative(args.Holder())->removeEventListener(v8ValueToAtomicWebCoreString(args[0]), listener.get(), args[2]->BooleanValue()); + removeHiddenDependency(args.Holder(), args[1], V8TestObj::eventListenerCacheIndex); + } + return v8::Undefined(); +} + +static v8::Handle<v8::Value> withDynamicFrameCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.withDynamicFrame"); + TestObj* imp = V8TestObj::toNative(args.Holder()); + Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext(); + if (!enteredFrame) + return v8::Undefined(); + imp->withDynamicFrame(enteredFrame); + return v8::Handle<v8::Value>(); +} + +static v8::Handle<v8::Value> withDynamicFrameAndArgCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.withDynamicFrameAndArg"); + TestObj* imp = V8TestObj::toNative(args.Holder()); + int intArg = toInt32(args[0]); + Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext(); + if (!enteredFrame) + return v8::Undefined(); + imp->withDynamicFrameAndArg(enteredFrame, intArg); + return v8::Handle<v8::Value>(); +} + +static v8::Handle<v8::Value> withDynamicFrameAndOptionalArgCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.withDynamicFrameAndOptionalArg"); + TestObj* imp = V8TestObj::toNative(args.Holder()); + int intArg = toInt32(args[0]); + if (args.Length() <= 1) { + Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext(); + if (!enteredFrame) + return v8::Undefined(); + imp->withDynamicFrameAndOptionalArg(enteredFrame, intArg); + return v8::Handle<v8::Value>(); + } + int optionalArg = toInt32(args[1]); + Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext(); + if (!enteredFrame) + return v8::Undefined(); + imp->withDynamicFrameAndOptionalArg(enteredFrame, intArg, optionalArg); + return v8::Handle<v8::Value>(); +} + +static v8::Handle<v8::Value> withDynamicFrameAndUserGestureCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.withDynamicFrameAndUserGesture"); + TestObj* imp = V8TestObj::toNative(args.Holder()); + int intArg = toInt32(args[0]); + Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext(); + if (!enteredFrame) + return v8::Undefined(); + imp->withDynamicFrameAndUserGesture(enteredFrame, intArg, processingUserGesture()); + return v8::Handle<v8::Value>(); +} + +static v8::Handle<v8::Value> withDynamicFrameAndUserGestureASADCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.withDynamicFrameAndUserGestureASAD"); + TestObj* imp = V8TestObj::toNative(args.Holder()); + int intArg = toInt32(args[0]); + if (args.Length() <= 1) { + Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext(); + if (!enteredFrame) + return v8::Undefined(); + imp->withDynamicFrameAndUserGestureASAD(enteredFrame, intArg, processingUserGesture()); + return v8::Handle<v8::Value>(); + } + int optionalArg = toInt32(args[1]); + Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext(); + if (!enteredFrame) + return v8::Undefined(); + imp->withDynamicFrameAndUserGestureASAD(enteredFrame, intArg, optionalArg, processingUserGesture()); + return v8::Handle<v8::Value>(); +} + +static v8::Handle<v8::Value> withScriptStateVoidCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.withScriptStateVoid"); + TestObj* imp = V8TestObj::toNative(args.Holder()); + EmptyScriptState state; + imp->withScriptStateVoid(&state); + if (state.hadException()) + return throwError(state.exception()); + return v8::Handle<v8::Value>(); +} + +static v8::Handle<v8::Value> withScriptStateObjCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.withScriptStateObj"); + TestObj* imp = V8TestObj::toNative(args.Holder()); + EmptyScriptState state; + RefPtr<TestObj> result = imp->withScriptStateObj(&state); + if (state.hadException()) + return throwError(state.exception()); + return toV8(result.release()); +} + +static v8::Handle<v8::Value> withScriptStateVoidExceptionCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.withScriptStateVoidException"); + TestObj* imp = V8TestObj::toNative(args.Holder()); + ExceptionCode ec = 0; + { + EmptyScriptState state; + imp->withScriptStateVoidException(&state, ec); + if (UNLIKELY(ec)) + goto fail; + if (state.hadException()) + return throwError(state.exception()); + return v8::Handle<v8::Value>(); + } + fail: + V8Proxy::setDOMException(ec); + return v8::Handle<v8::Value>(); +} + +static v8::Handle<v8::Value> withScriptStateObjExceptionCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.withScriptStateObjException"); + TestObj* imp = V8TestObj::toNative(args.Holder()); + ExceptionCode ec = 0; + { + EmptyScriptState state; + RefPtr<TestObj> result = imp->withScriptStateObjException(&state, ec); + if (UNLIKELY(ec)) + goto fail; + if (state.hadException()) + return throwError(state.exception()); + return toV8(result.release()); + } + fail: + V8Proxy::setDOMException(ec); + return v8::Handle<v8::Value>(); +} + static v8::Handle<v8::Value> methodWithOptionalArgCallback(const v8::Arguments& args) { INC_STATS("DOM.TestObj.methodWithOptionalArg"); @@ -343,6 +574,10 @@ static const BatchedAttribute TestObjAttrs[] = { {"readOnlyTestObjAttr", TestObjInternal::readOnlyTestObjAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'intAttr' (Type: 'attribute' ExtAttr: '') {"intAttr", TestObjInternal::intAttrAttrGetter, TestObjInternal::intAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'longLongAttr' (Type: 'attribute' ExtAttr: '') + {"longLongAttr", TestObjInternal::longLongAttrAttrGetter, TestObjInternal::longLongAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'unsignedLongLongAttr' (Type: 'attribute' ExtAttr: '') + {"unsignedLongLongAttr", TestObjInternal::unsignedLongLongAttrAttrGetter, TestObjInternal::unsignedLongLongAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'stringAttr' (Type: 'attribute' ExtAttr: '') {"stringAttr", TestObjInternal::stringAttrAttrGetter, TestObjInternal::stringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'testObjAttr' (Type: 'attribute' ExtAttr: '') @@ -355,14 +590,28 @@ static const BatchedAttribute TestObjAttrs[] = { {"attrWithGetterException", TestObjInternal::attrWithGetterExceptionAttrGetter, TestObjInternal::attrWithGetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'customAttr' (Type: 'attribute' ExtAttr: 'Custom') {"customAttr", V8TestObj::customAttrAccessorGetter, V8TestObj::customAttrAccessorSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'scriptStringAttr' (Type: 'readonly attribute' ExtAttr: 'ConvertScriptString') + {"scriptStringAttr", TestObjInternal::scriptStringAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, }; static const BatchedCallback TestObjCallbacks[] = { {"voidMethod", TestObjInternal::voidMethodCallback}, {"intMethod", TestObjInternal::intMethodCallback}, {"objMethod", TestObjInternal::objMethodCallback}, + {"serializedValue", TestObjInternal::serializedValueCallback}, {"methodWithException", TestObjInternal::methodWithExceptionCallback}, {"customMethod", V8TestObj::customMethodCallback}, {"customMethodWithArgs", V8TestObj::customMethodWithArgsCallback}, + {"addEventListener", TestObjInternal::addEventListenerCallback}, + {"removeEventListener", TestObjInternal::removeEventListenerCallback}, + {"withDynamicFrame", TestObjInternal::withDynamicFrameCallback}, + {"withDynamicFrameAndArg", TestObjInternal::withDynamicFrameAndArgCallback}, + {"withDynamicFrameAndOptionalArg", TestObjInternal::withDynamicFrameAndOptionalArgCallback}, + {"withDynamicFrameAndUserGesture", TestObjInternal::withDynamicFrameAndUserGestureCallback}, + {"withDynamicFrameAndUserGestureASAD", TestObjInternal::withDynamicFrameAndUserGestureASADCallback}, + {"withScriptStateVoid", TestObjInternal::withScriptStateVoidCallback}, + {"withScriptStateObj", TestObjInternal::withScriptStateObjCallback}, + {"withScriptStateVoidException", TestObjInternal::withScriptStateVoidExceptionCallback}, + {"withScriptStateObjException", TestObjInternal::withScriptStateObjExceptionCallback}, {"methodWithOptionalArg", TestObjInternal::methodWithOptionalArgCallback}, {"methodWithNonOptionalArgAndOptionalArg", TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback}, {"methodWithNonOptionalArgAndTwoOptionalArgs", TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback}, @@ -395,6 +644,12 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persi v8::Handle<v8::Signature> objMethodWithArgsSignature = v8::Signature::New(desc, objMethodWithArgsArgc, objMethodWithArgsArgv); proto->Set(v8::String::New("objMethodWithArgs"), v8::FunctionTemplate::New(TestObjInternal::objMethodWithArgsCallback, v8::Handle<v8::Value>(), objMethodWithArgsSignature)); + // Custom Signature 'customArgsAndException' + const int customArgsAndExceptionArgc = 1; + v8::Handle<v8::FunctionTemplate> customArgsAndExceptionArgv[customArgsAndExceptionArgc] = { V8log::GetRawTemplate() }; + v8::Handle<v8::Signature> customArgsAndExceptionSignature = v8::Signature::New(desc, customArgsAndExceptionArgc, customArgsAndExceptionArgv); + proto->Set(v8::String::New("customArgsAndException"), v8::FunctionTemplate::New(TestObjInternal::customArgsAndExceptionCallback, v8::Handle<v8::Value>(), customArgsAndExceptionSignature)); + // Custom toString template desc->Set(getToStringName(), getToStringTemplate()); return desc; diff --git a/WebCore/bindings/v8/test/V8TestObj.h b/WebCore/bindings/scripts/test/V8/V8TestObj.h index 5d6770a..5d6770a 100644 --- a/WebCore/bindings/v8/test/V8TestObj.h +++ b/WebCore/bindings/scripts/test/V8/V8TestObj.h diff --git a/WebCore/bindings/v8/ScriptCallStack.cpp b/WebCore/bindings/v8/ScriptCallStack.cpp index 95e874b..6ca952e 100644 --- a/WebCore/bindings/v8/ScriptCallStack.cpp +++ b/WebCore/bindings/v8/ScriptCallStack.cpp @@ -33,13 +33,16 @@ #include "ScriptController.h" #include "ScriptDebugServer.h" +#include "V8Binding.h" +#include <v8-debug.h> #include <v8.h> - -#include "V8Binding.h" +#include <wtf/StdLibExtras.h> // For DEFINE_STATIC_LOCAL namespace WebCore { +v8::Persistent<v8::Context> ScriptCallStack::s_utilityContext; + ScriptCallStack* ScriptCallStack::create(const v8::Arguments& arguments, unsigned skipArgumentCount) { String sourceName; int sourceLineNumber; @@ -51,10 +54,14 @@ ScriptCallStack* ScriptCallStack::create(const v8::Arguments& arguments, unsigne bool ScriptCallStack::callLocation(String* sourceName, int* sourceLineNumber, String* functionName) { +<<<<<<< HEAD:WebCore/bindings/v8/ScriptCallStack.cpp #if PLATFORM(ANDROID) return false; #else if (!ScriptDebugServer::topStackFrame(*sourceName, *sourceLineNumber, *functionName)) +======= + if (!topStackFrame(*sourceName, *sourceLineNumber, *functionName)) +>>>>>>> webkit.org at r58956:WebCore/bindings/v8/ScriptCallStack.cpp return false; *sourceLineNumber += 1; return true; @@ -79,4 +86,67 @@ const ScriptCallFrame& ScriptCallStack::at(unsigned index) const return m_lastCaller; } +// Create the utility context for holding JavaScript functions used internally +// which are not visible to JavaScript executing on the page. +void ScriptCallStack::createUtilityContext() +{ + ASSERT(s_utilityContext.IsEmpty()); + + v8::HandleScope scope; + v8::Handle<v8::ObjectTemplate> globalTemplate = v8::ObjectTemplate::New(); + s_utilityContext = v8::Context::New(0, globalTemplate); + v8::Context::Scope contextScope(s_utilityContext); + + // Compile JavaScript function for retrieving the source line, the source + // name and the symbol name for the top JavaScript stack frame. + DEFINE_STATIC_LOCAL(const char*, topStackFrame, + ("function topStackFrame(exec_state) {" + " if (!exec_state.frameCount())" + " return undefined;" + " var frame = exec_state.frame(0);" + " var func = frame.func();" + " var scriptName;" + " if (func.resolved() && func.script())" + " scriptName = func.script().name();" + " return [scriptName, frame.sourceLine(), (func.name() || func.inferredName())];" + "}")); + v8::Script::Compile(v8::String::New(topStackFrame))->Run(); +} + +bool ScriptCallStack::topStackFrame(String& sourceName, int& lineNumber, String& functionName) +{ + v8::HandleScope scope; + v8::Handle<v8::Context> v8UtilityContext = utilityContext(); + if (v8UtilityContext.IsEmpty()) + return false; + v8::Context::Scope contextScope(v8UtilityContext); + v8::Handle<v8::Function> topStackFrame; + topStackFrame = v8::Local<v8::Function>::Cast(v8UtilityContext->Global()->Get(v8::String::New("topStackFrame"))); + if (topStackFrame.IsEmpty()) + return false; + v8::Handle<v8::Value> value = v8::Debug::Call(topStackFrame); + if (value.IsEmpty()) + return false; + // If there is no top stack frame, we still return success, but fill the input params with defaults. + if (value->IsUndefined()) { + // Fallback to setting lineNumber to 0, and source and function name to "undefined". + sourceName = toWebCoreString(value); + lineNumber = 0; + functionName = toWebCoreString(value); + return true; + } + if (!value->IsArray()) + return false; + v8::Local<v8::Object> jsArray = value->ToObject(); + v8::Local<v8::Value> sourceNameValue = jsArray->Get(0); + v8::Local<v8::Value> lineNumberValue = jsArray->Get(1); + v8::Local<v8::Value> functionNameValue = jsArray->Get(2); + if (sourceNameValue.IsEmpty() || lineNumberValue.IsEmpty() || functionNameValue.IsEmpty()) + return false; + sourceName = toWebCoreString(sourceNameValue); + lineNumber = lineNumberValue->Int32Value(); + functionName = toWebCoreString(functionNameValue); + return true; +} + } // namespace WebCore diff --git a/WebCore/bindings/v8/ScriptCallStack.h b/WebCore/bindings/v8/ScriptCallStack.h index 2433bde..11ec3bb 100644 --- a/WebCore/bindings/v8/ScriptCallStack.h +++ b/WebCore/bindings/v8/ScriptCallStack.h @@ -42,26 +42,48 @@ namespace v8 { namespace WebCore { - class ScriptCallStack : public Noncopyable { - public: - static ScriptCallStack* create(const v8::Arguments&, unsigned skipArgumentCount = 0); - ~ScriptCallStack(); - - static bool callLocation(String* sourceName, int* sourceLineNumber, String* functionName); - - const ScriptCallFrame& at(unsigned) const; - // FIXME: implement retrieving and storing call stack trace - unsigned size() const { return 1; } - - ScriptState* state() const { return m_scriptState; } - ScriptState* globalState() const { return m_scriptState; } - - private: - ScriptCallStack(const v8::Arguments& arguments, unsigned skipArgumentCount, String sourceName, int sourceLineNumber, String funcName); - - ScriptCallFrame m_lastCaller; - ScriptState* m_scriptState; - }; +class ScriptCallStack : public Noncopyable { +public: + static ScriptCallStack* create(const v8::Arguments&, unsigned skipArgumentCount = 0); + ~ScriptCallStack(); + + static bool callLocation(String* sourceName, int* sourceLineNumber, String* functionName); + + const ScriptCallFrame& at(unsigned) const; + // FIXME: implement retrieving and storing call stack trace + unsigned size() const { return 1; } + + ScriptState* state() const { return m_scriptState; } + ScriptState* globalState() const { return m_scriptState; } + +private: + ScriptCallStack(const v8::Arguments& arguments, unsigned skipArgumentCount, String sourceName, int sourceLineNumber, String funcName); + + // Function for retrieving the source name, line number and function name for the top + // JavaScript stack frame. + // + // It will return true if the caller information was successfully retrieved and written + // into the function parameters, otherwise the function will return false. It may + // fail due to a stack overflow in the underlying JavaScript implementation, handling + // of such exception is up to the caller. + static bool topStackFrame(String& sourceName, int& lineNumber, String& functionName); + + static void createUtilityContext(); + + // Returns a local handle of the utility context. + static v8::Local<v8::Context> utilityContext() + { + if (s_utilityContext.IsEmpty()) + createUtilityContext(); + return v8::Local<v8::Context>::New(s_utilityContext); + } + + ScriptCallFrame m_lastCaller; + ScriptState* m_scriptState; + + // Utility context holding JavaScript functions used internally. + static v8::Persistent<v8::Context> s_utilityContext; +}; } // namespace WebCore diff --git a/WebCore/bindings/v8/ScriptController.cpp b/WebCore/bindings/v8/ScriptController.cpp index ee15eaa..0f94a2e 100644 --- a/WebCore/bindings/v8/ScriptController.cpp +++ b/WebCore/bindings/v8/ScriptController.cpp @@ -68,6 +68,7 @@ void ScriptController::initializeThreading() static bool initializedThreading = false; if (!initializedThreading) { WTF::initializeThreading(); + WTF::initializeMainThread(); initializedThreading = true; } } diff --git a/WebCore/bindings/v8/ScriptDebugServer.cpp b/WebCore/bindings/v8/ScriptDebugServer.cpp index 54d7694..ce258fb 100644 --- a/WebCore/bindings/v8/ScriptDebugServer.cpp +++ b/WebCore/bindings/v8/ScriptDebugServer.cpp @@ -44,8 +44,6 @@ namespace WebCore { -v8::Persistent<v8::Context> ScriptDebugServer::s_utilityContext; - ScriptDebugServer::MessageLoopDispatchHandler ScriptDebugServer::s_messageLoopDispatchHandler = 0; ScriptDebugServer& ScriptDebugServer::shared() @@ -81,11 +79,10 @@ void ScriptDebugServer::addListener(ScriptDebugListener* listener, Page* page) m_listenersMap.set(page, listener); V8Proxy* proxy = V8Proxy::retrieve(page->mainFrame()); v8::Local<v8::Context> context = proxy->mainWorldContext(); - String contextData = toWebCoreStringWithNullCheck(context->GetData()); - m_contextDataMap.set(listener, contextData); v8::Handle<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("getScripts"))); - v8::Handle<v8::Value> value = v8::Debug::Call(getScriptsFunction); + v8::Handle<v8::Value> argv[] = { context->GetData() }; + v8::Handle<v8::Value> value = getScriptsFunction->Call(m_debuggerScript.get(), 1, argv); if (value.IsEmpty()) return; ASSERT(!value->IsUndefined() && value->IsArray()); @@ -175,6 +172,35 @@ void ScriptDebugServer::setBreakpointsActivated(bool enabled) #endif } +ScriptDebugServer::PauseOnExceptionsState ScriptDebugServer::pauseOnExceptionsState() +{ +#if ENABLE(V8_SCRIPT_DEBUG_SERVER) + ensureDebuggerScriptCompiled(); + v8::HandleScope scope; + v8::Context::Scope contextScope(v8::Debug::GetDebugContext()); + + v8::Handle<v8::Function> currentCallFrameFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("pauseOnExceptionsState"))); + v8::Handle<v8::Value> argv[] = { v8::Handle<v8::Value>() }; + v8::Handle<v8::Value> result = currentCallFrameFunction->Call(m_debuggerScript.get(), 0, argv); + return static_cast<ScriptDebugServer::PauseOnExceptionsState>(result->Int32Value()); +#else + return DontPauseOnExceptions; +#endif +} + +void ScriptDebugServer::setPauseOnExceptionsState(PauseOnExceptionsState pauseOnExceptionsState) +{ +#if ENABLE(V8_SCRIPT_DEBUG_SERVER) + ensureDebuggerScriptCompiled(); + v8::HandleScope scope; + v8::Context::Scope contextScope(v8::Debug::GetDebugContext()); + + v8::Handle<v8::Function> currentCallFrameFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("setPauseOnExceptionsState"))); + v8::Handle<v8::Value> argv[] = { v8::Int32::New(pauseOnExceptionsState) }; + currentCallFrameFunction->Call(m_debuggerScript.get(), 1, argv); +#endif +} + void ScriptDebugServer::continueProgram() { #if ENABLE(V8_SCRIPT_DEBUG_SERVER) @@ -216,26 +242,15 @@ ScriptState* ScriptDebugServer::currentCallFrameState() return m_currentCallFrameState; } -v8::Handle<v8::Value> ScriptDebugServer::currentCallFrameV8() -{ -#if ENABLE(V8_SCRIPT_DEBUG_SERVER) - if (!m_currentCallFrame.get().IsEmpty()) - return m_currentCallFrame.get(); - - // Check on a bp. - v8::Handle<v8::Function> currentCallFrameFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("currentCallFrame"))); - v8::Handle<v8::Value> argv[] = { m_executionState.get() }; - v8::Handle<v8::Value> result = currentCallFrameFunction->Call(m_debuggerScript.get(), 1, argv); - m_currentCallFrame.set(result); - return result; -#else - return v8::Handle<v8::Value>(); -#endif -} - PassRefPtr<JavaScriptCallFrame> ScriptDebugServer::currentCallFrame() { - return JavaScriptCallFrame::create(v8::Debug::GetDebugContext(), v8::Handle<v8::Object>::Cast(currentCallFrameV8())); + if (!m_currentCallFrame) { + v8::Handle<v8::Function> currentCallFrameFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("currentCallFrame"))); + v8::Handle<v8::Value> argv[] = { m_executionState.get() }; + v8::Handle<v8::Value> currentCallFrameV8 = currentCallFrameFunction->Call(m_debuggerScript.get(), 1, argv); + m_currentCallFrame = JavaScriptCallFrame::create(v8::Debug::GetDebugContext(), v8::Handle<v8::Object>::Cast(currentCallFrameV8)); + } + return m_currentCallFrame; } void ScriptDebugServer::onV8DebugMessage(const v8::Debug::Message& message) @@ -268,7 +283,7 @@ void ScriptDebugServer::handleV8DebugMessage(const v8::Debug::Message& message) return; // Ignore unsupported event types. - if (message.GetEvent() != v8::AfterCompile && message.GetEvent() != v8::Break) + if (message.GetEvent() != v8::AfterCompile && message.GetEvent() != v8::Break && message.GetEvent() != v8::Exception) return; v8::Handle<v8::Context> context = message.GetEventContext(); @@ -286,11 +301,13 @@ void ScriptDebugServer::handleV8DebugMessage(const v8::Debug::Message& message) if (global.IsEmpty()) return; + bool handled = false; Frame* frame = V8Proxy::retrieveFrame(context); if (frame) { ScriptDebugListener* listener = m_listenersMap.get(frame->page()); if (listener) { if (message.GetEvent() == v8::AfterCompile) { + handled = true; v8::Context::Scope contextScope(v8::Debug::GetDebugContext()); v8::Local<v8::Object> args = v8::Object::New(); args->Set(v8::String::New("eventData"), message.GetEventData()); @@ -300,7 +317,8 @@ void ScriptDebugServer::handleV8DebugMessage(const v8::Debug::Message& message) ASSERT(value->IsObject()); v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(value); dispatchDidParseSource(listener, object); - } else if (message.GetEvent() == v8::Break) { + } else if (message.GetEvent() == v8::Break || message.GetEvent() == v8::Exception) { + handled = true; m_executionState.set(message.GetExecutionState()); m_currentCallFrameState = mainWorldScriptState(frame); listener->didPause(); @@ -308,14 +326,13 @@ void ScriptDebugServer::handleV8DebugMessage(const v8::Debug::Message& message) } } } + + if (!handled && !message.WillStartRunning()) + continueProgram(); } void ScriptDebugServer::dispatchDidParseSource(ScriptDebugListener* listener, v8::Handle<v8::Object> object) { - String contextData = toWebCoreStringWithNullCheck(object->Get(v8::String::New("contextData"))); - if (contextData != m_contextDataMap.get(listener)) - return; - listener->didParseSource( toWebCoreStringWithNullCheck(object->Get(v8::String::New("id"))), toWebCoreStringWithNullCheck(object->Get(v8::String::New("name"))), @@ -339,69 +356,6 @@ void ScriptDebugServer::didResume() m_executionState.clear(); } -// Create the utility context for holding JavaScript functions used internally -// which are not visible to JavaScript executing on the page. -void ScriptDebugServer::createUtilityContext() -{ - ASSERT(s_utilityContext.IsEmpty()); - - v8::HandleScope scope; - v8::Handle<v8::ObjectTemplate> globalTemplate = v8::ObjectTemplate::New(); - s_utilityContext = v8::Context::New(0, globalTemplate); - v8::Context::Scope contextScope(s_utilityContext); - - // Compile JavaScript function for retrieving the source line, the source - // name and the symbol name for the top JavaScript stack frame. - DEFINE_STATIC_LOCAL(const char*, topStackFrame, - ("function topStackFrame(exec_state) {" - " if (!exec_state.frameCount())" - " return undefined;" - " var frame = exec_state.frame(0);" - " var func = frame.func();" - " var scriptName;" - " if (func.resolved() && func.script())" - " scriptName = func.script().name();" - " return [scriptName, frame.sourceLine(), (func.name() || func.inferredName())];" - "}")); - v8::Script::Compile(v8::String::New(topStackFrame))->Run(); -} - -bool ScriptDebugServer::topStackFrame(String& sourceName, int& lineNumber, String& functionName) -{ - v8::HandleScope scope; - v8::Handle<v8::Context> v8UtilityContext = utilityContext(); - if (v8UtilityContext.IsEmpty()) - return false; - v8::Context::Scope contextScope(v8UtilityContext); - v8::Handle<v8::Function> topStackFrame; - topStackFrame = v8::Local<v8::Function>::Cast(v8UtilityContext->Global()->Get(v8::String::New("topStackFrame"))); - if (topStackFrame.IsEmpty()) - return false; - v8::Handle<v8::Value> value = v8::Debug::Call(topStackFrame); - if (value.IsEmpty()) - return false; - // If there is no top stack frame, we still return success, but fill the input params with defaults. - if (value->IsUndefined()) { - // Fallback to setting lineNumber to 0, and source and function name to "undefined". - sourceName = toWebCoreString(value); - lineNumber = 0; - functionName = toWebCoreString(value); - return true; - } - if (!value->IsArray()) - return false; - v8::Local<v8::Object> jsArray = value->ToObject(); - v8::Local<v8::Value> sourceNameValue = jsArray->Get(0); - v8::Local<v8::Value> lineNumberValue = jsArray->Get(1); - v8::Local<v8::Value> functionNameValue = jsArray->Get(2); - if (sourceNameValue.IsEmpty() || lineNumberValue.IsEmpty() || functionNameValue.IsEmpty()) - return false; - sourceName = toWebCoreString(sourceNameValue); - lineNumber = lineNumberValue->Int32Value(); - functionName = toWebCoreString(functionNameValue); - return true; -} - } // namespace WebCore #endif // ENABLE(JAVASCRIPT_DEBUGGER) diff --git a/WebCore/bindings/v8/ScriptDebugServer.h b/WebCore/bindings/v8/ScriptDebugServer.h index 04857e4..6ef0afd 100644 --- a/WebCore/bindings/v8/ScriptDebugServer.h +++ b/WebCore/bindings/v8/ScriptDebugServer.h @@ -33,7 +33,7 @@ #if ENABLE(JAVASCRIPT_DEBUGGER) -#include "OwnHandle.h" +#include "JavaScriptCallFrame.h" #include "PlatformString.h" #include "ScriptBreakpoint.h" #include "ScriptState.h" @@ -45,22 +45,12 @@ namespace WebCore { -class JavaScriptCallFrame; class Page; class ScriptDebugListener; class ScriptDebugServer : public Noncopyable { public: static ScriptDebugServer& shared(); - - // Function for retrieving the source name, line number and function name for the top - // JavaScript stack frame. - // - // It will return true if the caller information was successfully retrieved and written - // into the function parameters, otherwise the function will return false. It may - // fail due to a stack overflow in the underlying JavaScript implementation, handling - // of such exception is up to the caller. - static bool topStackFrame(String& sourceName, int& lineNumber, String& functionName); void addListener(ScriptDebugListener*, Page*); void removeListener(ScriptDebugListener*, Page*); @@ -75,8 +65,8 @@ public: PauseOnAllExceptions, PauseOnUncaughtExceptions }; - PauseOnExceptionsState pauseOnExceptionsState() const { return m_pauseOnExceptionsState; } - void setPauseOnExceptionsState(PauseOnExceptionsState pauseOnExceptionsState) { m_pauseOnExceptionsState = pauseOnExceptionsState; } + PauseOnExceptionsState pauseOnExceptionsState(); + void setPauseOnExceptionsState(PauseOnExceptionsState pauseOnExceptionsState); void pauseProgram() { } void continueProgram(); @@ -97,7 +87,6 @@ public: typedef void (*MessageLoopDispatchHandler)(const Vector<WebCore::Page*>&); static void setMessageLoopDispatchHandler(MessageLoopDispatchHandler messageLoopDispatchHandler) { s_messageLoopDispatchHandler = messageLoopDispatchHandler; } - v8::Handle<v8::Value> currentCallFrameV8(); PassRefPtr<JavaScriptCallFrame> currentCallFrame(); private: @@ -115,28 +104,13 @@ private: void ensureDebuggerScriptCompiled(); void didResume(); - static void createUtilityContext(); - - // Returns a local handle of the utility context. - static v8::Local<v8::Context> utilityContext() - { - if (s_utilityContext.IsEmpty()) - createUtilityContext(); - return v8::Local<v8::Context>::New(s_utilityContext); - } - - // Utility context holding JavaScript functions used internally. - static v8::Persistent<v8::Context> s_utilityContext; - typedef HashMap<Page*, ScriptDebugListener*> ListenersMap; ListenersMap m_listenersMap; - typedef HashMap<ScriptDebugListener*, String> ContextDataMap; - ContextDataMap m_contextDataMap; String m_debuggerScriptSource; PauseOnExceptionsState m_pauseOnExceptionsState; OwnHandle<v8::Object> m_debuggerScript; ScriptState* m_currentCallFrameState; - OwnHandle<v8::Value> m_currentCallFrame; + RefPtr<JavaScriptCallFrame> m_currentCallFrame; OwnHandle<v8::Object> m_executionState; static MessageLoopDispatchHandler s_messageLoopDispatchHandler; diff --git a/WebCore/bindings/v8/ScriptEventListener.cpp b/WebCore/bindings/v8/ScriptEventListener.cpp index fdb6076..cad7a1c 100644 --- a/WebCore/bindings/v8/ScriptEventListener.cpp +++ b/WebCore/bindings/v8/ScriptEventListener.cpp @@ -106,7 +106,7 @@ PassRefPtr<V8LazyEventListener> createAttributeEventListener(Frame* frame, Attri return V8LazyEventListener::create(attr->localName().string(), frame->document()->isSVGDocument(), attr->value(), sourceURL, lineNumber, columnNumber, WorldContextHandle(UseMainWorld)); } -String getEventListenerHandlerBody(ScriptExecutionContext* context, ScriptState* scriptState, EventListener* listener) +String eventListenerHandlerBody(ScriptExecutionContext* context, ScriptState* scriptState, EventListener* listener) { if (listener->type() != EventListener::JSEventListenerType) return ""; @@ -120,4 +120,25 @@ String getEventListenerHandlerBody(ScriptExecutionContext* context, ScriptState* return toWebCoreStringWithNullCheck(function); } +bool eventListenerHandlerLocation(ScriptExecutionContext* context, ScriptState* scriptState, EventListener* listener, String& sourceName, int& lineNumber) +{ + if (listener->type() != EventListener::JSEventListenerType) + return false; + + ScriptScope scope(scriptState); + V8AbstractEventListener* v8Listener = static_cast<V8AbstractEventListener*>(listener); + v8::Handle<v8::Object> object = v8Listener->getListenerObject(context); + if (object.IsEmpty() || !object->IsFunction()) + return false; + + v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(object); + v8::ScriptOrigin origin = function->GetScriptOrigin(); + if (!origin.ResourceName().IsEmpty()) { + sourceName = toWebCoreString(origin.ResourceName()); + lineNumber = function->GetScriptLineNumber() + 1; + return true; + } + return false; +} + } // namespace WebCore diff --git a/WebCore/bindings/v8/ScriptEventListener.h b/WebCore/bindings/v8/ScriptEventListener.h index ce12a53..7815e29 100644 --- a/WebCore/bindings/v8/ScriptEventListener.h +++ b/WebCore/bindings/v8/ScriptEventListener.h @@ -45,7 +45,8 @@ namespace WebCore { PassRefPtr<V8LazyEventListener> createAttributeEventListener(Node*, Attribute*); PassRefPtr<V8LazyEventListener> createAttributeEventListener(Frame*, Attribute*); - String getEventListenerHandlerBody(ScriptExecutionContext*, ScriptState*, EventListener*); + String eventListenerHandlerBody(ScriptExecutionContext*, ScriptState*, EventListener*); + bool eventListenerHandlerLocation(ScriptExecutionContext*, ScriptState*, EventListener*, String& sourceName, int& lineNumber); } // namespace WebCore diff --git a/WebCore/bindings/v8/ScriptProfileNode.cpp b/WebCore/bindings/v8/ScriptProfileNode.cpp index 3121128..7266c29 100644 --- a/WebCore/bindings/v8/ScriptProfileNode.cpp +++ b/WebCore/bindings/v8/ScriptProfileNode.cpp @@ -55,14 +55,12 @@ unsigned long ScriptProfileNode::lineNumber() const double ScriptProfileNode::totalTime() const { - // FIXME: use GetTotalMilliseconds once it is implemented in V8. - return m_profileNode->GetTotalSamplesCount(); + return m_profileNode->GetTotalTime(); } double ScriptProfileNode::selfTime() const { - // FIXME: use GetSelfMilliseconds once it is implemented in V8. - return m_profileNode->GetSelfSamplesCount(); + return m_profileNode->GetSelfTime(); } unsigned long ScriptProfileNode::numberOfCalls() const diff --git a/WebCore/bindings/v8/V8AbstractEventListener.cpp b/WebCore/bindings/v8/V8AbstractEventListener.cpp index 6dc2b29..b6c53df 100644 --- a/WebCore/bindings/v8/V8AbstractEventListener.cpp +++ b/WebCore/bindings/v8/V8AbstractEventListener.cpp @@ -71,6 +71,8 @@ V8AbstractEventListener::~V8AbstractEventListener() void V8AbstractEventListener::handleEvent(ScriptExecutionContext* context, Event* event) { + ASSERT(event); + // The callback function on XMLHttpRequest can clear the event listener and destroys 'this' object. Keep a local reference to it. // See issue 889829. RefPtr<V8AbstractEventListener> protect(this); @@ -86,6 +88,7 @@ void V8AbstractEventListener::handleEvent(ScriptExecutionContext* context, Event // Get the V8 wrapper for the event object. v8::Handle<v8::Value> jsEvent = toV8(event); + ASSERT(!jsEvent.IsEmpty()); invokeEventHandler(context, event, jsEvent); } @@ -114,6 +117,9 @@ void V8AbstractEventListener::setListenerObject(v8::Handle<v8::Object> listener) void V8AbstractEventListener::invokeEventHandler(ScriptExecutionContext* context, Event* event, v8::Handle<v8::Value> jsEvent) { + // If jsEvent is empty, attempt to set it as a hidden value would crash v8. + if (jsEvent.IsEmpty()) + return; v8::Local<v8::Context> v8Context = toV8Context(context, worldContext()); if (v8Context.IsEmpty()) diff --git a/WebCore/bindings/v8/V8GCController.cpp b/WebCore/bindings/v8/V8GCController.cpp index 61b2a88..fa7c357 100644 --- a/WebCore/bindings/v8/V8GCController.cpp +++ b/WebCore/bindings/v8/V8GCController.cpp @@ -378,7 +378,12 @@ public: ActiveDOMObject* activeDOMObject = typeInfo->toActiveDOMObject(wrapper); if (activeDOMObject && activeDOMObject->hasPendingActivity()) { ASSERT(!wrapper.IsWeak()); - wrapper.MakeWeak(activeDOMObject, &DOMDataStore::weakActiveDOMObjectCallback); + // NOTE: To re-enable weak status of the active object we use + // |object| from the map and not |activeDOMObject|. The latter + // may be a different pointer (in case ActiveDOMObject is not + // the main base class of the object's class) and pointer + // identity is required by DOM map functions. + wrapper.MakeWeak(object, &DOMDataStore::weakActiveDOMObjectCallback); } } } diff --git a/WebCore/bindings/v8/V8NPObject.cpp b/WebCore/bindings/v8/V8NPObject.cpp index 1ea6487..84450e5 100644 --- a/WebCore/bindings/v8/V8NPObject.cpp +++ b/WebCore/bindings/v8/V8NPObject.cpp @@ -33,7 +33,6 @@ #include "V8NPObject.h" #include "HTMLPlugInElement.h" -#include "IdentifierRep.h" #include "NPV8Object.h" #include "V8DOMMap.h" #include "V8HTMLAppletElement.h" @@ -54,6 +53,17 @@ enum InvokeFunctionType { InvokeDefault = 3 }; +struct IdentifierRep { + int number() const { return m_isString ? 0 : m_value.m_number; } + const char* string() const { return m_isString ? m_value.m_string : 0; } + + union { + const char* m_string; + int m_number; + } m_value; + bool m_isString; +}; + // FIXME: need comments. // Params: holder could be HTMLEmbedElement or NPObject static v8::Handle<v8::Value> npObjectInvokeImpl(const v8::Arguments& args, InvokeFunctionType functionId) diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp index 0543037..7f52374 100644 --- a/WebCore/bindings/v8/V8Proxy.cpp +++ b/WebCore/bindings/v8/V8Proxy.cpp @@ -505,7 +505,7 @@ v8::Local<v8::Value> V8Proxy::callFunction(v8::Handle<v8::Function> function, v8 #if ENABLE(INSPECTOR) Page* inspectedPage = InspectorTimelineAgent::instanceCount() ? m_frame->page(): 0; - if (inspectedPage) + if (inspectedPage) { if (InspectorTimelineAgent* timelineAgent = inspectedPage->inspectorTimelineAgent()) { v8::ScriptOrigin origin = function->GetScriptOrigin(); String resourceName("undefined"); @@ -517,6 +517,7 @@ v8::Local<v8::Value> V8Proxy::callFunction(v8::Handle<v8::Function> function, v8 timelineAgent->willCallFunction(resourceName, lineNumber); } else inspectedPage = 0; + } #endif // !ENABLE(INSPECTOR) m_recursion++; diff --git a/WebCore/bindings/v8/V8Proxy.h b/WebCore/bindings/v8/V8Proxy.h index 98bc902..cd2ddad 100644 --- a/WebCore/bindings/v8/V8Proxy.h +++ b/WebCore/bindings/v8/V8Proxy.h @@ -39,6 +39,7 @@ #include "V8DOMWindowShell.h" #include "V8DOMWrapper.h" #include "V8GCController.h" +#include "V8Utilities.h" #include "WrapperTypeInfo.h" #include <v8.h> #include <wtf/PassRefPtr.h> // so generated bindings don't have to @@ -304,6 +305,9 @@ namespace WebCore { template <typename T> static v8::Handle<v8::Value> constructDOMObject(const v8::Arguments&, WrapperTypeInfo*); + template <typename T> + static v8::Handle<v8::Value> constructDOMObjectWithScriptExecutionContext(const v8::Arguments&, WrapperTypeInfo*); + // Process any pending JavaScript console messages. static void processConsoleMessages(); @@ -409,6 +413,25 @@ namespace WebCore { return args.Holder(); } + template <typename T> + v8::Handle<v8::Value> V8Proxy::constructDOMObjectWithScriptExecutionContext(const v8::Arguments& args, WrapperTypeInfo* type) + { + if (!args.IsConstructCall()) + return throwError(V8Proxy::TypeError, ""); + + ScriptExecutionContext* context = getScriptExecutionContext(); + if (!context) + return throwError(V8Proxy::ReferenceError, ""); + + // Note: it's OK to let this RefPtr go out of scope because we also call + // SetDOMWrapper(), which effectively holds a reference to obj. + RefPtr<T> obj = T::create(context); + V8DOMWrapper::setDOMWrapper(args.Holder(), type, obj.get()); + obj->ref(); + V8DOMWrapper::setJSWrapperForDOMObject(obj.get(), v8::Persistent<v8::Object>::New(args.Holder())); + return args.Holder(); + } + v8::Local<v8::Context> toV8Context(ScriptExecutionContext*, const WorldContextHandle& worldContext); diff --git a/WebCore/bindings/v8/WorkerScriptController.h b/WebCore/bindings/v8/WorkerScriptController.h index 616697a..5e3159f 100644 --- a/WebCore/bindings/v8/WorkerScriptController.h +++ b/WebCore/bindings/v8/WorkerScriptController.h @@ -58,6 +58,7 @@ namespace WebCore { enum ForbidExecutionOption { TerminateRunningScript, LetRunningScriptFinish }; void forbidExecution(ForbidExecutionOption); + bool isExecutionForbidden() const { return m_executionForbidden; } // Returns WorkerScriptController for the currently executing context. 0 will be returned if the current executing context is not the worker context. static WorkerScriptController* controllerForContext(); diff --git a/WebCore/bindings/v8/WorldContextHandle.cpp b/WebCore/bindings/v8/WorldContextHandle.cpp index 7ba76d3..24f461f 100644 --- a/WebCore/bindings/v8/WorldContextHandle.cpp +++ b/WebCore/bindings/v8/WorldContextHandle.cpp @@ -47,10 +47,9 @@ WorldContextHandle::WorldContextHandle(WorldToUse worldToUse) v8::Local<v8::Context> WorldContextHandle::adjustedContext(V8Proxy* proxy) const { - if (m_worldToUse == UseMainWorld) + if (m_worldToUse == UseMainWorld || !m_context || m_context->get().IsEmpty()) return proxy->mainWorldContext(); - if (!m_context || m_context->get().IsEmpty()) - return proxy->context(); + return v8::Local<v8::Context>::New(m_context->get()); } diff --git a/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp b/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp index 9026420..4cc6ac2 100644 --- a/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp +++ b/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp @@ -42,17 +42,11 @@ namespace WebCore { typedef Vector<RefPtr<ScriptProfile> > ProfilesArray; -v8::Handle<v8::Value> V8Console::profilesAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +v8::Handle<v8::Value> V8Console::profilesAccessorGetter(v8::Local<v8::String>, const v8::AccessorInfo&) { INC_STATS("DOM.Console.profilesAccessorGetter"); - Console* imp = V8Console::toNative(info.Holder()); - const ProfilesArray& profiles = imp->profiles(); - v8::Handle<v8::Array> result = v8::Array::New(profiles.size()); - int index = 0; - ProfilesArray::const_iterator end = profiles.end(); - for (ProfilesArray::const_iterator iter = profiles.begin(); iter != end; ++iter) - result->Set(v8::Integer::New(index++), toV8(iter->get())); - return result; + // FIXME: Provide a real implementation. + return v8::Array::New(0); } } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8CustomSQLStatementCallback.cpp b/WebCore/bindings/v8/custom/V8CustomSQLStatementCallback.cpp deleted file mode 100644 index df0cc53..0000000 --- a/WebCore/bindings/v8/custom/V8CustomSQLStatementCallback.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(DATABASE) - -#include "V8CustomSQLStatementCallback.h" - -#include "Frame.h" -#include "ScriptExecutionContext.h" -#include "V8CustomVoidCallback.h" -#include "V8SQLResultSet.h" -#include "V8SQLTransaction.h" - -namespace WebCore { - -V8CustomSQLStatementCallback::V8CustomSQLStatementCallback(v8::Local<v8::Object> callback, Frame* frame) - : m_callback(v8::Persistent<v8::Object>::New(callback)) - , m_frame(frame) - , m_worldContext(UseCurrentWorld) -{ -} - -V8CustomSQLStatementCallback::~V8CustomSQLStatementCallback() -{ - m_callback.Dispose(); -} - -void V8CustomSQLStatementCallback::handleEvent(ScriptExecutionContext* context, SQLTransaction* transaction, SQLResultSet* resultSet, bool& raisedException) -{ - v8::HandleScope handleScope; - - v8::Handle<v8::Context> v8Context = toV8Context(context, m_worldContext); - if (v8Context.IsEmpty()) - return; - - v8::Context::Scope scope(v8Context); - - v8::Handle<v8::Value> argv[] = { - toV8(transaction), - toV8(resultSet) - }; - - // Protect the frame until the callback returns. - RefPtr<Frame> protector(m_frame); - - bool callbackReturnValue = false; - raisedException = invokeCallback(m_callback, 2, argv, callbackReturnValue); -} - -} // namespace WebCore - -#endif diff --git a/WebCore/bindings/v8/custom/V8CustomSQLStatementCallback.h b/WebCore/bindings/v8/custom/V8CustomSQLStatementCallback.h deleted file mode 100644 index 31f53e4..0000000 --- a/WebCore/bindings/v8/custom/V8CustomSQLStatementCallback.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8CustomSQLStatementCallback_h -#define V8CustomSQLStatementCallback_h - -#if ENABLE(DATABASE) - -#include "SQLStatementCallback.h" -#include "WorldContextHandle.h" -#include <v8.h> -#include <wtf/Forward.h> - -namespace WebCore { - -class Frame; - -class V8CustomSQLStatementCallback : public SQLStatementCallback { -public: - static PassRefPtr<V8CustomSQLStatementCallback> create(v8::Local<v8::Value> value, Frame* frame) - { - ASSERT(value->IsObject()); - return adoptRef(new V8CustomSQLStatementCallback(value->ToObject(), frame)); - } - virtual ~V8CustomSQLStatementCallback(); - - virtual void handleEvent(ScriptExecutionContext*, SQLTransaction*, SQLResultSet*, bool& raisedException); -private: - V8CustomSQLStatementCallback(v8::Local<v8::Object>, Frame*); - - v8::Persistent<v8::Object> m_callback; - RefPtr<Frame> m_frame; - WorldContextHandle m_worldContext; -}; - -} // namespace WebCore - -#endif - -#endif // V8CustomSQLStatementCallback_h diff --git a/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp b/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp index 2545f24..e033684 100644 --- a/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp +++ b/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp @@ -32,7 +32,7 @@ #if ENABLE(DATABASE) -#include "V8CustomSQLStatementErrorCallback.h" +#include "V8SQLStatementErrorCallback.h" #include "Frame.h" #include "ScriptExecutionContext.h" @@ -42,19 +42,7 @@ namespace WebCore { -V8CustomSQLStatementErrorCallback::V8CustomSQLStatementErrorCallback(v8::Local<v8::Object> callback, Frame* frame) - : m_callback(v8::Persistent<v8::Object>::New(callback)) - , m_frame(frame) - , m_worldContext(UseCurrentWorld) -{ -} - -V8CustomSQLStatementErrorCallback::~V8CustomSQLStatementErrorCallback() -{ - m_callback.Dispose(); -} - -bool V8CustomSQLStatementErrorCallback::handleEvent(ScriptExecutionContext* context, SQLTransaction* transaction, SQLError* error) +bool V8SQLStatementErrorCallback::handleEvent(ScriptExecutionContext* context, SQLTransaction* transaction, SQLError* error) { v8::HandleScope handleScope; diff --git a/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.h b/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.h deleted file mode 100644 index c3d7f79..0000000 --- a/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8CustomSQLStatementErrorCallback_h -#define V8CustomSQLStatementErrorCallback_h - -#if ENABLE(DATABASE) - -#include "SQLStatementErrorCallback.h" -#include "WorldContextHandle.h" -#include <v8.h> -#include <wtf/PassRefPtr.h> -#include <wtf/RefPtr.h> - -namespace WebCore { - -class Frame; - -class V8CustomSQLStatementErrorCallback : public SQLStatementErrorCallback { -public: - static PassRefPtr<V8CustomSQLStatementErrorCallback> create(v8::Local<v8::Value> value, Frame* frame) - { - ASSERT(value->IsObject()); - return adoptRef(new V8CustomSQLStatementErrorCallback(value->ToObject(), frame)); - } - virtual ~V8CustomSQLStatementErrorCallback(); - - virtual bool handleEvent(ScriptExecutionContext*, SQLTransaction*, SQLError*); -private: - V8CustomSQLStatementErrorCallback(v8::Local<v8::Object>, Frame*); - - v8::Persistent<v8::Object> m_callback; - RefPtr<Frame> m_frame; - WorldContextHandle m_worldContext; -}; - -} // namespace WebCore - -#endif - -#endif // V8CustomSQLStatementErrorCallback_h diff --git a/WebCore/bindings/v8/custom/V8CustomSQLTransactionCallback.cpp b/WebCore/bindings/v8/custom/V8CustomSQLTransactionCallback.cpp deleted file mode 100644 index efe415c..0000000 --- a/WebCore/bindings/v8/custom/V8CustomSQLTransactionCallback.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2009, Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(DATABASE) - -#include "V8CustomSQLTransactionCallback.h" - -#include "Frame.h" -#include "ScriptExecutionContext.h" -#include "V8CustomVoidCallback.h" -#include "V8SQLTransaction.h" - -namespace WebCore { - -V8CustomSQLTransactionCallback::V8CustomSQLTransactionCallback(v8::Local<v8::Object> callback, Frame* frame) - : m_callback(v8::Persistent<v8::Object>::New(callback)) - , m_frame(frame) - , m_worldContext(UseCurrentWorld) -{ -} - -V8CustomSQLTransactionCallback::~V8CustomSQLTransactionCallback() -{ - m_callback.Dispose(); -} - - -void V8CustomSQLTransactionCallback::handleEvent(ScriptExecutionContext* context, SQLTransaction* transaction, bool& raisedException) -{ - v8::HandleScope handleScope; - - v8::Handle<v8::Context> v8Context = toV8Context(context, m_worldContext); - if (v8Context.IsEmpty()) - return; - - v8::Context::Scope scope(v8Context); - - v8::Handle<v8::Value> argv[] = { - toV8(transaction) - }; - - // Protect the frame until the callback returns. - RefPtr<Frame> protector(m_frame); - - // Step 5: If the callback couldn't be called (e.g. it was null) or if - // the callback was invoked and raised an exception, jump to the last - // step (rollback transaction). - bool callbackReturnValue = false; - raisedException = invokeCallback(m_callback, 1, argv, callbackReturnValue); -} - -} // namespace WebCore - -#endif diff --git a/WebCore/bindings/v8/custom/V8CustomSQLTransactionCallback.h b/WebCore/bindings/v8/custom/V8CustomSQLTransactionCallback.h deleted file mode 100644 index 60ad529..0000000 --- a/WebCore/bindings/v8/custom/V8CustomSQLTransactionCallback.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8CustomSQLTransactionCallback_h -#define V8CustomSQLTransactionCallback_h - -#if ENABLE(DATABASE) - -#include "SQLTransactionCallback.h" -#include "WorldContextHandle.h" -#include <v8.h> -#include <wtf/Forward.h> - -namespace WebCore { - -class Frame; - -class V8CustomSQLTransactionCallback : public SQLTransactionCallback { -public: - static PassRefPtr<V8CustomSQLTransactionCallback> create(v8::Local<v8::Value> value, Frame* frame) - { - ASSERT(value->IsObject()); - return adoptRef(new V8CustomSQLTransactionCallback(value->ToObject(), frame)); - } - virtual ~V8CustomSQLTransactionCallback(); - - virtual void handleEvent(ScriptExecutionContext*, SQLTransaction*, bool& raisedException); -private: - V8CustomSQLTransactionCallback(v8::Local<v8::Object>, Frame*); - - v8::Persistent<v8::Object> m_callback; - RefPtr<Frame> m_frame; - WorldContextHandle m_worldContext; -}; - -} // namespace WebCore - -#endif - -#endif // V8CustomSQLTransactionCallback_h diff --git a/WebCore/bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp b/WebCore/bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp deleted file mode 100644 index 1ef711a..0000000 --- a/WebCore/bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2009, Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(DATABASE) - -#include "V8CustomSQLTransactionErrorCallback.h" - -#include "Frame.h" -#include "ScriptExecutionContext.h" -#include "V8CustomVoidCallback.h" -#include "V8SQLError.h" - -namespace WebCore { - -V8CustomSQLTransactionErrorCallback::V8CustomSQLTransactionErrorCallback(v8::Local<v8::Object> callback, Frame* frame) - : m_callback(v8::Persistent<v8::Object>::New(callback)) - , m_frame(frame) - , m_worldContext(UseCurrentWorld) -{ -} - -V8CustomSQLTransactionErrorCallback::~V8CustomSQLTransactionErrorCallback() -{ - m_callback.Dispose(); -} - -void V8CustomSQLTransactionErrorCallback::handleEvent(ScriptExecutionContext* context, SQLError* error) -{ - v8::HandleScope handleScope; - - v8::Handle<v8::Context> v8Context = toV8Context(context, m_worldContext); - if (v8Context.IsEmpty()) - return; - - v8::Context::Scope scope(v8Context); - - v8::Handle<v8::Value> argv[] = { - toV8(error) - }; - - // Protect the frame until the callback returns. - RefPtr<Frame> protector(m_frame); - - bool callbackReturnValue = false; - invokeCallback(m_callback, 1, argv, callbackReturnValue); -} - -} // namespace WebCore - -#endif diff --git a/WebCore/bindings/v8/custom/V8CustomSQLTransactionErrorCallback.h b/WebCore/bindings/v8/custom/V8CustomSQLTransactionErrorCallback.h deleted file mode 100644 index 72e9e7a..0000000 --- a/WebCore/bindings/v8/custom/V8CustomSQLTransactionErrorCallback.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8CustomSQLTransactionErrorCallback_h -#define V8CustomSQLTransactionErrorCallback_h - -#if ENABLE(DATABASE) - -#include "SQLTransactionErrorCallback.h" -#include "WorldContextHandle.h" -#include <v8.h> -#include <wtf/Forward.h> - -namespace WebCore { - -class Frame; - -class V8CustomSQLTransactionErrorCallback : public SQLTransactionErrorCallback { -public: - static PassRefPtr<V8CustomSQLTransactionErrorCallback> create(v8::Local<v8::Value> value, Frame* frame) - { - ASSERT(value->IsObject()); - return adoptRef(new V8CustomSQLTransactionErrorCallback(value->ToObject(), frame)); - } - virtual ~V8CustomSQLTransactionErrorCallback(); - - virtual void handleEvent(ScriptExecutionContext*, SQLError*); - -private: - V8CustomSQLTransactionErrorCallback(v8::Local<v8::Object>, Frame*); - - v8::Persistent<v8::Object> m_callback; - RefPtr<Frame> m_frame; - WorldContextHandle m_worldContext; -}; - -} // namespace WebCore - -#endif - -#endif // V8CustomSQLTransactionErrorCallback_h diff --git a/WebCore/bindings/v8/custom/V8DatabaseCallback.cpp b/WebCore/bindings/v8/custom/V8DatabaseCallback.cpp deleted file mode 100644 index 088d89f..0000000 --- a/WebCore/bindings/v8/custom/V8DatabaseCallback.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2010, Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(DATABASE) - -#include "V8DatabaseCallback.h" - -#include "Frame.h" -#include "ScriptExecutionContext.h" -#include "V8CustomVoidCallback.h" -#include "V8Database.h" - -namespace WebCore { - -V8DatabaseCallback::V8DatabaseCallback(v8::Local<v8::Object> callback, Frame* frame) - : m_callback(v8::Persistent<v8::Object>::New(callback)) - , m_frame(frame) - , m_worldContext(UseCurrentWorld) -{ -} - -V8DatabaseCallback::~V8DatabaseCallback() -{ - m_callback.Dispose(); -} - -void V8DatabaseCallback::handleEvent(ScriptExecutionContext* context, Database* database) -{ - v8::HandleScope handleScope; - - v8::Handle<v8::Context> v8Context = toV8Context(context, m_worldContext); - if (v8Context.IsEmpty()) - return; - - v8::Context::Scope scope(v8Context); - - v8::Handle<v8::Value> argv[] = { - toV8(database) - }; - - // Protect the frame until the callback returns. - RefPtr<Frame> protector(m_frame); - - bool callbackReturnValue = false; - invokeCallback(m_callback, 1, argv, callbackReturnValue); -} - -} // namespace WebCore - -#endif diff --git a/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp b/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp index 9915d77..39e6632 100644 --- a/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp +++ b/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp @@ -35,8 +35,8 @@ #include "Database.h" #include "V8Binding.h" -#include "V8CustomSQLTransactionCallback.h" -#include "V8CustomSQLTransactionErrorCallback.h" +#include "V8SQLTransactionCallback.h" +#include "V8SQLTransactionErrorCallback.h" #include "V8CustomVoidCallback.h" #include "V8Proxy.h" @@ -58,20 +58,20 @@ v8::Handle<v8::Value> V8Database::changeVersionCallback(const v8::Arguments& arg if (!frame) return v8::Undefined(); - RefPtr<V8CustomSQLTransactionCallback> callback; + RefPtr<V8SQLTransactionCallback> callback; if (args.Length() > 2) { if (!args[2]->IsObject()) return throwError("changeVersion transaction callback must be of valid type."); - callback = V8CustomSQLTransactionCallback::create(args[2], frame); + callback = V8SQLTransactionCallback::create(args[2], frame); } - RefPtr<V8CustomSQLTransactionErrorCallback> errorCallback; + RefPtr<V8SQLTransactionErrorCallback> errorCallback; if (args.Length() > 3) { if (!args[3]->IsObject()) return throwError("changeVersion error callback must be of valid type."); - errorCallback = V8CustomSQLTransactionErrorCallback::create(args[3], frame); + errorCallback = V8SQLTransactionErrorCallback::create(args[3], frame); } RefPtr<V8CustomVoidCallback> successCallback; @@ -101,14 +101,14 @@ static v8::Handle<v8::Value> createTransaction(const v8::Arguments& args, bool r if (!frame) return v8::Undefined(); - RefPtr<V8CustomSQLTransactionCallback> callback = V8CustomSQLTransactionCallback::create(args[0], frame); + RefPtr<V8SQLTransactionCallback> callback = V8SQLTransactionCallback::create(args[0], frame); - RefPtr<V8CustomSQLTransactionErrorCallback> errorCallback; + RefPtr<V8SQLTransactionErrorCallback> errorCallback; if (args.Length() > 1 && !isUndefinedOrNull(args[1])) { if (!args[1]->IsObject()) return throwError("Transaction error callback must be of valid type."); - errorCallback = V8CustomSQLTransactionErrorCallback::create(args[1], frame); + errorCallback = V8SQLTransactionErrorCallback::create(args[1], frame); } RefPtr<V8CustomVoidCallback> successCallback; diff --git a/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp index 0a9e8dd..786a96a 100644 --- a/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp +++ b/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp @@ -81,16 +81,4 @@ v8::Handle<v8::Value> V8HTMLFormElement::namedPropertyGetter(v8::Local<v8::Strin return toV8(collection); } -v8::Handle<v8::Value> V8HTMLFormElement::submitCallback(const v8::Arguments& args) -{ - INC_STATS("DOM.HTMLFormElement.submit()"); - HTMLFormElement* form = V8HTMLFormElement::toNative(args.Holder()); - Frame* frame = V8Proxy::retrieveFrameForEnteredContext(); - if (!frame) - return v8::Undefined(); - - form->submit(frame); - return v8::Undefined(); -} - } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp index 4c091c8..c7cd54c 100644 --- a/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp +++ b/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp @@ -161,12 +161,6 @@ v8::Handle<v8::Value> V8InjectedScriptHost::currentCallFrameCallback(const v8::A INC_STATS("InjectedScriptHost.currentCallFrame()"); return toV8(ScriptDebugServer::shared().currentCallFrame()); } - -v8::Handle<v8::Value> V8InjectedScriptHost::isActivationCallback(const v8::Arguments& args) -{ - INC_STATS("InjectedScriptHost.isActivation()"); - return v8::Boolean::New(true); -} #endif #if ENABLE(DATABASE) diff --git a/WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp b/WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp deleted file mode 100644 index 728b3dc..0000000 --- a/WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2007-2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "V8NodeIterator.h" - -#include "NodeIterator.h" -#include "ScriptState.h" - -#include "V8Binding.h" -#include "V8Node.h" -#include "V8Proxy.h" - -#include <wtf/PassRefPtr.h> -#include <wtf/RefPtr.h> - -namespace WebCore { - -static inline v8::Handle<v8::Value> toV8(PassRefPtr<Node> object, ExceptionCode ec, ScriptState* state) -{ - if (ec) - return throwError(ec); - - if (state->hadException()) - return throwError(state->exception()); - - if (!object) - return v8::Null(); - - return toV8(object); -} - -v8::Handle<v8::Value> V8NodeIterator::nextNodeCallback(const v8::Arguments& args) -{ - INC_STATS("DOM.NodeIterator.nextNode()"); - NodeIterator* nodeIterator = V8NodeIterator::toNative(args.Holder()); - - ExceptionCode ec = 0; - EmptyScriptState state; - RefPtr<Node> result = nodeIterator->nextNode(&state, ec); - return toV8(result.release(), ec, &state); -} - -v8::Handle<v8::Value> V8NodeIterator::previousNodeCallback(const v8::Arguments& args) -{ - INC_STATS("DOM.NodeIterator.previousNode()"); - NodeIterator* nodeIterator = V8NodeIterator::toNative(args.Holder()); - - ExceptionCode ec = 0; - EmptyScriptState state; - RefPtr<Node> result = nodeIterator->previousNode(&state, ec); - return toV8(result.release(), ec, &state); -} - -} // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp b/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp index cdb160d..51a57c0 100644 --- a/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp +++ b/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp @@ -39,25 +39,6 @@ namespace WebCore { -v8::Handle<v8::Value> V8PopStateEvent::initPopStateEventCallback(const v8::Arguments& args) -{ - INC_STATS("DOM.PopStateEvent.initPopStateEvent"); - - String typeArg = v8ValueToWebCoreString(args[0]); - bool canBubbleArg = args[1]->BooleanValue(); - bool cancelableArg = args[2]->BooleanValue(); - - bool didThrow = false; - RefPtr<SerializedScriptValue> stateArg = SerializedScriptValue::create(args[3], didThrow); - if (didThrow) - return v8::Undefined(); - - PopStateEvent* event = V8PopStateEvent::toNative(args.Holder()); - event->initPopStateEvent(typeArg, canBubbleArg, cancelableArg, stateArg.release()); - - return v8::Undefined(); -} - v8::Handle<v8::Value> V8PopStateEvent::stateAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.PopStateEvent.state"); diff --git a/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp b/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp index b7e7ff2..4e68b30 100644 --- a/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp +++ b/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp @@ -37,8 +37,8 @@ #include "Database.h" #include "SQLValue.h" #include "V8Binding.h" -#include "V8CustomSQLStatementCallback.h" -#include "V8CustomSQLStatementErrorCallback.h" +#include "V8SQLStatementCallback.h" +#include "V8SQLStatementErrorCallback.h" #include "V8Proxy.h" #include <wtf/Vector.h> @@ -105,7 +105,7 @@ v8::Handle<v8::Value> V8SQLTransaction::executeSqlCallback(const v8::Arguments& return throwError("Statement callback must be of valid type.", V8Proxy::TypeError); if (frame) - callback = V8CustomSQLStatementCallback::create(args[2], frame); + callback = V8SQLStatementCallback::create(args[2], frame); } RefPtr<SQLStatementErrorCallback> errorCallback; @@ -114,7 +114,7 @@ v8::Handle<v8::Value> V8SQLTransaction::executeSqlCallback(const v8::Arguments& return throwError("Statement error callback must be of valid type.", V8Proxy::TypeError); if (frame) - errorCallback = V8CustomSQLStatementErrorCallback::create(args[3], frame); + errorCallback = V8SQLStatementErrorCallback::create(args[3], frame); } ExceptionCode ec = 0; @@ -127,4 +127,3 @@ v8::Handle<v8::Value> V8SQLTransaction::executeSqlCallback(const v8::Arguments& } // namespace WebCore #endif - diff --git a/WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp b/WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp deleted file mode 100644 index 37087df..0000000 --- a/WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (C) 2007-2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "V8TreeWalker.h" - -#include "Node.h" -#include "ScriptState.h" -#include "TreeWalker.h" - -#include "V8Binding.h" -#include "V8Node.h" -#include "V8Proxy.h" - -#include <wtf/PassRefPtr.h> -#include <wtf/RefPtr.h> - -namespace WebCore { - -static inline v8::Handle<v8::Value> toV8Object(PassRefPtr<Node> object, ScriptState* state) -{ - if (state->hadException()) - return throwError(state->exception()); - - if (!object) - return v8::Null(); - - return toV8(object); -} - -v8::Handle<v8::Value> V8TreeWalker::parentNodeCallback(const v8::Arguments& args) -{ - INC_STATS("DOM.TreeWalker.parentNode()"); - TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder()); - - EmptyScriptState state; - RefPtr<Node> result = treeWalker->parentNode(&state); - return toV8Object(result.release(), &state); -} - -v8::Handle<v8::Value> V8TreeWalker::firstChildCallback(const v8::Arguments& args) -{ - INC_STATS("DOM.TreeWalker.firstChild()"); - TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder()); - - EmptyScriptState state; - RefPtr<Node> result = treeWalker->firstChild(&state); - return toV8Object(result.release(), &state); -} - -v8::Handle<v8::Value> V8TreeWalker::lastChildCallback(const v8::Arguments& args) -{ - INC_STATS("DOM.TreeWalker.lastChild()"); - TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder()); - - EmptyScriptState state; - RefPtr<Node> result = treeWalker->lastChild(&state); - return toV8Object(result.release(), &state); -} - -v8::Handle<v8::Value> V8TreeWalker::nextNodeCallback(const v8::Arguments& args) -{ - INC_STATS("DOM.TreeWalker.nextNode()"); - TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder()); - - EmptyScriptState state; - RefPtr<Node> result = treeWalker->nextNode(&state); - return toV8Object(result.release(), &state); -} - -v8::Handle<v8::Value> V8TreeWalker::previousNodeCallback(const v8::Arguments& args) -{ - INC_STATS("DOM.TreeWalker.previousNode()"); - TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder()); - - EmptyScriptState state; - RefPtr<Node> result = treeWalker->previousNode(&state); - return toV8Object(result.release(), &state); -} - -v8::Handle<v8::Value> V8TreeWalker::nextSiblingCallback(const v8::Arguments& args) -{ - INC_STATS("DOM.TreeWalker.nextSibling()"); - TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder()); - - EmptyScriptState state; - RefPtr<Node> result = treeWalker->nextSibling(&state); - return toV8Object(result.release(), &state); -} - -v8::Handle<v8::Value> V8TreeWalker::previousSiblingCallback(const v8::Arguments& args) -{ - INC_STATS("DOM.TreeWalker.previousSibling()"); - TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder()); - - EmptyScriptState state; - RefPtr<Node> result = treeWalker->previousSibling(&state); - return toV8Object(result.release(), &state); -} - -} // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp index 1b8936d..75eff67 100644 --- a/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp +++ b/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp @@ -105,80 +105,6 @@ static int* jsArrayToIntArray(v8::Handle<v8::Array> array, uint32_t len) return data; } -v8::Handle<v8::Value> V8WebGLRenderingContext::bufferDataCallback(const v8::Arguments& args) -{ - INC_STATS("DOM.WebGLRenderingContext.bufferData()"); - - // Forms: - // * bufferData(GLenum target, WebGLArray data, GLenum usage); - // - Sets the buffer's data from the given WebGLArray - // * bufferData(GLenum target, GLsizeiptr size, GLenum usage); - // - Sets the size of the buffer to the given size in bytes - if (args.Length() != 3) { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - - WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder()); - bool ok; - int target = toInt32(args[0], ok); - if (!ok) { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - int usage = toInt32(args[2], ok); - if (!ok) { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - if (args[1]->IsInt32()) { - int size = toInt32(args[1]); - ExceptionCode exceptionCode; - context->bufferData(target, size, usage, exceptionCode); - } else if (V8WebGLArray::HasInstance(args[1])) { - WebGLArray* array = V8WebGLArray::toNative(args[1]->ToObject()); - ExceptionCode exceptionCode; - context->bufferData(target, array, usage, exceptionCode); - } else { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - return v8::Undefined(); -} - -v8::Handle<v8::Value> V8WebGLRenderingContext::bufferSubDataCallback(const v8::Arguments& args) -{ - INC_STATS("DOM.WebGLRenderingContext.bufferSubData()"); - - // Forms: - // * bufferSubData(GLenum target, GLintptr offset, WebGLArray data); - if (args.Length() != 3) { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - - WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder()); - bool ok; - int target = toInt32(args[0], ok); - if (!ok) { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - int offset = toInt32(args[1], ok); - if (!ok) { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - if (!V8WebGLArray::HasInstance(args[2])) { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - WebGLArray* array = V8WebGLArray::toNative(args[2]->ToObject()); - ExceptionCode exceptionCode; - context->bufferSubData(target, offset, array, exceptionCode); - return v8::Undefined(); -} - static v8::Handle<v8::Value> toV8Object(const WebGLGetInfo& info) { switch (info.getType()) { @@ -443,290 +369,6 @@ v8::Handle<v8::Value> V8WebGLRenderingContext::getVertexAttribCallback(const v8: return getObjectParameter(args, kVertexAttrib); } -v8::Handle<v8::Value> V8WebGLRenderingContext::texImage2DCallback(const v8::Arguments& args) -{ - INC_STATS("DOM.WebGLRenderingContext.texImage2D()"); - - // Currently supported forms: - // * void texImage2D(in GLenum target, in GLint level, - // in GLint internalformat, - // in GLsizei width, in GLsizei height, in GLint border, - // in GLenum format, in GLenum type, in WebGLArray pixels); - // * void texImage2D(in GLenum target, in GLint level, in ImageData pixels, - // [Optional] in GLboolean flipY, [Optional] in GLboolean premulitplyAlpha); - // * void texImage2D(in GLenum target, in GLint level, in HTMLImageElement image, - // [Optional] in GLboolean flipY, [Optional] in GLboolean premultiplyAlpha); - // * void texImage2D(in GLenum target, in GLint level, in HTMLCanvasElement image, - // [Optional] in GLboolean flipY, [Optional] in GLboolean premultiplyAlpha); - // * void texImage2D(in GLenum target, in GLint level, in HTMLVideoElement image, - // [Optional] in GLboolean flipY, [Optional] in GLboolean premultiplyAlpha); - if (args.Length() != 3 && - args.Length() != 4 && - args.Length() != 5 && - args.Length() != 9) { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - - WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder()); - bool ok; - int target = toInt32(args[0], ok); - if (!ok) { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - int level = toInt32(args[1], ok); - if (!ok) { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - - ExceptionCode ec = 0; - if (args.Length() == 3 || - args.Length() == 4 || - args.Length() == 5) { - bool flipY = false; - bool premultiplyAlpha = false; - if (args.Length() >= 4) - flipY = args[3]->BooleanValue(); - if (args.Length() >= 5) - premultiplyAlpha = args[4]->BooleanValue(); - - v8::Handle<v8::Value> arg = args[2]; - if (V8HTMLImageElement::HasInstance(arg)) { - HTMLImageElement* element = V8HTMLImageElement::toNative(v8::Handle<v8::Object>::Cast(arg)); - context->texImage2D(target, level, element, flipY, premultiplyAlpha, ec); - } else if (V8HTMLCanvasElement::HasInstance(arg)) { - HTMLCanvasElement* element = V8HTMLCanvasElement::toNative(v8::Handle<v8::Object>::Cast(arg)); - context->texImage2D(target, level, element, flipY, premultiplyAlpha, ec); - } else if(V8ImageData::HasInstance(arg)) { - ImageData* imageElement = V8ImageData::toNative(v8::Handle<v8::Object>::Cast(arg)); - context->texImage2D(target, level, imageElement, flipY, premultiplyAlpha, ec); - } else if (V8HTMLVideoElement::HasInstance(arg)) { - HTMLVideoElement* element = V8HTMLVideoElement::toNative(v8::Handle<v8::Object>::Cast(arg)); - context->texImage2D(target, level, element, flipY, premultiplyAlpha, ec); - } - else { - // FIXME: consider different / better exception type. - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - // Fall through - } else if (args.Length() == 9) { - int internalformat = toInt32(args[2], ok); - if (!ok) { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - int width = toInt32(args[3], ok); - if (!ok) { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - int height = toInt32(args[4], ok); - if (!ok) { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - int border = toInt32(args[5], ok); - if (!ok) { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - int format = toInt32(args[6], ok); - if (!ok) { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - int type = toInt32(args[7], ok); - if (!ok) { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - v8::Handle<v8::Value> arg = args[8]; - if (!arg->IsObject()) - // Assume that the user is passing null for texture - context->texImage2D(target, - level, - internalformat, - width, - height, - border, - format, - type, - 0, - ec); - else if (V8WebGLArray::HasInstance(arg)) { - WebGLArray* array = V8WebGLArray::toNative(arg->ToObject()); - context->texImage2D(target, - level, - internalformat, - width, - height, - border, - format, - type, - array, - ec); - // Fall through - } else { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - } else { - ASSERT_NOT_REACHED(); - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - if (ec) { - V8Proxy::setDOMException(ec); - return v8::Handle<v8::Value>(); - } - return v8::Undefined(); -} - -v8::Handle<v8::Value> V8WebGLRenderingContext::texSubImage2DCallback(const v8::Arguments& args) -{ - INC_STATS("DOM.WebGLRenderingContext.texSubImage2D()"); - - // Currently supported forms: - // * void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, - // in GLsizei width, in GLsizei height, - // in GLenum format, in GLenum type, in WebGLArray pixels); - // * void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, - // in ImageData pixels, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha); - // * void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, - // in HTMLImageElement image, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha); - // * void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, - // in HTMLCanvasElement canvas, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha); - // * void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, - // in HTMLVideoElement video, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha); - - if (args.Length() != 5 && - args.Length() != 6 && - args.Length() != 7 && - args.Length() != 9) { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - - WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder()); - bool ok; - int target = toInt32(args[0], ok); - if (!ok) { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - int level = toInt32(args[1], ok); - if (!ok) { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - int xoff = toInt32(args[2], ok); - if (!ok) { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - int yoff = toInt32(args[3], ok); - if (!ok) { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - - ExceptionCode ec = 0; - if (args.Length() == 5 || - args.Length() == 6 || - args.Length() == 7) { - bool flipY = false; - bool premultiplyAlpha = false; - if (args.Length() >= 6) - flipY = args[5]->BooleanValue(); - if (args.Length() >= 7) - premultiplyAlpha = args[6]->BooleanValue(); - - v8::Handle<v8::Value> arg = args[4]; - if (V8HTMLImageElement::HasInstance(arg)) { - HTMLImageElement* element = V8HTMLImageElement::toNative(v8::Handle<v8::Object>::Cast(arg)); - context->texSubImage2D(target, level, xoff, yoff, element, flipY, premultiplyAlpha, ec); - } else if (V8HTMLCanvasElement::HasInstance(arg)) { - HTMLCanvasElement* element = V8HTMLCanvasElement::toNative(v8::Handle<v8::Object>::Cast(arg)); - context->texSubImage2D(target, level, xoff, yoff, element, flipY, premultiplyAlpha, ec); - } else if(V8ImageData::HasInstance(arg)) { - ImageData* imageElement = V8ImageData::toNative(v8::Handle<v8::Object>::Cast(arg)); - context->texSubImage2D(target, level, xoff, yoff, imageElement, flipY, premultiplyAlpha, ec); - } else if (V8HTMLVideoElement::HasInstance(arg)) { - HTMLVideoElement* element = V8HTMLVideoElement::toNative(v8::Handle<v8::Object>::Cast(arg)); - context->texSubImage2D(target, level, xoff, yoff, element, flipY, premultiplyAlpha, ec); - } - else { - // FIXME: consider different / better exception type. - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - // Fall through - } else if (args.Length() == 9) { - int width = toInt32(args[4], ok); - if (!ok) { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - int height = toInt32(args[5], ok); - if (!ok) { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - int format = toInt32(args[6], ok); - if (!ok) { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - int type = toInt32(args[7], ok); - if (!ok) { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - v8::Handle<v8::Value> arg = args[8]; - if (!arg->IsObject()) - // Assume that the user is passing null for texture - context->texSubImage2D(target, - level, - xoff, - yoff, - width, - height, - format, - type, - 0, - ec); - else if (V8WebGLArray::HasInstance(arg)) { - WebGLArray* array = V8WebGLArray::toNative(arg->ToObject()); - context->texSubImage2D(target, - level, - xoff, - yoff, - width, - height, - format, - type, - array, - ec); - // Fall through - } else { - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - } else { - ASSERT_NOT_REACHED(); - V8Proxy::setDOMException(SYNTAX_ERR); - return notHandledByInterceptor(); - } - if (ec) { - V8Proxy::setDOMException(ec); - return v8::Handle<v8::Value>(); - } - return v8::Undefined(); -} - enum FunctionToCall { kUniform1v, kUniform2v, kUniform3v, kUniform4v, kVertexAttrib1v, kVertexAttrib2v, kVertexAttrib3v, kVertexAttrib4v diff --git a/WebCore/bindings/v8/test/run_tests.py b/WebCore/bindings/v8/test/run_tests.py deleted file mode 100644 index e27d559..0000000 --- a/WebCore/bindings/v8/test/run_tests.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/python -# -# Copyright (C) 2010 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY -# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (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 script generates h and cpp file for TestObj.idl using the V8 code -# generator. Please execute the script whenever changes are made to -# CodeGeneratorV8.pm, and submit the changes in V8TestObj.h/cpp in the same -# patch. This makes it easier to track and review changes in generated code. -# To execute, invoke: 'python run_tests.py' - -import os -import sys - - -def test(idlFilePath): - cmd = ['perl', '-w', - '-I../../scripts', - '../../scripts/generate-bindings.pl', - # idl include directories (path relative to generate-bindings.pl) - '--include .', - # place holder for defines (generate-bindings.pl requires it) - '--defines xxx', - '--generator V8', - '--outputDir .', - idlFilePath] - os.system(' '.join(cmd)) - - -def main(argv): - scriptDir = os.path.dirname(__file__) - os.chdir(scriptDir) - test('TestObj.idl') - - -if __name__ == '__main__': - sys.exit(main(sys.argv)) diff --git a/WebCore/bridge/jni/JNIBridge.cpp b/WebCore/bridge/jni/JNIBridge.cpp index 28e8698..35a0d34 100644 --- a/WebCore/bridge/jni/JNIBridge.cpp +++ b/WebCore/bridge/jni/JNIBridge.cpp @@ -27,7 +27,7 @@ #include "config.h" #include "JNIBridge.h" -#if ENABLE(MAC_JAVA_BRIDGE) +#if ENABLE(JAVA_BRIDGE) #include "StringBuilder.h" #include <wtf/text/CString.h> @@ -178,4 +178,4 @@ jmethodID JavaMethod::methodID(jobject obj) const return m_methodID; } -#endif // ENABLE(MAC_JAVA_BRIDGE) +#endif // ENABLE(JAVA_BRIDGE) diff --git a/WebCore/bridge/jni/JNIBridge.h b/WebCore/bridge/jni/JNIBridge.h index 5d482a7..78202ae 100644 --- a/WebCore/bridge/jni/JNIBridge.h +++ b/WebCore/bridge/jni/JNIBridge.h @@ -27,7 +27,7 @@ #ifndef JNIBridge_h #define JNIBridge_h -#if ENABLE(MAC_JAVA_BRIDGE) +#if ENABLE(JAVA_BRIDGE) #include "Bridge.h" #include "JNIUtility.h" @@ -118,6 +118,6 @@ private: } // namespace JSC -#endif // ENABLE(MAC_JAVA_BRIDGE) +#endif // ENABLE(JAVA_BRIDGE) #endif // JNIBridge_h diff --git a/WebCore/bridge/jni/JNIUtility.cpp b/WebCore/bridge/jni/JNIUtility.cpp index ece39ed..4b4f393 100644 --- a/WebCore/bridge/jni/JNIUtility.cpp +++ b/WebCore/bridge/jni/JNIUtility.cpp @@ -26,7 +26,7 @@ #include "config.h" #include "JNIUtility.h" -#if ENABLE(MAC_JAVA_BRIDGE) +#if ENABLE(JAVA_BRIDGE) #include <dlfcn.h> @@ -340,4 +340,4 @@ jvalue getJNIField(jobject obj, JNIType type, const char* name, const char* sign } // namespace JSC -#endif // ENABLE(MAC_JAVA_BRIDGE) +#endif // ENABLE(JAVA_BRIDGE) diff --git a/WebCore/bridge/jni/JNIUtility.h b/WebCore/bridge/jni/JNIUtility.h index 0eb889c..5fb2138 100644 --- a/WebCore/bridge/jni/JNIUtility.h +++ b/WebCore/bridge/jni/JNIUtility.h @@ -26,7 +26,7 @@ #ifndef JNIUtility_h #define JNIUtility_h -#if ENABLE(MAC_JAVA_BRIDGE) +#if ENABLE(JAVA_BRIDGE) #include <JavaVM/jni.h> @@ -270,6 +270,6 @@ T callJNIStaticMethod(jclass cls, const char* methodName, const char* methodSign } // namespace JSC -#endif // ENABLE(MAC_JAVA_BRIDGE) +#endif // ENABLE(JAVA_BRIDGE) #endif // JNIUtility_h diff --git a/WebCore/bridge/jni/jni_jsobject.h b/WebCore/bridge/jni/jni_jsobject.h index d78eb97..3c87043 100644 --- a/WebCore/bridge/jni/jni_jsobject.h +++ b/WebCore/bridge/jni/jni_jsobject.h @@ -26,7 +26,7 @@ #ifndef JAVASCRIPTCORE_BINDINGS_JNI_JSOBJECT_H #define JAVASCRIPTCORE_BINDINGS_JNI_JSOBJECT_H -#if ENABLE(MAC_JAVA_BRIDGE) +#if ENABLE(JAVA_BRIDGE) #include <JavaVM/jni.h> #include <runtime/JSValue.h> @@ -128,6 +128,10 @@ jstring KJS_JSObject_JSObjectToString(JNIEnv*, jclass, jlong nativeJSObject); #endif // PLATFORM(MAC) +<<<<<<< HEAD:WebCore/bridge/jni/jni_jsobject.h #endif // ENABLE(MAC_JAVA_BRIDGE) +======= +#endif // ENABLE(JAVA_BRIDGE) +>>>>>>> webkit.org at r58956:WebCore/bridge/jni/jni_jsobject.h #endif // JAVASCRIPTCORE_BINDINGS_JNI_JSOBJECT_H diff --git a/WebCore/bridge/jni/jni_jsobject.mm b/WebCore/bridge/jni/jni_jsobject.mm index 5e036ab..3fb794b 100644 --- a/WebCore/bridge/jni/jni_jsobject.mm +++ b/WebCore/bridge/jni/jni_jsobject.mm @@ -26,7 +26,7 @@ #include "config.h" #include "jni_jsobject.h" -#if ENABLE(MAC_JAVA_BRIDGE) +#if ENABLE(JAVA_BRIDGE) #include "Frame.h" #include "JavaRuntimeObject.h" @@ -702,4 +702,4 @@ jstring KJS_JSObject_JSObjectToString (JNIEnv*, jclass, jlong nativeHandle) } -#endif // ENABLE(MAC_JAVA_BRIDGE) +#endif // ENABLE(JAVA_BRIDGE) diff --git a/WebCore/bridge/jni/jni_objc.mm b/WebCore/bridge/jni/jni_objc.mm index e2e71c5..8fa2c3f 100644 --- a/WebCore/bridge/jni/jni_objc.mm +++ b/WebCore/bridge/jni/jni_objc.mm @@ -25,7 +25,7 @@ #include "config.h" -#if ENABLE(MAC_JAVA_BRIDGE) +#if ENABLE(JAVA_BRIDGE) #import <Foundation/Foundation.h> #import "JNIUtility.h" @@ -81,4 +81,4 @@ bool JSC::Bindings::dispatchJNICall(ExecState* exec, const void* targetAppletVie return false; } -#endif // ENABLE(MAC_JAVA_BRIDGE) +#endif // ENABLE(JAVA_BRIDGE) diff --git a/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp b/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp index 6de1011..24e2b91 100644 --- a/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp +++ b/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp @@ -27,7 +27,7 @@ #include "config.h" #include "JNIBridgeJSC.h" -#if ENABLE(MAC_JAVA_BRIDGE) +#if ENABLE(JAVA_BRIDGE) #include "JNIUtilityPrivate.h" #include "Logging.h" @@ -442,4 +442,4 @@ unsigned int JavaArray::getLength() const return m_length; } -#endif // ENABLE(MAC_JAVA_BRIDGE) +#endif // ENABLE(JAVA_BRIDGE) diff --git a/WebCore/bridge/jni/jsc/JNIBridgeJSC.h b/WebCore/bridge/jni/jsc/JNIBridgeJSC.h index 902bd4e..dd65417 100644 --- a/WebCore/bridge/jni/jsc/JNIBridgeJSC.h +++ b/WebCore/bridge/jni/jsc/JNIBridgeJSC.h @@ -27,7 +27,7 @@ #ifndef JNIBridgeJSC_h #define JNIBridgeJSC_h -#if ENABLE(MAC_JAVA_BRIDGE) +#if ENABLE(JAVA_BRIDGE) #include "Bridge.h" #include "JNIBridge.h" @@ -84,6 +84,6 @@ private: } // namespace JSC -#endif // ENABLE(MAC_JAVA_BRIDGE) +#endif // ENABLE(JAVA_BRIDGE) #endif // JNIBridge_h diff --git a/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp b/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp index b48a757..2048d8e 100644 --- a/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp +++ b/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp @@ -27,7 +27,7 @@ #include "config.h" #include "JNIUtilityPrivate.h" -#if ENABLE(MAC_JAVA_BRIDGE) +#if ENABLE(JAVA_BRIDGE) #include "JavaRuntimeObject.h" #include "JNIBridgeJSC.h" @@ -314,4 +314,4 @@ jvalue convertValueToJValue(ExecState* exec, RootObject* rootObject, JSValue val } // end of namespace JSC -#endif // ENABLE(MAC_JAVA_BRIDGE) +#endif // ENABLE(JAVA_BRIDGE) diff --git a/WebCore/bridge/jni/jsc/JNIUtilityPrivate.h b/WebCore/bridge/jni/jsc/JNIUtilityPrivate.h index 8d4652d..1266acd 100644 --- a/WebCore/bridge/jni/jsc/JNIUtilityPrivate.h +++ b/WebCore/bridge/jni/jsc/JNIUtilityPrivate.h @@ -27,7 +27,7 @@ #ifndef JNIUtilityPrivate_h #define JNIUtilityPrivate_h -#if ENABLE(MAC_JAVA_BRIDGE) +#if ENABLE(JAVA_BRIDGE) #include "JNIUtility.h" #include <runtime/JSValue.h> @@ -48,6 +48,6 @@ bool dispatchJNICall(ExecState*, const void* targetAppletView, jobject obj, bool } // namespace JSC -#endif // ENABLE(MAC_JAVA_BRIDGE) +#endif // ENABLE(JAVA_BRIDGE) #endif // JNIUtilityPrivate_h diff --git a/WebCore/bridge/jni/jsc/JavaClassJSC.cpp b/WebCore/bridge/jni/jsc/JavaClassJSC.cpp index e1b8b4c..780c4fc 100644 --- a/WebCore/bridge/jni/jsc/JavaClassJSC.cpp +++ b/WebCore/bridge/jni/jsc/JavaClassJSC.cpp @@ -26,7 +26,7 @@ #include "config.h" #include "JavaClassJSC.h" -#if ENABLE(MAC_JAVA_BRIDGE) +#if ENABLE(JAVA_BRIDGE) #include "JNIUtility.h" #include "JSDOMWindow.h" @@ -147,4 +147,4 @@ bool JavaClass::isStringClass() const return !strcmp(m_name, "java.lang.String"); } -#endif // ENABLE(MAC_JAVA_BRIDGE) +#endif // ENABLE(JAVA_BRIDGE) diff --git a/WebCore/bridge/jni/jsc/JavaClassJSC.h b/WebCore/bridge/jni/jsc/JavaClassJSC.h index 09b93e9..0527162 100644 --- a/WebCore/bridge/jni/jsc/JavaClassJSC.h +++ b/WebCore/bridge/jni/jsc/JavaClassJSC.h @@ -26,7 +26,7 @@ #ifndef JavaClassJSC_h #define JavaClassJSC_h -#if ENABLE(MAC_JAVA_BRIDGE) +#if ENABLE(JAVA_BRIDGE) #include "JNIBridgeJSC.h" #include <wtf/HashMap.h> @@ -57,6 +57,6 @@ private: } // namespace JSC -#endif // ENABLE(MAC_JAVA_BRIDGE) +#endif // ENABLE(JAVA_BRIDGE) #endif // JavaClassJSC_h diff --git a/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp b/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp index d8de40a..008d1ab 100644 --- a/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp +++ b/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp @@ -26,7 +26,7 @@ #include "config.h" #include "JavaInstanceJSC.h" -#if ENABLE(MAC_JAVA_BRIDGE) +#if ENABLE(JAVA_BRIDGE) #include "JavaRuntimeObject.h" #include "JNIBridgeJSC.h" @@ -392,4 +392,4 @@ JObjectWrapper::~JObjectWrapper() m_env->DeleteGlobalRef(m_instance); } -#endif // ENABLE(MAC_JAVA_BRIDGE) +#endif // ENABLE(JAVA_BRIDGE) diff --git a/WebCore/bridge/jni/jsc/JavaInstanceJSC.h b/WebCore/bridge/jni/jsc/JavaInstanceJSC.h index d395cc8..53b6132 100644 --- a/WebCore/bridge/jni/jsc/JavaInstanceJSC.h +++ b/WebCore/bridge/jni/jsc/JavaInstanceJSC.h @@ -26,7 +26,7 @@ #ifndef JavaInstanceJSC_h #define JavaInstanceJSC_h -#if ENABLE(MAC_JAVA_BRIDGE) +#if ENABLE(JAVA_BRIDGE) #include "Bridge.h" #include "runtime_root.h" @@ -107,6 +107,6 @@ protected: } // namespace JSC -#endif // ENABLE(MAC_JAVA_BRIDGE) +#endif // ENABLE(JAVA_BRIDGE) #endif // JavaInstanceJSC_h diff --git a/WebCore/bridge/npapi.h b/WebCore/bridge/npapi.h index f82d25e..38e0905 100644 --- a/WebCore/bridge/npapi.h +++ b/WebCore/bridge/npapi.h @@ -43,6 +43,8 @@ #ifndef _NPAPI_H_ #define _NPAPI_H_ +#include "nptypes.h" + #ifdef INCLUDE_JAVA #include "jri.h" /* Java Runtime Interface */ #else @@ -127,42 +129,6 @@ /* Definition of Basic Types */ /*----------------------------------------------------------------------*/ -/* QNX sets the _INT16 and friends defines, but does not typedef the types */ -#ifdef __QNXNTO__ -#undef _UINT16 -#undef _INT16 -#undef _UINT32 -#undef _INT32 -#endif - -#ifndef _UINT16 -#define _UINT16 -typedef unsigned short uint16; -#endif - -#ifndef _UINT32 -#define _UINT32 -#ifdef __LP64__ -typedef unsigned int uint32; -#else /* __LP64__ */ -typedef unsigned long uint32; -#endif /* __LP64__ */ -#endif - -#ifndef _INT16 -#define _INT16 -typedef short int16; -#endif - -#ifndef _INT32 -#define _INT32 -#ifdef __LP64__ -typedef int int32; -#else /* __LP64__ */ -typedef long int32; -#endif /* __LP64__ */ -#endif - #ifndef FALSE #define FALSE (0) #endif @@ -174,8 +140,8 @@ typedef long int32; #endif typedef unsigned char NPBool; -typedef int16 NPError; -typedef int16 NPReason; +typedef int16_t NPError; +typedef int16_t NPReason; typedef char* NPMIMEType; @@ -207,8 +173,8 @@ typedef struct _NPStream void* pdata; /* plug-in private data */ void* ndata; /* netscape private data */ const char* url; - uint32 end; - uint32 lastmodified; + uint32_t end; + uint32_t lastmodified; void* notifyData; const char* headers; /* Response headers from host. * Exists only for >= NPVERS_HAS_RESPONSE_HEADERS. @@ -225,25 +191,25 @@ typedef struct _NPStream typedef struct _NPByteRange { - int32 offset; /* negative offset means from the end */ - uint32 length; + int32_t offset; /* negative offset means from the end */ + uint32_t length; struct _NPByteRange* next; } NPByteRange; typedef struct _NPSavedData { - int32 len; + int32_t len; void* buf; } NPSavedData; typedef struct _NPRect { - uint16 top; - uint16 left; - uint16 bottom; - uint16 right; + uint16_t top; + uint16_t left; + uint16_t bottom; + uint16_t right; } NPRect; @@ -264,12 +230,12 @@ enum { typedef struct { - int32 type; + int32_t type; } NPAnyCallbackStruct; typedef struct { - int32 type; + int32_t type; Display* display; Visual* visual; Colormap colormap; @@ -278,7 +244,7 @@ typedef struct typedef struct { - int32 type; + int32_t type; FILE* fp; } NPPrintCallbackStruct; @@ -498,25 +464,25 @@ typedef struct _NPNSMenu NPNSMenu; typedef struct _NPCocoaEvent { NPCocoaEventType type; - uint32 version; + uint32_t version; union { struct { - uint32 modifierFlags; + uint32_t modifierFlags; double pluginX; double pluginY; - int32 buttonNumber; - int32 clickCount; + int32_t buttonNumber; + int32_t clickCount; double deltaX; double deltaY; double deltaZ; } mouse; struct { - uint32 modifierFlags; + uint32_t modifierFlags; NPNSString *characters; NPNSString *charactersIgnoringModifiers; NPBool isARepeat; - uint16 keyCode; + uint16_t keyCode; } key; struct { CGContextRef context; @@ -540,10 +506,10 @@ typedef struct _NPCocoaEvent { typedef struct _NPWindow { void* window; /* Platform specific window handle */ - int32 x; /* Position of top left corner relative */ - int32 y; /* to a netscape page. */ - uint32 width; /* Maximum window size */ - uint32 height; + int32_t x; /* Position of top left corner relative */ + int32_t y; /* to a netscape page. */ + uint32_t width; /* Maximum window size */ + uint32_t height; NPRect clipRect; /* Clipping rectangle in port coordinates */ /* Used by MAC only. */ #if defined(XP_UNIX) || defined(XP_SYMBIAN) @@ -570,7 +536,7 @@ typedef struct _NPEmbedPrint typedef struct _NPPrint { - uint16 mode; /* NP_FULL or NP_EMBED */ + uint16_t mode; /* NP_FULL or NP_EMBED */ union { NPFullPrint fullPrint; /* if mode is NP_FULL */ @@ -603,9 +569,9 @@ typedef QEvent NPEvent; #elif defined(XP_WIN) typedef struct _NPEvent { - uint16 event; - uint32 wParam; - uint32 lParam; + uint16_t event; + uintptr_t wParam; + uintptr_t lParam; } NPEvent; #elif defined (XP_UNIX) typedef XEvent NPEvent; @@ -691,8 +657,8 @@ typedef struct NP_GLContext typedef struct NP_Port { CGrafPtr port; /* Grafport */ - int32 portx; /* position inside the topmost window */ - int32 porty; + int32_t portx; /* position inside the topmost window */ + int32_t porty; } NP_Port; #endif /* NP_NO_QUICKDRAW */ @@ -815,22 +781,22 @@ char* NPP_GetMIMEDescription(void); NPError NPP_Initialize(void); void NPP_Shutdown(void); NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance, - uint16 mode, int16 argc, char* argn[], + uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved); NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save); NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window); NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, - uint16* stype); + uint16_t* stype); NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason); -int32 NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream); -int32 NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32 offset, - int32 len, void* buffer); +int32_t NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream); +int32_t NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32_t offset, + int32_t len, void* buffer); void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname); void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint); -int16 NPP_HandleEvent(NPP instance, void* event); +int16_t NPP_HandleEvent(NPP instance, void* event); void NP_LOADDS NPP_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData); jref NP_LOADDS NPP_GetJavaClass(void); @@ -850,24 +816,24 @@ NPError NPN_GetURLNotify(NPP instance, const char* url, NPError NPN_GetURL(NPP instance, const char* url, const char* target); NPError NPN_PostURLNotify(NPP instance, const char* url, - const char* target, uint32 len, + const char* target, uint32_t len, const char* buf, NPBool file, void* notifyData); NPError NPN_PostURL(NPP instance, const char* url, - const char* target, uint32 len, + const char* target, uint32_t len, const char* buf, NPBool file); NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList); NPError NPN_NewStream(NPP instance, NPMIMEType type, const char* target, NPStream** stream); -int32 NPN_Write(NPP instance, NPStream* stream, int32 len, +int32_t NPN_Write(NPP instance, NPStream* stream, int32_t len, void* buffer); NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPReason reason); void NPN_Status(NPP instance, const char* message); const char* NPN_UserAgent(NPP instance); -void* NPN_MemAlloc(uint32 size); +void* NPN_MemAlloc(uint32_t size); void NPN_MemFree(void* ptr); -uint32 NPN_MemFlush(uint32 size); +uint32_t NPN_MemFlush(uint32_t size); void NPN_ReloadPlugins(NPBool reloadPages); JRIEnv* NPN_GetJavaEnv(void); jref NPN_GetJavaPeer(NPP instance); @@ -881,11 +847,11 @@ void NPN_ForceRedraw(NPP instance); void NPN_PushPopupsEnabledState(NPP instance, NPBool enabled); void NPN_PopPopupsEnabledState(NPP instance); void NPN_PluginThreadAsyncCall(NPP instance, void (*func) (void *), void *userData); -NPError NPN_GetValueForURL(NPP instance, NPNURLVariable variable, const char* url, char** value, uint32* len); -NPError NPN_SetValueForURL(NPP instance, NPNURLVariable variable, const char* url, const char* value, uint32 len); -NPError NPN_GetAuthenticationInfo(NPP instance, const char* protocol, const char* host, int32 port, const char* scheme, const char *realm, char** username, uint32* ulen, char** password, uint32* plen); -uint32 NPN_ScheduleTimer(NPP instance, uint32 interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32 timerID)); -void NPN_UnscheduleTimer(NPP instance, uint32 timerID); +NPError NPN_GetValueForURL(NPP instance, NPNURLVariable variable, const char* url, char** value, uint32_t* len); +NPError NPN_SetValueForURL(NPP instance, NPNURLVariable variable, const char* url, const char* value, uint32_t len); +NPError NPN_GetAuthenticationInfo(NPP instance, const char* protocol, const char* host, int32_t port, const char* scheme, const char *realm, char** username, uint32_t* ulen, char** password, uint32_t* plen); +uint32_t NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID)); +void NPN_UnscheduleTimer(NPP instance, uint32_t timerID); NPError NPN_PopUpContextMenu(NPP instance, NPMenu* menu); NPBool NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace); diff --git a/WebCore/bridge/npruntime.h b/WebCore/bridge/npruntime.h index 8a285be..d5ebcb2 100644 --- a/WebCore/bridge/npruntime.h +++ b/WebCore/bridge/npruntime.h @@ -72,7 +72,6 @@ extern "C" { #endif -#include <stdint.h> #include "npapi.h" /* diff --git a/WebCore/bridge/nptypes.h b/WebCore/bridge/nptypes.h new file mode 100644 index 0000000..11e9683 --- /dev/null +++ b/WebCore/bridge/nptypes.h @@ -0,0 +1,214 @@ +/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * mozilla.org. + * Portions created by the Initial Developer are Copyright (C) 2004 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Johnny Stenback <jst@mozilla.org> (Original author) + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* + * Header file for ensuring that C99 types ([u]int32_t and bool) are + * available. + */ + +#if defined(WIN32) || defined(OS2) + /* + * Win32 and OS/2 don't know C99, so define [u]int_16/32 here. The bool + * is predefined tho, both in C and C++. + */ + typedef short int16_t; + typedef unsigned short uint16_t; + typedef int int32_t; + typedef unsigned int uint32_t; +#elif defined(_AIX) || defined(__sun) || defined(__osf__) || defined(IRIX) || defined(HPUX) + /* + * AIX and SunOS ship a inttypes.h header that defines [u]int32_t, + * but not bool for C. + */ + #include <inttypes.h> + + #ifndef __cplusplus + typedef int bool; + #endif +#elif defined(bsdi) || defined(FREEBSD) || defined(OPENBSD) + /* + * BSD/OS, FreeBSD, and OpenBSD ship sys/types.h that define int32_t and + * u_int32_t. + */ + #include <sys/types.h> + + /* + * BSD/OS ships no header that defines uint32_t, nor bool (for C) + */ + #if defined(bsdi) + typedef u_int32_t uint32_t; + + #if !defined(__cplusplus) + typedef int bool; + #endif + #else + /* + * FreeBSD and OpenBSD define uint32_t and bool. + */ + #include <inttypes.h> + #include <stdbool.h> + #endif +#elif defined(BEOS) + #include <inttypes.h> +#else + /* + * For those that ship a standard C99 stdint.h header file, include + * it. Can't do the same for stdbool.h tho, since some systems ship + * with a stdbool.h file that doesn't compile! + */ + #include <stdint.h> + + #ifndef __cplusplus + #if !defined(__GNUC__) || (__GNUC__ > 2 || __GNUC_MINOR__ > 95) + #include <stdbool.h> + #else + /* + * GCC 2.91 can't deal with a typedef for bool, but a #define + * works. + */ + #define bool int + #endif + #endif +#endif +/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * mozilla.org. + * Portions created by the Initial Developer are Copyright (C) 2004 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Johnny Stenback <jst@mozilla.org> (Original author) + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* + * Header file for ensuring that C99 types ([u]int32_t and bool) are + * available. + */ + +#if defined(WIN32) || defined(OS2) + /* + * Win32 and OS/2 don't know C99, so define [u]int_16/32 here. The bool + * is predefined tho, both in C and C++. + */ + typedef short int16_t; + typedef unsigned short uint16_t; + typedef int int32_t; + typedef unsigned int uint32_t; +#elif defined(_AIX) || defined(__sun) || defined(__osf__) || defined(IRIX) || defined(HPUX) + /* + * AIX and SunOS ship a inttypes.h header that defines [u]int32_t, + * but not bool for C. + */ + #include <inttypes.h> + + #ifndef __cplusplus + typedef int bool; + #endif +#elif defined(bsdi) || defined(FREEBSD) || defined(OPENBSD) + /* + * BSD/OS, FreeBSD, and OpenBSD ship sys/types.h that define int32_t and + * u_int32_t. + */ + #include <sys/types.h> + + /* + * BSD/OS ships no header that defines uint32_t, nor bool (for C) + */ + #if defined(bsdi) + typedef u_int32_t uint32_t; + + #if !defined(__cplusplus) + typedef int bool; + #endif + #else + /* + * FreeBSD and OpenBSD define uint32_t and bool. + */ + #include <inttypes.h> + #include <stdbool.h> + #endif +#elif defined(BEOS) + #include <inttypes.h> +#else + /* + * For those that ship a standard C99 stdint.h header file, include + * it. Can't do the same for stdbool.h tho, since some systems ship + * with a stdbool.h file that doesn't compile! + */ + #include <stdint.h> + + #ifndef __cplusplus + #if !defined(__GNUC__) || (__GNUC__ > 2 || __GNUC_MINOR__ > 95) + #include <stdbool.h> + #else + /* + * GCC 2.91 can't deal with a typedef for bool, but a #define + * works. + */ + #define bool int + #endif + #endif +#endif diff --git a/WebCore/bridge/qt/qt_instance.cpp b/WebCore/bridge/qt/qt_instance.cpp index 4e39371..f6f368b 100644 --- a/WebCore/bridge/qt/qt_instance.cpp +++ b/WebCore/bridge/qt/qt_instance.cpp @@ -171,10 +171,11 @@ QtInstance* QtInstance::getInstance(JSObject* object) Class* QtInstance::getClass() const { - if (!m_object) - return 0; - if (!m_class) + if (!m_class) { + if (!m_object) + return 0; m_class = QtClass::classForObject(m_object); + } return m_class; } diff --git a/WebCore/bridge/qt/qt_runtime.cpp b/WebCore/bridge/qt/qt_runtime.cpp index 40ff6a1..1775815 100644 --- a/WebCore/bridge/qt/qt_runtime.cpp +++ b/WebCore/bridge/qt/qt_runtime.cpp @@ -897,7 +897,7 @@ JSValue convertQVariantToValue(ExecState* exec, PassRefPtr<RootObject> root, con QVariantMap::const_iterator i = map.constBegin(); while (i != map.constEnd()) { QString s = i.key(); - JSValue val = convertQVariantToValue(exec, root, i.value()); + JSValue val = convertQVariantToValue(exec, root.get(), i.value()); if (val) { PutPropertySlot slot; ret->put(exec, Identifier(exec, (const UChar *)s.constData(), s.length()), val, slot); diff --git a/WebCore/config.h b/WebCore/config.h index 24b0f14..c812ee8 100644 --- a/WebCore/config.h +++ b/WebCore/config.h @@ -25,7 +25,7 @@ #include <wtf/Platform.h> -#if OS(WINDOWS) && !defined(BUILDING_WX__) && !COMPILER(GCC) +#if !PLATFORM(CHROMIUM) && OS(WINDOWS) && !defined(BUILDING_WX__) && !COMPILER(GCC) #if defined(BUILDING_JavaScriptCore) || defined(BUILDING_WTF) #define JS_EXPORTDATA __declspec(dllexport) #else diff --git a/WebCore/css/CSSComputedStyleDeclaration.cpp b/WebCore/css/CSSComputedStyleDeclaration.cpp index d7f585f..86756b7 100644 --- a/WebCore/css/CSSComputedStyleDeclaration.cpp +++ b/WebCore/css/CSSComputedStyleDeclaration.cpp @@ -1474,6 +1474,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper break; /* Other unimplemented properties */ + case CSSPropertyBackgroundRepeatX: + case CSSPropertyBackgroundRepeatY: case CSSPropertyContent: // FIXME: needs implementation, bug 23668 case CSSPropertyCounterIncrement: case CSSPropertyCounterReset: @@ -1494,6 +1496,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper case CSSPropertyWebkitMarquee: case CSSPropertyWebkitMarqueeSpeed: case CSSPropertyWebkitMask: + case CSSPropertyWebkitMaskRepeatX: + case CSSPropertyWebkitMaskRepeatY: case CSSPropertyWebkitPaddingStart: case CSSPropertyWebkitPerspectiveOriginX: case CSSPropertyWebkitPerspectiveOriginY: @@ -1546,7 +1550,7 @@ void CSSComputedStyleDeclaration::setProperty(int /*propertyID*/, const String& ec = NO_MODIFICATION_ALLOWED_ERR; } -unsigned CSSComputedStyleDeclaration::length() const +unsigned CSSComputedStyleDeclaration::virtualLength() const { Node* node = m_node.get(); if (!node) diff --git a/WebCore/css/CSSComputedStyleDeclaration.h b/WebCore/css/CSSComputedStyleDeclaration.h index eb93bad..ba55d77 100644 --- a/WebCore/css/CSSComputedStyleDeclaration.h +++ b/WebCore/css/CSSComputedStyleDeclaration.h @@ -39,7 +39,7 @@ public: virtual String cssText() const; - virtual unsigned length() const; + virtual unsigned virtualLength() const; virtual String item(unsigned index) const; virtual PassRefPtr<CSSValue> getPropertyCSSValue(int propertyID) const; diff --git a/WebCore/css/CSSFontFaceSrcValue.cpp b/WebCore/css/CSSFontFaceSrcValue.cpp index 308ff31..21eea04 100644 --- a/WebCore/css/CSSFontFaceSrcValue.cpp +++ b/WebCore/css/CSSFontFaceSrcValue.cpp @@ -49,6 +49,9 @@ bool CSSFontFaceSrcValue::isSupportedFormat() const } return equalIgnoringCase(m_format, "truetype") || equalIgnoringCase(m_format, "opentype") +#if ENABLE(OPENTYPE_SANITIZER) + || equalIgnoringCase(m_format, "woff") +#endif #if ENABLE(SVG_FONTS) || isSVGFontFaceSrc() #endif diff --git a/WebCore/css/CSSGrammar.y b/WebCore/css/CSSGrammar.y index ec0c141..7798264 100644 --- a/WebCore/css/CSSGrammar.y +++ b/WebCore/css/CSSGrammar.y @@ -70,6 +70,7 @@ using namespace HTMLNames; CSSRuleList* ruleList; CSSSelector* selector; Vector<CSSSelector*>* selectorList; + CSSSelector::MarginBoxType marginBox; CSSSelector::Relation relation; MediaList* mediaList; MediaQuery* mediaQuery; @@ -97,7 +98,7 @@ static int cssyylex(YYSTYPE* yylval, void* parser) %} -%expect 54 +%expect 55 %nonassoc LOWEST_PREC @@ -142,6 +143,23 @@ static int cssyylex(YYSTYPE* yylval, void* parser) %token WEBKIT_DEFINE_SYM %token VARIABLES_FOR %token WEBKIT_VARIABLES_DECLS_SYM +%token <marginBox> TOPLEFTCORNER_SYM +%token <marginBox> TOPLEFT_SYM +%token <marginBox> TOPCENTER_SYM +%token <marginBox> TOPRIGHT_SYM +%token <marginBox> TOPRIGHTCORNER_SYM +%token <marginBox> BOTTOMLEFTCORNER_SYM +%token <marginBox> BOTTOMLEFT_SYM +%token <marginBox> BOTTOMCENTER_SYM +%token <marginBox> BOTTOMRIGHT_SYM +%token <marginBox> BOTTOMRIGHTCORNER_SYM +%token <marginBox> LEFTTOP_SYM +%token <marginBox> LEFTMIDDLE_SYM +%token <marginBox> LEFTBOTTOM_SYM +%token <marginBox> RIGHTTOP_SYM +%token <marginBox> RIGHTMIDDLE_SYM +%token <marginBox> RIGHTBOTTOM_SYM + %token ATKEYWORD %token IMPORTANT_SYM @@ -188,6 +206,7 @@ static int cssyylex(YYSTYPE* yylval, void* parser) %type <rule> import %type <rule> namespace %type <rule> page +%type <rule> margin_box %type <rule> font_face %type <rule> keyframes %type <rule> invalid_rule @@ -209,6 +228,7 @@ static int cssyylex(YYSTYPE* yylval, void* parser) %type <string> ident_or_string %type <string> medium %type <string> hexcolor +%type <marginBox> margin_sym %type <string> media_feature %type <mediaList> media_list @@ -237,10 +257,12 @@ static int cssyylex(YYSTYPE* yylval, void* parser) %type <selector> class %type <selector> attrib %type <selector> pseudo +%type <selector> page_selector %type <boolean> declaration_list %type <boolean> decl_list %type <boolean> declaration +%type <boolean> declarations_and_margins %type <boolean> prio @@ -729,26 +751,105 @@ key: } ; -/* page: - PAGE_SYM maybe_space IDENT? pseudo_page? maybe_space - '{' maybe_space declaration [ ';' maybe_space declaration ]* '}' maybe_space - ; - -pseudo_page - : ':' IDENT - ; -*/ - -page: - PAGE_SYM error invalid_block { + PAGE_SYM maybe_space page_selector maybe_space + '{' maybe_space declarations_and_margins closing_brace { + CSSParser* p = static_cast<CSSParser*>(parser); + $$ = p->createPageRule(p->sinkFloatingSelector($3)); + } + | PAGE_SYM error invalid_block { $$ = 0; } - | PAGE_SYM error ';' { + | PAGE_SYM error ';' { $$ = 0; } ; +page_selector: + IDENT { + CSSParser* p = static_cast<CSSParser*>(parser); + $$ = p->createFloatingSelector(); + $$->m_tag = QualifiedName(nullAtom, $1, p->m_defaultNamespace); + } + | IDENT pseudo { + CSSParser* p = static_cast<CSSParser*>(parser); + $$ = $2; + if ($$) + $$->m_tag = QualifiedName(nullAtom, $1, p->m_defaultNamespace); + } + | pseudo { + $$ = $1; + } + | /* empty */ { + CSSParser* p = static_cast<CSSParser*>(parser); + $$ = p->createFloatingSelector(); + } + ; + +declarations_and_margins: + declaration_list + | declarations_and_margins margin_box maybe_space declaration_list + ; + +margin_box: + margin_sym { + static_cast<CSSParser*>(parser)->startDeclarationsForMarginBox(); + } maybe_space '{' maybe_space declaration_list closing_brace { + $$ = static_cast<CSSParser*>(parser)->createMarginAtRule($1); + } + ; + +margin_sym : + TOPLEFTCORNER_SYM { + $$ = CSSSelector::TopLeftCornerMarginBox; + } + | TOPLEFT_SYM { + $$ = CSSSelector::TopLeftMarginBox; + } + | TOPCENTER_SYM { + $$ = CSSSelector::TopCenterMarginBox; + } + | TOPRIGHT_SYM { + $$ = CSSSelector::TopRightMarginBox; + } + | TOPRIGHTCORNER_SYM { + $$ = CSSSelector::TopRightCornerMarginBox; + } + | BOTTOMLEFTCORNER_SYM { + $$ = CSSSelector::BottomLeftCornerMarginBox; + } + | BOTTOMLEFT_SYM { + $$ = CSSSelector::BottomLeftMarginBox; + } + | BOTTOMCENTER_SYM { + $$ = CSSSelector::BottomCenterMarginBox; + } + | BOTTOMRIGHT_SYM { + $$ = CSSSelector::BottomRightMarginBox; + } + | BOTTOMRIGHTCORNER_SYM { + $$ = CSSSelector::BottomRightCornerMarginBox; + } + | LEFTTOP_SYM { + $$ = CSSSelector::LeftTopMarginBox; + } + | LEFTMIDDLE_SYM { + $$ = CSSSelector::LeftMiddleMarginBox; + } + | LEFTBOTTOM_SYM { + $$ = CSSSelector::LeftBottomMarginBox; + } + | RIGHTTOP_SYM { + $$ = CSSSelector::RightTopMarginBox; + } + | RIGHTMIDDLE_SYM { + $$ = CSSSelector::RightMiddleMarginBox; + } + | RIGHTBOTTOM_SYM { + $$ = CSSSelector::RightBottomMarginBox; + } + ; + font_face: FONT_FACE_SYM maybe_space '{' maybe_space declaration_list '}' maybe_space { diff --git a/WebCore/css/CSSHelper.cpp b/WebCore/css/CSSHelper.cpp index 8e6f3a0..c3418b4 100644 --- a/WebCore/css/CSSHelper.cpp +++ b/WebCore/css/CSSHelper.cpp @@ -36,7 +36,7 @@ String deprecatedParseURL(const String& url) int o = 0; int l = i->length(); - while (o < l && (*i)[o] <= ' ') { + while (0 < l && (*i)[o] <= ' ') { ++o; --l; } @@ -53,7 +53,7 @@ String deprecatedParseURL(const String& url) l -= 5; } - while (o < l && (*i)[o] <= ' ') { + while (0 < l && (*i)[o] <= ' ') { ++o; --l; } @@ -65,7 +65,7 @@ String deprecatedParseURL(const String& url) l -= 2; } - while (o < l && (*i)[o] <= ' ') { + while (0 < l && (*i)[o] <= ' ') { ++o; --l; } diff --git a/WebCore/css/CSSMutableStyleDeclaration.cpp b/WebCore/css/CSSMutableStyleDeclaration.cpp index 31c7507..327f398 100644 --- a/WebCore/css/CSSMutableStyleDeclaration.cpp +++ b/WebCore/css/CSSMutableStyleDeclaration.cpp @@ -627,9 +627,9 @@ void CSSMutableStyleDeclaration::setLengthProperty(int propertyId, const String& setStrictParsing(parseMode); } -unsigned CSSMutableStyleDeclaration::length() const +unsigned CSSMutableStyleDeclaration::virtualLength() const { - return m_properties.size(); + return length(); } String CSSMutableStyleDeclaration::item(unsigned i) const diff --git a/WebCore/css/CSSMutableStyleDeclaration.h b/WebCore/css/CSSMutableStyleDeclaration.h index 5eb8a27..f7759f4 100644 --- a/WebCore/css/CSSMutableStyleDeclaration.h +++ b/WebCore/css/CSSMutableStyleDeclaration.h @@ -88,7 +88,9 @@ public: virtual String cssText() const; virtual void setCssText(const String&, ExceptionCode&); - virtual unsigned length() const; + virtual unsigned virtualLength() const; + unsigned length() const { return m_properties.size(); } + virtual String item(unsigned index) const; virtual PassRefPtr<CSSValue> getPropertyCSSValue(int propertyID) const; diff --git a/WebCore/css/CSSPageRule.cpp b/WebCore/css/CSSPageRule.cpp index 6a37963..c85c1aa 100644 --- a/WebCore/css/CSSPageRule.cpp +++ b/WebCore/css/CSSPageRule.cpp @@ -23,12 +23,16 @@ #include "CSSPageRule.h" #include "CSSMutableStyleDeclaration.h" +#include <wtf/Vector.h> namespace WebCore { -CSSPageRule::CSSPageRule(CSSStyleSheet* parent) - : CSSRule(parent) +CSSPageRule::CSSPageRule(CSSStyleSheet* parent, CSSSelector* selector, int sourceLine) + : CSSStyleRule(parent, sourceLine) { + Vector<CSSSelector*> selectors; + selectors.append(selector); + adoptSelectorVector(selectors); } CSSPageRule::~CSSPageRule() @@ -37,19 +41,14 @@ CSSPageRule::~CSSPageRule() String CSSPageRule::selectorText() const { - // FIXME: Implement! - return String(); -} - -void CSSPageRule::setSelectorText(const String& /*selectorText*/, ExceptionCode& /*ec*/) -{ - // FIXME: Implement! -} - -String CSSPageRule::cssText() const -{ - // FIXME: Implement! - return String(); + String text = "@page"; + CSSSelector* selector = selectorList().first(); + if (selector) { + String pageSpecification = selector->selectorText(); + if (!pageSpecification.isEmpty() && pageSpecification != starAtom) + text += " " + pageSpecification; + } + return text; } } // namespace WebCore diff --git a/WebCore/css/CSSPageRule.h b/WebCore/css/CSSPageRule.h index 8e374a5..bdfb751 100644 --- a/WebCore/css/CSSPageRule.h +++ b/WebCore/css/CSSPageRule.h @@ -22,37 +22,34 @@ #ifndef CSSPageRule_h #define CSSPageRule_h -#include "CSSRule.h" +#include "CSSStyleRule.h" #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> namespace WebCore { class CSSMutableStyleDeclaration; +class CSSSelector; +class CSSSelectorList; -class CSSPageRule : public CSSRule { +class CSSPageRule : public CSSStyleRule { public: - static PassRefPtr<CSSPageRule> create(CSSStyleSheet* parent) + static PassRefPtr<CSSPageRule> create(CSSStyleSheet* parent, CSSSelector* selector, int sourceLine) { - return adoptRef(new CSSPageRule(parent)); + return adoptRef(new CSSPageRule(parent, selector, sourceLine)); } virtual ~CSSPageRule(); - String selectorText() const; - void setSelectorText(const String&, ExceptionCode&); - - CSSMutableStyleDeclaration* style() const { return m_style.get(); } - - virtual String cssText() const; + virtual String selectorText() const; private: - CSSPageRule(CSSStyleSheet* parent); + CSSPageRule(CSSStyleSheet* parent, CSSSelector* selector, int sourceLine); + + virtual bool isPageRule() { return true; } // Inherited from CSSRule virtual unsigned short type() const { return PAGE_RULE; } - - RefPtr<CSSMutableStyleDeclaration> m_style; }; } // namespace WebCore diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp index 466e741..8983eeb 100644 --- a/WebCore/css/CSSParser.cpp +++ b/WebCore/css/CSSParser.cpp @@ -40,6 +40,7 @@ #include "CSSInitialValue.h" #include "CSSMediaRule.h" #include "CSSMutableStyleDeclaration.h" +#include "CSSPageRule.h" #include "CSSPrimitiveValue.h" #include "CSSProperty.h" #include "CSSPropertyNames.h" @@ -69,6 +70,7 @@ #include "WebKitCSSKeyframeRule.h" #include "WebKitCSSKeyframesRule.h" #include "WebKitCSSTransformValue.h" +#include <limits.h> #include <wtf/dtoa.h> #if ENABLE(DASHBOARD_SUPPORT) @@ -95,6 +97,8 @@ using namespace WTF; namespace WebCore { +static const unsigned INVALID_NUM_PARSED_PROPERTIES = UINT_MAX; + static bool equal(const CSSParserString& a, const char* b) { for (int i = 0; i < a.length; ++i) { @@ -139,6 +143,7 @@ CSSParser::CSSParser(bool strictParsing) , m_parsedProperties(static_cast<CSSProperty**>(fastMalloc(32 * sizeof(CSSProperty*)))) , m_numParsedProperties(0) , m_maxParsedProperties(32) + , m_numParsedPropertiesBeforeMarginBox(INVALID_NUM_PARSED_PROPERTIES) , m_inParseShorthand(0) , m_currentShorthand(0) , m_implicitShorthand(false) @@ -448,6 +453,7 @@ void CSSParser::clearProperties() for (unsigned i = 0; i < m_numParsedProperties; i++) delete m_parsedProperties[i]; m_numParsedProperties = 0; + m_numParsedPropertiesBeforeMarginBox = INVALID_NUM_PARSED_PROPERTIES; m_hasFontFaceOnlyValues = false; } @@ -638,7 +644,9 @@ bool CSSParser::parseValue(int propId, bool important) * (see parseAuralValues). As we don't support them at all this seems reasonable. */ - case CSSPropertySize: // <length>{1,2} | auto | portrait | landscape | inherit + case CSSPropertySize: // <length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ] + return parseSize(propId, important); + case CSSPropertyQuotes: // [<string> <string>]+ | none | inherit if (id) validPrimitive = true; @@ -1738,18 +1746,28 @@ bool CSSParser::parseValue(int propId, bool important) return parseTransitionShorthand(important); case CSSPropertyInvalid: return false; - case CSSPropertyFontStretch: case CSSPropertyPage: + return parsePage(propId, important); + case CSSPropertyFontStretch: case CSSPropertyTextLineThrough: case CSSPropertyTextOverline: case CSSPropertyTextUnderline: case CSSPropertyWebkitVariableDeclarationBlock: return false; +<<<<<<< HEAD:WebCore/css/CSSParser.cpp #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR case CSSPropertyWebkitTapHighlightColor: parsedValue = parseColor(); if (parsedValue) m_valueList->next(); +======= +#if ENABLE(WCSS) + case CSSPropertyWapInputFormat: + validPrimitive = true; + break; + case CSSPropertyWapInputRequired: + parsedValue = parseWCSSInputProperty(); +>>>>>>> webkit.org at r58956:WebCore/css/CSSParser.cpp break; #endif @@ -1781,6 +1799,27 @@ bool CSSParser::parseValue(int propId, bool important) return false; } +#if ENABLE(WCSS) +PassRefPtr<CSSValue> CSSParser::parseWCSSInputProperty() +{ + RefPtr<CSSValue> parsedValue = 0; + CSSParserValue* value = m_valueList->current(); + String inputProperty; + if (value->unit == CSSPrimitiveValue::CSS_STRING || value->unit == CSSPrimitiveValue::CSS_IDENT) + inputProperty = String(value->string); + + if (!inputProperty.isEmpty()) + parsedValue = CSSPrimitiveValue::create(inputProperty, CSSPrimitiveValue::CSS_STRING); + + while (m_valueList->next()) { + // pass all other values, if any. If we don't do this, + // the parser will think that it's not done and won't process this property + } + + return parsedValue; +} +#endif + void CSSParser::addFillValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSValue> rval) { if (lval) { @@ -2164,6 +2203,101 @@ bool CSSParser::parse4Values(int propId, const int *properties, bool important) return true; } +// auto | <identifier> +bool CSSParser::parsePage(int propId, bool important) +{ + ASSERT(propId == CSSPropertyPage); + + if (m_valueList->size() != 1) + return false; + + CSSParserValue* value = m_valueList->current(); + if (!value) + return false; + + if (value->id == CSSValueAuto) { + addProperty(propId, CSSPrimitiveValue::createIdentifier(value->id), important); + return true; + } else if (value->id == 0 && value->unit == CSSPrimitiveValue::CSS_IDENT) { + addProperty(propId, CSSPrimitiveValue::create(value->string, CSSPrimitiveValue::CSS_STRING), important); + return true; + } + return false; +} + +// <length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ] +bool CSSParser::parseSize(int propId, bool important) +{ + ASSERT(propId == CSSPropertySize); + + if (m_valueList->size() > 2) + return false; + + CSSParserValue* value = m_valueList->current(); + if (!value) + return false; + + RefPtr<CSSValueList> parsedValues = CSSValueList::createSpaceSeparated(); + + // First parameter. + SizeParameterType paramType = parseSizeParameter(parsedValues.get(), value, None); + if (paramType == None) + return false; + + // Second parameter, if any. + value = m_valueList->next(); + if (value) { + paramType = parseSizeParameter(parsedValues.get(), value, paramType); + if (paramType == None) + return false; + } + + addProperty(propId, parsedValues.release(), important); + return true; +} + +CSSParser::SizeParameterType CSSParser::parseSizeParameter(CSSValueList* parsedValues, CSSParserValue* value, SizeParameterType prevParamType) +{ + switch (value->id) { + case CSSValueAuto: + if (prevParamType == None) { + parsedValues->append(CSSPrimitiveValue::createIdentifier(value->id)); + return Auto; + } + return None; + case CSSValueLandscape: + case CSSValuePortrait: + if (prevParamType == None || prevParamType == PageSize) { + parsedValues->append(CSSPrimitiveValue::createIdentifier(value->id)); + return Orientation; + } + return None; + case CSSValueA3: + case CSSValueA4: + case CSSValueA5: + case CSSValueB4: + case CSSValueB5: + case CSSValueLedger: + case CSSValueLegal: + case CSSValueLetter: + if (prevParamType == None || prevParamType == Orientation) { + // Normalize to Page Size then Orientation order by prepending. + // This is not specified by the CSS3 Paged Media specification, but for simpler processing hereafter. + parsedValues->prepend(CSSPrimitiveValue::createIdentifier(value->id)); + return PageSize; + } + return None; + case 0: + if (validUnit(value, FLength, m_strict) && (prevParamType == None || prevParamType == Length)) { + parsedValues->append(CSSPrimitiveValue::create(value->fValue, static_cast<CSSPrimitiveValue::UnitTypes>(value->unit))); + return Length; + } + return None; + default: + return None; + } +} + // [ <string> | <uri> | <counter> | attr(X) | open-quote | close-quote | no-open-quote | no-close-quote ]+ | inherit // in CSS 2.1 this got somewhat reduced: // [ <string> | attr(X) | open-quote | close-quote | no-open-quote | no-close-quote ]+ | inherit @@ -5253,6 +5387,43 @@ bool CSSParser::addVariableDeclarationBlock(const CSSParserString&) #endif +CSSRule* CSSParser::createPageRule(CSSSelector* pageSelector) +{ + // FIXME: Margin at-rules are ignored. + m_allowImportRules = m_allowNamespaceDeclarations = m_allowVariablesRules = false; + CSSPageRule* pageRule = 0; + if (pageSelector) { + RefPtr<CSSPageRule> rule = CSSPageRule::create(m_styleSheet, pageSelector, m_lastSelectorLine); + rule->setDeclaration(CSSMutableStyleDeclaration::create(rule.get(), m_parsedProperties, m_numParsedProperties)); + pageRule = rule.get(); + m_parsedStyleObjects.append(rule.release()); + } + clearProperties(); + return pageRule; +} + +CSSRule* CSSParser::createMarginAtRule(CSSSelector::MarginBoxType /* marginBox */) +{ + // FIXME: Implement margin at-rule here, using: + // - marginBox: margin box + // - m_parsedProperties: properties at [m_numParsedPropertiesBeforeMarginBox, m_numParsedProperties) are for this at-rule. + + endDeclarationsForMarginBox(); + return 0; // until this method is implemented. +} + +void CSSParser::startDeclarationsForMarginBox() +{ + m_numParsedPropertiesBeforeMarginBox = m_numParsedProperties; +} + +void CSSParser::endDeclarationsForMarginBox() +{ + ASSERT(m_numParsedPropertiesBeforeMarginBox != INVALID_NUM_PARSED_PROPERTIES); + rollbackLastProperties(m_numParsedProperties - m_numParsedPropertiesBeforeMarginBox); + m_numParsedPropertiesBeforeMarginBox = INVALID_NUM_PARSED_PROPERTIES; +} + void CSSParser::clearVariables() { m_variableNames.clear(); diff --git a/WebCore/css/CSSParser.h b/WebCore/css/CSSParser.h index ca8c66a..6e0354e 100644 --- a/WebCore/css/CSSParser.h +++ b/WebCore/css/CSSParser.h @@ -2,6 +2,7 @@ * Copyright (C) 2003 Lars Knoll (knoll@kde.org) * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. * Copyright (C) 2008 Eric Seidel <eric@webkit.org> + * Copyright (C) 2009 - 2010 Torch Mobile (Beijing) Co. Ltd. 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 @@ -139,6 +140,10 @@ namespace WebCore { PassRefPtr<CSSValue> parseSVGStrokeDasharray(); #endif +#if ENABLE(WCSS) + PassRefPtr<CSSValue> parseWCSSInputProperty(); +#endif + // CSS3 Parsing Routines (for properties specific to CSS3) bool parseShadow(int propId, bool important); bool parseBorderImage(int propId, bool important, RefPtr<CSSValue>&); @@ -179,6 +184,10 @@ namespace WebCore { CSSRule* createStyleRule(Vector<CSSSelector*>* selectors); CSSRule* createFontFaceRule(); CSSRule* createVariablesRule(MediaList*, bool variablesKeyword); + CSSRule* createPageRule(CSSSelector* pageSelector); + CSSRule* createMarginAtRule(CSSSelector::MarginBoxType marginBox); + void startDeclarationsForMarginBox(); + void endDeclarationsForMarginBox(); MediaQueryExp* createFloatingMediaQueryExp(const AtomicString&, CSSParserValueList*); MediaQueryExp* sinkFloatingMediaQueryExp(MediaQueryExp*); @@ -212,6 +221,7 @@ namespace WebCore { CSSSelectorList* m_selectorListForParseSelector; unsigned m_numParsedProperties; unsigned m_maxParsedProperties; + unsigned m_numParsedPropertiesBeforeMarginBox; int m_inParseShorthand; int m_currentShorthand; @@ -247,6 +257,18 @@ namespace WebCore { void deleteFontFaceOnlyValues(); + enum SizeParameterType { + None, + Auto, + Length, + PageSize, + Orientation, + }; + + bool parsePage(int propId, bool important); + bool parseSize(int propId, bool important); + SizeParameterType parseSizeParameter(CSSValueList* parsedValues, CSSParserValue* value, SizeParameterType prevParamType); + UChar* m_data; UChar* yytext; UChar* yy_c_buf_p; diff --git a/WebCore/css/CSSPrimitiveValueMappings.h b/WebCore/css/CSSPrimitiveValueMappings.h index 223b515..d5876e7 100644 --- a/WebCore/css/CSSPrimitiveValueMappings.h +++ b/WebCore/css/CSSPrimitiveValueMappings.h @@ -276,10 +276,15 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e) m_value.ident = CSSValueOuterSpinButton; break; case ProgressBarPart: -#if ENABLE(PROGRESS_BAR) +#if ENABLE(PROGRESS_TAG) m_value.ident = CSSValueProgressBar; #endif break; + case ProgressBarValuePart: +#if ENABLE(PROGRESS_TAG) + m_value.ident = CSSValueProgressBarValue; +#endif + break; case SliderHorizontalPart: m_value.ident = CSSValueSliderHorizontal; break; diff --git a/WebCore/css/CSSPropertyNames.in b/WebCore/css/CSSPropertyNames.in index aed7063..6ed923a 100644 --- a/WebCore/css/CSSPropertyNames.in +++ b/WebCore/css/CSSPropertyNames.in @@ -8,6 +8,24 @@ # http://msdn.microsoft.com/workshop/author/css/reference/attributes.asp # +# high-priority property names have to be listed first, to simplify the check +# for applying them first. +color +direction +display +font +font-family +font-size +font-style +font-variant +font-weight +-webkit-text-size-adjust +zoom + +# line height needs to be right after the above high-priority properties +line-height + +# The remaining properties are listed in alphabetical order background background-attachment background-clip @@ -52,26 +70,16 @@ 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 @@ -146,7 +154,6 @@ word-break word-spacing word-wrap z-index -zoom -webkit-animation -webkit-animation-delay -webkit-animation-direction @@ -241,7 +248,6 @@ zoom -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 diff --git a/WebCore/css/CSSSelector.cpp b/WebCore/css/CSSSelector.cpp index 23a89f6..ee9c846 100644 --- a/WebCore/css/CSSSelector.cpp +++ b/WebCore/css/CSSSelector.cpp @@ -143,6 +143,13 @@ PseudoId CSSSelector::pseudoId(PseudoType type) return INNER_SPIN_BUTTON; case PseudoOuterSpinButton: return OUTER_SPIN_BUTTON; + case PseudoProgressBarValue: +#if ENABLE(PROGRESS_TAG) + return PROGRESS_BAR_VALUE; +#else + ASSERT_NOT_REACHED(); + return NOPSEUDO; +#endif case PseudoInputListButton: #if ENABLE(DATALIST) return INPUT_LIST_BUTTON; @@ -196,6 +203,9 @@ PseudoId CSSSelector::pseudoId(PseudoType type) case PseudoDoubleButton: case PseudoSingleButton: case PseudoNoButton: + case PseudoFirstPage: + case PseudoLeftPage: + case PseudoRightPage: return NOPSEUDO; case PseudoNotParsed: ASSERT_NOT_REACHED(); @@ -267,8 +277,8 @@ static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap( DEFINE_STATIC_LOCAL(AtomicString, onlyOfType, ("only-of-type")); DEFINE_STATIC_LOCAL(AtomicString, optional, ("optional")); DEFINE_STATIC_LOCAL(AtomicString, outerSpinButton, ("-webkit-outer-spin-button")); -#if ENABLE(PROGRESS_BAR) - DEFINE_STATIC_LOCAL(AtomicString, progressBar, ("-webkit-progress-bar")); +#if ENABLE(PROGRESS_TAG) + DEFINE_STATIC_LOCAL(AtomicString, progressBarValue, ("-webkit-progress-bar-value")); #endif DEFINE_STATIC_LOCAL(AtomicString, required, ("required")); DEFINE_STATIC_LOCAL(AtomicString, resizer, ("-webkit-resizer")); @@ -298,6 +308,10 @@ static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap( DEFINE_STATIC_LOCAL(AtomicString, singleButton, ("single-button")); DEFINE_STATIC_LOCAL(AtomicString, noButton, ("no-button")); DEFINE_STATIC_LOCAL(AtomicString, cornerPresent, ("corner-present")); + // Paged Media pseudo-classes + DEFINE_STATIC_LOCAL(AtomicString, firstPage, ("first")); + DEFINE_STATIC_LOCAL(AtomicString, leftPage, ("left")); + DEFINE_STATIC_LOCAL(AtomicString, rightPage, ("right")); static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoType = 0; if (!nameToPseudoType) { @@ -360,6 +374,9 @@ static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap( nameToPseudoType->set(nthLastChild.impl(), CSSSelector::PseudoNthLastChild); nameToPseudoType->set(nthLastOfType.impl(), CSSSelector::PseudoNthLastOfType); nameToPseudoType->set(outerSpinButton.impl(), CSSSelector::PseudoOuterSpinButton); +#if ENABLE(PROGRESS_TAG) + nameToPseudoType->set(progressBarValue.impl(), CSSSelector::PseudoProgressBarValue); +#endif nameToPseudoType->set(root.impl(), CSSSelector::PseudoRoot); nameToPseudoType->set(windowInactive.impl(), CSSSelector::PseudoWindowInactive); nameToPseudoType->set(decrement.impl(), CSSSelector::PseudoDecrement); @@ -389,6 +406,9 @@ static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap( nameToPseudoType->set(sliderThumb.impl(), CSSSelector::PseudoSliderThumb); nameToPseudoType->set(target.impl(), CSSSelector::PseudoTarget); nameToPseudoType->set(visited.impl(), CSSSelector::PseudoVisited); + nameToPseudoType->set(firstPage.impl(), CSSSelector::PseudoFirstPage); + nameToPseudoType->set(leftPage.impl(), CSSSelector::PseudoLeftPage); + nameToPseudoType->set(rightPage.impl(), CSSSelector::PseudoRightPage); } return nameToPseudoType; } @@ -439,6 +459,7 @@ void CSSSelector::extractPseudoType() const case PseudoMediaControlsTimelineContainer: case PseudoMediaControlsVolumeSliderContainer: case PseudoOuterSpinButton: + case PseudoProgressBarValue: case PseudoResizer: case PseudoScrollbar: case PseudoScrollbarCorner: @@ -505,6 +526,12 @@ void CSSSelector::extractPseudoType() const case PseudoNoButton: case PseudoNotParsed: break; + case PseudoFirstPage: + case PseudoLeftPage: + case PseudoRightPage: + // FIXME: These should only be allowed in @page rules. Disabled them altogether until that's implemented correctly. + m_pseudoType = PseudoUnknown; + return; } if (m_match == PseudoClass && element) { @@ -749,7 +776,8 @@ bool CSSSelector::RareData::parseNth() m_b = argument.substring(p + 1, argument.length() - p - 1).toInt(); else { p = argument.find('-', n); - m_b = -argument.substring(p + 1, argument.length() - p - 1).toInt(); + if (p != -1) + m_b = -argument.substring(p + 1, argument.length() - p - 1).toInt(); } } else m_b = argument.toInt(); diff --git a/WebCore/css/CSSSelector.h b/WebCore/css/CSSSelector.h index f8748c7..8f84b05 100644 --- a/WebCore/css/CSSSelector.h +++ b/WebCore/css/CSSSelector.h @@ -187,6 +187,29 @@ namespace WebCore { PseudoInputListButton, PseudoInnerSpinButton, PseudoOuterSpinButton, + PseudoProgressBarValue, + PseudoLeftPage, + PseudoRightPage, + PseudoFirstPage, + }; + + enum MarginBoxType { + TopLeftCornerMarginBox, + TopLeftMarginBox, + TopCenterMarginBox, + TopRightMarginBox, + TopRightCornerMarginBox, + BottomLeftCornerMarginBox, + BottomLeftMarginBox, + BottomCenterMarginBox, + BottomRightMarginBox, + BottomRightCornerMarginBox, + LeftTopMarginBox, + LeftMiddleMarginBox, + LeftBottomMarginBox, + RightTopMarginBox, + RightMiddleMarginBox, + RightBottomMarginBox, }; PseudoType pseudoType() const diff --git a/WebCore/css/CSSStyleDeclaration.h b/WebCore/css/CSSStyleDeclaration.h index 18493df..08b3bf0 100644 --- a/WebCore/css/CSSStyleDeclaration.h +++ b/WebCore/css/CSSStyleDeclaration.h @@ -42,7 +42,8 @@ public: virtual String cssText() const = 0; virtual void setCssText(const String&, ExceptionCode&) = 0; - virtual unsigned length() const = 0; + unsigned length() const { return virtualLength(); } + virtual unsigned virtualLength() const = 0; bool isEmpty() const { return !length(); } virtual String item(unsigned index) const = 0; diff --git a/WebCore/css/CSSStyleRule.h b/WebCore/css/CSSStyleRule.h index 835f2a2..d797c73 100644 --- a/WebCore/css/CSSStyleRule.h +++ b/WebCore/css/CSSStyleRule.h @@ -40,7 +40,7 @@ public: } virtual ~CSSStyleRule(); - String selectorText() const; + virtual String selectorText() const; void setSelectorText(const String&, ExceptionCode&); CSSMutableStyleDeclaration* style() const { return m_style.get(); } @@ -60,9 +60,10 @@ public: int sourceLine() { return m_sourceLine; } -private: +protected: CSSStyleRule(CSSStyleSheet* parent, int sourceLine); +private: virtual bool isStyleRule() { return true; } // Inherited from CSSRule diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp index dd4fed9..389bd11 100644 --- a/WebCore/css/CSSStyleSelector.cpp +++ b/WebCore/css/CSSStyleSelector.cpp @@ -31,6 +31,7 @@ #include "CSSFontFaceRule.h" #include "CSSImportRule.h" #include "CSSMediaRule.h" +#include "CSSPageRule.h" #include "CSSParser.h" #include "CSSPrimitiveValueMappings.h" #include "CSSPropertyNames.h" @@ -358,6 +359,7 @@ public: void addRulesFromSheet(CSSStyleSheet*, const MediaQueryEvaluator&, CSSStyleSelector* = 0); void addRule(CSSStyleRule* rule, CSSSelector* sel); + void addPageRule(CSSStyleRule* rule, CSSSelector* sel); void addToRuleSet(AtomicStringImpl* key, AtomRuleMap& map, CSSStyleRule* rule, CSSSelector* sel); @@ -365,13 +367,16 @@ public: CSSRuleDataList* getClassRules(AtomicStringImpl* key) { return m_classRules.get(key); } CSSRuleDataList* getTagRules(AtomicStringImpl* key) { return m_tagRules.get(key); } CSSRuleDataList* getUniversalRules() { return m_universalRules; } + CSSRuleDataList* getPageRules() { return m_pageRules; } public: AtomRuleMap m_idRules; AtomRuleMap m_classRules; AtomRuleMap m_tagRules; CSSRuleDataList* m_universalRules; + CSSRuleDataList* m_pageRules; unsigned m_ruleCount; + unsigned m_pageRuleCount; }; static CSSRuleSet* defaultStyle; @@ -486,6 +491,7 @@ void CSSStyleSelector::addKeyframeStyle(PassRefPtr<WebKitCSSKeyframesRule> rule) void CSSStyleSelector::init() { m_element = 0; + m_haveCachedLinkState = false; m_matchedDecls.clear(); m_ruleList = 0; m_rootDefaultStyle = 0; @@ -696,9 +702,7 @@ void CSSStyleSelector::matchRulesForList(CSSRuleDataList* rules, int& firstRuleI for (CSSRuleData* d = rules->first(); d; d = d->next()) { CSSStyleRule* rule = d->rule(); - const AtomicString& localName = m_element->localName(); - const AtomicString& selectorLocalName = d->selector()->m_tag.localName(); - if ((localName == selectorLocalName || selectorLocalName == starAtom) && checkSelector(d->selector())) { + if (checkSelector(d->selector())) { // If the rule has no properties to apply, then ignore it. CSSMutableStyleDeclaration* decl = rule->declaration(); if (!decl || !decl->length()) @@ -800,13 +804,16 @@ void CSSStyleSelector::sortMatchedRules(unsigned start, unsigned end) m_matchedRules[i] = rulesMergeBuffer[i - start]; } -void CSSStyleSelector::initElement(Element* e) +inline void CSSStyleSelector::initElement(Element* e, bool helperCallForVisitedStyle = false) { + if (!helperCallForVisitedStyle) + m_haveCachedLinkState = false; + m_element = e; m_styledElement = m_element && m_element->isStyledElement() ? static_cast<StyledElement*>(m_element) : 0; } -void CSSStyleSelector::initForStyleResolve(Element* e, RenderStyle* parentStyle, PseudoId pseudoID) +inline void CSSStyleSelector::initForStyleResolve(Element* e, RenderStyle* parentStyle, PseudoId pseudoID) { m_checker.m_pseudoStyle = pseudoID; @@ -874,10 +881,17 @@ CSSStyleSelector::SelectorChecker::SelectorChecker(Document* document, bool stri { } -EInsideLink CSSStyleSelector::SelectorChecker::determineLinkState(Element* element) const +inline EInsideLink CSSStyleSelector::SelectorChecker::determineLinkState(Element* element) const { if (!element->isLink()) return NotInsideLink; + return determineLinkStateSlowCase(element); +} + + +EInsideLink CSSStyleSelector::SelectorChecker::determineLinkStateSlowCase(Element* element) const +{ + ASSERT(element->isLink()); const AtomicString* attr = linkAttribute(element); if (!attr || attr->isNull()) @@ -1025,7 +1039,7 @@ bool CSSStyleSelector::canShareStyleWithElement(Node* n) mappedAttrsMatch = s->mappedAttributes()->mapsEquivalent(m_styledElement->mappedAttributes()); if (mappedAttrsMatch) { if (s->isLink()) { - if (m_checker.determineLinkState(m_element) != style->insideLink()) + if (currentElementLinkState() != style->insideLink()) return false; } return true; @@ -1036,7 +1050,7 @@ bool CSSStyleSelector::canShareStyleWithElement(Node* n) return false; } -RenderStyle* CSSStyleSelector::locateSharedStyle() +ALWAYS_INLINE RenderStyle* CSSStyleSelector::locateSharedStyle() { if (m_styledElement && !m_styledElement->inlineStyleDecl() && !m_styledElement->hasID() && !m_styledElement->document()->usesSiblingRules()) { // Check previous siblings. @@ -1118,13 +1132,13 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForDocument(Document* document) // If resolveForRootDefault is true, style based on user agent style sheet only. This is used in media queries, where // relative units are interpreted according to document root element style, styled only with UA stylesheet -PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyle* defaultParent, bool allowSharing, bool resolveForRootDefault, bool matchVisitedRules) +PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyle* defaultParent, bool allowSharing, bool resolveForRootDefault, bool helperCallForVisitedStyle) { // Once an element has a renderer, we don't try to destroy it, since otherwise the renderer // will vanish if a style recalc happens during loading. if (allowSharing && !e->document()->haveStylesheetsLoaded() && !e->renderer()) { if (!s_styleNotYetAvailable) { - s_styleNotYetAvailable = ::new RenderStyle; + s_styleNotYetAvailable = RenderStyle::create().releaseRef(); s_styleNotYetAvailable->ref(); s_styleNotYetAvailable->setDisplay(NONE); s_styleNotYetAvailable->font().update(m_fontSelector); @@ -1134,7 +1148,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl return s_styleNotYetAvailable; } - initElement(e); + initElement(e, helperCallForVisitedStyle); if (allowSharing) { RenderStyle* sharedStyle = locateSharedStyle(); if (sharedStyle) @@ -1144,7 +1158,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl // Compute our style allowing :visited to match first. RefPtr<RenderStyle> visitedStyle; - if (!matchVisitedRules && m_parentStyle && (m_parentStyle->insideLink() || e->isLink()) && e->document()->usesLinkRules()) { + if (!helperCallForVisitedStyle && m_parentStyle && (m_parentStyle->insideLink() || e->isLink()) && e->document()->usesLinkRules()) { // Fetch our parent style. RenderStyle* parentStyle = m_parentStyle; if (!e->isLink()) { @@ -1158,7 +1172,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl initForStyleResolve(e, defaultParent); } - m_checker.m_matchVisitedPseudoClass = matchVisitedRules; + m_checker.m_matchVisitedPseudoClass = helperCallForVisitedStyle; m_style = RenderStyle::create(); @@ -1169,7 +1183,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl if (e->isLink()) { m_style->setIsLink(true); - m_style->setInsideLink(m_checker.determineLinkState(e)); + m_style->setInsideLink(currentElementLinkState()); } if (simpleDefaultStyleSheet && !elementCanUseSimpleDefaultStyle(e)) @@ -1284,19 +1298,19 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl } // Reset the value back before applying properties, so that -webkit-link knows what color to use. - m_checker.m_matchVisitedPseudoClass = matchVisitedRules; + m_checker.m_matchVisitedPseudoClass = helperCallForVisitedStyle; // Now we have all of the matched rules in the appropriate order. Walk the rules and apply // high-priority properties first, i.e., those properties that other properties depend on. // The order is (1) high-priority not important, (2) high-priority important, (3) normal not important // and (4) normal important. m_lineHeightValue = 0; - applyDeclarations(true, false, 0, m_matchedDecls.size() - 1); + applyDeclarations<true>(false, 0, m_matchedDecls.size() - 1); if (!resolveForRootDefault) { - applyDeclarations(true, true, firstAuthorRule, lastAuthorRule); - applyDeclarations(true, true, firstUserRule, lastUserRule); + applyDeclarations<true>(true, firstAuthorRule, lastAuthorRule); + applyDeclarations<true>(true, firstUserRule, lastUserRule); } - applyDeclarations(true, true, firstUARule, lastUARule); + applyDeclarations<true>(true, firstUARule, lastUARule); // If our font got dirtied, go ahead and update it now. if (m_fontDirty) @@ -1307,18 +1321,18 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl applyProperty(CSSPropertyLineHeight, m_lineHeightValue); // Now do the normal priority UA properties. - applyDeclarations(false, false, firstUARule, lastUARule); + applyDeclarations<false>(false, firstUARule, lastUARule); // Cache our border and background so that we can examine them later. cacheBorderAndBackground(); // Now do the author and user normal priority properties and all the !important properties. if (!resolveForRootDefault) { - applyDeclarations(false, false, lastUARule + 1, m_matchedDecls.size() - 1); - applyDeclarations(false, true, firstAuthorRule, lastAuthorRule); - applyDeclarations(false, true, firstUserRule, lastUserRule); + applyDeclarations<false>(false, lastUARule + 1, m_matchedDecls.size() - 1); + applyDeclarations<false>(true, firstAuthorRule, lastAuthorRule); + applyDeclarations<false>(true, firstUserRule, lastUserRule); } - applyDeclarations(false, true, firstUARule, lastUARule); + applyDeclarations<false>(true, firstUARule, lastUARule); // If our font got dirtied by one of the non-essential font props, // go ahead and update it a second time. @@ -1382,7 +1396,7 @@ void CSSStyleSelector::keyframeStylesForAnimation(Element* e, const RenderStyle* // We don't need to bother with !important. Since there is only ever one // decl, there's nothing to override. So just add the first properties. - applyDeclarations(true, false, 0, m_matchedDecls.size() - 1); + applyDeclarations<true>(false, 0, m_matchedDecls.size() - 1); // If our font got dirtied, go ahead and update it now. if (m_fontDirty) @@ -1393,7 +1407,7 @@ void CSSStyleSelector::keyframeStylesForAnimation(Element* e, const RenderStyle* applyProperty(CSSPropertyLineHeight, m_lineHeightValue); // Now do rest of the properties. - applyDeclarations(false, false, 0, m_matchedDecls.size() - 1); + applyDeclarations<false>(false, 0, m_matchedDecls.size() - 1); // If our font got dirtied by one of the non-essential font props, // go ahead and update it a second time. @@ -1431,7 +1445,7 @@ void CSSStyleSelector::keyframeStylesForAnimation(Element* e, const RenderStyle* list.clear(); } -PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo, Element* e, RenderStyle* parentStyle, bool matchVisitedLinks) +PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo, Element* e, RenderStyle* parentStyle, bool helperCallForVisitedStyle) { if (!e) return 0; @@ -1439,7 +1453,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo, // Compute our :visited style first, so that we know whether or not we'll need to create a normal style just to hang it // off of. RefPtr<RenderStyle> visitedStyle; - if (!matchVisitedLinks && parentStyle && parentStyle->insideLink()) { + if (!helperCallForVisitedStyle && parentStyle && parentStyle->insideLink()) { // Fetch our parent style with :visited in effect. RenderStyle* parentVisitedStyle = parentStyle->getCachedPseudoStyle(VISITED_LINK); visitedStyle = pseudoStyleForElement(pseudo, e, parentVisitedStyle ? parentVisitedStyle : parentStyle, true); @@ -1447,11 +1461,11 @@ PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo, visitedStyle->setStyleType(VISITED_LINK); } - initElement(e); + initElement(e, helperCallForVisitedStyle); initForStyleResolve(e, parentStyle, pseudo); m_style = parentStyle; - m_checker.m_matchVisitedPseudoClass = matchVisitedLinks; + m_checker.m_matchVisitedPseudoClass = helperCallForVisitedStyle; // Since we don't use pseudo-elements in any of our quirk/print user agent rules, don't waste time walking // those rules. @@ -1477,13 +1491,13 @@ PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo, m_lineHeightValue = 0; // Reset the value back before applying properties, so that -webkit-link knows what color to use. - m_checker.m_matchVisitedPseudoClass = matchVisitedLinks; + m_checker.m_matchVisitedPseudoClass = helperCallForVisitedStyle; // High-priority properties. - applyDeclarations(true, false, 0, m_matchedDecls.size() - 1); - applyDeclarations(true, true, firstAuthorRule, lastAuthorRule); - applyDeclarations(true, true, firstUserRule, lastUserRule); - applyDeclarations(true, true, firstUARule, lastUARule); + applyDeclarations<true>(false, 0, m_matchedDecls.size() - 1); + applyDeclarations<true>(true, firstAuthorRule, lastAuthorRule); + applyDeclarations<true>(true, firstUserRule, lastUserRule); + applyDeclarations<true>(true, firstUARule, lastUARule); // If our font got dirtied, go ahead and update it now. if (m_fontDirty) @@ -1494,15 +1508,15 @@ PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo, applyProperty(CSSPropertyLineHeight, m_lineHeightValue); // Now do the normal priority properties. - applyDeclarations(false, false, firstUARule, lastUARule); + applyDeclarations<false>(false, firstUARule, lastUARule); // Cache our border and background so that we can examine them later. cacheBorderAndBackground(); - applyDeclarations(false, false, lastUARule + 1, m_matchedDecls.size() - 1); - applyDeclarations(false, true, firstAuthorRule, lastAuthorRule); - applyDeclarations(false, true, firstUserRule, lastUserRule); - applyDeclarations(false, true, firstUARule, lastUARule); + applyDeclarations<false>(false, lastUARule + 1, m_matchedDecls.size() - 1); + applyDeclarations<false>(true, firstAuthorRule, lastAuthorRule); + applyDeclarations<false>(true, firstUserRule, lastUserRule); + applyDeclarations<false>(true, firstUARule, lastUARule); // If our font got dirtied by one of the non-essential font props, // go ahead and update it a second time. @@ -2540,6 +2554,11 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme break; return true; } + case CSSSelector::PseudoLeftPage: + case CSSSelector::PseudoRightPage: + case CSSSelector::PseudoFirstPage: + // Page media related pseudo-classes are not handled yet. + return false; case CSSSelector::PseudoUnknown: case CSSSelector::PseudoNotParsed: default: @@ -2666,7 +2685,9 @@ CSSValue* CSSStyleSelector::resolveVariableDependentValue(CSSVariableDependentVa CSSRuleSet::CSSRuleSet() { m_universalRules = 0; + m_pageRules = 0; m_ruleCount = 0; + m_pageRuleCount = 0; } CSSRuleSet::~CSSRuleSet() @@ -2676,6 +2697,7 @@ CSSRuleSet::~CSSRuleSet() deleteAllValues(m_tagRules); delete m_universalRules; + delete m_pageRules; } @@ -2715,6 +2737,14 @@ void CSSRuleSet::addRule(CSSStyleRule* rule, CSSSelector* sel) m_universalRules->append(m_ruleCount++, rule, sel); } +void CSSRuleSet::addPageRule(CSSStyleRule* rule, CSSSelector* sel) +{ + if (!m_pageRules) + m_pageRules = new CSSRuleDataList(m_pageRuleCount++, rule, sel); + else + m_pageRules->append(m_pageRuleCount++, rule, sel); +} + void CSSRuleSet::addRulesFromSheet(CSSStyleSheet* sheet, const MediaQueryEvaluator& medium, CSSStyleSelector* styleSelector) { if (!sheet) @@ -2730,9 +2760,14 @@ void CSSRuleSet::addRulesFromSheet(CSSStyleSheet* sheet, const MediaQueryEvaluat for (int i = 0; i < len; i++) { StyleBase* item = sheet->item(i); if (item->isStyleRule()) { - CSSStyleRule* rule = static_cast<CSSStyleRule*>(item); - for (CSSSelector* s = rule->selectorList().first(); s; s = CSSSelectorList::next(s)) - addRule(rule, s); + if (item->isPageRule()) { + CSSPageRule* pageRule = static_cast<CSSPageRule*>(item); + addPageRule(pageRule, pageRule->selectorList().first()); + } else { + CSSStyleRule* rule = static_cast<CSSStyleRule*>(item); + for (CSSSelector* s = rule->selectorList().first(); s; s = CSSSelectorList::next(s)) + addRule(rule, s); + } } else if (item->isImportRule()) { CSSImportRule* import = static_cast<CSSImportRule*>(item); @@ -2806,8 +2841,8 @@ static Length convertToLength(CSSPrimitiveValue* primitiveValue, RenderStyle* st return l; } -void CSSStyleSelector::applyDeclarations(bool applyFirst, bool isImportant, - int startIndex, int endIndex) +template <bool applyFirst> +void CSSStyleSelector::applyDeclarations(bool isImportant, int startIndex, int endIndex) { if (startIndex == -1) return; @@ -2817,35 +2852,26 @@ void CSSStyleSelector::applyDeclarations(bool applyFirst, bool isImportant, CSSMutableStyleDeclaration::const_iterator end = decl->end(); for (CSSMutableStyleDeclaration::const_iterator it = decl->begin(); it != end; ++it) { const CSSProperty& current = *it; - // give special priority to font-xxx, color properties if (isImportant == current.isImportant()) { - bool first; - switch (current.id()) { - case CSSPropertyLineHeight: - m_lineHeightValue = current.value(); - first = !applyFirst; // we apply line-height later - break; - case CSSPropertyColor: - case CSSPropertyDirection: - case CSSPropertyDisplay: - case CSSPropertyFont: - case CSSPropertyFontSize: - case CSSPropertyFontStyle: - case CSSPropertyFontFamily: - case CSSPropertyFontWeight: - case CSSPropertyWebkitTextSizeAdjust: - case CSSPropertyFontVariant: - case CSSPropertyZoom: - // these have to be applied first, because other properties use the computed - // values of these properties. - first = true; - break; - default: - first = false; - break; + int property = current.id(); + + if (applyFirst) { + COMPILE_ASSERT(firstCSSProperty == CSSPropertyColor, CSS_color_is_first_property); + COMPILE_ASSERT(CSSPropertyZoom == CSSPropertyColor + 10, CSS_zoom_is_end_of_first_prop_range); + COMPILE_ASSERT(CSSPropertyLineHeight == CSSPropertyZoom + 1, CSS_line_height_is_after_zoom); + + // give special priority to font-xxx, color properties, etc + if (property <= CSSPropertyLineHeight) { + // we apply line-height later + if (property == CSSPropertyLineHeight) + m_lineHeightValue = current.value(); + else + applyProperty(current.id(), current.value()); + } + } else { + if (property > CSSPropertyLineHeight) + applyProperty(current.id(), current.value()); } - if (first == applyFirst) - applyProperty(current.id(), current.value()); } } } @@ -5294,6 +5320,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) case CSSPropertyWebkitTextStroke: case CSSPropertyWebkitVariableDeclarationBlock: return; +<<<<<<< HEAD:WebCore/css/CSSStyleSelector.cpp #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR case CSSPropertyWebkitTapHighlightColor: { HANDLE_INHERIT_AND_INITIAL(tapHighlightColor, TapHighlightColor); @@ -5305,6 +5332,25 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) return; } #endif +======= +#if ENABLE(WCSS) + case CSSPropertyWapInputFormat: + if (primitiveValue && m_element->hasTagName(WebCore::inputTag)) { + String mask = primitiveValue->getStringValue(); + static_cast<HTMLInputElement*>(m_element)->setWapInputFormat(mask); + } + return; + + case CSSPropertyWapInputRequired: + if (primitiveValue && m_element->isFormControlElement()) { + HTMLFormControlElement* element = static_cast<HTMLFormControlElement*>(m_element); + bool required = primitiveValue->getStringValue() == "true"; + element->setRequired(required); + } + return; +#endif + +>>>>>>> webkit.org at r58956:WebCore/css/CSSStyleSelector.cpp #if ENABLE(SVG) default: // Try the SVG properties diff --git a/WebCore/css/CSSStyleSelector.h b/WebCore/css/CSSStyleSelector.h index 80a186b..5089686 100644 --- a/WebCore/css/CSSStyleSelector.h +++ b/WebCore/css/CSSStyleSelector.h @@ -35,6 +35,7 @@ namespace WebCore { class CSSMutableStyleDeclaration; +class CSSPageRule; class CSSPrimitiveValue; class CSSProperty; class CSSFontFace; @@ -85,12 +86,11 @@ public: bool strictParsing, bool matchAuthorAndUserStyles); ~CSSStyleSelector(); - void initElement(Element*); void initForStyleResolve(Element*, RenderStyle* parentStyle = 0, PseudoId = NOPSEUDO); - PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle = 0, bool allowSharing = true, bool resolveForRootDefault = false, bool matchVisitedLinks = false); + PassRefPtr<RenderStyle> styleForElement(Element* e, RenderStyle* parentStyle = 0, bool allowSharing = true, bool resolveForRootDefault = false) { return styleForElement(e, parentStyle, allowSharing, resolveForRootDefault, false); } void keyframeStylesForAnimation(Element*, const RenderStyle*, KeyframeList& list); - PassRefPtr<RenderStyle> pseudoStyleForElement(PseudoId, Element*, RenderStyle* parentStyle = 0, bool matchVisitedLinks = false); + PassRefPtr<RenderStyle> pseudoStyleForElement(PseudoId pseudo, Element* e, RenderStyle* parentStyle = 0) { return pseudoStyleForElement(pseudo, e, parentStyle, false); } static PassRefPtr<RenderStyle> styleForDocument(Document*); @@ -101,6 +101,9 @@ public: #endif private: + PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle, bool allowSharing, bool resolveForRootDefault, bool helperCallForVisitedStyle); + PassRefPtr<RenderStyle> pseudoStyleForElement(PseudoId, Element*, RenderStyle*, bool helperCallForVisitedStyle); + void initElement(Element*, bool); RenderStyle* locateSharedStyle(); Node* locateCousinList(Element* parent, unsigned depth = 1); bool canShareStyleWithElement(Node*); @@ -155,6 +158,7 @@ public: void resolveVariablesForDeclaration(CSSMutableStyleDeclaration* decl, CSSMutableStyleDeclaration* newDecl, HashSet<String>& usedBlockVariables); void addKeyframeStyle(PassRefPtr<WebKitCSSKeyframesRule> rule); + void addPageStyle(PassRefPtr<CSSPageRule>); static bool createTransformOperations(CSSValue* inValue, RenderStyle* inStyle, RenderStyle* rootStyle, TransformOperations& outOperations); @@ -175,7 +179,8 @@ public: void matchRulesForList(CSSRuleDataList*, int& firstRuleIndex, int& lastRuleIndex); void sortMatchedRules(unsigned start, unsigned end); - void applyDeclarations(bool firstPass, bool important, int startIndex, int endIndex); + template <bool firstPass> + void applyDeclarations(bool important, int startIndex, int endIndex); CSSRuleSet* m_authorStyle; CSSRuleSet* m_userStyle; @@ -201,6 +206,7 @@ public: bool checkScrollbarPseudoClass(CSSSelector*, PseudoId& dynamicPseudo) const; EInsideLink determineLinkState(Element* element) const; + EInsideLink determineLinkStateSlowCase(Element* element) const; void allVisitedStateChanged(); void visitedStateChanged(LinkHash visitedHash); @@ -252,6 +258,19 @@ public: StyleImage* styleImage(CSSValue* value); + + EInsideLink currentElementLinkState() const + { + if (!m_haveCachedLinkState) { + m_cachedLinkState = m_checker.determineLinkState(m_element); + m_haveCachedLinkState = true; + } + return m_cachedLinkState; + } + + mutable EInsideLink m_cachedLinkState; + mutable bool m_haveCachedLinkState; + // 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 @@ -347,7 +366,7 @@ public: CSSRuleData* m_first; CSSRuleData* m_last; }; - + } // namespace WebCore #endif // CSSStyleSelector_h diff --git a/WebCore/css/CSSStyleSheet.cpp b/WebCore/css/CSSStyleSheet.cpp index fb25374..5949f96 100644 --- a/WebCore/css/CSSStyleSheet.cpp +++ b/WebCore/css/CSSStyleSheet.cpp @@ -28,7 +28,9 @@ #include "Document.h" #include "ExceptionCode.h" #include "Node.h" +#include "Page.h" #include "SecurityOrigin.h" +#include "Settings.h" #include "TextEncoding.h" #include <wtf/Deque.h> @@ -137,8 +139,23 @@ int CSSStyleSheet::addRule(const String& selector, const String& style, Exceptio PassRefPtr<CSSRuleList> CSSStyleSheet::cssRules(bool omitCharsetRules) { - if (doc() && !doc()->securityOrigin()->canRequest(baseURL())) - return 0; + if (doc() && !doc()->securityOrigin()->canRequest(baseURL())) { + + // The Safari welcome page runs afoul of the same-origin restriction on access to stylesheet rules + // that was added to address <https://bugs.webkit.org/show_bug.cgi?id=20527>. The following site- + // specific quirk relaxes this restriction for the particular cross-origin access that occurs on + // the Safari welcome page (<rdar://problem/7847573>). + + Settings* settings = doc()->settings(); + if (!settings || !settings->needsSiteSpecificQuirks()) + return 0; + + if (!equalIgnoringCase(baseURL().string(), "http://images.apple.com/safari/welcome/styles/safari.css")) + return 0; + + if (!doc()->url().string().contains("apple.com/safari/welcome/", false)) + return 0; + } return CSSRuleList::create(this, omitCharsetRules); } diff --git a/WebCore/css/CSSValueKeywords.in b/WebCore/css/CSSValueKeywords.in index 09d969a..06d966c 100644 --- a/WebCore/css/CSSValueKeywords.in +++ b/WebCore/css/CSSValueKeywords.in @@ -380,10 +380,15 @@ collapse # # Unordered rest # +a3 +a4 +a5 above absolute always avoid +b4 +b5 below bidi-override blink @@ -398,6 +403,9 @@ hide higher invert landscape +ledger +legal +letter level line-through local @@ -583,6 +591,7 @@ menulist-text menulist-textfield outer-spin-button progress-bar +progress-bar-value slider-horizontal slider-vertical sliderthumb-horizontal @@ -711,7 +720,8 @@ geometricPrecision sRGB # (-webkit-view-mode:) media feature: -mini floating -application fullscreen +maximized +minimized +windowed diff --git a/WebCore/css/MediaQueryEvaluator.cpp b/WebCore/css/MediaQueryEvaluator.cpp index ded40b5..20c7bb9 100644 --- a/WebCore/css/MediaQueryEvaluator.cpp +++ b/WebCore/css/MediaQueryEvaluator.cpp @@ -533,6 +533,9 @@ bool MediaQueryEvaluator::eval(const MediaQueryExp* expr) const if (!m_frame || !m_style) return m_expResult; + if (!expr->isValid()) + return false; + if (!gFunctionMap) createFunctionMap(); diff --git a/WebCore/css/MediaQueryExp.cpp b/WebCore/css/MediaQueryExp.cpp index 7ba6d84..53c0b73 100644 --- a/WebCore/css/MediaQueryExp.cpp +++ b/WebCore/css/MediaQueryExp.cpp @@ -37,6 +37,7 @@ namespace WebCore { MediaQueryExp::MediaQueryExp(const AtomicString& mediaFeature, CSSParserValueList* valueList) : m_mediaFeature(mediaFeature) , m_value(0) + , m_isValid(true) { if (valueList) { if (valueList->size() == 1) { @@ -73,6 +74,7 @@ MediaQueryExp::MediaQueryExp(const AtomicString& mediaFeature, CSSParserValueLis if (isValid) m_value = list.release(); } + m_isValid = m_value; } } diff --git a/WebCore/css/MediaQueryExp.h b/WebCore/css/MediaQueryExp.h index fd55cf6..9272402 100644 --- a/WebCore/css/MediaQueryExp.h +++ b/WebCore/css/MediaQueryExp.h @@ -52,6 +52,8 @@ public: || (other.m_value && m_value && other.m_value->cssText() == m_value->cssText())); } + bool isValid() const { return m_isValid; } + bool isViewportDependent() const { return m_mediaFeature == MediaFeatureNames::widthMediaFeature || m_mediaFeature == MediaFeatureNames::heightMediaFeature || m_mediaFeature == MediaFeatureNames::min_widthMediaFeature || @@ -65,6 +67,7 @@ public: private: AtomicString m_mediaFeature; RefPtr<CSSValue> m_value; + bool m_isValid; }; } // namespace diff --git a/WebCore/css/StyleBase.h b/WebCore/css/StyleBase.h index 5f9124d..521ee5d 100644 --- a/WebCore/css/StyleBase.h +++ b/WebCore/css/StyleBase.h @@ -54,6 +54,7 @@ namespace WebCore { virtual bool isKeyframesRule() { return false; } virtual bool isMediaRule() { return false; } virtual bool isVariablesRule() { return false; } + virtual bool isPageRule() { return false; } virtual bool isRule() { return false; } virtual bool isStyleRule() { return false; } diff --git a/WebCore/css/Media.cpp b/WebCore/css/StyleMedia.cpp index e238602..6cb662f 100644 --- a/WebCore/css/Media.cpp +++ b/WebCore/css/StyleMedia.cpp @@ -24,8 +24,8 @@ */ #include "config.h" +#include "StyleMedia.h" -#include "Media.h" #include "CSSStyleSelector.h" #include "Frame.h" #include "FrameView.h" @@ -34,12 +34,12 @@ namespace WebCore { -Media::Media(Frame* frame) +StyleMedia::StyleMedia(Frame* frame) : m_frame(frame) { } -String Media::type() const +String StyleMedia::type() const { FrameView* view = m_frame ? m_frame->view() : 0; if (view) @@ -48,7 +48,7 @@ String Media::type() const return String(); } -bool Media::matchMedium(const String& query) const +bool StyleMedia::matchMedium(const String& query) const { if (!m_frame) return false; diff --git a/WebCore/css/Media.h b/WebCore/css/StyleMedia.h index ee6961b..761e6a3 100644 --- a/WebCore/css/Media.h +++ b/WebCore/css/StyleMedia.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,18 +24,18 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef Media_h -#define Media_h +#ifndef StyleMedia_h +#define StyleMedia_h #include "DOMWindow.h" namespace WebCore { -class Media : public RefCounted<Media> { +class StyleMedia : public RefCounted<StyleMedia> { public: - static PassRefPtr<Media> create(Frame* frame) + static PassRefPtr<StyleMedia> create(Frame* frame) { - return adoptRef(new Media(frame)); + return adoptRef(new StyleMedia(frame)); } void disconnectFrame() { m_frame = 0; } @@ -42,13 +43,13 @@ public: String type() const; bool matchMedium(const String&) const; - + private: - Media(Frame*); + StyleMedia(Frame*); Frame* m_frame; }; } // namespace -#endif // Media_h +#endif // StyleMedia_h diff --git a/WebCore/css/Media.idl b/WebCore/css/StyleMedia.idl index 1bf5900..7be35cc 100644 --- a/WebCore/css/Media.idl +++ b/WebCore/css/StyleMedia.idl @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -24,7 +25,7 @@ */ module view { - interface Media { + interface StyleMedia { readonly attribute DOMString type; boolean matchMedium(in DOMString mediaquery); }; diff --git a/WebCore/css/WCSSPropertyNames.in b/WebCore/css/WCSSPropertyNames.in index 704209f..66be83b 100644 --- a/WebCore/css/WCSSPropertyNames.in +++ b/WebCore/css/WCSSPropertyNames.in @@ -1,3 +1,5 @@ +-wap-input-format +-wap-input-required -wap-marquee-dir -wap-marquee-loop -wap-marquee-speed diff --git a/WebCore/css/WebKitCSSMatrix.cpp b/WebCore/css/WebKitCSSMatrix.cpp index aaf5c3d..3714760 100644 --- a/WebCore/css/WebKitCSSMatrix.cpp +++ b/WebCore/css/WebKitCSSMatrix.cpp @@ -93,14 +93,14 @@ void WebKitCSSMatrix::setMatrixValue(const String& string, ExceptionCode& ec) ec = SYNTAX_ERR; } -// This is a multRight (this = this * secondMatrix) +// Perform a concatenation of the matrices (this * secondMatrix) PassRefPtr<WebKitCSSMatrix> WebKitCSSMatrix::multiply(WebKitCSSMatrix* secondMatrix) const { if (!secondMatrix) return 0; - TransformationMatrix tmp(m_matrix); - tmp.multiply(secondMatrix->m_matrix); + TransformationMatrix tmp(secondMatrix->m_matrix); + tmp.multiply(m_matrix); return WebKitCSSMatrix::create(tmp); } diff --git a/WebCore/css/html.css b/WebCore/css/html.css index 3f7818e..01103f4 100644 --- a/WebCore/css/html.css +++ b/WebCore/css/html.css @@ -362,12 +362,14 @@ input::-webkit-input-list-button { input::-webkit-inner-spin-button { -webkit-appearance: inner-spin-button; display: inline-block; + -webkit-user-select: none; } input::-webkit-outer-spin-button { -webkit-appearance: outer-spin-button; display: inline-block; margin-left: 2px; + -webkit-user-select: none; } textarea { diff --git a/WebCore/css/mathml.css b/WebCore/css/mathml.css index 8b4da3e..5c9038a 100644 --- a/WebCore/css/mathml.css +++ b/WebCore/css/mathml.css @@ -132,14 +132,23 @@ msqrt { mroot { display: inline-block; + position: relative; padding-top: 0.2em; padding-left: 0.2em; } mroot > * + * { font-size: 0.75em; - vertical-align: top; - padding-right: 0.3em; + vertical-align: bottom; + position: absolute; + left: 0px; + padding-right: 0.4em; + padding-left: 0.2em; + padding-bottom: 0.2em; +} + +mroot > * + mrow, mroot > * + mfenced { + padding-bottom: 0.4em; } mtable { diff --git a/WebCore/css/tokenizer.flex b/WebCore/css/tokenizer.flex index 3af725c..290c590 100644 --- a/WebCore/css/tokenizer.flex +++ b/WebCore/css/tokenizer.flex @@ -53,6 +53,22 @@ nth [\+-]?{intnum}*n([\+-]{intnum})? "@import" {BEGIN(mediaquery); yyTok = IMPORT_SYM; return yyTok;} "@page" {yyTok = PAGE_SYM; return yyTok;} +"@top-left-corner" {yyTok = TOPLEFTCORNER_SYM; return yyTok;} +"@top-left" {yyTok = TOPLEFT_SYM; return yyTok;} +"@top-center" {yyTok = TOPCENTER_SYM; return yyTok;} +"@top-right" {yyTok = TOPRIGHT_SYM; return yyTok;} +"@top-right-corner" {yyTok = TOPRIGHTCORNER_SYM; return yyTok;} +"@bottom-left-corner" {yyTok = BOTTOMLEFTCORNER_SYM; return yyTok;} +"@bottom-left" {yyTok = BOTTOMLEFT_SYM; return yyTok;} +"@bottom-center" {yyTok = BOTTOMCENTER_SYM; return yyTok;} +"@bottom-right" {yyTok = BOTTOMRIGHT_SYM; return yyTok;} +"@bottom-right-corner" {yyTok = BOTTOMRIGHTCORNER_SYM; return yyTok;} +"@left-top" {yyTok = LEFTTOP_SYM; return yyTok;} +"@left-middle" {yyTok = LEFTMIDDLE_SYM; return yyTok;} +"@left-bottom" {yyTok = LEFTBOTTOM_SYM; return yyTok;} +"@right-top" {yyTok = RIGHTTOP_SYM; return yyTok;} +"@right-middle" {yyTok = RIGHTMIDDLE_SYM; return yyTok;} +"@right-bottom" {yyTok = RIGHTBOTTOM_SYM; return yyTok;} "@media" {BEGIN(mediaquery); yyTok = MEDIA_SYM; return yyTok;} "@font-face" {yyTok = FONT_FACE_SYM; return yyTok;} "@charset" {yyTok = CHARSET_SYM; return yyTok;} diff --git a/WebCore/dom/CharacterData.cpp b/WebCore/dom/CharacterData.cpp index f5adb6c..9670988 100644 --- a/WebCore/dom/CharacterData.cpp +++ b/WebCore/dom/CharacterData.cpp @@ -29,13 +29,6 @@ namespace WebCore { -CharacterData::CharacterData(Document* document, const String& text, ConstructionType type) - : Node(document, type) - , m_data(text.impl() ? text.impl() : StringImpl::empty()) -{ - ASSERT(type == CreateOther || type == CreateText); -} - void CharacterData::setData(const String& data, ExceptionCode&) { StringImpl* dataImpl = data.impl() ? data.impl() : StringImpl::empty(); diff --git a/WebCore/dom/CharacterData.h b/WebCore/dom/CharacterData.h index 6c31933..5ca4b75 100644 --- a/WebCore/dom/CharacterData.h +++ b/WebCore/dom/CharacterData.h @@ -43,7 +43,12 @@ public: StringImpl* dataImpl() { return m_data.get(); } protected: - CharacterData(Document*, const String&, ConstructionType); + CharacterData(Document* document, const String& text, ConstructionType type) + : Node(document, type) + , m_data(text.impl() ? text.impl() : StringImpl::empty()) + { + ASSERT(type == CreateComment || type == CreateText); + } virtual bool rendererIsNeeded(RenderStyle*); diff --git a/WebCore/dom/ClassNodeList.cpp b/WebCore/dom/ClassNodeList.cpp index a7aefba..d482359 100644 --- a/WebCore/dom/ClassNodeList.cpp +++ b/WebCore/dom/ClassNodeList.cpp @@ -35,12 +35,18 @@ namespace WebCore { -ClassNodeList::ClassNodeList(PassRefPtr<Node> rootNode, const String& classNames, DynamicNodeList::Caches* caches) - : DynamicNodeList(rootNode, caches) +ClassNodeList::ClassNodeList(PassRefPtr<Node> rootNode, const String& classNames) + : DynamicNodeList(rootNode) , m_classNames(classNames, m_rootNode->document()->inCompatMode()) + , m_originalClassNames(classNames) { } +ClassNodeList::~ClassNodeList() +{ + m_rootNode->removeCachedClassNodeList(this, m_originalClassNames); +} + bool ClassNodeList::nodeMatches(Element* testNode) const { if (!testNode->hasClass()) diff --git a/WebCore/dom/ClassNodeList.h b/WebCore/dom/ClassNodeList.h index c519b3e..ea048a2 100644 --- a/WebCore/dom/ClassNodeList.h +++ b/WebCore/dom/ClassNodeList.h @@ -37,17 +37,20 @@ namespace WebCore { class ClassNodeList : public DynamicNodeList { public: - static PassRefPtr<ClassNodeList> create(PassRefPtr<Node> rootNode, const String& classNames, Caches* caches) + static PassRefPtr<ClassNodeList> create(PassRefPtr<Node> rootNode, const String& classNames) { - return adoptRef(new ClassNodeList(rootNode, classNames, caches)); + return adoptRef(new ClassNodeList(rootNode, classNames)); } + virtual ~ClassNodeList(); + private: - ClassNodeList(PassRefPtr<Node> rootNode, const String& classNames, Caches*); + ClassNodeList(PassRefPtr<Node> rootNode, const String& classNames); virtual bool nodeMatches(Element*) const; SpaceSplitString m_classNames; + String m_originalClassNames; }; } // namespace WebCore diff --git a/WebCore/dom/Comment.cpp b/WebCore/dom/Comment.cpp index 3dcde38..00f1724 100644 --- a/WebCore/dom/Comment.cpp +++ b/WebCore/dom/Comment.cpp @@ -22,10 +22,12 @@ #include "config.h" #include "Comment.h" +#include "Document.h" + namespace WebCore { inline Comment::Comment(Document* document, const String& text) - : CharacterData(document, text, CreateOther) + : CharacterData(document, text, CreateComment) { } diff --git a/WebCore/dom/Comment.h b/WebCore/dom/Comment.h index 680ffae..a0210c4 100644 --- a/WebCore/dom/Comment.h +++ b/WebCore/dom/Comment.h @@ -37,7 +37,6 @@ private: virtual String nodeName() const; virtual NodeType nodeType() const; virtual PassRefPtr<Node> cloneNode(bool deep); - virtual bool isCommentNode() const { return true; } virtual bool childTypeAllowed(NodeType); }; diff --git a/WebCore/dom/ContainerNode.cpp b/WebCore/dom/ContainerNode.cpp index f42b9cf..b063998 100644 --- a/WebCore/dom/ContainerNode.cpp +++ b/WebCore/dom/ContainerNode.cpp @@ -616,7 +616,7 @@ void ContainerNode::detach() { for (Node* child = m_firstChild; child; child = child->nextSibling()) child->detach(); - setChildNeedsStyleRecalc(false); + clearChildNeedsStyleRecalc(); Node::detach(); } @@ -633,7 +633,7 @@ void ContainerNode::removedFromDocument() Node::removedFromDocument(); if (document()->cssTarget() == this) document()->setCSSTarget(0); - setInDocument(false); + clearInDocument(); removedFromTree(false); for (Node* child = m_firstChild; child; child = child->nextSibling()) child->removedFromDocument(); diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp index ffbfd24..c6920bf 100644 --- a/WebCore/dom/Document.cpp +++ b/WebCore/dom/Document.cpp @@ -78,6 +78,7 @@ #include "HTMLParser.h" #include "HTMLStyleElement.h" #include "HTMLTitleElement.h" +#include "HTMLTokenizer.h" #include "HTTPParsers.h" #include "HistoryItem.h" #include "HitTestRequest.h" @@ -191,6 +192,9 @@ #endif #if ENABLE(TOUCH_EVENTS) +#if USE(V8) +#include "RuntimeEnabledFeatures.h" +#endif #include "TouchEvent.h" #endif @@ -219,6 +223,29 @@ namespace WebCore { using namespace HTMLNames; +class SynchronousHTMLTokenizerGuard { +public: + SynchronousHTMLTokenizerGuard(Tokenizer* tokenizer) + : m_htmlTokenizer(tokenizer->asHTMLTokenizer()) + , m_savedForceSynchronous(false) + { + if (m_htmlTokenizer) { + m_savedForceSynchronous = m_htmlTokenizer->forceSynchronous(); + m_htmlTokenizer->setForceSynchronous(true); + } + } + + ~SynchronousHTMLTokenizerGuard() + { + if (m_htmlTokenizer) + m_htmlTokenizer->setForceSynchronous(m_savedForceSynchronous); + } + +private: + HTMLTokenizer* m_htmlTokenizer; + bool m_savedForceSynchronous; +}; + // #define INSTRUMENT_LAYOUT_SCHEDULING 1 // This amount of time must have elapsed before we will even consider scheduling a layout without a delay. @@ -439,7 +466,7 @@ Document::Document(Frame* frame, bool isXHTML, bool isHTML) m_textColor = Color::black; m_listenerTypes = 0; - m_inDocument = true; + setInDocument(); m_inStyleRecalc = false; m_closeAfterStyleRecalc = false; @@ -1421,7 +1448,7 @@ void Document::recalcStyle(StyleChange change) bail_out: setNeedsStyleRecalc(NoStyleChange); - setChildNeedsStyleRecalc(false); + clearChildNeedsStyleRecalc(); unscheduleStyleRecalc(); if (view()) @@ -1997,8 +2024,11 @@ void Document::write(const SegmentedString& text, Document* ownerDocument) if (!m_tokenizer) open(ownerDocument); - ASSERT(m_tokenizer); - m_tokenizer->write(text, false); + { + ASSERT(m_tokenizer); + SynchronousHTMLTokenizerGuard tokenizerGuard(m_tokenizer.get()); + m_tokenizer->write(text, false); + } #ifdef INSTRUMENT_LAYOUT_SCHEDULING if (!ownerElement()) @@ -2891,7 +2921,7 @@ bool Document::setFocusedNode(PassRefPtr<Node> newFocusedNode) m_focusedNode = 0; // Remove focus from the existing focus node (if any) - if (oldFocusedNode && !oldFocusedNode->m_inDetach) { + if (oldFocusedNode && !oldFocusedNode->inDetach()) { if (oldFocusedNode->active()) oldFocusedNode->setActive(false); @@ -2927,6 +2957,14 @@ bool Document::setFocusedNode(PassRefPtr<Node> newFocusedNode) if (oldFocusedNode == oldFocusedNode->rootEditableElement()) frame()->editor()->didEndEditing(); + + if (view()) { + Widget* oldWidget = widgetForNode(oldFocusedNode.get()); + if (oldWidget) + oldWidget->setFocus(false); + else + view()->setFocus(false); + } } if (newFocusedNode) { @@ -2954,7 +2992,7 @@ bool Document::setFocusedNode(PassRefPtr<Node> newFocusedNode) focusChangeBlocked = true; goto SetFocusedNodeDone; } - m_focusedNode->setFocus(); + m_focusedNode->setFocus(true); if (m_focusedNode == m_focusedNode->rootEditableElement()) frame()->editor()->didBeginEditing(); @@ -2972,9 +3010,9 @@ bool Document::setFocusedNode(PassRefPtr<Node> newFocusedNode) focusWidget = widgetForNode(m_focusedNode.get()); } if (focusWidget) - focusWidget->setFocus(); + focusWidget->setFocus(true); else - view()->setFocus(); + view()->setFocus(true); } } @@ -3212,7 +3250,11 @@ PassRefPtr<Event> Document::createEvent(const String& eventType, ExceptionCode& event = SVGZoomEvent::create(); #endif #if ENABLE(TOUCH_EVENTS) +#if USE(V8) + else if (eventType == "TouchEvent" && RuntimeEnabledFeatures::touchEnabled()) +#else else if (eventType == "TouchEvent") +#endif event = TouchEvent::create(); #endif if (event) @@ -4543,6 +4585,8 @@ void Document::setIconURL(const String& iconURL, const String& type) m_iconURL = iconURL; else if (!type.isEmpty()) m_iconURL = iconURL; + if (Frame* f = frame()) + f->loader()->setIconURL(m_iconURL); } void Document::setUseSecureKeyboardEntryWhenActive(bool usesSecureKeyboard) @@ -4900,10 +4944,9 @@ void Document::enqueuePageshowEvent(PageshowEventPersistence persisted) void Document::enqueueHashchangeEvent(const String& /*oldURL*/, const String& /*newURL*/) { - // FIXME: https://bugs.webkit.org/show_bug.cgi?id=36201 Hashchange event needs to fire asynchronously. // FIXME: https://bugs.webkit.org/show_bug.cgi?id=36335 Hashchange event is now its own interface and takes two // URL arguments which we need to pass in here. - dispatchWindowEvent(Event::create(eventNames().hashchangeEvent, false, false)); + enqueueEvent(Event::create(eventNames().hashchangeEvent, false, false)); } void Document::enqueuePopstateEvent(PassRefPtr<SerializedScriptValue> stateObject) @@ -4921,7 +4964,7 @@ bool Document::isXHTMLMPDocument() const // MUST accept XHTMLMP document identified as "application/vnd.wap.xhtml+xml" // and SHOULD accept it identified as "application/xhtml+xml" , "application/xhtml+xml" is a // general MIME type for all XHTML documents, not only for XHTMLMP - return frame()->loader()->responseMIMEType() == "application/vnd.wap.xhtml+xml"; + return frame()->loader()->writer()->mimeType() == "application/vnd.wap.xhtml+xml"; } #endif diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h index 6ac1f01..45031c3 100644 --- a/WebCore/dom/Document.h +++ b/WebCore/dom/Document.h @@ -958,6 +958,7 @@ public: #endif virtual bool isContextThread() const; + virtual bool isJSExecutionTerminated() const { return false; } void setUsingGeolocation(bool f) { m_usingGeolocation = f; } bool usingGeolocation() const { return m_usingGeolocation; }; @@ -1264,6 +1265,22 @@ inline bool Node::isDocumentNode() const return this == m_document; } +// here because it uses a Document method but we really want to inline it +inline Node::Node(Document* document, ConstructionType type) + : TreeShared<Node>(initialRefCount(type)) + , m_document(document) + , m_previous(0) + , m_next(0) + , m_renderer(0) + , m_nodeFlags(type) +{ + if (m_document) + m_document->selfOnlyRef(); +#if !defined(NDEBUG) || (defined(DUMP_NODE_STATISTICS) && DUMP_NODE_STATISTICS) + trackForDebugging(); +#endif +} + } // namespace WebCore #endif // Document_h diff --git a/WebCore/dom/Document.idl b/WebCore/dom/Document.idl index 88bd639..cd877b3 100644 --- a/WebCore/dom/Document.idl +++ b/WebCore/dom/Document.idl @@ -306,10 +306,10 @@ module core { attribute [DontEnum] EventListener onreset; attribute [DontEnum] EventListener onsearch; attribute [DontEnum] EventListener onselectstart; - attribute [DontEnum,Conditional=TOUCH_EVENTS] EventListener ontouchstart; - attribute [DontEnum,Conditional=TOUCH_EVENTS] EventListener ontouchmove; - attribute [DontEnum,Conditional=TOUCH_EVENTS] EventListener ontouchend; - attribute [DontEnum,Conditional=TOUCH_EVENTS] EventListener ontouchcancel; + attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchstart; + attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchmove; + attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchend; + attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchcancel; #endif }; diff --git a/WebCore/dom/DocumentFragment.cpp b/WebCore/dom/DocumentFragment.cpp index 3663e99..f7df8f6 100644 --- a/WebCore/dom/DocumentFragment.cpp +++ b/WebCore/dom/DocumentFragment.cpp @@ -23,6 +23,8 @@ #include "config.h" #include "DocumentFragment.h" +#include "Document.h" + namespace WebCore { inline DocumentFragment::DocumentFragment(Document* document) diff --git a/WebCore/dom/EditingText.cpp b/WebCore/dom/EditingText.cpp index b36931a..e412ad6 100644 --- a/WebCore/dom/EditingText.cpp +++ b/WebCore/dom/EditingText.cpp @@ -20,6 +20,8 @@ #include "config.h" #include "EditingText.h" +#include "Document.h" + // FIXME: Does this really require a class? Perhaps instead any text node // inside an editable element could have the "always create a renderer" behavior. diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp index 3363e95..171a869 100644 --- a/WebCore/dom/Element.cpp +++ b/WebCore/dom/Element.cpp @@ -64,12 +64,6 @@ namespace WebCore { using namespace HTMLNames; using namespace XMLNames; -Element::Element(const QualifiedName& tagName, Document* document, ConstructionType type) - : ContainerNode(document, type) - , m_tagName(tagName) -{ -} - PassRefPtr<Element> Element::create(const QualifiedName& tagName, Document* document) { return adoptRef(new Element(tagName, document, CreateElement)); @@ -161,12 +155,12 @@ PassRefPtr<Element> Element::cloneElementWithoutChildren() // This is a sanity check as HTML overloads some of the DOM methods. ASSERT(isHTMLElement() == clone->isHTMLElement()); - clone->copyNonAttributeProperties(this); - // Clone attributes. if (namedAttrMap) clone->attributes()->setAttributes(*attributes(true)); // Call attributes(true) to force attribute synchronization to occur (for svg and style) before cloning happens. + clone->copyNonAttributeProperties(this); + return clone.release(); } @@ -225,11 +219,11 @@ bool Element::hasAttribute(const QualifiedName& name) const const AtomicString& Element::getAttribute(const QualifiedName& name) const { - if (name == styleAttr && !m_isStyleAttributeValid) + if (name == styleAttr && !isStyleAttributeValid()) updateStyleAttribute(); #if ENABLE(SVG) - if (!m_areSVGAttributesValid) + if (!areSVGAttributesValid()) updateAnimatedSVGAttribute(name); #endif @@ -532,11 +526,11 @@ const AtomicString& Element::getAttribute(const String& name) const bool ignoreCase = shouldIgnoreAttributeCase(this); // Update the 'style' attribute if it's invalid and being requested: - if (!m_isStyleAttributeValid && equalPossiblyIgnoringCase(name, styleAttr.localName(), ignoreCase)) + if (!isStyleAttributeValid() && equalPossiblyIgnoringCase(name, styleAttr.localName(), ignoreCase)) updateStyleAttribute(); #if ENABLE(SVG) - if (!m_areSVGAttributesValid) { + if (!areSVGAttributesValid()) { // We're not passing a namespace argument on purpose. SVGNames::*Attr are defined w/o namespaces as well. updateAnimatedSVGAttribute(QualifiedName(nullAtom, name, nullAtom)); } @@ -583,7 +577,7 @@ void Element::setAttribute(const AtomicString& name, const AtomicString& value, #if ENABLE(INSPECTOR) if (Page* page = document()->page()) { if (InspectorController* inspectorController = page->inspectorController()) { - if (!m_synchronizingStyleAttribute) + if (!isSynchronizingStyleAttribute()) inspectorController->didModifyDOMAttr(this); } } @@ -612,7 +606,7 @@ void Element::setAttribute(const QualifiedName& name, const AtomicString& value, #if ENABLE(INSPECTOR) if (Page* page = document()->page()) { if (InspectorController* inspectorController = page->inspectorController()) { - if (!m_synchronizingStyleAttribute) + if (!isSynchronizingStyleAttribute()) inspectorController->didModifyDOMAttr(this); } } @@ -718,11 +712,11 @@ void Element::setAttributeMap(PassRefPtr<NamedNodeMap> list, FragmentScriptingPe bool Element::hasAttributes() const { - if (!m_isStyleAttributeValid) + if (!isStyleAttributeValid()) updateStyleAttribute(); #if ENABLE(SVG) - if (!m_areSVGAttributesValid) + if (!areSVGAttributesValid()) updateAnimatedSVGAttribute(anyQName()); #endif @@ -916,7 +910,7 @@ void Element::recalcStyle(StyleChange change) attach(); // FIXME: The style gets computed twice by calling attach. We could do better if we passed the style along. // attach recalulates the style for all children. No need to do it twice. setNeedsStyleRecalc(NoStyleChange); - setChildNeedsStyleRecalc(false); + clearChildNeedsStyleRecalc(); return; } @@ -982,7 +976,7 @@ void Element::recalcStyle(StyleChange change) } setNeedsStyleRecalc(NoStyleChange); - setChildNeedsStyleRecalc(false); + clearChildNeedsStyleRecalc(); } bool Element::childTypeAllowed(NodeType type) @@ -1091,7 +1085,7 @@ void Element::childrenChanged(bool changedByParser, Node* beforeChange, Node* af void Element::finishParsingChildren() { ContainerNode::finishParsingChildren(); - m_parsingChildrenFinished = true; + setIsParsingChildrenFinished(); checkForSiblingStyleChanges(this, renderStyle(), true, lastChild(), 0, 0); } diff --git a/WebCore/dom/Element.h b/WebCore/dom/Element.h index eefaeb1..3d02f1b 100644 --- a/WebCore/dom/Element.h +++ b/WebCore/dom/Element.h @@ -29,6 +29,7 @@ #include "Document.h" #include "HTMLNames.h" #include "MappedAttributeEntry.h" +#include "NamedNodeMap.h" #include "QualifiedName.h" #include "ScrollTypes.h" @@ -236,9 +237,9 @@ public: // Use Document::registerForMediaVolumeCallbacks() to subscribe to this virtual void mediaVolumeDidChange() { } - bool isFinishedParsingChildren() const { return m_parsingChildrenFinished; } + bool isFinishedParsingChildren() const { return isParsingChildrenFinished(); } virtual void finishParsingChildren(); - virtual void beginParsingChildren() { m_parsingChildrenFinished = false; } + virtual void beginParsingChildren() { clearIsParsingChildrenFinished(); } // ElementTraversal API Element* firstElementChild() const; @@ -252,6 +253,7 @@ public: virtual bool isFormControlElement() const { return false; } virtual bool isEnabledFormControl() const { return true; } virtual bool isReadOnlyFormControl() const { return false; } + virtual bool isSpinButtonElement() const { return false; } virtual bool isTextFormControl() const { return false; } virtual bool isOptionalFormControl() const { return false; } virtual bool isRequiredFormControl() const { return false; } @@ -272,7 +274,11 @@ public: virtual void dispatchFormControlChangeEvent() { } protected: - Element(const QualifiedName&, Document*, ConstructionType); + Element(const QualifiedName& tagName, Document* document, ConstructionType type) + : ContainerNode(document, type) + , m_tagName(tagName) + { + } virtual void insertedIntoDocument(); virtual void removedFromDocument(); @@ -356,11 +362,11 @@ inline const QualifiedName& Element::idAttributeName() const inline NamedNodeMap* Element::attributes(bool readonly) const { - if (!m_isStyleAttributeValid) + if (!isStyleAttributeValid()) updateStyleAttribute(); #if ENABLE(SVG) - if (!m_areSVGAttributesValid) + if (!areSVGAttributesValid()) updateAnimatedSVGAttribute(anyQName()); #endif diff --git a/WebCore/dom/Element.idl b/WebCore/dom/Element.idl index 1368503..977d15a 100644 --- a/WebCore/dom/Element.idl +++ b/WebCore/dom/Element.idl @@ -195,10 +195,10 @@ module core { attribute [DontEnum] EventListener onreset; attribute [DontEnum] EventListener onsearch; attribute [DontEnum] EventListener onselectstart; - attribute [DontEnum,Conditional=TOUCH_EVENTS] EventListener ontouchstart; - attribute [DontEnum,Conditional=TOUCH_EVENTS] EventListener ontouchmove; - attribute [DontEnum,Conditional=TOUCH_EVENTS] EventListener ontouchend; - attribute [DontEnum,Conditional=TOUCH_EVENTS] EventListener ontouchcancel; + attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchstart; + attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchmove; + attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchend; + attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchcancel; #endif }; diff --git a/WebCore/dom/EntityReference.cpp b/WebCore/dom/EntityReference.cpp index c4c292a..72944ec 100644 --- a/WebCore/dom/EntityReference.cpp +++ b/WebCore/dom/EntityReference.cpp @@ -21,6 +21,8 @@ #include "config.h" #include "EntityReference.h" +#include "Document.h" + namespace WebCore { inline EntityReference::EntityReference(Document* document, const String& entityName) diff --git a/WebCore/dom/EventNames.h b/WebCore/dom/EventNames.h index c50cfb2..ca2ae96 100644 --- a/WebCore/dom/EventNames.h +++ b/WebCore/dom/EventNames.h @@ -159,6 +159,8 @@ namespace WebCore { \ macro(success) \ \ + macro(loadend) \ + \ // end of DOM_EVENT_NAMES_FOR_EACH class EventNames : public Noncopyable { diff --git a/WebCore/dom/EventTarget.cpp b/WebCore/dom/EventTarget.cpp index 1598790..91a5d0c 100644 --- a/WebCore/dom/EventTarget.cpp +++ b/WebCore/dom/EventTarget.cpp @@ -156,6 +156,13 @@ Notification* EventTarget::toNotification() } #endif +#if ENABLE(FILE_READER) +FileReader* EventTarget::toFileReader() +{ + return 0; +} +#endif + bool EventTarget::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture) { EventTargetData* d = ensureEventTargetData(); diff --git a/WebCore/dom/EventTarget.h b/WebCore/dom/EventTarget.h index da98d98..96d2d29 100644 --- a/WebCore/dom/EventTarget.h +++ b/WebCore/dom/EventTarget.h @@ -48,6 +48,7 @@ namespace WebCore { class Event; class EventListener; class EventSource; + class FileReader; class MessagePort; class Node; class Notification; @@ -118,6 +119,9 @@ namespace WebCore { #if ENABLE(NOTIFICATIONS) virtual Notification* toNotification(); #endif +#if ENABLE(FILE_READER) + virtual FileReader* toFileReader(); +#endif virtual ScriptExecutionContext* scriptExecutionContext() const = 0; diff --git a/WebCore/dom/ExceptionCode.h b/WebCore/dom/ExceptionCode.h index 573fb36..a5618f8 100644 --- a/WebCore/dom/ExceptionCode.h +++ b/WebCore/dom/ExceptionCode.h @@ -58,6 +58,13 @@ namespace WebCore { ABORT_ERR = 20, URL_MISMATCH_ERR = 21, QUOTA_EXCEEDED_ERR = 22, + + // Introduced in File API: + // http://www.w3.org/TR/file-upload/#dfn-fileerror +#if ENABLE(FILE_READER) || ENABLE(FILE_WRITER) + NOT_READABLE_ERR = 24, + ENCODING_ERR = 26, +#endif }; enum ExceptionType { diff --git a/WebCore/dom/InputElement.cpp b/WebCore/dom/InputElement.cpp index 52812f9..3459906 100644 --- a/WebCore/dom/InputElement.cpp +++ b/WebCore/dom/InputElement.cpp @@ -22,6 +22,15 @@ #include "InputElement.h" #include "BeforeTextInsertedEvent.h" + +#if ENABLE(WCSS) +#include "CSSPropertyNames.h" +#include "CSSRule.h" +#include "CSSRuleList.h" +#include "CSSStyleRule.h" +#include "CSSStyleSelector.h" +#endif + #include "Chrome.h" #include "ChromeClient.h" #include "Document.h" @@ -138,6 +147,14 @@ void InputElement::setValueFromRenderer(InputElementData& data, InputElement* in String InputElement::sanitizeValue(const InputElement* inputElement, const String& proposedValue) { +#if ENABLE(WCSS) + InputElementData data = const_cast<InputElement*>(inputElement)->data(); + if (!isConformToInputMask(data, proposedValue)) { + if (isConformToInputMask(data, data.value())) + return data.value(); + return String(); + } +#endif return InputElement::sanitizeUserInputValue(inputElement, proposedValue, s_maximumLength); } @@ -172,8 +189,12 @@ void InputElement::handleBeforeTextInsertedEvent(InputElementData& data, InputEl // RenderTextControlSingleLine::subtreeHasChanged() in some cases. unsigned oldLength = numGraphemeClusters(toRenderTextControlSingleLine(element->renderer())->text()); - // selection() may be a pre-edit text. - unsigned selectionLength = numGraphemeClusters(plainText(element->document()->frame()->selection()->selection().toNormalizedRange().get())); + // selectionLength represents the selection length of this text field to be + // removed by this insertion. + // If the text field has no focus, we don't need to take account of the + // selection length. The selection is the source of text drag-and-drop in + // that case, and nothing in the text field will be removed. + unsigned selectionLength = element->focused() ? numGraphemeClusters(plainText(element->document()->frame()->selection()->selection().toNormalizedRange().get())) : 0; ASSERT(oldLength >= selectionLength); // Selected characters will be removed by the next text event. @@ -183,6 +204,18 @@ void InputElement::handleBeforeTextInsertedEvent(InputElementData& data, InputEl // Truncate the inserted text to avoid violating the maxLength and other constraints. BeforeTextInsertedEvent* textEvent = static_cast<BeforeTextInsertedEvent*>(event); +#if ENABLE(WCSS) + RefPtr<Range> range = element->document()->frame()->selection()->selection().toNormalizedRange(); + String candidateString = toRenderTextControlSingleLine(element->renderer())->text(); + if (selectionLength) + candidateString.replace(range->startOffset(), range->endOffset(), textEvent->text()); + else + candidateString.insert(textEvent->text(), range->startOffset()); + if (!isConformToInputMask(inputElement->data(), candidateString)) { + textEvent->setText(""); + return; + } +#endif textEvent->setText(sanitizeUserInputValue(inputElement, textEvent->text(), appendableLength)); } @@ -234,6 +267,10 @@ InputElementData::InputElementData() , m_maxLength(InputElement::s_maximumLength) , m_cachedSelectionStart(-1) , m_cachedSelectionEnd(-1) +#if ENABLE(WCSS) + , m_inputFormatMask("*m") + , m_maxInputCharsAllowed(InputElement::s_maximumLength) +#endif { } @@ -255,4 +292,137 @@ InputElement* toInputElement(Element* element) return 0; } +#if ENABLE(WCSS) +static inline const AtomicString& formatCodes() +{ + DEFINE_STATIC_LOCAL(AtomicString, codes, ("AaNnXxMm")); + return codes; +} + +static unsigned cursorPositionToMaskIndex(const String& inputFormatMask, unsigned cursorPosition) +{ + UChar mask; + int index = -1; + do { + mask = inputFormatMask[++index]; + if (mask == '\\') + ++index; + else if (mask == '*' || (isASCIIDigit(mask) && mask != '0')) { + index = inputFormatMask.length() - 1; + break; + } + } while (cursorPosition--); + + return index; +} + +bool InputElement::isConformToInputMask(const InputElementData& data, const String& inputChars) +{ + for (unsigned i = 0; i < inputChars.length(); ++i) + if (!isConformToInputMask(data, inputChars[i], i)) + return false; + return true; +} + +bool InputElement::isConformToInputMask(const InputElementData& data, UChar inChar, unsigned cursorPosition) +{ + String inputFormatMask = data.inputFormatMask(); + + if (inputFormatMask.isEmpty() || inputFormatMask == "*M" || inputFormatMask == "*m") + return true; + + if (cursorPosition >= data.maxInputCharsAllowed()) + return false; + + unsigned maskIndex = cursorPositionToMaskIndex(inputFormatMask, cursorPosition); + bool ok = true; + UChar mask = inputFormatMask[maskIndex]; + // Match the inputed character with input mask + switch (mask) { + case 'A': + ok = !isASCIIDigit(inChar) && !isASCIILower(inChar) && isASCIIPrintable(inChar); + break; + case 'a': + ok = !isASCIIDigit(inChar) && !isASCIIUpper(inChar) && isASCIIPrintable(inChar); + break; + case 'N': + ok = isASCIIDigit(inChar); + break; + case 'n': + ok = !isASCIIAlpha(inChar) && isASCIIPrintable(inChar); + break; + case 'X': + ok = !isASCIILower(inChar) && isASCIIPrintable(inChar); + break; + case 'x': + ok = !isASCIIUpper(inChar) && isASCIIPrintable(inChar); + break; + case 'M': + case 'm': + ok = isASCIIPrintable(inChar); + break; + default: + ok = (mask == inChar); + break; + } + + return ok; +} + +String InputElement::validateInputMask(InputElementData& data, String& inputMask) +{ + inputMask.replace("\\\\", "\\"); + + bool isValid = true; + bool hasWildcard = false; + unsigned escapeCharCount = 0; + unsigned maskLength = inputMask.length(); + UChar formatCode; + for (unsigned i = 0; i < maskLength; ++i) { + formatCode = inputMask[i]; + if (formatCodes().find(formatCode) == -1) { + if (formatCode == '*' || (isASCIIDigit(formatCode) && formatCode != '0')) { + // Validate codes which ends with '*f' or 'nf' + formatCode = inputMask[++i]; + if ((i + 1 != maskLength) || formatCodes().find(formatCode) == -1) { + isValid = false; + break; + } + hasWildcard = true; + } else if (formatCode == '\\') { + // skip over the next mask character + ++i; + ++escapeCharCount; + } else { + isValid = false; + break; + } + } + } + + if (!isValid) + return String(); + // calculate the number of characters allowed to be entered by input mask + unsigned allowedLength = maskLength; + if (escapeCharCount) + allowedLength -= escapeCharCount; + + if (hasWildcard) { + formatCode = inputMask[maskLength - 2]; + if (formatCode == '*') + allowedLength = data.maxInputCharsAllowed(); + else { + unsigned leftLen = String(&formatCode).toInt(); + allowedLength = leftLen + allowedLength - 2; + } + } + + if (allowedLength < data.maxInputCharsAllowed()) + data.setMaxInputCharsAllowed(allowedLength); + + return inputMask; +} + +#endif + } diff --git a/WebCore/dom/InputElement.h b/WebCore/dom/InputElement.h index a24b438..bdd5645 100644 --- a/WebCore/dom/InputElement.h +++ b/WebCore/dom/InputElement.h @@ -43,6 +43,7 @@ public: virtual bool isPasswordField() const = 0; virtual bool isSearchField() const = 0; virtual bool isTextField() const = 0; + virtual bool hasSpinButton() const { return false; } virtual bool searchEventsShouldBeDispatched() const = 0; @@ -57,6 +58,10 @@ public: virtual void cacheSelection(int start, int end) = 0; virtual void select() = 0; + +#if ENABLE(WCSS) + virtual InputElementData data() const = 0; +#endif static const int s_maximumLength; static const int s_defaultSize; @@ -79,6 +84,11 @@ protected: static void parseMaxLengthAttribute(InputElementData&, InputElement*, Element*, MappedAttribute*); static void updateValueIfNeeded(InputElementData&, InputElement*); static void notifyFormStateChanged(Element*); +#if ENABLE(WCSS) + static bool isConformToInputMask(const InputElementData&, const String&); + static bool isConformToInputMask(const InputElementData&, UChar, unsigned); + static String validateInputMask(InputElementData&, String&); +#endif }; // HTML/WMLInputElement hold this struct as member variable @@ -108,6 +118,15 @@ public: int cachedSelectionEnd() const { return m_cachedSelectionEnd; } void setCachedSelectionEnd(int value) { m_cachedSelectionEnd = value; } +#if ENABLE(WCSS) + String inputFormatMask() const { return m_inputFormatMask; } + void setInputFormatMask(const String& mask) { m_inputFormatMask = mask; } + + unsigned maxInputCharsAllowed() const { return m_maxInputCharsAllowed; } + void setMaxInputCharsAllowed(unsigned maxLength) { m_maxInputCharsAllowed = maxLength; } + +#endif + private: AtomicString m_name; String m_value; @@ -116,6 +135,10 @@ private: int m_maxLength; int m_cachedSelectionStart; int m_cachedSelectionEnd; +#if ENABLE(WCSS) + String m_inputFormatMask; + unsigned m_maxInputCharsAllowed; +#endif }; InputElement* toInputElement(Element*); diff --git a/WebCore/dom/MessagePort.idl b/WebCore/dom/MessagePort.idl index 9312430..7bde45e 100644 --- a/WebCore/dom/MessagePort.idl +++ b/WebCore/dom/MessagePort.idl @@ -43,12 +43,12 @@ module events { attribute EventListener onmessage; // EventTarget interface - [JSCCustom] void addEventListener(in DOMString type, - in EventListener listener, - in boolean useCapture); - [JSCCustom] void removeEventListener(in DOMString type, - in EventListener listener, - in boolean useCapture); + void addEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); + void removeEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); boolean dispatchEvent(in Event evt) raises(EventException); #endif diff --git a/WebCore/dom/NameNodeList.cpp b/WebCore/dom/NameNodeList.cpp index 4d96de0..2ffa577 100644 --- a/WebCore/dom/NameNodeList.cpp +++ b/WebCore/dom/NameNodeList.cpp @@ -31,12 +31,17 @@ namespace WebCore { using namespace HTMLNames; -NameNodeList::NameNodeList(PassRefPtr<Node> rootNode, const String& name, DynamicNodeList::Caches* caches) - : DynamicNodeList(rootNode, caches) +NameNodeList::NameNodeList(PassRefPtr<Node> rootNode, const String& name) + : DynamicNodeList(rootNode) , m_nodeName(name) { } +NameNodeList::~NameNodeList() +{ + m_rootNode->removeCachedNameNodeList(this, m_nodeName); +} + bool NameNodeList::nodeMatches(Element* testNode) const { return testNode->getAttribute(nameAttr) == m_nodeName; diff --git a/WebCore/dom/NameNodeList.h b/WebCore/dom/NameNodeList.h index 2fdb43d..4f109b4 100644 --- a/WebCore/dom/NameNodeList.h +++ b/WebCore/dom/NameNodeList.h @@ -34,13 +34,15 @@ namespace WebCore { // NodeList which lists all Nodes in a Element with a given "name" attribute class NameNodeList : public DynamicNodeList { public: - static PassRefPtr<NameNodeList> create(PassRefPtr<Node> rootNode, const String& name, Caches* caches) + static PassRefPtr<NameNodeList> create(PassRefPtr<Node> rootNode, const String& name) { - return adoptRef(new NameNodeList(rootNode, name, caches)); + return adoptRef(new NameNodeList(rootNode, name)); } + virtual ~NameNodeList(); + private: - NameNodeList(PassRefPtr<Node> rootNode, const String& name, Caches*); + NameNodeList(PassRefPtr<Node> rootNode, const String& name); virtual bool nodeMatches(Element*) const; diff --git a/WebCore/dom/Node.cpp b/WebCore/dom/Node.cpp index a8ffc37..83aef21 100644 --- a/WebCore/dom/Node.cpp +++ b/WebCore/dom/Node.cpp @@ -103,8 +103,13 @@ #include "HTMLNoScriptElement.h" #endif +<<<<<<< HEAD:WebCore/dom/Node.cpp #if ENABLE(TOUCH_EVENTS) #include "ChromeClient.h" +======= +#if USE(JSC) +#include <runtime/JSGlobalData.h> +>>>>>>> webkit.org at r58956:WebCore/dom/Node.cpp #endif #define DUMP_NODE_STATISTICS 0 @@ -339,99 +344,8 @@ Node::StyleChange Node::diff(const RenderStyle* s1, const RenderStyle* s2) return ch; } -inline bool Node::initialRefCount(ConstructionType type) -{ - switch (type) { - case CreateContainer: - case CreateElement: - case CreateOther: - case CreateText: - return 1; - case CreateElementZeroRefCount: - return 0; - } - ASSERT_NOT_REACHED(); - return 1; -} - -inline bool Node::isContainer(ConstructionType type) +void Node::trackForDebugging() { - switch (type) { - case CreateContainer: - case CreateElement: - case CreateElementZeroRefCount: - return true; - case CreateOther: - case CreateText: - return false; - } - ASSERT_NOT_REACHED(); - return false; -} - -inline bool Node::isElement(ConstructionType type) -{ - switch (type) { - case CreateContainer: - case CreateOther: - case CreateText: - return false; - case CreateElement: - case CreateElementZeroRefCount: - return true; - } - ASSERT_NOT_REACHED(); - return false; -} - -inline bool Node::isText(ConstructionType type) -{ - switch (type) { - case CreateContainer: - case CreateElement: - case CreateElementZeroRefCount: - case CreateOther: - return false; - case CreateText: - return true; - } - ASSERT_NOT_REACHED(); - return false; -} - -Node::Node(Document* document, ConstructionType type) - : TreeShared<Node>(initialRefCount(type)) - , m_document(document) - , m_previous(0) - , m_next(0) - , m_renderer(0) - , m_styleChange(NoStyleChange) - , m_hasId(false) - , m_hasClass(false) - , m_attached(false) - , m_childNeedsStyleRecalc(false) - , m_inDocument(false) - , m_isLink(false) - , m_active(false) - , m_hovered(false) - , m_inActiveChain(false) - , m_inDetach(false) - , m_hasRareData(false) - , m_isElement(isElement(type)) - , m_isContainer(isContainer(type)) - , m_isText(isText(type)) - , m_parsingChildrenFinished(true) - , m_isStyleAttributeValid(true) - , m_synchronizingStyleAttribute(false) -#if ENABLE(SVG) - , m_areSVGAttributesValid(true) - , m_synchronizingSVGAttributes(false) - , m_hasRareSVGData(false) -#endif -{ - if (m_document) - m_document->selfOnlyRef(); - #ifndef NDEBUG if (shouldIgnoreLeaks) ignoreSet.add(this); @@ -555,7 +469,7 @@ NodeRareData* Node::ensureRareData() ASSERT(!NodeRareData::rareDataMap().contains(this)); NodeRareData* data = createRareData(); NodeRareData::rareDataMap().set(this, data); - m_hasRareData = true; + setFlag(HasRareDataFlag); return data; } @@ -771,17 +685,43 @@ IntRect Node::getRect() const return IntRect(); } +bool Node::hasNonEmptyBoundingBox() const +{ + // Before calling absoluteRects, check for the common case where the renderer + // is non-empty, since this is a faster check and almost always returns true. + RenderBoxModelObject* box = renderBoxModelObject(); + if (!box) + return false; + if (!box->borderBoundingBox().isEmpty()) + return true; + + Vector<IntRect> rects; + FloatPoint absPos = renderer()->localToAbsolute(); + renderer()->absoluteRects(rects, absPos.x(), absPos.y()); + size_t n = rects.size(); + for (size_t i = 0; i < n; ++i) + if (!rects[i].isEmpty()) + return true; + + return false; +} + +inline void Node::setStyleChange(StyleChangeType changeType) +{ + m_nodeFlags = (m_nodeFlags & ~StyleChangeMask) | changeType; +} + void Node::setNeedsStyleRecalc(StyleChangeType changeType) { if ((changeType != NoStyleChange) && !attached()) // changed compared to what? return; - if (!(changeType == InlineStyleChange && (m_styleChange == FullStyleChange || m_styleChange == SyntheticStyleChange))) - m_styleChange = changeType; + if (!(changeType == InlineStyleChange && (styleChangeType() == FullStyleChange || styleChangeType() == SyntheticStyleChange))) + setStyleChange(changeType); - if (m_styleChange != NoStyleChange) { + if (styleChangeType() != NoStyleChange) { for (Node* p = parentNode(); p && !p->childNeedsStyleRecalc(); p = p->parentNode()) - p->setChildNeedsStyleRecalc(true); + p->setChildNeedsStyleRecalc(); if (document()->childNeedsStyleRecalc()) document()->scheduleStyleRecalc(); } @@ -805,9 +745,9 @@ void Node::lazyAttach() } if (n->firstChild()) - n->setChildNeedsStyleRecalc(true); - n->m_styleChange = FullStyleChange; - n->m_attached = true; + n->setChildNeedsStyleRecalc(); + n->setStyleChange(FullStyleChange); + n->setAttached(); } if (mustDoFullAttach) { @@ -817,7 +757,7 @@ void Node::lazyAttach() lazyAttachedAncestor->attach(); } else { for (Node* p = parentNode(); p && !p->childNeedsStyleRecalc(); p = p->parentNode()) - p->setChildNeedsStyleRecalc(true); + p->setChildNeedsStyleRecalc(); if (document()->childNeedsStyleRecalc()) document()->scheduleStyleRecalc(); } @@ -965,6 +905,39 @@ void Node::notifyNodeListsChildrenChanged() n->notifyLocalNodeListsChildrenChanged(); } +void Node::removeCachedClassNodeList(ClassNodeList* list, const String& className) +{ + ASSERT(rareData()); + ASSERT(rareData()->nodeLists()); + ASSERT_UNUSED(list, list->hasOwnCaches()); + + NodeListsNodeData* data = rareData()->nodeLists(); + ASSERT_UNUSED(list, list == data->m_classNodeListCache.get(className)); + data->m_classNodeListCache.remove(className); +} + +void Node::removeCachedNameNodeList(NameNodeList* list, const String& nodeName) +{ + ASSERT(rareData()); + ASSERT(rareData()->nodeLists()); + ASSERT_UNUSED(list, list->hasOwnCaches()); + + NodeListsNodeData* data = rareData()->nodeLists(); + ASSERT_UNUSED(list, list == data->m_nameNodeListCache.get(nodeName)); + data->m_nameNodeListCache.remove(nodeName); +} + +void Node::removeCachedTagNodeList(TagNodeList* list, const QualifiedName& name) +{ + ASSERT(rareData()); + ASSERT(rareData()->nodeLists()); + ASSERT_UNUSED(list, list->hasOwnCaches()); + + NodeListsNodeData* data = rareData()->nodeLists(); + ASSERT_UNUSED(list, list == data->m_tagNodeListCache.get(name)); + data->m_tagNodeListCache.remove(name); +} + Node *Node::traverseNextNode(const Node *stayWithin) const { if (firstChild()) @@ -1247,7 +1220,7 @@ void Node::attach() } } - m_attached = true; + setAttached(); } void Node::willRemove() @@ -1256,23 +1229,24 @@ void Node::willRemove() void Node::detach() { - m_inDetach = true; + setFlag(InDetachFlag); if (renderer()) renderer()->destroy(); setRenderer(0); Document* doc = document(); - if (m_hovered) + if (hovered()) doc->hoveredNodeDetached(this); - if (m_inActiveChain) + if (inActiveChain()) doc->activeChainNodeDetached(this); - m_active = false; - m_hovered = false; - m_inActiveChain = false; - m_attached = false; - m_inDetach = false; + clearFlag(IsActiveFlag); + clearFlag(IsHoveredFlag); + clearFlag(InActiveChainFlag); + clearFlag(IsAttachedFlag); + + clearFlag(InDetachFlag); } Node *Node::previousEditable() const @@ -1595,11 +1569,13 @@ PassRefPtr<NodeList> Node::getElementsByTagNameNS(const AtomicString& namespaceU AtomicString localNameAtom = name; - pair<NodeListsNodeData::TagCacheMap::iterator, bool> result = data->nodeLists()->m_tagNodeListCaches.add(QualifiedName(nullAtom, localNameAtom, namespaceURI), 0); - if (result.second) - result.first->second = DynamicNodeList::Caches::create(); + pair<NodeListsNodeData::TagNodeListCache::iterator, bool> result = data->nodeLists()->m_tagNodeListCache.add(QualifiedName(nullAtom, localNameAtom, namespaceURI), 0); + if (!result.second) + return PassRefPtr<TagNodeList>(result.first->second); - return TagNodeList::create(this, namespaceURI.isEmpty() ? nullAtom : namespaceURI, localNameAtom, result.first->second.get()); + RefPtr<TagNodeList> list = TagNodeList::create(this, namespaceURI.isEmpty() ? nullAtom : namespaceURI, localNameAtom); + result.first->second = list.get(); + return list.release(); } PassRefPtr<NodeList> Node::getElementsByName(const String& elementName) @@ -1610,11 +1586,13 @@ PassRefPtr<NodeList> Node::getElementsByName(const String& elementName) document()->addNodeListCache(); } - pair<NodeListsNodeData::CacheMap::iterator, bool> result = data->nodeLists()->m_nameNodeListCaches.add(elementName, 0); - if (result.second) - result.first->second = DynamicNodeList::Caches::create(); - - return NameNodeList::create(this, elementName, result.first->second.get()); + pair<NodeListsNodeData::NameNodeListCache::iterator, bool> result = data->nodeLists()->m_nameNodeListCache.add(elementName, 0); + if (!result.second) + return PassRefPtr<NodeList>(result.first->second); + + RefPtr<NameNodeList> list = NameNodeList::create(this, elementName); + result.first->second = list.get(); + return list.release(); } PassRefPtr<NodeList> Node::getElementsByClassName(const String& classNames) @@ -1625,11 +1603,13 @@ PassRefPtr<NodeList> Node::getElementsByClassName(const String& classNames) document()->addNodeListCache(); } - pair<NodeListsNodeData::CacheMap::iterator, bool> result = data->nodeLists()->m_classNodeListCaches.add(classNames, 0); - if (result.second) - result.first->second = DynamicNodeList::Caches::create(); - - return ClassNodeList::create(this, classNames, result.first->second.get()); + pair<NodeListsNodeData::ClassNodeListCache::iterator, bool> result = data->nodeLists()->m_classNodeListCache.add(classNames, 0); + if (!result.second) + return PassRefPtr<NodeList>(result.first->second); + + RefPtr<ClassNodeList> list = ClassNodeList::create(this, classNames); + result.first->second = list.get(); + return list.release(); } PassRefPtr<Element> Node::querySelector(const String& selectors, ExceptionCode& ec) @@ -2271,21 +2251,21 @@ void Node::formatForDebugger(char* buffer, unsigned length) const void NodeListsNodeData::invalidateCaches() { m_childNodeListCaches->reset(); - TagCacheMap::const_iterator tagCachesEnd = m_tagNodeListCaches.end(); - for (TagCacheMap::const_iterator it = m_tagNodeListCaches.begin(); it != tagCachesEnd; ++it) - it->second->reset(); + TagNodeListCache::const_iterator tagCacheEnd = m_tagNodeListCache.end(); + for (TagNodeListCache::const_iterator it = m_tagNodeListCache.begin(); it != tagCacheEnd; ++it) + it->second->invalidateCache(); invalidateCachesThatDependOnAttributes(); } void NodeListsNodeData::invalidateCachesThatDependOnAttributes() { - CacheMap::iterator classCachesEnd = m_classNodeListCaches.end(); - for (CacheMap::iterator it = m_classNodeListCaches.begin(); it != classCachesEnd; ++it) - it->second->reset(); + ClassNodeListCache::iterator classCacheEnd = m_classNodeListCache.end(); + for (ClassNodeListCache::iterator it = m_classNodeListCache.begin(); it != classCacheEnd; ++it) + it->second->invalidateCache(); - CacheMap::iterator nameCachesEnd = m_nameNodeListCaches.end(); - for (CacheMap::iterator it = m_nameNodeListCaches.begin(); it != nameCachesEnd; ++it) - it->second->reset(); + NameNodeListCache::iterator nameCacheEnd = m_nameNodeListCache.end(); + for (NameNodeListCache::iterator it = m_nameNodeListCache.begin(); it != nameCacheEnd; ++it) + it->second->invalidateCache(); } bool NodeListsNodeData::isEmpty() const @@ -2296,20 +2276,20 @@ bool NodeListsNodeData::isEmpty() const if (m_childNodeListCaches->refCount()) return false; - TagCacheMap::const_iterator tagCachesEnd = m_tagNodeListCaches.end(); - for (TagCacheMap::const_iterator it = m_tagNodeListCaches.begin(); it != tagCachesEnd; ++it) { + TagNodeListCache::const_iterator tagCacheEnd = m_tagNodeListCache.end(); + for (TagNodeListCache::const_iterator it = m_tagNodeListCache.begin(); it != tagCacheEnd; ++it) { if (it->second->refCount()) return false; } - CacheMap::const_iterator classCachesEnd = m_classNodeListCaches.end(); - for (CacheMap::const_iterator it = m_classNodeListCaches.begin(); it != classCachesEnd; ++it) { + ClassNodeListCache::const_iterator classCacheEnd = m_classNodeListCache.end(); + for (ClassNodeListCache::const_iterator it = m_classNodeListCache.begin(); it != classCacheEnd; ++it) { if (it->second->refCount()) return false; } - CacheMap::const_iterator nameCachesEnd = m_nameNodeListCaches.end(); - for (CacheMap::const_iterator it = m_nameNodeListCaches.begin(); it != nameCachesEnd; ++it) { + NameNodeListCache::const_iterator nameCacheEnd = m_nameNodeListCache.end(); + for (NameNodeListCache::const_iterator it = m_nameNodeListCache.begin(); it != nameCacheEnd; ++it) { if (it->second->refCount()) return false; } @@ -2384,12 +2364,12 @@ ScriptExecutionContext* Node::scriptExecutionContext() const void Node::insertedIntoDocument() { - setInDocument(true); + setInDocument(); } void Node::removedFromDocument() { - setInDocument(false); + clearInDocument(); } void Node::willMoveToNewOwnerDocument() @@ -2569,6 +2549,28 @@ EventTargetData* Node::ensureEventTargetData() return ensureRareData()->ensureEventTargetData(); } +#if USE(JSC) + +template <class NodeListMap> +void markNodeLists(const NodeListMap& map, JSC::MarkStack& markStack, JSC::JSGlobalData& globalData) +{ + for (typename NodeListMap::const_iterator it = map.begin(); it != map.end(); ++it) + markDOMObjectWrapper(markStack, globalData, it->second); +} + +void Node::markCachedNodeListsSlow(JSC::MarkStack& markStack, JSC::JSGlobalData& globalData) +{ + NodeListsNodeData* nodeLists = rareData()->nodeLists(); + if (!nodeLists) + return; + + markNodeLists(nodeLists->m_classNodeListCache, markStack, globalData); + markNodeLists(nodeLists->m_nameNodeListCache, markStack, globalData); + markNodeLists(nodeLists->m_tagNodeListCache, markStack, globalData); +} + +#endif + void Node::handleLocalEvents(Event* event) { if (!hasRareData() || !rareData()->eventTargetData()) diff --git a/WebCore/dom/Node.h b/WebCore/dom/Node.h index b2af8fc..b165615 100644 --- a/WebCore/dom/Node.h +++ b/WebCore/dom/Node.h @@ -32,10 +32,20 @@ #include "TreeShared.h" #include <wtf/ListHashSet.h> +#if USE(JSC) +namespace JSC { + + class JSGlobalData; + class MarkStack; + +} +#endif + namespace WebCore { class AtomicString; class Attribute; +class ClassNodeList; class ContainerNode; class Document; class DynamicNodeList; @@ -48,6 +58,7 @@ class IntRect; class KeyboardEvent; class NSResolver; class NamedNodeMap; +class NameNodeList; class NodeList; class NodeRareData; class PlatformKeyboardEvent; @@ -61,13 +72,21 @@ class RenderBoxModelObject; class RenderObject; class RenderStyle; class StringBuilder; +class TagNodeList; typedef int ExceptionCode; +const int nodeStyleChangeShift = 24; + // SyntheticStyleChange means that we need to go through the entire style change logic even though // no style property has actually changed. It is used to restructure the tree when, for instance, // RenderLayers are created or destroyed due to animation changes. -enum StyleChangeType { NoStyleChange, InlineStyleChange, FullStyleChange, SyntheticStyleChange }; +enum StyleChangeType { + NoStyleChange = 0, + InlineStyleChange = 1 << nodeStyleChangeShift, + FullStyleChange = 2 << nodeStyleChangeShift, + SyntheticStyleChange = 3 << nodeStyleChangeShift +}; const unsigned short DOCUMENT_POSITION_EQUIVALENT = 0x00; const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01; @@ -162,17 +181,13 @@ public: // Other methods (not part of DOM) - bool isElementNode() const { return m_isElement; } - bool isContainerNode() const { return m_isContainer; } - bool isTextNode() const { return m_isText; } + bool isElementNode() const { return getFlag(IsElementFlag); } + bool isContainerNode() const { return getFlag(IsContainerFlag); } + bool isTextNode() const { return getFlag(IsTextFlag); } - virtual bool isHTMLElement() const { return false; } + bool isHTMLElement() const { return getFlag(IsHTMLFlag); } -#if ENABLE(SVG) - virtual bool isSVGElement() const { return false; } -#else - static bool isSVGElement() { return false; } -#endif + bool isSVGElement() const { return getFlag(IsSVGFlag); } #if ENABLE(WML) virtual bool isWMLElement() const { return false; } @@ -188,10 +203,10 @@ public: virtual bool isMediaControlElement() const { return false; } - virtual bool isStyledElement() const { return false; } + bool isStyledElement() const { return getFlag(IsStyledElementFlag); } virtual bool isFrameOwnerElement() const { return false; } virtual bool isAttributeNode() const { return false; } - virtual bool isCommentNode() const { return false; } + bool isCommentNode() const { return getFlag(IsCommentFlag); } virtual bool isCharacterDataNode() const { return false; } bool isDocumentNode() const; virtual bool isShadowNode() const { return false; } @@ -268,33 +283,40 @@ public: // For <link> and <style> elements. virtual bool sheetLoaded() { return true; } - bool hasID() const { return m_hasId; } - bool hasClass() const { return m_hasClass; } - bool active() const { return m_active; } - bool inActiveChain() const { return m_inActiveChain; } - bool inDetach() const { return m_inDetach; } - bool hovered() const { return m_hovered; } + bool hasID() const { return getFlag(HasIDFlag); } + bool hasClass() const { return getFlag(HasClassFlag); } + bool active() const { return getFlag(IsActiveFlag); } + bool inActiveChain() const { return getFlag(InActiveChainFlag); } + bool inDetach() const { return getFlag(InDetachFlag); } + bool hovered() const { return getFlag(IsHoveredFlag); } bool focused() const { return hasRareData() ? rareDataFocused() : false; } - bool attached() const { return m_attached; } - void setAttached(bool b = true) { m_attached = b; } - bool needsStyleRecalc() const { return m_styleChange != NoStyleChange; } - StyleChangeType styleChangeType() const { return static_cast<StyleChangeType>(m_styleChange); } - bool childNeedsStyleRecalc() const { return m_childNeedsStyleRecalc; } - bool isLink() const { return m_isLink; } - void setHasID(bool b = true) { m_hasId = b; } - void setHasClass(bool b = true) { m_hasClass = b; } - void setChildNeedsStyleRecalc(bool b = true) { m_childNeedsStyleRecalc = b; } - void setInDocument(bool b = true) { m_inDocument = b; } - void setInActiveChain(bool b = true) { m_inActiveChain = b; } + bool attached() const { return getFlag(IsAttachedFlag); } + void setAttached() { setFlag(IsAttachedFlag); } + bool needsStyleRecalc() const { return styleChangeType() != NoStyleChange; } + StyleChangeType styleChangeType() const { return static_cast<StyleChangeType>(m_nodeFlags & StyleChangeMask); } + bool childNeedsStyleRecalc() const { return getFlag(ChildNeedsStyleRecalcFlag); } + bool isLink() const { return getFlag(IsLinkFlag); } + + void setHasID(bool f) { setFlag(f, HasIDFlag); } + void setHasClass(bool f) { setFlag(f, HasClassFlag); } + void setChildNeedsStyleRecalc() { setFlag(ChildNeedsStyleRecalcFlag); } + void clearChildNeedsStyleRecalc() { clearFlag(ChildNeedsStyleRecalcFlag); } + void setInDocument() { setFlag(InDocumentFlag); } + void clearInDocument() { clearFlag(InDocumentFlag); } + + void setInActiveChain() { setFlag(InActiveChainFlag); } + void clearInActiveChain() { clearFlag(InActiveChainFlag); } void setNeedsStyleRecalc(StyleChangeType changeType = FullStyleChange); - void setIsLink(bool b = true) { m_isLink = b; } + void setIsLink(bool f) { setFlag(f, IsLinkFlag); } + void setIsLink() { setFlag(IsLinkFlag); } + void clearIsLink() { clearFlag(IsLinkFlag); } void lazyAttach(); virtual bool canLazyAttach(); virtual void setFocus(bool b = true); - virtual void setActive(bool b = true, bool /*pause*/ = false) { m_active = b; } - virtual void setHovered(bool b = true) { m_hovered = b; } + virtual void setActive(bool f = true, bool /*pause*/ = false) { setFlag(f, IsActiveFlag); } + virtual void setHovered(bool f = true) { setFlag(f, IsHoveredFlag); } virtual short tabIndex() const; @@ -311,6 +333,11 @@ public: virtual bool shouldUseInputMethod() const; virtual IntRect getRect() const; + // Returns true if the node has a non-empty bounding box in layout. + // This does not 100% guarantee the user can see it, but is pretty close. + // Note: This method only works properly after layout has occurred. + bool hasNonEmptyBoundingBox() const; + virtual void recalcStyle(StyleChange = NoChange) { } unsigned nodeIndex() const; @@ -333,8 +360,8 @@ public: // node tree, false otherwise. bool inDocument() const { - ASSERT(m_document || !m_inDocument); - return m_inDocument; + ASSERT(m_document || !getFlag(InDocumentFlag)); + return getFlag(InDocumentFlag); } bool isReadOnlyNode() const { return nodeType() == ENTITY_REFERENCE_NODE; } @@ -497,6 +524,9 @@ public: void notifyLocalNodeListsChildrenChanged(); void notifyNodeListsAttributeChanged(); void notifyLocalNodeListsAttributeChanged(); + void removeCachedClassNodeList(ClassNodeList*, const String&); + void removeCachedNameNodeList(NameNodeList*, const String&); + void removeCachedTagNodeList(TagNodeList*, const QualifiedName&); PassRefPtr<NodeList> getElementsByTagName(const String&); PassRefPtr<NodeList> getElementsByTagNameNS(const AtomicString& namespaceURI, const String& localName); @@ -571,10 +601,82 @@ public: virtual EventTargetData* eventTargetData(); virtual EventTargetData* ensureEventTargetData(); +#if USE(JSC) + void markCachedNodeLists(JSC::MarkStack& markStack, JSC::JSGlobalData& globalData) + { + // NodeLists may be present. If so, they need to be marked. + if (!hasRareData()) + return; + + markCachedNodeListsSlow(markStack, globalData); + } +#endif + +private: + enum NodeFlags { + IsTextFlag = 1, + IsCommentFlag = 1 << 1, + IsContainerFlag = 1 << 2, + IsElementFlag = 1 << 3, + IsStyledElementFlag = 1 << 4, + IsHTMLFlag = 1 << 5, + IsSVGFlag = 1 << 6, + HasIDFlag = 1 << 7, + HasClassFlag = 1 << 8, + IsAttachedFlag = 1 << 9, + ChildNeedsStyleRecalcFlag = 1 << 10, + InDocumentFlag = 1 << 11, + IsLinkFlag = 1 << 12, + IsActiveFlag = 1 << 13, + IsHoveredFlag = 1 << 14, + InActiveChainFlag = 1 << 15, + InDetachFlag = 1 << 16, + HasRareDataFlag = 1 << 17, + + // These bits are used by derived classes, pulled up here so they can + // be stored in the same memory word as the Node bits above. + IsParsingChildrenFinishedFlag = 1 << 18, // Element + IsStyleAttributeValidFlag = 1 << 19, // StyledElement + IsSynchronizingStyleAttributeFlag = 1 << 20, // StyledElement +#if ENABLE(SVG) + AreSVGAttributesValidFlag = 1 << 21, // Element + IsSynchronizingSVGAttributesFlag = 1 << 22, // SVGElement + HasSVGRareDataFlag = 1 << 23, // SVGElement +#endif + StyleChangeMask = 1 << nodeStyleChangeShift | 1 << (nodeStyleChangeShift + 1), + CreateWithZeroRefCountFlag = 1 << 26, + +#if ENABLE(SVG) + DefaultNodeFlags = IsParsingChildrenFinishedFlag | IsStyleAttributeValidFlag | AreSVGAttributesValidFlag +#else + DefaultNodeFlags = IsParsingChildrenFinishedFlag | IsStyleAttributeValidFlag +#endif + }; + + // 5 bits remaining + + bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; } + void setFlag(bool f, NodeFlags mask) const { m_nodeFlags = (m_nodeFlags & ~mask) | (-(int32_t)f & mask); } + void setFlag(NodeFlags mask) const { m_nodeFlags |= mask; } + void clearFlag(NodeFlags mask) const { m_nodeFlags &= ~mask; } + protected: // CreateElementZeroRefCount is deprecated and can be removed once we convert all element // classes to start with a reference count of 1. - enum ConstructionType { CreateContainer, CreateElement, CreateOther, CreateText, CreateElementZeroRefCount }; + enum ConstructionType { + CreateOther = DefaultNodeFlags, + CreateText = DefaultNodeFlags | IsTextFlag, + CreateComment = DefaultNodeFlags | IsCommentFlag, + CreateContainer = DefaultNodeFlags | IsContainerFlag, + CreateElement = CreateContainer | IsElementFlag, + CreateElementZeroRefCount = IsElementFlag | CreateWithZeroRefCountFlag, + CreateStyledElement = CreateElement | IsStyledElementFlag, + CreateStyledElementZeroRefCount = CreateStyledElement | CreateWithZeroRefCountFlag, + CreateHTMLElement = CreateStyledElement | IsHTMLFlag, + CreateHTMLElementZeroRefCount = CreateHTMLElement | CreateWithZeroRefCountFlag, + CreateSVGElement = CreateStyledElement | IsSVGFlag, + CreateSVGElementZeroRefCount = CreateSVGElement | CreateWithZeroRefCountFlag, + }; Node(Document*, ConstructionType); virtual void willMoveToNewOwnerDocument(); @@ -583,19 +685,18 @@ protected: virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const { } void setTabIndexExplicitly(short); - bool hasRareData() const { return m_hasRareData; } -#if ENABLE(SVG) - bool hasRareSVGData() const { return m_hasRareSVGData; } -#endif + bool hasRareData() const { return getFlag(HasRareDataFlag); } NodeRareData* rareData() const; NodeRareData* ensureRareData(); private: +#if USE(JSC) + void markCachedNodeListsSlow(JSC::MarkStack&, JSC::JSGlobalData&); +#endif + static bool initialRefCount(ConstructionType); - static bool isContainer(ConstructionType); - static bool isElement(ConstructionType); - static bool isText(ConstructionType); + void setStyleChange(StyleChangeType); virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } @@ -617,45 +718,45 @@ private: Element* ancestorElement() const; void appendTextContent(bool convertBRsToNewlines, StringBuilder&) const; + void trackForDebugging(); Document* m_document; Node* m_previous; Node* m_next; RenderObject* m_renderer; - - unsigned m_styleChange : 2; - bool m_hasId : 1; - bool m_hasClass : 1; - bool m_attached : 1; - bool m_childNeedsStyleRecalc : 1; - bool m_inDocument : 1; - bool m_isLink : 1; - bool m_active : 1; - bool m_hovered : 1; - bool m_inActiveChain : 1; - bool m_inDetach : 1; - bool m_hasRareData : 1; - const bool m_isElement : 1; - const bool m_isContainer : 1; - const bool m_isText : 1; - -protected: - // These bits are used by derived classes, pulled up here so they can - // be stored in the same memory word as the Node bits above. - - bool m_parsingChildrenFinished : 1; // Element - mutable bool m_isStyleAttributeValid : 1; // StyledElement - mutable bool m_synchronizingStyleAttribute : 1; // StyledElement + mutable uint32_t m_nodeFlags; + + protected: + bool isParsingChildrenFinished() const { return getFlag(IsParsingChildrenFinishedFlag); } + void setIsParsingChildrenFinished() { setFlag(IsParsingChildrenFinishedFlag); } + void clearIsParsingChildrenFinished() { clearFlag(IsParsingChildrenFinishedFlag); } + bool isStyleAttributeValid() const { return getFlag(IsStyleAttributeValidFlag); } + void setIsStyleAttributeValid(bool f) { setFlag(f, IsStyleAttributeValidFlag); } + void setIsStyleAttributeValid() const { setFlag(IsStyleAttributeValidFlag); } + void clearIsStyleAttributeValid() { clearFlag(IsStyleAttributeValidFlag); } + bool isSynchronizingStyleAttribute() const { return getFlag(IsSynchronizingStyleAttributeFlag); } + void setIsSynchronizingStyleAttribute(bool f) { setFlag(f, IsSynchronizingStyleAttributeFlag); } + void setIsSynchronizingStyleAttribute() const { setFlag(IsSynchronizingStyleAttributeFlag); } + void clearIsSynchronizingStyleAttribute() const { clearFlag(IsSynchronizingStyleAttributeFlag); } #if ENABLE(SVG) - mutable bool m_areSVGAttributesValid : 1; // Element - mutable bool m_synchronizingSVGAttributes : 1; // SVGElement - bool m_hasRareSVGData : 1; // SVGElement + bool areSVGAttributesValid() const { return getFlag(AreSVGAttributesValidFlag); } + void setAreSVGAttributesValid() const { setFlag(AreSVGAttributesValidFlag); } + void clearAreSVGAttributesValid() { clearFlag(AreSVGAttributesValidFlag); } + bool isSynchronizingSVGAttributes() const { return getFlag(IsSynchronizingSVGAttributesFlag); } + void setIsSynchronizingSVGAttributes() const { setFlag(IsSynchronizingSVGAttributesFlag); } + void clearIsSynchronizingSVGAttributes() const { clearFlag(IsSynchronizingSVGAttributesFlag); } + bool hasRareSVGData() const { return getFlag(HasSVGRareDataFlag); } + void setHasRareSVGData() { setFlag(HasSVGRareDataFlag); } + void clearHasRareSVGData() { clearFlag(HasSVGRareDataFlag); } #endif - - // 10 bits remaining }; +inline bool Node::initialRefCount(ConstructionType type) +{ + return !(type & CreateWithZeroRefCountFlag); +} + // Used in Node::addSubresourceAttributeURLs() and in addSubresourceStyleURLs() inline void addSubresourceURL(ListHashSet<KURL>& urls, const KURL& url) { diff --git a/WebCore/dom/Node.idl b/WebCore/dom/Node.idl index c0f159c..7bc6d1d 100644 --- a/WebCore/dom/Node.idl +++ b/WebCore/dom/Node.idl @@ -62,9 +62,7 @@ module core { readonly attribute Node previousSibling; readonly attribute Node nextSibling; readonly attribute NamedNodeMap attributes; -#if !defined(LANGUAGE_GOBJECT) || !LANGUAGE_GOBJECT readonly attribute Document ownerDocument; -#endif [OldStyleObjC, Custom] Node insertBefore(in [Return] Node newChild, in Node refChild) @@ -136,12 +134,12 @@ module core { #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C #if !defined(LANGUAGE_GOBJECT) || !LANGUAGE_GOBJECT - [JSCCustom] void addEventListener(in DOMString type, - in EventListener listener, - in boolean useCapture); - [JSCCustom] void removeEventListener(in DOMString type, - in EventListener listener, - in boolean useCapture); + void addEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); + void removeEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); boolean dispatchEvent(in Event event) raises(EventException); #endif diff --git a/WebCore/dom/NodeFilter.idl b/WebCore/dom/NodeFilter.idl index d721f80..16f3f26 100644 --- a/WebCore/dom/NodeFilter.idl +++ b/WebCore/dom/NodeFilter.idl @@ -43,7 +43,7 @@ module traversal { const unsigned long SHOW_DOCUMENT_FRAGMENT = 0x00000400; const unsigned long SHOW_NOTATION = 0x00000800; - [Custom] short acceptNode(in Node n); + [CallWith=ScriptState] short acceptNode(in Node n); }; diff --git a/WebCore/dom/NodeIterator.idl b/WebCore/dom/NodeIterator.idl index e1818a1..9f59ae1 100644 --- a/WebCore/dom/NodeIterator.idl +++ b/WebCore/dom/NodeIterator.idl @@ -31,9 +31,9 @@ module traversal { readonly attribute Node referenceNode; readonly attribute boolean pointerBeforeReferenceNode; - [Custom] Node nextNode() + [CallWith=ScriptState] Node nextNode() raises (DOMException); - [Custom] Node previousNode() + [CallWith=ScriptState] Node previousNode() raises (DOMException); void detach(); }; diff --git a/WebCore/dom/NodeRareData.h b/WebCore/dom/NodeRareData.h index 6e9d0e4..3d2cf0c 100644 --- a/WebCore/dom/NodeRareData.h +++ b/WebCore/dom/NodeRareData.h @@ -22,11 +22,14 @@ #ifndef NodeRareData_h #define NodeRareData_h +#include "ClassNodeList.h" #include "DynamicNodeList.h" #include "EventListener.h" +#include "NameNodeList.h" +#include "QualifiedName.h" #include "RegisteredEventListener.h" #include "StringHash.h" -#include "QualifiedName.h" +#include "TagNodeList.h" #include <wtf/HashSet.h> #include <wtf/PassOwnPtr.h> #include <wtf/OwnPtr.h> @@ -39,12 +42,14 @@ struct NodeListsNodeData : Noncopyable { RefPtr<DynamicNodeList::Caches> m_childNodeListCaches; - typedef HashMap<String, RefPtr<DynamicNodeList::Caches> > CacheMap; - CacheMap m_classNodeListCaches; - CacheMap m_nameNodeListCaches; + typedef HashMap<String, ClassNodeList*> ClassNodeListCache; + ClassNodeListCache m_classNodeListCache; + + typedef HashMap<String, NameNodeList*> NameNodeListCache; + NameNodeListCache m_nameNodeListCache; - typedef HashMap<QualifiedName, RefPtr<DynamicNodeList::Caches> > TagCacheMap; - TagCacheMap m_tagNodeListCaches; + typedef HashMap<QualifiedName, TagNodeList*> TagNodeListCache; + TagNodeListCache m_tagNodeListCache; static PassOwnPtr<NodeListsNodeData> create() { diff --git a/WebCore/dom/Notation.cpp b/WebCore/dom/Notation.cpp index cade384..4b3ab28 100644 --- a/WebCore/dom/Notation.cpp +++ b/WebCore/dom/Notation.cpp @@ -21,6 +21,8 @@ #include "config.h" #include "Notation.h" +#include "Document.h" + namespace WebCore { Notation::Notation(Document* document, const String& name, const String& publicId, const String& systemId) diff --git a/WebCore/dom/PopStateEvent.idl b/WebCore/dom/PopStateEvent.idl index f9c9a71..28da9e6 100644 --- a/WebCore/dom/PopStateEvent.idl +++ b/WebCore/dom/PopStateEvent.idl @@ -27,11 +27,11 @@ module events { interface PopStateEvent : Event { - [Custom] void initPopStateEvent(in DOMString typeArg, + void initPopStateEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, - in any stateArg); - + in SerializedScriptValue stateArg); + readonly attribute [V8CustomGetter] any state; }; diff --git a/WebCore/dom/Position.cpp b/WebCore/dom/Position.cpp index fa994e3..fdcd7e5 100644 --- a/WebCore/dom/Position.cpp +++ b/WebCore/dom/Position.cpp @@ -986,27 +986,46 @@ static InlineTextBox* searchAheadForBetterMatch(RenderObject* renderer) return 0; } +static Position downstreamIgnoringEditingBoundaries(Position position) +{ + Position lastPosition; + while (position != lastPosition) { + lastPosition = position; + position = position.downstream(Position::CanCrossEditingBoundary); + } + return position; +} + +static Position upstreamIgnoringEditingBoundaries(Position position) +{ + Position lastPosition; + while (position != lastPosition) { + lastPosition = position; + position = position.upstream(Position::CanCrossEditingBoundary); + } + return position; +} + void Position::getInlineBoxAndOffset(EAffinity affinity, TextDirection primaryDirection, InlineBox*& inlineBox, int& caretOffset) const { caretOffset = m_offset; RenderObject* renderer = node()->renderer(); - + if (!renderer->isText()) { - if (!renderer->isRenderButton() && renderer->isBlockFlow() && hasRenderedNonAnonymousDescendantsWithHeight(renderer)) { - bool lastPosition = caretOffset == lastOffsetInNode(node()); - Node* startNode = lastPosition ? node()->childNode(caretOffset - 1) : node()->childNode(caretOffset); - while (startNode && (!startNode->renderer() || (startNode->isTextNode() && toRenderText(startNode->renderer())->isAllCollapsibleWhitespace()))) - startNode = (lastPosition)? startNode->previousSibling(): startNode->nextSibling(); - if (startNode) { - Position pos(startNode, 0); - pos = pos.downstream(CanCrossEditingBoundary); - pos.getInlineBoxAndOffset(UPSTREAM, primaryDirection, inlineBox, caretOffset); - if (lastPosition && inlineBox) - caretOffset = inlineBox->caretMaxOffset(); + inlineBox = 0; + if (canHaveChildrenForEditing(node()) && renderer->isBlockFlow() && hasRenderedNonAnonymousDescendantsWithHeight(renderer)) { + // Try a visually equivalent position with possibly opposite editability. This helps in case |this| is in + // an editable block but surrounded by non-editable positions. It acts to negate the logic at the beginning + // of RenderObject::createVisiblePosition(). + Position equivalent = downstreamIgnoringEditingBoundaries(*this); + if (equivalent == *this) + equivalent = upstreamIgnoringEditingBoundaries(*this); + if (equivalent == *this) return; - } + + equivalent.getInlineBoxAndOffset(UPSTREAM, primaryDirection, inlineBox, caretOffset); + return; } - inlineBox = 0; if (renderer->isBox()) { inlineBox = toRenderBox(renderer)->inlineBoxWrapper(); if (!inlineBox || (caretOffset > inlineBox->caretMinOffset() && caretOffset < inlineBox->caretMaxOffset())) diff --git a/WebCore/dom/QualifiedName.cpp b/WebCore/dom/QualifiedName.cpp index 6f5a74f..7cc809f 100644 --- a/WebCore/dom/QualifiedName.cpp +++ b/WebCore/dom/QualifiedName.cpp @@ -78,6 +78,7 @@ void QualifiedName::deref() if (!m_impl) return; #endif + ASSERT(!isHashTableDeletedValue()); if (m_impl->hasOneRef()) gNameCache->remove(m_impl); diff --git a/WebCore/dom/QualifiedName.h b/WebCore/dom/QualifiedName.h index 7581ba1..672a302 100644 --- a/WebCore/dom/QualifiedName.h +++ b/WebCore/dom/QualifiedName.h @@ -58,6 +58,8 @@ public: QualifiedName(const AtomicString& prefix, const AtomicString& localName, const AtomicString& namespaceURI); QualifiedName(const AtomicString& prefix, const char* localName, const AtomicString& namespaceURI); + QualifiedName(WTF::HashTableDeletedValueType) : m_impl(hashTableDeletedValue()) { } + bool isHashTableDeletedValue() const { return m_impl == hashTableDeletedValue(); } ~QualifiedName() { deref(); } #ifdef QNAME_DEFAULT_CONSTRUCTOR QualifiedName() : m_impl(0) { } @@ -92,6 +94,8 @@ private: void init(const AtomicString& prefix, const AtomicString& localName, const AtomicString& namespaceURI); void ref() const { m_impl->ref(); } void deref(); + + static QualifiedNameImpl* hashTableDeletedValue() { return RefPtr<QualifiedNameImpl>::hashTableDeletedValue(); } QualifiedNameImpl* m_impl; }; @@ -167,8 +171,8 @@ namespace WTF { template<> struct HashTraits<WebCore::QualifiedName> : GenericHashTraits<WebCore::QualifiedName> { static const bool emptyValueIsZero = false; static WebCore::QualifiedName emptyValue() { return WebCore::QualifiedName(WebCore::nullAtom, WebCore::nullAtom, WebCore::nullAtom); } - static void constructDeletedValue(WebCore::QualifiedName& slot) { new (&slot) WebCore::QualifiedName(WebCore::nullAtom, WebCore::AtomicString(HashTableDeletedValue), WebCore::nullAtom); } - static bool isDeletedValue(const WebCore::QualifiedName& slot) { return slot.localName().isHashTableDeletedValue(); } + static void constructDeletedValue(WebCore::QualifiedName& slot) { new (&slot) WebCore::QualifiedName(WTF::HashTableDeletedValue); } + static bool isDeletedValue(const WebCore::QualifiedName& slot) { return slot.isHashTableDeletedValue(); } }; } diff --git a/WebCore/dom/ScriptExecutionContext.h b/WebCore/dom/ScriptExecutionContext.h index d0f2e26..18e2cd0 100644 --- a/WebCore/dom/ScriptExecutionContext.h +++ b/WebCore/dom/ScriptExecutionContext.h @@ -76,6 +76,7 @@ namespace WebCore { void stopDatabases(DatabaseTaskSynchronizer*); #endif virtual bool isContextThread() const = 0; + virtual bool isJSExecutionTerminated() const = 0; const KURL& url() const { return virtualURL(); } KURL completeURL(const String& url) const { return virtualCompleteURL(url); } diff --git a/WebCore/dom/SelectElement.cpp b/WebCore/dom/SelectElement.cpp index 4af90c9..fb7d9a6 100644 --- a/WebCore/dom/SelectElement.cpp +++ b/WebCore/dom/SelectElement.cpp @@ -529,12 +529,8 @@ static int nextValidIndex(const Vector<Element*>& listItems, int listIndex, Skip } #endif -void SelectElement::menuListDefaultEventHandler(SelectElementData& data, Element* element, Event* event, HTMLFormElement* htmlForm) +void SelectElement::menuListDefaultEventHandler(SelectElementData& data, Element* element, Event* event) { -#if !ARROW_KEYS_POP_MENU - UNUSED_PARAM(htmlForm); -#endif - if (event->type() == eventNames().keydownEvent) { if (!element->renderer() || !event->isKeyboardEvent()) return; @@ -613,8 +609,6 @@ void SelectElement::menuListDefaultEventHandler(SelectElementData& data, Element handled = true; } else if (keyCode == '\r') { menuListOnChange(data, element); - if (htmlForm) - htmlForm->submitClick(event); handled = true; } #else @@ -693,7 +687,7 @@ void SelectElement::updateSelectedState(SelectElementData& data, Element* elemen updateListBoxSelection(data, element, !multiSelect); } -void SelectElement::listBoxDefaultEventHandler(SelectElementData& data, Element* element, Event* event, HTMLFormElement* htmlForm) +void SelectElement::listBoxDefaultEventHandler(SelectElementData& data, Element* element, Event* event) { const Vector<Element*>& listItems = data.listItems(element); @@ -759,29 +753,18 @@ void SelectElement::listBoxDefaultEventHandler(SelectElementData& data, Element* listBoxOnChange(data, element); event->setDefaultHandled(); } - } else if (event->type() == eventNames().keypressEvent) { - if (!event->isKeyboardEvent()) - return; - int keyCode = static_cast<KeyboardEvent*>(event)->keyCode(); - - if (keyCode == '\r') { - if (htmlForm) - htmlForm->submitClick(event); - event->setDefaultHandled(); - return; - } } } -void SelectElement::defaultEventHandler(SelectElementData& data, Element* element, Event* event, HTMLFormElement* htmlForm) +void SelectElement::defaultEventHandler(SelectElementData& data, Element* element, Event* event) { if (!element->renderer()) return; if (data.usesMenuList()) - menuListDefaultEventHandler(data, element, event, htmlForm); + menuListDefaultEventHandler(data, element, event); else - listBoxDefaultEventHandler(data, element, event, htmlForm); + listBoxDefaultEventHandler(data, element, event); if (event->defaultHandled()) return; diff --git a/WebCore/dom/SelectElement.h b/WebCore/dom/SelectElement.h index dcb6879..6db841e 100644 --- a/WebCore/dom/SelectElement.h +++ b/WebCore/dom/SelectElement.h @@ -92,7 +92,7 @@ protected: static void parseMultipleAttribute(SelectElementData&, Element*, MappedAttribute*); static bool appendFormData(SelectElementData&, Element*, FormDataList&); static void reset(SelectElementData&, Element*); - static void defaultEventHandler(SelectElementData&, Element*, Event*, HTMLFormElement* = 0); + static void defaultEventHandler(SelectElementData&, Element*, Event*); static int lastSelectedListIndex(const SelectElementData&, const Element*); static void typeAheadFind(SelectElementData&, Element*, KeyboardEvent*); static void insertedIntoTree(SelectElementData&, Element*); @@ -103,8 +103,8 @@ protected: bool multi, bool shift); private: - static void menuListDefaultEventHandler(SelectElementData&, Element*, Event*, HTMLFormElement*); - static void listBoxDefaultEventHandler(SelectElementData&, Element*, Event*, HTMLFormElement*); + static void menuListDefaultEventHandler(SelectElementData&, Element*, Event*); + static void listBoxDefaultEventHandler(SelectElementData&, Element*, Event*); static void setOptionsChangedOnRenderer(SelectElementData&, Element*); }; diff --git a/WebCore/dom/StyledElement.cpp b/WebCore/dom/StyledElement.cpp index 3607963..cd5f863 100644 --- a/WebCore/dom/StyledElement.cpp +++ b/WebCore/dom/StyledElement.cpp @@ -103,17 +103,12 @@ void StyledElement::removeMappedAttributeDecl(MappedAttributeEntry entryType, co void StyledElement::updateStyleAttribute() const { - ASSERT(!m_isStyleAttributeValid); - m_isStyleAttributeValid = true; - m_synchronizingStyleAttribute = true; + ASSERT(!isStyleAttributeValid()); + setIsStyleAttributeValid(); + setIsSynchronizingStyleAttribute(); if (m_inlineStyleDecl) const_cast<StyledElement*>(this)->setAttribute(styleAttr, m_inlineStyleDecl->cssText()); - m_synchronizingStyleAttribute = false; -} - -StyledElement::StyledElement(const QualifiedName& name, Document* document, ConstructionType type) - : Element(name, document, type) -{ + clearIsSynchronizingStyleAttribute(); } StyledElement::~StyledElement() @@ -208,7 +203,7 @@ bool StyledElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEnt { result = eNone; if (attrName == styleAttr) - return !m_synchronizingStyleAttribute; + return !isSynchronizingStyleAttribute(); return true; } @@ -253,7 +248,7 @@ void StyledElement::parseMappedAttribute(MappedAttribute *attr) destroyInlineStyleDecl(); else getInlineStyleDecl()->parseDeclaration(attr->value()); - m_isStyleAttributeValid = true; + setIsStyleAttributeValid(); setNeedsStyleRecalc(); } } @@ -476,8 +471,8 @@ void StyledElement::copyNonAttributeProperties(const Element *sourceElement) return; *getInlineStyleDecl() = *source->m_inlineStyleDecl; - m_isStyleAttributeValid = source->m_isStyleAttributeValid; - m_synchronizingStyleAttribute = source->m_synchronizingStyleAttribute; + setIsStyleAttributeValid(source->isStyleAttributeValid()); + setIsSynchronizingStyleAttribute(source->isSynchronizingStyleAttribute()); Element::copyNonAttributeProperties(sourceElement); } diff --git a/WebCore/dom/StyledElement.h b/WebCore/dom/StyledElement.h index 52bffd3..279282c 100644 --- a/WebCore/dom/StyledElement.h +++ b/WebCore/dom/StyledElement.h @@ -25,6 +25,7 @@ #ifndef StyledElement_h #define StyledElement_h +#include "CSSMutableStyleDeclaration.h" #include "CSSPrimitiveValue.h" #include "Element.h" #include "MappedAttributeEntry.h" @@ -33,7 +34,6 @@ namespace WebCore { class CSSMappedAttributeDeclaration; -class CSSMutableStyleDeclaration; class MappedAttribute; class StyledElement : public Element { @@ -73,7 +73,10 @@ public: virtual PassRefPtr<Attribute> createAttribute(const QualifiedName&, const AtomicString& value); protected: - StyledElement(const QualifiedName&, Document*, ConstructionType); + StyledElement(const QualifiedName& name, Document* document, ConstructionType type) + : Element(name, document, type) + { + } virtual void attributeChanged(Attribute*, bool preserveDecls = false); virtual void parseMappedAttribute(MappedAttribute*); @@ -89,8 +92,6 @@ protected: virtual void didMoveToNewOwnerDocument(); private: - virtual bool isStyledElement() const { return true; } - void createMappedDecl(MappedAttribute*); void createInlineStyleDecl(); @@ -104,7 +105,7 @@ private: inline void StyledElement::invalidateStyleAttribute() { - m_isStyleAttributeValid = false; + clearIsStyleAttributeValid(); } } //namespace diff --git a/WebCore/dom/TagNodeList.cpp b/WebCore/dom/TagNodeList.cpp index bec9b8e..4914e09 100644 --- a/WebCore/dom/TagNodeList.cpp +++ b/WebCore/dom/TagNodeList.cpp @@ -29,14 +29,19 @@ namespace WebCore { -TagNodeList::TagNodeList(PassRefPtr<Node> rootNode, const AtomicString& namespaceURI, const AtomicString& localName, DynamicNodeList::Caches* caches) - : DynamicNodeList(rootNode, caches) +TagNodeList::TagNodeList(PassRefPtr<Node> rootNode, const AtomicString& namespaceURI, const AtomicString& localName) + : DynamicNodeList(rootNode) , m_namespaceURI(namespaceURI) , m_localName(localName) { ASSERT(m_namespaceURI.isNull() || !m_namespaceURI.isEmpty()); } +TagNodeList::~TagNodeList() +{ + m_rootNode->removeCachedTagNodeList(this, QualifiedName(nullAtom, m_localName, m_namespaceURI)); +} + bool TagNodeList::nodeMatches(Element* testNode) const { if (m_namespaceURI != starAtom && m_namespaceURI != testNode->namespaceURI()) diff --git a/WebCore/dom/TagNodeList.h b/WebCore/dom/TagNodeList.h index 0031bad..1b1a038 100644 --- a/WebCore/dom/TagNodeList.h +++ b/WebCore/dom/TagNodeList.h @@ -32,13 +32,15 @@ namespace WebCore { // NodeList that limits to a particular tag. class TagNodeList : public DynamicNodeList { public: - static PassRefPtr<TagNodeList> create(PassRefPtr<Node> rootNode, const AtomicString& namespaceURI, const AtomicString& localName, DynamicNodeList::Caches* caches) + static PassRefPtr<TagNodeList> create(PassRefPtr<Node> rootNode, const AtomicString& namespaceURI, const AtomicString& localName) { - return adoptRef(new TagNodeList(rootNode, namespaceURI, localName, caches)); + return adoptRef(new TagNodeList(rootNode, namespaceURI, localName)); } + virtual ~TagNodeList(); + private: - TagNodeList(PassRefPtr<Node> rootNode, const AtomicString& namespaceURI, const AtomicString& localName, DynamicNodeList::Caches* caches); + TagNodeList(PassRefPtr<Node> rootNode, const AtomicString& namespaceURI, const AtomicString& localName); virtual bool nodeMatches(Element*) const; diff --git a/WebCore/dom/Text.cpp b/WebCore/dom/Text.cpp index cf98817..14da1a4 100644 --- a/WebCore/dom/Text.cpp +++ b/WebCore/dom/Text.cpp @@ -41,11 +41,6 @@ using namespace std; namespace WebCore { -Text::Text(Document* document, const String& data) - : CharacterData(document, data, CreateText) -{ -} - PassRefPtr<Text> Text::create(Document* document, const String& data) { return adoptRef(new Text(document, data)); diff --git a/WebCore/dom/Text.h b/WebCore/dom/Text.h index 4722736..45678ef 100644 --- a/WebCore/dom/Text.h +++ b/WebCore/dom/Text.h @@ -44,7 +44,10 @@ public: virtual void attach(); protected: - Text(Document*, const String&); + Text(Document* document, const String& data) + : CharacterData(document, data, CreateText) + { + } private: virtual String nodeName() const; diff --git a/WebCore/dom/Tokenizer.h b/WebCore/dom/Tokenizer.h index 9a9b7b3..939ac70 100644 --- a/WebCore/dom/Tokenizer.h +++ b/WebCore/dom/Tokenizer.h @@ -25,6 +25,7 @@ namespace WebCore { + class HTMLTokenizer; class SegmentedString; class XSSAuditor; @@ -57,6 +58,7 @@ namespace WebCore { virtual void executeScriptsWaitingForStylesheets() {} virtual bool isHTMLTokenizer() const { return false; } + virtual HTMLTokenizer* asHTMLTokenizer() { return 0; } XSSAuditor* xssAuditor() const { return m_XSSAuditor; } void setXSSAuditor(XSSAuditor* auditor) { m_XSSAuditor = auditor; } diff --git a/WebCore/bindings/v8/custom/V8NodeFilterCustom.cpp b/WebCore/dom/TreeDepthLimit.h index 7bb640b..e78e093 100644 --- a/WebCore/bindings/v8/custom/V8NodeFilterCustom.cpp +++ b/WebCore/dom/TreeDepthLimit.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 Google Inc. All rights reserved. + * Copyright (C) 2010 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -28,21 +28,13 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" -#include "V8NodeFilter.h" +#ifndef TreeDepthLimit_h +#define TreeDepthLimit_h -#include "ExceptionCode.h" -#include "NodeFilter.h" +#ifndef MAX_DOM_TREE_DEPTH +#define MAX_DOM_TREE_DEPTH 5000 +#endif +const unsigned maxDOMTreeDepth = MAX_DOM_TREE_DEPTH; -#include "V8Binding.h" -#include "V8Proxy.h" +#endif // TreeDepthLimit.h -namespace WebCore { - -v8::Handle<v8::Value> V8NodeFilter::acceptNodeCallback(const v8::Arguments& args) -{ - INC_STATS("DOM.NodeFilter.acceptNode()"); - return throwError(NOT_SUPPORTED_ERR); -} - -} // namespace WebCore diff --git a/WebCore/dom/TreeWalker.idl b/WebCore/dom/TreeWalker.idl index f591128..890e315 100644 --- a/WebCore/dom/TreeWalker.idl +++ b/WebCore/dom/TreeWalker.idl @@ -31,13 +31,13 @@ module traversal { attribute Node currentNode setter raises(DOMException); - [Custom] Node parentNode(); - [Custom] Node firstChild(); - [Custom] Node lastChild(); - [Custom] Node previousSibling(); - [Custom] Node nextSibling(); - [Custom] Node previousNode(); - [Custom] Node nextNode(); + [CallWith=ScriptState] Node parentNode(); + [CallWith=ScriptState] Node firstChild(); + [CallWith=ScriptState] Node lastChild(); + [CallWith=ScriptState] Node previousSibling(); + [CallWith=ScriptState] Node nextSibling(); + [CallWith=ScriptState] Node previousNode(); + [CallWith=ScriptState] Node nextNode(); }; } diff --git a/WebCore/dom/XMLTokenizer.cpp b/WebCore/dom/XMLTokenizer.cpp index 818dacd..1d98dfe 100644 --- a/WebCore/dom/XMLTokenizer.cpp +++ b/WebCore/dom/XMLTokenizer.cpp @@ -50,6 +50,7 @@ #include "ScriptSourceCode.h" #include "ScriptValue.h" #include "TextResourceDecoder.h" +#include "TreeDepthLimit.h" #include <wtf/text/CString.h> #include <wtf/StringExtras.h> #include <wtf/Threading.h> @@ -67,7 +68,6 @@ namespace WebCore { using namespace HTMLNames; const int maxErrors = 25; -const size_t maxNestingDepth = 4096; #if ENABLE(WML) bool XMLTokenizer::isWMLDocument() const @@ -87,7 +87,7 @@ void XMLTokenizer::pushCurrentNode(Node* n) n->ref(); m_currentNodeStack.append(m_currentNode); m_currentNode = n; - if (m_currentNodeStack.size() > maxNestingDepth) + if (m_currentNodeStack.size() > maxDOMTreeDepth) handleError(fatal, "Excessive node nesting.", lineNumber(), columnNumber()); } diff --git a/WebCore/editing/EditCommand.cpp b/WebCore/editing/EditCommand.cpp index 2301c54..db447a5 100644 --- a/WebCore/editing/EditCommand.cpp +++ b/WebCore/editing/EditCommand.cpp @@ -62,7 +62,7 @@ void EditCommand::apply() Frame* frame = m_document->frame(); - if (!m_parent) { + if (isTopLevelCommand()) { if (!endingSelection().isContentRichlyEditable()) { switch (editingAction()) { case EditActionTyping: @@ -83,7 +83,7 @@ void EditCommand::apply() // require a layout, as in <rdar://problem/5658603>. Low level operations, like // RemoveNodeCommand, don't require a layout because the high level operations that // use them perform one if one is necessary (like for the creation of VisiblePositions). - if (!m_parent) + if (isTopLevelCommand()) updateLayout(); DeleteButtonController* deleteButtonController = frame->editor()->deleteButtonController(); @@ -91,8 +91,7 @@ void EditCommand::apply() doApply(); deleteButtonController->enable(); - if (!m_parent) { - updateLayout(); + if (isTopLevelCommand()) { // Only need to call appliedEditing for top-level commands, and TypingCommands do it on their // own (see TypingCommand::typingAddedToOpenCommand). if (!isTypingCommand()) @@ -111,7 +110,7 @@ void EditCommand::unapply() // require a layout, as in <rdar://problem/5658603>. Low level operations, like // RemoveNodeCommand, don't require a layout because the high level operations that // use them perform one if one is necessary (like for the creation of VisiblePositions). - if (!m_parent) + if (isTopLevelCommand()) updateLayout(); DeleteButtonController* deleteButtonController = frame->editor()->deleteButtonController(); @@ -119,10 +118,8 @@ void EditCommand::unapply() doUnapply(); deleteButtonController->enable(); - if (!m_parent) { - updateLayout(); + if (isTopLevelCommand()) frame->editor()->unappliedEditing(this); - } } void EditCommand::reapply() @@ -136,7 +133,7 @@ void EditCommand::reapply() // require a layout, as in <rdar://problem/5658603>. Low level operations, like // RemoveNodeCommand, don't require a layout because the high level operations that // use them perform one if one is necessary (like for the creation of VisiblePositions). - if (!m_parent) + if (isTopLevelCommand()) updateLayout(); DeleteButtonController* deleteButtonController = frame->editor()->deleteButtonController(); @@ -144,10 +141,8 @@ void EditCommand::reapply() doReapply(); deleteButtonController->enable(); - if (!m_parent) { - updateLayout(); + if (isTopLevelCommand()) frame->editor()->reappliedEditing(this); - } } void EditCommand::doReapply() diff --git a/WebCore/editing/EditCommand.h b/WebCore/editing/EditCommand.h index 7dc4d92..e50e88d 100644 --- a/WebCore/editing/EditCommand.h +++ b/WebCore/editing/EditCommand.h @@ -57,6 +57,8 @@ public: virtual bool isTypingCommand() const; virtual bool preservesTypingStyle() const; + + bool isTopLevelCommand() const { return !m_parent; } protected: EditCommand(Document*); diff --git a/WebCore/editing/Editor.cpp b/WebCore/editing/Editor.cpp index e171ac1..be89846 100644 --- a/WebCore/editing/Editor.cpp +++ b/WebCore/editing/Editor.cpp @@ -867,6 +867,8 @@ static void dispatchEditableContentChangedEvents(const EditCommand& command) void Editor::appliedEditing(PassRefPtr<EditCommand> cmd) { + m_frame->document()->updateLayout(); + dispatchEditableContentChangedEvents(*cmd); VisibleSelection newSelection(cmd->endingSelection()); @@ -891,6 +893,8 @@ void Editor::appliedEditing(PassRefPtr<EditCommand> cmd) void Editor::unappliedEditing(PassRefPtr<EditCommand> cmd) { + m_frame->document()->updateLayout(); + dispatchEditableContentChangedEvents(*cmd); VisibleSelection newSelection(cmd->startingSelection()); @@ -904,6 +908,8 @@ void Editor::unappliedEditing(PassRefPtr<EditCommand> cmd) void Editor::reappliedEditing(PassRefPtr<EditCommand> cmd) { + m_frame->document()->updateLayout(); + dispatchEditableContentChangedEvents(*cmd); VisibleSelection newSelection(cmd->endingSelection()); diff --git a/WebCore/editing/EditorCommand.cpp b/WebCore/editing/EditorCommand.cpp index 34fa46d..4cb34ac 100644 --- a/WebCore/editing/EditorCommand.cpp +++ b/WebCore/editing/EditorCommand.cpp @@ -1069,6 +1069,21 @@ static bool supportedFromMenuOrKeyBinding(Frame*, EditorCommandSource source) return source == CommandFromMenuOrKeyBinding; } +static bool supportedCopyCut(Frame* frame, EditorCommandSource source) +{ + switch (source) { + case CommandFromMenuOrKeyBinding: + return true; + case CommandFromDOM: + case CommandFromDOMWithUserInterface: { + Settings* settings = frame ? frame->settings() : 0; + return settings && settings->javaScriptCanAccessClipboard(); + } + } + ASSERT_NOT_REACHED(); + return false; +} + static bool supportedPaste(Frame* frame, EditorCommandSource source) { switch (source) { @@ -1077,7 +1092,7 @@ static bool supportedPaste(Frame* frame, EditorCommandSource source) case CommandFromDOM: case CommandFromDOMWithUserInterface: { Settings* settings = frame ? frame->settings() : 0; - return settings && settings->isDOMPasteAllowed(); + return settings && (settings->javaScriptCanAccessClipboard() ? settings->isDOMPasteAllowed() : 0); } } ASSERT_NOT_REACHED(); @@ -1304,9 +1319,9 @@ static const CommandMap& createCommandMap() { "BackColor", { executeBackColor, supported, enabledInRichlyEditableText, stateNone, valueBackColor, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "BackwardDelete", { executeDeleteBackward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, // FIXME: remove BackwardDelete when Safari for Windows stops using it. { "Bold", { executeToggleBold, supported, enabledInRichlyEditableText, stateBold, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, - { "Copy", { executeCopy, supported, enabledCopy, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } }, + { "Copy", { executeCopy, supportedCopyCut, enabledCopy, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } }, { "CreateLink", { executeCreateLink, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, - { "Cut", { executeCut, supported, enabledCut, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } }, + { "Cut", { executeCut, supportedCopyCut, enabledCut, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } }, { "Delete", { executeDelete, supported, enabledDelete, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "DeleteBackward", { executeDeleteBackward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "DeleteBackwardByDecomposingPreviousCharacter", { executeDeleteBackwardByDecomposingPreviousCharacter, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, diff --git a/WebCore/editing/TextIterator.cpp b/WebCore/editing/TextIterator.cpp index e022e3b..f3bd9df 100644 --- a/WebCore/editing/TextIterator.cpp +++ b/WebCore/editing/TextIterator.cpp @@ -254,27 +254,12 @@ TextIterator::TextIterator() , m_textCharacters(0) , m_textLength(0) , m_lastCharacter(0) - , m_emitCharactersBetweenAllVisiblePositions(false) - , m_enterTextControls(false) + , m_emitsCharactersBetweenAllVisiblePositions(false) + , m_entersTextControls(false) , m_emitsTextWithoutTranscoding(false) { } -TextIterator::TextIterator(const Range* r, bool emitCharactersBetweenAllVisiblePositions, bool enterTextControls) - : m_startContainer(0) - , m_startOffset(0) - , m_endContainer(0) - , m_endOffset(0) - , m_positionNode(0) - , m_textCharacters(0) - , m_textLength(0) - , m_emitCharactersBetweenAllVisiblePositions(emitCharactersBetweenAllVisiblePositions) - , m_enterTextControls(enterTextControls) - , m_emitsTextWithoutTranscoding(false) -{ - init(r); -} - TextIterator::TextIterator(const Range* r, TextIteratorBehavior behavior) : m_startContainer(0) , m_startOffset(0) @@ -283,14 +268,9 @@ TextIterator::TextIterator(const Range* r, TextIteratorBehavior behavior) , m_positionNode(0) , m_textCharacters(0) , m_textLength(0) - , m_emitCharactersBetweenAllVisiblePositions(behavior & TextIteratorBehaviorEmitCharactersBetweenAllVisiblePositions) - , m_enterTextControls(behavior & TextIteratorBehaviorEnterTextControls) - , m_emitsTextWithoutTranscoding(behavior & TextIteratorBehaviorEmitsTextsWithoutTranscoding) -{ - init(r); -} - -void TextIterator::init(const Range* r) + , m_emitsCharactersBetweenAllVisiblePositions(behavior & TextIteratorEmitsCharactersBetweenAllVisiblePositions) + , m_entersTextControls(behavior & TextIteratorEntersTextControls) + , m_emitsTextWithoutTranscoding(behavior & TextIteratorEmitsTextsWithoutTranscoding) { if (!r) return; @@ -326,11 +306,11 @@ void TextIterator::init(const Range* r) m_pastEndNode = nextInPreOrderCrossingShadowBoundaries(endContainer, endOffset); // initialize node processing state - m_needAnotherNewline = false; + m_needsAnotherNewline = false; m_textBox = 0; // initialize record of previous node processing - m_haveEmitted = false; + m_hasEmitted = false; m_lastTextNode = 0; m_lastTextNodeEndedWithCollapsedSpace = false; m_lastCharacter = 0; @@ -351,16 +331,16 @@ void TextIterator::advance() m_textLength = 0; // handle remembered node that needed a newline after the text node's newline - if (m_needAnotherNewline) { + if (m_needsAnotherNewline) { // Emit the extra newline, and position it *inside* m_node, after m_node's // contents, in case it's a block, in the same way that we position the first // newline. The range for the emitted newline should start where the line // break begins. // FIXME: It would be cleaner if we emitted two newlines during the last - // iteration, instead of using m_needAnotherNewline. + // iteration, instead of using m_needsAnotherNewline. Node* baseNode = m_node->lastChild() ? m_node->lastChild() : m_node; emitCharacter('\n', baseNode->parentNode(), baseNode, 1, 1); - m_needAnotherNewline = false; + m_needsAnotherNewline = false; return; } @@ -494,7 +474,7 @@ bool TextIterator::handleTextNode() m_sortedTextBoxesPosition = 0; } - m_textBox = renderer->containsReversedText() ? m_sortedTextBoxes[0] : renderer->firstTextBox(); + m_textBox = renderer->containsReversedText() ? (m_sortedTextBoxes.isEmpty() ? 0 : m_sortedTextBoxes[0]) : renderer->firstTextBox(); handleTextBox(); return true; } @@ -585,7 +565,7 @@ bool TextIterator::handleReplacedElement() return false; } - if (m_enterTextControls && renderer->isTextControl()) { + if (m_entersTextControls && renderer->isTextControl()) { if (HTMLElement* innerTextElement = toRenderTextControl(renderer)->innerTextElement()) { m_node = innerTextElement->shadowTreeRootNode(); pushFullyClippedState(m_fullyClippedStack, m_node); @@ -594,9 +574,9 @@ bool TextIterator::handleReplacedElement() } } - m_haveEmitted = true; + m_hasEmitted = true; - if (m_emitCharactersBetweenAllVisiblePositions) { + if (m_emitsCharactersBetweenAllVisiblePositions) { // We want replaced elements to behave like punctuation for boundary // finding, and to simply take up space for the selection preservation // code in moveParagraphs, so we use a comma. @@ -758,7 +738,7 @@ static int maxOffsetIncludingCollapsedSpaces(Node* node) // Whether or not we should emit a character as we enter m_node (if it's a container) or as we hit it (if it's atomic). bool TextIterator::shouldRepresentNodeOffsetZero() { - if (m_emitCharactersBetweenAllVisiblePositions && m_node->renderer() && m_node->renderer()->isTable()) + if (m_emitsCharactersBetweenAllVisiblePositions && m_node->renderer() && m_node->renderer()->isTable()) return true; // Leave element positioned flush with start of a paragraph @@ -767,7 +747,7 @@ bool TextIterator::shouldRepresentNodeOffsetZero() return false; // Otherwise, show the position if we have emitted any characters - if (m_haveEmitted) + if (m_hasEmitted) return true; // We've not emitted anything yet. Generally, there is no need for any positioning then. @@ -789,7 +769,7 @@ bool TextIterator::shouldRepresentNodeOffsetZero() // If we started as m_startContainer offset 0 and the current node is a descendant of // the start container, we already had enough context to correctly decide whether to - // emit after a preceding block. We chose not to emit (m_haveEmitted is false), + // emit after a preceding block. We chose not to emit (m_hasEmitted is false), // so don't second guess that now. // NOTE: Is this really correct when m_node is not a leftmost descendant? Probably // immaterial since we likely would have already emitted something by now. @@ -813,7 +793,7 @@ bool TextIterator::shouldRepresentNodeOffsetZero() bool TextIterator::shouldEmitSpaceBeforeAndAfterNode(Node* node) { - return node->renderer() && node->renderer()->isTable() && (node->renderer()->isInline() || m_emitCharactersBetweenAllVisiblePositions); + return node->renderer() && node->renderer()->isTable() && (node->renderer()->isInline() || m_emitsCharactersBetweenAllVisiblePositions); } void TextIterator::representNodeOffsetZero() @@ -840,7 +820,7 @@ bool TextIterator::handleNonTextNode() { if (shouldEmitNewlineForNode(m_node)) emitCharacter('\n', m_node->parentNode(), m_node, 0, 1); - else if (m_emitCharactersBetweenAllVisiblePositions && m_node->renderer() && m_node->renderer()->isHR()) + else if (m_emitsCharactersBetweenAllVisiblePositions && m_node->renderer() && m_node->renderer()->isHR()) emitCharacter(' ', m_node->parentNode(), m_node, 0, 1); else representNodeOffsetZero(); @@ -851,10 +831,10 @@ bool TextIterator::handleNonTextNode() void TextIterator::exitNode() { // prevent emitting a newline when exiting a collapsed block at beginning of the range - // FIXME: !m_haveEmitted does not necessarily mean there was a collapsed block... it could + // FIXME: !m_hasEmitted does not necessarily mean there was a collapsed block... it could // have been an hr (e.g.). Also, a collapsed block could have height (e.g. a table) and // therefore look like a blank line. - if (!m_haveEmitted) + if (!m_hasEmitted) return; // Emit with a position *inside* m_node, after m_node's contents, in @@ -875,8 +855,8 @@ void TextIterator::exitNode() // insert a newline with a position following this block's contents. emitCharacter('\n', baseNode->parentNode(), baseNode, 1, 1); // remember whether to later add a newline for the current node - ASSERT(!m_needAnotherNewline); - m_needAnotherNewline = addNewline; + ASSERT(!m_needsAnotherNewline); + m_needsAnotherNewline = addNewline; } else if (addNewline) // insert a newline with a position following this block's contents. emitCharacter('\n', baseNode->parentNode(), baseNode, 1, 1); @@ -889,7 +869,7 @@ void TextIterator::exitNode() void TextIterator::emitCharacter(UChar c, Node* textNode, Node* offsetBaseNode, int textStartOffset, int textEndOffset) { - m_haveEmitted = true; + m_hasEmitted = true; // remember information with which to construct the TextIterator::range() // NOTE: textNode is often not a text node, so the range will specify child nodes of positionNode @@ -911,19 +891,19 @@ void TextIterator::emitCharacter(UChar c, Node* textNode, Node* offsetBaseNode, void TextIterator::emitText(Node* textNode, int textStartOffset, int textEndOffset) { RenderText* renderer = toRenderText(m_node->renderer()); - String str = m_emitsTextWithoutTranscoding ? renderer->textWithoutTranscoding() : renderer->text(); - ASSERT(str.characters()); + m_text = m_emitsTextWithoutTranscoding ? renderer->textWithoutTranscoding() : renderer->text(); + ASSERT(m_text.characters()); m_positionNode = textNode; m_positionOffsetBaseNode = 0; m_positionStartOffset = textStartOffset; m_positionEndOffset = textEndOffset; - m_textCharacters = str.characters() + textStartOffset; + m_textCharacters = m_text.characters() + textStartOffset; m_textLength = textEndOffset - textStartOffset; - m_lastCharacter = str[textEndOffset - 1]; + m_lastCharacter = m_text[textEndOffset - 1]; m_lastTextNodeEndedWithCollapsedSpace = false; - m_haveEmitted = true; + m_hasEmitted = true; } PassRefPtr<Range> TextIterator::range() const @@ -1174,11 +1154,11 @@ CharacterIterator::CharacterIterator() { } -CharacterIterator::CharacterIterator(const Range* r, bool emitCharactersBetweenAllVisiblePositions, bool enterTextControls) +CharacterIterator::CharacterIterator(const Range* r, TextIteratorBehavior behavior) : m_offset(0) , m_runOffset(0) , m_atBreak(true) - , m_textIterator(r, emitCharactersBetweenAllVisiblePositions, enterTextControls) + , m_textIterator(r, behavior) { while (!atEnd() && m_textIterator.length() == 0) m_textIterator.advance(); @@ -2013,7 +1993,7 @@ size_t SearchBuffer::length() const int TextIterator::rangeLength(const Range* r, bool forSelectionPreservation) { int length = 0; - for (TextIterator it(r, forSelectionPreservation); !it.atEnd(); it.advance()) + for (TextIterator it(r, forSelectionPreservation ? TextIteratorEmitsCharactersBetweenAllVisiblePositions : TextIteratorDefaultBehavior); !it.atEnd(); it.advance()) length += it.length(); return length; @@ -2035,7 +2015,7 @@ PassRefPtr<Range> TextIterator::rangeFromLocationAndLength(Element* scope, int r RefPtr<Range> textRunRange; - TextIterator it(rangeOfContents(scope).get(), forSelectionPreservation); + TextIterator it(rangeOfContents(scope).get(), forSelectionPreservation ? TextIteratorEmitsCharactersBetweenAllVisiblePositions : TextIteratorDefaultBehavior); // FIXME: the atEnd() check shouldn't be necessary, workaround for <http://bugs.webkit.org/show_bug.cgi?id=6289>. if (rangeLocation == 0 && rangeLength == 0 && it.atEnd()) { @@ -2138,7 +2118,7 @@ UChar* plainTextToMallocAllocatedBuffer(const Range* r, unsigned& bufferLength, Vector<TextSegment>* textSegments = 0; Vector<UChar> textBuffer; textBuffer.reserveInitialCapacity(cMaxSegmentSize); - for (TextIterator it(r, isDisplayString ? TextIteratorBehaviorDefault : TextIteratorBehaviorEmitsTextsWithoutTranscoding); !it.atEnd(); it.advance()) { + for (TextIterator it(r, isDisplayString ? TextIteratorDefaultBehavior : TextIteratorEmitsTextsWithoutTranscoding); !it.atEnd(); it.advance()) { if (textBuffer.size() && textBuffer.size() + it.length() > cMaxSegmentSize) { UChar* newSegmentBuffer = static_cast<UChar*>(malloc(textBuffer.size() * sizeof(UChar))); if (!newSegmentBuffer) @@ -2258,14 +2238,14 @@ PassRefPtr<Range> findPlainText(const Range* range, const String& target, bool f size_t matchStart; size_t matchLength; { - CharacterIterator findIterator(range, false, true); + CharacterIterator findIterator(range, TextIteratorEntersTextControls); matchLength = findPlainText(findIterator, target, forward, caseSensitive, matchStart); if (!matchLength) return collapsedToBoundary(range, forward); } // Then, find the document position of the start and the end of the text. - CharacterIterator computeRangeIterator(range, false, true); + CharacterIterator computeRangeIterator(range, TextIteratorEntersTextControls); return characterSubrange(computeRangeIterator, matchStart, matchLength); } diff --git a/WebCore/editing/TextIterator.h b/WebCore/editing/TextIterator.h index abd8161..ba381b9 100644 --- a/WebCore/editing/TextIterator.h +++ b/WebCore/editing/TextIterator.h @@ -69,17 +69,16 @@ private: // chunks so as to optimize for performance of the iteration. enum TextIteratorBehavior { - TextIteratorBehaviorDefault = 0, - TextIteratorBehaviorEmitCharactersBetweenAllVisiblePositions = 1 << 0, - TextIteratorBehaviorEnterTextControls = 1 << 1, - TextIteratorBehaviorEmitsTextsWithoutTranscoding = 1 << 2, + TextIteratorDefaultBehavior = 0, + TextIteratorEmitsCharactersBetweenAllVisiblePositions = 1 << 0, + TextIteratorEntersTextControls = 1 << 1, + TextIteratorEmitsTextsWithoutTranscoding = 1 << 2, }; class TextIterator { public: TextIterator(); - explicit TextIterator(const Range*, bool emitCharactersBetweenAllVisiblePositions = false, bool enterTextControls = false); - TextIterator(const Range*, TextIteratorBehavior); + explicit TextIterator(const Range*, TextIteratorBehavior = TextIteratorDefaultBehavior); bool atEnd() const { return !m_positionNode; } void advance(); @@ -95,7 +94,6 @@ public: static PassRefPtr<Range> subrange(Range* entireRange, int characterOffset, int characterCount); private: - void init(const Range*); void exitNode(); bool shouldRepresentNodeOffsetZero(); bool shouldEmitSpaceBeforeAndAfterNode(Node*); @@ -129,10 +127,12 @@ private: mutable int m_positionEndOffset; const UChar* m_textCharacters; int m_textLength; - + // Hold string m_textCharacters points to so we ensure it won't be deleted. + String m_text; + // Used when there is still some pending text from the current node; when these // are false and 0, we go back to normal iterating. - bool m_needAnotherNewline; + bool m_needsAnotherNewline; InlineTextBox* m_textBox; // Used to do the whitespace collapsing logic. @@ -148,14 +148,14 @@ private: size_t m_sortedTextBoxesPosition; // Used when deciding whether to emit a "positioning" (e.g. newline) before any other content - bool m_haveEmitted; + bool m_hasEmitted; // Used by selection preservation code. There should be one character emitted between every VisiblePosition // in the Range used to create the TextIterator. // FIXME <rdar://problem/6028818>: This functionality should eventually be phased out when we rewrite // moveParagraphs to not clone/destroy moved content. - bool m_emitCharactersBetweenAllVisiblePositions; - bool m_enterTextControls; + bool m_emitsCharactersBetweenAllVisiblePositions; + bool m_entersTextControls; // Used when we want texts for copying, pasting, and transposing. bool m_emitsTextWithoutTranscoding; @@ -222,7 +222,7 @@ private: class CharacterIterator { public: CharacterIterator(); - explicit CharacterIterator(const Range*, bool emitCharactersBetweenAllVisiblePositions = false, bool enterTextControls = false); + explicit CharacterIterator(const Range*, TextIteratorBehavior = TextIteratorDefaultBehavior); void advance(int numCharacters); diff --git a/WebCore/editing/VisibleSelection.cpp b/WebCore/editing/VisibleSelection.cpp index 6784631..4037670 100644 --- a/WebCore/editing/VisibleSelection.cpp +++ b/WebCore/editing/VisibleSelection.cpp @@ -226,7 +226,7 @@ void VisibleSelection::appendTrailingWhitespace() if (!searchRange) return; - CharacterIterator charIt(searchRange.get(), true); + CharacterIterator charIt(searchRange.get(), TextIteratorEmitsCharactersBetweenAllVisiblePositions); for (; charIt.length(); charIt.advance(1)) { UChar c = charIt.characters()[0]; @@ -481,10 +481,8 @@ void VisibleSelection::adjustSelectionToAvoidCrossingEditingBoundaries() if (endRoot != baseRoot) { VisiblePosition last = lastEditablePositionBeforePositionInRoot(m_end, baseRoot); m_end = last.deepEquivalent(); - if (m_end.isNull()) { - ASSERT_NOT_REACHED(); + if (m_end.isNull()) m_end = m_start; - } } // The selection is based in non-editable content. } else { diff --git a/WebCore/editing/qt/SmartReplaceQt.cpp b/WebCore/editing/qt/SmartReplaceQt.cpp new file mode 100644 index 0000000..1436afe --- /dev/null +++ b/WebCore/editing/qt/SmartReplaceQt.cpp @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2010 Robert Hogan <robert@roberthogan.net>. All rights reserved. + * Copyright (C) 2007,2008,2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "SmartReplace.h" + +namespace WebCore { + +bool isCharacterSmartReplaceExempt(UChar32 c, bool isPreviousCharacter) +{ + QChar d(c); + if (d.isSpace()) + return true; + if (!isPreviousCharacter && d.isPunct()) + return true; + + if ((c >= 0x1100 && c <= (0x1100 + 256)) // Hangul Jamo (0x1100 - 0x11FF) + || (c >= 0x2E80 && c <= (0x2E80 + 352)) // CJK & Kangxi Radicals (0x2E80 - 0x2FDF) + || (c >= 0x2FF0 && c <= (0x2FF0 + 464)) // Ideograph Deseriptions, CJK Symbols, Hiragana, Katakana, Bopomofo, Hangul Compatibility Jamo, Kanbun, & Bopomofo Ext (0x2FF0 - 0x31BF) + || (c >= 0x3200 && c <= (0x3200 + 29392)) // Enclosed CJK, CJK Ideographs (Uni Han & Ext A), & Yi (0x3200 - 0xA4CF) + || (c >= 0xAC00 && c <= (0xAC00 + 11183)) // Hangul Syllables (0xAC00 - 0xD7AF) + || (c >= 0xF900 && c <= (0xF900 + 352)) // CJK Compatibility Ideographs (0xF900 - 0xFA5F) + || (c >= 0xFE30 && c <= (0xFE30 + 32)) // CJK Compatibility From (0xFE30 - 0xFE4F) + || (c >= 0xFF00 && c <= (0xFF00 + 240)) // Half/Full Width Form (0xFF00 - 0xFFEF) + || (c >= 0x20000 && c <= (0x20000 + 0xA6D7)) // CJK Ideograph Exntension B + || (c >= 0x2F800 && c <= (0x2F800 + 0x021E))) // CJK Compatibility Ideographs (0x2F800 - 0x2FA1D) + return true; + + const char prev[] = "([\"\'#$/-`{\0"; + const char next[] = ")].,;:?\'!\"%*-/}\0"; + const char* str = (isPreviousCharacter) ? prev : next; + for (int i = 0; i < strlen(str); ++i) { + if (str[i] == c) + return true; + } + + return false; +} + +} diff --git a/WebCore/editing/visible_units.cpp b/WebCore/editing/visible_units.cpp index 3d85ad1..c094aac 100644 --- a/WebCore/editing/visible_units.cpp +++ b/WebCore/editing/visible_units.cpp @@ -207,7 +207,7 @@ static VisiblePosition nextBoundary(const VisiblePosition& c, BoundarySearchFunc searchRange->selectNodeContents(boundary, ec); searchRange->setStart(start.node(), start.deprecatedEditingOffset(), ec); - TextIterator it(searchRange.get(), true); + TextIterator it(searchRange.get(), TextIteratorEmitsCharactersBetweenAllVisiblePositions); unsigned next = 0; bool inTextSecurityMode = start.node() && start.node()->renderer() && start.node()->renderer()->style()->textSecurity() != TSNONE; bool needMoreContext = false; @@ -238,7 +238,7 @@ static VisiblePosition nextBoundary(const VisiblePosition& c, BoundarySearchFunc pos = it.range()->startPosition(); } else if (next != prefixLength) { // Use the character iterator to translate the next value into a DOM position. - CharacterIterator charIt(searchRange.get(), true); + CharacterIterator charIt(searchRange.get(), TextIteratorEmitsCharactersBetweenAllVisiblePositions); charIt.advance(next - prefixLength - 1); pos = charIt.range()->endPosition(); diff --git a/WebCore/bindings/js/JSDatabaseCallback.h b/WebCore/html/FileError.h index 752a2c3..8190883 100644 --- a/WebCore/bindings/js/JSDatabaseCallback.h +++ b/WebCore/html/FileError.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Google Inc. All rights reserved. + * Copyright (C) 2010 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -28,39 +28,33 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef JSDatabaseCallback_h -#define JSDatabaseCallback_h +#ifndef FileError_h +#define FileError_h -#if ENABLE(DATABASE) +#if ENABLE(FILE_READER) || ENABLE(FILE_WRITER) -#include "DatabaseCallback.h" -#include "JSCallbackData.h" -#include <wtf/Forward.h> +#include "ExceptionCode.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> namespace WebCore { -class ScriptExecutionContext; - -class JSDatabaseCallback : public DatabaseCallback { +class FileError : public RefCounted<FileError> { public: - static PassRefPtr<JSDatabaseCallback> create(JSC::JSObject* callback, JSDOMGlobalObject* globalObject) - { - return adoptRef(new JSDatabaseCallback(callback, globalObject)); - } - - virtual ~JSDatabaseCallback(); + static PassRefPtr<FileError> create(ExceptionCode code) { return adoptRef(new FileError(code)); } - virtual void handleEvent(ScriptExecutionContext*, Database*); + ExceptionCode code() const { return m_code; } private: - JSDatabaseCallback(JSC::JSObject* callback, JSDOMGlobalObject*); + FileError(ExceptionCode code) + : m_code(code) + { } - JSCallbackData* m_data; - RefPtr<DOMWrapperWorld> m_isolatedWorld; + ExceptionCode m_code; }; -} +} // namespace WebCore -#endif // ENABLE(DATABASE) +#endif // ENABLE(FILE_READER) || ENABLE(FILE_WRITER) -#endif // JSDatabaseCallback_h +#endif // FileError_h diff --git a/WebCore/bindings/v8/custom/V8DatabaseCallback.h b/WebCore/html/FileError.idl index 064a9a7..6c2b08c 100644 --- a/WebCore/bindings/v8/custom/V8DatabaseCallback.h +++ b/WebCore/html/FileError.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Google Inc. All rights reserved. + * Copyright (C) 2010 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -28,41 +28,16 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef V8DatabaseCallback_h -#define V8DatabaseCallback_h - -#if ENABLE(DATABASE) - -#include "DatabaseCallback.h" -#include "WorldContextHandle.h" -#include <v8.h> -#include <wtf/Forward.h> - -namespace WebCore { - -class Frame; - -class V8DatabaseCallback : public DatabaseCallback { -public: - static PassRefPtr<V8DatabaseCallback> create(v8::Local<v8::Value> value, Frame* frame) - { - ASSERT(value->IsObject()); - return adoptRef(new V8DatabaseCallback(value->ToObject(), frame)); - } - virtual ~V8DatabaseCallback(); - - virtual void handleEvent(ScriptExecutionContext*, Database*); - -private: - V8DatabaseCallback(v8::Local<v8::Object>, Frame*); - - v8::Persistent<v8::Object> m_callback; - RefPtr<Frame> m_frame; - WorldContextHandle m_worldContext; -}; - -} // namespace WebCore - -#endif - -#endif // V8DatabaseCallback_h +module html { + interface [ + Conditional=FILE_READER|FILE_WRITER + ] FileError { + const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7; + const unsigned short NOT_FOUND_ERR = 8; + const unsigned short SECURITY_ERR = 18; + const unsigned short ABORT_ERR = 20; + const unsigned short NOT_READABLE_ERR = 24; + const unsigned short ENCODING_ERR = 26; + readonly attribute unsigned short code; + }; +} diff --git a/WebCore/html/FileReader.cpp b/WebCore/html/FileReader.cpp new file mode 100644 index 0000000..69e01ce --- /dev/null +++ b/WebCore/html/FileReader.cpp @@ -0,0 +1,295 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(FILE_READER) + +#include "FileReader.h" + +#include "Base64.h" +#include "Blob.h" +#include "File.h" +#include "FileStreamProxy.h" +#include "Logging.h" +#include "ProgressEvent.h" +#include "ScriptExecutionContext.h" +#include <wtf/CurrentTime.h> + +namespace WebCore { + +const unsigned bufferSize = 1024; +const double progressNotificationIntervalMS = 50; + +FileReader::FileReader(ScriptExecutionContext* context) + : ActiveDOMObject(context, this) + , m_state(Empty) + , m_readType(ReadFileAsBinaryString) + , m_result("") + , m_isRawDataConverted(false) + , m_bytesLoaded(0) + , m_totalBytes(0) + , m_lastProgressNotificationTimeMS(0) + , m_alreadyStarted(false) +{ + m_buffer.resize(bufferSize); +} + +FileReader::~FileReader() +{ + terminate(); +} + +bool FileReader::hasPendingActivity() const +{ + return m_state == Loading || ActiveDOMObject::hasPendingActivity(); +} + +bool FileReader::canSuspend() const +{ + // FIXME: It is not currently possible to suspend a FileReader, so pages with FileReader can not go into page cache. + return false; +} + +void FileReader::stop() +{ + terminate(); +} + +void FileReader::readAsBinaryString(Blob* fileBlob) +{ + LOG(FileAPI, "FileReader: reading as binary: %s\n", fileBlob->path().utf8().data()); + + readInternal(fileBlob, ReadFileAsBinaryString); +} + +void FileReader::readAsText(Blob* fileBlob, const String& encoding) +{ + LOG(FileAPI, "FileReader: reading as text: %s\n", fileBlob->path().utf8().data()); + + if (!encoding.isEmpty()) + m_encoding = TextEncoding(encoding); + readInternal(fileBlob, ReadFileAsText); +} + +void FileReader::readAsDataURL(File* file) +{ + LOG(FileAPI, "FileReader: reading as data URL: %s\n", file->path().utf8().data()); + + m_fileType = file->type(); + readInternal(file, ReadFileAsDataURL); +} + +void FileReader::readInternal(Blob* fileBlob, ReadType type) +{ + // readAs*** methods() can be called multiple times. Only the last call before the actual reading happens is processed. + if (m_alreadyStarted) + return; + + m_fileBlob = fileBlob; + m_readType = type; + + // When FileStreamProxy is created, FileReader::didStart() will get notified on the File thread and we will start + // opening and reading the file since then. + if (!m_streamProxy.get()) + m_streamProxy = FileStreamProxy::create(scriptExecutionContext(), this); +} + +void FileReader::abort() +{ + LOG(FileAPI, "FileReader: aborting\n"); + + terminate(); + + m_result = ""; + m_error = FileError::create(ABORT_ERR); + + fireEvent(eventNames().errorEvent); + fireEvent(eventNames().abortEvent); + fireEvent(eventNames().loadendEvent); +} + +void FileReader::terminate() +{ + if (m_streamProxy) { + m_streamProxy->stop(); + m_streamProxy = 0; + } + m_state = Done; +} + +void FileReader::didStart() +{ + m_alreadyStarted = true; + m_streamProxy->openForRead(m_fileBlob.get()); +} + +void FileReader::didGetSize(long long size) +{ + m_state = Loading; + fireEvent(eventNames().loadstartEvent); + + m_totalBytes = size; + m_streamProxy->read(&m_buffer.at(0), m_buffer.size()); +} + +void FileReader::didRead(const char* data, int bytesRead) +{ + ASSERT(data && bytesRead); + + // Bail out if we have aborted the reading. + if (m_state == Done) + return; + + switch (m_readType) { + case ReadFileAsBinaryString: + m_result += String(data, static_cast<unsigned>(bytesRead)); + break; + case ReadFileAsText: + case ReadFileAsDataURL: + m_rawData.append(data, static_cast<unsigned>(bytesRead)); + m_isRawDataConverted = false; + break; + default: + ASSERT_NOT_REACHED(); + } + + m_bytesLoaded += bytesRead; + + // Fire the progress event at least every 50ms. + double now = WTF::currentTimeMS(); + if (!m_lastProgressNotificationTimeMS) + m_lastProgressNotificationTimeMS = now; + else if (now - m_lastProgressNotificationTimeMS > progressNotificationIntervalMS) { + fireEvent(eventNames().progressEvent); + m_lastProgressNotificationTimeMS = now; + } + + // Continue reading. + m_streamProxy->read(&m_buffer.at(0), m_buffer.size()); +} + +void FileReader::didFinish() +{ + m_state = Done; + + m_streamProxy->close(); + + fireEvent(eventNames().loadEvent); + fireEvent(eventNames().loadendEvent); +} + +void FileReader::didFail(ExceptionCode ec) +{ + m_state = Done; + m_error = FileError::create(ec); + + m_streamProxy->close(); + + fireEvent(eventNames().errorEvent); + fireEvent(eventNames().loadendEvent); +} + +void FileReader::fireEvent(const AtomicString& type) +{ + // FIXME: the current ProgressEvent uses "unsigned long" for total and loaded attributes. Need to talk with the spec writer to resolve the issue. + dispatchEvent(ProgressEvent::create(type, true, static_cast<unsigned>(m_bytesLoaded), static_cast<unsigned>(m_totalBytes))); +} + +const ScriptString& FileReader::result() +{ + // If reading as binary string, we can return the result immediately. + if (m_readType == ReadFileAsBinaryString) + return m_result; + + // If we already convert the raw data received so far, we can return the result now. + if (m_isRawDataConverted) + return m_result; + m_isRawDataConverted = true; + + if (m_readType == ReadFileAsText) + convertToText(); + // For data URL, we only do the coversion until we receive all the raw data. + else if (m_readType == ReadFileAsDataURL && m_state == Done) + convertToDataURL(); + + return m_result; +} + +void FileReader::convertToText() +{ + if (!m_rawData.size()) { + m_result = ""; + return; + } + + // Try to determine the encoding if it is not provided. + // FIXME: move the following logic to a more generic place. + int offset = 0; + if (!m_encoding.isValid()) { + if (m_rawData.size() >= 2 && m_rawData[0] == '\xFE' && m_rawData[1] == '\xFF') { + offset = 2; + m_encoding = UTF16BigEndianEncoding(); + } else if (m_rawData.size() >= 2 && m_rawData[0] == '\xFF' && m_rawData[1] == '\xFE') { + offset = 2; + m_encoding = UTF16LittleEndianEncoding(); + } else if (m_rawData.size() >= 2 && m_rawData[0] == '\xEF' && m_rawData[1] == '\xBB' && m_rawData[2] == '\xBF') { + offset = 3; + m_encoding = UTF8Encoding(); + } else + m_encoding = UTF8Encoding(); + } + + // Decode the data. + // FIXME: consider supporting incremental decoding to improve the perf. + m_result = m_encoding.decode(&m_rawData.at(0) + offset, m_rawData.size() - offset); +} + +void FileReader::convertToDataURL() +{ + m_result = "data:"; + + if (!m_rawData.size()) + return; + + m_result += m_fileType; + if (!m_fileType.isEmpty()) + m_result += ";"; + m_result += "base64,"; + + Vector<char> out; + base64Encode(m_rawData, out); + out.append('\0'); + m_result += out.data(); +} + +} // namespace WebCore + +#endif // ENABLE(FILE_READER) diff --git a/WebCore/html/FileReader.h b/WebCore/html/FileReader.h new file mode 100644 index 0000000..b30fad7 --- /dev/null +++ b/WebCore/html/FileReader.h @@ -0,0 +1,163 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FileReader_h +#define FileReader_h + +#if ENABLE(FILE_READER) + +#include "ActiveDOMObject.h" +#include "EventTarget.h" +#include "FileError.h" +#include "FileStreamClient.h" +#include "PlatformString.h" +#include "ScriptString.h" +#include "TextEncoding.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> +#include <wtf/Vector.h> + +namespace WebCore { + +class Blob; +class File; +class FileStreamProxy; +class ScriptExecutionContext; + +class FileReader : public RefCounted<FileReader>, public ActiveDOMObject, public EventTarget, public FileStreamClient { +public: + static PassRefPtr<FileReader> create(ScriptExecutionContext* context) + { + return adoptRef(new FileReader(context)); + } + + virtual ~FileReader(); + + enum ReadyState { + Empty = 0, + Loading = 1, + Done = 2 + }; + + void readAsBinaryString(Blob*); + void readAsText(Blob*, const String& encoding = ""); + void readAsDataURL(File*); + void abort(); + + ReadyState readyState() const { return m_state; } + PassRefPtr<FileError> error() { return m_error; } + const ScriptString& result(); + + // ActiveDOMObject + virtual bool canSuspend() const; + virtual void stop(); + virtual bool hasPendingActivity() const; + + // EventTarget + virtual FileReader* toFileReader() { return this; } + virtual ScriptExecutionContext* scriptExecutionContext() const { return ActiveDOMObject::scriptExecutionContext(); } + + // FileStreamClient + virtual void didStart(); + virtual void didGetSize(long long); + virtual void didRead(const char*, int); + virtual void didFinish(); + virtual void didFail(ExceptionCode); + + using RefCounted<FileReader>::ref; + using RefCounted<FileReader>::deref; + + DEFINE_ATTRIBUTE_EVENT_LISTENER(loadstart); + DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); + DEFINE_ATTRIBUTE_EVENT_LISTENER(load); + DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); + DEFINE_ATTRIBUTE_EVENT_LISTENER(error); + DEFINE_ATTRIBUTE_EVENT_LISTENER(loadend); + +private: + enum ReadType { + ReadFileAsBinaryString, + ReadFileAsText, + ReadFileAsDataURL + }; + + FileReader(ScriptExecutionContext*); + + // EventTarget + virtual void refEventTarget() { ref(); } + virtual void derefEventTarget() { deref(); } + virtual EventTargetData* eventTargetData() { return &m_eventTargetData; } + virtual EventTargetData* ensureEventTargetData() { return &m_eventTargetData; } + + void terminate(); + void readInternal(Blob*, ReadType); + void fireEvent(const AtomicString& type); + void convertToText(); + void convertToDataURL(); + + ReadyState m_state; + EventTargetData m_eventTargetData; + + RefPtr<Blob> m_fileBlob; + ReadType m_readType; + + // Like XMLHttpRequest.m_responseText, we keep this as a ScriptString, not a WebCore::String. + // That's because these strings can easily get huge (they are filled from the file) and + // because JS can easily observe many intermediate states, so it's very useful to be + // able to share the buffer with JavaScript versions of the whole or partial string. + // In contrast, this string doesn't interact much with the rest of the engine so it's not that + // big a cost that it isn't a String. + ScriptString m_result; + + // The raw data. We have to keep track of all the raw data for it to be converted to text or data URL data. + Vector<char> m_rawData; + bool m_isRawDataConverted; + + // Encoding scheme used to decode the data. + TextEncoding m_encoding; + + // Needed to create data URL. + String m_fileType; + + RefPtr<FileStreamProxy> m_streamProxy; + Vector<char> m_buffer; + RefPtr<FileError> m_error; + long long m_bytesLoaded; + long long m_totalBytes; + double m_lastProgressNotificationTimeMS; + bool m_alreadyStarted; +}; + +} // namespace WebCore + +#endif + +#endif // FileReader_h diff --git a/WebCore/html/FileStream.cpp b/WebCore/html/FileStream.cpp index 84a28d6..7089f61 100644 --- a/WebCore/html/FileStream.cpp +++ b/WebCore/html/FileStream.cpp @@ -42,6 +42,8 @@ namespace WebCore { FileStream::FileStream(FileStreamClient* client) : m_client(client) , m_handle(invalidPlatformFileHandle) + , m_bytesProcessed(0) + , m_totalBytesToRead(0) { } @@ -63,10 +65,56 @@ void FileStream::stop() m_client->didStop(); } -void FileStream::openForRead(Blob*) +void FileStream::openForRead(Blob* blob) { ASSERT(!isMainThread()); - // FIXME: to be implemented. + + if (isHandleValid(m_handle)) + return; + + // Check if the file exists by querying its modification time. We choose not to call fileExists() in order to save an + // extra file system call when the modification time is needed to check the validity of the sliced file blob. + // Per the spec, we need to return different error codes to differentiate between non-existent file and permission error. + // openFile() could not tell use the failure reason. + time_t currentModificationTime; + if (!getFileModificationTime(blob->path(), currentModificationTime)) { + m_client->didFail(NOT_FOUND_ERR); + return; + } + + // Open the file blob. + m_handle = openFile(blob->path(), OpenForRead); + if (!isHandleValid(m_handle)) { + m_client->didFail(NOT_READABLE_ERR); + return; + } + +#if ENABLE(BLOB_SLICE) + // Check the modificationt time for the possible file change. + if (blob->modificationTime() != Blob::doNotCheckFileChange && static_cast<time_t>(blob->modificationTime()) != currentModificationTime) { + m_client->didFail(NOT_READABLE_ERR); + return; + } + + // Jump to the beginning position if the file has been sliced. + if (blob->start() > 0) { + if (!seekFile(m_handle, blob->start(), SeekFromBeginning)) { + m_client->didFail(NOT_READABLE_ERR); + return; + } + } +#endif + + // Get the size. +#if ENABLE(BLOB_SLICE) + m_totalBytesToRead = blob->length(); + if (m_totalBytesToRead == Blob::toEndOfFile) + m_totalBytesToRead = blob->size() - blob->start(); +#else + m_total = blob->size(); +#endif + + m_client->didGetSize(m_totalBytesToRead); } void FileStream::openForWrite(const String&) @@ -78,14 +126,41 @@ void FileStream::openForWrite(const String&) void FileStream::close() { ASSERT(!isMainThread()); - if (isHandleValid(m_handle)) + if (isHandleValid(m_handle)) { closeFile(m_handle); + m_handle = invalidPlatformFileHandle; + } } -void FileStream::read(char*, int) +void FileStream::read(char* buffer, int length) { ASSERT(!isMainThread()); - // FIXME: to be implemented. + + if (!isHandleValid(m_handle)) { + m_client->didFail(NOT_READABLE_ERR); + return; + } + + if (m_bytesProcessed >= m_totalBytesToRead) { + m_client->didFinish(); + return; + } + + long long remaining = m_totalBytesToRead - m_bytesProcessed; + int bytesToRead = (remaining < length) ? static_cast<int>(remaining) : length; + int bytesRead = readFromFile(m_handle, buffer, bytesToRead); + if (bytesRead < 0) { + m_client->didFail(NOT_READABLE_ERR); + return; + } + + if (!bytesRead) { + m_client->didFinish(); + return; + } + + m_bytesProcessed += bytesRead; + m_client->didRead(buffer, bytesRead); } void FileStream::write(Blob*, long long, int) @@ -102,4 +177,4 @@ void FileStream::truncate(long long) } // namespace WebCore -#endif // ENABLE(FILE_WRITER) || ENABLE_FILE_READER) +#endif // ENABLE(FILE_READER) || ENABLE(FILE_WRITER) diff --git a/WebCore/html/FileStream.h b/WebCore/html/FileStream.h index bda8fc7..9d3f7b8 100644 --- a/WebCore/html/FileStream.h +++ b/WebCore/html/FileStream.h @@ -67,6 +67,8 @@ private: FileStreamClient* m_client; PlatformFileHandle m_handle; + long long m_bytesProcessed; + long long m_totalBytesToRead; }; } // namespace WebCore diff --git a/WebCore/html/HTMLAnchorElement.cpp b/WebCore/html/HTMLAnchorElement.cpp index f636020..e3752c3 100644 --- a/WebCore/html/HTMLAnchorElement.cpp +++ b/WebCore/html/HTMLAnchorElement.cpp @@ -42,7 +42,7 @@ namespace WebCore { using namespace HTMLNames; HTMLAnchorElement::HTMLAnchorElement(const QualifiedName& tagName, Document* document) - : HTMLElement(tagName, document, CreateElement) + : HTMLElement(tagName, document, CreateHTMLElement) , m_wasShiftKeyDownOnMouseDown(false) , m_linkRelations(0) { @@ -102,24 +102,7 @@ bool HTMLAnchorElement::isKeyboardFocusable(KeyboardEvent* event) const if (!document()->frame()->eventHandler()->tabsToLinks(event)) return false; - if (!renderer() || !renderer()->isBoxModelObject()) - return false; - - // Before calling absoluteRects, check for the common case where the renderer - // is non-empty, since this is a faster check and almost always returns true. - RenderBoxModelObject* box = toRenderBoxModelObject(renderer()); - if (!box->borderBoundingBox().isEmpty()) - return true; - - Vector<IntRect> rects; - FloatPoint absPos = renderer()->localToAbsolute(); - renderer()->absoluteRects(rects, absPos.x(), absPos.y()); - size_t n = rects.size(); - for (size_t i = 0; i < n; ++i) - if (!rects[i].isEmpty()) - return true; - - return false; + return hasNonEmptyBoundingBox(); } void HTMLAnchorElement::defaultEventHandler(Event* evt) @@ -282,7 +265,7 @@ void HTMLAnchorElement::parseMappedAttribute(MappedAttribute *attr) ResourceHandle::prepareForURL(document()->completeURL(parsedURL)); } if (document()->page() && !document()->page()->javaScriptURLsAreAllowed() && protocolIsJavaScript(parsedURL)) { - setIsLink(false); + clearIsLink(); attr->setValue(nullAtom); } } diff --git a/WebCore/html/HTMLElement.cpp b/WebCore/html/HTMLElement.cpp index 816bb60..f2ffc16 100644 --- a/WebCore/html/HTMLElement.cpp +++ b/WebCore/html/HTMLElement.cpp @@ -58,7 +58,7 @@ using std::max; PassRefPtr<HTMLElement> HTMLElement::create(const QualifiedName& tagName, Document* document) { - return adoptRef(new HTMLElement(tagName, document, CreateElement)); + return adoptRef(new HTMLElement(tagName, document, CreateHTMLElement)); } String HTMLElement::nodeName() const diff --git a/WebCore/html/HTMLElement.h b/WebCore/html/HTMLElement.h index ccc9aa3..b51dba4 100644 --- a/WebCore/html/HTMLElement.h +++ b/WebCore/html/HTMLElement.h @@ -82,7 +82,7 @@ public: static void addHTMLAlignmentToStyledElement(StyledElement*, MappedAttribute*); protected: - HTMLElement(const QualifiedName& tagName, Document*, ConstructionType = CreateElementZeroRefCount); + HTMLElement(const QualifiedName& tagName, Document*, ConstructionType = CreateHTMLElementZeroRefCount); void addHTMLAlignment(MappedAttribute*); @@ -102,8 +102,6 @@ protected: HTMLFormElement* findFormAncestor() const; private: - virtual bool isHTMLElement() const { return true; } - virtual String nodeName() const; void setContentEditable(MappedAttribute*); diff --git a/WebCore/html/HTMLFormControlElement.cpp b/WebCore/html/HTMLFormControlElement.cpp index bcdf40d..7ae33d3 100644 --- a/WebCore/html/HTMLFormControlElement.cpp +++ b/WebCore/html/HTMLFormControlElement.cpp @@ -454,6 +454,16 @@ void HTMLFormControlElementWithState::finishParsingChildren() } } +void HTMLFormControlElementWithState::defaultEventHandler(Event* event) +{ + if (event->type() == eventNames().webkitEditableContentChangedEvent && renderer() && renderer()->isTextControl()) { + toRenderTextControl(renderer())->subtreeHasChanged(); + return; + } + + HTMLFormControlElement::defaultEventHandler(event); +} + HTMLTextFormControlElement::HTMLTextFormControlElement(const QualifiedName& tagName, Document* doc, HTMLFormElement* form) : HTMLFormControlElementWithState(tagName, doc, form) { diff --git a/WebCore/html/HTMLFormControlElement.h b/WebCore/html/HTMLFormControlElement.h index 0045fbe..5b3a490 100644 --- a/WebCore/html/HTMLFormControlElement.h +++ b/WebCore/html/HTMLFormControlElement.h @@ -36,7 +36,7 @@ class VisibleSelection; class HTMLFormControlElement : public HTMLElement { public: - HTMLFormControlElement(const QualifiedName& tagName, Document*, HTMLFormElement*, ConstructionType = CreateElementZeroRefCount); + HTMLFormControlElement(const QualifiedName& tagName, Document*, HTMLFormElement*, ConstructionType = CreateHTMLElementZeroRefCount); virtual ~HTMLFormControlElement(); virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; } @@ -160,6 +160,7 @@ public: protected: virtual void willMoveToNewOwnerDocument(); virtual void didMoveToNewOwnerDocument(); + virtual void defaultEventHandler(Event*); }; class HTMLTextFormControlElement : public HTMLFormControlElementWithState { diff --git a/WebCore/html/HTMLFormElement.cpp b/WebCore/html/HTMLFormElement.cpp index cafa3c9..d7f5d96 100644 --- a/WebCore/html/HTMLFormElement.cpp +++ b/WebCore/html/HTMLFormElement.cpp @@ -38,6 +38,7 @@ #include "FormState.h" #include "Frame.h" #include "FrameLoader.h" +#include "FrameLoaderClient.h" #include "HTMLDocument.h" #include "HTMLFormCollection.h" #include "HTMLImageElement.h" @@ -175,20 +176,21 @@ Node* HTMLFormElement::item(unsigned index) return elements()->item(index); } -void HTMLFormElement::submitClick(Event* event) +void HTMLFormElement::submitImplicitly(Event* event, bool fromTextField) { - bool submitFound = false; + int textControlCount = 0; for (unsigned i = 0; i < formElements.size(); ++i) { if (formElements[i]->hasLocalName(inputTag)) { HTMLInputElement* element = static_cast<HTMLInputElement*>(formElements[i]); if (element->isSuccessfulSubmitButton() && element->renderer()) { - submitFound = true; element->dispatchSimulatedClick(event); - break; - } - } + return; + } else if (element->isTextField()) + ++textControlCount; + } else if (formElements[i]->hasLocalName(isindexTag)) + ++textControlCount; } - if (!submitFound) // submit the form without a submit or image input + if (fromTextField && textControlCount == 1) prepareSubmit(event); } @@ -291,6 +293,8 @@ bool HTMLFormElement::prepareSubmit(Event* event) if (!validateInteractively(event)) return false; + frame->loader()->client()->dispatchWillSendSubmitEvent(this); + if (dispatchEvent(Event::create(eventNames().submitEvent, true, true)) && !m_doingsubmit) m_doingsubmit = true; diff --git a/WebCore/html/HTMLFormElement.h b/WebCore/html/HTMLFormElement.h index 923c734..a2142ec 100644 --- a/WebCore/html/HTMLFormElement.h +++ b/WebCore/html/HTMLFormElement.h @@ -91,7 +91,7 @@ public: virtual bool isURLAttribute(Attribute*) const; - void submitClick(Event*); + void submitImplicitly(Event*, bool fromTextField); bool formWouldHaveSecureSubmission(const String& url); String name() const; diff --git a/WebCore/html/HTMLFormElement.idl b/WebCore/html/HTMLFormElement.idl index d639c34..0654a7d 100644 --- a/WebCore/html/HTMLFormElement.idl +++ b/WebCore/html/HTMLFormElement.idl @@ -35,7 +35,7 @@ module html { attribute [ConvertNullToNullString] DOMString method; attribute [ConvertNullToNullString] DOMString target; - [Custom] void submit(); + [CallWith=DynamicFrame] void submit(); void reset(); boolean checkValidity(); }; diff --git a/WebCore/html/HTMLFrameOwnerElement.cpp b/WebCore/html/HTMLFrameOwnerElement.cpp index c3ae785..a9538fd 100644 --- a/WebCore/html/HTMLFrameOwnerElement.cpp +++ b/WebCore/html/HTMLFrameOwnerElement.cpp @@ -33,7 +33,7 @@ namespace WebCore { HTMLFrameOwnerElement::HTMLFrameOwnerElement(const QualifiedName& tagName, Document* document) - : HTMLElement(tagName, document, CreateElement) + : HTMLElement(tagName, document, CreateHTMLElement) , m_contentFrame(0) , m_sandboxFlags(SandboxNone) { diff --git a/WebCore/html/HTMLInputElement.cpp b/WebCore/html/HTMLInputElement.cpp index 60669ef..bbc9f43 100644 --- a/WebCore/html/HTMLInputElement.cpp +++ b/WebCore/html/HTMLInputElement.cpp @@ -46,7 +46,7 @@ #include "HTMLImageLoader.h" #include "HTMLNames.h" #include "HTMLOptionElement.h" -#include "ScriptEventListener.h" +#include "HTMLParser.h" #include "KeyboardEvent.h" #include "LocalizedStrings.h" #include "MappedAttribute.h" @@ -60,6 +60,7 @@ #include "RenderText.h" #include "RenderTextControlSingleLine.h" #include "RenderTheme.h" +#include "ScriptEventListener.h" #include "StepRange.h" #include "StringHash.h" #include "TextEvent.h" @@ -69,7 +70,6 @@ #include <wtf/HashMap.h> #include <wtf/MathExtras.h> #include <wtf/StdLibExtras.h> -#include <wtf/dtoa.h> using namespace std; @@ -168,41 +168,50 @@ static inline CheckedRadioButtons& checkedRadioButtons(const HTMLInputElement* e return element->document()->checkedRadioButtons(); } +void HTMLInputElement::updateCheckedRadioButtons() +{ + if (attached() && checked()) + checkedRadioButtons(this).addButton(this); + + if (renderer() && renderer()->style()->hasAppearance()) + renderer()->theme()->stateChanged(renderer(), CheckedState); +} + bool HTMLInputElement::valueMissing() const { if (!isRequiredFormControl() || readOnly() || disabled()) return false; switch (inputType()) { - case DATE: - case DATETIME: - case DATETIMELOCAL: - case EMAIL: - case FILE: - case MONTH: - case NUMBER: - case PASSWORD: - case SEARCH: - case TELEPHONE: - case TEXT: - case TIME: - case URL: - case WEEK: - return value().isEmpty(); - case CHECKBOX: - return !checked(); - case RADIO: - return !checkedRadioButtons(this).checkedButtonForGroup(name()); - case COLOR: - return false; - case BUTTON: - case HIDDEN: - case IMAGE: - case ISINDEX: - case RANGE: - case RESET: - case SUBMIT: - break; + case DATE: + case DATETIME: + case DATETIMELOCAL: + case EMAIL: + case FILE: + case MONTH: + case NUMBER: + case PASSWORD: + case SEARCH: + case TELEPHONE: + case TEXT: + case TIME: + case URL: + case WEEK: + return value().isEmpty(); + case CHECKBOX: + return !checked(); + case RADIO: + return !checkedRadioButtons(this).checkedButtonForGroup(name()); + case COLOR: + return false; + case BUTTON: + case HIDDEN: + case IMAGE: + case ISINDEX: + case RANGE: + case RESET: + case SUBMIT: + break; } ASSERT_NOT_REACHED(); @@ -212,46 +221,42 @@ bool HTMLInputElement::valueMissing() const bool HTMLInputElement::patternMismatch() const { switch (inputType()) { - case BUTTON: - case CHECKBOX: - case COLOR: - case DATE: - case DATETIME: - case DATETIMELOCAL: - case FILE: - case HIDDEN: - case IMAGE: - case ISINDEX: - case MONTH: - case NUMBER: - case RADIO: - case RANGE: - case RESET: - case SUBMIT: - case TIME: - case WEEK: + case BUTTON: + case CHECKBOX: + case COLOR: + case DATE: + case DATETIME: + case DATETIMELOCAL: + case FILE: + case HIDDEN: + case IMAGE: + case ISINDEX: + case MONTH: + case NUMBER: + case RADIO: + case RANGE: + case RESET: + case SUBMIT: + case TIME: + case WEEK: + return false; + case EMAIL: + case PASSWORD: + case SEARCH: + case TELEPHONE: + case TEXT: + case URL: + const AtomicString& pattern = getAttribute(patternAttr); + String value = this->value(); + // Empty values can't be mismatched + if (pattern.isEmpty() || value.isEmpty()) return false; - case EMAIL: - case PASSWORD: - case SEARCH: - case TELEPHONE: - case TEXT: - case URL: - const AtomicString& pattern = getAttribute(patternAttr); - String value = this->value(); - - // Empty values can't be mismatched - if (pattern.isEmpty() || value.isEmpty()) - return false; - - RegularExpression patternRegExp(pattern, TextCaseSensitive); - int matchLength = 0; - int valueLength = value.length(); - int matchOffset = patternRegExp.match(value, 0, &matchLength); - - return matchOffset != 0 || matchLength != valueLength; + RegularExpression patternRegExp(pattern, TextCaseSensitive); + int matchLength = 0; + int valueLength = value.length(); + int matchOffset = patternRegExp.match(value, 0, &matchLength); + return matchOffset || matchLength != valueLength; } - ASSERT_NOT_REACHED(); return false; } @@ -703,8 +708,7 @@ bool HTMLInputElement::isKeyboardFocusable(KeyboardEvent* event) const Node* currentFocusedNode = document()->focusedNode(); if (currentFocusedNode && currentFocusedNode->hasTagName(inputTag)) { HTMLInputElement* focusedInput = static_cast<HTMLInputElement*>(currentFocusedNode); - if (focusedInput->inputType() == RADIO && focusedInput->form() == form() && - focusedInput->name() == name()) + if (focusedInput->inputType() == RADIO && focusedInput->form() == form() && focusedInput->name() == name()) return false; } @@ -737,7 +741,11 @@ void HTMLInputElement::aboutToUnload() bool HTMLInputElement::shouldUseInputMethod() const { - return m_type == TEXT || m_type == SEARCH || m_type == ISINDEX; + // The reason IME's are disabled for the password field is because IMEs + // can access the underlying password and display it in clear text -- + // e.g. you can use it to access the stored password for any site + // with only trivial effort. + return isTextField() && inputType() != PASSWORD; } void HTMLInputElement::handleFocusEvent() @@ -913,39 +921,39 @@ const AtomicString& HTMLInputElement::formControlType() const bool HTMLInputElement::saveFormControlState(String& result) const { switch (inputType()) { - case BUTTON: - case COLOR: - case DATE: - case DATETIME: - case DATETIMELOCAL: - case EMAIL: - case FILE: - case HIDDEN: - case IMAGE: - case ISINDEX: - case MONTH: - case NUMBER: - case RANGE: - case RESET: - case SEARCH: - case SUBMIT: - case TELEPHONE: - case TEXT: - case TIME: - case URL: - case WEEK: { - String currentValue = value(); - if (currentValue == defaultValue()) - return false; - result = currentValue; - return true; - } - case CHECKBOX: - case RADIO: - result = checked() ? "on" : "off"; - return true; - case PASSWORD: + case BUTTON: + case COLOR: + case DATE: + case DATETIME: + case DATETIMELOCAL: + case EMAIL: + case FILE: + case HIDDEN: + case IMAGE: + case ISINDEX: + case MONTH: + case NUMBER: + case RANGE: + case RESET: + case SEARCH: + case SUBMIT: + case TELEPHONE: + case TEXT: + case TIME: + case URL: + case WEEK: { + String currentValue = value(); + if (currentValue == defaultValue()) return false; + result = currentValue; + return true; + } + case CHECKBOX: + case RADIO: + result = checked() ? "on" : "off"; + return true; + case PASSWORD: + return false; } ASSERT_NOT_REACHED(); return false; @@ -955,35 +963,35 @@ void HTMLInputElement::restoreFormControlState(const String& state) { ASSERT(inputType() != PASSWORD); // should never save/restore password fields switch (inputType()) { - case BUTTON: - case COLOR: - case DATE: - case DATETIME: - case DATETIMELOCAL: - case EMAIL: - case FILE: - case HIDDEN: - case IMAGE: - case ISINDEX: - case MONTH: - case NUMBER: - case RANGE: - case RESET: - case SEARCH: - case SUBMIT: - case TELEPHONE: - case TEXT: - case TIME: - case URL: - case WEEK: - setValue(state); - break; - case CHECKBOX: - case RADIO: - setChecked(state == "on"); - break; - case PASSWORD: - break; + case BUTTON: + case COLOR: + case DATE: + case DATETIME: + case DATETIMELOCAL: + case EMAIL: + case FILE: + case HIDDEN: + case IMAGE: + case ISINDEX: + case MONTH: + case NUMBER: + case RANGE: + case RESET: + case SEARCH: + case SUBMIT: + case TELEPHONE: + case TEXT: + case TIME: + case URL: + case WEEK: + setValue(state); + break; + case CHECKBOX: + case RADIO: + setChecked(state == "on"); + break; + case PASSWORD: + break; } } @@ -1002,47 +1010,47 @@ bool HTMLInputElement::canHaveSelection() const void HTMLInputElement::accessKeyAction(bool sendToAnyElement) { switch (inputType()) { - case BUTTON: - case CHECKBOX: - case FILE: - case IMAGE: - case RADIO: - case RANGE: - case RESET: - case SUBMIT: - focus(false); - // send the mouse button events iff the caller specified sendToAnyElement - dispatchSimulatedClick(0, sendToAnyElement); - break; - case HIDDEN: - // a no-op for this type - break; - case COLOR: - case DATE: - case DATETIME: - case DATETIMELOCAL: - case EMAIL: - case ISINDEX: - case MONTH: - case NUMBER: - case PASSWORD: - case SEARCH: - case TELEPHONE: - case TEXT: - case TIME: - case URL: - case WEEK: - // should never restore previous selection here - focus(false); - break; + case BUTTON: + case CHECKBOX: + case FILE: + case IMAGE: + case RADIO: + case RANGE: + case RESET: + case SUBMIT: + focus(false); + // send the mouse button events iff the caller specified sendToAnyElement + dispatchSimulatedClick(0, sendToAnyElement); + break; + case HIDDEN: + // a no-op for this type + break; + case COLOR: + case DATE: + case DATETIME: + case DATETIMELOCAL: + case EMAIL: + case ISINDEX: + case MONTH: + case NUMBER: + case PASSWORD: + case SEARCH: + case TELEPHONE: + case TEXT: + case TIME: + case URL: + case WEEK: + // should never restore previous selection here + focus(false); + break; } } bool HTMLInputElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const { - if (((attrName == heightAttr || attrName == widthAttr) && respectHeightAndWidthAttrs()) || - attrName == vspaceAttr || - attrName == hspaceAttr) { + if (((attrName == heightAttr || attrName == widthAttr) && respectHeightAndWidthAttrs()) + || attrName == vspaceAttr + || attrName == hspaceAttr) { result = eUniversal; return false; } @@ -1109,8 +1117,7 @@ void HTMLInputElement::parseMappedAttribute(MappedAttribute *attr) m_imageLoader.set(new HTMLImageLoader(this)); m_imageLoader->updateFromElementIgnoringPreviousError(); } - } else if (attr->name() == usemapAttr || - attr->name() == accesskeyAttr) { + } else if (attr->name() == usemapAttr || attr->name() == accesskeyAttr) { // FIXME: ignore for the moment } else if (attr->name() == vspaceAttr) { addCSSLength(attr, CSSPropertyMarginTop, attr->value()); @@ -1127,10 +1134,8 @@ void HTMLInputElement::parseMappedAttribute(MappedAttribute *attr) } else if (attr->name() == heightAttr) { if (respectHeightAndWidthAttrs()) addCSSLength(attr, CSSPropertyHeight, attr->value()); - } - // Search field and slider attributes all just cause updateFromElement to be called through style - // recalcing. - else if (attr->name() == onsearchAttr) { + } else if (attr->name() == onsearchAttr) { + // Search field and slider attributes all just cause updateFromElement to be called through style recalcing. setAttributeEventListener(eventNames().searchEvent, createAttributeEventListener(this, attr)); } else if (attr->name() == resultsAttr) { int oldResults = m_maxResults; @@ -1174,40 +1179,40 @@ bool HTMLInputElement::rendererIsNeeded(RenderStyle *style) return HTMLFormControlElementWithState::rendererIsNeeded(style); } -RenderObject *HTMLInputElement::createRenderer(RenderArena *arena, RenderStyle *style) +RenderObject* HTMLInputElement::createRenderer(RenderArena *arena, RenderStyle *style) { switch (inputType()) { - case BUTTON: - case RESET: - case SUBMIT: - return new (arena) RenderButton(this); - case CHECKBOX: - case RADIO: - return RenderObject::createObject(this, style); - case FILE: - return new (arena) RenderFileUploadControl(this); - case HIDDEN: - break; - case IMAGE: - return new (arena) RenderImage(this); - case RANGE: - return new (arena) RenderSlider(this); - case COLOR: - case DATE: - case DATETIME: - case DATETIMELOCAL: - case EMAIL: - case ISINDEX: - case MONTH: - case NUMBER: - case PASSWORD: - case SEARCH: - case TELEPHONE: - case TEXT: - case TIME: - case URL: - case WEEK: - return new (arena) RenderTextControlSingleLine(this, placeholderShouldBeVisible()); + case BUTTON: + case RESET: + case SUBMIT: + return new (arena) RenderButton(this); + case CHECKBOX: + case RADIO: + return RenderObject::createObject(this, style); + case FILE: + return new (arena) RenderFileUploadControl(this); + case HIDDEN: + break; + case IMAGE: + return new (arena) RenderImage(this); + case RANGE: + return new (arena) RenderSlider(this); + case COLOR: + case DATE: + case DATETIME: + case DATETIMELOCAL: + case EMAIL: + case ISINDEX: + case MONTH: + case NUMBER: + case PASSWORD: + case SEARCH: + case TELEPHONE: + case TEXT: + case TIME: + case URL: + case WEEK: + return new (arena) RenderTextControlSingleLine(this, placeholderShouldBeVisible()); } ASSERT(false); return 0; @@ -1238,6 +1243,9 @@ void HTMLInputElement::attach() } } + if (inputType() == RADIO) + updateCheckedRadioButtons(); + if (document()->focusedNode() == this) document()->updateFocusAppearanceSoon(true /* restore selection */); } @@ -1288,87 +1296,86 @@ bool HTMLInputElement::appendFormData(FormDataList& encoding, bool multipart) return false; switch (inputType()) { - case COLOR: - case DATE: - case DATETIME: - case DATETIMELOCAL: - case EMAIL: - case HIDDEN: - case ISINDEX: - case MONTH: - case NUMBER: - case PASSWORD: - case RANGE: - case SEARCH: - case TELEPHONE: - case TEXT: - case TIME: - case URL: - case WEEK: - // always successful + case COLOR: + case DATE: + case DATETIME: + case DATETIMELOCAL: + case EMAIL: + case HIDDEN: + case ISINDEX: + case MONTH: + case NUMBER: + case PASSWORD: + case RANGE: + case SEARCH: + case TELEPHONE: + case TEXT: + case TIME: + case URL: + case WEEK: + // always successful + encoding.appendData(name(), value()); + return true; + + case CHECKBOX: + case RADIO: + if (checked()) { encoding.appendData(name(), value()); return true; + } + break; - case CHECKBOX: - case RADIO: - if (checked()) { - encoding.appendData(name(), value()); - return true; - } - break; - - case BUTTON: - case RESET: - // these types of buttons are never successful - return false; - - case IMAGE: - if (m_activeSubmit) { - encoding.appendData(name().isEmpty() ? "x" : (name() + ".x"), m_xPos); - encoding.appendData(name().isEmpty() ? "y" : (name() + ".y"), m_yPos); - if (!name().isEmpty() && !value().isEmpty()) - encoding.appendData(name(), value()); - return true; - } - break; - - case SUBMIT: - if (m_activeSubmit) { - String enc_str = valueWithDefault(); - encoding.appendData(name(), enc_str); - return true; - } - break; - - case FILE: { - unsigned numFiles = m_fileList->length(); - if (!multipart) { - // Send only the basenames. - // 4.10.16.4 and 4.10.16.6 sections in HTML5. + case BUTTON: + case RESET: + // these types of buttons are never successful + return false; - // Unlike the multipart case, we have no special - // handling for the empty fileList because Netscape - // doesn't support for non-multipart submission of - // file inputs, and Firefox doesn't add "name=" query - // parameter. + case IMAGE: + if (m_activeSubmit) { + encoding.appendData(name().isEmpty() ? "x" : (name() + ".x"), m_xPos); + encoding.appendData(name().isEmpty() ? "y" : (name() + ".y"), m_yPos); + if (!name().isEmpty() && !value().isEmpty()) + encoding.appendData(name(), value()); + return true; + } + break; - for (unsigned i = 0; i < numFiles; ++i) { - encoding.appendData(name(), m_fileList->item(i)->fileName()); - } - return true; - } + case SUBMIT: + if (m_activeSubmit) { + String encstr = valueWithDefault(); + encoding.appendData(name(), encstr); + return true; + } + break; - // If no filename at all is entered, return successful but empty. - // Null would be more logical, but Netscape posts an empty file. Argh. - if (!numFiles) { - encoding.appendBlob(name(), File::create("")); - return true; - } + case FILE: { + unsigned numFiles = m_fileList->length(); + if (!multipart) { + // Send only the basenames. + // 4.10.16.4 and 4.10.16.6 sections in HTML5. + + // Unlike the multipart case, we have no special + // handling for the empty fileList because Netscape + // doesn't support for non-multipart submission of + // file inputs, and Firefox doesn't add "name=" query + // parameter. + + for (unsigned i = 0; i < numFiles; ++i) + encoding.appendData(name(), m_fileList->item(i)->fileName()); + return true; + } - for (unsigned i = 0; i < numFiles; ++i) - encoding.appendBlob(name(), m_fileList->item(i)); + // If no filename at all is entered, return successful but empty. + // Null would be more logical, but Netscape posts an empty file. Argh. + if (!numFiles) { + encoding.appendBlob(name(), File::create("")); return true; } + + for (unsigned i = 0; i < numFiles; ++i) + encoding.appendBlob(name(), m_fileList->item(i)); + return true; + } } return false; } @@ -1427,10 +1434,7 @@ void HTMLInputElement::setChecked(bool nowChecked, bool sendChangeEvent) m_checked = nowChecked; setNeedsStyleRecalc(); - checkedRadioButtons(this).addButton(this); - - if (renderer() && renderer()->style()->hasAppearance()) - renderer()->theme()->stateChanged(renderer(), CheckedState); + updateCheckedRadioButtons(); // Ideally we'd do this from the render tree (matching // RenderTextView), but it's not possible to do it at the moment @@ -1447,13 +1451,13 @@ void HTMLInputElement::setChecked(bool nowChecked, bool sendChangeEvent) dispatchFormControlChangeEvent(); } -void HTMLInputElement::setIndeterminate(bool _indeterminate) +void HTMLInputElement::setIndeterminate(bool newValue) { // Only checkboxes and radio buttons honor indeterminate. - if (!allowsIndeterminate() || indeterminate() == _indeterminate) + if (!allowsIndeterminate() || indeterminate() == newValue) return; - m_indeterminate = _indeterminate; + m_indeterminate = newValue; setNeedsStyleRecalc(); @@ -1499,7 +1503,7 @@ String HTMLInputElement::value() const if (value.isNull()) { if (inputType() == CHECKBOX || inputType() == RADIO) return checked() ? "on" : ""; - else if (inputType() == RANGE) + if (inputType() == RANGE) return serializeForNumberType(StepRange(this).defaultValue()); } } @@ -1512,35 +1516,35 @@ String HTMLInputElement::valueWithDefault() const String v = value(); if (v.isNull()) { switch (inputType()) { - case BUTTON: - case CHECKBOX: - case COLOR: - case DATE: - case DATETIME: - case DATETIMELOCAL: - case EMAIL: - case FILE: - case HIDDEN: - case IMAGE: - case ISINDEX: - case MONTH: - case NUMBER: - case PASSWORD: - case RADIO: - case RANGE: - case SEARCH: - case TELEPHONE: - case TEXT: - case TIME: - case URL: - case WEEK: - break; - case RESET: - v = resetButtonDefaultLabel(); - break; - case SUBMIT: - v = submitButtonDefaultLabel(); - break; + case BUTTON: + case CHECKBOX: + case COLOR: + case DATE: + case DATETIME: + case DATETIMELOCAL: + case EMAIL: + case FILE: + case HIDDEN: + case IMAGE: + case ISINDEX: + case MONTH: + case NUMBER: + case PASSWORD: + case RADIO: + case RANGE: + case SEARCH: + case TELEPHONE: + case TEXT: + case TIME: + case URL: + case WEEK: + break; + case RESET: + v = resetButtonDefaultLabel(); + break; + case SUBMIT: + v = submitButtonDefaultLabel(); + break; } } return v; @@ -1963,32 +1967,32 @@ void HTMLInputElement::setFileListFromRenderer(const Vector<String>& paths) bool HTMLInputElement::storesValueSeparateFromAttribute() const { switch (inputType()) { - case BUTTON: - case CHECKBOX: - case HIDDEN: - case IMAGE: - case RADIO: - case RESET: - case SUBMIT: - return false; - case COLOR: - case DATE: - case DATETIME: - case DATETIMELOCAL: - case EMAIL: - case FILE: - case ISINDEX: - case MONTH: - case NUMBER: - case PASSWORD: - case RANGE: - case SEARCH: - case TELEPHONE: - case TEXT: - case TIME: - case URL: - case WEEK: - return true; + case BUTTON: + case CHECKBOX: + case HIDDEN: + case IMAGE: + case RADIO: + case RESET: + case SUBMIT: + return false; + case COLOR: + case DATE: + case DATETIME: + case DATETIMELOCAL: + case EMAIL: + case FILE: + case ISINDEX: + case MONTH: + case NUMBER: + case PASSWORD: + case RANGE: + case SEARCH: + case TELEPHONE: + case TEXT: + case TIME: + case URL: + case WEEK: + return true; } return false; } @@ -2078,10 +2082,10 @@ void HTMLInputElement::defaultEventHandler(Event* evt) // FIXME: It would be better to refactor this for the different types of input element. // Having them all in one giant function makes this hard to read, and almost all the handling is type-specific. - bool clickDefaultFormButton = false; + bool implicitSubmission = false; if (isTextField() && evt->type() == eventNames().textInputEvent && evt->isTextEvent() && static_cast<TextEvent*>(evt)->data() == "\n") - clickDefaultFormButton = true; + implicitSubmission = true; if (inputType() == IMAGE && evt->isMouseEvent() && evt->type() == eventNames().clickEvent) { // record the mouse position for when we get the DOMActivate event @@ -2120,7 +2124,7 @@ void HTMLInputElement::defaultEventHandler(Event* evt) // Call the base event handler before any of our own event handling for almost all events in text fields. // Makes editing keyboard handling take precedence over the keydown and keypress handling in this function. - bool callBaseClassEarly = isTextField() && !clickDefaultFormButton + bool callBaseClassEarly = isTextField() && !implicitSubmission && (evt->type() == eventNames().keydownEvent || evt->type() == eventNames().keypressEvent); if (callBaseClassEarly) { HTMLFormControlElementWithState::defaultEventHandler(evt); @@ -2163,52 +2167,51 @@ void HTMLInputElement::defaultEventHandler(Event* evt) if (charCode == '\r') { switch (inputType()) { - case CHECKBOX: - case COLOR: - case DATE: - case DATETIME: - case DATETIMELOCAL: - case EMAIL: - case HIDDEN: - case ISINDEX: - case MONTH: - case NUMBER: - case PASSWORD: - case RANGE: - case SEARCH: - case TELEPHONE: - case TEXT: - case TIME: - case URL: - case WEEK: - // Simulate mouse click on the default form button for enter for these types of elements. - clickDefaultFormButton = true; - break; - case BUTTON: - case FILE: - case IMAGE: - case RESET: - case SUBMIT: - // Simulate mouse click for enter for these types of elements. - clickElement = true; - break; - case RADIO: - break; // Don't do anything for enter on a radio button. + case CHECKBOX: + case COLOR: + case DATE: + case DATETIME: + case DATETIMELOCAL: + case EMAIL: + case HIDDEN: + case ISINDEX: + case MONTH: + case NUMBER: + case PASSWORD: + case RADIO: + case RANGE: + case SEARCH: + case TELEPHONE: + case TEXT: + case TIME: + case URL: + case WEEK: + // Simulate mouse click on the default form button for enter for these types of elements. + implicitSubmission = true; + break; + case BUTTON: + case FILE: + case IMAGE: + case RESET: + case SUBMIT: + // Simulate mouse click for enter for these types of elements. + clickElement = true; + break; } } else if (charCode == ' ') { switch (inputType()) { - case BUTTON: - case CHECKBOX: - case FILE: - case IMAGE: - case RESET: - case SUBMIT: - case RADIO: - // Prevent scrolling down the page. - evt->setDefaultHandled(); - return; - default: - break; + case BUTTON: + case CHECKBOX: + case FILE: + case IMAGE: + case RESET: + case SUBMIT: + case RADIO: + // Prevent scrolling down the page. + evt->setDefaultHandled(); + return; + default: + break; } } @@ -2224,19 +2227,19 @@ void HTMLInputElement::defaultEventHandler(Event* evt) if (key == "U+0020") { switch (inputType()) { - case BUTTON: - case CHECKBOX: - case FILE: - case IMAGE: - case RESET: - case SUBMIT: - case RADIO: - setActive(true, true); - // No setDefaultHandled(), because IE dispatches a keypress in this case - // and the caller will only dispatch a keypress if we don't call setDefaultHandled. - return; - default: - break; + case BUTTON: + case CHECKBOX: + case FILE: + case IMAGE: + case RESET: + case SUBMIT: + case RADIO: + setActive(true, true); + // No setDefaultHandled(), because IE dispatches a keypress in this case + // and the caller will only dispatch a keypress if we don't call setDefaultHandled. + return; + default: + break; } } @@ -2283,40 +2286,40 @@ void HTMLInputElement::defaultEventHandler(Event* evt) if (key == "U+0020") { switch (inputType()) { - case BUTTON: - case CHECKBOX: - case FILE: - case IMAGE: - case RESET: - case SUBMIT: - // Simulate mouse click for spacebar for these types of elements. - // The AppKit already does this for some, but not all, of them. + case BUTTON: + case CHECKBOX: + case FILE: + case IMAGE: + case RESET: + case SUBMIT: + // Simulate mouse click for spacebar for these types of elements. + // The AppKit already does this for some, but not all, of them. + clickElement = true; + break; + case RADIO: + // If an unselected radio is tabbed into (because the entire group has nothing + // checked, or because of some explicit .focus() call), then allow space to check it. + if (!checked()) clickElement = true; - break; - case RADIO: - // If an unselected radio is tabbed into (because the entire group has nothing - // checked, or because of some explicit .focus() call), then allow space to check it. - if (!checked()) - clickElement = true; - break; - case COLOR: - case DATE: - case DATETIME: - case DATETIMELOCAL: - case EMAIL: - case HIDDEN: - case ISINDEX: - case MONTH: - case NUMBER: - case PASSWORD: - case RANGE: - case SEARCH: - case TELEPHONE: - case TEXT: - case TIME: - case URL: - case WEEK: - break; + break; + case COLOR: + case DATE: + case DATETIME: + case DATETIMELOCAL: + case EMAIL: + case HIDDEN: + case ISINDEX: + case MONTH: + case NUMBER: + case PASSWORD: + case RANGE: + case SEARCH: + case TELEPHONE: + case TEXT: + case TIME: + case URL: + case WEEK: + break; } } @@ -2328,7 +2331,7 @@ void HTMLInputElement::defaultEventHandler(Event* evt) } } - if (clickDefaultFormButton) { + if (implicitSubmission) { if (isSearchField()) { addSearchResult(); onSearch(); @@ -2350,7 +2353,7 @@ void HTMLInputElement::defaultEventHandler(Event* evt) // Form may never have been present, or may have been destroyed by code responding to the change event. if (formForSubmission) - formForSubmission->submitClick(evt); + formForSubmission->submitImplicitly(evt, isTextField()); evt->setDefaultHandled(); return; @@ -2475,9 +2478,9 @@ void HTMLInputElement::setMultiple(bool multiple) setAttribute(multipleAttr, multiple ? "" : 0); } -void HTMLInputElement::setSize(unsigned _size) +void HTMLInputElement::setSize(unsigned size) { - setAttribute(sizeAttr, String::number(_size)); + setAttribute(sizeAttr, String::number(size)); } KURL HTMLInputElement::src() const @@ -2553,32 +2556,32 @@ bool HTMLInputElement::isRequiredFormControl() const return false; switch (inputType()) { - case CHECKBOX: - case DATE: - case DATETIME: - case DATETIMELOCAL: - case EMAIL: - case FILE: - case MONTH: - case NUMBER: - case PASSWORD: - case RADIO: - case SEARCH: - case TELEPHONE: - case TEXT: - case TIME: - case URL: - case WEEK: - return true; - case BUTTON: - case COLOR: - case HIDDEN: - case IMAGE: - case ISINDEX: - case RANGE: - case RESET: - case SUBMIT: - return false; + case CHECKBOX: + case DATE: + case DATETIME: + case DATETIMELOCAL: + case EMAIL: + case FILE: + case MONTH: + case NUMBER: + case PASSWORD: + case RADIO: + case SEARCH: + case TELEPHONE: + case TEXT: + case TIME: + case URL: + case WEEK: + return true; + case BUTTON: + case COLOR: + case HIDDEN: + case IMAGE: + case ISINDEX: + case RANGE: + case RESET: + case SUBMIT: + return false; } ASSERT_NOT_REACHED(); @@ -2646,42 +2649,6 @@ bool HTMLInputElement::recalcWillValidate() const && inputType() != HIDDEN && inputType() != BUTTON && inputType() != RESET; } -String HTMLInputElement::serializeForNumberType(double number) -{ - // According to HTML5, "the best representation of the number n as a floating - // point number" is a string produced by applying ToString() to n. - DtoaBuffer buffer; - unsigned length; - doubleToStringInJavaScriptFormat(number, buffer, &length); - return String(buffer, length); -} - -bool HTMLInputElement::parseToDoubleForNumberType(const String& src, double* out) -{ - // See HTML5 2.4.4.3 `Real numbers.' - - if (src.isEmpty()) - return false; - // String::toDouble() accepts leading + \t \n \v \f \r and SPACE, which are invalid in HTML5. - // So, check the first character. - if (src[0] != '-' && (src[0] < '0' || src[0] > '9')) - return false; - - bool valid = false; - double value = src.toDouble(&valid); - if (!valid) - return false; - // NaN and Infinity are not valid numbers according to the standard. - if (!isfinite(value)) - return false; - // -0 -> 0 - if (!value) - value = 0; - if (out) - *out = value; - return true; -} - bool HTMLInputElement::parseToDateComponents(InputType type, const String& formString, DateComponents* out) { if (formString.isEmpty()) @@ -2777,6 +2744,41 @@ HTMLOptionElement* HTMLInputElement::selectedOption() const } return 0; } -#endif // ENABLE(DATALIST) +#endif // ENABLE(DATALIST) + +void HTMLInputElement::stepUpFromRenderer(int n) +{ + // The difference from stepUp()/stepDown() is: + // If the current value is invalid, the value will be + // - the minimum value if n > 0 + // - the maximum value if n < 0 + + ASSERT(hasSpinButton()); + if (!hasSpinButton()) + return; + ASSERT(n); + if (!n) + return; + + const double nan = numeric_limits<double>::quiet_NaN(); + double current = parseToDouble(value(), nan); + if (!isfinite(current)) { + setValue(serialize(n > 0 ? minimum() : maximum())); + return; + } + ExceptionCode ec; + stepUp(n, ec); +} + +#if ENABLE(WCSS) +void HTMLInputElement::setWapInputFormat(String& mask) +{ + String validateMask = validateInputMask(m_data, mask); + if (!validateMask.isEmpty()) + m_data.setInputFormatMask(validateMask); +} +#endif + + } // namespace diff --git a/WebCore/html/HTMLInputElement.h b/WebCore/html/HTMLInputElement.h index c3b0a73..e717628 100644 --- a/WebCore/html/HTMLInputElement.h +++ b/WebCore/html/HTMLInputElement.h @@ -121,6 +121,8 @@ public: void stepDown(int, ExceptionCode&); void stepUp(ExceptionCode& ec) { stepUp(1, ec); } void stepDown(ExceptionCode& ec) { stepDown(1, ec); } + // stepUp()/stepDown() for user-interaction. + void stepUpFromRenderer(int); bool isTextButton() const { return m_type == SUBMIT || m_type == RESET || m_type == BUTTON; } virtual bool isRadioButton() const { return m_type == RADIO; } @@ -128,6 +130,7 @@ public: virtual bool isSearchField() const { return m_type == SEARCH; } virtual bool isInputTypeHidden() const { return m_type == HIDDEN; } virtual bool isPasswordField() const { return m_type == PASSWORD; } + virtual bool hasSpinButton() const { return m_type == NUMBER || m_type == DATE || m_type == DATETIME || m_type == DATETIMELOCAL || m_type == MONTH || m_type == TIME || m_type == WEEK; } bool checked() const { return m_checked; } void setChecked(bool, bool sendChangeEvent = false); @@ -199,7 +202,6 @@ public: virtual void* preDispatchEventHandler(Event*); virtual void postDispatchEventHandler(Event*, void* dataFromPreDispatch); - virtual void defaultEventHandler(Event*); String altText() const; @@ -261,21 +263,20 @@ public: virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; - // Converts the specified string to a floating number. - // If the conversion fails, the return value is false. Take care that leading or trailing unnecessary characters make failures. This returns false for an empty string input. - // The double* parameter may be 0. - static bool parseToDoubleForNumberType(const String&, double*); - // Converts the specified number to a string. This is an implementation of - // HTML5's "algorithm to convert a number to a string" for NUMBER/RANGE types. - static String serializeForNumberType(double); // Parses the specified string as the InputType, and returns true if it is successfully parsed. // An instance pointed by the DateComponents* parameter will have parsed values and be // modified even if the parsing fails. The DateComponents* parameter may be 0. static bool parseToDateComponents(InputType, const String&, DateComponents*); + +#if ENABLE(WCSS) + void setWapInputFormat(String& mask); + virtual InputElementData data() const { return m_data; } +#endif protected: virtual void willMoveToNewOwnerDocument(); virtual void didMoveToNewOwnerDocument(); + virtual void defaultEventHandler(Event*); private: bool storesValueSeparateFromAttribute() const; @@ -295,6 +296,8 @@ private: virtual bool isRequiredFormControl() const; virtual bool recalcWillValidate() const; + void updateCheckedRadioButtons(); + PassRefPtr<HTMLFormElement> createTemporaryFormForIsIndex(); // Helper for getAllowedValueStep(); bool getStepParameters(double* defaultStep, double* stepScaleFactor) const; diff --git a/WebCore/html/HTMLMediaElement.cpp b/WebCore/html/HTMLMediaElement.cpp index e8ab4e6..a0e9302 100644 --- a/WebCore/html/HTMLMediaElement.cpp +++ b/WebCore/html/HTMLMediaElement.cpp @@ -59,6 +59,7 @@ #include "RenderVideo.h" #include "RenderView.h" #include "ScriptEventListener.h" +#include "Settings.h" #include "TimeRanges.h" #include <limits> #include <wtf/CurrentTime.h> @@ -92,6 +93,7 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* doc) , m_webkitPreservesPitch(true) , m_networkState(NETWORK_EMPTY) , m_readyState(HAVE_NOTHING) + , m_readyStateMaximum(HAVE_NOTHING) , m_volume(1.0f) , m_lastSeekTime(0) , m_previousProgress(0) @@ -126,6 +128,7 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* doc) #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) , m_needWidgetUpdate(false) #endif + , m_dispatchingCanPlayEvent(false) { document()->registerForDocumentActivationCallbacks(this); document()->registerForMediaVolumeCallbacks(this); @@ -358,8 +361,14 @@ void HTMLMediaElement::asyncEventTimerFired(Timer<HTMLMediaElement>*) m_pendingEvents.swap(pendingEvents); unsigned count = pendingEvents.size(); - for (unsigned ndx = 0; ndx < count; ++ndx) - dispatchEvent(pendingEvents[ndx].release(), ec); + for (unsigned ndx = 0; ndx < count; ++ndx) { + if (pendingEvents[ndx]->type() == eventNames().canplayEvent) { + m_dispatchingCanPlayEvent = true; + dispatchEvent(pendingEvents[ndx].release(), ec); + m_dispatchingCanPlayEvent = false; + } else + dispatchEvent(pendingEvents[ndx].release(), ec); + } } void HTMLMediaElement::loadTimerFired(Timer<HTMLMediaElement>*) @@ -493,6 +502,7 @@ void HTMLMediaElement::prepareForLoad() if (m_networkState != NETWORK_EMPTY) { m_networkState = NETWORK_EMPTY; m_readyState = HAVE_NOTHING; + m_readyStateMaximum = HAVE_NOTHING; m_paused = true; m_seeking = false; scheduleEvent(eventNames().emptiedEvent); @@ -858,6 +868,9 @@ void HTMLMediaElement::setReadyState(MediaPlayer::ReadyState state) if (m_readyState == oldState) return; + if (oldState > m_readyStateMaximum) + m_readyStateMaximum = oldState; + if (m_networkState == NETWORK_EMPTY) return; @@ -1190,6 +1203,17 @@ void HTMLMediaElement::play(bool isUserGesture) if (m_restrictions & RequireUserGestureForRateChangeRestriction && !isUserGesture) return; + Document* doc = document(); + Settings* settings = doc->settings(); + if (settings && settings->needsSiteSpecificQuirks() && m_dispatchingCanPlayEvent) { + // It should be impossible to be processing the canplay event while handling a user gesture + // since it is dispatched asynchronously. + ASSERT(!isUserGesture); + String host = doc->baseURL().host(); + if (host.endsWith(".npr.org", false) || equalIgnoringCase(host, "npr.org")) + return; + } + playInternal(); } @@ -1634,7 +1658,11 @@ PassRefPtr<TimeRanges> HTMLMediaElement::seekable() const bool HTMLMediaElement::potentiallyPlaying() const { - return m_readyState >= HAVE_FUTURE_DATA && couldPlayIfEnoughData(); + // "pausedToBuffer" means the media engine's rate is 0, but only because it had to stop playing + // when it ran out of buffered data. A movie is this state is "potentially playing", modulo the + // checks in couldPlayIfEnoughData(). + bool pausedToBuffer = m_readyStateMaximum >= HAVE_FUTURE_DATA && m_readyState < HAVE_FUTURE_DATA; + return (pausedToBuffer || m_readyState >= HAVE_FUTURE_DATA) && couldPlayIfEnoughData(); } bool HTMLMediaElement::couldPlayIfEnoughData() const diff --git a/WebCore/html/HTMLMediaElement.h b/WebCore/html/HTMLMediaElement.h index 83e1f2c..9c36438 100644 --- a/WebCore/html/HTMLMediaElement.h +++ b/WebCore/html/HTMLMediaElement.h @@ -296,6 +296,7 @@ private: bool m_webkitPreservesPitch; NetworkState m_networkState; ReadyState m_readyState; + ReadyState m_readyStateMaximum; String m_currentSrc; RefPtr<MediaError> m_error; @@ -361,6 +362,8 @@ private: #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) bool m_needWidgetUpdate : 1; #endif + + bool m_dispatchingCanPlayEvent : 1; }; } //namespace diff --git a/WebCore/html/HTMLOptionElement.cpp b/WebCore/html/HTMLOptionElement.cpp index 2752cbb..1280d32 100644 --- a/WebCore/html/HTMLOptionElement.cpp +++ b/WebCore/html/HTMLOptionElement.cpp @@ -190,11 +190,15 @@ void HTMLOptionElement::childrenChanged(bool changedByParser, Node* beforeChange HTMLSelectElement* HTMLOptionElement::ownerSelectElement() const { Node* select = parentNode(); +<<<<<<< HEAD:WebCore/html/HTMLOptionElement.cpp #ifdef ANDROID_FIX while (select && !(select->hasTagName(selectTag) || select->hasTagName(keygenTag))) #else while (select && !select->hasTagName(selectTag)) #endif +======= + while (select && !(select->hasTagName(selectTag) || select->hasTagName(keygenTag))) +>>>>>>> webkit.org at r58956:WebCore/html/HTMLOptionElement.cpp select = select->parentNode(); if (!select) diff --git a/WebCore/html/HTMLParser.cpp b/WebCore/html/HTMLParser.cpp index c5839a8..428e8d5 100644 --- a/WebCore/html/HTMLParser.cpp +++ b/WebCore/html/HTMLParser.cpp @@ -57,7 +57,9 @@ #include "Page.h" #include "Settings.h" #include "Text.h" +#include "TreeDepthLimit.h" #include <wtf/StdLibExtras.h> +#include <wtf/dtoa.h> namespace WebCore { @@ -132,6 +134,7 @@ HTMLParser::HTMLParser(HTMLDocument* doc, bool reportErrors) , m_didRefCurrent(false) , m_blockStack(0) , m_blocksInStack(0) + , m_treeDepth(0) , m_hasPElementInScope(NotInScope) , m_inBody(false) , m_haveContent(false) @@ -151,6 +154,7 @@ HTMLParser::HTMLParser(DocumentFragment* frag, FragmentScriptingPermission scrip , m_didRefCurrent(true) , m_blockStack(0) , m_blocksInStack(0) + , m_treeDepth(0) , m_hasPElementInScope(NotInScope) , m_inBody(true) , m_haveContent(false) @@ -181,6 +185,7 @@ void HTMLParser::reset() freeBlock(); + m_treeDepth = 0; m_inBody = false; m_haveFrameSet = false; m_haveContent = false; @@ -213,17 +218,19 @@ inline static int tagPriorityOfNode(Node* n) return n->isHTMLElement() ? static_cast<HTMLElement*>(n)->tagPriority() : 0; } -inline void HTMLParser::limitBlockDepth(int tagPriority) +inline void HTMLParser::limitDepth(int tagPriority) { + while (m_treeDepth >= maxDOMTreeDepth) + popBlock(m_blockStack->tagName); if (tagPriority >= minBlockLevelTagPriority) { while (m_blocksInStack >= cMaxBlockDepth) popBlock(m_blockStack->tagName); } } -inline bool HTMLParser::insertNodeAfterLimitBlockDepth(Node* n, bool flat) +inline bool HTMLParser::insertNodeAfterLimitDepth(Node* n, bool flat) { - limitBlockDepth(tagPriorityOfNode(n)); + limitDepth(tagPriorityOfNode(n)); return insertNode(n, flat); } @@ -265,7 +272,7 @@ PassRefPtr<Node> HTMLParser::parseToken(Token* t) while (charsLeft) { // split large blocks of text to nodes of manageable size n = Text::createWithLengthLimit(m_document, text, charsLeft); - if (!insertNodeAfterLimitBlockDepth(n.get(), t->selfClosingTag)) + if (!insertNodeAfterLimitDepth(n.get(), t->selfClosingTag)) return 0; } return n; @@ -296,7 +303,7 @@ PassRefPtr<Node> HTMLParser::parseToken(Token* t) } } - if (!insertNodeAfterLimitBlockDepth(n.get(), t->selfClosingTag)) { + if (!insertNodeAfterLimitDepth(n.get(), t->selfClosingTag)) { // we couldn't insert the node if (n->isElementNode()) { @@ -1188,8 +1195,8 @@ void HTMLParser::handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem* elem) prevElem->node = currElem->node; prevElem->didRefNode = currElem->didRefNode; delete currElem; - } - else + m_treeDepth--; + } else prevElem = currElem; currElem = nextElem; } @@ -1290,6 +1297,7 @@ void HTMLParser::handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem* elem) prevElem->derefNode(); prevElem->node = elem->node; prevElem->didRefNode = elem->didRefNode; + m_treeDepth--; if (!finished) { // Repurpose |elem| to represent |newNode| and insert it at the appropriate position // in the stack. We do not do this for the innermost block, because in that case the new @@ -1303,6 +1311,7 @@ void HTMLParser::handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem* elem) prevMaxElem->node = newNodePtr; newNodePtr->ref(); prevMaxElem->didRefNode = true; + m_treeDepth++; } else delete elem; } @@ -1399,6 +1408,7 @@ void HTMLParser::pushBlock(const AtomicString& tagName, int level) m_blockStack = new HTMLStackElem(tagName, level, m_current, m_didRefCurrent, m_blockStack); if (level >= minBlockLevelTagPriority) m_blocksInStack++; + m_treeDepth++; m_didRefCurrent = false; if (tagName == pTag) m_hasPElementInScope = InScope; @@ -1508,6 +1518,7 @@ inline HTMLStackElem* HTMLParser::popOneBlockCommon() ASSERT(m_blocksInStack > 0); m_blocksInStack--; } + m_treeDepth--; m_blockStack = elem->next; m_current = elem->node; m_didRefCurrent = elem->didRefNode; @@ -1583,6 +1594,7 @@ void HTMLParser::freeBlock() while (m_blockStack) popOneBlock(); ASSERT(!m_blocksInStack); + ASSERT(!m_treeDepth); } void HTMLParser::createHead() @@ -1728,4 +1740,41 @@ bool shouldCreateImplicitHead(Document* document) } #endif + +String serializeForNumberType(double number) +{ + // According to HTML5, "the best representation of the number n as a floating + // point number" is a string produced by applying ToString() to n. + DtoaBuffer buffer; + unsigned length; + doubleToStringInJavaScriptFormat(number, buffer, &length); + return String(buffer, length); +} + +bool parseToDoubleForNumberType(const String& src, double* out) +{ + // See HTML5 2.4.4.3 `Real numbers.' + + if (src.isEmpty()) + return false; + // String::toDouble() accepts leading + \t \n \v \f \r and SPACE, which are invalid in HTML5. + // So, check the first character. + if (src[0] != '-' && (src[0] < '0' || src[0] > '9')) + return false; + + bool valid = false; + double value = src.toDouble(&valid); + if (!valid) + return false; + // NaN and Infinity are not valid numbers according to the standard. + if (!isfinite(value)) + return false; + // -0 -> 0 + if (!value) + value = 0; + if (out) + *out = value; + return true; +} + } diff --git a/WebCore/html/HTMLParser.h b/WebCore/html/HTMLParser.h index acb6a6f..028836c 100644 --- a/WebCore/html/HTMLParser.h +++ b/WebCore/html/HTMLParser.h @@ -112,9 +112,8 @@ private: void processCloseTag(Token*); - void limitBlockDepth(int tagPriority); - - bool insertNodeAfterLimitBlockDepth(Node*, bool flat = false); + void limitDepth(int tagPriority); + bool insertNodeAfterLimitDepth(Node*, bool flat = false); bool insertNode(Node*, bool flat = false); bool handleError(Node*, bool flat, const AtomicString& localName, int tagPriority); @@ -170,6 +169,8 @@ private: // currently in m_blockStack. The parser enforces a cap on this value by // adding such new elements as siblings instead of children once it is reached. size_t m_blocksInStack; + // Depth of the tree. + unsigned m_treeDepth; enum ElementInScopeState { NotInScope, InScope, Unknown }; ElementInScopeState m_hasPElementInScope; @@ -200,6 +201,14 @@ bool shouldCreateImplicitHead(Document*); inline bool shouldCreateImplicitHead(Document*) { return true; } #endif +// Converts the specified string to a floating number. +// If the conversion fails, the return value is false. Take care that leading or trailing unnecessary characters make failures. This returns false for an empty string input. +// The double* parameter may be 0. +bool parseToDoubleForNumberType(const String&, double*); +// Converts the specified number to a string. This is an implementation of +// HTML5's "algorithm to convert a number to a string" for NUMBER/RANGE types. +String serializeForNumberType(double); + } #endif // HTMLParser_h diff --git a/WebCore/html/HTMLProgressElement.cpp b/WebCore/html/HTMLProgressElement.cpp index 6fa8043..84a9794 100644 --- a/WebCore/html/HTMLProgressElement.cpp +++ b/WebCore/html/HTMLProgressElement.cpp @@ -26,6 +26,7 @@ #include "FormDataList.h" #include "HTMLFormElement.h" #include "HTMLNames.h" +#include "HTMLParser.h" #include "MappedAttribute.h" #include "RenderProgress.h" #include <wtf/StdLibExtras.h> @@ -35,7 +36,7 @@ namespace WebCore { using namespace HTMLNames; HTMLProgressElement::HTMLProgressElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form) - : HTMLFormControlElement(tagName, document, form, CreateElement) + : HTMLFormControlElement(tagName, document, form, CreateHTMLElement) { ASSERT(hasTagName(progressTag)); } @@ -71,29 +72,37 @@ void HTMLProgressElement::parseMappedAttribute(MappedAttribute* attribute) double HTMLProgressElement::value() const { const AtomicString& valueString = getAttribute(valueAttr); - bool ok; - double value = valueString.toDouble(&ok); + double value; + bool ok = parseToDoubleForNumberType(valueString, &value); if (!ok || value < 0) return valueString.isNull() ? 1 : 0; return (value > max()) ? max() : value; } -void HTMLProgressElement::setValue(double value) +void HTMLProgressElement::setValue(double value, ExceptionCode& ec) { + if (!isfinite(value)) { + ec = NOT_SUPPORTED_ERR; + return; + } setAttribute(valueAttr, String::number(value >= 0 ? value : 0)); } double HTMLProgressElement::max() const { - bool ok; - double max = getAttribute(maxAttr).toDouble(&ok); + double max; + bool ok = parseToDoubleForNumberType(getAttribute(maxAttr), &max); if (!ok || max <= 0) return 1; return max; } -void HTMLProgressElement::setMax(double max) +void HTMLProgressElement::setMax(double max, ExceptionCode& ec) { + if (!isfinite(max)) { + ec = NOT_SUPPORTED_ERR; + return; + } setAttribute(maxAttr, String::number(max > 0 ? max : 1)); } diff --git a/WebCore/html/HTMLProgressElement.h b/WebCore/html/HTMLProgressElement.h index a925fc5..eaf4ce9 100644 --- a/WebCore/html/HTMLProgressElement.h +++ b/WebCore/html/HTMLProgressElement.h @@ -31,10 +31,10 @@ public: static PassRefPtr<HTMLProgressElement> create(const QualifiedName&, Document*, HTMLFormElement* = 0); double value() const; - void setValue(double); + void setValue(double, ExceptionCode&); double max() const; - void setMax(double); + void setMax(double, ExceptionCode&); double position() const; diff --git a/WebCore/html/HTMLProgressElement.idl b/WebCore/html/HTMLProgressElement.idl index 8da62aa..935bd95 100644 --- a/WebCore/html/HTMLProgressElement.idl +++ b/WebCore/html/HTMLProgressElement.idl @@ -21,8 +21,10 @@ module html { interface [ Conditional=PROGRESS_TAG ] HTMLProgressElement : HTMLElement { - attribute double value; - attribute double max; + attribute double value + setter raises(DOMException); + attribute double max + setter raises(DOMException); readonly attribute double position; readonly attribute HTMLFormElement form; }; diff --git a/WebCore/html/HTMLSelectElement.cpp b/WebCore/html/HTMLSelectElement.cpp index de40ff7..12ec26f 100644 --- a/WebCore/html/HTMLSelectElement.cpp +++ b/WebCore/html/HTMLSelectElement.cpp @@ -323,7 +323,7 @@ void HTMLSelectElement::dispatchBlurEvent() void HTMLSelectElement::defaultEventHandler(Event* event) { - SelectElement::defaultEventHandler(m_data, this, event, form()); + SelectElement::defaultEventHandler(m_data, this, event); if (event->defaultHandled()) return; HTMLFormControlElementWithState::defaultEventHandler(event); diff --git a/WebCore/html/HTMLTextAreaElement.cpp b/WebCore/html/HTMLTextAreaElement.cpp index 2bfde03..cdb7cdb 100644 --- a/WebCore/html/HTMLTextAreaElement.cpp +++ b/WebCore/html/HTMLTextAreaElement.cpp @@ -245,7 +245,12 @@ void HTMLTextAreaElement::handleBeforeTextInsertedEvent(BeforeTextInsertedEvent* unsigned unsignedMaxLength = static_cast<unsigned>(signedMaxLength); unsigned currentLength = numGraphemeClusters(toRenderTextControl(renderer())->text()); - unsigned selectionLength = numGraphemeClusters(plainText(document()->frame()->selection()->selection().toNormalizedRange().get())); + // selectionLength represents the selection length of this text field to be + // removed by this insertion. + // If the text field has no focus, we don't need to take account of the + // selection length. The selection is the source of text drag-and-drop in + // that case, and nothing in the text field will be removed. + unsigned selectionLength = focused() ? numGraphemeClusters(plainText(document()->frame()->selection()->selection().toNormalizedRange().get())) : 0; ASSERT(currentLength >= selectionLength); unsigned baseLength = currentLength - selectionLength; unsigned appendableLength = unsignedMaxLength > baseLength ? unsignedMaxLength - baseLength : 0; diff --git a/WebCore/html/HTMLTextAreaElement.h b/WebCore/html/HTMLTextAreaElement.h index 8d92a48..f75f076 100644 --- a/WebCore/html/HTMLTextAreaElement.h +++ b/WebCore/html/HTMLTextAreaElement.h @@ -60,7 +60,6 @@ public: virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); virtual bool appendFormData(FormDataList&, bool); virtual void reset(); - virtual void defaultEventHandler(Event*); virtual bool isMouseFocusable() const; virtual bool isKeyboardFocusable(KeyboardEvent*) const; virtual void updateFocusAppearance(bool restorePreviousSelection); @@ -104,6 +103,8 @@ private: virtual bool isOptionalFormControl() const { return !isRequiredFormControl(); } virtual bool isRequiredFormControl() const { return required(); } + virtual void defaultEventHandler(Event*); + int m_rows; int m_cols; WrapMethod m_wrap; diff --git a/WebCore/html/HTMLTokenizer.h b/WebCore/html/HTMLTokenizer.h index ef7cbfc..290fc5c 100644 --- a/WebCore/html/HTMLTokenizer.h +++ b/WebCore/html/HTMLTokenizer.h @@ -141,6 +141,7 @@ public: virtual void write(const SegmentedString&, bool appendData); virtual void finish(); + virtual bool forceSynchronous() const { return m_state.forceSynchronous(); } virtual void setForceSynchronous(bool force); virtual bool isWaitingForScripts() const; virtual void stopParsing(); @@ -155,6 +156,7 @@ public: virtual void executeScriptsWaitingForStylesheets(); virtual bool isHTMLTokenizer() const { return true; } + virtual HTMLTokenizer* asHTMLTokenizer() { return this; } HTMLParser* htmlParser() const { return m_parser.get(); } private: diff --git a/WebCore/html/StepRange.cpp b/WebCore/html/StepRange.cpp index 7c270f2..04f4ed3 100644 --- a/WebCore/html/StepRange.cpp +++ b/WebCore/html/StepRange.cpp @@ -23,6 +23,7 @@ #include "HTMLInputElement.h" #include "HTMLNames.h" +#include "HTMLParser.h" #include "PlatformString.h" #include <wtf/MathExtras.h> @@ -61,7 +62,7 @@ double StepRange::clampValue(double value) double StepRange::clampValue(const String& stringValue) { double value; - bool parseSuccess = HTMLInputElement::parseToDoubleForNumberType(stringValue, &value); + bool parseSuccess = parseToDoubleForNumberType(stringValue, &value); if (!parseSuccess) value = (minimum + maximum) / 2; return clampValue(value); @@ -70,7 +71,7 @@ double StepRange::clampValue(const String& stringValue) double StepRange::valueFromElement(HTMLInputElement* element, bool* wasClamped) { double oldValue; - bool parseSuccess = HTMLInputElement::parseToDoubleForNumberType(element->value(), &oldValue); + bool parseSuccess = parseToDoubleForNumberType(element->value(), &oldValue); if (!parseSuccess) oldValue = (minimum + maximum) / 2; double newValue = clampValue(oldValue); diff --git a/WebCore/html/TextMetrics.h b/WebCore/html/TextMetrics.h index 34a3378..14cdb67 100644 --- a/WebCore/html/TextMetrics.h +++ b/WebCore/html/TextMetrics.h @@ -34,6 +34,7 @@ class TextMetrics : public RefCounted<TextMetrics> { public: static PassRefPtr<TextMetrics> create() { return adoptRef(new TextMetrics); } + // FIXME: Is coercing to an integer value intentional? If so, there should be a static_cast<unsigned>() here. unsigned width() const { return m_width; } void setWidth(float w) { m_width = w; } diff --git a/WebCore/html/ValidityState.cpp b/WebCore/html/ValidityState.cpp index c6c58a5..fc60a22 100644 --- a/WebCore/html/ValidityState.cpp +++ b/WebCore/html/ValidityState.cpp @@ -26,6 +26,7 @@ #include "HTMLInputElement.h" #include "HTMLNames.h" +#include "HTMLParser.h" #include "KURL.h" #include "LocalizedStrings.h" #include "RegularExpression.h" @@ -80,7 +81,7 @@ bool ValidityState::typeMismatch() const case HTMLInputElement::COLOR: return !isValidColorString(value); case HTMLInputElement::NUMBER: - return !HTMLInputElement::parseToDoubleForNumberType(value, 0); + return !parseToDoubleForNumberType(value, 0); case HTMLInputElement::URL: return !KURL(KURL(), value).isValid(); case HTMLInputElement::EMAIL: { diff --git a/WebCore/html/canvas/CanvasObject.h b/WebCore/html/canvas/CanvasObject.h index b7b016a..6f89f12 100644 --- a/WebCore/html/canvas/CanvasObject.h +++ b/WebCore/html/canvas/CanvasObject.h @@ -51,6 +51,13 @@ namespace WebCore { WebGLRenderingContext* context() const { return m_context; } + virtual bool isBuffer() const { return false; } + virtual bool isFramebuffer() const { return false; } + virtual bool isProgram() const { return false; } + virtual bool isRenderbuffer() const { return false; } + virtual bool isShader() const { return false; } + virtual bool isTexture() const { return false; } + protected: CanvasObject(WebGLRenderingContext*); virtual void _deleteObject(Platform3DObject) = 0; diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/WebCore/html/canvas/CanvasRenderingContext2D.cpp index 3732487..615b45d 100644 --- a/WebCore/html/canvas/CanvasRenderingContext2D.cpp +++ b/WebCore/html/canvas/CanvasRenderingContext2D.cpp @@ -615,7 +615,10 @@ static bool validateRectForCanvas(float& x, float& y, float& width, float& heigh { if (!isfinite(x) | !isfinite(y) | !isfinite(width) | !isfinite(height)) return false; - + + if (!width && !height) + return false; + if (width < 0) { width = -width; x -= width; diff --git a/WebCore/html/canvas/WebGLBuffer.h b/WebCore/html/canvas/WebGLBuffer.h index bdb7052..f56d374 100644 --- a/WebCore/html/canvas/WebGLBuffer.h +++ b/WebCore/html/canvas/WebGLBuffer.h @@ -64,6 +64,8 @@ namespace WebCore { virtual void _deleteObject(Platform3DObject o); private: + virtual bool isBuffer() const { return true; } + RefPtr<WebGLArrayBuffer> m_elementArrayBuffer; unsigned m_elementArrayBufferByteLength; unsigned m_arrayBufferByteLength; diff --git a/WebCore/html/canvas/WebGLFramebuffer.h b/WebCore/html/canvas/WebGLFramebuffer.h index b9402a0..71e5a27 100644 --- a/WebCore/html/canvas/WebGLFramebuffer.h +++ b/WebCore/html/canvas/WebGLFramebuffer.h @@ -50,7 +50,9 @@ namespace WebCore { virtual void _deleteObject(Platform3DObject); - private: + private: + virtual bool isFramebuffer() const { return true; } + bool m_isDepthAttached; bool m_isStencilAttached; bool m_isDepthStencilAttached; diff --git a/WebCore/html/canvas/WebGLProgram.h b/WebCore/html/canvas/WebGLProgram.h index 56bce15..b13fc22 100644 --- a/WebCore/html/canvas/WebGLProgram.h +++ b/WebCore/html/canvas/WebGLProgram.h @@ -45,13 +45,15 @@ namespace WebCore { bool cacheActiveAttribLocations(); int numActiveAttribLocations(); int getActiveAttribLocation(int index); - + protected: WebGLProgram(WebGLRenderingContext*); virtual void _deleteObject(Platform3DObject); private: + virtual bool isProgram() const { return true; } + Vector<int> m_activeAttribLocations; }; diff --git a/WebCore/html/canvas/WebGLRenderbuffer.cpp b/WebCore/html/canvas/WebGLRenderbuffer.cpp index cad4298..0ac9c7e 100644 --- a/WebCore/html/canvas/WebGLRenderbuffer.cpp +++ b/WebCore/html/canvas/WebGLRenderbuffer.cpp @@ -37,11 +37,6 @@ PassRefPtr<WebGLRenderbuffer> WebGLRenderbuffer::create(WebGLRenderingContext* c return adoptRef(new WebGLRenderbuffer(ctx)); } -PassRefPtr<WebGLRenderbuffer> WebGLRenderbuffer::create(WebGLRenderingContext* ctx, Platform3DObject obj) -{ - return adoptRef(new WebGLRenderbuffer(ctx, obj)); -} - WebGLRenderbuffer::WebGLRenderbuffer(WebGLRenderingContext* ctx) : CanvasObject(ctx) , m_internalformat(GraphicsContext3D::RGBA4) @@ -49,13 +44,6 @@ WebGLRenderbuffer::WebGLRenderbuffer(WebGLRenderingContext* ctx) setObject(context()->graphicsContext3D()->createRenderbuffer()); } -WebGLRenderbuffer::WebGLRenderbuffer(WebGLRenderingContext* ctx, Platform3DObject obj) - : CanvasObject(ctx) - , m_internalformat(GraphicsContext3D::RGBA4) -{ - setObject(obj, false); -} - void WebGLRenderbuffer::_deleteObject(Platform3DObject object) { context()->graphicsContext3D()->deleteRenderbuffer(object); diff --git a/WebCore/html/canvas/WebGLRenderbuffer.h b/WebCore/html/canvas/WebGLRenderbuffer.h index 1bdf1b7..e399012 100644 --- a/WebCore/html/canvas/WebGLRenderbuffer.h +++ b/WebCore/html/canvas/WebGLRenderbuffer.h @@ -38,21 +38,18 @@ namespace WebCore { virtual ~WebGLRenderbuffer() { deleteObject(); } static PassRefPtr<WebGLRenderbuffer> create(WebGLRenderingContext*); - - // For querying previously created objects via e.g. getFramebufferAttachmentParameter - // FIXME: should consider canonicalizing these objects - static PassRefPtr<WebGLRenderbuffer> create(WebGLRenderingContext*, Platform3DObject renderbuffer); void setInternalformat(unsigned long internalformat) { m_internalformat = internalformat; } unsigned long getInternalformat() const { return m_internalformat; } protected: WebGLRenderbuffer(WebGLRenderingContext*); - WebGLRenderbuffer(WebGLRenderingContext*, Platform3DObject); virtual void _deleteObject(Platform3DObject); - private: + private: + virtual bool isRenderbuffer() const { return true; } + unsigned long m_internalformat; }; diff --git a/WebCore/html/canvas/WebGLRenderingContext.cpp b/WebCore/html/canvas/WebGLRenderingContext.cpp index d9af757..54ba17f 100644 --- a/WebCore/html/canvas/WebGLRenderingContext.cpp +++ b/WebCore/html/canvas/WebGLRenderingContext.cpp @@ -101,8 +101,6 @@ WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, Pa m_implementationColorReadFormat = implementationColorReadFormat; int implementationColorReadType = GraphicsContext3D::UNSIGNED_BYTE; m_context->getIntegerv(GraphicsContext3D::IMPLEMENTATION_COLOR_READ_TYPE, &implementationColorReadType); - // FIXME: remove the getError() when IMPLEMENTATION_COLOR_READ_FORMAT/TYPE are supported. - m_context->getError(); m_implementationColorReadType = implementationColorReadType; m_context->reshape(canvas()->width(), canvas()->height()); m_context->viewport(0, 0, canvas()->width(), canvas()->height()); @@ -815,7 +813,7 @@ void WebGLRenderingContext::framebufferRenderbuffer(unsigned long target, unsign m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); return; } - if (buffer->object()) { + if (buffer && buffer->object()) { bool isConflicted = false; bool isDepthOrStencil = true; switch (attachment) { @@ -981,18 +979,11 @@ WebGLGetInfo WebGLRenderingContext::getFramebufferAttachmentParameter(unsigned l m_context->getFramebufferAttachmentParameteriv(target, attachment, GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &type); int value = 0; m_context->getFramebufferAttachmentParameteriv(target, attachment, GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &value); - // FIXME: should consider canonicalizing these objects switch (type) { - case GraphicsContext3D::RENDERBUFFER: { - RefPtr<WebGLRenderbuffer> tmp = WebGLRenderbuffer::create(this, value); - addObject(tmp.get()); - return WebGLGetInfo(PassRefPtr<WebGLRenderbuffer>(tmp)); - } - case GraphicsContext3D::TEXTURE: { - RefPtr<WebGLTexture> tmp = WebGLTexture::create(this, value); - addObject(tmp.get()); - return WebGLGetInfo(PassRefPtr<WebGLTexture>(tmp)); - } + case GraphicsContext3D::RENDERBUFFER: + return WebGLGetInfo(findRenderbuffer(static_cast<Platform3DObject>(value))); + case GraphicsContext3D::TEXTURE: + return WebGLGetInfo(findTexture(static_cast<Platform3DObject>(value))); default: // FIXME: raise exception? return WebGLGetInfo(); @@ -1070,6 +1061,10 @@ WebGLGetInfo WebGLRenderingContext::getParameter(unsigned long pname, ExceptionC return getUnsignedLongParameter(pname); case GraphicsContext3D::GREEN_BITS: return getLongParameter(pname); + case GraphicsContext3D::IMPLEMENTATION_COLOR_READ_FORMAT: + return getLongParameter(pname); + case GraphicsContext3D::IMPLEMENTATION_COLOR_READ_TYPE: + return getLongParameter(pname); case GraphicsContext3D::LINE_WIDTH: return getFloatParameter(pname); case GraphicsContext3D::MAX_COMBINED_TEXTURE_IMAGE_UNITS: @@ -1639,7 +1634,7 @@ PassRefPtr<WebGLArray> WebGLRenderingContext::readPixels(long x, long y, unsigne m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); return 0; } - if (!(format == GraphicsContext3D::RGBA && type == GraphicsContext3D::UNSIGNED_BYTE || format == m_implementationColorReadFormat && type == m_implementationColorReadFormat)) { + if (!((format == GraphicsContext3D::RGBA && type == GraphicsContext3D::UNSIGNED_BYTE) || (format == m_implementationColorReadFormat && type == m_implementationColorReadType))) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); return 0; } @@ -1764,71 +1759,126 @@ void WebGLRenderingContext::stencilOpSeparate(unsigned long face, unsigned long cleanupAfterGraphicsCall(false); } -void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, unsigned internalformat, - unsigned width, unsigned height, unsigned border, - unsigned format, unsigned type, WebGLArray* pixels, ExceptionCode& ec) +void WebGLRenderingContext::texImage2DBase(unsigned target, unsigned level, unsigned internalformat, + unsigned width, unsigned height, unsigned border, + unsigned format, unsigned type, void* pixels, ExceptionCode& ec) { // FIXME: For now we ignore any errors returned - // FIXME: Need to make sure passed buffer has enough bytes to define the texture ec = 0; m_context->texImage2D(target, level, internalformat, width, height, - border, format, type, pixels ? pixels->baseAddress() : 0); + border, format, type, pixels); cleanupAfterGraphicsCall(false); } -void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, ImageData* pixels, +void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, Image* image, bool flipY, bool premultiplyAlpha, ExceptionCode& ec) { - // FIXME: For now we ignore any errors returned ec = 0; Vector<uint8_t> data; - m_context->extractImageData(pixels, flipY, premultiplyAlpha, data); - m_context->texImage2D(target, level, GraphicsContext3D::RGBA, pixels->width(), pixels->height(), 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, data.data()); - cleanupAfterGraphicsCall(false); + unsigned int format, internalformat; + if (!m_context->extractImageData(image, flipY, premultiplyAlpha, data, &format, &internalformat)) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + texImage2DBase(target, level, internalformat, image->width(), image->height(), 0, + format, GraphicsContext3D::UNSIGNED_BYTE, data.data(), ec); } -void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLImageElement* image, +void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, unsigned internalformat, + unsigned width, unsigned height, unsigned border, + unsigned format, unsigned type, WebGLArray* pixels, ExceptionCode& ec) +{ + // FIXME: Need to make sure passed buffer has enough bytes to define the texture + texImage2DBase(target, level, internalformat, width, height, border, + format, type, pixels ? pixels->baseAddress() : 0, ec); +} + +void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, ImageData* pixels, + ExceptionCode& ec) +{ + texImage2D(target, level, pixels, 0, 0, ec); +} + +void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, ImageData* pixels, + bool flipY, ExceptionCode& ec) +{ + texImage2D(target, level, pixels, flipY, 0, ec); +} + +void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, ImageData* pixels, bool flipY, bool premultiplyAlpha, ExceptionCode& ec) { ec = 0; - if (!image) { + Vector<uint8_t> data; + if (!m_context->extractImageData(pixels, flipY, premultiplyAlpha, data)) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return; } + texImage2DBase(target, level, GraphicsContext3D::RGBA, pixels->width(), pixels->height(), 0, + GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, data.data(), ec); +} + + +void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLImageElement* image, + ExceptionCode& ec) +{ + texImage2D(target, level, image, 0, 0, ec); +} + +void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLImageElement* image, + bool flipY, ExceptionCode& ec) +{ + texImage2D(target, level, image, flipY, 0, ec); +} - CachedImage* cachedImage = image->cachedImage(); - if (!cachedImage) { +void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLImageElement* image, + bool flipY, bool premultiplyAlpha, ExceptionCode& ec) +{ + ec = 0; + if (!image || !image->cachedImage()) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return; } + texImage2D(target, level, image->cachedImage()->image(), flipY, premultiplyAlpha, ec); +} - // FIXME: For now we ignore any errors returned - m_context->texImage2D(target, level, cachedImage->image(), flipY, premultiplyAlpha); - cleanupAfterGraphicsCall(false); +void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, + ExceptionCode& ec) +{ + texImage2D(target, level, canvas, 0, 0, ec); } void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, - bool flipY, bool premultiplyAlpha, ExceptionCode& ec) + bool flipY, ExceptionCode& ec) +{ + texImage2D(target, level, canvas, flipY, 0, ec); +} + +void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, + bool flipY, bool premultiplyAlpha, ExceptionCode& ec) { ec = 0; - if (!canvas) { + if (!canvas || !canvas->buffer()) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return; } + texImage2D(target, level, canvas->buffer()->image(), flipY, premultiplyAlpha, ec); +} - ImageBuffer* buffer = canvas->buffer(); - if (!buffer) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); - return; - } +void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLVideoElement* video, + ExceptionCode& ec) +{ + texImage2D(target, level, video, 0, 0, ec); +} - // FIXME: For now we ignore any errors returned - m_context->texImage2D(target, level, buffer->image(), flipY, premultiplyAlpha); - cleanupAfterGraphicsCall(false); +void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLVideoElement* video, + bool flipY, ExceptionCode& ec) +{ + texImage2D(target, level, video, flipY, 0, ec); } void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLVideoElement* video, - bool flipY, bool premultiplyAlpha, ExceptionCode& ec) + bool flipY, bool premultiplyAlpha, ExceptionCode& ec) { // FIXME: Need implement this call UNUSED_PARAM(target); @@ -1853,66 +1903,121 @@ void WebGLRenderingContext::texParameteri(unsigned target, unsigned pname, int p cleanupAfterGraphicsCall(false); } -void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - unsigned width, unsigned height, - unsigned format, unsigned type, WebGLArray* pixels, ExceptionCode& ec) +void WebGLRenderingContext::texSubImage2DBase(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + unsigned width, unsigned height, + unsigned format, unsigned type, void* pixels, ExceptionCode& ec) { // FIXME: For now we ignore any errors returned - // FIXME: Need to make sure passed buffer has enough bytes to define the texture ec = 0; - m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels ? pixels->baseAddress() : 0); + m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); cleanupAfterGraphicsCall(false); } void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - ImageData* pixels, bool flipY, bool premultiplyAlpha, ExceptionCode& ec) + Image* image, bool flipY, bool premultiplyAlpha, ExceptionCode& ec) { - // FIXME: For now we ignore any errors returned ec = 0; Vector<uint8_t> data; - m_context->extractImageData(pixels, flipY, premultiplyAlpha, data); - m_context->texSubImage2D(target, level, xoffset, yoffset, pixels->width(), pixels->height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, data.data()); - cleanupAfterGraphicsCall(false); + unsigned int format, internalformat; + if (!m_context->extractImageData(image, flipY, premultiplyAlpha, data, &format, &internalformat)) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + texSubImage2DBase(target, level, xoffset, yoffset, image->width(), image->height(), + format, GraphicsContext3D::UNSIGNED_BYTE, data.data(), ec); } void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - HTMLImageElement* image, bool flipY, bool premultiplyAlpha, ExceptionCode& ec) + unsigned width, unsigned height, + unsigned format, unsigned type, WebGLArray* pixels, ExceptionCode& ec) +{ + // FIXME: Need to make sure passed buffer has enough bytes to define the texture + texSubImage2DBase(target, level, xoffset, yoffset, width, height, format, type, pixels ? pixels->baseAddress() : 0, ec); +} + +void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + ImageData* pixels, ExceptionCode& ec) +{ + texSubImage2D(target, level, xoffset, yoffset, pixels, 0, 0, ec); +} + +void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + ImageData* pixels, bool flipY, ExceptionCode& ec) +{ + texSubImage2D(target, level, xoffset, yoffset, pixels, flipY, 0, ec); +} + +void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + ImageData* pixels, bool flipY, bool premultiplyAlpha, ExceptionCode& ec) { - // FIXME: For now we ignore any errors returned ec = 0; - if (!image) { + Vector<uint8_t> data; + if (!m_context->extractImageData(pixels, flipY, premultiplyAlpha, data)) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return; } - - CachedImage* cachedImage = image->cachedImage(); - if (!cachedImage) { + texSubImage2DBase(target, level, xoffset, yoffset, pixels->width(), pixels->height(), + GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, data.data(), ec); +} + +void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + HTMLImageElement* image, ExceptionCode& ec) +{ + texSubImage2D(target, level, xoffset, yoffset, image, 0, 0, ec); +} + +void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + HTMLImageElement* image, bool flipY, ExceptionCode& ec) +{ + texSubImage2D(target, level, xoffset, yoffset, image, flipY, 0, ec); +} + +void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + HTMLImageElement* image, bool flipY, bool premultiplyAlpha, ExceptionCode& ec) +{ + ec = 0; + if (!image || !image->cachedImage()) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return; } + texSubImage2D(target, level, xoffset, yoffset, image->cachedImage()->image(), + flipY, premultiplyAlpha, ec); +} - m_context->texSubImage2D(target, level, xoffset, yoffset, cachedImage->image(), flipY, premultiplyAlpha); - cleanupAfterGraphicsCall(false); +void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + HTMLCanvasElement* canvas, ExceptionCode& ec) +{ + texSubImage2D(target, level, xoffset, yoffset, canvas, 0, 0, ec); +} + +void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + HTMLCanvasElement* canvas, bool flipY, ExceptionCode& ec) +{ + texSubImage2D(target, level, xoffset, yoffset, canvas, flipY, 0, ec); } void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLCanvasElement* canvas, bool flipY, bool premultiplyAlpha, ExceptionCode& ec) { ec = 0; - if (!canvas) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); - return; - } - - ImageBuffer* buffer = canvas->buffer(); - if (!buffer) { + if (!canvas || !canvas->buffer()) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return; } - - // FIXME: For now we ignore any errors returned - m_context->texSubImage2D(target, level, xoffset, yoffset, buffer->image(), flipY, premultiplyAlpha); - cleanupAfterGraphicsCall(false); + texSubImage2D(target, level, xoffset, yoffset, canvas->buffer()->image(), + flipY, premultiplyAlpha, ec); +} + +void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + HTMLVideoElement* video, ExceptionCode& ec) +{ + texSubImage2D(target, level, xoffset, yoffset, video, 0, 0, ec); +} + +void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + HTMLVideoElement* video, bool flipY, ExceptionCode& ec) +{ + texSubImage2D(target, level, xoffset, yoffset, video, flipY, 0, ec); } void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, @@ -2731,6 +2836,30 @@ void WebGLRenderingContext::detachAndRemoveAllObjects() m_canvasObjects.clear(); } +PassRefPtr<WebGLTexture> WebGLRenderingContext::findTexture(Platform3DObject obj) +{ + HashSet<RefPtr<CanvasObject> >::iterator pend = m_canvasObjects.end(); + for (HashSet<RefPtr<CanvasObject> >::iterator it = m_canvasObjects.begin(); it != pend; ++it) { + if ((*it)->isTexture() && (*it)->object() == obj) { + RefPtr<WebGLTexture> tex = reinterpret_cast<WebGLTexture*>((*it).get()); + return tex.release(); + } + } + return 0; +} + +PassRefPtr<WebGLRenderbuffer> WebGLRenderingContext::findRenderbuffer(Platform3DObject obj) +{ + HashSet<RefPtr<CanvasObject> >::iterator pend = m_canvasObjects.end(); + for (HashSet<RefPtr<CanvasObject> >::iterator it = m_canvasObjects.begin(); it != pend; ++it) { + if ((*it)->isRenderbuffer() && (*it)->object() == obj) { + RefPtr<WebGLRenderbuffer> buffer = reinterpret_cast<WebGLRenderbuffer*>((*it).get()); + return buffer.release(); + } + } + return 0; +} + WebGLGetInfo WebGLRenderingContext::getBooleanParameter(unsigned long pname) { unsigned char value; @@ -2819,6 +2948,11 @@ WebGLGetInfo WebGLRenderingContext::getWebGLUnsignedByteArrayParameter(unsigned return WebGLGetInfo(WebGLUnsignedByteArray::create(value, length)); } +bool WebGLRenderingContext::isGLES2Compliant() +{ + return m_context->isGLES2Compliant(); +} + } // namespace WebCore #endif // ENABLE(3D_CANVAS) diff --git a/WebCore/html/canvas/WebGLRenderingContext.h b/WebCore/html/canvas/WebGLRenderingContext.h index 9c58a53..aefa6cc 100644 --- a/WebCore/html/canvas/WebGLRenderingContext.h +++ b/WebCore/html/canvas/WebGLRenderingContext.h @@ -199,14 +199,18 @@ class WebKitCSSMatrix; void texImage2D(unsigned target, unsigned level, unsigned internalformat, unsigned width, unsigned height, unsigned border, unsigned format, unsigned type, WebGLArray* pixels, ExceptionCode&); - void texImage2D(unsigned target, unsigned level, ImageData* pixels, - bool flipY, bool premultiplyAlpha, ExceptionCode&); - void texImage2D(unsigned target, unsigned level, HTMLImageElement* image, - bool flipY, bool premultiplyAlpha, ExceptionCode&); - void texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, - bool flipY, bool premultiplyAlpha, ExceptionCode&); - void texImage2D(unsigned target, unsigned level, HTMLVideoElement* video, - bool flipY, bool premultiplyAlpha, ExceptionCode&); + void texImage2D(unsigned target, unsigned level, ImageData* pixels, ExceptionCode&); + void texImage2D(unsigned target, unsigned level, ImageData* pixels, bool flipY, ExceptionCode&); + void texImage2D(unsigned target, unsigned level, ImageData* pixels, bool flipY, bool premultiplyAlpha, ExceptionCode&); + void texImage2D(unsigned target, unsigned level, HTMLImageElement* image, ExceptionCode&); + void texImage2D(unsigned target, unsigned level, HTMLImageElement* image, bool flipY, ExceptionCode&); + void texImage2D(unsigned target, unsigned level, HTMLImageElement* image, bool flipY, bool premultiplyAlpha, ExceptionCode&); + void texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, ExceptionCode&); + void texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, bool flipY, ExceptionCode&); + void texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, bool flipY, bool premultiplyAlpha, ExceptionCode&); + void texImage2D(unsigned target, unsigned level, HTMLVideoElement* video, ExceptionCode&); + void texImage2D(unsigned target, unsigned level, HTMLVideoElement* video, bool flipY, ExceptionCode&); + void texImage2D(unsigned target, unsigned level, HTMLVideoElement* video, bool flipY, bool premultiplyAlpha, ExceptionCode&); void texParameterf(unsigned target, unsigned pname, float param); void texParameteri(unsigned target, unsigned pname, int param); @@ -214,14 +218,18 @@ class WebKitCSSMatrix; void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, unsigned width, unsigned height, unsigned format, unsigned type, WebGLArray* pixels, ExceptionCode&); - void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - ImageData* pixels, bool flipY, bool premultiplyAlpha, ExceptionCode&); - void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - HTMLImageElement* image, bool flipY, bool premultiplyAlpha, ExceptionCode&); - void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - HTMLCanvasElement* canvas, bool flipY, bool premultiplyAlpha, ExceptionCode&); - void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - HTMLVideoElement* video, bool flipY, bool premultiplyAlpha, ExceptionCode&); + void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, ImageData* pixels, ExceptionCode&); + void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, ImageData* pixels, bool flipY, ExceptionCode&); + void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, ImageData* pixels, bool flipY, bool premultiplyAlpha, ExceptionCode&); + void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLImageElement* image, ExceptionCode&); + void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLImageElement* image, bool flipY, ExceptionCode&); + void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLImageElement* image, bool flipY, bool premultiplyAlpha, ExceptionCode&); + void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLCanvasElement* canvas, ExceptionCode&); + void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLCanvasElement* canvas, bool flipY, ExceptionCode&); + void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLCanvasElement* canvas, bool flipY, bool premultiplyAlpha, ExceptionCode&); + void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLVideoElement* video, ExceptionCode&); + void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLVideoElement* video, bool flipY, ExceptionCode&); + void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLVideoElement* video, bool flipY, bool premultiplyAlpha, ExceptionCode&); void uniform1f(const WebGLUniformLocation* location, float x, ExceptionCode&); void uniform1fv(const WebGLUniformLocation* location, WebGLFloatArray* v, ExceptionCode&); @@ -291,6 +299,8 @@ class WebKitCSSMatrix; void addObject(CanvasObject*); void detachAndRemoveAllObjects(); + PassRefPtr<WebGLTexture> findTexture(Platform3DObject); + PassRefPtr<WebGLRenderbuffer> findRenderbuffer(Platform3DObject); void markContextChanged(); void cleanupAfterGraphicsCall(bool changed) @@ -298,6 +308,8 @@ class WebKitCSSMatrix; if (changed) markContextChanged(); } + + bool isGLES2Compliant(); // Basic validation of count and offset against number of elements in element array buffer bool validateElementArraySize(unsigned long count, unsigned long type, long offset); @@ -359,6 +371,17 @@ class WebKitCSSMatrix; WebGLGetInfo getWebGLIntArrayParameter(unsigned long pname); WebGLGetInfo getWebGLUnsignedByteArrayParameter(unsigned long pname); + void texImage2DBase(unsigned target, unsigned level, unsigned internalformat, + unsigned width, unsigned height, unsigned border, + unsigned format, unsigned type, void* pixels, ExceptionCode&); + void texImage2D(unsigned target, unsigned level, Image* image, + bool flipY, bool premultiplyAlpha, ExceptionCode&); + void texSubImage2DBase(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + unsigned width, unsigned height, + unsigned format, unsigned type, void* pixels, ExceptionCode&); + void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + Image* image, bool flipY, bool premultiplyAlpha, ExceptionCode&); + friend class WebGLStateRestorer; }; diff --git a/WebCore/html/canvas/WebGLRenderingContext.idl b/WebCore/html/canvas/WebGLRenderingContext.idl index a257452..b775378 100644 --- a/WebCore/html/canvas/WebGLRenderingContext.idl +++ b/WebCore/html/canvas/WebGLRenderingContext.idl @@ -474,13 +474,15 @@ module html { void blendFunc(in unsigned long sfactor, in unsigned long dfactor); void blendFuncSeparate(in unsigned long srcRGB, in unsigned long dstRGB, in unsigned long srcAlpha, in unsigned long dstAlpha); - // Supported forms: - // void bufferData (in GLenum target, in GLsizei size, in GLenum usage); - // void bufferData (in GLenum target, in WebGLArray data, in GLenum usage); +#if defined(V8_BINDING) && V8_BINDING + void bufferData(in unsigned long target, in WebGLArray data, in unsigned long usage) raises (DOMException); + void bufferData(in unsigned long target, in long size, in unsigned long usage) raises (DOMException); + void bufferSubData(in unsigned long target, in long offset, in WebGLArray data) raises (DOMException); +#else + // FIXME: Unfork once JSC supports overload generation too. [Custom] void bufferData() raises(DOMException); - // Supported forms: - // void bufferSubData (in GLenum target, in GLsizeiptr offset, in WebGLArray data); [Custom] void bufferSubData() raises(DOMException); +#endif unsigned long checkFramebufferStatus(in unsigned long target); void clear(in unsigned long mask); @@ -611,32 +613,34 @@ module html { void texParameteri(in unsigned long target, in unsigned long pname, in long param); // Supported forms: - // void texImage2D(in GLenum target, in GLint level, in GLenum internalformat, in GLsizei width, in GLsizei height, - // in GLint border, in GLenum format, in GLenum type, in WebGLArray pixels); - // void texImage2D(in GLenum target, in GLint level, in ImageData pixels, - // [Optional] in GLboolean flipY, [Optional] in premultiplyAlpha); - // void texImage2D(in GLenum target, in GLint level, in HTMLImageElement image, - // [Optional] in GLboolean flipY, [Optional] in premultiplyAlpha); - // void texImage2D(in GLenum target, in GLint level, in HTMLCanvasElement canvas, - // [Optional] in GLboolean flipY, [Optional] in premultiplyAlpha); - // void texImage2D(in GLenum target, in GLint level, in HTMLVideoElement video, - // [Optional] in GLboolean flipY, [Optional] in premultiplyAlpha); +#if defined(V8_BINDING) && V8_BINDING + void texImage2D(in unsigned long target, in long level, in unsigned long internalformat, in long width, in long height, + in long border, in unsigned long format, in unsigned long type, in WebGLArray pixels) raises (DOMException); + void texImage2D(in unsigned long target, in long level, in ImageData pixels, + in [Optional] boolean flipY, in [Optional] boolean premultiplyAlpha) raises (DOMException); + void texImage2D(in unsigned long target, in long level, in HTMLImageElement image, + in [Optional] boolean flipY, in [Optional] boolean premultiplyAlpha) raises (DOMException); + void texImage2D(in unsigned long target, in long level, in HTMLCanvasElement canvas, + in [Optional] boolean flipY, in [Optional] boolean premultiplyAlpha) raises (DOMException); + void texImage2D(in unsigned long target, in long level, in HTMLVideoElement video, + in [Optional] boolean flipY, in [Optional] boolean premultiplyAlpha) raises (DOMException); + + void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, + in long width, in long height, + in unsigned long format, in unsigned long type, in WebGLArray pixels) raises (DOMException); + void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, + in ImageData pixels, in [Optional] boolean flipY, in [Optional] boolean premultiplyAlpha) raises (DOMException); + void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, + in HTMLImageElement image, in [Optional] boolean flipY, in [Optional] boolean premultiplyAlpha) raises (DOMException); + void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, + in HTMLCanvasElement canvas, in [Optional] boolean flipY, in [Optional] boolean premultiplyAlpha) raises (DOMException); + void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, + in HTMLVideoElement video, in [Optional] boolean flipY, in [Optional] boolean premultiplyAlpha) raises (DOMException); +#else + // FIXME: Unfork once JSC supports overload generation too. [Custom] void texImage2D(); - - // Supported forms: - // void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, - // in GLsizei width, in GLsizei height, - // in GLenum format, in GLenum type, in WebGLArray pixels); - // void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, - // in ImageData pixels, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha); - // void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, - // in HTMLImageElement image, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha); - // void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, - // in HTMLCanvasElement canvas, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha); - // void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, - // in HTMLVideoElement video, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha); [Custom] void texSubImage2D(); - +#endif void uniform1f(in WebGLUniformLocation location, in float x) raises(DOMException); [Custom] void uniform1fv(in WebGLUniformLocation location, in WebGLFloatArray v) raises(DOMException); void uniform1i(in WebGLUniformLocation location, in long x) raises(DOMException); diff --git a/WebCore/html/canvas/WebGLShader.h b/WebCore/html/canvas/WebGLShader.h index 1ef912c..d4006aa 100644 --- a/WebCore/html/canvas/WebGLShader.h +++ b/WebCore/html/canvas/WebGLShader.h @@ -38,11 +38,13 @@ namespace WebCore { virtual ~WebGLShader() { deleteObject(); } static PassRefPtr<WebGLShader> create(WebGLRenderingContext*, GraphicsContext3D::WebGLEnumType); - + private: WebGLShader(WebGLRenderingContext*, GraphicsContext3D::WebGLEnumType); virtual void _deleteObject(Platform3DObject); + + virtual bool isShader() const { return true; } }; } // namespace WebCore diff --git a/WebCore/html/canvas/WebGLTexture.cpp b/WebCore/html/canvas/WebGLTexture.cpp index ae09b48..0c58edb 100644 --- a/WebCore/html/canvas/WebGLTexture.cpp +++ b/WebCore/html/canvas/WebGLTexture.cpp @@ -37,11 +37,6 @@ PassRefPtr<WebGLTexture> WebGLTexture::create(WebGLRenderingContext* ctx) return adoptRef(new WebGLTexture(ctx)); } -PassRefPtr<WebGLTexture> WebGLTexture::create(WebGLRenderingContext* ctx, Platform3DObject obj) -{ - return adoptRef(new WebGLTexture(ctx, obj)); -} - WebGLTexture::WebGLTexture(WebGLRenderingContext* ctx) : CanvasObject(ctx) , cubeMapRWrapModeInitialized(false) @@ -49,13 +44,6 @@ WebGLTexture::WebGLTexture(WebGLRenderingContext* ctx) setObject(context()->graphicsContext3D()->createTexture()); } -WebGLTexture::WebGLTexture(WebGLRenderingContext* ctx, Platform3DObject obj) - : CanvasObject(ctx) - , cubeMapRWrapModeInitialized(false) -{ - setObject(obj, false); -} - void WebGLTexture::_deleteObject(Platform3DObject object) { context()->graphicsContext3D()->deleteTexture(object); diff --git a/WebCore/html/canvas/WebGLTexture.h b/WebCore/html/canvas/WebGLTexture.h index c64dd41..b3c1f05 100644 --- a/WebCore/html/canvas/WebGLTexture.h +++ b/WebCore/html/canvas/WebGLTexture.h @@ -38,10 +38,6 @@ namespace WebCore { virtual ~WebGLTexture() { deleteObject(); } static PassRefPtr<WebGLTexture> create(WebGLRenderingContext*); - - // For querying previously created objects via e.g. getFramebufferAttachmentParameter - // FIXME: should consider canonicalizing these objects - static PassRefPtr<WebGLTexture> create(WebGLRenderingContext*, Platform3DObject); bool isCubeMapRWrapModeInitialized() { return cubeMapRWrapModeInitialized; @@ -53,11 +49,12 @@ namespace WebCore { protected: WebGLTexture(WebGLRenderingContext*); - WebGLTexture(WebGLRenderingContext*, Platform3DObject); virtual void _deleteObject(Platform3DObject); private: + virtual bool isTexture() const { return true; } + bool cubeMapRWrapModeInitialized; }; diff --git a/WebCore/inspector/InjectedScriptHost.idl b/WebCore/inspector/InjectedScriptHost.idl index e3cd976..8b24157 100644 --- a/WebCore/inspector/InjectedScriptHost.idl +++ b/WebCore/inspector/InjectedScriptHost.idl @@ -43,7 +43,6 @@ module core { #if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER [Custom] DOMObject currentCallFrame(); - [Custom] boolean isActivation(in DOMObject object); #endif #if defined(ENABLE_DATABASE) && ENABLE_DATABASE diff --git a/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.h b/WebCore/inspector/InspectorCSSStore.cpp index b1b0792..e53688b 100644 --- a/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.h +++ b/WebCore/inspector/InspectorCSSStore.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2010 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,40 +26,32 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef JSCustomSQLStatementErrorCallback_h -#define JSCustomSQLStatementErrorCallback_h +#include "config.h" +#include "InspectorCSSStore.h" -#if ENABLE(DATABASE) - -#include "JSCallbackData.h" -#include "SQLStatementErrorCallback.h" -#include <wtf/Forward.h> +#include "CSSStyleDeclaration.h" +#include "CSSStyleRule.h" +#include "CSSStyleSheet.h" +#include "PlatformString.h" namespace WebCore { -class JSCallbackData; -class SQLError; - -class JSCustomSQLStatementErrorCallback : public SQLStatementErrorCallback { -public: - static PassRefPtr<JSCustomSQLStatementErrorCallback> create(JSC::JSObject* callback, JSDOMGlobalObject* globalObject) - { - return adoptRef(new JSCustomSQLStatementErrorCallback(callback, globalObject)); - } - - virtual ~JSCustomSQLStatementErrorCallback(); - - virtual bool handleEvent(ScriptExecutionContext*, SQLTransaction*, SQLError*); - -private: - JSCustomSQLStatementErrorCallback(JSC::JSObject* callback, JSDOMGlobalObject*); - - JSCallbackData* m_data; - RefPtr<DOMWrapperWorld> m_isolatedWorld; -}; +InspectorCSSStore::InspectorCSSStore() +{ +} +InspectorCSSStore::~InspectorCSSStore() +{ } -#endif // ENABLE(DATABASE) +void InspectorCSSStore::reset() +{ + styleToId.clear(); + idToStyle.clear(); + ruleToId.clear(); + idToRule.clear(); + idToDisabledStyle.clear(); + inspectorStyleSheet = 0; +} -#endif // JSCustomSQLStatementErrorCallback_h +} // namespace WebCore diff --git a/WebCore/inspector/InspectorCSSStore.h b/WebCore/inspector/InspectorCSSStore.h new file mode 100644 index 0000000..d290fad --- /dev/null +++ b/WebCore/inspector/InspectorCSSStore.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must 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 InspectorCSSStore_h +#define InspectorCSSStore_h + +#include "StringHash.h" + +#include <wtf/HashMap.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + +class CSSStyleDeclaration; +class CSSStyleRule; +class CSSStyleSheet; +class String; + +typedef std::pair<String, String> PropertyValueAndPriority; +typedef HashMap<String, PropertyValueAndPriority> DisabledStyleDeclaration; +typedef HashMap<CSSStyleDeclaration*, long> StyleToIdMap; +typedef HashMap<long, RefPtr<CSSStyleDeclaration> > IdToStyleMap; +typedef HashMap<CSSStyleRule*, long> RuleToIdMap; +typedef HashMap<long, RefPtr<CSSStyleRule> > IdToRuleMap; +typedef HashMap<long, DisabledStyleDeclaration> IdToDisabledStyleMap; + +struct InspectorCSSStore { + InspectorCSSStore(); + ~InspectorCSSStore(); + void reset(); + + StyleToIdMap styleToId; + IdToStyleMap idToStyle; + RuleToIdMap ruleToId; + IdToRuleMap idToRule; + IdToDisabledStyleMap idToDisabledStyle; + RefPtr<CSSStyleSheet> inspectorStyleSheet; +}; + +} // namespace WebCore + +#endif // !defined(InspectorCSSStore_h) diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp index c54ee5b..23a991e 100644 --- a/WebCore/inspector/InspectorController.cpp +++ b/WebCore/inspector/InspectorController.cpp @@ -24,7 +24,7 @@ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (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 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" @@ -55,6 +55,7 @@ #include "InjectedScript.h" #include "InjectedScriptHost.h" #include "InspectorBackend.h" +#include "InspectorCSSStore.h" #include "InspectorClient.h" #include "InspectorFrontendClient.h" #include "InspectorDOMStorageResource.h" @@ -144,6 +145,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* client) : m_inspectedPage(page) , m_client(client) , m_openingFrontend(false) + , m_cssStore(new InspectorCSSStore()) , m_expiredConsoleMessageCount(0) , m_showAfterVisible(CurrentPanel) , m_groupLevel(0) @@ -427,7 +429,7 @@ void InspectorController::setFrontend(PassOwnPtr<InspectorFrontend> frontend) m_openingFrontend = false; m_frontend = frontend; releaseDOMAgent(); - m_domAgent = InspectorDOMAgent::create(m_frontend.get()); + m_domAgent = InspectorDOMAgent::create(m_cssStore.get(), m_frontend.get()); if (m_timelineAgent) m_timelineAgent->resetFrontendProxyObject(m_frontend.get()); #if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) @@ -663,8 +665,11 @@ void InspectorController::didCommitLoad(DocumentLoader* loader) m_currentUserInitiatedProfileNumber = 1; m_nextUserInitiatedProfileNumber = 1; #endif - // resetScriptObjects should be called before database and DOM storage + // unbindAllResources should be called before database and DOM storage // resources are cleared so that it has a chance to unbind them. + unbindAllResources(); + + m_cssStore->reset(); if (m_frontend) { m_frontend->reset(); m_domAgent->reset(); @@ -892,15 +897,19 @@ void InspectorController::willSendRequest(unsigned long identifier, const Resour void InspectorController::didReceiveResponse(unsigned long identifier, const ResourceResponse& response) { - RefPtr<InspectorResource> resource = getTrackedResource(identifier); - if (!resource) - return; + if (RefPtr<InspectorResource> resource = getTrackedResource(identifier)) { + resource->updateResponse(response); + resource->markResponseReceivedTime(); - resource->updateResponse(response); - resource->markResponseReceivedTime(); + if (resource != m_mainResource && m_frontend) + resource->updateScriptObject(m_frontend.get()); + } + if (response.httpStatusCode() >= 400) { + // The ugly code below is due to that String::format() is not utf8-safe at the moment. + String message = String::format("Failed to load resource: the server responded with a status of %u (", response.httpStatusCode()) + response.httpStatusText() + ")"; - if (resource != m_mainResource && m_frontend) - resource->updateScriptObject(m_frontend.get()); + addMessageToConsole(OtherMessageSource, LogMessageType, ErrorMessageLevel, message, 0, response.url().string()); + } } void InspectorController::didReceiveContentLength(unsigned long identifier, int lengthReceived) @@ -931,11 +940,16 @@ void InspectorController::didFinishLoading(unsigned long identifier) resource->updateScriptObject(m_frontend.get()); } -void InspectorController::didFailLoading(unsigned long identifier, const ResourceError& /*error*/) +void InspectorController::didFailLoading(unsigned long identifier, const ResourceError& error) { if (m_timelineAgent) m_timelineAgent->didFinishLoadingResource(identifier, true); + String message = "Failed to load resource"; + if (!error.localizedDescription().isEmpty()) + message += ": " + error.localizedDescription(); + addMessageToConsole(OtherMessageSource, LogMessageType, ErrorMessageLevel, message, 0, error.failingURL()); + RefPtr<InspectorResource> resource = getTrackedResource(identifier); if (!resource) return; diff --git a/WebCore/inspector/InspectorController.h b/WebCore/inspector/InspectorController.h index 3c67975..a90b299 100644 --- a/WebCore/inspector/InspectorController.h +++ b/WebCore/inspector/InspectorController.h @@ -65,6 +65,7 @@ class InjectedScript; class InjectedScriptHost; class InspectorBackend; class InspectorClient; +struct InspectorCSSStore; class InspectorFrontend; class InspectorFrontendClient; class InspectorTimelineAgent; @@ -318,6 +319,7 @@ private: bool m_openingFrontend; OwnPtr<InspectorFrontend> m_frontend; RefPtr<InspectorDOMAgent> m_domAgent; + OwnPtr<InspectorCSSStore> m_cssStore; OwnPtr<InspectorTimelineAgent> m_timelineAgent; RefPtr<Node> m_nodeToFocus; RefPtr<InspectorResource> m_mainResource; diff --git a/WebCore/inspector/InspectorDOMAgent.cpp b/WebCore/inspector/InspectorDOMAgent.cpp index 31fad80..d12a6d7 100644 --- a/WebCore/inspector/InspectorDOMAgent.cpp +++ b/WebCore/inspector/InspectorDOMAgent.cpp @@ -73,8 +73,9 @@ namespace WebCore { -InspectorDOMAgent::InspectorDOMAgent(InspectorFrontend* frontend) +InspectorDOMAgent::InspectorDOMAgent(InspectorCSSStore* cssStore, InspectorFrontend* frontend) : EventListener(InspectorDOMAgentType) + , m_cssStore(cssStore) , m_frontend(frontend) , m_lastNodeId(1) , m_lastStyleId(1) @@ -236,12 +237,6 @@ void InspectorDOMAgent::discardBindings() m_idToNode.clear(); releaseDanglingNodes(); m_childrenRequested.clear(); - m_styleToId.clear(); - m_idToStyle.clear(); - m_ruleToId.clear(); - m_idToRule.clear(); - m_idToDisabledStyle.clear(); - m_inspectorStyleSheet = 0; } Node* InspectorDOMAgent::nodeForId(long id) @@ -628,7 +623,13 @@ ScriptObject InspectorDOMAgent::buildObjectForEventListener(const RegisteredEven value.set("useCapture", registeredEventListener.useCapture); value.set("isAttribute", eventListener->isAttribute()); value.set("nodeId", pushNodePathToFrontend(node)); - value.set("listener", getEventListenerHandlerBody(node->document(), m_frontend->scriptState(), eventListener.get())); + value.set("listenerBody", eventListenerHandlerBody(node->document(), m_frontend->scriptState(), eventListener.get())); + String sourceName; + int lineNumber; + if (eventListenerHandlerLocation(node->document(), m_frontend->scriptState(), eventListener.get(), sourceName, lineNumber)) { + value.set("sourceName", sourceName); + value.set("lineNumber", lineNumber); + } return value; } @@ -899,8 +900,8 @@ ScriptArray InspectorDOMAgent::buildArrayForPseudoElements(Element* element, boo void InspectorDOMAgent::applyStyleText(long callId, long styleId, const String& styleText, const String& propertyName) { - IdToStyleMap::iterator it = m_idToStyle.find(styleId); - if (it == m_idToStyle.end()) { + IdToStyleMap::iterator it = cssStore()->idToStyle.find(styleId); + if (it == cssStore()->idToStyle.end()) { m_frontend->didApplyStyleText(callId, false, ScriptValue::undefined(), m_frontend->newScriptArray()); return; } @@ -976,8 +977,8 @@ void InspectorDOMAgent::applyStyleText(long callId, long styleId, const String& void InspectorDOMAgent::setStyleText(long callId, long styleId, const String& cssText) { - IdToStyleMap::iterator it = m_idToStyle.find(styleId); - if (it == m_idToStyle.end()) { + IdToStyleMap::iterator it = cssStore()->idToStyle.find(styleId); + if (it == cssStore()->idToStyle.end()) { m_frontend->didSetStyleText(callId, false); return; } @@ -989,8 +990,8 @@ void InspectorDOMAgent::setStyleText(long callId, long styleId, const String& cs void InspectorDOMAgent::setStyleProperty(long callId, long styleId, const String& name, const String& value) { - IdToStyleMap::iterator it = m_idToStyle.find(styleId); - if (it == m_idToStyle.end()) { + IdToStyleMap::iterator it = cssStore()->idToStyle.find(styleId); + if (it == cssStore()->idToStyle.end()) { m_frontend->didSetStyleProperty(callId, false); return; } @@ -1003,16 +1004,16 @@ void InspectorDOMAgent::setStyleProperty(long callId, long styleId, const String void InspectorDOMAgent::toggleStyleEnabled(long callId, long styleId, const String& propertyName, bool disabled) { - IdToStyleMap::iterator it = m_idToStyle.find(styleId); - if (it == m_idToStyle.end()) { + IdToStyleMap::iterator it = cssStore()->idToStyle.find(styleId); + if (it == cssStore()->idToStyle.end()) { m_frontend->didToggleStyleEnabled(callId, ScriptValue::undefined()); return; } CSSStyleDeclaration* style = it->second.get(); - IdToDisabledStyleMap::iterator disabledIt = m_idToDisabledStyle.find(styleId); - if (disabledIt == m_idToDisabledStyle.end()) - disabledIt = m_idToDisabledStyle.set(styleId, DisabledStyleDeclaration()).first; + IdToDisabledStyleMap::iterator disabledIt = cssStore()->idToDisabledStyle.find(styleId); + if (disabledIt == cssStore()->idToDisabledStyle.end()) + disabledIt = cssStore()->idToDisabledStyle.set(styleId, DisabledStyleDeclaration()).first; // TODO: make sure this works with shorthands right. ExceptionCode ec = 0; @@ -1035,8 +1036,8 @@ void InspectorDOMAgent::toggleStyleEnabled(long callId, long styleId, const Stri void InspectorDOMAgent::setRuleSelector(long callId, long ruleId, const String& selector, long selectedNodeId) { - IdToRuleMap::iterator it = m_idToRule.find(ruleId); - if (it == m_idToRule.end()) { + IdToRuleMap::iterator it = cssStore()->idToRule.find(ruleId); + if (it == cssStore()->idToRule.end()) { m_frontend->didSetRuleSelector(callId, ScriptValue::undefined(), false); return; } @@ -1076,7 +1077,7 @@ void InspectorDOMAgent::addRule(long callId, const String& selector, long select return; } - if (!m_inspectorStyleSheet.get()) { + if (!cssStore()->inspectorStyleSheet.get()) { Document* ownerDocument = node->ownerDocument(); ExceptionCode ec = 0; RefPtr<Element> styleElement = ownerDocument->createElement("style", ec); @@ -1094,38 +1095,38 @@ void InspectorDOMAgent::addRule(long callId, const String& selector, long select m_frontend->didAddRule(callId, ScriptValue::undefined(), false); return; } - m_inspectorStyleSheet = static_cast<CSSStyleSheet*>(styleSheet); + cssStore()->inspectorStyleSheet = static_cast<CSSStyleSheet*>(styleSheet); } ExceptionCode ec = 0; - m_inspectorStyleSheet->addRule(selector, "", ec); + cssStore()->inspectorStyleSheet->addRule(selector, "", ec); if (ec) { m_frontend->didAddRule(callId, ScriptValue::undefined(), false); return; } - CSSStyleRule* newRule = static_cast<CSSStyleRule*>(m_inspectorStyleSheet->item(m_inspectorStyleSheet->length() - 1)); + CSSStyleRule* newRule = static_cast<CSSStyleRule*>(cssStore()->inspectorStyleSheet->item(cssStore()->inspectorStyleSheet->length() - 1)); m_frontend->didAddRule(callId, buildObjectForRule(newRule), ruleAffectsNode(newRule, node)); } long InspectorDOMAgent::bindStyle(CSSStyleDeclaration* style) { - long id = m_styleToId.get(style); + long id = cssStore()->styleToId.get(style); if (!id) { id = m_lastStyleId++; - m_idToStyle.set(id, style); - m_styleToId.set(style, id); + cssStore()->idToStyle.set(id, style); + cssStore()->styleToId.set(style, id); } return id; } long InspectorDOMAgent::bindRule(CSSStyleRule* rule) { - long id = m_ruleToId.get(rule); + long id = cssStore()->ruleToId.get(rule); if (!id) { id = m_lastRuleId++; - m_idToRule.set(id, rule); - m_ruleToId.set(rule, id); + cssStore()->idToRule.set(id, rule); + cssStore()->ruleToId.set(rule, id); } return id; } @@ -1137,8 +1138,8 @@ ScriptObject InspectorDOMAgent::buildObjectForStyle(CSSStyleDeclaration* style, long styleId = bindStyle(style); result.set("id", styleId); - IdToDisabledStyleMap::iterator disabledIt = m_idToDisabledStyle.find(styleId); - if (disabledIt != m_idToDisabledStyle.end()) + IdToDisabledStyleMap::iterator disabledIt = cssStore()->idToDisabledStyle.find(styleId); + if (disabledIt != cssStore()->idToDisabledStyle.end()) result.set("disabled", buildArrayForDisabledStyleProperties(disabledIt->second)); } result.set("width", style->getPropertyValue("width")); @@ -1224,7 +1225,7 @@ ScriptObject InspectorDOMAgent::buildObjectForRule(CSSStyleRule* rule) bool isUser = parentStyleSheet && parentStyleSheet->ownerNode() && parentStyleSheet->ownerNode()->nodeName() == "#document"; result.set("isUserAgent", isUserAgent); result.set("isUser", isUser); - result.set("isViaInspector", rule->parentStyleSheet() == m_inspectorStyleSheet.get()); + result.set("isViaInspector", rule->parentStyleSheet() == cssStore()->inspectorStyleSheet.get()); // Bind editable scripts only. bool bind = !isUserAgent && !isUser; diff --git a/WebCore/inspector/InspectorDOMAgent.h b/WebCore/inspector/InspectorDOMAgent.h index 7211ed2..c8a4e1a 100644 --- a/WebCore/inspector/InspectorDOMAgent.h +++ b/WebCore/inspector/InspectorDOMAgent.h @@ -33,6 +33,7 @@ #include "AtomicString.h" #include "EventListener.h" #include "EventTarget.h" +#include "InspectorCSSStore.h" #include "ScriptArray.h" #include "ScriptObject.h" #include "ScriptState.h" @@ -73,9 +74,9 @@ namespace WebCore { class InspectorDOMAgent : public EventListener { public: - static PassRefPtr<InspectorDOMAgent> create(InspectorFrontend* frontend) + static PassRefPtr<InspectorDOMAgent> create(InspectorCSSStore* cssStore, InspectorFrontend* frontend) { - return adoptRef(new InspectorDOMAgent(frontend)); + return adoptRef(new InspectorDOMAgent(cssStore, frontend)); } static const InspectorDOMAgent* cast(const EventListener* listener) @@ -85,7 +86,7 @@ namespace WebCore { : 0; } - InspectorDOMAgent(InspectorFrontend* frontend); + InspectorDOMAgent(InspectorCSSStore* cssStore, InspectorFrontend* frontend); ~InspectorDOMAgent(); void reset(); @@ -127,9 +128,6 @@ namespace WebCore { void pushChildNodesToFrontend(long nodeId); private: - typedef std::pair<String, String> PropertyValueAndPriority; - typedef HashMap<String, PropertyValueAndPriority> DisabledStyleDeclaration; - void startListening(Document* document); void stopListening(Document* document); @@ -162,6 +160,7 @@ namespace WebCore { Document* mainFrameDocument() const; String documentURLString(Document* document) const; + InspectorCSSStore* cssStore() { return m_cssStore; } long bindStyle(CSSStyleDeclaration*); long bindRule(CSSStyleRule*); @@ -178,6 +177,7 @@ namespace WebCore { void discardBindings(); + InspectorCSSStore* m_cssStore; InspectorFrontend* m_frontend; NodeToIdMap m_documentNodeToIdMap; // Owns node mappings for dangling nodes. @@ -186,19 +186,6 @@ namespace WebCore { HashMap<long, NodeToIdMap*> m_idToNodesMap; HashSet<long> m_childrenRequested; long m_lastNodeId; - - typedef HashMap<CSSStyleDeclaration*, long> StyleToIdMap; - typedef HashMap<long, RefPtr<CSSStyleDeclaration> > IdToStyleMap; - StyleToIdMap m_styleToId; - IdToStyleMap m_idToStyle; - typedef HashMap<CSSStyleRule*, long> RuleToIdMap; - typedef HashMap<long, RefPtr<CSSStyleRule> > IdToRuleMap; - RuleToIdMap m_ruleToId; - IdToRuleMap m_idToRule; - typedef HashMap<long, DisabledStyleDeclaration> IdToDisabledStyleMap; - IdToDisabledStyleMap m_idToDisabledStyle; - RefPtr<CSSStyleSheet> m_inspectorStyleSheet; - long m_lastStyleId; long m_lastRuleId; ListHashSet<RefPtr<Document> > m_documents; diff --git a/WebCore/inspector/InspectorFrontend.cpp b/WebCore/inspector/InspectorFrontend.cpp index d89ae71..d89ae71 100755..100644 --- a/WebCore/inspector/InspectorFrontend.cpp +++ b/WebCore/inspector/InspectorFrontend.cpp diff --git a/WebCore/inspector/InspectorTimelineAgent.cpp b/WebCore/inspector/InspectorTimelineAgent.cpp index c0278c2..b8471a8 100644 --- a/WebCore/inspector/InspectorTimelineAgent.cpp +++ b/WebCore/inspector/InspectorTimelineAgent.cpp @@ -56,13 +56,17 @@ InspectorTimelineAgent::InspectorTimelineAgent(InspectorFrontend* frontend) void InspectorTimelineAgent::pushGCEventRecords() { - for (GCEvents::iterator i = m_gcEvents.begin(); i != m_gcEvents.end(); ++i) { + if (!m_gcEvents.size()) + return; + + GCEvents events = m_gcEvents; + m_gcEvents.clear(); + for (GCEvents::iterator i = events.begin(); i != events.end(); ++i) { ScriptObject record = TimelineRecordFactory::createGenericRecord(m_frontend, i->startTime); record.set("data", TimelineRecordFactory::createGCEventData(m_frontend, i->collectedBytes)); record.set("endTime", i->endTime); addRecordToTimeline(record, GCEventTimelineRecordType); } - m_gcEvents.clear(); } void InspectorTimelineAgent::didGC(double startTime, double endTime, size_t collectedBytesCount) diff --git a/WebCore/inspector/front-end/AuditLauncherView.js b/WebCore/inspector/front-end/AuditLauncherView.js index 60b7c32..33d3872 100644 --- a/WebCore/inspector/front-end/AuditLauncherView.js +++ b/WebCore/inspector/front-end/AuditLauncherView.js @@ -70,13 +70,12 @@ WebInspector.AuditLauncherView.prototype = { if (!this._auditPresentStateLabelElement) return; - this._resetResourceCount(); - if (isTracking) { this._auditPresentStateLabelElement.nodeValue = WebInspector.UIString("Audit Present State"); this._auditPresentStateElement.disabled = false; this._auditPresentStateElement.parentElement.removeStyleClass("disabled"); } else { + this._resetResourceCount(); this._auditPresentStateLabelElement.nodeValue = WebInspector.UIString("Audit Present State (Resource Tracking must be enabled)"); this._auditPresentStateElement.disabled = true; this._auditPresentStateElement.parentElement.addStyleClass("disabled"); @@ -268,12 +267,12 @@ WebInspector.AuditLauncherView.prototype = { if (!this._resourceProgressContainer) return; - if (!this._auditRunning) + if (!this._auditRunning) { + this._resetResourceCount(); this._resourceProgressContainer.addStyleClass("hidden"); - else { + } else this._resourceProgressContainer.removeStyleClass("hidden"); - this._resourceProgressTextElement.textContent = WebInspector.UIString("Loading (%d of %d)", this.loadedResources, this.totalResources); - } + this._resourceProgressTextElement.textContent = WebInspector.UIString("Loading (%d of %d)", this.loadedResources, this.totalResources); }, _updateButton: function() diff --git a/WebCore/inspector/front-end/AuditRules.js b/WebCore/inspector/front-end/AuditRules.js index d2c5f09..a6976b1 100644 --- a/WebCore/inspector/front-end/AuditRules.js +++ b/WebCore/inspector/front-end/AuditRules.js @@ -647,10 +647,12 @@ WebInspector.AuditRules.ImageDimensionsRule.prototype = { const node = WebInspector.domAgent.nodeForId(imageId); var src = node.getAttribute("src"); - for (var frameOwnerCandidate = node; frameOwnerCandidate; frameOwnerCandidate = frameOwnerCandidate.parentNode) { - if (frameOwnerCandidate.documentURL) { - var completeSrc = WebInspector.completeURL(frameOwnerCandidate.documentURL, src); - break; + if (!WebInspector.URLRegExp.test(src)) { + for (var frameOwnerCandidate = node; frameOwnerCandidate; frameOwnerCandidate = frameOwnerCandidate.parentNode) { + if (frameOwnerCandidate.documentURL) { + var completeSrc = WebInspector.completeURL(frameOwnerCandidate.documentURL, src); + break; + } } } if (completeSrc) diff --git a/WebCore/inspector/front-end/ElementsPanel.js b/WebCore/inspector/front-end/ElementsPanel.js index e2ca838..d47a4cd 100644 --- a/WebCore/inspector/front-end/ElementsPanel.js +++ b/WebCore/inspector/front-end/ElementsPanel.js @@ -763,6 +763,15 @@ WebInspector.ElementsPanel.prototype = { parentElement.title = title; }, + linkifyNodeReference: function(node) + { + var link = document.createElement("span"); + link.className = "node-link"; + link.addEventListener("click", WebInspector.updateFocusedNode.bind(WebInspector, node.id), false); + this.decorateNodeLabel(node, link); + return link; + }, + updateBreadcrumbSizes: function(focusedCrumb) { if (!this.visible) @@ -1111,6 +1120,11 @@ WebInspector.ElementsPanel.prototype = { InspectorBackend.enableSearchingForNode(); else InspectorBackend.disableSearchingForNode(); + }, + + elementsToRestoreScrollPositionsFor: function() + { + return [ this.contentElement, this.sidebarElement ]; } } diff --git a/WebCore/inspector/front-end/ElementsTreeOutline.js b/WebCore/inspector/front-end/ElementsTreeOutline.js index 1add6cc..cd1bf23 100644 --- a/WebCore/inspector/front-end/ElementsTreeOutline.js +++ b/WebCore/inspector/front-end/ElementsTreeOutline.js @@ -285,6 +285,10 @@ WebInspector.ElementsTreeOutline.prototype = { if (element) { element.hovered = true; this._previousHoveredElement = element; + + // Lazily compute tag-specific tooltips. + if (element.representedObject && !element.tooltip) + element._createTooltipForNode(); } WebInspector.hoveredDOMNode = (element ? element.representedObject : null); @@ -424,27 +428,24 @@ WebInspector.ElementsTreeElement.prototype = { return this.expandedChildCount > index; }, - createTooltipForImageNode: function(node, callback) + _createTooltipForNode: function() { - if (this._elementCloseTag) + var node = this.representedObject; + if (!node.nodeName || node.nodeName.toLowerCase() !== "img") return; - - function createTooltipThenCallback(properties) + + function setTooltip(properties) { - if (!properties) { - callback(); + if (!properties) return; - } - var tooltipText = null; if (properties.offsetHeight === properties.naturalHeight && properties.offsetWidth === properties.naturalWidth) - tooltipText = WebInspector.UIString("%d × %d pixels", properties.offsetWidth, properties.offsetHeight); + this.tooltip = WebInspector.UIString("%d × %d pixels", properties.offsetWidth, properties.offsetHeight); else - tooltipText = WebInspector.UIString("%d × %d pixels (Natural: %d × %d pixels)", properties.offsetWidth, properties.offsetHeight, properties.naturalWidth, properties.naturalHeight); - callback(tooltipText); + this.tooltip = WebInspector.UIString("%d × %d pixels (Natural: %d × %d pixels)", properties.offsetWidth, properties.offsetHeight, properties.naturalWidth, properties.naturalHeight); } var objectProxy = new WebInspector.ObjectProxy(node.injectedScriptId, node.id); - WebInspector.ObjectProxy.getPropertiesAsync(objectProxy, ["naturalHeight", "naturalWidth", "offsetHeight", "offsetWidth"], createTooltipThenCallback); + WebInspector.ObjectProxy.getPropertiesAsync(objectProxy, ["naturalHeight", "naturalWidth", "offsetHeight", "offsetWidth"], setTooltip.bind(this)); }, updateSelection: function() @@ -1175,22 +1176,12 @@ WebInspector.ElementsTreeElement.prototype = { if (this._editing) return; - var self = this; - function callback(tooltipText) - { - var title = self._nodeTitleInfo(WebInspector.linkifyURL, tooltipText).title; - self.title = "<span class=\"highlight\">" + title + "</span>"; - delete self.selectionElement; - self.updateSelection(); - self._preventFollowingLinksOnDoubleClick(); - self._highlightSearchResults(); - }; - - // TODO: Replace with InjectedScriptAccess.getBasicProperties(obj, [names]). - if (this.representedObject.nodeName.toLowerCase() !== "img") - callback(); - else - this.createTooltipForImageNode(this.representedObject, callback); + var title = this._nodeTitleInfo(WebInspector.linkifyURL).title; + this.title = "<span class=\"highlight\">" + title + "</span>"; + delete this.selectionElement; + this.updateSelection(); + this._preventFollowingLinksOnDoubleClick(); + this._highlightSearchResults(); }, _rewriteAttrHref: function(node, hrefValue) @@ -1216,7 +1207,7 @@ WebInspector.ElementsTreeElement.prototype = { return hrefValue; }, - _attributeHTML: function(name, value, node, linkify, tooltipText) + _attributeHTML: function(name, value, node, linkify) { var hasText = (value.length > 0); var html = "<span class=\"webkit-html-attribute\"><span class=\"webkit-html-attribute-name\">" + name.escapeHTML() + "</span>"; @@ -1226,7 +1217,7 @@ WebInspector.ElementsTreeElement.prototype = { if (linkify && (name === "src" || name === "href")) { value = value.replace(/([\/;:\)\]\}])/g, "$1\u200B"); - html += linkify(this._rewriteAttrHref(node, value), value, "webkit-html-attribute-value", node.nodeName.toLowerCase() === "a", tooltipText); + html += linkify(this._rewriteAttrHref(node, value), value, "webkit-html-attribute-value", node.nodeName.toLowerCase() === "a"); } else { value = value.escapeHTML().replace(/([\/;:\)\]\}])/g, "$1​"); html += "<span class=\"webkit-html-attribute-value\">" + value + "</span>"; @@ -1239,7 +1230,7 @@ WebInspector.ElementsTreeElement.prototype = { return html; }, - _tagHTML: function(tagName, isClosingTag, isDistinctTreeElement, linkify, tooltipText) + _tagHTML: function(tagName, isClosingTag, isDistinctTreeElement, linkify) { var node = this.representedObject; var result = "<span class=\"webkit-html-tag" + (isClosingTag && isDistinctTreeElement ? " close" : "") + "\"><"; @@ -1247,7 +1238,7 @@ WebInspector.ElementsTreeElement.prototype = { if (!isClosingTag && node.hasAttributes()) { for (var i = 0; i < node.attributes.length; ++i) { var attr = node.attributes[i]; - result += " " + this._attributeHTML(attr.name, attr.value, node, linkify, tooltipText); + result += " " + this._attributeHTML(attr.name, attr.value, node, linkify); } } result += "></span>​"; @@ -1255,7 +1246,7 @@ WebInspector.ElementsTreeElement.prototype = { return result; }, - _nodeTitleInfo: function(linkify, tooltipText) + _nodeTitleInfo: function(linkify) { var node = this.representedObject; var info = {title: "", hasChildren: this.hasChildren}; @@ -1277,7 +1268,7 @@ WebInspector.ElementsTreeElement.prototype = { break; } - info.title = this._tagHTML(tagName, false, false, linkify, tooltipText); + info.title = this._tagHTML(tagName, false, false, linkify); var textChild = onlyTextChild.call(node); var showInlineText = textChild && textChild.textContent.length < Preferences.maxInlineTextChildLength; diff --git a/WebCore/inspector/front-end/EventListenersSidebarPane.js b/WebCore/inspector/front-end/EventListenersSidebarPane.js index e454256..045d29b 100644 --- a/WebCore/inspector/front-end/EventListenersSidebarPane.js +++ b/WebCore/inspector/front-end/EventListenersSidebarPane.js @@ -77,7 +77,7 @@ WebInspector.EventListenersSidebarPane.prototype = { var eventListener = eventListeners[i]; eventListener.node = WebInspector.domAgent.nodeForId(eventListener.nodeId); delete eventListener.nodeId; // no longer needed - if (/^function _inspectorCommandLineAPI_logEvent\(/.test(eventListener.listener.toString())) + if (/^function _inspectorCommandLineAPI_logEvent\(/.test(eventListener.listenerBody.toString())) continue; // ignore event listeners generated by monitorEvent var type = eventListener.type; var section = sectionMap[type]; @@ -155,7 +155,7 @@ WebInspector.EventListenersSection.prototype = { var length = filteredEventListeners.length; for (var i = 0; i < length; ++i) { var eventListener = filteredEventListeners[i]; - var eventListenerBar = new WebInspector.EventListenerBar(eventListener); + var eventListenerBar = new WebInspector.EventListenerBar(eventListener, this._nodeId); if (i < length - 1) { var connector = document.createElement("div"); connector.className = "event-bar-connector"; @@ -174,10 +174,13 @@ WebInspector.EventListenersSection.prototype = { WebInspector.EventListenersSection.prototype.__proto__ = WebInspector.PropertiesSection.prototype; -WebInspector.EventListenerBar = function(eventListener) +WebInspector.EventListenerBar = function(eventListener, nodeId) { this.eventListener = eventListener; - WebInspector.ObjectPropertiesSection.call(this, null, this._getFunctionDisplayName(), this._getNodeDisplayName()); + this._nodeId = nodeId; + WebInspector.ObjectPropertiesSection.call(this); + this._setNodeTitle(); + this._setFunctionSubtitle(); this.editable = false; this.element.className = "event-bar"; /* Changed from "section" */ this.propertiesElement.className = "event-properties"; /* Changed from "properties" */ @@ -199,23 +202,39 @@ WebInspector.EventListenerBar.prototype = { this.updateProperties(properties); }, - _getNodeDisplayName: function() + _setNodeTitle: function() { var node = this.eventListener.node; if (!node) - return ""; + return; + + if (node.nodeType === Node.DOCUMENT_NODE) { + this.titleElement.textContent = "document"; + return; + } - if (node.nodeType === Node.DOCUMENT_NODE) - return "document"; + if (node.id === this._nodeId) { + this.titleElement.textContent = appropriateSelectorForNode(node); + return; + } - return appropriateSelectorForNode(node); + this.titleElement.removeChildren(); + this.titleElement.appendChild(WebInspector.panels.elements.linkifyNodeReference(this.eventListener.node)); }, - _getFunctionDisplayName: function() + _setFunctionSubtitle: function() { // Requires that Function.toString() return at least the function's signature. - var match = this.eventListener.listener.toString().match(/function ([^\(]+?)\(/); - return (match ? match[1] : WebInspector.UIString("(anonymous function)")); + if (this.eventListener.sourceName) { + this.subtitleElement.removeChildren(); + this.subtitleElement.appendChild(WebInspector.linkifyResourceAsNode(this.eventListener.sourceName, "scripts", this.eventListener.lineNumber)); + } else { + var match = this.eventListener.listenerBody.match(/function ([^\(]+?)\(/); + if (match) + this.subtitleElement.textContent = match[1]; + else + this.subtitleElement.textContent = WebInspector.UIString("(anonymous function)"); + } } } diff --git a/WebCore/inspector/front-end/FontView.js b/WebCore/inspector/front-end/FontView.js index 8468cc9..b011204 100644 --- a/WebCore/inspector/front-end/FontView.js +++ b/WebCore/inspector/front-end/FontView.js @@ -31,24 +31,35 @@ WebInspector.FontView = function(resource) WebInspector.ResourceView.call(this, resource); this.element.addStyleClass("font"); +} - var uniqueFontName = "WebInspectorFontPreview" + this.resource.identifier; +WebInspector.FontView.prototype = { + hasContentTab: function() + { + return true; + }, - this.fontStyleElement = document.createElement("style"); - this.fontStyleElement.textContent = "@font-face { font-family: \"" + uniqueFontName + "\"; src: url(" + this.resource.url + "); }"; - document.head.appendChild(this.fontStyleElement); + contentTabSelected: function() + { + if (this.fontPreviewElement) + return; - this.fontPreviewElement = document.createElement("div"); - this.fontPreviewElement.className = "preview"; - this.contentElement.appendChild(this.fontPreviewElement); + var uniqueFontName = "WebInspectorFontPreview" + this.resource.identifier; - this.fontPreviewElement.style.setProperty("font-family", uniqueFontName, null); - this.fontPreviewElement.innerHTML = "ABCDEFGHIJKLM<br>NOPQRSTUVWXYZ<br>abcdefghijklm<br>nopqrstuvwxyz<br>1234567890"; + this.fontStyleElement = document.createElement("style"); + this.fontStyleElement.textContent = "@font-face { font-family: \"" + uniqueFontName + "\"; src: url(" + this.resource.url + "); }"; + document.head.appendChild(this.fontStyleElement); - this.updateFontPreviewSize(); -} + this.fontPreviewElement = document.createElement("div"); + this.contentElement.appendChild(this.fontPreviewElement); + + this.fontPreviewElement.style.setProperty("font-family", uniqueFontName, null); + this.fontPreviewElement.innerHTML = "ABCDEFGHIJKLM<br>NOPQRSTUVWXYZ<br>abcdefghijklm<br>nopqrstuvwxyz<br>1234567890"; + this._lineCount = this.fontPreviewElement.getElementsByTagName("br").length + 1; + + this.updateFontPreviewSize(); + }, -WebInspector.FontView.prototype = { show: function(parentElement) { WebInspector.ResourceView.prototype.show.call(this, parentElement); @@ -60,44 +71,36 @@ WebInspector.FontView.prototype = { this.updateFontPreviewSize(); }, - updateFontPreviewSize: function () + updateFontPreviewSize: function() { if (!this.fontPreviewElement || !this.visible) return; - this.fontPreviewElement.removeStyleClass("preview"); - - var measureFontSize = 50; - this.fontPreviewElement.style.setProperty("position", "absolute", null); + const measureFontSize = 50; this.fontPreviewElement.style.setProperty("font-size", measureFontSize + "px", null); + this.fontPreviewElement.style.setProperty("position", "absolute", null); this.fontPreviewElement.style.removeProperty("height"); - var height = this.fontPreviewElement.offsetHeight; - var width = this.fontPreviewElement.offsetWidth; - - var containerWidth = this.contentElement.offsetWidth; + const height = this.fontPreviewElement.offsetHeight; + const width = this.fontPreviewElement.offsetWidth; // Subtract some padding. This should match the padding in the CSS plus room for the scrollbar. - containerWidth -= 40; + const containerWidth = this.contentElement.offsetWidth - 50; if (!height || !width || !containerWidth) { this.fontPreviewElement.style.removeProperty("font-size"); this.fontPreviewElement.style.removeProperty("position"); - this.fontPreviewElement.addStyleClass("preview"); return; } - var lineCount = this.fontPreviewElement.getElementsByTagName("br").length + 1; - var realLineHeight = Math.floor(height / lineCount); + var realLineHeight = Math.floor(height / this._lineCount); var fontSizeLineRatio = measureFontSize / realLineHeight; var widthRatio = containerWidth / width; - var finalFontSize = Math.floor(realLineHeight * widthRatio * fontSizeLineRatio) - 1; + var finalFontSize = Math.floor(realLineHeight * widthRatio * fontSizeLineRatio) - 2; this.fontPreviewElement.style.setProperty("font-size", finalFontSize + "px", null); this.fontPreviewElement.style.setProperty("height", this.fontPreviewElement.offsetHeight + "px", null); this.fontPreviewElement.style.removeProperty("position"); - - this.fontPreviewElement.addStyleClass("preview"); } } diff --git a/WebCore/inspector/front-end/ImageView.js b/WebCore/inspector/front-end/ImageView.js index c13c9a5..0c15a40 100644 --- a/WebCore/inspector/front-end/ImageView.js +++ b/WebCore/inspector/front-end/ImageView.js @@ -34,6 +34,11 @@ WebInspector.ImageView = function(resource) } WebInspector.ImageView.prototype = { + hasContentTab: function() + { + return true; + }, + contentTabSelected: function() { if (this._container) diff --git a/WebCore/inspector/front-end/InjectedScript.js b/WebCore/inspector/front-end/InjectedScript.js index 8984d0e..e3be6a3 100644 --- a/WebCore/inspector/front-end/InjectedScript.js +++ b/WebCore/inspector/front-end/InjectedScript.js @@ -841,9 +841,6 @@ InjectedScript.CallFrameProxy = function(id, callFrame) this.scopeChain = this._wrapScopeChain(callFrame); } -// FIXME(37663): unify scope chain representation and remove this if. -if (jsEngine === "v8") { - InjectedScript.CallFrameProxy.prototype = { _wrapScopeChain: function(callFrame) { @@ -855,12 +852,12 @@ InjectedScript.CallFrameProxy.prototype = { var scopeChain = callFrame.scopeChain; var scopeChainProxy = []; + var foundLocalScope = false; for (var i = 0; i < scopeChain.length; i++) { var scopeType = callFrame.scopeType(i); var scopeObject = scopeChain[i]; var scopeObjectProxy = InjectedScript.createProxyObject(scopeObject, { callFrame: this.id, chainIndex: i }, true); - var foundLocalScope = false; switch(scopeType) { case LOCAL_SCOPE: { foundLocalScope = true; @@ -874,57 +871,21 @@ InjectedScript.CallFrameProxy.prototype = { } case WITH_SCOPE: case CATCH_SCOPE: { - scopeObjectProxy.isWithBlock = true; + if (foundLocalScope && scopeObject instanceof inspectedWindow.Element) + scopeObjectProxy.isElement = true; + else if (foundLocalScope && scopeObject instanceof inspectedWindow.Document) + scopeObjectProxy.isDocument = true; + else + scopeObjectProxy.isWithBlock = true; break; } } - - if (foundLocalScope) { - if (scopeObject instanceof inspectedWindow.Element) - scopeObjectProxy.isElement = true; - else if (scopeObject instanceof inspectedWindow.Document) - scopeObjectProxy.isDocument = true; - } - - scopeChainProxy.push(scopeObjectProxy); - } - return scopeChainProxy; - } -} - -} else { - -InjectedScript.CallFrameProxy.prototype = { - _wrapScopeChain: function(callFrame) - { - var foundLocalScope = false; - var scopeChain = callFrame.scopeChain; - var scopeChainProxy = []; - for (var i = 0; i < scopeChain.length; ++i) { - var scopeObject = scopeChain[i]; - var scopeObjectProxy = InjectedScript.createProxyObject(scopeObject, { callFrame: this.id, chainIndex: i }, true); - - if (InjectedScriptHost.isActivation(scopeObject)) { - if (!foundLocalScope) - scopeObjectProxy.thisObject = InjectedScript.createProxyObject(callFrame.thisObject, { callFrame: this.id, thisObject: true }, true); - else - scopeObjectProxy.isClosure = true; - foundLocalScope = true; - scopeObjectProxy.isLocal = true; - } else if (foundLocalScope && scopeObject instanceof inspectedWindow.Element) - scopeObjectProxy.isElement = true; - else if (foundLocalScope && scopeObject instanceof inspectedWindow.Document) - scopeObjectProxy.isDocument = true; - else if (!foundLocalScope) - scopeObjectProxy.isWithBlock = true; scopeChainProxy.push(scopeObjectProxy); } return scopeChainProxy; } } -} - InjectedScript.executeSql = function(callId, databaseId, query) { function successCallback(tx, result) @@ -1052,8 +1013,19 @@ InjectedScript._toString = function(obj) InjectedScript._className = function(obj) { - var str = inspectedWindow.Object ? inspectedWindow.Object.prototype.toString.call(obj) : InjectedScript._toString(obj); - return str.replace(/^\[object (.*)\]$/i, "$1"); + // We can't use the same code for fetching class names of the dom bindings prototype chain. + // Both of the methods below result in "Object" names on the foreign engine bindings. + // I gave up and am using a check below to distinguish between the egine bingings. + + if (typeof Document === "object") { + // JSC + var str = inspectedWindow.Object ? inspectedWindow.Object.prototype.toString.call(obj) : InjectedScript._toString(obj); + return str.replace(/^\[object (.*)\]$/i, "$1"); + } + // V8 + if (typeof obj !== "object") + return "null"; + return obj.constructor.name; } InjectedScript._escapeCharacters = function(str, chars) diff --git a/WebCore/inspector/front-end/Panel.js b/WebCore/inspector/front-end/Panel.js index b916708..6dbc60e 100644 --- a/WebCore/inspector/front-end/Panel.js +++ b/WebCore/inspector/front-end/Panel.js @@ -84,10 +84,12 @@ WebInspector.Panel.prototype = { WebInspector.currentFocusElement = this.defaultFocusedElement; this.updateSidebarWidth(); + this._restoreScrollPositions(); }, hide: function() { + this._storeScrollPositions(); WebInspector.View.prototype.hide.call(this); if (this._statusBarItemContainer && this._statusBarItemContainer.parentNode) @@ -386,6 +388,30 @@ WebInspector.Panel.prototype = { searchIteratesOverViews: function() { return false; + }, + + elementsToRestoreScrollPositionsFor: function() + { + return []; + }, + + _storeScrollPositions: function() + { + var elements = this.elementsToRestoreScrollPositionsFor(); + for (var i = 0; i < elements.length; ++i) { + var container = elements[i]; + container._scrollTop = container.scrollTop; + } + }, + + _restoreScrollPositions: function() + { + var elements = this.elementsToRestoreScrollPositionsFor(); + for (var i = 0; i < elements.length; ++i) { + var container = elements[i]; + if (container._scrollTop) + container.scrollTop = container._scrollTop; + } } } diff --git a/WebCore/inspector/front-end/Popover.js b/WebCore/inspector/front-end/Popover.js index 848c99e..59b48f9 100644 --- a/WebCore/inspector/front-end/Popover.js +++ b/WebCore/inspector/front-end/Popover.js @@ -175,7 +175,7 @@ WebInspector.PopoverHelper.prototype = { var self = this; function doHide() { - self.hidePopup(); + self._hidePopup(); delete self._hidePopupTimer; } this._hidePopupTimer = setTimeout(doHide, 500); @@ -206,6 +206,12 @@ WebInspector.PopoverHelper.prototype = { hidePopup: function() { + this._resetHoverTimer(); + this._hidePopup(); + }, + + _hidePopup: function() + { if (!this._popup) return; diff --git a/WebCore/inspector/front-end/ProfilesPanel.js b/WebCore/inspector/front-end/ProfilesPanel.js index 2f9d38d..cca9e33 100644 --- a/WebCore/inspector/front-end/ProfilesPanel.js +++ b/WebCore/inspector/front-end/ProfilesPanel.js @@ -311,14 +311,37 @@ WebInspector.ProfilesPanel.prototype = { profile._profilesTreeElement = profileTreeElement; sidebarParent.appendChild(profileTreeElement); - this.welcomeView.hide(); - if (!this.visibleView) - this.showProfile(profile); + if (!profile.isTemporary) { + this.welcomeView.hide(); + if (!this.visibleView) + this.showProfile(profile); + } + }, + + removeProfileHeader: function(profile) + { + var typeId = profile.typeId; + var profileType = this.getProfileType(typeId); + var sidebarParent = profileType.treeElement; + + for (var i = 0; i < this._profiles.length; ++i) { + if (this._profiles[i].uid === profile.uid) { + profile = this._profiles[i]; + this._profiles.splice(i, 1); + break; + } + } + delete this._profilesIdMap[this._makeKey(profile.uid, typeId)]; + + var profileTitleKey = this._makeKey(profile.title, typeId); + delete this._profileGroups[profileTitleKey]; + + sidebarParent.removeChild(profile._profilesTreeElement); }, showProfile: function(profile) { - if (!profile) + if (!profile || profile.isTemporary) return; this.closeVisibleView(); diff --git a/WebCore/inspector/front-end/Resource.js b/WebCore/inspector/front-end/Resource.js index 4ee5f28..739dd73 100644 --- a/WebCore/inspector/front-end/Resource.js +++ b/WebCore/inspector/front-end/Resource.js @@ -536,6 +536,12 @@ WebInspector.Resource.prototype = { _mimeTypeIsConsistentWithType: function() { + // If status is an error, content is likely to be of an inconsistent type, + // as it's going to be an error message. We do not want to emit a warning + // for this, though, as this will already be reported as resource loading failure. + if (this.statusCode >= 400) + return true; + if (typeof this.type === "undefined" || this.type === WebInspector.Resource.Type.Other || this.type === WebInspector.Resource.Type.XHR) diff --git a/WebCore/inspector/front-end/ResourceView.js b/WebCore/inspector/front-end/ResourceView.js index 618a935..fac57b4 100644 --- a/WebCore/inspector/front-end/ResourceView.js +++ b/WebCore/inspector/front-end/ResourceView.js @@ -43,11 +43,12 @@ WebInspector.ResourceView = function(resource) this.headersTabElement.textContent = WebInspector.UIString("Headers"); this.contentTabElement = document.createElement("li"); this.contentTabElement.textContent = WebInspector.UIString("Content"); + this.tabsElement.appendChild(this.headersTabElement); this.tabsElement.appendChild(this.contentTabElement); - this.headersTabElement.addEventListener("click", this._selectHeadersTab.bind(this), false); - this.contentTabElement.addEventListener("click", this.selectContentTab.bind(this), false); + this.headersTabElement.addEventListener("click", this._selectHeadersTab.bind(this, true), false); + this.contentTabElement.addEventListener("click", this.selectContentTab.bind(this, true), false); this.headersElement = document.createElement("div"); this.headersElement.className = "resource-view-headers"; @@ -118,6 +119,8 @@ WebInspector.ResourceView = function(resource) this._refreshRequestHeaders(); this._refreshResponseHeaders(); this._refreshHTTPInformation(); + if (!this.hasContentTab()) + this.contentTabElement.addStyleClass("hidden"); this._selectTab(); } @@ -152,7 +155,7 @@ WebInspector.ResourceView.prototype = { _selectTab: function() { if (this._headersVisible) { - if (WebInspector.settings.resourceViewTab === "headers") + if (!this.hasContentTab() || WebInspector.settings.resourceViewTab === "headers") this._selectHeadersTab(); else this.selectContentTab(); @@ -160,21 +163,29 @@ WebInspector.ResourceView.prototype = { this._innerSelectContentTab(); }, - _selectHeadersTab: function() + _selectHeadersTab: function(updatePrefs) { - WebInspector.settings.resourceViewTab = "headers"; + if (updatePrefs) + WebInspector.settings.resourceViewTab = "headers"; this.headersTabElement.addStyleClass("selected"); this.contentTabElement.removeStyleClass("selected"); this.headersElement.removeStyleClass("hidden"); this.contentElement.addStyleClass("hidden"); }, - selectContentTab: function() + selectContentTab: function(updatePrefs) { - WebInspector.settings.resourceViewTab = "content"; + if (updatePrefs) + WebInspector.settings.resourceViewTab = "content"; this._innerSelectContentTab(); }, + hasContentTab: function() + { + // Derived classes should override this method and define this.contentTabSelected for content rendering. + return false; + }, + _innerSelectContentTab: function() { this.contentTabElement.addStyleClass("selected"); @@ -186,16 +197,6 @@ WebInspector.ResourceView.prototype = { this.contentTabSelected(); }, - contentTabSelected: function() - { - if (!this._contentPlaceholderElement) { - this._contentPlaceholderElement = document.createElement("div"); - this._contentPlaceholderElement.className = "resource-content-unavailable"; - this._contentPlaceholderElement.textContent = WebInspector.UIString("No Content Available"); - this.contentElement.appendChild(this._contentPlaceholderElement); - } - }, - _refreshURL: function() { this.urlTreeElement.title = "<div class=\"header-name\">" + WebInspector.UIString("Request URL") + ":</div>" + diff --git a/WebCore/inspector/front-end/ResourcesPanel.js b/WebCore/inspector/front-end/ResourcesPanel.js index 5284e68..a62994e 100644 --- a/WebCore/inspector/front-end/ResourcesPanel.js +++ b/WebCore/inspector/front-end/ResourcesPanel.js @@ -443,9 +443,6 @@ WebInspector.ResourcesPanel.prototype = { if (newView.__proto__ === resource._resourcesView.__proto__) return; - resource.warnings = 0; - resource.errors = 0; - if (!this.currentQuery && resource._itemsTreeElement) resource._itemsTreeElement.updateErrorsAndWarnings(); @@ -490,7 +487,7 @@ WebInspector.ResourcesPanel.prototype = { view.show(this.viewsContainerElement); if (line) { - view.selectContentTab(); + view.selectContentTab(true); if (view.revealLine) view.revealLine(line); if (view.highlightLine) @@ -574,6 +571,7 @@ WebInspector.ResourcesPanel.prototype = { return; } + this._timelineGrid.removeEventDividers(); if (this.mainResourceLoadTime !== -1) { var percent = this.calculator.computePercentageFromEventTime(this.mainResourceLoadTime); @@ -727,6 +725,11 @@ WebInspector.ResourcesPanel.prototype = { searchIteratesOverViews: function() { return true; + }, + + elementsToRestoreScrollPositionsFor: function() + { + return [ this.containerElement ]; } } diff --git a/WebCore/inspector/front-end/ScriptView.js b/WebCore/inspector/front-end/ScriptView.js index e55a685..cb10889 100644 --- a/WebCore/inspector/front-end/ScriptView.js +++ b/WebCore/inspector/front-end/ScriptView.js @@ -77,11 +77,6 @@ WebInspector.ScriptView.prototype = { WebInspector.panels.scripts.addBreakpoint(breakpoint); }, - _editLine: function(line, newContent) - { - WebInspector.panels.scripts.editScriptLine(this.script.sourceID, line, newContent, this._editLineComplete.bind(this)); - }, - _editLineComplete: function(newBody) { this.script.source = newBody; @@ -107,6 +102,7 @@ WebInspector.ScriptView.prototype = { _jumpToSearchResult: WebInspector.SourceView.prototype._jumpToSearchResult, _sourceFrameSetupFinished: WebInspector.SourceView.prototype._sourceFrameSetupFinished, _removeBreakpoint: WebInspector.SourceView.prototype._removeBreakpoint, + _editLine: WebInspector.SourceView.prototype._editLine, resize: WebInspector.SourceView.prototype.resize } diff --git a/WebCore/inspector/front-end/ScriptsPanel.js b/WebCore/inspector/front-end/ScriptsPanel.js index 987bdf2..6344554 100644 --- a/WebCore/inspector/front-end/ScriptsPanel.js +++ b/WebCore/inspector/front-end/ScriptsPanel.js @@ -248,6 +248,13 @@ WebInspector.ScriptsPanel.prototype = { delete this._attachDebuggerWhenShown; } }, + + hide: function() + { + WebInspector.Panel.prototype.hide.call(this); + if (this.visibleView) + this.visibleView.hide(); + }, get searchableViews() { @@ -352,10 +359,10 @@ WebInspector.ScriptsPanel.prototype = { canEditScripts: function() { - return !!InspectorBackend.editScriptLine; + return !!InspectorBackend.editScriptSource; }, - editScriptLine: function(sourceID, line, newContent, callback) + editScriptSource: function(sourceID, newContent, line, linesCountToShift, callback) { if (!this.canEditScripts()) return; @@ -369,7 +376,6 @@ WebInspector.ScriptsPanel.prototype = { newBreakpoints.push(breakpoint); } - var linesCountToShift = newContent.split("\n").length - 1; function mycallback(newBody) { callback(newBody); @@ -381,7 +387,7 @@ WebInspector.ScriptsPanel.prototype = { } }; var callbackId = WebInspector.Callback.wrap(mycallback.bind(this)) - InspectorBackend.editScriptLine(callbackId, sourceID, line, newContent); + InspectorBackend.editScriptSource(callbackId, sourceID, newContent); }, selectedCallFrameId: function() @@ -992,9 +998,14 @@ WebInspector.ScriptsPanel.prototype = { this.toggleBreakpointsButton.title = WebInspector.UIString("Activate all breakpoints."); document.getElementById("main-panels").addStyleClass("breakpoints-deactivated"); } + }, + + elementsToRestoreScrollPositionsFor: function() + { + return [ this.sidebarElement ]; } } WebInspector.ScriptsPanel.prototype.__proto__ = WebInspector.Panel.prototype; -WebInspector.didEditScriptLine = WebInspector.Callback.processCallback; +WebInspector.didEditScriptSource = WebInspector.Callback.processCallback; diff --git a/WebCore/inspector/front-end/SourceFrame.js b/WebCore/inspector/front-end/SourceFrame.js index 99280fc..2dec650 100644 --- a/WebCore/inspector/front-end/SourceFrame.js +++ b/WebCore/inspector/front-end/SourceFrame.js @@ -39,7 +39,6 @@ WebInspector.SourceFrame = function(parentElement, addBreakpointDelegate, remove this._rowMessages = {}; this._messageBubbles = {}; this.breakpoints = []; - this._shortcuts = {}; this._loaded = false; @@ -55,9 +54,12 @@ WebInspector.SourceFrame.prototype = { { this._visible = visible; this._createViewerIfNeeded(); - if (!visible && this._textViewer) - this._textViewer.freeCachedElements(); - + + if (!visible) { + this._hidePopup(); + if (this._textViewer) + this._textViewer.freeCachedElements(); + } }, get executionLine() @@ -149,6 +151,11 @@ WebInspector.SourceFrame.prototype = { this._textModel.setText(null, content); }, + get textModel() + { + return this._textModel; + }, + highlightLine: function(line) { if (this._textViewer) @@ -164,7 +171,6 @@ WebInspector.SourceFrame.prototype = { this._textViewer = new WebInspector.TextViewer(this._textModel, WebInspector.platform, this._url); var element = this._textViewer.element; - element.addEventListener("keydown", this._keyDown.bind(this), true); element.addEventListener("contextmenu", this._contextMenu.bind(this), true); element.addEventListener("mousedown", this._mouseDown.bind(this), true); element.addEventListener("mousemove", this._mouseMove.bind(this), true); @@ -669,17 +675,6 @@ WebInspector.SourceFrame.prototype = { return conditionElement; }, - _keyDown: function(event) - { - var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event); - var handler = this._shortcuts[shortcut]; - if (handler) { - handler(event); - event.preventDefault(); - } else - WebInspector.documentKeyDown(event); - }, - _evalSelectionInCallFrame: function(event) { if (!WebInspector.panels.scripts || !WebInspector.panels.scripts.paused) @@ -689,7 +684,7 @@ WebInspector.SourceFrame.prototype = { if (!selection.rangeCount) return; - var expression = selection.getRangeAt(0).toString().trimWhitespace(); + var expression = selection.getRangeAt(0).toString().trim(); WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression, false, "console", function(result, exception) { WebInspector.showConsole(); var commandMessage = new WebInspector.ConsoleCommand(expression); diff --git a/WebCore/inspector/front-end/SourceView.js b/WebCore/inspector/front-end/SourceView.js index 9fbd161..3621187 100644 --- a/WebCore/inspector/front-end/SourceView.js +++ b/WebCore/inspector/front-end/SourceView.js @@ -32,7 +32,8 @@ WebInspector.SourceView = function(resource) this.element.addStyleClass("source"); - this.sourceFrame = new WebInspector.SourceFrame(this.contentElement, this._addBreakpoint.bind(this), this._removeBreakpoint.bind(this)); + var canEditScripts = WebInspector.panels.scripts.canEditScripts() && resource.type === WebInspector.Resource.Type.Script; + this.sourceFrame = new WebInspector.SourceFrame(this.contentElement, this._addBreakpoint.bind(this), this._removeBreakpoint.bind(this), canEditScripts ? this._editLine.bind(this) : null); resource.addEventListener("finished", this._resourceLoadingFinished, this); this._frameNeedsSetup = true; } @@ -77,6 +78,11 @@ WebInspector.SourceView.prototype = { WebInspector.getResourceContent(this.resource.identifier, this._contentLoaded.bind(this)); }, + hasContentTab: function() + { + return true; + }, + contentTabSelected: function() { this.setupSourceFrameIfNeeded(); @@ -105,17 +111,7 @@ WebInspector.SourceView.prototype = { _addBreakpoint: function(line) { - var sourceID = null; - var closestStartingLine = 0; - var scripts = this.resource.scripts; - for (var i = 0; i < scripts.length; ++i) { - var script = scripts[i]; - if (script.startingLine <= line && script.startingLine >= closestStartingLine) { - closestStartingLine = script.startingLine; - sourceID = script.sourceID; - } - } - + var sourceID = this._sourceIDForLine(line); if (WebInspector.panels.scripts) { var breakpoint = new WebInspector.Breakpoint(this.resource.url, line, sourceID); WebInspector.panels.scripts.addBreakpoint(breakpoint); @@ -128,6 +124,41 @@ WebInspector.SourceView.prototype = { WebInspector.panels.scripts.removeBreakpoint(breakpoint); }, + _editLine: function(line, newContent) + { + var lines = []; + var textModel = this.sourceFrame.textModel; + for (var i = 0; i < textModel.linesCount; ++i) { + if (i === line) + lines.push(newContent); + else + lines.push(textModel.line(i)); + } + + var linesCountToShift = newContent.split("\n").length - 1; + WebInspector.panels.scripts.editScriptSource(this._sourceIDForLine(line), lines.join("\n"), line, linesCountToShift, this._editLineComplete.bind(this)); + }, + + _editLineComplete: function(newBody) + { + this.sourceFrame.updateContent(newBody); + }, + + _sourceIDForLine: function(line) + { + var sourceID = null; + var closestStartingLine = 0; + var scripts = this.resource.scripts; + for (var i = 0; i < scripts.length; ++i) { + var script = scripts[i]; + if (script.startingLine <= line && script.startingLine >= closestStartingLine) { + closestStartingLine = script.startingLine; + sourceID = script.sourceID; + } + } + return sourceID; + }, + // The rest of the methods in this prototype need to be generic enough to work with a ScriptView. // The ScriptView prototype pulls these methods into it's prototype to avoid duplicate code. diff --git a/WebCore/inspector/front-end/StylesSidebarPane.js b/WebCore/inspector/front-end/StylesSidebarPane.js index eb5e012..c280fbb 100644 --- a/WebCore/inspector/front-end/StylesSidebarPane.js +++ b/WebCore/inspector/front-end/StylesSidebarPane.js @@ -409,10 +409,7 @@ WebInspector.StylesSidebarPane.prototype = { var separatorElement = document.createElement("div"); separatorElement.className = "styles-sidebar-separator"; if (styleRule.node) { - var link = document.createElement("a"); - link.href = ""; - link.addEventListener("mousedown", this._selectNode.bind(this, styleRule.node.id), false); - WebInspector.panels.elements.decorateNodeLabel(styleRule.node, link); + var link = WebInspector.panels.elements.linkifyNodeReference(styleRule.node); separatorElement.appendChild(document.createTextNode(WebInspector.UIString("Inherited from") + " ")); separatorElement.appendChild(link); } else if ("pseudoId" in styleRule) { @@ -454,12 +451,6 @@ WebInspector.StylesSidebarPane.prototype = { return sections; }, - _selectNode: function(nodeId, e) - { - WebInspector.updateFocusedNode(nodeId); - e.preventDefault(); - }, - _containsInherited: function(payload) { var properties = []; @@ -1289,7 +1280,7 @@ WebInspector.StylePropertyTreeElement.prototype = { if (WebInspector.isBeingEdited(this.listItemElement) || (this.treeOutline.section && !this.treeOutline.section.editable)) return; - var context = { expanded: this.expanded, hasChildren: this.hasChildren }; + var context = { expanded: this.expanded, hasChildren: this.hasChildren, keyDownListener: this.editingKeyDown.bind(this) }; // Lie about our children to prevent expanding on double click and to collapse shorthands. this.hasChildren = false; @@ -1297,7 +1288,7 @@ WebInspector.StylePropertyTreeElement.prototype = { if (!selectElement) selectElement = this.listItemElement; - this.listItemElement.handleKeyEvent = this.editingKeyDown.bind(this); + this.listItemElement.addEventListener("keydown", context.keyDownListener, false); WebInspector.startEditing(this.listItemElement, this.editingCommitted.bind(this), this.editingCancelled.bind(this), context); window.getSelection().setBaseAndExtent(selectElement, 0, selectElement, 1); @@ -1378,7 +1369,7 @@ WebInspector.StylePropertyTreeElement.prototype = { selection.removeAllRanges(); selection.addRange(finalSelectionRange); - event.handled = true; + event.preventDefault(); if (!this.originalCSSText) { // Remember the rule's original CSS text, so it can be restored @@ -1398,7 +1389,7 @@ WebInspector.StylePropertyTreeElement.prototype = { this.hasChildren = context.hasChildren; if (context.expanded) this.expand(); - delete this.listItemElement.handleKeyEvent; + this.listItemElement.removeEventListener("keydown", context.keyDownListener, false); delete this.originalCSSText; }, diff --git a/WebCore/inspector/front-end/SummaryBar.js b/WebCore/inspector/front-end/SummaryBar.js index 1c31449..4bd5c65 100644 --- a/WebCore/inspector/front-end/SummaryBar.js +++ b/WebCore/inspector/front-end/SummaryBar.js @@ -230,13 +230,13 @@ WebInspector.SummaryBar.prototype = { ctx.beginPath(); ctx.moveTo(x, y + r); ctx.lineTo(x, y + h - r); - ctx.quadraticCurveTo(x, y + h, x + r, y + h); + ctx.arc(x + r, y + h - r, r, Math.PI, Math.PI / 2, true); ctx.lineTo(x + w - r, y + h); - ctx.quadraticCurveTo(x + w, y + h, x + w, y + h - r); + ctx.arc(x + w - r, y + h - r, r, Math.PI / 2, 0, true); ctx.lineTo(x + w, y + r); - ctx.quadraticCurveTo(x + w, y, x + w - r, y); + ctx.arc(x + w - r, y + r, r, 0, 3 * Math.PI / 2, true); ctx.lineTo(x + r, y); - ctx.quadraticCurveTo(x, y, x, y + r); + ctx.arc(x + r, y + r, r, Math.PI / 2, Math.PI, true); ctx.closePath(); // Clip to the rounded rect path. diff --git a/WebCore/inspector/front-end/TextPrompt.js b/WebCore/inspector/front-end/TextPrompt.js index d179a9a..7fcce8c 100644 --- a/WebCore/inspector/front-end/TextPrompt.js +++ b/WebCore/inspector/front-end/TextPrompt.js @@ -29,6 +29,7 @@ WebInspector.TextPrompt = function(element, completions, stopCharacters) { this.element = element; + this.element.addStyleClass("text-prompt"); this.completions = completions; this.completionStopCharacters = stopCharacters; this.history = []; diff --git a/WebCore/inspector/front-end/TextViewer.js b/WebCore/inspector/front-end/TextViewer.js index de04641..eae7394 100644 --- a/WebCore/inspector/front-end/TextViewer.js +++ b/WebCore/inspector/front-end/TextViewer.js @@ -251,9 +251,14 @@ WebInspector.TextViewer.prototype = { if (!this._editCallback) return; - var lineRow = e.target.enclosingNodeOrSelfWithNodeName("TR"); - if (!lineRow) + var cell = e.target.enclosingNodeOrSelfWithNodeName("TD"); + if (!cell) return; + + var lineRow = cell.parentElement; + if (lineRow.firstChild === cell) + return; // Do not trigger editing from line numbers. + var oldContent = lineRow.lastChild.innerHTML; this._editingLine = WebInspector.startEditing(lineRow.lastChild, this._commitEditingLine.bind(this, lineRow.lineNumber, lineRow.lastChild), this._cancelEditingLine.bind(this, lineRow.lastChild, oldContent), null, true); }, diff --git a/WebCore/inspector/front-end/TimelineGrid.js b/WebCore/inspector/front-end/TimelineGrid.js index fb93b8f..3286e65 100644 --- a/WebCore/inspector/front-end/TimelineGrid.js +++ b/WebCore/inspector/front-end/TimelineGrid.js @@ -66,7 +66,6 @@ WebInspector.TimelineGrid.prototype = { paddingLeft = 0; this._currentDividerSlice = slice; - this._eventDividersElement.removeChildren(); // Reuse divider elements and labels. var divider = this._dividersElement.firstChild; var dividerLabelBar = this._dividersLabelBarElement.firstChild; @@ -135,6 +134,15 @@ WebInspector.TimelineGrid.prototype = { this._eventDividersElement.appendChild(divider); }, + addEventDividers: function(dividers) + { + this.element.removeChild(this._eventDividersElement); + for (var i = 0; i < dividers.length; ++i) + if (dividers[i]) + this._eventDividersElement.appendChild(dividers[i]); + this.element.appendChild(this._eventDividersElement); + }, + removeEventDividers: function() { this._eventDividersElement.removeChildren(); diff --git a/WebCore/inspector/front-end/TimelineOverviewPane.js b/WebCore/inspector/front-end/TimelineOverviewPane.js index 7191ef8..aaf2adb 100644 --- a/WebCore/inspector/front-end/TimelineOverviewPane.js +++ b/WebCore/inspector/front-end/TimelineOverviewPane.js @@ -54,6 +54,7 @@ WebInspector.TimelineOverviewPane = function(categories) this._overviewGrid = new WebInspector.TimelineGrid(); this._overviewGrid.element.id = "timeline-overview-grid"; this._overviewGrid.itemsGraphsElement.id = "timeline-overview-graphs"; + this._overviewGrid.element.addEventListener("mousedown", this._dragWindow.bind(this), true); this.element.appendChild(this._overviewGrid.element); this._categoryGraphs = {}; @@ -67,20 +68,25 @@ WebInspector.TimelineOverviewPane = function(categories) this._overviewWindowElement = document.createElement("div"); this._overviewWindowElement.id = "timeline-overview-window"; - this._overviewWindowElement.addEventListener("mousedown", this._dragWindow.bind(this), false); this._overviewGrid.element.appendChild(this._overviewWindowElement); + this._overviewWindowBordersElement = document.createElement("div"); + this._overviewWindowBordersElement.className = "timeline-overview-window-rulers"; + this._overviewGrid.element.appendChild(this._overviewWindowBordersElement); + + var overviewDividersBackground = document.createElement("div"); + overviewDividersBackground.className = "timeline-overview-dividers-background"; + this._overviewGrid.element.appendChild(overviewDividersBackground); + this._leftResizeElement = document.createElement("div"); this._leftResizeElement.className = "timeline-window-resizer"; this._leftResizeElement.style.left = 0; this._overviewGrid.element.appendChild(this._leftResizeElement); - this._leftResizeElement.addEventListener("mousedown", this._resizeWindow.bind(this, this._leftResizeElement), false); this._rightResizeElement = document.createElement("div"); this._rightResizeElement.className = "timeline-window-resizer timeline-window-resizer-right"; this._rightResizeElement.style.right = 0; this._overviewGrid.element.appendChild(this._rightResizeElement); - this._rightResizeElement.addEventListener("mousedown", this._resizeWindow.bind(this, this._rightResizeElement), false); this._overviewCalculator = new WebInspector.TimelineOverviewCalculator(); @@ -92,6 +98,8 @@ WebInspector.TimelineOverviewPane = function(categories) this.windowRight = 1.0; } +WebInspector.TimelineOverviewPane.minSelectableSize = 12; + WebInspector.TimelineOverviewPane.prototype = { _onCheckboxClicked: function (category, event) { if (event.target.checked) @@ -166,13 +174,18 @@ WebInspector.TimelineOverviewPane.prototype = { updateEventDividers: function(records, dividerConstructor) { this._overviewGrid.removeEventDividers(); + var dividers = []; for (var i = 0; i < records.length; ++i) { var record = records[i]; var positions = this._overviewCalculator.computeBarGraphPercentages(record); + var dividerPosition = Math.round(positions.start * 10); + if (dividers[dividerPosition]) + continue; var divider = dividerConstructor(record); divider.style.left = positions.start + "%"; - this._overviewGrid.addEventDivider(divider); + dividers[dividerPosition] = divider; } + this._overviewGrid.addEventDividers(dividers); }, setSidebarWidth: function(width) @@ -191,6 +204,8 @@ WebInspector.TimelineOverviewPane.prototype = { this.windowRight = 1.0; this._overviewWindowElement.style.left = "0%"; this._overviewWindowElement.style.width = "100%"; + this._overviewWindowBordersElement.style.left = "0%"; + this._overviewWindowBordersElement.style.right = "0%"; this._leftResizeElement.style.left = "0%"; this._rightResizeElement.style.left = "100%"; this._overviewCalculator.reset(); @@ -213,8 +228,42 @@ WebInspector.TimelineOverviewPane.prototype = { _dragWindow: function(event) { - WebInspector.elementDragStart(this._overviewWindowElement, this._windowDragging.bind(this, event.pageX, - this._leftResizeElement.offsetLeft, this._rightResizeElement.offsetLeft), this._endWindowDragging.bind(this), event, "ew-resize"); + var node = event.target; + while (node) { + if (node === this._overviewGrid._dividersLabelBarElement) { + WebInspector.elementDragStart(this._overviewWindowElement, this._windowDragging.bind(this, event.pageX, + this._leftResizeElement.offsetLeft, this._rightResizeElement.offsetLeft), this._endWindowDragging.bind(this), event, "ew-resize"); + break; + } else if (node === this._overviewGrid.element) { + var position = event.pageX - this._overviewGrid.element.offsetLeft; + this._overviewWindowSelector = new WebInspector.TimelinePanel.WindowSelector(this._overviewGrid.element, position, event); + WebInspector.elementDragStart(null, this._windowSelectorDragging.bind(this), this._endWindowSelectorDragging.bind(this), event, "col-resize"); + break; + } else if (node === this._leftResizeElement || node === this._rightResizeElement) { + this._resizeWindow(node, event); + break; + } + node = node.parentNode; + } + }, + + _windowSelectorDragging: function(event) + { + this._overviewWindowSelector._updatePosition(event.pageX - this._overviewGrid.element.offsetLeft); + event.preventDefault(); + }, + + _endWindowSelectorDragging: function(event) + { + WebInspector.elementDragEnd(event); + var window = this._overviewWindowSelector._close(event.pageX - this._overviewGrid.element.offsetLeft); + delete this._overviewWindowSelector; + if (window.end - window.start < WebInspector.TimelineOverviewPane.minSelectableSize) + if (this._overviewGrid.itemsGraphsElement.offsetWidth - window.end > WebInspector.TimelineOverviewPane.minSelectableSize) + window.end = window.start + WebInspector.TimelineOverviewPane.minSelectableSize; + else + window.start = window.end - WebInspector.TimelineOverviewPane.minSelectableSize; + this._setWindowPosition(window.start, window.end); }, _windowDragging: function(startX, windowLeft, windowRight, event) @@ -243,6 +292,8 @@ WebInspector.TimelineOverviewPane.prototype = { // Glue to edge. if (start < 10) start = 0; + else if (start > this._rightResizeElement.offsetLeft - 4) + start = this._rightResizeElement.offsetLeft - 4; this._setWindowPosition(start, null); }, @@ -251,27 +302,26 @@ WebInspector.TimelineOverviewPane.prototype = { // Glue to edge. if (end > this._overviewGrid.element.clientWidth - 10) end = this._overviewGrid.element.clientWidth; + else if (end < this._leftResizeElement.offsetLeft + WebInspector.TimelineOverviewPane.minSelectableSize) + end = this._leftResizeElement.offsetLeft + WebInspector.TimelineOverviewPane.minSelectableSize; this._setWindowPosition(null, end); }, _setWindowPosition: function(start, end) { + const rulerAdjustment = 1 / this._overviewGrid.element.clientWidth; if (typeof start === "number") { - if (start > this._rightResizeElement.offsetLeft - 4) - start = this._rightResizeElement.offsetLeft - 4; - this.windowLeft = start / this._overviewGrid.element.clientWidth; this._leftResizeElement.style.left = this.windowLeft * 100 + "%"; this._overviewWindowElement.style.left = this.windowLeft * 100 + "%"; + this._overviewWindowBordersElement.style.left = (this.windowLeft - rulerAdjustment) * 100 + "%"; } if (typeof end === "number") { - if (end < this._leftResizeElement.offsetLeft + 12) - end = this._leftResizeElement.offsetLeft + 12; - this.windowRight = end / this._overviewGrid.element.clientWidth; this._rightResizeElement.style.left = this.windowRight * 100 + "%"; } this._overviewWindowElement.style.width = (this.windowRight - this.windowLeft) * 100 + "%"; + this._overviewWindowBordersElement.style.right = (1 - this.windowRight + 2 * rulerAdjustment) * 100 + "%"; this.dispatchEventToListeners("window changed"); }, @@ -403,3 +453,48 @@ WebInspector.TimelineCategoryGraph.prototype = { this._barAreaElement.addStyleClass("timeline-category-" + this._category.name); } } + +WebInspector.TimelinePanel.WindowSelector = function(parent, position, event) +{ + this._startPosition = position; + this._width = parent.offsetWidth; + this._windowSelector = document.createElement("div"); + this._windowSelector.className = "timeline-window-selector"; + this._windowSelector.style.left = this._startPosition + "px"; + this._windowSelector.style.right = this._width - this._startPosition + + "px"; + parent.appendChild(this._windowSelector); +} + +WebInspector.TimelinePanel.WindowSelector.prototype = { + _createSelectorElement: function(parent, left, width, height) + { + var selectorElement = document.createElement("div"); + selectorElement.className = "timeline-window-selector"; + selectorElement.style.left = left + "px"; + selectorElement.style.width = width + "px"; + selectorElement.style.top = "0px"; + selectorElement.style.height = height + "px"; + parent.appendChild(selectorElement); + return selectorElement; + }, + + _close: function(position) + { + position = Math.max(0, Math.min(position, this._width)); + this._windowSelector.parentNode.removeChild(this._windowSelector); + return this._startPosition < position ? {start: this._startPosition, end: position} : {start: position, end: this._startPosition}; + }, + + _updatePosition: function(position) + { + position = Math.max(0, Math.min(position, this._width)); + if (position < this._startPosition) { + this._windowSelector.style.left = position + "px"; + this._windowSelector.style.right = this._width - this._startPosition + "px"; + } else { + this._windowSelector.style.left = this._startPosition + "px"; + this._windowSelector.style.right = this._width - position + "px"; + } + } +} + diff --git a/WebCore/inspector/front-end/TimelinePanel.js b/WebCore/inspector/front-end/TimelinePanel.js index 7b3e3b0..4ff9d5a 100644 --- a/WebCore/inspector/front-end/TimelinePanel.js +++ b/WebCore/inspector/front-end/TimelinePanel.js @@ -185,17 +185,18 @@ WebInspector.TimelinePanel.prototype = { { this._timelineGrid.removeEventDividers(); var clientWidth = this._graphRowsElement.offsetWidth - this._expandOffset; + var dividers = []; for (var i = 0; i < this._markTimelineRecords.length; ++i) { var record = this._markTimelineRecords[i]; var positions = this._calculator.computeBarGraphWindowPosition(record, clientWidth); - if (positions.left < 0 || positions.left >= clientWidth) + var dividerPosition = Math.round(positions.left); + if (dividerPosition < 0 || dividerPosition >= clientWidth || dividers[dividerPosition]) continue; - var divider = this._createEventDivider(record); - divider.style.left = (positions.left + this._expandOffset) + "px"; - - this._timelineGrid.addEventDivider(divider); + divider.style.left = (dividerPosition + this._expandOffset) + "px"; + dividers[dividerPosition] = divider; } + this._timelineGrid.addEventDividers(dividers); this._overviewPane.updateEventDividers(this._markTimelineRecords, this._createEventDivider.bind(this)); }, @@ -280,38 +281,56 @@ WebInspector.TimelinePanel.prototype = { _innerAddRecordToTimeline: function(record, parentRecord) { var connectedToOldRecord = false; - if (parentRecord === this._rootRecord) { + var recordTypes = WebInspector.TimelineAgent.RecordType; + if (record.type === recordTypes.MarkDOMContentEventType || record.type === recordTypes.MarkLoadEventType) + parentRecord = null; // No bar entry for load events. + else if (parentRecord === this._rootRecord) { var newParentRecord = this._findParentRecord(record); if (newParentRecord) { parentRecord = newParentRecord; connectedToOldRecord = true; } } - var recordTypes = WebInspector.TimelineAgent.RecordType; + + if (record.type == recordTypes.TimerFire && record.children && record.children.length === 1) { + var childRecord = record.children[0]; + if ( childRecord.type === recordTypes.FunctionCall) { + record.data.scriptName = childRecord.data.scriptName; + record.data.scriptLine = childRecord.data.scriptLine; + record.children = childRecord.children; + } + } var formattedRecord = new WebInspector.TimelinePanel.FormattedRecord(record, parentRecord, this._recordStyles, this._sendRequestRecords, this._timerRecords); if (record.type === recordTypes.MarkDOMContentEventType || record.type === recordTypes.MarkLoadEventType) { - // No bar entry for load events. this._markTimelineRecords.push(formattedRecord); return; } ++this._rootRecord._allRecordsCount; + formattedRecord.collapsed = (parentRecord === this._rootRecord); - if (parentRecord === this._rootRecord) - formattedRecord.collapsed = true; - - for (var i = 0; record.children && i < record.children.length; ++i) + var childrenCount = record.children ? record.children.length : 0; + for (var i = 0; i < childrenCount; ++i) this._innerAddRecordToTimeline(record.children[i], formattedRecord); + formattedRecord._calculateAggregatedStats(this.categories); + if (connectedToOldRecord) { var record = formattedRecord; - while (record.parent && record.parent._lastChildEndTime < record._lastChildEndTime) { - record.parent._lastChildEndTime = record._lastChildEndTime; - record = record.parent; - } - } + do { + var parent = record.parent; + parent._cpuTime += formattedRecord._cpuTime; + if (parent._lastChildEndTime < record._lastChildEndTime) + parent._lastChildEndTime = record._lastChildEndTime; + for (var category in formattedRecord._aggregatedStats) + parent._aggregatedStats[category] += formattedRecord._aggregatedStats[category]; + record = parent; + } while (record.parent); + } else + if (parentRecord !== this._rootRecord) + parentRecord._selfTime -= formattedRecord.endTime - formattedRecord.startTime; // Keep bar entry for mark timeline since nesting might be interesting to the user. if (record.type === recordTypes.MarkTimeline) @@ -344,6 +363,7 @@ WebInspector.TimelinePanel.prototype = { rootRecord.children = []; rootRecord._visibleRecordsCount = 0; rootRecord._allRecordsCount = 0; + rootRecord._aggregatedStats = {}; return rootRecord; }, @@ -365,8 +385,7 @@ WebInspector.TimelinePanel.prototype = { WebInspector.Panel.prototype.show.call(this); if (typeof this._scrollTop === "number") this._containerElement.scrollTop = this._scrollTop; - else if (this._needsRefresh) - this._refresh(); + this._refresh(); }, hide: function() @@ -394,22 +413,20 @@ WebInspector.TimelinePanel.prototype = { { this._closeRecordDetails(); this._boundariesAreValid &= preserveBoundaries; - if (this._needsRefresh) + + if (!this.visible) return; - this._needsRefresh = true; - if (this.visible && !("_refreshTimeout" in this)) { - if (preserveBoundaries) - this._refresh(); - else + if (preserveBoundaries) + this._refresh(); + else + if (!this._refreshTimeout) this._refreshTimeout = setTimeout(this._refresh.bind(this), 100); - } }, _refresh: function() { - this._needsRefresh = false; - if ("_refreshTimeout" in this) { + if (this._refreshTimeout) { clearTimeout(this._refreshTimeout); delete this._refreshTimeout; } @@ -417,7 +434,8 @@ WebInspector.TimelinePanel.prototype = { this._overviewPane.update(this._rootRecord.children, this._calculator._showShortEvents); this._refreshRecords(!this._boundariesAreValid); this._updateRecordsCounter(); - this._updateEventDividers(); + if(!this._boundariesAreValid) + this._updateEventDividers(); this._boundariesAreValid = true; }, @@ -550,7 +568,7 @@ WebInspector.TimelinePanel.prototype = { _showPopover: function(anchor) { var record = anchor.row._record; - var popover = new WebInspector.Popover(record._generatePopupContent(this._calculator)); + var popover = new WebInspector.Popover(record._generatePopupContent(this._calculator, this.categories)); popover.show(anchor); return popover; }, @@ -582,9 +600,10 @@ WebInspector.TimelineCalculator.prototype = { computeBarGraphPercentages: function(record) { var start = (record.startTime - this.minimumBoundary) / this.boundarySpan * 100; - var end = (record.endTime - this.minimumBoundary) / this.boundarySpan * 100; + var end = (record.startTime + record._selfTime - this.minimumBoundary) / this.boundarySpan * 100; var endWithChildren = (record._lastChildEndTime - this.minimumBoundary) / this.boundarySpan * 100; - return {start: start, end: end, endWithChildren: endWithChildren}; + var cpuWidth = record._cpuTime / this.boundarySpan * 100; + return {start: start, end: end, endWithChildren: endWithChildren, cpuWidth: cpuWidth}; }, computeBarGraphWindowPosition: function(record, clientWidth) @@ -596,9 +615,10 @@ WebInspector.TimelineCalculator.prototype = { var left = percentages.start / 100 * workingArea; var width = (percentages.end - percentages.start) / 100 * workingArea + minWidth; var widthWithChildren = (percentages.endWithChildren - percentages.start) / 100 * workingArea; + var cpuWidth = percentages.cpuWidth / 100 * workingArea + minWidth; if (percentages.endWithChildren > percentages.end) widthWithChildren += borderWidth + minWidth; - return {left: left, width: width, widthWithChildren: widthWithChildren}; + return {left: left, width: width, widthWithChildren: widthWithChildren, cpuWidth: cpuWidth}; }, calculateWindow: function() @@ -654,12 +674,8 @@ WebInspector.TimelineRecordListRow = function() this._dataElement = document.createElement("span"); this._dataElement.className = "data dimmed"; - this._repeatCountElement = document.createElement("span"); - this._repeatCountElement.className = "count"; - this.element.appendChild(separatorElement); this.element.appendChild(this._dataElement); - this.element.appendChild(this._repeatCountElement); } WebInspector.TimelineRecordListRow.prototype = { @@ -672,15 +688,18 @@ WebInspector.TimelineRecordListRow.prototype = { this.element.className = "timeline-tree-item timeline-category-" + record.category.name + (isEven ? " even" : ""); this._typeElement.textContent = record.title; - if (record.details) - this._dataElement.textContent = "(" + record.details + ")"; - else - this._dataElement.textContent = ""; - - if (record.count > 1) - this._repeatCountElement.textContent = "\u2009\u00d7\u2009" + record.count; - else - this._repeatCountElement.textContent = ""; + if (this._dataElement.firstChild) + this._dataElement.removeChildren(); + if (record.details) { + var detailsContainer = document.createElement("span"); + if (typeof record.details === "object") { + detailsContainer.appendChild(document.createTextNode("(")); + detailsContainer.appendChild(record.details); + detailsContainer.appendChild(document.createTextNode(")")); + } else + detailsContainer.textContent = "(" + record.details + ")"; + this._dataElement.appendChild(detailsContainer); + } }, dispose: function() @@ -703,6 +722,11 @@ WebInspector.TimelineRecordGraphRow = function(graphContainer, scheduleRefresh, this._barWithChildrenElement.row = this; this._barAreaElement.appendChild(this._barWithChildrenElement); + this._barCpuElement = document.createElement("div"); + this._barCpuElement.className = "timeline-graph-bar cpu" + this._barCpuElement.row = this; + this._barAreaElement.appendChild(this._barCpuElement); + this._barElement = document.createElement("div"); this._barElement.className = "timeline-graph-bar"; this._barElement.row = this; @@ -732,6 +756,8 @@ WebInspector.TimelineRecordGraphRow.prototype = { this._barWithChildrenElement.style.width = barPosition.widthWithChildren + "px"; this._barElement.style.left = barPosition.left + expandOffset + "px"; this._barElement.style.width = barPosition.width + "px"; + this._barCpuElement.style.left = barPosition.left + expandOffset + "px"; + this._barCpuElement.style.width = barPosition.cpuWidth + "px"; if (record._visibleChildrenCount || record._invisibleChildrenCount) { this._expandElement.style.top = index * this._rowHeight + "px"; @@ -771,14 +797,15 @@ WebInspector.TimelinePanel.FormattedRecord = function(record, parentRecord, reco var style = recordStyles[record.type]; this.parent = parentRecord; - parentRecord.children.push(this); + if (parentRecord) + parentRecord.children.push(this); this.category = style.category; this.title = style.title; this.startTime = record.startTime / 1000; this.data = record.data; - this.count = 1; this.type = record.type; this.endTime = (typeof record.endTime !== "undefined") ? record.endTime / 1000 : this.startTime; + this._selfTime = this.endTime - this.startTime; this._lastChildEndTime = this.endTime; this.originalRecordForTests = record; this.callerScriptName = record.callerScriptName; @@ -826,18 +853,6 @@ WebInspector.TimelinePanel.FormattedRecord.prototype = { return (this._lastChildEndTime - this.startTime) > WebInspector.TimelinePanel.shortRecordThreshold; }, - _createCell: function(content, styleName) - { - var text = document.createElement("label"); - text.appendChild(document.createTextNode(content)); - var cell = document.createElement("td"); - cell.className = "timeline-details"; - if (styleName) - cell.className += " " + styleName; - cell.textContent = content; - return cell; - }, - get children() { if (!this._children) @@ -845,88 +860,90 @@ WebInspector.TimelinePanel.FormattedRecord.prototype = { return this._children; }, - _createRow: function(title, content) + _generateAggregatedInfo: function() { - var row = document.createElement("tr"); - row.appendChild(this._createCell(title, "timeline-details-row-title")); - row.appendChild(this._createCell(content, "timeline-details-row-data")); - return row; + var cell = document.createElement("span"); + cell.className = "timeline-aggregated-info"; + for (var index in this._aggregatedStats) { + var label = document.createElement("div"); + label.className = "timeline-aggregated-category timeline-" + index; + cell.appendChild(label); + var text = document.createElement("span"); + text.textContent = Number.secondsToString(this._aggregatedStats[index] + 0.0001); + cell.appendChild(text); + } + return cell; }, - _createLinkRow: function(title, content) + _generatePopupContent: function(calculator, categories) { - var row = document.createElement("tr"); - row.appendChild(this._createCell(title, "timeline-details-row-title")); - var cell = document.createElement("td"); - cell.appendChild(content); - row.appendChild(cell); - return row; - }, + var contentHelper = new WebInspector.TimelinePanel.PopupContentHelper(this.title); - _generatePopupContent: function(calculator) - { - var recordContentTable = document.createElement("table"); - var titleCell = this._createCell(WebInspector.UIString("%s - Details", this.title), "timeline-details-title"); - titleCell.colSpan = 2; - var titleRow = document.createElement("tr"); - titleRow.appendChild(titleCell); - recordContentTable.appendChild(titleRow); - var text = Number.secondsToString(this.endTime - this.startTime) + " (@" + - calculator.formatValue(this.startTime - calculator.minimumBoundary) + ")"; - recordContentTable.appendChild(this._createRow(WebInspector.UIString("Duration"), text)); + if (this._children && this._children.length) { + contentHelper._appendTextRow("Self Time", Number.secondsToString(this._selfTime + 0.0001)); + contentHelper._appendElementRow("Aggregated Time", this._generateAggregatedInfo()); + } + var text = Number.secondsToString(this._lastChildEndTime - this.startTime) + " (@" + + calculator.formatValue(this.startTime - calculator.minimumBoundary) + ")"; + contentHelper._appendTextRow("Duration", text); const recordTypes = WebInspector.TimelineAgent.RecordType; - if (this.details) { - if (this.type === recordTypes.GCEvent ) - recordContentTable.appendChild(this._createRow(WebInspector.UIString("Collected"), Number.bytesToString(this.data.usedHeapSizeDelta))); - else if (this.type === recordTypes.TimerInstall || - this.type === recordTypes.TimerFire || - this.type === recordTypes.TimerRemove) { - recordContentTable.appendChild(this._createRow(WebInspector.UIString("Timer Id"), this.data.timerId)); + + switch (this.type) { + case recordTypes.GCEvent: + contentHelper._appendTextRow("Collected", Number.bytesToString(this.data.usedHeapSizeDelta)); + break; + case recordTypes.TimerInstall: + case recordTypes.TimerFire: + case recordTypes.TimerRemove: + contentHelper._appendTextRow("Timer Id", this.data.timerId); if (typeof this.timeout === "number") { - recordContentTable.appendChild(this._createRow(WebInspector.UIString("Timeout"), this.timeout)); - recordContentTable.appendChild(this._createRow(WebInspector.UIString("Repeats"), !this.singleShot)); + contentHelper._appendTextRow("Timeout", this.timeout); + contentHelper._appendTextRow("Repeats", !this.singleShot); } - if (typeof this.callSiteScriptLine === "number") { - var link = WebInspector.linkifyResourceAsNode(this.callSiteScriptName, "scripts", this.callSiteScriptLine, "timeline-details"); - recordContentTable.appendChild(this._createLinkRow(WebInspector.UIString("Call Site"), link)); - } - } else if (this.type === recordTypes.FunctionCall) { - var link = WebInspector.linkifyResourceAsNode(this.data.scriptName, "scripts", this.data.scriptLine, "timeline-details"); - recordContentTable.appendChild(this._createLinkRow(WebInspector.UIString("Location"), link)); - } else if (this.type === recordTypes.ResourceSendRequest || - this.type === recordTypes.ResourceReceiveResponse || - this.type === recordTypes.ResourceReceiveData || - this.type === recordTypes.ResourceFinish) { - var link = WebInspector.linkifyResourceAsNode(this.data.url, "resources", null, "timeline-details"); - recordContentTable.appendChild(this._createLinkRow(WebInspector.UIString("Resource"), link)); + if (typeof this.callSiteScriptLine === "number") + contentHelper._appendLinkRow("Call Site", this.callSiteScriptName, this.callSiteScriptLine); + break; + case recordTypes.FunctionCall: + contentHelper._appendLinkRow("Location", this.data.scriptName, this.data.scriptLine); + break; + case recordTypes.ResourceSendRequest: + case recordTypes.ResourceReceiveResponse: + case recordTypes.ResourceReceiveData: + case recordTypes.ResourceFinish: + contentHelper._appendLinkRow("Resource", this.data.url); if (this.data.requestMethod) - recordContentTable.appendChild(this._createRow(WebInspector.UIString("Request Method"), this.data.requestMethod)); + contentHelper._appendTextRow("Request Method", this.data.requestMethod); if (typeof this.data.statusCode === "number") - recordContentTable.appendChild(this._createRow(WebInspector.UIString("Status Code"), this.data.statusCode)); + contentHelper._appendTextRow("Status Code", this.data.statusCode); if (this.data.mimeType) - recordContentTable.appendChild(this._createRow(WebInspector.UIString("Mime Type"), this.data.mimeType)); + contentHelper._appendTextRow("Mime Type", this.data.mimeType); if (typeof this.data.expectedContentLength === "number" && this.data.expectedContentLength !== -1) - recordContentTable.appendChild(this._createRow(WebInspector.UIString("Expected Content Length"), this.data.expectedContentLength)); - } else if (this.type === recordTypes.EvaluateScript) { - var link = WebInspector.linkifyResourceAsNode(this.data.url, "scripts", null, "timeline-details"); - recordContentTable.appendChild(this._createLinkRow(WebInspector.UIString("Script"), link)); - } else if (this.type === recordTypes.Paint) { - recordContentTable.appendChild(this._createRow(WebInspector.UIString("Location"), this.data.x + "\u2009\u00d7\u2009" + this.data.y)); - recordContentTable.appendChild(this._createRow(WebInspector.UIString("Dimensions"), this.data.width + "\u2009\u00d7\u2009" + this.data.height)); - } else - recordContentTable.appendChild(this._createRow(WebInspector.UIString("Details"), this.details)); + contentHelper._appendTextRow("Expected Content Length", this.data.expectedContentLength); + break; + case recordTypes.EvaluateScript: + if (this.data && this.data.url) + contentHelper._appendLinkRow("Script", this.data.url, this.data.lineNumber); + break; + case recordTypes.Paint: + contentHelper._appendTextRow("Location", this.data.x + "\u2009\u00d7\u2009" + this.data.y); + contentHelper._appendTextRow("Dimensions", this.data.width + "\u2009\u00d7\u2009" + this.data.height); + default: + if (this.details) + contentHelper._appendTextRow("Details", this.details); + break; } - if (this.type !== recordTypes.GCEvent && this.callerScriptName) { - var link = WebInspector.linkifyResourceAsNode(this.callerScriptName, "scripts", this.callerScriptLine); - recordContentTable.appendChild(this._createLinkRow(WebInspector.UIString("Caller"), link)); - } - if (this.usedHeapSize) { - recordContentTable.appendChild(this._createRow(WebInspector.UIString("Used Heap Size"), Number.bytesToString(this.usedHeapSize))); - recordContentTable.appendChild(this._createRow(WebInspector.UIString("Total Heap Size"), Number.bytesToString(this.totalHeapSize))); - } - return recordContentTable; + if (this.data.scriptName && this.type !== recordTypes.FunctionCall) + contentHelper._appendLinkRow("Function Call", this.data.scriptName, this.data.scriptLine); + + if (this.callerScriptName && this.type !== recordTypes.GCEvent) + contentHelper._appendLinkRow("Caller", this.callerScriptName, this.callerScriptLine); + + if (this.usedHeapSize) + contentHelper._appendTextRow("Used Heap Size", WebInspector.UIString("%s of %s", Number.bytesToString(this.usedHeapSize), Number.bytesToString(this.totalHeapSize))); + + return contentHelper._contentTable; }, _getRecordDetails: function(record, sendRequestRecords) @@ -934,19 +951,24 @@ WebInspector.TimelinePanel.FormattedRecord.prototype = { switch (record.type) { case WebInspector.TimelineAgent.RecordType.GCEvent: return WebInspector.UIString("%s collected", Number.bytesToString(record.data.usedHeapSizeDelta)); + case WebInspector.TimelineAgent.RecordType.TimerFire: + return record.data.scriptName ? WebInspector.linkifyResourceAsNode(record.data.scriptName, "scripts", record.data.scriptLine) : record.data.timerId; case WebInspector.TimelineAgent.RecordType.FunctionCall: - return WebInspector.displayNameForURL(record.data.scriptName) + ":" + record.data.scriptLine; + return record.data.scriptName ? WebInspector.linkifyResourceAsNode(record.data.scriptName, "scripts", record.data.scriptLine) : null; case WebInspector.TimelineAgent.RecordType.EventDispatch: - return record.data ? record.data.type : ""; + return record.data ? record.data.type : null; case WebInspector.TimelineAgent.RecordType.Paint: return record.data.width + "\u2009\u00d7\u2009" + record.data.height; case WebInspector.TimelineAgent.RecordType.TimerInstall: case WebInspector.TimelineAgent.RecordType.TimerRemove: - case WebInspector.TimelineAgent.RecordType.TimerFire: - return record.data.timerId; + return this.callerScriptName ? WebInspector.linkifyResourceAsNode(this.callerScriptName, "scripts", this.callerScriptLine) : record.data.timerId; + case WebInspector.TimelineAgent.RecordType.ParseHTML: + case WebInspector.TimelineAgent.RecordType.RecalculateStyles: + return this.callerScriptName ? WebInspector.linkifyResourceAsNode(this.callerScriptName, "scripts", this.callerScriptLine) : null; + case WebInspector.TimelineAgent.RecordType.EvaluateScript: + return record.data.url ? WebInspector.linkifyResourceAsNode(record.data.url, "scripts", record.data.lineNumber) : null; case WebInspector.TimelineAgent.RecordType.XHRReadyStateChange: case WebInspector.TimelineAgent.RecordType.XHRLoad: - case WebInspector.TimelineAgent.RecordType.EvaluateScript: case WebInspector.TimelineAgent.RecordType.ResourceSendRequest: case WebInspector.TimelineAgent.RecordType.ResourceReceiveData: case WebInspector.TimelineAgent.RecordType.ResourceReceiveResponse: @@ -955,8 +977,74 @@ WebInspector.TimelinePanel.FormattedRecord.prototype = { case WebInspector.TimelineAgent.RecordType.MarkTimeline: return record.data.message; default: - return ""; + return null; + } + }, + + _calculateAggregatedStats: function(categories) + { + this._aggregatedStats = {}; + for (var category in categories) + this._aggregatedStats[category] = 0; + this._cpuTime = this._selfTime; + + if (this._children) { + for (var index = this._children.length; index; --index) { + var child = this._children[index - 1]; + this._aggregatedStats[child.category.name] += child._selfTime; + for (var category in categories) + this._aggregatedStats[category] += child._aggregatedStats[category]; + } + for (var category in this._aggregatedStats) + this._cpuTime += this._aggregatedStats[category]; } } } +WebInspector.TimelinePanel.PopupContentHelper = function(title) +{ + this._contentTable = document.createElement("table");; + var titleCell = this._createCell(WebInspector.UIString("%s - Details", title), "timeline-details-title"); + titleCell.colSpan = 2; + var titleRow = document.createElement("tr"); + titleRow.appendChild(titleCell); + this._contentTable.appendChild(titleRow); +} + +WebInspector.TimelinePanel.PopupContentHelper.prototype = { + _createCell: function(content, styleName) + { + var text = document.createElement("label"); + text.appendChild(document.createTextNode(content)); + var cell = document.createElement("td"); + cell.className = "timeline-details"; + if (styleName) + cell.className += " " + styleName; + cell.textContent = content; + return cell; + }, + + _appendTextRow: function(title, content) + { + var row = document.createElement("tr"); + row.appendChild(this._createCell(WebInspector.UIString(title), "timeline-details-row-title")); + row.appendChild(this._createCell(content, "timeline-details-row-data")); + this._contentTable.appendChild(row); + }, + + _appendElementRow: function(title, content) + { + var row = document.createElement("tr"); + row.appendChild(this._createCell(WebInspector.UIString(title), "timeline-details-row-title")); + var cell = document.createElement("td"); + cell.appendChild(content); + row.appendChild(cell); + this._contentTable.appendChild(row); + }, + + _appendLinkRow: function(title, scriptName, scriptLine) + { + var link = WebInspector.linkifyResourceAsNode(scriptName, "scripts", scriptLine, "timeline-details"); + this._appendElementRow(title, link); + } +} diff --git a/WebCore/inspector/front-end/inspector.css b/WebCore/inspector/front-end/inspector.css index 581c75a..199a3f3 100644 --- a/WebCore/inspector/front-end/inspector.css +++ b/WebCore/inspector/front-end/inspector.css @@ -3387,7 +3387,15 @@ body.inactive .sidebar-tree-item.selected .bubble.search-matches { bottom: 0px; left: 200px; right: 0px; - background-color: rgb(224, 224, 224); + background-color: rgb(255, 255, 255); +} + +.timeline-window-selector { + position: absolute; + top: 0; + bottom: 0; + background-color: rgba(125, 173, 217, 0.5); + z-index: 250; } #timeline-overview-window { @@ -3396,14 +3404,33 @@ body.inactive .sidebar-tree-item.selected .bubble.search-matches { left: 0; right: 0; top: 0; + bottom: 60px; + z-index: 150; +} + +.timeline-overview-dividers-background { + left: 0%; + right: 0%; + top: 0px; + bottom: 60px; + background-color: black; + position: absolute; +} + +.timeline-overview-window-rulers { + top: 0; bottom: 0; + position: absolute; + opacity: 0.2; + border-right: 1px solid black; + border-left: 1px solid black; z-index: 150; } .timeline-window-resizer { position: absolute; - top: 35px; - bottom: 15px; + top: 0px; + bottom: 60px; width: 5px; margin-left: -3px; margin-right: -2px; @@ -3605,7 +3632,11 @@ body.inactive .sidebar-tree-item.selected .bubble.search-matches { } .timeline-graph-bar.with-children { - opacity: 0.3; + opacity: 0.2; +} + +.timeline-graph-bar.cpu { + opacity: 0.6; } .timeline-graph-side.even { @@ -3624,6 +3655,32 @@ body.inactive .sidebar-tree-item.selected .bubble.search-matches { -webkit-border-image: url(Images/timelineBarPurple.png) 4 4 5 4; } +.timeline-aggregated-category { + display: inline-block; + height: 11px; + margin-right: 2px; + margin-left: 6px; + position: relative; + top: 2px; + width: 10px; +} + +.timeline-loading { + -webkit-border-image: url(Images/timelineBarBlue.png) 4 4 5 4; +} + +.timeline-scripting { + -webkit-border-image: url(Images/timelineBarOrange.png) 4 4 5 4; +} + +.timeline-rendering { + -webkit-border-image: url(Images/timelineBarPurple.png) 4 4 5 4; +} + +.popover .timeline-aggregated-category.timeline-loading { + margin-left: 0px; +} + .timeline-category-loading .timeline-tree-icon { background-position-y: 0px; } @@ -3651,7 +3708,11 @@ body.inactive .sidebar-tree-item.selected .bubble.search-matches { } .timeline-details-title { + border-bottom: 1px solid #B8B8B8; + font-size: 11px; font-weight: bold; + padding-bottom: 5px; + padding-top: 0px; white-space: nowrap; } @@ -3969,3 +4030,8 @@ a.worker-item:hover { text-align: center; padding: 32px; } + +.node-link { + text-decoration: underline; + cursor: pointer; +} diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js index c75dd9c..edd54bd 100644 --- a/WebCore/inspector/front-end/inspector.js +++ b/WebCore/inspector/front-end/inspector.js @@ -190,8 +190,10 @@ var WebInspector = { } for (var panelName in WebInspector.panels) { - if (WebInspector.panels[panelName] == x) + if (WebInspector.panels[panelName] === x) { InspectorBackend.storeLastActivePanel(panelName); + this._panelHistory.setPanel(panelName); + } } }, @@ -244,6 +246,8 @@ var WebInspector = { body.addStyleClass("detached"); dockToggleButton.title = WebInspector.UIString("Dock to main window."); } + if (this.drawer) + this.drawer.resize(); }, get errors() @@ -458,6 +462,7 @@ WebInspector.loaded = function() this.panels = {}; this._createPanels(); + this._panelHistory = new WebInspector.PanelHistory(); var toolbarElement = document.getElementById("toolbar"); var previousToolbarItem = toolbarElement.children[0]; @@ -680,6 +685,7 @@ WebInspector.documentKeyDown = function(event) if (WebInspector.isEditingAnyField()) return; + var isInTextPrompt = event.target.enclosingNodeOrSelfWithClass("text-prompt"); if (this.currentFocusElement && this.currentFocusElement.handleKeyEvent) { this.currentFocusElement.handleKeyEvent(event); if (event.handled) { @@ -697,8 +703,23 @@ WebInspector.documentKeyDown = function(event) } var isMac = WebInspector.isMac(); - switch (event.keyIdentifier) { + case "Left": + var isBackKey = !isInTextPrompt && (isMac ? event.metaKey : event.ctrlKey); + if (isBackKey && this._panelHistory.canGoBack()) { + this._panelHistory.goBack(); + event.preventDefault(); + } + break; + + case "Right": + var isForwardKey = !isInTextPrompt && (isMac ? event.metaKey : event.ctrlKey); + if (isForwardKey && this._panelHistory.canGoForward()) { + this._panelHistory.goForward(); + event.preventDefault(); + } + break; + case "U+001B": // Escape key event.preventDefault(); if (this.drawer.fullPanel) @@ -1457,6 +1478,21 @@ WebInspector.addProfileHeader = function(profile) WebInspector.setRecordingProfile = function(isProfiling) { this.panels.profiles.getProfileType(WebInspector.CPUProfileType.TypeId).setRecordingProfile(isProfiling); + if (this._previousIsProfiling !== isProfiling) { + if (!this._temporaryRecordingProfile) { + this._temporaryRecordingProfile = { + typeId: WebInspector.CPUProfileType.TypeId, + title: WebInspector.UIString('Recording...'), + uid: -1, + isTemporary: true + }; + } + this._previousIsProfiling = isProfiling; + if (isProfiling) + this.panels.profiles.addProfileHeader(this._temporaryRecordingProfile); + else + this.panels.profiles.removeProfileHeader(this._temporaryRecordingProfile); + } this.panels.profiles.updateProfileTypeButtons(); } @@ -1950,3 +1986,46 @@ WebInspector.MIMETypes = { "text/jscript": {4: true}, "text/livescript": {4: true}, } + +WebInspector.PanelHistory = function() +{ + this._history = []; + this._historyIterator = -1; +} + +WebInspector.PanelHistory.prototype = { + canGoBack: function() + { + return this._historyIterator > 0; + }, + + goBack: function() + { + this._inHistory = true; + WebInspector.currentPanel = WebInspector.panels[this._history[--this._historyIterator]]; + delete this._inHistory; + }, + + canGoForward: function() + { + return this._historyIterator < this._history.length - 1; + }, + + goForward: function() + { + this._inHistory = true; + WebInspector.currentPanel = WebInspector.panels[this._history[++this._historyIterator]]; + delete this._inHistory; + }, + + setPanel: function(panelName) + { + if (this._inHistory) + return; + + this._history.splice(this._historyIterator + 1, this._history.length - this._historyIterator - 1); + if (!this._history.length || this._history[this._history.length - 1] !== panelName) + this._history.push(panelName); + this._historyIterator = this._history.length - 1; + } +} diff --git a/WebCore/inspector/front-end/textViewer.css b/WebCore/inspector/front-end/textViewer.css index b69545f..a24a75c 100644 --- a/WebCore/inspector/front-end/textViewer.css +++ b/WebCore/inspector/front-end/textViewer.css @@ -63,6 +63,7 @@ background-color: rgb(240, 240, 240); border-right: 1px solid rgb(187, 187, 187); text-align: right; + vertical-align: top; word-break: normal; -webkit-user-select: none; padding-right: 4px; diff --git a/WebCore/loader/DocumentLoader.cpp b/WebCore/loader/DocumentLoader.cpp index e835f80..21c2e27 100644 --- a/WebCore/loader/DocumentLoader.cpp +++ b/WebCore/loader/DocumentLoader.cpp @@ -617,6 +617,17 @@ void DocumentLoader::setTitle(const String& title) } } +void DocumentLoader::setIconURL(const String& iconURL) +{ + if (iconURL.isEmpty()) + return; + + if (m_pageIconURL != iconURL) { + m_pageIconURL = iconURL; + frameLoader()->didChangeIcons(this); + } +} + KURL DocumentLoader::urlForHistory() const { // Return the URL to be used for history and B/F list. diff --git a/WebCore/loader/DocumentLoader.h b/WebCore/loader/DocumentLoader.h index 440cfc4..1beed10 100644 --- a/WebCore/loader/DocumentLoader.h +++ b/WebCore/loader/DocumentLoader.h @@ -111,6 +111,7 @@ namespace WebCore { bool isLoadingInAPISense() const; void setPrimaryLoadComplete(bool); void setTitle(const String&); + void setIconURL(const String&); const String& overrideEncoding() const { return m_overrideEncoding; } #if PLATFORM(MAC) @@ -154,6 +155,7 @@ namespace WebCore { void stopRecordingResponses(); const String& title() const { return m_pageTitle; } + const String& iconURL() const { return m_pageIconURL; } KURL urlForHistory() const; bool urlForHistoryReflectsFailure() const; @@ -261,6 +263,7 @@ namespace WebCore { bool m_isClientRedirect; String m_pageTitle; + String m_pageIconURL; String m_overrideEncoding; diff --git a/WebCore/loader/DocumentThreadableLoader.cpp b/WebCore/loader/DocumentThreadableLoader.cpp index 3bebbe6..ee926b1 100644 --- a/WebCore/loader/DocumentThreadableLoader.cpp +++ b/WebCore/loader/DocumentThreadableLoader.cpp @@ -81,16 +81,19 @@ DocumentThreadableLoader::DocumentThreadableLoader(Document* document, Threadabl ASSERT(m_options.crossOriginRequestPolicy == UseAccessControl); - if (!m_options.forcePreflight && isSimpleCrossOriginAccessRequest(request.httpMethod(), request.httpHeaderFields())) - makeSimpleCrossOriginAccessRequest(request); + OwnPtr<ResourceRequest> crossOriginRequest(new ResourceRequest(request)); + crossOriginRequest->removeCredentials(); + crossOriginRequest->setAllowCookies(m_options.allowCredentials); + + if (!m_options.forcePreflight && isSimpleCrossOriginAccessRequest(crossOriginRequest->httpMethod(), crossOriginRequest->httpHeaderFields())) + makeSimpleCrossOriginAccessRequest(*crossOriginRequest); else { - m_actualRequest.set(new ResourceRequest(request)); - m_actualRequest->setAllowCookies(m_options.allowCredentials); + m_actualRequest.set(crossOriginRequest.release()); - if (CrossOriginPreflightResultCache::shared().canSkipPreflight(document->securityOrigin()->toString(), request.url(), m_options.allowCredentials, request.httpMethod(), request.httpHeaderFields())) + if (CrossOriginPreflightResultCache::shared().canSkipPreflight(document->securityOrigin()->toString(), m_actualRequest->url(), m_options.allowCredentials, m_actualRequest->httpMethod(), m_actualRequest->httpHeaderFields())) preflightSuccess(); else - makeCrossOriginAccessRequestWithPreflight(request); + makeCrossOriginAccessRequestWithPreflight(*m_actualRequest); } } @@ -106,8 +109,6 @@ void DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest(const Resource // Make a copy of the passed request so that we can modify some details. ResourceRequest crossOriginRequest(request); - crossOriginRequest.removeCredentials(); - crossOriginRequest.setAllowCookies(m_options.allowCredentials); crossOriginRequest.setHTTPOrigin(m_document->securityOrigin()->toString()); loadRequest(crossOriginRequest, DoSecurityCheck); @@ -297,6 +298,11 @@ void DocumentThreadableLoader::preflightFailure() void DocumentThreadableLoader::loadRequest(const ResourceRequest& request, SecurityCheckPolicy securityCheck) { + // Any credential should have been removed from the cross-site requests. + const KURL& requestURL = request.url(); + ASSERT(m_sameOriginRequest || requestURL.user().isEmpty()); + ASSERT(m_sameOriginRequest || requestURL.pass().isEmpty()); + if (m_async) { // Don't sniff content or send load callbacks for the preflight request. bool sendLoadCallbacks = m_options.sendLoadCallbacks && !m_actualRequest; @@ -320,15 +326,15 @@ void DocumentThreadableLoader::loadRequest(const ResourceRequest& request, Secur // No exception for file:/// resources, see <rdar://problem/4962298>. // Also, if we have an HTTP response, then it wasn't a network error in fact. - if (!error.isNull() && !request.url().isLocalFile() && response.httpStatusCode() <= 0) { + if (!error.isNull() && !requestURL.isLocalFile() && response.httpStatusCode() <= 0) { m_client->didFail(error); return; } // FIXME: FrameLoader::loadSynchronously() does not tell us whether a redirect happened or not, so we guess by comparing the // request and response URLs. This isn't a perfect test though, since a server can serve a redirect to the same URL that was - // requested. - if (request.url() != response.url() && !isAllowedRedirect(response.url())) { + // requested. Also comparing the request and response URLs as strings will fail if the requestURL still has its credentials. + if (requestURL != response.url() && !isAllowedRedirect(response.url())) { m_client->didFailRedirectCheck(); return; } diff --git a/WebCore/loader/EmptyClients.h b/WebCore/loader/EmptyClients.h index 3147a3b..982324a 100644 --- a/WebCore/loader/EmptyClients.h +++ b/WebCore/loader/EmptyClients.h @@ -198,6 +198,9 @@ public: virtual void dispatchWillSendRequest(DocumentLoader*, unsigned long, ResourceRequest&, const ResourceResponse&) { } virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge&) { } virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge&) { } +#if USE(PROTECTION_SPACE_AUTH_CALLBACK) + virtual bool canAuthenticateAgainstProtectionSpace(DocumentLoader*, unsigned long, const ProtectionSpace&) { return false; } +#endif virtual void dispatchDidReceiveResponse(DocumentLoader*, unsigned long, const ResourceResponse&) { } virtual void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long, int) { } virtual void dispatchDidFinishLoading(DocumentLoader*, unsigned long) { } @@ -216,6 +219,7 @@ public: virtual void dispatchDidReceiveIcon() { } virtual void dispatchDidStartProvisionalLoad() { } virtual void dispatchDidReceiveTitle(const String&) { } + virtual void dispatchDidChangeIcons() { } virtual void dispatchDidCommitLoad() { } virtual void dispatchDidFailProvisionalLoad(const ResourceError&) { } virtual void dispatchDidFailLoad(const ResourceError&) { } @@ -234,6 +238,7 @@ public: virtual void dispatchUnableToImplementPolicy(const ResourceError&) { } + virtual void dispatchWillSendSubmitEvent(HTMLFormElement*) { } virtual void dispatchWillSubmitForm(FramePolicyFunction, PassRefPtr<FormState>) { } virtual void dispatchDidLoadMainResource(DocumentLoader*) { } diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp index 63b00e8..125ee9b 100644 --- a/WebCore/loader/FrameLoader.cpp +++ b/WebCore/loader/FrameLoader.cpp @@ -230,6 +230,10 @@ FrameLoader::~FrameLoader() void FrameLoader::init() { + // Propagate sandbox attributes to this Frameloader and its descendants. + // This needs to be done early, so that an initial document gets correct sandbox flags in its SecurityOrigin. + updateSandboxFlags(); + // this somewhat odd set of steps is needed to give the frame an initial empty document m_isDisplayingInitialEmptyDocument = false; m_creatingInitialEmptyDocument = true; @@ -243,9 +247,6 @@ void FrameLoader::init() m_frame->document()->cancelParsing(); m_creatingInitialEmptyDocument = false; m_didCallImplicitClose = true; - - // Propagate sandbox attributes to this Frameloader and its descendants. - updateSandboxFlags(); } void FrameLoader::setDefersLoading(bool defers) @@ -521,7 +522,7 @@ void FrameLoader::submitForm(const char* action, const String& url, PassRefPtr<F m_submittedFormURL = u; } - formData->generateFiles(m_frame->page()->chrome()->client()); + formData->generateFiles(m_frame->document()); if (!m_outgoingReferrer.isEmpty()) frameRequest.resourceRequest().setHTTPReferrer(m_outgoingReferrer); @@ -1210,7 +1211,7 @@ ObjectContentType FrameLoader::defaultObjectContentType(const KURL& url, const S if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType)) return WebCore::ObjectContentImage; -#if !PLATFORM(MAC) && !PLATFORM(CHROMIUM) // Mac has no PluginDatabase, nor does Chromium +#if !PLATFORM(MAC) && !PLATFORM(CHROMIUM) && !PLATFORM(EFL) // Mac has no PluginDatabase, nor does Chromium or EFL if (PluginDatabase::installedPlugins()->isMIMETypeRegistered(mimeType)) return WebCore::ObjectContentNetscapePlugin; #endif @@ -3745,7 +3746,7 @@ void FrameLoader::navigateToDifferentDocument(HistoryItem* item, FrameLoadType l // If this was a repost that failed the page cache, we might try to repost the form. NavigationAction action; if (formData) { - formData->generateFiles(m_frame->page()->chrome()->client()); + formData->generateFiles(m_frame->document()); request.setHTTPMethod("POST"); request.setHTTPBody(formData); @@ -3878,11 +3879,23 @@ bool FrameLoader::shouldUseCredentialStorage(ResourceLoader* loader) return m_client->shouldUseCredentialStorage(loader->documentLoader(), loader->identifier()); } +#if USE(PROTECTION_SPACE_AUTH_CALLBACK) +bool FrameLoader::canAuthenticateAgainstProtectionSpace(ResourceLoader* loader, const ProtectionSpace& protectionSpace) +{ + return m_client->canAuthenticateAgainstProtectionSpace(loader->documentLoader(), loader->identifier(), protectionSpace); +} +#endif + void FrameLoader::setTitle(const String& title) { documentLoader()->setTitle(title); } +void FrameLoader::setIconURL(const String& iconURL) +{ + documentLoader()->setIconURL(iconURL); +} + KURL FrameLoader::originalRequestURL() const { return activeDocumentLoader()->originalRequest().url(); @@ -4000,6 +4013,12 @@ void FrameLoader::didChangeTitle(DocumentLoader* loader) } } +void FrameLoader::didChangeIcons(DocumentLoader* loader) +{ + if (loader == m_documentLoader) + m_client->dispatchDidChangeIcons(); +} + void FrameLoader::dispatchDidCommitLoad() { if (m_creatingInitialEmptyDocument) diff --git a/WebCore/loader/FrameLoader.h b/WebCore/loader/FrameLoader.h index adfebd4..34d1ad1 100644 --- a/WebCore/loader/FrameLoader.h +++ b/WebCore/loader/FrameLoader.h @@ -71,6 +71,7 @@ class NavigationAction; #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) class Node; #endif +class ProtectionSpace; class RenderEmbeddedObject; class ResourceError; class ResourceLoader; @@ -155,6 +156,9 @@ public: static double timeOfLastCompletedLoad(); bool shouldUseCredentialStorage(ResourceLoader*); +#if USE(PROTECTION_SPACE_AUTH_CALLBACK) + bool canAuthenticateAgainstProtectionSpace(ResourceLoader* loader, const ProtectionSpace& protectionSpace); +#endif const ResourceRequest& originalRequest() const; const ResourceRequest& initialRequest() const; void receivedMainResourceError(const ResourceError&, bool isComplete); @@ -193,6 +197,7 @@ public: bool subframeIsLoading() const; void willChangeTitle(DocumentLoader*); void didChangeTitle(DocumentLoader*); + void didChangeIcons(DocumentLoader*); FrameLoadType loadType() const; CachePolicy subresourceCachePolicy() const; @@ -303,6 +308,7 @@ public: void cancelAndClear(); void setTitle(const String&); + void setIconURL(const String&); void commitProvisionalLoad(PassRefPtr<CachedPage>); bool isLoadingFromCachedPage() const { return m_loadingFromCachedPage; } diff --git a/WebCore/loader/FrameLoaderClient.h b/WebCore/loader/FrameLoaderClient.h index b2931c8..c74933b 100644 --- a/WebCore/loader/FrameLoaderClient.h +++ b/WebCore/loader/FrameLoaderClient.h @@ -54,6 +54,7 @@ namespace WebCore { class FrameLoader; class HistoryItem; class HTMLAppletElement; + class HTMLFormElement; class HTMLFrameOwnerElement; #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) class HTMLMediaElement; @@ -62,6 +63,7 @@ namespace WebCore { class IntSize; class KURL; class NavigationAction; + class ProtectionSpace; class PluginView; class PolicyChecker; class ResourceError; @@ -107,6 +109,9 @@ namespace WebCore { virtual bool shouldUseCredentialStorage(DocumentLoader*, unsigned long identifier) = 0; virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&) = 0; virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&) = 0; +#if USE(PROTECTION_SPACE_AUTH_CALLBACK) + virtual bool canAuthenticateAgainstProtectionSpace(DocumentLoader*, unsigned long identifier, const ProtectionSpace&) = 0; +#endif virtual void dispatchDidReceiveResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse&) = 0; virtual void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long identifier, int lengthReceived) = 0; virtual void dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier) = 0; @@ -126,6 +131,7 @@ namespace WebCore { virtual void dispatchDidReceiveIcon() = 0; virtual void dispatchDidStartProvisionalLoad() = 0; virtual void dispatchDidReceiveTitle(const String& title) = 0; + virtual void dispatchDidChangeIcons() = 0; virtual void dispatchDidCommitLoad() = 0; virtual void dispatchDidFailProvisionalLoad(const ResourceError&) = 0; virtual void dispatchDidFailLoad(const ResourceError&) = 0; @@ -144,6 +150,7 @@ namespace WebCore { virtual void dispatchUnableToImplementPolicy(const ResourceError&) = 0; + virtual void dispatchWillSendSubmitEvent(HTMLFormElement*) = 0; virtual void dispatchWillSubmitForm(FramePolicyFunction, PassRefPtr<FormState>) = 0; virtual void dispatchDidLoadMainResource(DocumentLoader*) = 0; @@ -251,7 +258,7 @@ namespace WebCore { #endif #if PLATFORM(MAC) -#if ENABLE(MAC_JAVA_BRIDGE) +#if ENABLE(JAVA_BRIDGE) virtual jobject javaApplet(NSView*) { return 0; } #endif virtual NSCachedURLResponse* willCacheResponse(DocumentLoader*, unsigned long identifier, NSCachedURLResponse*) const = 0; diff --git a/WebCore/loader/ResourceLoader.cpp b/WebCore/loader/ResourceLoader.cpp index 183d2ce..7a95383 100644 --- a/WebCore/loader/ResourceLoader.cpp +++ b/WebCore/loader/ResourceLoader.cpp @@ -495,6 +495,14 @@ void ResourceLoader::didCancelAuthenticationChallenge(const AuthenticationChalle frameLoader()->notifier()->didCancelAuthenticationChallenge(this, challenge); } +#if USE(PROTECTION_SPACE_AUTH_CALLBACK) +bool ResourceLoader::canAuthenticateAgainstProtectionSpace(const ProtectionSpace& protectionSpace) +{ + RefPtr<ResourceLoader> protector(this); + return frameLoader()->canAuthenticateAgainstProtectionSpace(this, protectionSpace); +} +#endif + void ResourceLoader::receivedCancellation(const AuthenticationChallenge&) { cancel(); diff --git a/WebCore/loader/ResourceLoader.h b/WebCore/loader/ResourceLoader.h index 3178eb4..ef09471 100644 --- a/WebCore/loader/ResourceLoader.h +++ b/WebCore/loader/ResourceLoader.h @@ -44,6 +44,7 @@ namespace WebCore { class DocumentLoader; class Frame; class FrameLoader; + class ProtectionSpace; class ResourceHandle; class SharedBuffer; @@ -90,6 +91,9 @@ namespace WebCore { virtual bool shouldUseCredentialStorage(); virtual void didReceiveAuthenticationChallenge(const AuthenticationChallenge&); void didCancelAuthenticationChallenge(const AuthenticationChallenge&); +#if USE(PROTECTION_SPACE_AUTH_CALLBACK) + virtual bool canAuthenticateAgainstProtectionSpace(const ProtectionSpace&); +#endif virtual void receivedCancellation(const AuthenticationChallenge&); // ResourceHandleClient @@ -105,6 +109,9 @@ namespace WebCore { virtual bool shouldUseCredentialStorage(ResourceHandle*) { return shouldUseCredentialStorage(); } virtual void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge& challenge) { didReceiveAuthenticationChallenge(challenge); } virtual void didCancelAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge& challenge) { didCancelAuthenticationChallenge(challenge); } +#if USE(PROTECTION_SPACE_AUTH_CALLBACK) + virtual bool canAuthenticateAgainstProtectionSpace(ResourceHandle*, const ProtectionSpace& protectionSpace) { return canAuthenticateAgainstProtectionSpace(protectionSpace); } +#endif virtual void receivedCancellation(ResourceHandle*, const AuthenticationChallenge& challenge) { receivedCancellation(challenge); } virtual void willCacheResponse(ResourceHandle*, CacheStoragePolicy&); #if PLATFORM(MAC) diff --git a/WebCore/loader/appcache/DOMApplicationCache.idl b/WebCore/loader/appcache/DOMApplicationCache.idl index 9794baf..8525fe6 100644 --- a/WebCore/loader/appcache/DOMApplicationCache.idl +++ b/WebCore/loader/appcache/DOMApplicationCache.idl @@ -55,12 +55,12 @@ module offline { attribute EventListener onobsolete; // EventTarget interface - [JSCCustom] void addEventListener(in DOMString type, - in EventListener listener, - in boolean useCapture); - [JSCCustom] void removeEventListener(in DOMString type, - in EventListener listener, - in boolean useCapture); + void addEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); + void removeEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); boolean dispatchEvent(in Event evt) raises(EventException); }; diff --git a/WebCore/loader/appcache/ManifestParser.cpp b/WebCore/loader/appcache/ManifestParser.cpp index b001bff..f58a55d 100644 --- a/WebCore/loader/appcache/ManifestParser.cpp +++ b/WebCore/loader/appcache/ManifestParser.cpp @@ -127,6 +127,9 @@ bool parseManifest(const KURL& manifestURL, const char* data, int length, Manife if (!equalIgnoringCase(url.protocol(), manifestURL.protocol())) continue; + if (mode == Explicit && manifestURL.protocolIs("https") && !protocolHostAndPortAreEqual(manifestURL, url)) + continue; + if (mode == Explicit) manifest.explicitURLs.add(url.string()); else diff --git a/WebCore/manual-tests/NPN_Invoke/main.c b/WebCore/manual-tests/NPN_Invoke/main.c index f149f54..4a6d706 100644 --- a/WebCore/manual-tests/NPN_Invoke/main.c +++ b/WebCore/manual-tests/NPN_Invoke/main.c @@ -37,16 +37,16 @@ NPNetscapeFuncs *browser; -NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved); +NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved); NPError NPP_Destroy(NPP instance, NPSavedData** save); NPError NPP_SetWindow(NPP instance, NPWindow* window); -NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype); +NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype); NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason); -int32 NPP_WriteReady(NPP instance, NPStream* stream); -int32 NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer); +int32_t NPP_WriteReady(NPP instance, NPStream* stream); +int32_t NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer); void NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname); void NPP_Print(NPP instance, NPPrint* platformPrint); -int16 NPP_HandleEvent(NPP instance, void* event); +int16_t NPP_HandleEvent(NPP instance, void* event); void NPP_URLNotify(NPP instance, const char* URL, NPReason reason, void* notifyData); NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value); NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value); @@ -153,7 +153,7 @@ int main(NPNetscapeFuncs *browserFuncs, NPPluginFuncs *pluginFuncs, NPP_Shutdown return NPERR_NO_ERROR; } -NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved) +NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved) { // Call window.alert("Success!") NPError error; @@ -180,7 +180,7 @@ NPError NPP_SetWindow(NPP instance, NPWindow* window) return NPERR_NO_ERROR; } -NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype) +NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype) { *stype = NP_ASFILEONLY; return NPERR_NO_ERROR; @@ -191,12 +191,12 @@ NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason) return NPERR_NO_ERROR; } -int32 NPP_WriteReady(NPP instance, NPStream* stream) +int32_t NPP_WriteReady(NPP instance, NPStream* stream) { return 0; } -int32 NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer) +int32_t NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer) { return 0; } @@ -210,7 +210,7 @@ void NPP_Print(NPP instance, NPPrint* platformPrint) } -int16 NPP_HandleEvent(NPP instance, void* event) +int16_t NPP_HandleEvent(NPP instance, void* event) { return 1; } @@ -234,11 +234,11 @@ NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value) FunctionPointer functionPointerForTVector(TransitionVector tvp) { - const uint32 temp[6] = {0x3D800000, 0x618C0000, 0x800C0000, 0x804C0004, 0x7C0903A6, 0x4E800420}; - uint32 *newGlue = NULL; + const uint32_t temp[6] = {0x3D800000, 0x618C0000, 0x800C0000, 0x804C0004, 0x7C0903A6, 0x4E800420}; + uint32_t *newGlue = NULL; if (tvp != NULL) { - newGlue = (uint32 *)malloc(sizeof(temp)); + newGlue = (uint32_t *)malloc(sizeof(temp)); if (newGlue != NULL) { unsigned i; for (i = 0; i < 6; i++) newGlue[i] = temp[i]; diff --git a/WebCore/manual-tests/chromium/suggestions-popup-font-change.html b/WebCore/manual-tests/chromium/suggestions-popup-font-change.html new file mode 100644 index 0000000..b85977a --- /dev/null +++ b/WebCore/manual-tests/chromium/suggestions-popup-font-change.html @@ -0,0 +1,21 @@ +<html> +<head> +</head> +<body> + <p>Verify that the font size in the suggestion popup matches the corresponding + input field, test passes if step 2 matches expected behavior.</p> + <ul> + <li>1. Type "abcd" in the text form and press enter.</li> + <li>2. Type "a" in the text form, suggestions popup should appear. + Verify that font size of text in suggestion popup is the same as in + the corresponding input form. + </li> + <li>3. Delete contents of input box, press Cntrl/+ [Command/+ on Mac] + to magnify the page contents. Repeat step 2, text size should still + match. </li> + </ul> + <form method="get" action="suggestions-popup-font-change.html" id="form"> + <input name="s" id="s" style="font-size:x-large"> + </form> +</body> +</html> diff --git a/WebCore/manual-tests/compositing/accel-comp-iframe-tab-repaint.html b/WebCore/manual-tests/compositing/accel-comp-iframe-tab-repaint.html new file mode 100644 index 0000000..35c9c34 --- /dev/null +++ b/WebCore/manual-tests/compositing/accel-comp-iframe-tab-repaint.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<title>Accelerated compositing tab repaint bug</title> +<style> +body { + background-color: yellow; +} +</style> +<h1>Accelerated compositing tab repaint bug</h1> +<p>This test case checks for a repaint bug resulting from accelerated +compositing of iframes on Mac. Follow these steps:</p> +<ol> +<li>Open <a href="resources/tab-repaint-part-2.html">this link</a> in a new tab.</li> +<li>Close this tab.</li> +<li>The new page should be blue.</li> +</ol> diff --git a/WebCore/manual-tests/compositing/resources/flash-frame.html b/WebCore/manual-tests/compositing/resources/flash-frame.html new file mode 100644 index 0000000..34d9290 --- /dev/null +++ b/WebCore/manual-tests/compositing/resources/flash-frame.html @@ -0,0 +1,3 @@ +<!DOCTYPE html> +<title>Flash frame for repaint test</title> +<embed src="../../resources/spinbox.swf"> diff --git a/WebCore/manual-tests/compositing/resources/tab-repaint-part-2.html b/WebCore/manual-tests/compositing/resources/tab-repaint-part-2.html new file mode 100644 index 0000000..17cb6e7 --- /dev/null +++ b/WebCore/manual-tests/compositing/resources/tab-repaint-part-2.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<title>Accelerated compositing tab repaint bug part 2</title> +<style> +body { + background-color: royalblue; +} +iframe { + border-width: 0px; + width: 400px; + height: 200px; +} +</style> +<body> +<ol> +<li>This page should have a blue background.</li> +</ol> +<iframe src="../resources/flash-frame.html"></iframe> +</body> diff --git a/WebCore/manual-tests/dom/document-write-synchronous-after-page-load.html b/WebCore/manual-tests/dom/document-write-synchronous-after-page-load.html new file mode 100644 index 0000000..f62fd68 --- /dev/null +++ b/WebCore/manual-tests/dom/document-write-synchronous-after-page-load.html @@ -0,0 +1,23 @@ +<p>This test ensures that document.write after page load is synchronous.</p> +<p>You will get a PASS or FAIL alert message after a few seconds.</p> +<script> +window.onload = function() { + + // Build a very long string to write. + var LIMIT = 17; + var str = '<p style="display:none">x</p>'; + for (var i=0; i<LIMIT; ++i) + str += str; + + // Write the string and check the DOM immediately and after a small delay. + var doc = document.implementation.createHTMLDocument(); + doc.write(str); + var immediateElementCount = doc.getElementsByTagName('*').length; + setTimeout(function() { + var delayedElementCount = doc.getElementsByTagName('*').length; + var passOrFail = (immediateElementCount === delayedElementCount ? "PASS" : "FAIL"); + alert(passOrFail); + }, 100); + +} +</script> diff --git a/WebCore/manual-tests/focus-change-between-key-events.html b/WebCore/manual-tests/focus-change-between-key-events.html new file mode 100644 index 0000000..8ceb575 --- /dev/null +++ b/WebCore/manual-tests/focus-change-between-key-events.html @@ -0,0 +1,24 @@ +<body onload="document.getElementById('dummy').focus();"> +<iframe src="data:text/html,<body onload='document.getElementsByTagName("input")[0].focus()'><input></body>" id=victim name=victim> +</iframe> +<script> + +var cur_pos = 0; + +function maybe_redirect(e) { + var evt = window.event ? event : e; + var cc = evt.charCode ? evt.charCode : evt.keyCode; + + document.getElementById('victim').focus(); + frames['victim'].focus(); + + document.getElementById('dummy').value += String.fromCharCode(cc).toLowerCase(); + + setTimeout('focus();document.getElementById("dummy").focus()',1); +} + + +</script> +<p>Type some text. It should only appear in the below input field.</p> +<input type=text onkeydown="maybe_redirect(event)" id=dummy> +</body> diff --git a/WebCore/manual-tests/onfocus-alert-blinking-caret.html b/WebCore/manual-tests/onfocus-alert-blinking-caret.html new file mode 100644 index 0000000..26b9812 --- /dev/null +++ b/WebCore/manual-tests/onfocus-alert-blinking-caret.html @@ -0,0 +1,8 @@ +<!DOCTYPE HTML> + +<body> +Focus the field below, then dismiss the alert. The field should retain the focus, +and the caret in the field should blink. +<br> +<input onfocus="alert('Test');"> +</body> diff --git a/WebCore/manual-tests/qt/qt-10loop-anim.gif b/WebCore/manual-tests/qt/qt-10loop-anim.gif Binary files differnew file mode 100644 index 0000000..ddb0006 --- /dev/null +++ b/WebCore/manual-tests/qt/qt-10loop-anim.gif diff --git a/WebCore/manual-tests/qt/qt-gif-test.html b/WebCore/manual-tests/qt/qt-gif-test.html index 06505f4..3412e1b 100644 --- a/WebCore/manual-tests/qt/qt-gif-test.html +++ b/WebCore/manual-tests/qt/qt-gif-test.html @@ -2,11 +2,15 @@ <body> <div> <img src="qt-anim.gif"> - <p>This should animate</p> + <p>This should animate.</p> </div> <div> <img src="qt-noanim.gif"> - <p>This should not animate and you should see a cross</p> + <p>This should not animate and you should see a cross.</p> +</div +<div> + <img src="qt-10loop-anim.gif"> + <p>This animation should loop 10 times.</p> </div </body> </html> diff --git a/WebCore/manual-tests/svg-tooltip.svg b/WebCore/manual-tests/svg-tooltip.svg new file mode 100644 index 0000000..84fe1d7 --- /dev/null +++ b/WebCore/manual-tests/svg-tooltip.svg @@ -0,0 +1,62 @@ +<?xml version="1.0"?> +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <title>This string should not show up as a tooltip</title> + <desc> + This test verifies that tooltips are properly rendered for SVG content in a variety of + scenarios. Hovering over every shape should result in a tooltip of "PASS". + </desc> + <defs> + <ellipse id="e1" cx="100" cy="200" rx="50" ry="30" fill="blue"> + <title>PASS</title> + </ellipse> + <ellipse id="e2" cx="250" cy="200" rx="50" ry="30" fill="blue"> + <title>FAIL</title> + </ellipse> + <symbol id="e3"> + <ellipse cx="100" cy="300" rx="50" ry="30" fill="blue"> + <title>PASS</title> + </ellipse> + </symbol> + <symbol id="e4"> + <title>FAIL</title> + <ellipse cx="250" cy="300" rx="50" ry="30" fill="blue"> + </ellipse> + </symbol> + </defs> + + <text y="15" x="0">When hovered, all shapes should show a "PASS" tooltip. Anything else is a failure.</text> + + <ellipse cx="100" cy="100" rx="50" ry="30" fill="blue"> + <title>PASS</title> + </ellipse> + + <g> + <title>PASS</title> + <ellipse cx="250" cy="100" rx="50" ry="30" fill="blue"/> + </g> + + <a xlink:title="PASS" xlink:href="#"> + <title>FAIL</title> + <ellipse id="e4" cx="400" cy="100" rx="50" ry="30" fill="blue"/> + </a> + + <use xlink:href="#e1"/> + + <use xlink:href="#e2"> + <title>PASS</title> + </use> + + <g> + <title>FAIL</title> + <ellipse id="e8" cx="400" cy="200" rx="50" ry="30" fill="blue"> + <title>PASS</title> + </ellipse> + </g> + + <use xlink:href="#e3"/> + <use xlink:href="#e4"> + <title>PASS</title> + </use> + + +</svg> diff --git a/WebCore/manual-tests/visited-link-new-window.html b/WebCore/manual-tests/visited-link-new-window.html new file mode 100644 index 0000000..5e10a34 --- /dev/null +++ b/WebCore/manual-tests/visited-link-new-window.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html> +<head> +<title>Visited link coloring test</test> +<style> +:visited { + color: limegreen; +} +</style> +</head> +<body> +<h1>Visited link coloring test</h1> +<p>Make sure the link below is not colored as visited (delete the item +for visited-link.html from your history and restart if +necessary). Then cmd-click it. The link should turn lime green.</p> +<a href="resources/visited-link.html">Am I a visited link?</a> +</body> +</html> diff --git a/WebCore/mathml/MathMLElement.cpp b/WebCore/mathml/MathMLElement.cpp index b47f4a9..b84616f 100644 --- a/WebCore/mathml/MathMLElement.cpp +++ b/WebCore/mathml/MathMLElement.cpp @@ -37,7 +37,7 @@ namespace WebCore { using namespace MathMLNames; MathMLElement::MathMLElement(const QualifiedName& tagName, Document* document) - : StyledElement(tagName, document, CreateElementZeroRefCount) + : StyledElement(tagName, document, CreateStyledElementZeroRefCount) { } diff --git a/WebCore/mathml/MathMLInlineContainerElement.cpp b/WebCore/mathml/MathMLInlineContainerElement.cpp index 2d682a2..c5fcac9 100644 --- a/WebCore/mathml/MathMLInlineContainerElement.cpp +++ b/WebCore/mathml/MathMLInlineContainerElement.cpp @@ -33,7 +33,9 @@ #include "RenderMathMLBlock.h" #include "RenderMathMLFraction.h" #include "RenderMathMLMath.h" +#include "RenderMathMLRoot.h" #include "RenderMathMLRow.h" +#include "RenderMathMLSquareRoot.h" #include "RenderMathMLSubSup.h" #include "RenderMathMLUnderOver.h" @@ -72,6 +74,10 @@ RenderObject* MathMLInlineContainerElement::createRenderer(RenderArena *arena, R object = new (arena) RenderMathMLUnderOver(this); else if (hasLocalName(MathMLNames::mfracTag)) object = new (arena) RenderMathMLFraction(this); + else if (hasLocalName(MathMLNames::msqrtTag)) + object = new (arena) RenderMathMLSquareRoot(this); + else if (hasLocalName(MathMLNames::mrootTag)) + object = new (arena) RenderMathMLRoot(this); else object = new (arena) RenderMathMLBlock(this); object->setStyle(style); diff --git a/WebCore/mathml/RenderMathMLOperator.cpp b/WebCore/mathml/RenderMathMLOperator.cpp index da9e8ec..1ab3409 100644 --- a/WebCore/mathml/RenderMathMLOperator.cpp +++ b/WebCore/mathml/RenderMathMLOperator.cpp @@ -193,7 +193,7 @@ void RenderMathMLOperator::updateFromElement() text = new (renderArena()) RenderText(node(), StringImpl::create(&m_operator, 1)); else if (node()->nodeType() == Node::ELEMENT_NODE) if (Element* mo = static_cast<Element*>(node())) - text = new (renderArena()) RenderText(node(), StringImpl::create(mo->textContent())); + text = new (renderArena()) RenderText(node(), StringImpl::create(mo->textContent().characters(), mo->textContent().length())); // If we can't figure out the text, leave it blank. if (text) { text->setStyle(container->style()); diff --git a/WebCore/mathml/RenderMathMLRoot.cpp b/WebCore/mathml/RenderMathMLRoot.cpp new file mode 100644 index 0000000..23e3519 --- /dev/null +++ b/WebCore/mathml/RenderMathMLRoot.cpp @@ -0,0 +1,251 @@ +/* + * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. + * Copyright (C) 2010 François Sausset (sausset@gmail.com). All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, 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 COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(MATHML) + +#include "RenderMathMLRoot.h" + +#include "GraphicsContext.h" +#include "MathMLNames.h" + +namespace WebCore { + +using namespace MathMLNames; + +// Left margin of the radical (px) +const int gRadicalLeftMargin = 3; +// Bottom padding of the radical (px) +const int gRadicalBasePad = 3; +// Threshold above which the radical shape is modified to look nice with big bases (%) +const float gThresholdBaseHeight = 1.5; +// Radical width (%) +const float gRadicalWidth = 0.75; +// Horizontal position of the bottom point of the radical (%) +const float gRadicalBottomPointXPos= 0.5; +// Horizontal position of the top left point of the radical (%) +const float gRadicalTopLeftPointXPos = 0.8; +// Vertical position of the top left point of the radical (%) +const float gRadicalTopLeftPointYPos = 0.625; +// Vertical shift of the left end point of the radical (%) +const float gRadicalLeftEndYShift = 0.05; +// Root padding around the base (%) +const float gRootPadding = 0.2; +// Additional bottom root padding (%) +const float gRootBottomPadding = 0.2; + +// Radical line thickness (%) +const float gRadicalLineThickness = 0.02; +// Radical thick line thickness (%) +const float gRadicalThickLineThickness = 0.1; + +RenderMathMLRoot::RenderMathMLRoot(Node *expression) +: RenderMathMLBlock(expression) +{ +} + +void RenderMathMLRoot::addChild(RenderObject* child, RenderObject* ) +{ + if (isEmpty()) { + // Add a block for the index + RenderBlock* block = new (renderArena()) RenderBlock(node()); + RefPtr<RenderStyle> indexStyle = makeBlockStyle(); + indexStyle->setDisplay(INLINE_BLOCK); + block->setStyle(indexStyle.release()); + RenderBlock::addChild(block); + + // FIXME: the wrapping does not seem to be needed anymore. + // this is the base, so wrap it so we can pad it + block = new (renderArena()) RenderBlock(node()); + RefPtr<RenderStyle> baseStyle = makeBlockStyle(); + baseStyle->setDisplay(INLINE_BLOCK); + baseStyle->setPaddingLeft(Length(5 * gRadicalWidth , Percent)); + block->setStyle(baseStyle.release()); + RenderBlock::addChild(block); + block->addChild(child); + } else { + // always add to the index + firstChild()->addChild(child); + } +} + +void RenderMathMLRoot::paint(PaintInfo& info, int tx, int ty) +{ + RenderMathMLBlock::paint(info , tx , ty); + + tx += x(); + ty += y(); + + RenderBoxModelObject* indexBox = toRenderBoxModelObject(lastChild()); + + int maxHeight = indexBox->offsetHeight(); + // default to the font size in pixels if we're empty + if (!maxHeight) + maxHeight = style()->fontSize(); + int width = indexBox->offsetWidth(); + + int indexWidth = 0; + RenderObject* current = firstChild(); + while (current != lastChild()) { + if (current->isBoxModelObject()) { + RenderBoxModelObject* box = toRenderBoxModelObject(current); + indexWidth += box->offsetWidth(); + } + current = current->nextSibling(); + } + + int frontWidth = static_cast<int>(style()->fontSize() * gRadicalWidth); + int topStartShift = 0; + // Base height above which the shape of the root changes + int thresholdHeight = static_cast<int>(gThresholdBaseHeight * style()->fontSize()); + + if (maxHeight > thresholdHeight && thresholdHeight) { + float shift = (maxHeight - thresholdHeight) / static_cast<float>(thresholdHeight); + if (shift > 1.) + shift = 1.; + topStartShift = static_cast<int>(gRadicalBottomPointXPos * frontWidth * shift); + } + + width += topStartShift; + + int rootPad = static_cast<int>(gRootPadding * style()->fontSize()); + int start = tx + indexWidth + gRadicalLeftMargin + style()->paddingLeft().value() - rootPad; + ty += style()->paddingTop().value() - rootPad; + + FloatPoint topStart(start - topStartShift, ty); + FloatPoint bottomLeft(start - gRadicalBottomPointXPos * frontWidth , ty + maxHeight + gRadicalBasePad); + FloatPoint topLeft(start - gRadicalTopLeftPointXPos * frontWidth , ty + gRadicalTopLeftPointYPos * maxHeight); + FloatPoint leftEnd(start - frontWidth , topLeft.y() + gRadicalLeftEndYShift * style()->fontSize()); + + info.context->save(); + + info.context->setStrokeThickness(gRadicalLineThickness * style()->fontSize()); + info.context->setStrokeStyle(SolidStroke); + info.context->setStrokeColor(style()->color(), sRGBColorSpace); + info.context->setLineJoin(MiterJoin); + info.context->setMiterLimit(style()->fontSize()); + + Path root; + + root.moveTo(FloatPoint(topStart.x() + width, ty)); + // draw top + root.addLineTo(topStart); + // draw from top left corner to bottom point of radical + root.addLineTo(bottomLeft); + // draw from bottom point to top of left part of radical base "pocket" + root.addLineTo(topLeft); + // draw to end + root.addLineTo(leftEnd); + + info.context->beginPath(); + info.context->addPath(root); + info.context->strokePath(); + + info.context->save(); + + // Build a mask to draw the thick part of the root. + Path mask; + + mask.moveTo(topStart); + mask.addLineTo(bottomLeft); + mask.addLineTo(topLeft); + mask.addLineTo(FloatPoint(2 * topLeft.x() - leftEnd.x(), 2 * topLeft.y() - leftEnd.y())); + + info.context->beginPath(); + info.context->addPath(mask); + info.context->clip(mask); + + // Draw the thick part of the root. + info.context->setStrokeThickness(gRadicalThickLineThickness * style()->fontSize()); + info.context->setLineCap(SquareCap); + + Path line; + + line = line.createLine(bottomLeft, topLeft); + + info.context->beginPath(); + info.context->addPath(line); + info.context->strokePath(); + + info.context->restore(); + + info.context->restore(); + +} + +void RenderMathMLRoot::layout() +{ + RenderBlock::layout(); + + int maxHeight = toRenderBoxModelObject(lastChild())->offsetHeight(); + + RenderObject* current = lastChild()->firstChild(); + + toRenderMathMLBlock(current)->style()->setVerticalAlign(BASELINE); + + if (!maxHeight) + maxHeight = style()->fontSize(); + + // Base height above which the shape of the root changes + int thresholdHeight = static_cast<int>(gThresholdBaseHeight * style()->fontSize()); + int topStartShift = 0; + + if (maxHeight > thresholdHeight && thresholdHeight) { + float shift = (maxHeight - thresholdHeight) / static_cast<float>(thresholdHeight); + if (shift > 1.) + shift = 1.; + int frontWidth = static_cast<int>(style()->fontSize() * gRadicalWidth); + topStartShift = static_cast<int>(gRadicalBottomPointXPos * frontWidth * shift); + + style()->setPaddingBottom(Length(static_cast<int>(gRootBottomPadding * style()->fontSize()), Fixed)); + } + + // Positioning of the index + RenderBoxModelObject* indexBox = toRenderBoxModelObject(firstChild()->firstChild()); + + int indexShift = indexBox->offsetWidth() + topStartShift; + int radicalHeight = static_cast<int>((1 - gRadicalTopLeftPointYPos) * maxHeight); + int rootMarginTop = radicalHeight + style()->paddingBottom().value() + indexBox->offsetHeight() - (maxHeight + static_cast<int>(gRootPadding * style()->fontSize())); + + style()->setPaddingLeft(Length(indexShift, Fixed)); + if (rootMarginTop > 0) + style()->setPaddingTop(Length(rootMarginTop + static_cast<int>(gRootPadding * style()->fontSize()), Fixed)); + + setNeedsLayoutAndPrefWidthsRecalc(); + markContainingBlocksForLayout(); + RenderBlock::layout(); + + indexBox->style()->setBottom(Length(radicalHeight + style()->paddingBottom().value(), Fixed)); + + indexBox->layout(); +} + +} + +#endif // ENABLE(MATHML) + + diff --git a/WebCore/mathml/RenderMathMLRoot.h b/WebCore/mathml/RenderMathMLRoot.h new file mode 100644 index 0000000..80f56ac --- /dev/null +++ b/WebCore/mathml/RenderMathMLRoot.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, 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 COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RenderMathMLRoot_h +#define RenderMathMLRoot_h + +#if ENABLE(MATHML) + +#include "RenderMathMLBlock.h" + +namespace WebCore { + +class RenderMathMLRoot : public RenderMathMLBlock { +public: + RenderMathMLRoot(Node* fraction); + virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0); + virtual void paint(PaintInfo&, int tx, int ty); +protected: + virtual void layout(); +}; + +} + +#endif // ENABLE(MATHML) + +#endif // RenderMathMLRoot_h diff --git a/WebCore/mathml/RenderMathMLSquareRoot.cpp b/WebCore/mathml/RenderMathMLSquareRoot.cpp new file mode 100644 index 0000000..fc0a16d --- /dev/null +++ b/WebCore/mathml/RenderMathMLSquareRoot.cpp @@ -0,0 +1,200 @@ +/* + * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. + * Copyright (C) 2010 François Sausset (sausset@gmail.com). All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, 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 COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(MATHML) + +#include "RenderMathMLSquareRoot.h" + +#include "GraphicsContext.h" +#include "MathMLNames.h" +#include "Path.h" + +namespace WebCore { + +using namespace MathMLNames; + +// Bottom padding of the radical (px) +const int gRadicalBasePad = 3; +// Threshold above which the radical shape is modified to look nice with big bases (%) +const float gThresholdBaseHeight = 1.5; +// Radical width (%) +const float gRadicalWidth = 0.75; +// Horizontal position of the bottom point of the radical (%) +const float gRadicalBottomPointXPos= 0.5; +// Horizontal position of the top left point of the radical (%) +const float gRadicalTopLeftPointXPos = 0.2; +// Vertical position of the top left point of the radical (%) +const float gRadicalTopLeftPointYPos = 0.5; +// Vertical shift of the left end point of the radical (%) +const float gRadicalLeftEndYShift = 0.05; +// Additional bottom root padding (%) +const float gRootBottomPadding = 0.2; + +// Radical line thickness (%) +const float gRadicalLineThickness = 0.02; +// Radical thick line thickness (%) +const float gRadicalThickLineThickness = 0.1; + +RenderMathMLSquareRoot::RenderMathMLSquareRoot(Node *expression) + : RenderMathMLBlock(expression) +{ +} + +void RenderMathMLSquareRoot::paint(PaintInfo& info, int tx, int ty) +{ + RenderMathMLBlock::paint(info, tx, ty); + + tx += x(); + ty += y(); + + int maxHeight = 0; + int width = 0; + RenderObject* current = firstChild(); + while (current) { + if (current->isBoxModelObject()) { + + RenderBoxModelObject* box = toRenderBoxModelObject(current); + + // Check to see if this box has a larger height + if (box->offsetHeight() > maxHeight) + maxHeight = box->offsetHeight(); + width += box->offsetWidth(); + } + current = current->nextSibling(); + } + // default to the font size in pixels if we're empty + if (!maxHeight) + maxHeight = style()->fontSize(); + + int frontWidth = static_cast<int>(style()->fontSize() * gRadicalWidth); + int topStartShift = 0; + // Base height above which the shape of the root changes + int thresholdHeight = static_cast<int>(gThresholdBaseHeight * style()->fontSize()); + + if (maxHeight > thresholdHeight && thresholdHeight) { + float shift = (maxHeight - thresholdHeight) / static_cast<float>(thresholdHeight); + if (shift > 1.) + shift = 1.; + topStartShift = static_cast<int>(gRadicalBottomPointXPos * frontWidth * shift); + } + + width += topStartShift; + + FloatPoint topStart(tx + frontWidth - topStartShift, ty); + FloatPoint bottomLeft(tx + frontWidth * gRadicalBottomPointXPos , ty + maxHeight + gRadicalBasePad); + FloatPoint topLeft(tx + frontWidth * gRadicalTopLeftPointXPos , ty + gRadicalTopLeftPointYPos * maxHeight); + FloatPoint leftEnd(tx , topLeft.y() + gRadicalLeftEndYShift * style()->fontSize()); + + info.context->save(); + + info.context->setStrokeThickness(gRadicalLineThickness * style()->fontSize()); + info.context->setStrokeStyle(SolidStroke); + info.context->setStrokeColor(style()->color(), sRGBColorSpace); + info.context->setLineJoin(MiterJoin); + info.context->setMiterLimit(style()->fontSize()); + + Path root; + + root.moveTo(FloatPoint(topStart.x() + width , ty)); + // draw top + root.addLineTo(topStart); + // draw from top left corner to bottom point of radical + root.addLineTo(bottomLeft); + // draw from bottom point to top of left part of radical base "pocket" + root.addLineTo(topLeft); + // draw to end + root.addLineTo(leftEnd); + + info.context->beginPath(); + info.context->addPath(root); + info.context->strokePath(); + + info.context->save(); + + // Build a mask to draw the thick part of the root. + Path mask; + + mask.moveTo(topStart); + mask.addLineTo(bottomLeft); + mask.addLineTo(topLeft); + mask.addLineTo(FloatPoint(2 * topLeft.x() - leftEnd.x(), 2 * topLeft.y() - leftEnd.y())); + + info.context->beginPath(); + info.context->addPath(mask); + info.context->clip(mask); + + // Draw the thick part of the root. + info.context->setStrokeThickness(gRadicalThickLineThickness * style()->fontSize()); + info.context->setLineCap(SquareCap); + + Path line; + + line = line.createLine(bottomLeft, topLeft); + + info.context->beginPath(); + info.context->addPath(line); + info.context->strokePath(); + + info.context->restore(); + + info.context->restore(); +} + +void RenderMathMLSquareRoot::layout() +{ + int maxHeight = 0; + + RenderObject* current = firstChild(); + while (current) { + if (current->isBoxModelObject()) { + RenderBoxModelObject* box = toRenderBoxModelObject(current); + + if (box->offsetHeight() > maxHeight) + maxHeight = box->offsetHeight(); + + box->style()->setVerticalAlign(BASELINE); + } + current = current->nextSibling(); + } + + if (!maxHeight) + maxHeight = style()->fontSize(); + + + if (maxHeight > static_cast<int>(gThresholdBaseHeight * style()->fontSize())) + style()->setPaddingBottom(Length(static_cast<int>(gRootBottomPadding * style()->fontSize()), Fixed)); + + + RenderBlock::layout(); +} + +} + +#endif // ENABLE(MATHML) + + diff --git a/WebCore/mathml/RenderMathMLSquareRoot.h b/WebCore/mathml/RenderMathMLSquareRoot.h new file mode 100644 index 0000000..d40b1ba --- /dev/null +++ b/WebCore/mathml/RenderMathMLSquareRoot.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, 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 COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RenderMathMLSquareRoot_h +#define RenderMathMLSquareRoot_h + +#if ENABLE(MATHML) + +#include "RenderMathMLBlock.h" + +namespace WebCore { + +class RenderMathMLSquareRoot : public RenderMathMLBlock { +public: + RenderMathMLSquareRoot(Node* fraction); + virtual void paint(PaintInfo&, int tx, int ty); +protected: + virtual void layout(); +}; + +} + +#endif // ENABLE(MATHML) + +#endif // RenderMathMLSquareRoot_h + + + diff --git a/WebCore/notifications/Notification.h b/WebCore/notifications/Notification.h index 98cbfdf..47de2a2 100644 --- a/WebCore/notifications/Notification.h +++ b/WebCore/notifications/Notification.h @@ -68,6 +68,11 @@ namespace WebCore { KURL iconURL() { return m_contents.icon(); } NotificationContents& contents() { return m_contents; } + String dir() const { return m_direction; } + void setDir(const String& dir) { m_direction = dir; } + String replaceId() const { return m_replaceId; } + void setReplaceId(const String& replaceId) { m_replaceId = replaceId; } + DEFINE_ATTRIBUTE_EVENT_LISTENER(display); DEFINE_ATTRIBUTE_EVENT_LISTENER(error); DEFINE_ATTRIBUTE_EVENT_LISTENER(close); @@ -93,6 +98,9 @@ namespace WebCore { KURL m_notificationURL; NotificationContents m_contents; + String m_direction; + String m_replaceId; + bool m_isShowing; NotificationPresenter* m_presenter; diff --git a/WebCore/notifications/Notification.idl b/WebCore/notifications/Notification.idl index b99da96..5ca84a5 100644 --- a/WebCore/notifications/Notification.idl +++ b/WebCore/notifications/Notification.idl @@ -42,13 +42,16 @@ module threads { attribute EventListener onerror; attribute EventListener onclose; + attribute DOMString dir; + attribute DOMString replaceId; + // EventTarget interface - [JSCCustom] void addEventListener(in DOMString type, - in EventListener listener, - in boolean useCapture); - [JSCCustom] void removeEventListener(in DOMString type, - in EventListener listener, - in boolean useCapture); + void addEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); + void removeEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); boolean dispatchEvent(in Event evt) raises(EventException); }; diff --git a/WebCore/page/AbstractView.idl b/WebCore/page/AbstractView.idl index 290bf48..e4ece0f 100644 --- a/WebCore/page/AbstractView.idl +++ b/WebCore/page/AbstractView.idl @@ -32,7 +32,7 @@ module views { OmitConstructor ] AbstractView { readonly attribute Document document; - readonly attribute Media media; + readonly attribute Media styleMedia; }; } diff --git a/WebCore/page/Chrome.cpp b/WebCore/page/Chrome.cpp index 841908d..799aaee 100644 --- a/WebCore/page/Chrome.cpp +++ b/WebCore/page/Chrome.cpp @@ -107,9 +107,10 @@ void Chrome::contentsSizeChanged(Frame* frame, const IntSize& size) const m_client->contentsSizeChanged(frame, size); } -void Chrome::scrollRectIntoView(const IntRect& rect, const ScrollView* scrollView) const +void Chrome::scrollRectIntoView(const IntRect& rect) const { - m_client->scrollRectIntoView(rect, scrollView); + // FIXME: The unused ScrollView* argument can and should be removed from ChromeClient::scrollRectIntoView. + m_client->scrollRectIntoView(rect, 0); } void Chrome::scrollbarsModeDidChange() const diff --git a/WebCore/page/Chrome.h b/WebCore/page/Chrome.h index 658404a..3882f5e 100644 --- a/WebCore/page/Chrome.h +++ b/WebCore/page/Chrome.h @@ -68,9 +68,10 @@ namespace WebCore { virtual IntPoint screenToWindow(const IntPoint&) const; virtual IntRect windowToScreen(const IntRect&) const; virtual PlatformPageClient platformPageClient() const; - virtual void scrollRectIntoView(const IntRect&, const ScrollView*) const; virtual void scrollbarsModeDidChange() const; + void scrollRectIntoView(const IntRect&) const; + void contentsSizeChanged(Frame*, const IntSize&) const; void setWindowRect(const FloatRect&) const; diff --git a/WebCore/page/Console.cpp b/WebCore/page/Console.cpp index d5ff7bc..864b834 100644 --- a/WebCore/page/Console.cpp +++ b/WebCore/page/Console.cpp @@ -289,6 +289,7 @@ void Console::markTimeline(ScriptCallStack* callStack) #if ENABLE(WML) String Console::lastWMLErrorMessage() const { +#if ENABLE(INSPECTOR) Page* page = this->page(); if (!page) return String(); @@ -307,7 +308,7 @@ String Console::lastWMLErrorMessage() const return message->message(); } - +#endif return String(); } #endif diff --git a/WebCore/page/DOMWindow.cpp b/WebCore/page/DOMWindow.cpp index c74cfaf..633feb6 100644 --- a/WebCore/page/DOMWindow.cpp +++ b/WebCore/page/DOMWindow.cpp @@ -58,7 +58,7 @@ #include "InspectorController.h" #include "InspectorTimelineAgent.h" #include "Location.h" -#include "Media.h" +#include "StyleMedia.h" #include "MessageEvent.h" #include "Navigator.h" #include "NotificationCenter.h" @@ -575,7 +575,7 @@ Location* DOMWindow::location() const } #if ENABLE(DOM_STORAGE) -Storage* DOMWindow::sessionStorage() const +Storage* DOMWindow::sessionStorage(ExceptionCode& ec) const { if (m_sessionStorage) return m_sessionStorage.get(); @@ -584,6 +584,11 @@ Storage* DOMWindow::sessionStorage() const if (!document) return 0; + if (!document->securityOrigin()->canAccessLocalStorage()) { + ec = SECURITY_ERR; + return 0; + } + Page* page = document->page(); if (!page) return 0; @@ -601,16 +606,16 @@ Storage* DOMWindow::localStorage(ExceptionCode& ec) const { if (m_localStorage) return m_localStorage.get(); - + Document* document = this->document(); if (!document) return 0; - + if (!document->securityOrigin()->canAccessLocalStorage()) { ec = SECURITY_ERR; return 0; } - + Page* page = document->page(); if (!page) return 0; @@ -1136,10 +1141,10 @@ Document* DOMWindow::document() const return m_frame->document(); } -PassRefPtr<Media> DOMWindow::media() const +PassRefPtr<StyleMedia> DOMWindow::styleMedia() const { if (!m_media) - m_media = Media::create(m_frame); + m_media = StyleMedia::create(m_frame); return m_media.get(); } diff --git a/WebCore/page/DOMWindow.h b/WebCore/page/DOMWindow.h index c3a781c..e4aa4cb 100644 --- a/WebCore/page/DOMWindow.h +++ b/WebCore/page/DOMWindow.h @@ -56,7 +56,7 @@ namespace WebCore { class IndexedDatabaseRequest; class InspectorTimelineAgent; class Location; - class Media; + class StyleMedia; class Navigator; class Node; class NotificationCenter; @@ -187,7 +187,7 @@ namespace WebCore { // DOM Level 2 AbstractView Interface Document* document() const; // CSSOM View Module - PassRefPtr<Media> media() const; + PassRefPtr<StyleMedia> styleMedia() const; // DOM Level 2 Style Interface PassRefPtr<CSSStyleDeclaration> getComputedStyle(Element*, const String& pseudoElt) const; @@ -206,7 +206,7 @@ namespace WebCore { #if ENABLE(DOM_STORAGE) // HTML 5 key/value storage - Storage* sessionStorage() const; + Storage* sessionStorage(ExceptionCode&) const; Storage* localStorage(ExceptionCode&) const; #endif @@ -353,7 +353,7 @@ namespace WebCore { Console* optionalConsole() const { return m_console.get(); } Navigator* optionalNavigator() const { return m_navigator.get(); } Location* optionalLocation() const { return m_location.get(); } - Media* optionalMedia() const { return m_media.get(); } + StyleMedia* optionalMedia() const { return m_media.get(); } #if ENABLE(DOM_STORAGE) Storage* optionalSessionStorage() const { return m_sessionStorage.get(); } Storage* optionalLocalStorage() const { return m_localStorage.get(); } @@ -390,7 +390,7 @@ namespace WebCore { mutable RefPtr<Console> m_console; mutable RefPtr<Navigator> m_navigator; mutable RefPtr<Location> m_location; - mutable RefPtr<Media> m_media; + mutable RefPtr<StyleMedia> m_media; #if ENABLE(DOM_STORAGE) mutable RefPtr<Storage> m_sessionStorage; mutable RefPtr<Storage> m_localStorage; diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl index 018b4de..a1ce419 100644 --- a/WebCore/page/DOMWindow.idl +++ b/WebCore/page/DOMWindow.idl @@ -141,7 +141,7 @@ module window { readonly attribute Document document; // CSSOM View Module - readonly attribute Media media; + readonly attribute StyleMedia styleMedia; // DOM Level 2 Style Interface CSSStyleDeclaration getComputedStyle(in Element element, @@ -164,7 +164,8 @@ module window { raises(DOMException); #endif #if defined(ENABLE_DOM_STORAGE) && ENABLE_DOM_STORAGE - readonly attribute [EnabledAtRuntime] Storage sessionStorage; + readonly attribute [EnabledAtRuntime] Storage sessionStorage + getter raises(DOMException); readonly attribute [EnabledAtRuntime] Storage localStorage getter raises(DOMException); #endif @@ -294,10 +295,10 @@ module window { #if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS attribute EventListener onorientationchange; #endif - attribute [DontEnum,Conditional=TOUCH_EVENTS] EventListener ontouchstart; - attribute [DontEnum,Conditional=TOUCH_EVENTS] EventListener ontouchmove; - attribute [DontEnum,Conditional=TOUCH_EVENTS] EventListener ontouchend; - attribute [DontEnum,Conditional=TOUCH_EVENTS] EventListener ontouchcancel; + attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchstart; + attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchmove; + attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchend; + attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchcancel; // EventTarget interface [Custom] void addEventListener(in DOMString type, @@ -715,6 +716,8 @@ module window { attribute DOMFormDataConstructor FormData; + attribute [Conditional=FILE_READER|FILE_WRITER] FileErrorConstructor FileError; + #endif // defined(LANGUAGE_JAVASCRIPT) #if defined(V8_BINDING) && V8_BINDING diff --git a/WebCore/page/DragController.cpp b/WebCore/page/DragController.cpp index f238b27..c603996 100644 --- a/WebCore/page/DragController.cpp +++ b/WebCore/page/DragController.cpp @@ -115,8 +115,15 @@ static PassRefPtr<DocumentFragment> documentFragmentFromDragData(DragData* dragD if (!url.isEmpty()) { RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::create(document); anchor->setHref(url); - ExceptionCode ec; + if (title.isEmpty()) { + // Try the plain text first because the url might be normalized or escaped. + if (dragData->containsPlainText()) + title = dragData->asPlainText(); + if (title.isEmpty()) + title = url; + } RefPtr<Node> anchorText = document->createTextNode(title); + ExceptionCode ec; anchor->appendChild(anchorText, ec); RefPtr<DocumentFragment> fragment = document->createDocumentFragment(); fragment->appendChild(anchor, ec); @@ -313,7 +320,7 @@ bool DragController::tryDocumentDrag(DragData* dragData, DragDestinationAction a } IntPoint point = frameView->windowToContents(dragData->clientPosition()); - Element* element = elementUnderMouse(m_documentUnderMouse, point); + Element* element = elementUnderMouse(m_documentUnderMouse.get(), point); if (!asFileInput(element)) { VisibleSelection dragCaret = m_documentUnderMouse->frame()->visiblePositionForPoint(point); m_page->dragCaretController()->setSelection(dragCaret); @@ -363,7 +370,7 @@ bool DragController::concludeEditDrag(DragData* dragData) return false; IntPoint point = m_documentUnderMouse->view()->windowToContents(dragData->clientPosition()); - Element* element = elementUnderMouse(m_documentUnderMouse, point); + Element* element = elementUnderMouse(m_documentUnderMouse.get(), point); Frame* innerFrame = element->ownerDocument()->frame(); ASSERT(innerFrame); @@ -439,7 +446,7 @@ bool DragController::concludeEditDrag(DragData* dragData) applyCommand(MoveSelectionCommand::create(fragment, dragCaret.base(), smartInsert, smartDelete)); } else { if (setSelectionToDragCaret(innerFrame, dragCaret, range, point)) - applyCommand(ReplaceSelectionCommand::create(m_documentUnderMouse, fragment, true, dragData->canSmartReplace(), chosePlainText)); + applyCommand(ReplaceSelectionCommand::create(m_documentUnderMouse.get(), fragment, true, dragData->canSmartReplace(), chosePlainText)); } } else { String text = dragData->asPlainText(); @@ -450,7 +457,7 @@ bool DragController::concludeEditDrag(DragData* dragData) m_client->willPerformDragDestinationAction(DragDestinationActionEdit, dragData); if (setSelectionToDragCaret(innerFrame, dragCaret, range, point)) - applyCommand(ReplaceSelectionCommand::create(m_documentUnderMouse, createFragmentFromText(range.get(), text), true, false, true)); + applyCommand(ReplaceSelectionCommand::create(m_documentUnderMouse.get(), createFragmentFromText(range.get(), text), true, false, true)); } loader->setAllowStaleResources(false); diff --git a/WebCore/page/DragController.h b/WebCore/page/DragController.h index 3b2b083..712f9ab 100644 --- a/WebCore/page/DragController.h +++ b/WebCore/page/DragController.h @@ -67,13 +67,11 @@ namespace WebCore { DragOperation sourceDragOperation() const { return m_sourceDragOperation; } void setDraggingImageURL(const KURL& url) { m_draggingImageURL = url; } const KURL& draggingImageURL() const { return m_draggingImageURL; } - void setDragInitiator(Document* initiator) { m_dragInitiator = initiator; m_didInitiateDrag = true; } - Document* dragInitiator() const { return m_dragInitiator; } void setDragOffset(const IntPoint& offset) { m_dragOffset = offset; } const IntPoint& dragOffset() const { return m_dragOffset; } DragSourceAction dragSourceAction() const { return m_dragSourceAction; } - Document* documentUnderMouse() const { return m_documentUnderMouse; } + Document* documentUnderMouse() const { return m_documentUnderMouse.get(); } DragDestinationAction dragDestinationAction() const { return m_dragDestinationAction; } DragSourceAction delegateDragSourceAction(const IntPoint& pagePoint); @@ -114,8 +112,8 @@ namespace WebCore { Page* m_page; DragClient* m_client; - Document* m_documentUnderMouse; // The document the mouse was last dragged over. - Document* m_dragInitiator; // The Document (if any) that initiated the drag. + RefPtr<Document> m_documentUnderMouse; // The document the mouse was last dragged over. + RefPtr<Document> m_dragInitiator; // The Document (if any) that initiated the drag. DragDestinationAction m_dragDestinationAction; DragSourceAction m_dragSourceAction; diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp index d775e89..8f63144 100644 --- a/WebCore/page/EventHandler.cpp +++ b/WebCore/page/EventHandler.cpp @@ -69,6 +69,7 @@ #include "SelectionController.h" #include "Settings.h" #include "TextEvent.h" +#include "TextIterator.h" #include "UserGestureIndicator.h" #include "WheelEvent.h" #include "htmlediting.h" // for comparePositions() @@ -145,7 +146,7 @@ static inline bool scrollNode(float delta, WheelEvent::Granularity granularity, return false; } -#if !PLATFORM(MAC) || ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE) +#if !PLATFORM(MAC) inline bool EventHandler::eventLoopHandleMouseUp(const MouseEventWithHitTestResults&) { @@ -190,7 +191,7 @@ EventHandler::EventHandler(Frame* frame) , m_mouseDownTimestamp(0) , m_useLatchedWheelEventNode(false) , m_widgetIsLatched(false) -#if PLATFORM(MAC) && !ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE) +#if PLATFORM(MAC) , m_mouseDownView(nil) , m_sendingEventToSubview(false) , m_activationEventNumber(0) @@ -339,6 +340,12 @@ bool EventHandler::handleMousePressEventTripleClick(const MouseEventWithHitTestR return true; } +static int textDistance(const Position& start, const Position& end) +{ + RefPtr<Range> range = Range::create(start.node()->document(), start, end); + return TextIterator::rangeLength(range.get(), true); +} + bool EventHandler::handleMousePressEventSingleClick(const MouseEventWithHitTestResults& event) { Node* innerNode = event.targetNode(); @@ -369,14 +376,21 @@ bool EventHandler::handleMousePressEventSingleClick(const MouseEventWithHitTestR if (extendSelection && newSelection.isCaretOrRange()) { m_frame->selection()->setIsDirectional(false); - // See <rdar://problem/3668157> REGRESSION (Mail): shift-click deselects when selection - // was created right-to-left - Position start = newSelection.start(); - Position end = newSelection.end(); - if (comparePositions(pos, start) <= 0) - newSelection = VisibleSelection(pos, end); - else - newSelection = VisibleSelection(start, pos); + ASSERT(m_frame->settings()); + if (m_frame->settings()->editingBehavior() == EditingMacBehavior) { + // See <rdar://problem/3668157> REGRESSION (Mail): shift-click deselects when selection + // was created right-to-left + Position start = newSelection.start(); + Position end = newSelection.end(); + int distanceToStart = textDistance(start, pos); + int distanceToEnd = textDistance(pos, end); + if (distanceToStart <= distanceToEnd) + newSelection = VisibleSelection(end, pos); + else + newSelection = VisibleSelection(start, pos); + } else { + newSelection.setExtent(pos); + } if (m_frame->selectionGranularity() != CharacterGranularity) { granularity = m_frame->selectionGranularity(); @@ -449,7 +463,6 @@ bool EventHandler::handleMousePressEvent(const MouseEventWithHitTestResults& eve #endif bool swallowEvent = false; - m_frame->selection()->setCaretBlinkingSuspended(true); m_mousePressed = true; m_beganSelectingText = false; @@ -466,6 +479,30 @@ bool EventHandler::handleMousePressEvent(const MouseEventWithHitTestResults& eve return swallowEvent; } +// There are two kinds of renderer that can autoscroll. +static bool canAutoscroll(RenderObject* renderer) +{ + if (!renderer->isBox()) + return false; + + // Check for a box that can be scrolled in its own right. + if (toRenderBox(renderer)->canBeScrolledAndHasScrollableArea()) + return true; + + // Check for a box that represents the top level of a web page. + // This can be scrolled by calling Chrome::scrollRectIntoView. + // This only has an effect on the Mac platform in applications + // that put web views into scrolling containers, such as Mac OS X Mail. + // The code for this is in RenderLayer::scrollRectToVisible. + if (renderer->node() != renderer->document()) + return false; + Frame* frame = renderer->document()->frame(); + if (!frame) + return false; + Page* page = frame->page(); + return page && page->mainFrame() == frame; +} + #if ENABLE(DRAG_SUPPORT) bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& event) { @@ -486,10 +523,9 @@ bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& e m_mouseDownMayStartDrag = false; if (m_mouseDownMayStartAutoscroll && !m_panScrollInProgress) { - // If the selection is contained in a layer that can scroll, that layer should handle the autoscroll - // Otherwise, let the bridge handle it so the view can scroll itself. + // Find a renderer that can autoscroll. RenderObject* renderer = targetNode->renderer(); - while (renderer && (!renderer->isBox() || !toRenderBox(renderer)->canBeScrolledAndHasScrollableArea())) { + while (renderer && !canAutoscroll(renderer)) { if (!renderer->parent() && renderer->node() == renderer->document() && renderer->document()->ownerElement()) renderer = renderer->document()->ownerElement()->renderer(); else @@ -607,7 +643,12 @@ void EventHandler::updateSelectionForMouseDrag(Node* targetNode, const IntPoint& } } #endif // ENABLE(DRAG_SUPPORT) - + +void EventHandler::lostMouseCapture() +{ + m_frame->selection()->setCaretBlinkingSuspended(false); +} + bool EventHandler::handleMouseUp(const MouseEventWithHitTestResults& event) { if (eventLoopHandleMouseUp(event)) @@ -792,7 +833,7 @@ void EventHandler::updateAutoscrollRenderer() if (Node* nodeAtPoint = hitTest.innerNode()) m_autoscrollRenderer = nodeAtPoint->renderer(); - while (m_autoscrollRenderer && (!m_autoscrollRenderer->isBox() || !toRenderBox(m_autoscrollRenderer)->canBeScrolledAndHasScrollableArea())) + while (m_autoscrollRenderer && !canAutoscroll(m_autoscrollRenderer)) m_autoscrollRenderer = m_autoscrollRenderer->parent(); } @@ -1256,6 +1297,8 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent) } } + m_frame->selection()->setCaretBlinkingSuspended(true); + bool swallowEvent = dispatchMouseEvent(eventNames().mousedownEvent, mev.targetNode(), true, m_clickCount, mouseEvent, true); m_capturesDragging = !swallowEvent; @@ -1483,7 +1526,7 @@ bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent) if (mouseEvent.button() == MiddleButton) m_panScrollButtonPressed = false; if (m_springLoadedPanScrollInProgress) - stopAutoscrollTimer(); + stopAutoscrollTimer(); #endif m_mousePressed = false; @@ -1666,7 +1709,7 @@ void EventHandler::clearDragState() m_dragTarget = 0; m_capturingMouseEventsNode = 0; m_shouldOnlyFireDragOverEvent = false; -#if PLATFORM(MAC) && !ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE) +#if PLATFORM(MAC) m_sendingEventToSubview = false; #endif } @@ -1790,8 +1833,15 @@ bool EventHandler::dispatchMouseEvent(const AtomicString& eventType, Node* targe if (m_nodeUnderMouse) swallowEvent = m_nodeUnderMouse->dispatchMouseEvent(mouseEvent, eventType, clickCount); - + if (!swallowEvent && eventType == eventNames().mousedownEvent) { + + // If clicking on a frame scrollbar, do not mess up with content focus. + if (FrameView* view = m_frame->view()) { + if (view->scrollbarAtPoint(mouseEvent.pos())) + return false; + } + // The layout needs to be up to date to determine if an element is focusable. m_frame->document()->updateLayoutIgnorePendingStylesheets(); @@ -2178,7 +2228,9 @@ bool EventHandler::keyEvent(const PlatformKeyboardEvent& initialKeyEvent) if (initialKeyEvent.type() == PlatformKeyboardEvent::RawKeyDown) { node->dispatchEvent(keydown, ec); - return keydown->defaultHandled() || keydown->defaultPrevented(); + // If frame changed as a result of keydown dispatch, then return true to avoid sending a subsequent keypress message to the new frame. + bool changedFocusedFrame = m_frame->page() && m_frame != m_frame->page()->focusController()->focusedOrMainFrame(); + return keydown->defaultHandled() || keydown->defaultPrevented() || changedFocusedFrame; } // Run input method in advance of DOM event handling. This may result in the IM @@ -2198,7 +2250,9 @@ bool EventHandler::keyEvent(const PlatformKeyboardEvent& initialKeyEvent) } node->dispatchEvent(keydown, ec); - bool keydownResult = keydown->defaultHandled() || keydown->defaultPrevented(); + // If frame changed as a result of keydown dispatch, then return early to avoid sending a subsequent keypress message to the new frame. + bool changedFocusedFrame = m_frame->page() && m_frame != m_frame->page()->focusController()->focusedOrMainFrame(); + bool keydownResult = keydown->defaultHandled() || keydown->defaultPrevented() || changedFocusedFrame; if (handledByInputMethod || (keydownResult && !backwardCompatibilityMode)) return keydownResult; diff --git a/WebCore/page/EventHandler.h b/WebCore/page/EventHandler.h index 282100d..c83925c 100644 --- a/WebCore/page/EventHandler.h +++ b/WebCore/page/EventHandler.h @@ -147,6 +147,8 @@ public: bool mouseMoved(const PlatformMouseEvent&); + void lostMouseCapture(); + bool handleMousePressEvent(const PlatformMouseEvent&); bool handleMouseMoveEvent(const PlatformMouseEvent&, HitTestResult* hoveredNode = 0); bool handleMouseReleaseEvent(const PlatformMouseEvent&); @@ -342,7 +344,7 @@ private: bool capturesDragging() const { return m_capturesDragging; } -#if PLATFORM(MAC) && defined(__OBJC__) && !ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE) +#if PLATFORM(MAC) && defined(__OBJC__) NSView *mouseDownViewIfStillGood(); PlatformMouseEvent currentPlatformMouseEvent() const; @@ -420,10 +422,8 @@ private: RefPtr<Node> m_previousWheelScrolledNode; #if PLATFORM(MAC) -#if !ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE) NSView *m_mouseDownView; bool m_sendingEventToSubview; -#endif int m_activationEventNumber; #endif #if ENABLE(TOUCH_EVENTS) diff --git a/WebCore/page/EventSource.idl b/WebCore/page/EventSource.idl index 57bd807..be01098 100644 --- a/WebCore/page/EventSource.idl +++ b/WebCore/page/EventSource.idl @@ -53,12 +53,12 @@ module window { void close(); // EventTarget interface - [JSCCustom] void addEventListener(in DOMString type, - in EventListener listener, - in boolean useCapture); - [JSCCustom] void removeEventListener(in DOMString type, - in EventListener listener, - in boolean useCapture); + void addEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); + void removeEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); boolean dispatchEvent(in Event evt) raises(EventException); diff --git a/WebCore/page/FocusController.cpp b/WebCore/page/FocusController.cpp index e07e2ea..372cb32 100644 --- a/WebCore/page/FocusController.cpp +++ b/WebCore/page/FocusController.cpp @@ -304,7 +304,7 @@ bool FocusController::advanceFocusDirectionally(FocusDirection direction, Keyboa frame = frame->tree()->top(); FocusCandidate focusCandidate; - findFocusableNodeInDirection(frame->document(), focusedNode, direction, event, focusCandidate); + findFocusableNodeInDirection(frame->document()->firstChild(), focusedNode, direction, event, focusCandidate); Node* node = focusCandidate.node; if (!node || !node->isElementNode()) { @@ -389,20 +389,23 @@ static void updateFocusCandidateIfCloser(Node* focusedNode, const FocusCandidate } } -void FocusController::findFocusableNodeInDirection(Document* document, Node* focusedNode, +void FocusController::findFocusableNodeInDirection(Node* outer, Node* focusedNode, FocusDirection direction, KeyboardEvent* event, FocusCandidate& closestFocusCandidate, const FocusCandidate& candidateParent) { - ASSERT(document); - ASSERT(candidateParent.isNull() || static_cast<HTMLFrameOwnerElement*>(candidateParent.node)); + ASSERT(outer); + ASSERT(candidateParent.isNull() + || candidateParent.node->hasTagName(frameTag) + || candidateParent.node->hasTagName(iframeTag)); // Walk all the child nodes and update closestFocusCandidate if we find a nearer node. - for (Node* candidate = document->firstChild(); candidate; candidate = candidate->traverseNextNode()) { + Node* candidate = outer; + while (candidate) { // Inner documents case. if (candidate->isFrameOwnerElement()) - deepFindFocusableNodeInDirection(focusedNode, candidate, direction, event, closestFocusCandidate); + deepFindFocusableNodeInDirection(candidate, focusedNode, direction, event, closestFocusCandidate); else if (candidate != focusedNode && candidate->isKeyboardFocusable(event)) { FocusCandidate currentFocusCandidate(candidate); @@ -410,8 +413,10 @@ void FocusController::findFocusableNodeInDirection(Document* document, Node* foc distanceDataForNode(direction, focusedNode, currentFocusCandidate); // Bail out if distance is maximum. - if (currentFocusCandidate.distance == maxDistance()) + if (currentFocusCandidate.distance == maxDistance()) { + candidate = candidate->traverseNextNode(outer->parent()); continue; + } // If candidateParent is not null, it means that we are in a recursive call // from deepFineFocusableNodeInDirection (i.e. processing an element in an iframe), @@ -423,33 +428,54 @@ void FocusController::findFocusableNodeInDirection(Document* document, Node* foc updateFocusCandidateIfCloser(focusedNode, currentFocusCandidate, closestFocusCandidate); } + + candidate = candidate->traverseNextNode(outer->parent()); } } -void FocusController::deepFindFocusableNodeInDirection(Node* focusedNode, Node* candidate, +void FocusController::deepFindFocusableNodeInDirection(Node* container, Node* focusedNode, FocusDirection direction, KeyboardEvent* event, FocusCandidate& closestFocusCandidate) { - HTMLFrameOwnerElement* owner = static_cast<HTMLFrameOwnerElement*>(candidate); - if (!owner->contentFrame()) + ASSERT(container->hasTagName(frameTag) || container->hasTagName(iframeTag)); + + // Track if focusedNode is a descendant of the current container node being processed. + bool descendantOfContainer = false; + Node* firstChild = 0; + + // Iframe or Frame. + if (container->hasTagName(frameTag) || container->hasTagName(iframeTag)) { + + HTMLFrameOwnerElement* owner = static_cast<HTMLFrameOwnerElement*>(container); + if (!owner->contentFrame()) + return; + + Document* innerDocument = owner->contentFrame()->document(); + if (!innerDocument) + return; + + descendantOfContainer = innerDocument == focusedNode->document(); + firstChild = innerDocument->firstChild(); + + } + + if (descendantOfContainer) { + findFocusableNodeInDirection(firstChild, focusedNode, direction, event, closestFocusCandidate); return; + } - Document* innerDocument = owner->contentFrame()->document(); - if (!innerDocument) + // Check if the current container element itself is a good candidate + // to move focus to. If it is, then we traverse its inner nodes. + FocusCandidate candidateParent = FocusCandidate(container); + distanceDataForNode(direction, focusedNode, candidateParent); + + // Bail out if distance is maximum. + if (candidateParent.distance == maxDistance()) return; - if (innerDocument == focusedNode->document()) - findFocusableNodeInDirection(innerDocument, focusedNode, direction, event, closestFocusCandidate); - else { - // Check if the current {i}frame element itself is a good candidate - // to move focus to. If it is, then we traverse its inner nodes. - FocusCandidate candidateParent = FocusCandidate(candidate); - distanceDataForNode(direction, focusedNode, candidateParent); - - // FIXME: Consider alignment? - if (candidateParent.distance < closestFocusCandidate.distance) - findFocusableNodeInDirection(innerDocument, focusedNode, direction, event, closestFocusCandidate, candidateParent); - } + // FIXME: Consider alignment? + if (candidateParent.distance < closestFocusCandidate.distance) + findFocusableNodeInDirection(firstChild, focusedNode, direction, event, closestFocusCandidate, candidateParent); } static bool relinquishesEditingFocus(Node *node) diff --git a/WebCore/page/FocusController.h b/WebCore/page/FocusController.h index dfa3780..4410833 100644 --- a/WebCore/page/FocusController.h +++ b/WebCore/page/FocusController.h @@ -63,9 +63,10 @@ private: bool advanceFocusDirectionally(FocusDirection, KeyboardEvent*); bool advanceFocusInDocumentOrder(FocusDirection, KeyboardEvent*, bool initialFocus); - void findFocusableNodeInDirection(Document*, Node*, FocusDirection, KeyboardEvent*, FocusCandidate& closestFocusCandidate, + void findFocusableNodeInDirection(Node* outter, Node*, FocusDirection, KeyboardEvent*, + FocusCandidate& closestFocusCandidate, const FocusCandidate& parentCandidate = FocusCandidate()); - void deepFindFocusableNodeInDirection(Node*, Node*, FocusDirection, KeyboardEvent*, FocusCandidate&); + void deepFindFocusableNodeInDirection(Node* container, Node* focused, FocusDirection, KeyboardEvent*, FocusCandidate&); Page* m_page; RefPtr<Frame> m_focusedFrame; diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp index c69b514..d6b6e71 100644 --- a/WebCore/page/FrameView.cpp +++ b/WebCore/page/FrameView.cpp @@ -484,8 +484,19 @@ void FrameView::setNeedsOneShotDrawingSynchronization() if (page) page->chrome()->client()->setNeedsOneShotDrawingSynchronization(); } + #endif // USE(ACCELERATED_COMPOSITING) +bool FrameView::isEnclosedInCompositingLayer() const +{ +#if USE(ACCELERATED_COMPOSITING) + RenderObject* frameOwnerRenderer = m_frame->ownerRenderer(); + return frameOwnerRenderer && frameOwnerRenderer->containerForRepaint(); +#else + return false; +#endif +} + bool FrameView::syncCompositingStateRecursive() { #if USE(ACCELERATED_COMPOSITING) @@ -1009,15 +1020,6 @@ void FrameView::maintainScrollPositionAtAnchor(Node* anchorNode) scrollToAnchor(); } -void FrameView::scrollRectIntoViewRecursively(const IntRect& r) -{ - bool wasInProgrammaticScroll = m_inProgrammaticScroll; - m_inProgrammaticScroll = true; - m_maintainScrollPositionAnchor = 0; - ScrollView::scrollRectIntoViewRecursively(r); - m_inProgrammaticScroll = wasInProgrammaticScroll; -} - void FrameView::setScrollPosition(const IntPoint& scrollPoint) { bool wasInProgrammaticScroll = m_inProgrammaticScroll; @@ -1460,7 +1462,7 @@ void FrameView::scrollToAnchor() if (AXObjectCache::accessibilityEnabled()) m_frame->document()->axObjectCache()->handleScrolledToAnchor(anchorNode.get()); - // scrollRectToVisible can call into scrollRectIntoViewRecursively(), which resets m_maintainScrollPositionAnchor. + // scrollRectToVisible can call into setScrollPosition(), which resets m_maintainScrollPositionAnchor. m_maintainScrollPositionAnchor = anchorNode; } @@ -1853,14 +1855,16 @@ void FrameView::paintContents(GraphicsContext* p, const IntRect& rect) // m_nodeToDraw is used to draw only one element (and its descendants) RenderObject* eltRenderer = m_nodeToDraw ? m_nodeToDraw->renderer() : 0; - PaintBehavior paintBehavior = m_paintBehavior; - if (paintBehavior == PaintBehaviorNormal) + PaintBehavior oldPaintBehavior = m_paintBehavior; + if (m_paintBehavior == PaintBehaviorNormal) document->invalidateRenderedRectsForMarkersInRect(rect); if (document->printing()) - paintBehavior |= PaintBehaviorFlattenCompositingLayers; + m_paintBehavior |= PaintBehaviorFlattenCompositingLayers; - contentRenderer->layer()->paint(p, rect, paintBehavior, eltRenderer); + contentRenderer->layer()->paint(p, rect, m_paintBehavior, eltRenderer); + + m_paintBehavior = oldPaintBehavior; m_isPainting = false; m_lastPaintTime = currentTime(); diff --git a/WebCore/page/FrameView.h b/WebCore/page/FrameView.h index cbd0cb9..efceebe 100644 --- a/WebCore/page/FrameView.h +++ b/WebCore/page/FrameView.h @@ -104,6 +104,9 @@ public: // content rendered via the normal painting path. void setNeedsOneShotDrawingSynchronization(); #endif + + bool isEnclosedInCompositingLayer() const; + // Only used with accelerated compositing, but outside the #ifdef to make linkage easier. // Returns true if the sync was completed. bool syncCompositingStateRecursive(); @@ -137,9 +140,8 @@ public: virtual IntRect windowResizerRect() const; - virtual void scrollRectIntoViewRecursively(const IntRect&); - virtual void setScrollPosition(const IntPoint&); - void scrollPositionChanged(); + void setScrollPosition(const IntPoint&); + virtual void scrollPositionChanged(); String mediaType() const; void setMediaType(const String&); diff --git a/WebCore/page/Geolocation.cpp b/WebCore/page/Geolocation.cpp index 36e14f6..88e8941 100644 --- a/WebCore/page/Geolocation.cpp +++ b/WebCore/page/Geolocation.cpp @@ -710,6 +710,8 @@ void Geolocation::handleEvent(ScriptExecutionContext*, Event* event) namespace WebCore { +void Geolocation::clearWatch(int watchId) {} + void Geolocation::disconnectFrame() {} Geolocation::Geolocation(Frame*) {} diff --git a/WebCore/page/Page.cpp b/WebCore/page/Page.cpp index ee5c052..4d7aa7c 100644 --- a/WebCore/page/Page.cpp +++ b/WebCore/page/Page.cpp @@ -420,7 +420,6 @@ void Page::addMediaCanStartListener(MediaCanStartListener* listener) void Page::removeMediaCanStartListener(MediaCanStartListener* listener) { - ASSERT(!m_canStartMedia); ASSERT(m_mediaCanStartListeners.contains(listener)); m_mediaCanStartListeners.remove(listener); } @@ -432,16 +431,14 @@ void Page::setCanStartMedia(bool canStartMedia) m_canStartMedia = canStartMedia; - if (!m_canStartMedia || m_mediaCanStartListeners.isEmpty()) - return; - - Vector<MediaCanStartListener*> listeners; - copyToVector(m_mediaCanStartListeners, listeners); - m_mediaCanStartListeners.clear(); - - size_t size = listeners.size(); - for (size_t i = 0; i < size; ++i) - listeners[i]->mediaCanStart(); + while (m_canStartMedia) { + HashSet<MediaCanStartListener*>::iterator slot = m_mediaCanStartListeners.begin(); + if (slot == m_mediaCanStartListeners.end()) + break; + MediaCanStartListener* listener = *slot; + m_mediaCanStartListeners.remove(slot); + listener->mediaCanStart(); + } } static Frame* incrementFrame(Frame* curr, bool forward, bool wrapFlag) diff --git a/WebCore/page/PrintContext.cpp b/WebCore/page/PrintContext.cpp index e0235de..ffde0be 100644 --- a/WebCore/page/PrintContext.cpp +++ b/WebCore/page/PrintContext.cpp @@ -38,7 +38,8 @@ PrintContext::PrintContext(Frame* frame) PrintContext::~PrintContext() { - ASSERT(!m_isPrinting); + if (m_isPrinting) + end(); m_pageRects.clear(); } @@ -192,10 +193,9 @@ int PrintContext::pageNumberForElement(Element* element, const FloatSize& pageSi for (; pageNumber < printContext.pageCount(); pageNumber++) { const IntRect& page = printContext.pageRect(pageNumber); if (page.x() <= left && left < page.right() && page.y() <= top && top < page.bottom()) - break; + return pageNumber; } - printContext.end(); - return (pageNumber < printContext.pageCount() ? pageNumber : -1); + return -1; } int PrintContext::numberOfPages(Frame* frame, const FloatSize& pageSizeInPixels) @@ -206,7 +206,6 @@ int PrintContext::numberOfPages(Frame* frame, const FloatSize& pageSizeInPixels) PrintContext printContext(frame); printContext.begin(pageRect.width()); printContext.computePageRectsWithPageSize(pageSizeInPixels, false); - printContext.end(); return printContext.pageCount(); } diff --git a/WebCore/page/SecurityOrigin.cpp b/WebCore/page/SecurityOrigin.cpp index 265c643..aab8866 100644 --- a/WebCore/page/SecurityOrigin.cpp +++ b/WebCore/page/SecurityOrigin.cpp @@ -89,6 +89,20 @@ static URLSchemesMap& schemesWithUniqueOrigins() return schemesWithUniqueOrigins; } +static bool schemeRequiresAuthority(const String& scheme) +{ + DEFINE_STATIC_LOCAL(URLSchemesMap, schemes, ()); + + if (schemes.isEmpty()) { + schemes.add("http"); + schemes.add("https"); + schemes.add("ftp"); + } + + return schemes.contains(scheme); +} + + SecurityOrigin::SecurityOrigin(const KURL& url, SandboxFlags sandboxFlags) : m_sandboxFlags(sandboxFlags) , m_protocol(url.protocol().isNull() ? "" : url.protocol().lower()) @@ -103,6 +117,10 @@ SecurityOrigin::SecurityOrigin(const KURL& url, SandboxFlags sandboxFlags) if (m_protocol == "about" || m_protocol == "javascript") m_protocol = ""; + // For edge case URLs that were probably misparsed, make sure that the origin is unique. + if (schemeRequiresAuthority(m_protocol) && m_host.isEmpty()) + m_isUnique = true; + // document.domain starts as m_host, but can be set by the DOM. m_domain = m_host; diff --git a/WebCore/page/SecurityOrigin.h b/WebCore/page/SecurityOrigin.h index d732664..a6c3a7a 100644 --- a/WebCore/page/SecurityOrigin.h +++ b/WebCore/page/SecurityOrigin.h @@ -120,6 +120,11 @@ public: bool canAccessLocalStorage() const { return !isUnique(); } bool canAccessCookies() const { return !isUnique(); } + // Technically, we should always allow access to sessionStorage, but we + // currently don't handle creating a sessionStorage area for unique + // origins. + bool canAccessSessionStorage() const { return !isUnique(); } + bool isSecureTransitionTo(const KURL&) const; // The local SecurityOrigin is the most privileged SecurityOrigin. diff --git a/WebCore/page/Settings.cpp b/WebCore/page/Settings.cpp index 33c9c0d..58c9629 100644 --- a/WebCore/page/Settings.cpp +++ b/WebCore/page/Settings.cpp @@ -96,6 +96,7 @@ Settings::Settings(Page* page) , m_allowUniversalAccessFromFileURLs(true) , m_allowFileAccessFromFileURLs(true) , m_javaScriptCanOpenWindowsAutomatically(false) + , m_javaScriptCanAccessClipboard(false) , m_shouldPrintBackgrounds(false) , m_textAreasAreResizable(false) #if ENABLE(DASHBOARD_SUPPORT) @@ -333,6 +334,11 @@ void Settings::setJavaScriptCanOpenWindowsAutomatically(bool javaScriptCanOpenWi m_javaScriptCanOpenWindowsAutomatically = javaScriptCanOpenWindowsAutomatically; } +void Settings::setJavaScriptCanAccessClipboard(bool javaScriptCanAccessClipboard) +{ + m_javaScriptCanAccessClipboard = javaScriptCanAccessClipboard; +} + void Settings::setDefaultTextEncodingName(const String& defaultTextEncodingName) { m_defaultTextEncodingName = defaultTextEncodingName; diff --git a/WebCore/page/Settings.h b/WebCore/page/Settings.h index 04487b1..5f567c2 100644 --- a/WebCore/page/Settings.h +++ b/WebCore/page/Settings.h @@ -145,6 +145,9 @@ namespace WebCore { void setJavaScriptCanOpenWindowsAutomatically(bool); bool javaScriptCanOpenWindowsAutomatically() const { return m_javaScriptCanOpenWindowsAutomatically; } + void setJavaScriptCanAccessClipboard(bool); + bool javaScriptCanAccessClipboard() const { return m_javaScriptCanAccessClipboard; } + void setSpatialNavigationEnabled(bool); bool isSpatialNavigationEnabled() const { return m_isSpatialNavigationEnabled; } @@ -448,6 +451,7 @@ namespace WebCore { bool m_allowUniversalAccessFromFileURLs: 1; bool m_allowFileAccessFromFileURLs: 1; bool m_javaScriptCanOpenWindowsAutomatically : 1; + bool m_javaScriptCanAccessClipboard : 1; bool m_shouldPrintBackgrounds : 1; bool m_textAreasAreResizable : 1; #if ENABLE(DASHBOARD_SUPPORT) diff --git a/WebCore/page/WindowFeatures.cpp b/WebCore/page/WindowFeatures.cpp index c499a4a..1654ff5 100644 --- a/WebCore/page/WindowFeatures.cpp +++ b/WebCore/page/WindowFeatures.cpp @@ -155,6 +155,8 @@ void WindowFeatures::setWindowFeature(const String& keyString, const String& val fullscreen = value; else if (keyString == "scrollbars") scrollbarsVisible = value; + else if (value == 1) + additionalFeatures.append(keyString); } bool WindowFeatures::boolFeature(const HashMap<String, String>& features, const char* key, bool defaultValue) diff --git a/WebCore/page/WindowFeatures.h b/WebCore/page/WindowFeatures.h index a12cf05..a414552 100644 --- a/WebCore/page/WindowFeatures.h +++ b/WebCore/page/WindowFeatures.h @@ -76,6 +76,8 @@ namespace WebCore { bool fullscreen; bool dialog; + + Vector<String> additionalFeatures; }; } // namespace WebCore diff --git a/WebCore/page/animation/AnimationBase.cpp b/WebCore/page/animation/AnimationBase.cpp index d9282cb..a49c754 100644 --- a/WebCore/page/animation/AnimationBase.cpp +++ b/WebCore/page/animation/AnimationBase.cpp @@ -952,9 +952,6 @@ void AnimationBase::updateStateMachine(AnimStateInput input, double param) overrideAnimations(); - // Send start event, if needed - onAnimationStart(0); // The elapsedTime is always 0 here - // Start the animation if (overridden()) { // We won't try to start accelerated animations if we are overridden and @@ -987,6 +984,9 @@ void AnimationBase::updateStateMachine(AnimStateInput input, double param) m_startTime += m_animation->delay(); } + // Now that we know the start time, fire the start event. + onAnimationStart(0); // The elapsedTime is 0. + // Decide whether to go into looping or ending state goIntoEndingOrLoopingState(); diff --git a/WebCore/page/animation/AnimationController.cpp b/WebCore/page/animation/AnimationController.cpp index cb609a5..3761c5a 100644 --- a/WebCore/page/animation/AnimationController.cpp +++ b/WebCore/page/animation/AnimationController.cpp @@ -134,9 +134,16 @@ void AnimationControllerPrivate::updateAnimationTimer(bool callSetChanged/* = fa void AnimationControllerPrivate::updateStyleIfNeededDispatcherFired(Timer<AnimationControllerPrivate>*) { + fireEventsAndUpdateStyle(); +} + +void AnimationControllerPrivate::fireEventsAndUpdateStyle() +{ // Protect the frame from getting destroyed in the event handler RefPtr<Frame> protector = m_frame; + bool updateStyle = !m_eventsToDispatch.isEmpty() || !m_nodeChangesToDispatch.isEmpty(); + // fire all the events Vector<EventToDispatch>::const_iterator eventsToDispatchEnd = m_eventsToDispatch.end(); for (Vector<EventToDispatch>::const_iterator it = m_eventsToDispatch.begin(); it != eventsToDispatchEnd; ++it) { @@ -155,7 +162,7 @@ void AnimationControllerPrivate::updateStyleIfNeededDispatcherFired(Timer<Animat m_nodeChangesToDispatch.clear(); - if (m_frame) + if (updateStyle && m_frame) m_frame->document()->updateStyleIfNeeded(); } @@ -196,6 +203,10 @@ void AnimationControllerPrivate::animationTimerFired(Timer<AnimationControllerPr // When the timer fires, all we do is call setChanged on all DOM nodes with running animations and then do an immediate // updateStyleIfNeeded. It will then call back to us with new information. updateAnimationTimer(true); + + // Fire events right away, to avoid a flash of unanimated style after an animation completes, and before + // the 'end' event fires. + fireEventsAndUpdateStyle(); } bool AnimationControllerPrivate::isAnimatingPropertyOnRenderer(RenderObject* renderer, CSSPropertyID property, bool isRunningNow) const diff --git a/WebCore/page/animation/AnimationControllerPrivate.h b/WebCore/page/animation/AnimationControllerPrivate.h index 682dd75..5ef9098 100644 --- a/WebCore/page/animation/AnimationControllerPrivate.h +++ b/WebCore/page/animation/AnimationControllerPrivate.h @@ -92,6 +92,7 @@ public: private: void styleAvailable(); + void fireEventsAndUpdateStyle(); typedef HashMap<RenderObject*, RefPtr<CompositeAnimation> > RenderObjectAnimationMap; diff --git a/WebCore/page/animation/CompositeAnimation.cpp b/WebCore/page/animation/CompositeAnimation.cpp index 0f238fd..7619b1f 100644 --- a/WebCore/page/animation/CompositeAnimation.cpp +++ b/WebCore/page/animation/CompositeAnimation.cpp @@ -205,6 +205,8 @@ void CompositeAnimation::updateKeyframeAnimations(RenderObject* renderer, Render // Toss the animation order map. m_keyframeAnimationOrderMap.clear(); + + DEFINE_STATIC_LOCAL(const AtomicString, none, ("none")); // Now mark any still active animations as active and add any new animations. if (targetStyle->animations()) { @@ -232,7 +234,7 @@ void CompositeAnimation::updateKeyframeAnimations(RenderObject* renderer, Render // Set the saved animation to this new one, just in case the play state has changed. keyframeAnim->setAnimation(anim); keyframeAnim->setIndex(i); - } else if ((anim->duration() || anim->delay()) && anim->iterationCount()) { + } else if ((anim->duration() || anim->delay()) && anim->iterationCount() && animationName != none) { keyframeAnim = KeyframeAnimation::create(const_cast<Animation*>(anim), renderer, i, this, targetStyle); m_keyframeAnimations.set(keyframeAnim->name().impl(), keyframeAnim); } diff --git a/WebCore/page/chromium/EventHandlerChromium.cpp b/WebCore/page/chromium/EventHandlerChromium.cpp index ff161af..bf9acb7 100644 --- a/WebCore/page/chromium/EventHandlerChromium.cpp +++ b/WebCore/page/chromium/EventHandlerChromium.cpp @@ -54,11 +54,12 @@ const double EventHandler::TextDragDelay = 0.0; bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe) { + const PlatformMouseEvent& mouseEvent = mev.event(); // If we're clicking into a frame that is selected, the frame will appear // greyed out even though we're clicking on the selection. This looks // really strange (having the whole frame be greyed out), so we deselect the // selection. - IntPoint p = m_frame->view()->windowToContents(mev.event().pos()); + IntPoint p = m_frame->view()->windowToContents(mouseEvent.pos()); if (m_frame->selection()->contains(p)) { VisiblePosition visiblePos( mev.targetNode()->renderer()->positionForPoint(mev.localPoint())); @@ -67,7 +68,19 @@ bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& m m_frame->selection()->setSelection(newSelection); } - subframe->eventHandler()->handleMousePressEvent(mev.event()); + // If the click hits a scrollbar, we pass the mouse press event to the + // scrollbar directly. This prevents selected text from being unselected. + // This matches the WebKit mac code which passes the mouse press event + // to an NSScroller. + FrameView* view = subframe->view(); + Scrollbar* scrollbar = view ? view->scrollbarAtPoint(mouseEvent.pos()) : 0; + if (scrollbar) { + HitTestRequest request(HitTestRequest::Active); + IntPoint documentPoint = view->windowToContents(mouseEvent.pos()); + MouseEventWithHitTestResults subframeMouseEvent = subframe->document()->prepareMouseEvent(request, documentPoint, mouseEvent); + subframe->eventHandler()->passMousePressEventToScrollbar(subframeMouseEvent, scrollbar); + } else + subframe->eventHandler()->handleMousePressEvent(mouseEvent); return true; } diff --git a/WebCore/page/gtk/EventHandlerGtk.cpp b/WebCore/page/gtk/EventHandlerGtk.cpp index 7051391..0ff67d2 100644 --- a/WebCore/page/gtk/EventHandlerGtk.cpp +++ b/WebCore/page/gtk/EventHandlerGtk.cpp @@ -96,7 +96,7 @@ bool EventHandler::passWheelEventToWidget(PlatformWheelEvent& event, Widget* wid PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const { - return ClipboardGtk::create(ClipboardWritable, true); + return ClipboardGtk::create(ClipboardWritable, DataObjectGtk::create(), true); } bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe) diff --git a/WebCore/page/mac/DragControllerMac.mm b/WebCore/page/mac/DragControllerMac.mm index f080232..a09c418 100644 --- a/WebCore/page/mac/DragControllerMac.mm +++ b/WebCore/page/mac/DragControllerMac.mm @@ -42,20 +42,6 @@ const int DragController::DragIconBottomInset = 3; const float DragController::DragImageAlpha = 0.75f; -#if ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE) - -DragOperation DragController::dragOperation(DragData*) -{ - return DragOperationNone; -} - -bool DragController::isCopyKeyDown() -{ - return false; -} - -#else - bool DragController::isCopyKeyDown() { return [[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask; @@ -74,8 +60,6 @@ DragOperation DragController::dragOperation(DragData* dragData) return DragOperationNone; } -#endif - const IntSize& DragController::maxDragImageSize() { static const IntSize maxDragImageSize(400, 400); diff --git a/WebCore/page/mac/EventHandlerMac.mm b/WebCore/page/mac/EventHandlerMac.mm index 650c0e1..8842e31 100644 --- a/WebCore/page/mac/EventHandlerMac.mm +++ b/WebCore/page/mac/EventHandlerMac.mm @@ -66,8 +66,6 @@ namespace WebCore { const double EventHandler::TextDragDelay = 0.15; #endif -#if !ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE) - static RetainPtr<NSEvent>& currentNSEventSlot() { DEFINE_STATIC_LOCAL(RetainPtr<NSEvent>, event, ()); @@ -661,119 +659,6 @@ bool EventHandler::eventActivatedView(const PlatformMouseEvent& event) const return m_activationEventNumber == event.eventNumber(); } -#else // ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE) - -NSEvent *EventHandler::currentNSEvent() -{ - return 0; -} - -bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe) -{ - subframe->eventHandler()->handleMousePressEvent(mev.event()); - return true; -} - -bool EventHandler::passMouseMoveEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe, HitTestResult* hoveredNode) -{ - if (m_mouseDownMayStartDrag && !m_mouseDownWasInSubframe) - return false; - subframe->eventHandler()->handleMouseMoveEvent(mev.event(), hoveredNode); - return true; -} - -bool EventHandler::passMouseReleaseEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe) -{ - subframe->eventHandler()->handleMouseReleaseEvent(mev.event()); - return true; -} - -bool EventHandler::passWheelEventToWidget(PlatformWheelEvent& wheelEvent, Widget* widget) -{ - if (!widget->isFrameView()) - return false; - - return static_cast<FrameView*>(widget)->frame()->eventHandler()->handleWheelEvent(wheelEvent); -} - -void EventHandler::focusDocumentView() -{ - Page* page = m_frame->page(); - if (!page) - return; - page->focusController()->setFocusedFrame(m_frame); -} - -bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults&) -{ - notImplemented(); - return false; -} - -bool EventHandler::eventActivatedView(const PlatformMouseEvent&) const -{ - notImplemented(); - return false; -} - -PassRefPtr<KeyboardEvent> EventHandler::currentKeyboardEvent() const -{ - return 0; -} - -void EventHandler::mouseDown(NSEvent *) -{ - notImplemented(); -} - -void EventHandler::mouseDragged(NSEvent *) -{ - notImplemented(); -} - -void EventHandler::mouseUp(NSEvent *) -{ - notImplemented(); -} - -void EventHandler::mouseMoved(NSEvent *) -{ - notImplemented(); -} - -bool EventHandler::keyEvent(NSEvent *) -{ - notImplemented(); - return false; -} - -bool EventHandler::wheelEvent(NSEvent *) -{ - notImplemented(); - return false; -} - -#if ENABLE(CONTEXT_MENUS) -bool EventHandler::sendContextMenuEvent(NSEvent *) -{ - notImplemented(); - return false; -} -#endif - -bool EventHandler::eventMayStartDrag(NSEvent *) -{ - notImplemented(); - return false; -} - -void EventHandler::sendFakeEventsAfterWidgetTracking(NSEvent *) -{ -} - - -#endif - #if ENABLE(DRAG_SUPPORT) PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const diff --git a/WebCore/page/qt/EventHandlerQt.cpp b/WebCore/page/qt/EventHandlerQt.cpp index d7982fa..5b24eae 100644 --- a/WebCore/page/qt/EventHandlerQt.cpp +++ b/WebCore/page/qt/EventHandlerQt.cpp @@ -51,7 +51,7 @@ #include "NotImplemented.h" QT_BEGIN_NAMESPACE -extern Q_GUI_EXPORT bool qt_tab_all_widgets; // from qapplication.cpp +Q_GUI_EXPORT extern bool qt_tab_all_widgets; // from qapplication.cpp QT_END_NAMESPACE namespace WebCore { diff --git a/WebCore/platform/Arena.h b/WebCore/platform/Arena.h index 4c9ecf4..b485fc1 100644 --- a/WebCore/platform/Arena.h +++ b/WebCore/platform/Arena.h @@ -44,7 +44,7 @@ namespace WebCore { -typedef unsigned long uword; +typedef uintptr_t uword; struct Arena { Arena* next; // next arena diff --git a/WebCore/platform/HostWindow.h b/WebCore/platform/HostWindow.h index dc681a1..e7316a7 100644 --- a/WebCore/platform/HostWindow.h +++ b/WebCore/platform/HostWindow.h @@ -54,10 +54,6 @@ public: // Method for retrieving the native client of the page. virtual PlatformPageClient platformPageClient() const = 0; - // For scrolling a rect into view recursively. Useful in the cases where a WebView is embedded inside some containing - // platform-specific ScrollView. - virtual void scrollRectIntoView(const IntRect&, const ScrollView*) const = 0; - // To notify WebKit of scrollbar mode changes. virtual void scrollbarsModeDidChange() const = 0; }; diff --git a/WebCore/platform/KURL.cpp b/WebCore/platform/KURL.cpp index 12ba4a2..9ed900f 100644 --- a/WebCore/platform/KURL.cpp +++ b/WebCore/platform/KURL.cpp @@ -1353,27 +1353,29 @@ bool protocolHostAndPortAreEqual(const KURL& a, const KURL& b) { if (a.m_schemeEnd != b.m_schemeEnd) return false; + int hostStartA = a.hostStart(); + int hostLengthA = a.hostEnd() - hostStartA; int hostStartB = b.hostStart(); - if (a.m_hostEnd - hostStartA != b.m_hostEnd - hostStartB) + int hostLengthB = b.hostEnd() - b.hostStart(); + if (hostLengthA != hostLengthB) return false; // Check the scheme for (int i = 0; i < a.m_schemeEnd; ++i) if (a.string()[i] != b.string()[i]) return false; - + // And the host - for (int i = hostStartA; i < a.m_hostEnd; ++i) - if (a.string()[i] != b.string()[i]) + for (int i = 0; i < hostLengthA; ++i) + if (a.string()[hostStartA + i] != b.string()[hostStartB + i]) return false; - + if (a.port() != b.port()) return false; return true; } - String encodeWithURLEscapeSequences(const String& notEncodedString) { diff --git a/WebCore/platform/KURLGoogle.cpp b/WebCore/platform/KURLGoogle.cpp index 97446bd..b4c84a6 100644 --- a/WebCore/platform/KURLGoogle.cpp +++ b/WebCore/platform/KURLGoogle.cpp @@ -1144,8 +1144,10 @@ bool protocolHostAndPortAreEqual(const KURL& a, const KURL& b) return false; int hostStartA = a.hostStart(); + int hostLengthA = a.hostEnd() - hostStartA; int hostStartB = b.hostStart(); - if (a.hostEnd() - hostStartA != b.hostEnd() - hostStartB) + int hostLengthB = b.hostEnd() - b.hostStart(); + if (hostLengthA != hostLengthB) return false; // Check the scheme @@ -1154,8 +1156,8 @@ bool protocolHostAndPortAreEqual(const KURL& a, const KURL& b) return false; // And the host - for (int i = hostStartA; i < static_cast<int>(a.hostEnd()); ++i) - if (a.string()[i] != b.string()[i]) + for (int i = 0; i < hostLengthA; ++i) + if (a.string()[hostStartA + i] != b.string()[hostStartB + i]) return false; if (a.port() != b.port()) diff --git a/WebCore/platform/LinkHash.cpp b/WebCore/platform/LinkHash.cpp index 0bd589c..12437ab 100644 --- a/WebCore/platform/LinkHash.cpp +++ b/WebCore/platform/LinkHash.cpp @@ -147,12 +147,17 @@ static inline bool needsTrailingSlash(const UChar* characters, unsigned length) return pos == length; } +static ALWAYS_INLINE LinkHash visitedLinkHashInline(const UChar* url, unsigned length) +{ + return AlreadyHashed::avoidDeletedValue(StringImpl::computeHash(url, length)); +} + LinkHash visitedLinkHash(const UChar* url, unsigned length) { - return AlreadyHashed::avoidDeletedValue(StringImpl::computeHash(url, length)); + return visitedLinkHashInline(url, length); } -void visitedURL(const KURL& base, const AtomicString& attributeURL, Vector<UChar, 512>& buffer) +static ALWAYS_INLINE void visitedURLInline(const KURL& base, const AtomicString& attributeURL, Vector<UChar, 512>& buffer) { if (attributeURL.isNull()) return; @@ -213,14 +218,19 @@ void visitedURL(const KURL& base, const AtomicString& attributeURL, Vector<UChar return; } +void visitedURL(const KURL& base, const AtomicString& attributeURL, Vector<UChar, 512>& buffer) +{ + return visitedURLInline(base, attributeURL, buffer); +} + LinkHash visitedLinkHash(const KURL& base, const AtomicString& attributeURL) { Vector<UChar, 512> url; - visitedURL(base, attributeURL, url); + visitedURLInline(base, attributeURL, url); if (url.isEmpty()) return 0; - return visitedLinkHash(url.data(), url.size()); + return visitedLinkHashInline(url.data(), url.size()); } } // namespace WebCore diff --git a/WebCore/platform/ScrollView.cpp b/WebCore/platform/ScrollView.cpp index 28f9c2f..f0e705e 100644 --- a/WebCore/platform/ScrollView.cpp +++ b/WebCore/platform/ScrollView.cpp @@ -292,9 +292,11 @@ void ScrollView::valueChanged(Scrollbar* scrollbar) if (scrollbarsSuppressed()) return; + scrollPositionChanged(); scrollContents(scrollDelta); } +<<<<<<< HEAD:WebCore/platform/ScrollView.cpp void ScrollView::scrollRectIntoViewRecursively(const IntRect& r) { #if PLATFORM(ANDROID) @@ -325,6 +327,8 @@ void ScrollView::scrollRectIntoViewRecursively(const IntRect& r) hostWindow()->scrollRectIntoView(rect, this); } +======= +>>>>>>> webkit.org at r58956:WebCore/platform/ScrollView.cpp void ScrollView::setScrollPosition(const IntPoint& scrollPoint) { if (prohibitsScrolling()) diff --git a/WebCore/platform/ScrollView.h b/WebCore/platform/ScrollView.h index 52afbf9..b103d22 100644 --- a/WebCore/platform/ScrollView.h +++ b/WebCore/platform/ScrollView.h @@ -57,31 +57,31 @@ class ScrollView : public Widget, public ScrollbarClient { public: ~ScrollView(); - // ScrollbarClient method. FrameView overrides the other two. + // ScrollbarClient function. FrameView overrides the other two. virtual void valueChanged(Scrollbar*); - // The window thats hosts the ScrollView. The ScrollView will communicate scrolls and repaints to the + // The window thats hosts the ScrollView. The ScrollView will communicate scrolls and repaints to the // host window in the window's coordinate space. virtual HostWindow* hostWindow() const = 0; - // Returns a clip rect in host window coordinates. Used to clip the blit on a scroll. + // Returns a clip rect in host window coordinates. Used to clip the blit on a scroll. virtual IntRect windowClipRect(bool clipToContents = true) const = 0; - // Methods for child manipulation and inspection. + // Functions for child manipulation and inspection. const HashSet<RefPtr<Widget> >* children() const { return &m_children; } void addChild(PassRefPtr<Widget>); void removeChild(Widget*); - // If the scroll view does not use a native widget, then it will have cross-platform Scrollbars. These methods + // If the scroll view does not use a native widget, then it will have cross-platform Scrollbars. These functions // can be used to obtain those scrollbars. Scrollbar* horizontalScrollbar() const { return m_horizontalScrollbar.get(); } Scrollbar* verticalScrollbar() const { return m_verticalScrollbar.get(); } bool isScrollViewScrollbar(const Widget* child) const { return horizontalScrollbar() == child || verticalScrollbar() == child; } - // Methods for setting and retrieving the scrolling mode in each axis (horizontal/vertical). The mode has values of - // AlwaysOff, AlwaysOn, and Auto. AlwaysOff means never show a scrollbar, AlwaysOn means always show a scrollbar. + // Functions for setting and retrieving the scrolling mode in each axis (horizontal/vertical). The mode has values of + // AlwaysOff, AlwaysOn, and Auto. AlwaysOff means never show a scrollbar, AlwaysOn means always show a scrollbar. // Auto means show a scrollbar only when one is needed. - // Note that for platforms with native widgets, these modes are considered advisory. In other words the underlying native + // Note that for platforms with native widgets, these modes are considered advisory. In other words the underlying native // widget may choose not to honor the requested modes. void setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode verticalMode, bool horizontalLock = false, bool verticalLock = false); void setHorizontalScrollbarMode(ScrollbarMode mode, bool lock = false) { setScrollbarModes(mode, verticalScrollbarMode(), lock, verticalScrollbarLock()); } @@ -103,7 +103,7 @@ public: virtual bool avoidScrollbarCreation() { return false; } // By default you only receive paint events for the area that is visible. In the case of using a - // tiled backing store, this method can be set, so that the view paints the entire contents. + // tiled backing store, this function can be set, so that the view paints the entire contents. bool paintsEntireContents() const { return m_paintsEntireContents; } void setPaintsEntireContents(bool); @@ -114,20 +114,20 @@ public: void setProhibitsScrolling(bool b) { m_prohibitsScrolling = b; } bool prohibitsScrolling() const { return m_prohibitsScrolling; } - // Whether or not a scroll view will blit visible contents when it is scrolled. Blitting is disabled in situations + // Whether or not a scroll view will blit visible contents when it is scrolled. Blitting is disabled in situations // where it would cause rendering glitches (such as with fixed backgrounds or when the view is partially transparent). void setCanBlitOnScroll(bool); bool canBlitOnScroll() const; // The visible content rect has a location that is the scrolled offset of the document. The width and height are the viewport width - // and height. By default the scrollbars themselves are excluded from this rectangle, but an optional boolean argument allows them to be + // and height. By default the scrollbars themselves are excluded from this rectangle, but an optional boolean argument allows them to be // included. IntRect visibleContentRect(bool includeScrollbars = false) const; int visibleWidth() const { return visibleContentRect().width(); } int visibleHeight() const { return visibleContentRect().height(); } - // Methods for getting/setting the size webkit should use to layout the contents. By default this is the same as the visible - // content size. Explicitly setting a layout size value will cause webkit to layout the contents using this size instead. + // Functions for getting/setting the size webkit should use to layout the contents. By default this is the same as the visible + // content size. Explicitly setting a layout size value will cause webkit to layout the contents using this size instead. int layoutWidth() const; int layoutHeight() const; IntSize fixedLayoutSize() const; @@ -135,27 +135,25 @@ public: bool useFixedLayout() const; void setUseFixedLayout(bool enable); - // Methods for getting/setting the size of the document contained inside the ScrollView (as an IntSize or as individual width and height + // Functions for getting/setting the size of the document contained inside the ScrollView (as an IntSize or as individual width and height // values). IntSize contentsSize() const; // Always at least as big as the visibleWidth()/visibleHeight(). int contentsWidth() const { return contentsSize().width(); } int contentsHeight() const { return contentsSize().height(); } virtual void setContentsSize(const IntSize&); - // Methods for querying the current scrolled position (both as a point, a size, or as individual X and Y values). + // Functions for querying the current scrolled position (both as a point, a size, or as individual X and Y values). IntPoint scrollPosition() const { return visibleContentRect().location(); } IntSize scrollOffset() const { return visibleContentRect().location() - IntPoint(); } // Gets the scrolled position as an IntSize. Convenient for adding to other sizes. IntPoint maximumScrollPosition() const; // The maximum position we can be scrolled to. int scrollX() const { return scrollPosition().x(); } int scrollY() const { return scrollPosition().y(); } - // Methods for scrolling the view. setScrollPosition is the only method that really scrolls the view. The other two methods are helper functions - // that ultimately end up calling setScrollPosition. + // Functions for scrolling the view. void setScrollPosition(const IntPoint&); void scrollBy(const IntSize& s) { return setScrollPosition(scrollPosition() + s); } - void scrollRectIntoViewRecursively(const IntRect&); - - // This method scrolls by lines, pages or pixels. + + // This function scrolls by lines, pages or pixels. bool scroll(ScrollDirection, ScrollGranularity); // Scroll the actual contents of the view (either blitting or invalidating as needed). @@ -173,15 +171,15 @@ public: IntRect windowToContents(const IntRect&) const; IntRect contentsToWindow(const IntRect&) const; - // Methods for converting to and from screen coordinates. + // Functions for converting to and from screen coordinates. IntRect contentsToScreen(const IntRect&) const; IntPoint screenToContents(const IntPoint&) const; - // The purpose of this method is to answer whether or not the scroll view is currently visible. Animations and painting updates can be suspended if + // The purpose of this function is to answer whether or not the scroll view is currently visible. Animations and painting updates can be suspended if // we know that we are either not in a window right now or if that window is not visible. bool isOffscreen() const; - // These methods are used to enable scrollbars to avoid window resizer controls that overlap the scroll view. This happens on Mac + // These functions are used to enable scrollbars to avoid window resizer controls that overlap the scroll view. This happens on Mac // for example. virtual IntRect windowResizerRect() const { return IntRect(); } bool containsScrollbarsAvoidingResizer() const; @@ -197,9 +195,9 @@ public: // For platforms that need to hit test scrollbars from within the engine's event handlers (like Win32). Scrollbar* scrollbarAtPoint(const IntPoint& windowPoint); - // This method exists for scrollviews that need to handle wheel events manually. + // This function exists for scrollviews that need to handle wheel events manually. // On Mac the underlying NSScrollView just does the scrolling, but on other platforms - // (like Windows), we need this method in order to do the scroll ourselves. + // (like Windows), we need this function in order to do the scroll ourselves. void wheelEvent(PlatformWheelEvent&); IntPoint convertChildToSelf(const Widget* child, const IntPoint& point) const @@ -220,7 +218,7 @@ public: return newPoint; } - // Widget override. Handles painting of the contents of the view as well as the scrollbars. + // Widget override. Handles painting of the contents of the view as well as the scrollbars. virtual void paint(GraphicsContext*, const IntRect&); void paintScrollbars(GraphicsContext*, const IntRect&); @@ -252,7 +250,7 @@ protected: virtual void contentsResized() = 0; virtual void visibleContentsResized() = 0; - // These methods are used to create/destroy scrollbars. + // These functions are used to create/destroy scrollbars. void setHasHorizontalScrollbar(bool); void setHasVerticalScrollbar(bool); @@ -299,6 +297,9 @@ private: // Called to update the scrollbars to accurately reflect the state of the view. void updateScrollbars(const IntSize& desiredOffset); + // Called when the scroll position within this view changes. FrameView overrides this to generate repaint invalidations. + virtual void scrollPositionChanged() {} + void platformInit(); void platformDestroy(); void platformAddChild(Widget*); diff --git a/WebCore/platform/ThemeTypes.h b/WebCore/platform/ThemeTypes.h index 07a11fb..de71899 100644 --- a/WebCore/platform/ThemeTypes.h +++ b/WebCore/platform/ThemeTypes.h @@ -52,7 +52,7 @@ enum ControlPart { MediaSeekForwardButtonPart, MediaRewindButtonPart, MediaReturnToRealtimeButtonPart, MediaToggleClosedCaptionsButtonPart, MediaSliderPart, MediaSliderThumbPart, MediaVolumeSliderContainerPart, MediaVolumeSliderPart, MediaVolumeSliderThumbPart, MediaControlsBackgroundPart, MediaCurrentTimePart, MediaTimeRemainingPart, - MenulistPart, MenulistButtonPart, MenulistTextPart, MenulistTextFieldPart, OuterSpinButtonPart, ProgressBarPart, + MenulistPart, MenulistButtonPart, MenulistTextPart, MenulistTextFieldPart, OuterSpinButtonPart, ProgressBarPart, ProgressBarValuePart, SliderHorizontalPart, SliderVerticalPart, SliderThumbHorizontalPart, SliderThumbVerticalPart, CaretPart, SearchFieldPart, SearchFieldDecorationPart, SearchFieldResultsDecorationPart, SearchFieldResultsButtonPart, diff --git a/WebCore/platform/ThreadGlobalData.cpp b/WebCore/platform/ThreadGlobalData.cpp index 434ee5a..99cd44a 100644 --- a/WebCore/platform/ThreadGlobalData.cpp +++ b/WebCore/platform/ThreadGlobalData.cpp @@ -69,7 +69,7 @@ ThreadGlobalData::ThreadGlobalData() #endif { // This constructor will have been called on the main thread before being called on - // any other thread, and is only called once per thread – this makes this a convenient + // any other thread, and is only called once per thread - this makes this a convenient // point to call methods that internally perform a one-time initialization that is not // threadsafe. wtfThreadData(); @@ -78,14 +78,25 @@ ThreadGlobalData::ThreadGlobalData() ThreadGlobalData::~ThreadGlobalData() { + destroy(); +} + +void ThreadGlobalData::destroy() +{ #if PLATFORM(MAC) delete m_cachedConverterTEC; + m_cachedConverterTEC = 0; #endif + #if USE(ICU_UNICODE) delete m_cachedConverterICU; + m_cachedConverterICU = 0; #endif + delete m_eventNames; + m_eventNames = 0; delete m_threadTimers; + m_threadTimers = 0; } } // namespace WebCore diff --git a/WebCore/platform/ThreadGlobalData.h b/WebCore/platform/ThreadGlobalData.h index 3d73932..c17fbeb 100644 --- a/WebCore/platform/ThreadGlobalData.h +++ b/WebCore/platform/ThreadGlobalData.h @@ -49,6 +49,7 @@ namespace WebCore { public: ThreadGlobalData(); ~ThreadGlobalData(); + void destroy(); // called on workers to clean up the ThreadGlobalData before the thread exits. EventNames& eventNames() { return *m_eventNames; } ThreadTimers& threadTimers() { return *m_threadTimers; } diff --git a/WebCore/platform/UUID.cpp b/WebCore/platform/UUID.cpp index d8ac749..852e3ae 100644 --- a/WebCore/platform/UUID.cpp +++ b/WebCore/platform/UUID.cpp @@ -33,6 +33,10 @@ #include "NotImplemented.h" +#if PLATFORM(QT) +#include <QUuid> +#endif + #if OS(WINDOWS) #include <objbase.h> #ifndef ARRAYSIZE @@ -51,7 +55,12 @@ static const int uuidVersionIdentifierIndex = 14; String createCanonicalUUIDString() { -#if OS(WINDOWS) +#if PLATFORM(QT) + QUuid uuid = QUuid::createUuid(); + String canonicalUuidStr = uuid.toString().mid(1, 36).toLower(); // remove opening and closing bracket and make it lower. + ASSERT(canonicalUuidStr[uuidVersionIdentifierIndex] == uuidVersionRequired); + return canonicalUuidStr; +#elif OS(WINDOWS) GUID uuid = { 0 }; HRESULT hr = CoCreateGuid(&uuid); if (FAILED(hr)) @@ -76,7 +85,8 @@ String createCanonicalUUIDString() if (!fptr) return String(); char uuidStr[37] = {0}; - fgets(uuidStr, sizeof(uuidStr) - 1, fptr); + if (!fgets(uuidStr, sizeof(uuidStr) - 1, fptr)) + return String(); fclose(fptr); String canonicalUuidStr = String(uuidStr).lower(); // make it lower. ASSERT(canonicalUuidStr[uuidVersionIdentifierIndex] == uuidVersionRequired); diff --git a/WebCore/platform/Widget.cpp b/WebCore/platform/Widget.cpp index 520eb6f..1370863 100644 --- a/WebCore/platform/Widget.cpp +++ b/WebCore/platform/Widget.cpp @@ -174,4 +174,10 @@ IntPoint Widget::convertFromContainingView(const IntPoint& parentPoint) const return parentPoint; } +#if !PLATFORM(EFL) +void Widget::frameRectsChanged() +{ +} +#endif + } // namespace WebCore diff --git a/WebCore/platform/Widget.h b/WebCore/platform/Widget.h index 2fce858..23d228e 100644 --- a/WebCore/platform/Widget.h +++ b/WebCore/platform/Widget.h @@ -77,6 +77,12 @@ typedef BView* PlatformWidget; #include "PlatformWidget.h" #endif +#if PLATFORM(EFL) +#include <Ecore_Evas.h> +#include <Evas.h> +typedef Evas_Object* PlatformWidget; +#endif + #if PLATFORM(QT) class QWebPageClient; typedef QWebPageClient* PlatformPageClient; @@ -99,6 +105,9 @@ class GraphicsContext; class PlatformMouseEvent; class ScrollView; class WidgetPrivate; +#if PLATFORM(EFL) +class String; +#endif // The Widget class serves as a base class for three kinds of objects: // (1) Scrollable areas (ScrollView) @@ -157,7 +166,7 @@ public: void invalidate() { invalidateRect(boundsRect()); } virtual void invalidateRect(const IntRect&) = 0; - virtual void setFocus(); + virtual void setFocus(bool); void setCursor(const Cursor&); @@ -194,7 +203,7 @@ public: IntPoint convertToContainingWindow(const IntPoint&) const; IntPoint convertFromContainingWindow(const IntPoint&) const; - virtual void frameRectsChanged() {} + virtual void frameRectsChanged(); // Notifies this widget that other widgets on the page have been repositioned. virtual void widgetPositionsUpdated() {} @@ -208,6 +217,20 @@ public: void removeFromSuperview(); #endif +#if PLATFORM(EFL) + // FIXME: These should really go to PlatformWidget. They're here currently since + // the EFL port considers that Evas_Object (a C object) is a PlatformWidget, but + // encapsulating that into a C++ class will make this header clean as it should be. + Evas* evas() const; + + void setEvasObject(Evas_Object*); + Evas_Object* evasObject() const; + + const String edjeTheme() const; + void setEdjeTheme(const String &); + const String edjeThemeRecursive() const; +#endif + // Virtual methods to convert points to/from the containing ScrollView virtual IntRect convertToContainingView(const IntRect&) const; virtual IntRect convertFromContainingView(const IntRect&) const; @@ -236,9 +259,18 @@ private: IntRect m_frame; // Not used when a native widget exists. -#if PLATFORM(MAC) +#if PLATFORM(EFL) + // FIXME: Please see the previous #if PLATFORM(EFL) block. + Ecore_Evas* ecoreEvas() const; + + void applyFallbackCursor(); + void applyCursor(); +#endif + +#if PLATFORM(MAC) || PLATFORM(EFL) WidgetPrivate* m_data; #endif + #if PLATFORM(HAIKU) PlatformWidget m_topLevelPlatformWidget; #endif diff --git a/WebCore/platform/android/FileSystemAndroid.cpp b/WebCore/platform/android/FileSystemAndroid.cpp index 3d841d7..520bc7d 100644 --- a/WebCore/platform/android/FileSystemAndroid.cpp +++ b/WebCore/platform/android/FileSystemAndroid.cpp @@ -75,6 +75,23 @@ bool unloadModule(PlatformModule module) return !dlclose(module); } +<<<<<<< HEAD:WebCore/platform/android/FileSystemAndroid.cpp +======= +int writeToFile(PlatformFileHandle handle, const char* data, int length) +{ + int totalBytesWritten = 0; + while (totalBytesWritten < length) { + int bytesWritten = write(handle, data, (size_t)(length - totalBytesWritten)); + if (bytesWritten < 0 && errno != EINTR) + return -1; + if (bytesWritten > 0) + totalBytesWritten += bytesWritten; + } + + return totalBytesWritten; +} + +>>>>>>> webkit.org at r58956:WebCore/platform/android/FileSystemAndroid.cpp String homeDirectoryPath() { return sPluginPath; diff --git a/WebCore/platform/android/WidgetAndroid.cpp b/WebCore/platform/android/WidgetAndroid.cpp index 9ab0b2c..14da0ca 100644 --- a/WebCore/platform/android/WidgetAndroid.cpp +++ b/WebCore/platform/android/WidgetAndroid.cpp @@ -54,7 +54,7 @@ IntRect Widget::frameRect() const return platformWidget()->getBounds(); } -void Widget::setFocus() +void Widget::setFocus(bool focused) { notImplemented(); } diff --git a/WebCore/platform/chromium/ChromiumBridge.h b/WebCore/platform/chromium/ChromiumBridge.h index e582241..6eca3eb 100644 --- a/WebCore/platform/chromium/ChromiumBridge.h +++ b/WebCore/platform/chromium/ChromiumBridge.h @@ -109,6 +109,12 @@ namespace WebCore { static String getAbsolutePath(const String&); static bool isDirectory(const String&); static KURL filePathToURL(const String&); + static PlatformFileHandle openFile(const String& path, FileOpenMode); + static void closeFile(PlatformFileHandle&); + static long long seekFile(PlatformFileHandle, long long offset, FileSeekOrigin); + static bool truncateFile(PlatformFileHandle, long long offset); + static int readFromFile(PlatformFileHandle, char* data, int length); + static int writeToFile(PlatformFileHandle, const char* data, int length); // Font --------------------------------------------------------------- #if OS(WINDOWS) diff --git a/WebCore/platform/chromium/ChromiumDataObject.h b/WebCore/platform/chromium/ChromiumDataObject.h index 625cb8c..af0a3fa 100644 --- a/WebCore/platform/chromium/ChromiumDataObject.h +++ b/WebCore/platform/chromium/ChromiumDataObject.h @@ -79,6 +79,8 @@ namespace WebCore { { url = newURL; uriList.clear(); + if (newURL.isEmpty()) + return; uriList.append(newURL.string()); } diff --git a/WebCore/platform/chromium/ClipboardChromium.cpp b/WebCore/platform/chromium/ClipboardChromium.cpp index 21d7edf..ab9f3c9 100644 --- a/WebCore/platform/chromium/ClipboardChromium.cpp +++ b/WebCore/platform/chromium/ClipboardChromium.cpp @@ -162,25 +162,21 @@ String ClipboardChromium::getData(const String& type, bool& success) const case ClipboardDataTypeNone: return String(); + // Hack for URLs. file URLs are used internally for drop's default action, but we don't want + // to expose them to the page, so we filter them out here. case ClipboardDataTypeURIList: { String text; for (size_t i = 0; i < m_dataObject->uriList.size(); ++i) { const String& uri = m_dataObject->uriList[i]; + if (protocolIs(uri, "file")) + continue; ASSERT(!uri.isEmpty()); if (!text.isEmpty()) text.append(textMIMETypeLineSeparator); // URIs have already been canonicalized, so copy everything verbatim. text.append(uri); } - // Also create file:// URLs out of the entries in the file list. - for (size_t i = 0; i < m_dataObject->filenames.size(); ++i) { - String fileURL = ChromiumBridge::filePathToURL(m_dataObject->filenames[i]); - ASSERT(!fileURL.isEmpty()); - if (!text.isEmpty()) - text.append(textMIMETypeLineSeparator); - text.append(fileURL); - } success = !text.isEmpty(); return text; } @@ -188,15 +184,10 @@ String ClipboardChromium::getData(const String& type, bool& success) const case ClipboardDataTypeURL: // In case of a previous setData('text/uri-list'), setData() has already // prepared the 'url' member, so we can just retrieve it here. - if (!m_dataObject->url.isEmpty()) { + if (!m_dataObject->url.isEmpty() && !m_dataObject->url.isLocalFile()) { success = true; return m_dataObject->url.string(); } - // Otherwise check if we have a file that we could convert to a file:// URL. - if (!m_dataObject->filenames.isEmpty()) { - success = true; - return ChromiumBridge::filePathToURL(m_dataObject->filenames[0]); - } return String(); case ClipboardDataTypeDownloadURL: @@ -326,20 +317,27 @@ HashSet<String> ClipboardChromium::types() const if (!m_dataObject) return results; - if (!m_dataObject->filenames.isEmpty()) { - results.add("text/uri-list"); + if (!m_dataObject->filenames.isEmpty()) results.add("Files"); - } - if (m_dataObject->url.isValid()) { + // Hack for URLs. file URLs are used internally for drop's default action, but we don't want + // to expose them to the page, so we filter them out here. + if (m_dataObject->url.isValid() && !m_dataObject->url.isLocalFile()) { ASSERT(!m_dataObject->uriList.isEmpty()); results.add("URL"); } if (!m_dataObject->uriList.isEmpty()) { - // Note that even if the URI list is not empty, it may not actually - // contain a valid URL, so we can't return "URL" here. - results.add("text/uri-list"); + // Verify that the URI list contains at least one non-file URL. + for (Vector<String>::const_iterator it = m_dataObject->uriList.begin(); + it != m_dataObject->uriList.end(); ++it) { + if (!protocolIs(*it, "file")) { + // Note that even if the URI list is not empty, it may not actually + // contain a valid URL, so we can't return "URL" here. + results.add("text/uri-list"); + break; + } + } } if (!m_dataObject->plainText.isEmpty()) { diff --git a/WebCore/platform/chromium/DragImageChromiumSkia.cpp b/WebCore/platform/chromium/DragImageChromiumSkia.cpp index 24bd8fd..e5c1cee 100644 --- a/WebCore/platform/chromium/DragImageChromiumSkia.cpp +++ b/WebCore/platform/chromium/DragImageChromiumSkia.cpp @@ -68,9 +68,26 @@ DragImageRef scaleDragImage(DragImageRef image, FloatSize scale) return scaledImage; } -DragImageRef dissolveDragImageToFraction(DragImageRef image, float) +DragImageRef dissolveDragImageToFraction(DragImageRef image, float fraction) { - notImplemented(); + if (!image) + return 0; + + image->setIsOpaque(false); + image->lockPixels(); + + for (int row = 0; row < image->height(); ++row) { + for (int column = 0; column < image->width(); ++column) { + uint32_t* pixel = image->getAddr32(column, row); + *pixel = SkPreMultiplyARGB(SkColorGetA(*pixel) * fraction, + SkColorGetR(*pixel), + SkColorGetG(*pixel), + SkColorGetB(*pixel)); + } + } + + image->unlockPixels(); + return image; } @@ -80,7 +97,12 @@ DragImageRef createDragImageFromImage(Image* image) return 0; NativeImageSkia* bitmap = image->nativeImageForCurrentFrame(); - return bitmap ? new SkBitmap(*bitmap) : 0; + if (!bitmap) + return 0; + + SkBitmap* dragImage = new SkBitmap(); + bitmap->copyTo(dragImage, SkBitmap::kARGB_8888_Config); + return dragImage; } DragImageRef createDragImageIconForCachedImage(CachedImage*) diff --git a/WebCore/platform/chromium/FileSystemChromium.cpp b/WebCore/platform/chromium/FileSystemChromium.cpp index 30674d9..975caf6 100644 --- a/WebCore/platform/chromium/FileSystemChromium.cpp +++ b/WebCore/platform/chromium/FileSystemChromium.cpp @@ -77,4 +77,34 @@ bool fileExists(const String& path) return ChromiumBridge::fileExists(path); } +PlatformFileHandle openFile(const String& path, FileOpenMode mode) +{ + return ChromiumBridge::openFile(path, mode); +} + +void closeFile(PlatformFileHandle& handle) +{ + return ChromiumBridge::closeFile(handle); +} + +long long seekFile(PlatformFileHandle handle, long long offset, FileSeekOrigin origin) +{ + return ChromiumBridge::seekFile(handle, offset, origin); +} + +bool truncateFile(PlatformFileHandle handle, long long offset) +{ + return ChromiumBridge::truncateFile(handle, offset); +} + +int readFromFile(PlatformFileHandle handle, char* data, int length) +{ + return ChromiumBridge::readFromFile(handle, data, length); +} + +int writeToFile(PlatformFileHandle handle, const char* data, int length) +{ + return ChromiumBridge::writeToFile(handle, data, length); +} + } // namespace WebCore diff --git a/WebCore/platform/chromium/WidgetChromium.cpp b/WebCore/platform/chromium/WidgetChromium.cpp index 4e16e68..94afa0d 100644 --- a/WebCore/platform/chromium/WidgetChromium.cpp +++ b/WebCore/platform/chromium/WidgetChromium.cpp @@ -63,9 +63,10 @@ void Widget::paint(GraphicsContext*, const IntRect&) { } -void Widget::setFocus() +void Widget::setFocus(bool focused) { - ChromiumBridge::widgetSetFocus(this); + if (focused) + ChromiumBridge::widgetSetFocus(this); } void Widget::setIsSelected(bool) diff --git a/WebCore/platform/efl/WidgetEfl.cpp b/WebCore/platform/efl/WidgetEfl.cpp index 168477a..c07c8c4 100644 --- a/WebCore/platform/efl/WidgetEfl.cpp +++ b/WebCore/platform/efl/WidgetEfl.cpp @@ -199,7 +199,7 @@ void Widget::frameRectsChanged() evas_object_resize(o, rect.width(), rect.height()); } -void Widget::setFocus() +void Widget::setFocus(bool focused) { } diff --git a/WebCore/platform/graphics/FloatSize.h b/WebCore/platform/graphics/FloatSize.h index 97ee00d..53a0071 100644 --- a/WebCore/platform/graphics/FloatSize.h +++ b/WebCore/platform/graphics/FloatSize.h @@ -31,7 +31,7 @@ #include "IntSize.h" #include <wtf/MathExtras.h> -#if PLATFORM(CG) +#if PLATFORM(CG) || (PLATFORM(WX) && OS(DARWIN)) typedef struct CGSize CGSize; #endif @@ -75,7 +75,7 @@ public: m_height < other.m_height ? m_height : other.m_height); } -#if PLATFORM(CG) +#if PLATFORM(CG) || (PLATFORM(WX) && OS(DARWIN)) explicit FloatSize(const CGSize&); // don't do this implicitly since it's lossy operator CGSize() const; #endif diff --git a/WebCore/platform/graphics/Font.cpp b/WebCore/platform/graphics/Font.cpp index 7bdefba..21380be 100644 --- a/WebCore/platform/graphics/Font.cpp +++ b/WebCore/platform/graphics/Font.cpp @@ -175,7 +175,7 @@ void Font::drawText(GraphicsContext* context, const TextRun& run, const FloatPoi #endif #if USE(FONT_FAST_PATH) - if (canUseGlyphCache(run)) + if (codePath(run) != Complex) return drawSimpleText(context, run, point, from, to); #endif @@ -190,11 +190,12 @@ float Font::floatWidth(const TextRun& run, HashSet<const SimpleFontData*>* fallb #endif #if USE(FONT_FAST_PATH) - if (canUseGlyphCache(run)) { + CodePath codePathToUse = codePath(run); + if (codePathToUse != Complex) { // If the complex text implementation cannot return fallback fonts, avoid // returning them for simple text as well. static bool returnFallbackFonts = canReturnFallbackFontsForComplexText(); - return floatWidthForSimpleText(run, 0, returnFallbackFonts ? fallbackFonts : 0); + return floatWidthForSimpleText(run, 0, returnFallbackFonts ? fallbackFonts : 0, codePathToUse == SimpleWithGlyphOverflow ? glyphOverflow : 0); } #endif @@ -214,7 +215,7 @@ float Font::floatWidth(const TextRun& run, int extraCharsAvailable, int& charsCo glyphName = ""; #if USE(FONT_FAST_PATH) - if (canUseGlyphCache(run)) + if (codePath(run) != Complex) return floatWidthForSimpleText(run, 0); #endif @@ -231,7 +232,7 @@ FloatRect Font::selectionRectForText(const TextRun& run, const IntPoint& point, to = (to == -1 ? run.length() : to); #if USE(FONT_FAST_PATH) - if (canUseGlyphCache(run)) + if (codePath(run) != Complex) return selectionRectForSimpleText(run, point, h, from, to); #endif @@ -246,7 +247,7 @@ int Font::offsetForPosition(const TextRun& run, int x, bool includePartialGlyphs #endif #if USE(FONT_FAST_PATH) - if (canUseGlyphCache(run)) + if (codePath(run) != Complex) return offsetForPositionForSimpleText(run, x, includePartialGlyphs); #endif diff --git a/WebCore/platform/graphics/Font.h b/WebCore/platform/graphics/Font.h index 62525b0..da546f0 100644 --- a/WebCore/platform/graphics/Font.h +++ b/WebCore/platform/graphics/Font.h @@ -26,9 +26,9 @@ #define Font_h #include "CharacterNames.h" -#include "TextRun.h" #include "FontDescription.h" #include "SimpleFontData.h" +#include "TextRun.h" #include "TypesettingFeatures.h" #include <wtf/HashMap.h> #include <wtf/HashSet.h> @@ -83,9 +83,7 @@ public: Font& operator=(const Font&); bool operator==(const Font& other) const; - bool operator!=(const Font& other) const { - return !(*this == other); - } + bool operator!=(const Font& other) const { return !(*this == other); } const FontDescription& fontDescription() const { return m_fontDescription; } @@ -152,6 +150,10 @@ public: static void setShouldUseSmoothing(bool); static bool shouldUseSmoothing(); +#if USE(FONT_FAST_PATH) + enum CodePath { Auto, Simple, Complex, SimpleWithGlyphOverflow }; +#endif + private: #if ENABLE(SVG_FONTS) void drawTextUsingSVGFont(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const; @@ -162,11 +164,11 @@ private: #endif #if USE(FONT_FAST_PATH) - bool canUseGlyphCache(const TextRun&) const; + CodePath codePath(const TextRun&) const; void drawSimpleText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const; void drawGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&, int from, int to, const FloatPoint&) const; void drawGlyphBuffer(GraphicsContext*, const GlyphBuffer&, const TextRun&, const FloatPoint&) const; - float floatWidthForSimpleText(const TextRun&, GlyphBuffer*, HashSet<const SimpleFontData*>* fallbackFonts = 0) const; + float floatWidthForSimpleText(const TextRun&, GlyphBuffer*, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const; int offsetForPositionForSimpleText(const TextRun&, int position, bool includePartialGlyphs) const; FloatRect selectionRectForSimpleText(const TextRun&, const IntPoint&, int h, int from, int to) const; @@ -183,7 +185,6 @@ private: public: // Useful for debugging the different font rendering code paths. #if USE(FONT_FAST_PATH) - enum CodePath { Auto, Simple, Complex }; static void setCodePath(CodePath); static CodePath codePath(); static CodePath s_codePath; @@ -197,7 +198,7 @@ public: FontSelector* fontSelector() const; static bool treatAsSpace(UChar c) { return c == ' ' || c == '\t' || c == '\n' || c == 0x00A0; } - static bool treatAsZeroWidthSpace(UChar c) { return c < 0x20 || (c >= 0x7F && c < 0xA0) || c == 0x200e || c == 0x200f || (c >= 0x202a && c <= 0x202e) || c == 0xFFFC; } + static bool treatAsZeroWidthSpace(UChar c) { return c < 0x20 || (c >= 0x7F && c < 0xA0) || (c >= 0x200c && c <= 0x200f) || (c >= 0x202a && c <= 0x202e) || c == 0xFFFC; } static inline UChar normalizeSpaces(UChar character) { diff --git a/WebCore/platform/graphics/FontFastPath.cpp b/WebCore/platform/graphics/FontFastPath.cpp index 6e2a744..f57ae5b 100644 --- a/WebCore/platform/graphics/FontFastPath.cpp +++ b/WebCore/platform/graphics/FontFastPath.cpp @@ -190,73 +190,64 @@ Font::CodePath Font::codePath() return s_codePath; } -bool Font::canUseGlyphCache(const TextRun& run) const +Font::CodePath Font::codePath(const TextRun& run) const { - switch (s_codePath) { - case Auto: - break; - case Simple: - return true; - case Complex: - return false; - } - + if (s_codePath != Auto) + return s_codePath; + // Start from 0 since drawing and highlighting also measure the characters before run->from for (int i = 0; i < run.length(); i++) { const UChar c = run[i]; if (c < 0x300) // U+0300 through U+036F Combining diacritical marks continue; if (c <= 0x36F) - return false; + return Complex; if (c < 0x0591 || c == 0x05BE) // U+0591 through U+05CF excluding U+05BE Hebrew combining marks, Hebrew punctuation Paseq, Sof Pasuq and Nun Hafukha continue; if (c <= 0x05CF) - return false; + return Complex; if (c < 0x0600) // U+0600 through U+1059 Arabic, Syriac, Thaana, Devanagari, Bengali, Gurmukhi, Gujarati, Oriya, Tamil, Telugu, Kannada, Malayalam, Sinhala, Thai, Lao, Tibetan, Myanmar continue; if (c <= 0x1059) - return false; + return Complex; if (c < 0x1100) // U+1100 through U+11FF Hangul Jamo (only Ancient Korean should be left here if you precompose; Modern Korean will be precomposed as a result of step A) continue; if (c <= 0x11FF) - return false; + return Complex; if (c < 0x1780) // U+1780 through U+18AF Khmer, Mongolian continue; if (c <= 0x18AF) - return false; + return Complex; if (c < 0x1900) // U+1900 through U+194F Limbu (Unicode 4.0) continue; if (c <= 0x194F) - return false; + return Complex; - // FIXME: we should not use complex text path for these characters. - if (c < 0x1E00) // U+1E00 through U+2000 characters with diacritics and stacked diacritics continue; if (c <= 0x2000) - return false; + return SimpleWithGlyphOverflow; if (c < 0x20D0) // U+20D0 through U+20FF Combining marks for symbols continue; if (c <= 0x20FF) - return false; + return Complex; if (c < 0xFE20) // U+FE20 through U+FE2F Combining half marks continue; if (c <= 0xFE2F) - return false; + return Complex; } if (typesettingFeatures()) - return false; - - return true; + return Complex; + return Simple; } void Font::drawSimpleText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const @@ -321,10 +312,18 @@ void Font::drawGlyphBuffer(GraphicsContext* context, const GlyphBuffer& glyphBuf drawGlyphs(context, fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint); } -float Font::floatWidthForSimpleText(const TextRun& run, GlyphBuffer* glyphBuffer, HashSet<const SimpleFontData*>* fallbackFonts) const +float Font::floatWidthForSimpleText(const TextRun& run, GlyphBuffer* glyphBuffer, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const { - WidthIterator it(this, run, fallbackFonts); + WidthIterator it(this, run, fallbackFonts, glyphOverflow); it.advance(run.length(), glyphBuffer); + + if (glyphOverflow) { + glyphOverflow->top = max<int>(glyphOverflow->top, ceilf(-it.minGlyphBoundingBoxY()) - ascent()); + glyphOverflow->bottom = max<int>(glyphOverflow->bottom, ceilf(it.maxGlyphBoundingBoxY()) - descent()); + glyphOverflow->left = ceilf(it.firstGlyphOverflow()); + glyphOverflow->right = ceilf(it.lastGlyphOverflow()); + } + return it.m_runWidthSoFar; } diff --git a/WebCore/platform/graphics/GlyphBuffer.h b/WebCore/platform/graphics/GlyphBuffer.h index edb804c..6f1fe7b 100644 --- a/WebCore/platform/graphics/GlyphBuffer.h +++ b/WebCore/platform/graphics/GlyphBuffer.h @@ -34,7 +34,7 @@ #include <wtf/UnusedParam.h> #include <wtf/Vector.h> -#if PLATFORM(CG) +#if PLATFORM(CG) || (PLATFORM(WX) && OS(DARWIN)) #include <ApplicationServices/ApplicationServices.h> #endif @@ -58,7 +58,7 @@ typedef Glyph GlyphBufferGlyph; // CG uses CGSize instead of FloatSize so that the result of advances() // can be passed directly to CGContextShowGlyphsWithAdvances in FontMac.mm -#if PLATFORM(CG) +#if PLATFORM(CG) || (PLATFORM(WX) && OS(DARWIN)) typedef CGSize GlyphBufferAdvance; #elif OS(WINCE) // There is no cross-platform code that uses the height of GlyphBufferAdvance, @@ -122,7 +122,7 @@ public: float advanceAt(int index) const { -#if PLATFORM(CG) +#if PLATFORM(CG) || (PLATFORM(WX) && OS(DARWIN)) return m_advances[index].width; #elif OS(WINCE) return m_advances[index]; @@ -153,7 +153,7 @@ public: m_glyphs.append(glyph); #endif -#if PLATFORM(CG) +#if PLATFORM(CG) || (PLATFORM(WX) && OS(DARWIN)) CGSize advance = { width, 0 }; m_advances.append(advance); #elif OS(WINCE) diff --git a/WebCore/platform/graphics/GlyphMetricsMap.h b/WebCore/platform/graphics/GlyphMetricsMap.h index 49854be..5e13afe 100644 --- a/WebCore/platform/graphics/GlyphMetricsMap.h +++ b/WebCore/platform/graphics/GlyphMetricsMap.h @@ -29,7 +29,6 @@ #ifndef GlyphMetricsMap_h #define GlyphMetricsMap_h -#include "FloatRect.h" #include <wtf/HashMap.h> #include <wtf/OwnPtr.h> #include <wtf/unicode/Unicode.h> @@ -40,12 +39,7 @@ typedef unsigned short Glyph; const float cGlyphSizeUnknown = -1; -struct GlyphMetrics { - float horizontalAdvance; - FloatRect boundingBox; -}; - -class GlyphMetricsMap : public Noncopyable { +template<class T> class GlyphMetricsMap : public Noncopyable { public: GlyphMetricsMap() : m_filledPrimaryPage(false) { } ~GlyphMetricsMap() @@ -54,17 +48,12 @@ public: deleteAllValues(*m_pages); } - GlyphMetrics metricsForGlyph(Glyph glyph) + T metricsForGlyph(Glyph glyph) { return locatePage(glyph / GlyphMetricsPage::size)->metricsForGlyph(glyph); } - float widthForGlyph(Glyph glyph) - { - return locatePage(glyph / GlyphMetricsPage::size)->metricsForGlyph(glyph).horizontalAdvance; - } - - void setMetricsForGlyph(Glyph glyph, const GlyphMetrics& metrics) + void setMetricsForGlyph(Glyph glyph, const T& metrics) { locatePage(glyph / GlyphMetricsPage::size)->setMetricsForGlyph(glyph, metrics); } @@ -72,14 +61,14 @@ public: private: struct GlyphMetricsPage { static const size_t size = 256; // Usually covers Latin-1 in a single page. - GlyphMetrics m_metrics[size]; + T m_metrics[size]; - GlyphMetrics metricsForGlyph(Glyph glyph) const { return m_metrics[glyph % size]; } - void setMetricsForGlyph(Glyph glyph, const GlyphMetrics& metrics) + T metricsForGlyph(Glyph glyph) const { return m_metrics[glyph % size]; } + void setMetricsForGlyph(Glyph glyph, const T& metrics) { setMetricsForIndex(glyph % size, metrics); } - void setMetricsForIndex(unsigned index, const GlyphMetrics& metrics) + void setMetricsForIndex(unsigned index, const T& metrics) { m_metrics[index] = metrics; } @@ -94,11 +83,47 @@ private: GlyphMetricsPage* locatePageSlowCase(unsigned pageNumber); + static T unknownMetrics(); + bool m_filledPrimaryPage; GlyphMetricsPage m_primaryPage; // We optimize for the page that contains glyph indices 0-255. OwnPtr<HashMap<int, GlyphMetricsPage*> > m_pages; }; +template<> inline float GlyphMetricsMap<float>::unknownMetrics() +{ + return cGlyphSizeUnknown; +} + +template<> inline FloatRect GlyphMetricsMap<FloatRect>::unknownMetrics() +{ + return FloatRect(0, 0, cGlyphSizeUnknown, cGlyphSizeUnknown); +} + +template<class T> typename GlyphMetricsMap<T>::GlyphMetricsPage* GlyphMetricsMap<T>::locatePageSlowCase(unsigned pageNumber) +{ + GlyphMetricsPage* page; + if (!pageNumber) { + ASSERT(!m_filledPrimaryPage); + page = &m_primaryPage; + m_filledPrimaryPage = true; + } else { + if (m_pages) { + if ((page = m_pages->get(pageNumber))) + return page; + } else + m_pages.set(new HashMap<int, GlyphMetricsPage*>); + page = new GlyphMetricsPage; + m_pages->set(pageNumber, page); + } + + // Fill in the whole page with the unknown glyph information. + for (unsigned i = 0; i < GlyphMetricsPage::size; i++) + page->setMetricsForIndex(i, unknownMetrics()); + + return page; +} + } // namespace WebCore #endif diff --git a/WebCore/platform/graphics/GlyphPageTreeNode.cpp b/WebCore/platform/graphics/GlyphPageTreeNode.cpp index 59a5efb..dac26b3 100644 --- a/WebCore/platform/graphics/GlyphPageTreeNode.cpp +++ b/WebCore/platform/graphics/GlyphPageTreeNode.cpp @@ -124,6 +124,18 @@ GlyphPageTreeNode::~GlyphPageTreeNode() delete m_systemFallbackChild; } +static bool fill(GlyphPage* pageToFill, unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData) +{ + if (!fontData->isSVGFont()) + return pageToFill->fill(offset, length, buffer, bufferLength, fontData); + + // SVG Fonts do not use the glyph page cache. Zero fill the glyph + // positions and return false to indicate the glyphs were not found. + for (unsigned i = 0; i < length; ++i) + pageToFill->setGlyphDataForIndex(offset + i, 0, 0); + return false; +} + void GlyphPageTreeNode::initializePage(const FontData* fontData, unsigned pageNumber) { ASSERT(!m_page); @@ -165,13 +177,15 @@ void GlyphPageTreeNode::initializePage(const FontData* fontData, unsigned pageNu buffer[(int)'\t'] = ' '; buffer[noBreakSpace] = ' '; } else if (start == (leftToRightMark & ~(GlyphPage::size - 1))) { - // LRM, RLM, LRE, RLE and PDF must not render at all. + // LRM, RLM, LRE, RLE, ZWNJ, ZWJ, and PDF must not render at all. buffer[leftToRightMark - start] = zeroWidthSpace; buffer[rightToLeftMark - start] = zeroWidthSpace; buffer[leftToRightEmbed - start] = zeroWidthSpace; buffer[rightToLeftEmbed - start] = zeroWidthSpace; buffer[leftToRightOverride - start] = zeroWidthSpace; buffer[rightToLeftOverride - start] = zeroWidthSpace; + buffer[zeroWidthNonJoiner - start] = zeroWidthSpace; + buffer[zeroWidthJoiner - start] = zeroWidthSpace; buffer[popDirectionalFormatting - start] = zeroWidthSpace; } else if (start == (objectReplacementCharacter & ~(GlyphPage::size - 1))) { // Object replacement character must not render at all. @@ -221,7 +235,7 @@ void GlyphPageTreeNode::initializePage(const FontData* fontData, unsigned pageNu } zeroFilled = true; } - haveGlyphs |= pageToFill->fill(from, to - from, buffer + from * (start < 0x10000 ? 1 : 2), (to - from) * (start < 0x10000 ? 1 : 2), range.fontData()); + haveGlyphs |= fill(pageToFill, from, to - from, buffer + from * (start < 0x10000 ? 1 : 2), (to - from) * (start < 0x10000 ? 1 : 2), range.fontData()); if (scratchPage) { ASSERT(to <= static_cast<int>(GlyphPage::size)); for (int j = from; j < to; j++) { @@ -232,7 +246,7 @@ void GlyphPageTreeNode::initializePage(const FontData* fontData, unsigned pageNu } } } else - haveGlyphs = m_page->fill(0, GlyphPage::size, buffer, bufferLength, static_cast<const SimpleFontData*>(fontData)); + haveGlyphs = fill(m_page.get(), 0, GlyphPage::size, buffer, bufferLength, static_cast<const SimpleFontData*>(fontData)); if (!haveGlyphs) m_page = 0; diff --git a/WebCore/platform/graphics/Gradient.cpp b/WebCore/platform/graphics/Gradient.cpp index daf4754..0e961ad 100644 --- a/WebCore/platform/graphics/Gradient.cpp +++ b/WebCore/platform/graphics/Gradient.cpp @@ -96,7 +96,14 @@ void Gradient::addColorStop(float value, const Color& color) m_stops.append(ColorStop(value, r, g, b, a)); m_stopsSorted = false; + platformDestroy(); +} +void Gradient::addColorStop(const Gradient::ColorStop& stop) +{ + m_stops.append(stop); + + m_stopsSorted = false; platformDestroy(); } diff --git a/WebCore/platform/graphics/Gradient.h b/WebCore/platform/graphics/Gradient.h index b6911f3..2c877af 100644 --- a/WebCore/platform/graphics/Gradient.h +++ b/WebCore/platform/graphics/Gradient.h @@ -87,6 +87,8 @@ namespace WebCore { } virtual ~Gradient(); + struct ColorStop; + void addColorStop(const ColorStop&); void addColorStop(float, const Color&); void getColor(float value, float* r, float* g, float* b, float* a) const; @@ -97,7 +99,6 @@ namespace WebCore { float r0() const { return m_r0; } float r1() const { return m_r1; } bool isRadial() const { return m_radial; } - struct ColorStop; const Vector<ColorStop>& getStops() const; #else #if PLATFORM(ANDROID) diff --git a/WebCore/platform/graphics/GraphicsContext3D.h b/WebCore/platform/graphics/GraphicsContext3D.h index 45f6f06..b64e9d3 100644 --- a/WebCore/platform/graphics/GraphicsContext3D.h +++ b/WebCore/platform/graphics/GraphicsContext3D.h @@ -479,6 +479,8 @@ namespace WebCore { bool flipVertically, AlphaOp alphaOp); + bool isGLES2Compliant() const; + //---------------------------------------------------------------------- // Entry points for WebGL. // @@ -607,16 +609,12 @@ namespace WebCore { void stencilOp(unsigned long fail, unsigned long zfail, unsigned long zpass); void stencilOpSeparate(unsigned long face, unsigned long fail, unsigned long zfail, unsigned long zpass); - // These next several functions return an error code (0 if no errors) rather than using an ExceptionCode. - // Currently they return -1 on any error. int texImage2D(unsigned target, unsigned level, unsigned internalformat, unsigned width, unsigned height, unsigned border, unsigned format, unsigned type, void* pixels); - int texImage2D(unsigned target, unsigned level, Image* image, bool flipY, bool premultiplyAlpha); void texParameterf(unsigned target, unsigned pname, float param); void texParameteri(unsigned target, unsigned pname, int param); int texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, unsigned width, unsigned height, unsigned format, unsigned type, void* pixels); - int texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, Image* image, bool flipY, bool premultiplyAlpha); void uniform1f(long location, float x); void uniform1fv(long location, float* v, int size); @@ -659,6 +657,9 @@ namespace WebCore { // Helpers for notification about paint events void beginPaint(WebGLRenderingContext* context); void endPaint(); +#if PLATFORM(QT) + void paint(QPainter* painter, const QRect& rect) const; +#endif // Support for buffer creation and deletion unsigned createBuffer(); diff --git a/WebCore/platform/graphics/MediaPlayer.cpp b/WebCore/platform/graphics/MediaPlayer.cpp index 55fa900..ee82083 100644 --- a/WebCore/platform/graphics/MediaPlayer.cpp +++ b/WebCore/platform/graphics/MediaPlayer.cpp @@ -50,7 +50,8 @@ #elif PLATFORM(GTK) #include "MediaPlayerPrivateGStreamer.h" #elif PLATFORM(QT) -#if QT_VERSION < 0x040700 +// QtMultimedia support is disabled currently. +#if 1 || (QT_VERSION < 0x040700) #include "MediaPlayerPrivatePhonon.h" #else #include "MediaPlayerPrivateQt.h" diff --git a/WebCore/platform/graphics/SimpleFontData.cpp b/WebCore/platform/graphics/SimpleFontData.cpp index 04b6ab1..1cc3b4c 100644 --- a/WebCore/platform/graphics/SimpleFontData.cpp +++ b/WebCore/platform/graphics/SimpleFontData.cpp @@ -92,6 +92,7 @@ SimpleFontData::SimpleFontData(const FontPlatformData& f, bool customFont, bool // FIXME: is there a way we can get the space glyph from the SVGGlyphIdentifier above? m_spaceGlyph = 0; + m_zeroWidthSpaceGlyph = 0; determinePitch(); m_adjustedSpaceWidth = roundf(m_spaceWidth); m_missingGlyphData.fontData = this; @@ -136,11 +137,14 @@ void SimpleFontData::platformGlyphInit() m_spaceWidth = 0; m_adjustedSpaceWidth = 0; determinePitch(); + m_zeroWidthSpaceGlyph = 0; m_missingGlyphData.fontData = this; m_missingGlyphData.glyph = 0; return; } + m_zeroWidthSpaceGlyph = glyphPageZero->glyphDataForCharacter(0).glyph; + // Nasty hack to determine if we should round or ceil space widths. // If the font is monospace or fake monospace we ceil to ensure that // every character and the space are the same width. Otherwise we round. @@ -155,14 +159,9 @@ void SimpleFontData::platformGlyphInit() // See <http://bugs.webkit.org/show_bug.cgi?id=13178> // Ask for the glyph for 0 to avoid paging in ZERO WIDTH SPACE. Control characters, including 0, // are mapped to the ZERO WIDTH SPACE glyph. - Glyph zeroWidthSpaceGlyph = glyphPageZero->glyphDataForCharacter(0).glyph; - if (zeroWidthSpaceGlyph) { - if (zeroWidthSpaceGlyph != m_spaceGlyph) { - GlyphMetrics metrics; - metrics.horizontalAdvance = 0; - m_glyphToMetricsMap.setMetricsForGlyph(zeroWidthSpaceGlyph, metrics); - } else - LOG_ERROR("Font maps SPACE and ZERO WIDTH SPACE to the same glyph. Glyph width not overridden."); + if (m_zeroWidthSpaceGlyph == m_spaceGlyph) { + m_zeroWidthSpaceGlyph = 0; + LOG_ERROR("Font maps SPACE and ZERO WIDTH SPACE to the same glyph. Glyph width will not be overridden."); } m_missingGlyphData.fontData = this; diff --git a/WebCore/platform/graphics/SimpleFontData.h b/WebCore/platform/graphics/SimpleFontData.h index efdbba4..4c34f2b 100644 --- a/WebCore/platform/graphics/SimpleFontData.h +++ b/WebCore/platform/graphics/SimpleFontData.h @@ -26,6 +26,7 @@ #include "FontData.h" #include "FontPlatformData.h" +#include "FloatRect.h" #include "GlyphMetricsMap.h" #include "GlyphPageTreeNode.h" #include "TypesettingFeatures.h" @@ -35,6 +36,11 @@ typedef struct OpaqueATSUStyle* ATSUStyle; #endif +#if USE(CORE_TEXT) +#include <ApplicationServices/ApplicationServices.h> +#include <wtf/RetainPtr.h> +#endif + #if (PLATFORM(WIN) && !OS(WINCE)) \ || (OS(WINDOWS) && PLATFORM(WX)) #include <usp10.h> @@ -60,7 +66,6 @@ class SharedBuffer; class SVGFontData; enum Pitch { UnknownPitch, FixedPitch, VariablePitch }; -enum GlyphMetricsMode { GlyphBoundingBox, GlyphWidthOnly }; class SimpleFontData : public FontData { public: @@ -81,14 +86,15 @@ public: float xHeight() const { return m_xHeight; } unsigned unitsPerEm() const { return m_unitsPerEm; } - float widthForGlyph(Glyph glyph) const { return metricsForGlyph(glyph, GlyphWidthOnly).horizontalAdvance; } - GlyphMetrics metricsForGlyph(Glyph, GlyphMetricsMode = GlyphBoundingBox) const; - GlyphMetrics platformMetricsForGlyph(Glyph, GlyphMetricsMode) const; + FloatRect boundsForGlyph(Glyph) const; + float widthForGlyph(Glyph glyph) const; + FloatRect platformBoundsForGlyph(Glyph) const; + float platformWidthForGlyph(Glyph) const; float spaceWidth() const { return m_spaceWidth; } float adjustedSpaceWidth() const { return m_adjustedSpaceWidth; } -#if PLATFORM(CG) || PLATFORM(CAIRO) || (OS(WINDOWS) && PLATFORM(WX)) +#if PLATFORM(CG) || PLATFORM(CAIRO) || PLATFORM(WX) float syntheticBoldOffset() const { return m_syntheticBoldOffset; } #endif @@ -119,6 +125,8 @@ public: #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) NSFont* getNSFont() const { return m_platformData.font(); } +#elif (PLATFORM(WX) && OS(DARWIN)) + NSFont* getNSFont() const { return m_platformData.nsFont(); } #endif #if USE(CORE_TEXT) @@ -168,7 +176,8 @@ private: || (OS(WINDOWS) && PLATFORM(WX)) void initGDIFont(); void platformCommonDestroy(); - GlyphMetrics metricsForGDIGlyph(Glyph glyph) const; + FloatRect boundsForGDIGlyph(Glyph glyph) const; + float widthForGDIGlyph(Glyph glyph) const; #endif int m_ascent; @@ -182,7 +191,8 @@ private: FontPlatformData m_platformData; - mutable GlyphMetricsMap m_glyphToMetricsMap; + mutable GlyphMetricsMap<FloatRect> m_glyphToBoundsMap; + mutable GlyphMetricsMap<float> m_glyphToWidthMap; bool m_treatAsFixedPitch; @@ -197,11 +207,13 @@ private: float m_spaceWidth; float m_adjustedSpaceWidth; + Glyph m_zeroWidthSpaceGlyph; + GlyphData m_missingGlyphData; mutable SimpleFontData* m_smallCapsFontData; -#if PLATFORM(CG) || PLATFORM(CAIRO) || (OS(WINDOWS) && PLATFORM(WX)) +#if PLATFORM(CG) || PLATFORM(CAIRO) || PLATFORM(WX) float m_syntheticBoldOffset; #endif @@ -238,16 +250,32 @@ private: #if !PLATFORM(QT) -ALWAYS_INLINE GlyphMetrics SimpleFontData::metricsForGlyph(Glyph glyph, GlyphMetricsMode metricsMode) const +ALWAYS_INLINE FloatRect SimpleFontData::boundsForGlyph(Glyph glyph) const +{ + if (glyph == m_zeroWidthSpaceGlyph && glyph) + return FloatRect(); + + FloatRect bounds = m_glyphToBoundsMap.metricsForGlyph(glyph); + if (bounds.width() != cGlyphSizeUnknown) + return bounds; + + bounds = platformBoundsForGlyph(glyph); + m_glyphToBoundsMap.setMetricsForGlyph(glyph, bounds); + return bounds; +} + +ALWAYS_INLINE float SimpleFontData::widthForGlyph(Glyph glyph) const { - GlyphMetrics metrics = m_glyphToMetricsMap.metricsForGlyph(glyph); - if ((metricsMode == GlyphWidthOnly && metrics.horizontalAdvance != cGlyphSizeUnknown) || (metricsMode == GlyphBoundingBox && metrics.boundingBox.width() != cGlyphSizeUnknown)) - return metrics; + if (glyph == m_zeroWidthSpaceGlyph && glyph) + return 0; - metrics = platformMetricsForGlyph(glyph, metricsMode); - m_glyphToMetricsMap.setMetricsForGlyph(glyph, metrics); + float width = m_glyphToWidthMap.metricsForGlyph(glyph); + if (width != cGlyphSizeUnknown) + return width; - return metrics; + width = platformWidthForGlyph(glyph); + m_glyphToWidthMap.setMetricsForGlyph(glyph, width); + return width; } #endif diff --git a/WebCore/platform/graphics/TextRun.h b/WebCore/platform/graphics/TextRun.h index 166b047..03d7b9f 100644 --- a/WebCore/platform/graphics/TextRun.h +++ b/WebCore/platform/graphics/TextRun.h @@ -29,7 +29,7 @@ namespace WebCore { class RenderObject; -class SVGPaintServer; +class RenderSVGResource; class TextRun { public: @@ -47,7 +47,7 @@ public: , m_disableSpacing(false) #if ENABLE(SVG_FONTS) , m_referencingRenderObject(0) - , m_activePaintServer(0) + , m_activePaintingResource(0) #endif { } @@ -66,7 +66,7 @@ public: , m_disableSpacing(false) #if ENABLE(SVG_FONTS) , m_referencingRenderObject(0) - , m_activePaintServer(0) + , m_activePaintingResource(0) #endif { } @@ -98,8 +98,8 @@ public: RenderObject* referencingRenderObject() const { return m_referencingRenderObject; } void setReferencingRenderObject(RenderObject* object) { m_referencingRenderObject = object; } - SVGPaintServer* activePaintServer() const { return m_activePaintServer; } - void setActivePaintServer(SVGPaintServer* object) { m_activePaintServer = object; } + RenderSVGResource* activePaintingResource() const { return m_activePaintingResource; } + void setActivePaintingResource(RenderSVGResource* object) { m_activePaintingResource = object; } #endif private: @@ -117,7 +117,7 @@ private: #if ENABLE(SVG_FONTS) RenderObject* m_referencingRenderObject; - SVGPaintServer* m_activePaintServer; + RenderSVGResource* m_activePaintingResource; #endif }; diff --git a/WebCore/platform/graphics/WidthIterator.cpp b/WebCore/platform/graphics/WidthIterator.cpp index 9157310..996ce40 100644 --- a/WebCore/platform/graphics/WidthIterator.cpp +++ b/WebCore/platform/graphics/WidthIterator.cpp @@ -33,13 +33,14 @@ using namespace WTF; using namespace Unicode; +using namespace std; namespace WebCore { // According to http://www.unicode.org/Public/UNIDATA/UCD.html#Canonical_Combining_Class_Values static const uint8_t hiraganaKatakanaVoicingMarksCombiningClass = 8; -WidthIterator::WidthIterator(const Font* font, const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts) +WidthIterator::WidthIterator(const Font* font, const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, bool accountForGlyphBounds) : m_font(font) , m_run(run) , m_end(run.length()) @@ -47,6 +48,11 @@ WidthIterator::WidthIterator(const Font* font, const TextRun& run, HashSet<const , m_runWidthSoFar(0) , m_finalRoundingWidth(0) , m_fallbackFonts(fallbackFonts) + , m_accountForGlyphBounds(accountForGlyphBounds) + , m_maxGlyphBoundingBoxY(numeric_limits<float>::min()) + , m_minGlyphBoundingBoxY(numeric_limits<float>::max()) + , m_firstGlyphOverflow(0) + , m_lastGlyphOverflow(0) { // If the padding is non-zero, count the number of spaces in the run // and divide that by the padding for per space addition. @@ -79,6 +85,7 @@ void WidthIterator::advance(int offset, GlyphBuffer* glyphBuffer) float runWidthSoFar = m_runWidthSoFar; float lastRoundingWidth = m_finalRoundingWidth; + FloatRect bounds; const SimpleFontData* primaryFont = m_font->primaryFont(); const SimpleFontData* lastFontData = primaryFont; @@ -175,6 +182,12 @@ void WidthIterator::advance(int offset, GlyphBuffer* glyphBuffer) } } + if (m_accountForGlyphBounds) { + bounds = fontData->boundsForGlyph(glyph); + if (!currentCharacter) + m_firstGlyphOverflow = max<float>(0, -bounds.x()); + } + // Advance past the character we just dealt with. cp += clusterLength; currentCharacter += clusterLength; @@ -205,6 +218,12 @@ void WidthIterator::advance(int offset, GlyphBuffer* glyphBuffer) glyphBuffer->add(glyph, fontData, (rtl ? oldWidth + lastRoundingWidth : width)); lastRoundingWidth = width - oldWidth; + + if (m_accountForGlyphBounds) { + m_maxGlyphBoundingBoxY = max(m_maxGlyphBoundingBoxY, bounds.bottom()); + m_minGlyphBoundingBoxY = min(m_minGlyphBoundingBoxY, bounds.y()); + m_lastGlyphOverflow = max<float>(0, bounds.right() - width); + } } m_currentCharacter = currentCharacter; diff --git a/WebCore/platform/graphics/WidthIterator.h b/WebCore/platform/graphics/WidthIterator.h index 7ca4198..d42a0c5 100644 --- a/WebCore/platform/graphics/WidthIterator.h +++ b/WebCore/platform/graphics/WidthIterator.h @@ -33,11 +33,16 @@ class SimpleFontData; class TextRun; struct WidthIterator { - WidthIterator(const Font*, const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0); + WidthIterator(const Font*, const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, bool accountForGlyphBounds = false); void advance(int to, GlyphBuffer* = 0); bool advanceOneCharacter(float& width, GlyphBuffer* = 0); + float maxGlyphBoundingBoxY() const { ASSERT(m_accountForGlyphBounds); return m_maxGlyphBoundingBoxY; } + float minGlyphBoundingBoxY() const { ASSERT(m_accountForGlyphBounds); return m_minGlyphBoundingBoxY; } + float firstGlyphOverflow() const { ASSERT(m_accountForGlyphBounds); return m_firstGlyphOverflow; } + float lastGlyphOverflow() const { ASSERT(m_accountForGlyphBounds); return m_lastGlyphOverflow; } + const Font* m_font; const TextRun& m_run; @@ -51,7 +56,13 @@ struct WidthIterator { private: UChar32 normalizeVoicingMarks(int currentCharacter); + HashSet<const SimpleFontData*>* m_fallbackFonts; + bool m_accountForGlyphBounds; + float m_maxGlyphBoundingBoxY; + float m_minGlyphBoundingBoxY; + float m_firstGlyphOverflow; + float m_lastGlyphOverflow; }; } diff --git a/WebCore/platform/graphics/cairo/FontCacheCairo.cpp b/WebCore/platform/graphics/cairo/FontCacheCairo.cpp index d2b2f39..79b32b4 100644 --- a/WebCore/platform/graphics/cairo/FontCacheCairo.cpp +++ b/WebCore/platform/graphics/cairo/FontCacheCairo.cpp @@ -39,6 +39,11 @@ const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, cons FcResult fresult; FontPlatformData* prim = const_cast<FontPlatformData*>(&font.primaryFont()->platformData()); + // FIXME: This should not happen, apparently. We are null-checking + // for now just to avoid crashing. + if (!prim || !prim->m_pattern) + return 0; + if (!prim->m_fallbacks) prim->m_fallbacks = FcFontSort(NULL, prim->m_pattern, FcTrue, NULL, &fresult); diff --git a/WebCore/platform/graphics/cairo/FontPlatformData.h b/WebCore/platform/graphics/cairo/FontPlatformData.h index 3c926fe..d271f5b 100644 --- a/WebCore/platform/graphics/cairo/FontPlatformData.h +++ b/WebCore/platform/graphics/cairo/FontPlatformData.h @@ -28,9 +28,10 @@ #ifndef FontPlatformData_h #define FontPlatformData_h +#include <cairo.h> #include "FontDescription.h" #include "GlyphBuffer.h" -#include <cairo.h> + #if defined(USE_FREETYPE) #include <cairo-ft.h> #include <fontconfig/fcfreetype.h> @@ -38,7 +39,7 @@ #include <pango/pangocairo.h> #elif PLATFORM(WIN) #include <cairo-win32.h> -#include "RefCountedHFONT.h" +#include "RefCountedGDIHandle.h" #include "StringImpl.h" #else #error "Must defined a font backend" @@ -107,7 +108,7 @@ public: #if !PLATFORM(WIN) static bool init(); #else - HFONT hfont() const { return m_font->hfont(); } + HFONT hfont() const { return m_font->handle(); } bool useGDI() const { return m_useGDI; } cairo_font_face_t* fontFace() const { return m_fontFace; } #endif @@ -164,7 +165,7 @@ public: private: void platformDataInit(HFONT, float size, HDC, WCHAR* faceName); - RefPtr<RefCountedHFONT> m_font; + RefPtr<RefCountedGDIHandle<HFONT> > m_font; cairo_font_face_t* m_fontFace; bool m_useGDI; #else diff --git a/WebCore/platform/graphics/cairo/SimpleFontDataCairo.cpp b/WebCore/platform/graphics/cairo/SimpleFontDataCairo.cpp index 0be45f6..0055078 100644 --- a/WebCore/platform/graphics/cairo/SimpleFontDataCairo.cpp +++ b/WebCore/platform/graphics/cairo/SimpleFontDataCairo.cpp @@ -83,9 +83,9 @@ SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDes { if (!m_smallCapsFontData) { FontDescription desc = FontDescription(fontDescription); - desc.setComputedSize(0.70f*fontDescription.computedSize()); - const FontPlatformData* pdata = new FontPlatformData(desc, desc.family().family()); - m_smallCapsFontData = new SimpleFontData(*pdata); + desc.setComputedSize(0.70f * fontDescription.computedSize()); + FontPlatformData platformData(desc, desc.family().family()); + m_smallCapsFontData = new SimpleFontData(platformData); } return m_smallCapsFontData; } @@ -114,7 +114,12 @@ void SimpleFontData::determinePitch() m_treatAsFixedPitch = m_platformData.isFixedPitch(); } -GlyphMetrics SimpleFontData::platformMetricsForGlyph(Glyph glyph, GlyphMetricsMode) const +FloatRect SimpleFontData::platformBoundsForGlyph(Glyph) const +{ + return FloatRect(); +} + +float SimpleFontData::platformWidthForGlyph(Glyph glyph) const { ASSERT(m_platformData.m_scaledFont); @@ -125,10 +130,8 @@ GlyphMetrics SimpleFontData::platformMetricsForGlyph(Glyph glyph, GlyphMetricsMo float w = (float)m_spaceWidth; if (cairo_scaled_font_status(m_platformData.m_scaledFont) == CAIRO_STATUS_SUCCESS && extents.x_advance != 0) w = (float)extents.x_advance; - - GlyphMetrics metrics; - metrics.horizontalAdvance = w; - return metrics; + + return w; } } diff --git a/WebCore/platform/graphics/cg/FontPlatformData.h b/WebCore/platform/graphics/cg/FontPlatformData.h index da2b7e3..1da8916 100644 --- a/WebCore/platform/graphics/cg/FontPlatformData.h +++ b/WebCore/platform/graphics/cg/FontPlatformData.h @@ -24,7 +24,7 @@ #ifndef FontPlatformData_h #define FontPlatformData_h -#include "RefCountedHFONT.h" +#include "RefCountedGDIHandle.h" #include "StringImpl.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> @@ -57,7 +57,7 @@ public: FontPlatformData(WTF::HashTableDeletedValueType) : m_font(WTF::HashTableDeletedValue) { } bool isHashTableDeletedValue() const { return m_font.isHashTableDeletedValue(); } - HFONT hfont() const { return m_font->hfont(); } + HFONT hfont() const { return m_font->handle(); } CGFontRef cgFont() const { return m_cgFont.get(); } float size() const { return m_size; } @@ -88,7 +88,7 @@ public: private: void platformDataInit(HFONT, float size, HDC, WCHAR* faceName); - RefPtr<RefCountedHFONT> m_font; + RefPtr<RefCountedGDIHandle<HFONT> > m_font; RetainPtr<CGFontRef> m_cgFont; float m_size; diff --git a/WebCore/platform/graphics/cg/ImageSourceCG.cpp b/WebCore/platform/graphics/cg/ImageSourceCG.cpp index b4e1ca9..0b5f0b0 100644 --- a/WebCore/platform/graphics/cg/ImageSourceCG.cpp +++ b/WebCore/platform/graphics/cg/ImageSourceCG.cpp @@ -130,10 +130,12 @@ void ImageSource::setData(SharedBuffer* data, bool allDataReceived) if (!m_decoder) { m_decoder = CGImageSourceCreateIncremental(0); } else if (allDataReceived) { +#if !PLATFORM(WIN) // 10.6 bug workaround: image sources with final=false fail to draw into PDF contexts, so re-create image source // when data is complete. <rdar://problem/7874035> (<http://openradar.appspot.com/7874035>) CFRelease(m_decoder); m_decoder = CGImageSourceCreateIncremental(0); +#endif } // Create a CGDataProvider to wrap the SharedBuffer. data->ref(); diff --git a/WebCore/platform/graphics/chromium/FontLinux.cpp b/WebCore/platform/graphics/chromium/FontLinux.cpp index fa549cd..700b3ed 100644 --- a/WebCore/platform/graphics/chromium/FontLinux.cpp +++ b/WebCore/platform/graphics/chromium/FontLinux.cpp @@ -64,7 +64,7 @@ static bool isCanvasMultiLayered(SkCanvas* canvas) return !layerIterator.done(); } -static bool adjustTextRenderMode(SkPaint* paint, bool isCanvasMultiLayered) +static void adjustTextRenderMode(SkPaint* paint, bool isCanvasMultiLayered) { // Our layers only have a single alpha channel. This means that subpixel // rendered text cannot be compositied correctly when the layer is @@ -238,6 +238,23 @@ public: } else { if (!hb_utf16_script_run_next(&m_numCodePoints, &m_item.item, m_run.characters(), m_run.length(), &m_indexOfNextScriptRun)) return false; + + // It is actually wrong to consider script runs at all in this code. + // Other WebKit code (e.g. Mac) segments complex text just by finding + // the longest span of text covered by a single font. + // But we currently need to call hb_utf16_script_run_next anyway to fill + // in the harfbuzz data structures to e.g. pick the correct script's shaper. + // So we allow that to run first, then do a second pass over the range it + // found and take the largest subregion that stays within a single font. + const FontData* glyphData = m_font->glyphDataForCharacter(m_item.string[m_item.item.pos], false, false).fontData; + int endOfRun; + for (endOfRun = 1; endOfRun < m_item.item.length; ++endOfRun) { + const FontData* nextGlyphData = m_font->glyphDataForCharacter(m_item.string[m_item.item.pos + endOfRun], false, false).fontData; + if (nextGlyphData != glyphData) + break; + } + m_item.item.length = endOfRun; + m_indexOfNextScriptRun = m_item.item.pos + endOfRun; } setupFontForScriptRun(); @@ -358,9 +375,7 @@ private: void setupFontForScriptRun() { - const FontData* fontData = m_font->fontDataAt(0); - if (!fontData->containsCharacters(m_item.string + m_item.item.pos, m_item.item.length)) - fontData = m_font->fontDataForCharacters(m_item.string + m_item.item.pos, m_item.item.length); + const FontData* fontData = m_font->glyphDataForCharacter(m_item.string[m_item.item.pos], false, false).fontData; const FontPlatformData& platformData = fontData->fontDataForCharacter(' ')->platformData(); m_item.face = platformData.harfbuzzFace(); void* opaquePlatformData = const_cast<FontPlatformData*>(&platformData); @@ -590,7 +605,7 @@ int Font::offsetForPositionForComplexText(const TextRun& run, int x, if (walker.rtl()) basePosition -= walker.numCodePoints(); - if (x < walker.width()) { + if (x >= 0 && x < walker.width()) { // The x value in question is within this script run. We consider // each glyph in presentation order and stop when we find the one // covering this position. diff --git a/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp b/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp index 2475e65..7b22bad 100644 --- a/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp +++ b/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp @@ -148,7 +148,7 @@ void FontPlatformData::setupPaint(SkPaint* paint) const paint->setFakeBoldText(m_fakeBold); paint->setTextSkewX(m_fakeItalic ? -SK_Scalar1 / 4 : 0); - if (m_style.useAntiAlias == 1 || m_style.useAntiAlias == FontRenderStyle::NoPreference && isSkiaAntiAlias) + if (m_style.useAntiAlias == 1 || (m_style.useAntiAlias == FontRenderStyle::NoPreference && isSkiaAntiAlias)) paint->setLCDRenderText(m_style.useSubpixel == FontRenderStyle::NoPreference ? isSkiaSubpixelGlyphs : m_style.useSubpixel); } diff --git a/WebCore/platform/graphics/chromium/HarfbuzzSkia.cpp b/WebCore/platform/graphics/chromium/HarfbuzzSkia.cpp index be3b0d0..4fd3ba0 100644 --- a/WebCore/platform/graphics/chromium/HarfbuzzSkia.cpp +++ b/WebCore/platform/graphics/chromium/HarfbuzzSkia.cpp @@ -139,7 +139,7 @@ static HB_Error getOutlinePoint(HB_Font hbFont, HB_Glyph glyph, int flags, hb_ui uint16_t glyph16 = glyph; SkPath path; paint.getTextPath(&glyph16, sizeof(glyph16), 0, 0, &path); - int numPoints = path.getPoints(NULL, 0); + int numPoints = path.getPoints(0, 0); if (point >= numPoints) return HB_Err_Invalid_SubTable; SkPoint* points = reinterpret_cast<SkPoint*>(fastMalloc(sizeof(SkPoint) * (point + 1))); diff --git a/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp b/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp index 72bbfb4..f3d8b86 100644 --- a/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp +++ b/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp @@ -151,7 +151,12 @@ void SimpleFontData::determinePitch() ReleaseDC(0, dc); } -GlyphMetrics SimpleFontData::platformMetricsForGlyph(Glyph glyph, GlyphMetricsMode) const +FloatRect SimpleFontData::platformBoundsForGlyph(Glyph) const +{ + return FloatRect(); +} + +float SimpleFontData::platformWidthForGlyph(Glyph glyph) const { HDC dc = GetDC(0); HGDIOBJ oldFont = SelectObject(dc, m_platformData.hfont()); @@ -170,9 +175,7 @@ GlyphMetrics SimpleFontData::platformMetricsForGlyph(Glyph glyph, GlyphMetricsMo SelectObject(dc, oldFont); ReleaseDC(0, dc); - GlyphMetrics metrics; - metrics.horizontalAdvance = static_cast<float>(width); - return metrics; + return static_cast<float>(width); } } // namespace WebCore diff --git a/WebCore/platform/graphics/chromium/SimpleFontDataLinux.cpp b/WebCore/platform/graphics/chromium/SimpleFontDataLinux.cpp index 8c639aa..d03c615 100644 --- a/WebCore/platform/graphics/chromium/SimpleFontDataLinux.cpp +++ b/WebCore/platform/graphics/chromium/SimpleFontDataLinux.cpp @@ -172,7 +172,12 @@ void SimpleFontData::determinePitch() m_treatAsFixedPitch = platformData().isFixedPitch(); } -GlyphMetrics SimpleFontData::platformMetricsForGlyph(Glyph glyph, GlyphMetricsMode /* metricsMode */) const +FloatRect SimpleFontData::platformBoundsForGlyph(Glyph) const +{ + return FloatRect(); +} + +float SimpleFontData::platformWidthForGlyph(Glyph glyph) const { SkASSERT(sizeof(glyph) == 2); // compile-time assert @@ -186,9 +191,7 @@ GlyphMetrics SimpleFontData::platformMetricsForGlyph(Glyph glyph, GlyphMetricsMo // Though WebKit supports non-integral advances, Skia only supports them // for "subpixel" (distinct from LCD subpixel antialiasing) text, which // we don't use. - GlyphMetrics metrics; - metrics.horizontalAdvance = round(SkScalarToFloat(width)); - return metrics; + return round(SkScalarToFloat(width)); } } // namespace WebCore diff --git a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp index 0afb971..8f6c9e0 100644 --- a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp +++ b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp @@ -1111,6 +1111,7 @@ void MediaPlayerPrivateGStreamer::didEnd() float now = currentTime(); if (now > 0) { m_mediaDuration = now; + m_mediaDurationKnown = true; m_player->durationChanged(); } diff --git a/WebCore/platform/graphics/gtk/SimpleFontDataPango.cpp b/WebCore/platform/graphics/gtk/SimpleFontDataPango.cpp index 0ed5393..bdfe237 100644 --- a/WebCore/platform/graphics/gtk/SimpleFontDataPango.cpp +++ b/WebCore/platform/graphics/gtk/SimpleFontDataPango.cpp @@ -84,9 +84,9 @@ SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDes { if (!m_smallCapsFontData) { FontDescription desc = FontDescription(fontDescription); - desc.setSpecifiedSize(0.70f*fontDescription.computedSize()); - const FontPlatformData* pdata = new FontPlatformData(desc, desc.family().family()); - m_smallCapsFontData = new SimpleFontData(*pdata); + desc.setSpecifiedSize(0.70f * fontDescription.computedSize()); + FontPlatformData platformData(desc, desc.family().family()); + m_smallCapsFontData = new SimpleFontData(platformData); } return m_smallCapsFontData; } @@ -119,7 +119,12 @@ void SimpleFontData::determinePitch() m_treatAsFixedPitch = m_platformData.isFixedPitch(); } -GlyphMetrics SimpleFontData::platformMetricsForGlyph(Glyph glyph, GlyphMetricsMode) const +FloatRect SimpleFontData::platformBoundsForGlyph(Glyph) const +{ + return FloatRect(); +} + +float SimpleFontData::platformWidthForGlyph(Glyph glyph) const { ASSERT(m_platformData.m_scaledFont); @@ -127,13 +132,11 @@ GlyphMetrics SimpleFontData::platformMetricsForGlyph(Glyph glyph, GlyphMetricsMo cairo_text_extents_t extents; cairo_scaled_font_glyph_extents(m_platformData.m_scaledFont, &cglyph, 1, &extents); - float w = (float)m_spaceWidth; + float width = (float)m_spaceWidth; if (cairo_scaled_font_status(m_platformData.m_scaledFont) == CAIRO_STATUS_SUCCESS && extents.x_advance != 0) - w = (float)extents.x_advance; - - GlyphMetrics metrics; - metrics.horizontalAdvance = w; - return metrics; + width = (float)extents.x_advance; + + return width; } } diff --git a/WebCore/platform/graphics/haiku/ImageBufferData.h b/WebCore/platform/graphics/haiku/ImageBufferData.h index f978c34..7c676cd 100644 --- a/WebCore/platform/graphics/haiku/ImageBufferData.h +++ b/WebCore/platform/graphics/haiku/ImageBufferData.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.com> + * Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de> * * All rights reserved. * @@ -28,16 +28,23 @@ #ifndef ImageBufferData_h #define ImageBufferData_h +#include <Bitmap.h> +#include <View.h> + namespace WebCore { - class IntSize; +class IntSize; + +class ImageBufferData { +public: + ImageBufferData(const IntSize&); + ~ImageBufferData(); - class ImageBufferData { - public: - ImageBufferData(const IntSize&); - }; + BBitmap m_bitmap; + BView m_view; +}; -} // namespace WebCore +} // namespace WebCore -#endif // ImageBufferData_h +#endif // ImageBufferData_h diff --git a/WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp b/WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp index 276c968..44943d7 100644 --- a/WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp +++ b/WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.com> + * Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -20,28 +20,56 @@ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" #include "ImageBuffer.h" +#include "Base64.h" #include "GraphicsContext.h" #include "ImageData.h" -#include "NotImplemented.h" - +#include "MIMETypeRegistry.h" +#include "StillImageHaiku.h" +#include <wtf/text/CString.h> +#include <BitmapStream.h> +#include <String.h> +#include <TranslatorRoster.h> namespace WebCore { -ImageBufferData::ImageBufferData(const IntSize&) +ImageBufferData::ImageBufferData(const IntSize& size) + : m_bitmap(BRect(0, 0, size.width() - 1, size.height() - 1), B_RGBA32, true) + , m_view(m_bitmap.Bounds(), "WebKit ImageBufferData", 0, 0) { + // Always keep the bitmap locked, we are the only client. + m_bitmap.Lock(); + m_bitmap.AddChild(&m_view); + + // Fill with completely transparent color. + memset(m_bitmap.Bits(), 0, m_bitmap.BitsLength()); + + // Since ImageBuffer is used mainly for Canvas, explicitly initialize + // its view's graphics state with the corresponding canvas defaults + // NOTE: keep in sync with CanvasRenderingContext2D::State + m_view.SetLineMode(B_BUTT_CAP, B_MITER_JOIN, 10); + m_view.SetDrawingMode(B_OP_ALPHA); + m_view.SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_COMPOSITE); } -ImageBuffer::ImageBuffer(const IntSize&, ImageColorSpace imageColorSpace, bool& success) - : m_data(IntSize()) +ImageBufferData::~ImageBufferData() { - notImplemented(); - success = false; + // Remove the view from the bitmap, keeping it from being free'd twice. + m_view.RemoveSelf(); + m_bitmap.Unlock(); +} + +ImageBuffer::ImageBuffer(const IntSize& size, ImageColorSpace imageColorSpace, bool& success) + : m_data(size) + , m_size(size) +{ + m_context.set(new GraphicsContext(&m_data.m_view)); + success = true; } ImageBuffer::~ImageBuffer() @@ -50,47 +78,296 @@ ImageBuffer::~ImageBuffer() GraphicsContext* ImageBuffer::context() const { - notImplemented(); - return 0; + ASSERT(m_data.m_view.Window()); + + return m_context.get(); } -PassRefPtr<ImageData> ImageBuffer::getUnmultipliedImageData(const IntRect& rect) const +Image* ImageBuffer::image() const { - notImplemented(); - return 0; + if (!m_image) { + // It's assumed that if image() is called, the actual rendering to the + // GraphicsContext must be done. + ASSERT(context()); + m_data.m_view.Sync(); + m_image = StillImage::create(m_data.m_bitmap); + } + + return m_image.get(); } -PassRefPtr<ImageData> ImageBuffer::getPremultipliedImageData(const IntRect& rect) const +void ImageBuffer::platformTransformColorSpace(const Vector<int>& lookUpTable) { - notImplemented(); - return 0; + uint8* rowData = reinterpret_cast<uint8*>(m_data.m_bitmap.Bits()); + unsigned bytesPerRow = m_data.m_bitmap.BytesPerRow(); + unsigned rows = m_size.height(); + unsigned columns = m_size.width(); + for (unsigned y = 0; y < rows; y++) { + uint8* pixel = rowData; + for (unsigned x = 0; x < columns; x++) { + // lookUpTable doesn't seem to support a LUT for each color channel + // separately (judging from the other ports). We don't need to + // convert from/to pre-multiplied color space since BBitmap storage + // is not pre-multiplied. + pixel[0] = lookUpTable[pixel[0]]; + pixel[1] = lookUpTable[pixel[1]]; + pixel[2] = lookUpTable[pixel[2]]; + // alpha stays unmodified. + pixel += 4; + } + rowData += bytesPerRow; + } } -void ImageBuffer::putUnmultipliedImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +static inline void convertFromData(const uint8* sourceRows, unsigned sourceBytesPerRow, + uint8* destRows, unsigned destBytesPerRow, + unsigned rows, unsigned columns) { - notImplemented(); + for (unsigned y = 0; y < rows; y++) { + const uint8* sourcePixel = sourceRows; + uint8* destPixel = destRows; + for (unsigned x = 0; x < columns; x++) { + // RGBA -> BGRA or BGRA -> RGBA + destPixel[0] = sourcePixel[2]; + destPixel[1] = sourcePixel[1]; + destPixel[2] = sourcePixel[0]; + destPixel[3] = sourcePixel[3]; + destPixel += 4; + sourcePixel += 4; + } + sourceRows += sourceBytesPerRow; + destRows += destBytesPerRow; + } } -void ImageBuffer::putPremultipliedImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +static inline void convertFromInternalData(const uint8* sourceRows, unsigned sourceBytesPerRow, + uint8* destRows, unsigned destBytesPerRow, + unsigned rows, unsigned columns, + bool premultiplied) { - notImplemented(); + if (premultiplied) { + // Internal storage is not pre-multiplied, pre-multiply on the fly. + for (unsigned y = 0; y < rows; y++) { + const uint8* sourcePixel = sourceRows; + uint8* destPixel = destRows; + for (unsigned x = 0; x < columns; x++) { + // RGBA -> BGRA or BGRA -> RGBA + destPixel[0] = static_cast<uint16>(sourcePixel[2]) * sourcePixel[3] / 255; + destPixel[1] = static_cast<uint16>(sourcePixel[1]) * sourcePixel[3] / 255; + destPixel[2] = static_cast<uint16>(sourcePixel[0]) * sourcePixel[3] / 255; + destPixel[3] = sourcePixel[3]; + destPixel += 4; + sourcePixel += 4; + } + sourceRows += sourceBytesPerRow; + destRows += destBytesPerRow; + } + } else { + convertFromData(sourceRows, sourceBytesPerRow, + destRows, destBytesPerRow, + rows, columns); + } } -String ImageBuffer::toDataURL(const String&) const +static inline void convertToInternalData(const uint8* sourceRows, unsigned sourceBytesPerRow, + uint8* destRows, unsigned destBytesPerRow, + unsigned rows, unsigned columns, + bool premultiplied) { - notImplemented(); - return String(); + if (premultiplied) { + // Internal storage is not pre-multiplied, de-multiply source data. + for (unsigned y = 0; y < rows; y++) { + const uint8* sourcePixel = sourceRows; + uint8* destPixel = destRows; + for (unsigned x = 0; x < columns; x++) { + // RGBA -> BGRA or BGRA -> RGBA + if (sourcePixel[3]) { + destPixel[0] = static_cast<uint16>(sourcePixel[2]) * 255 / sourcePixel[3]; + destPixel[1] = static_cast<uint16>(sourcePixel[1]) * 255 / sourcePixel[3]; + destPixel[2] = static_cast<uint16>(sourcePixel[0]) * 255 / sourcePixel[3]; + destPixel[3] = sourcePixel[3]; + } else { + destPixel[0] = 0; + destPixel[1] = 0; + destPixel[2] = 0; + destPixel[3] = 0; + } + destPixel += 4; + sourcePixel += 4; + } + sourceRows += sourceBytesPerRow; + destRows += destBytesPerRow; + } + } else { + convertFromData(sourceRows, sourceBytesPerRow, + destRows, destBytesPerRow, + rows, columns); + } } -Image* ImageBuffer::image() const +static PassRefPtr<ImageData> getImageData(const IntRect& rect, const ImageBufferData& imageData, const IntSize& size, bool premultiplied) +{ + PassRefPtr<ImageData> result = ImageData::create(rect.width(), rect.height()); + unsigned char* data = result->data()->data()->data(); + + // If the destination image is larger than the source image, the outside + // regions need to be transparent. This way is simply, although with a + // a slight overhead for the inside region. + if (rect.x() < 0 || rect.y() < 0 || (rect.x() + rect.width()) > size.width() || (rect.y() + rect.height()) > size.height()) + memset(data, 0, result->data()->length()); + + // If the requested image is outside the source image, we can return at + // this point. + if (rect.x() > size.width() || rect.y() > size.height() || rect.right() < 0 || rect.bottom() < 0) + return result; + + // Now we know there must be an intersection rect which we need to extract. + BRect sourceRect(0, 0, size.width() - 1, size.height() - 1); + sourceRect = BRect(rect) & sourceRect; + + unsigned destBytesPerRow = 4 * rect.width(); + unsigned char* destRows = data; + // Offset the destination pointer to point at the first pixel of the + // intersection rect. + destRows += (rect.x() - static_cast<int>(sourceRect.left)) * 4 + + (rect.y() - static_cast<int>(sourceRect.top)) * destBytesPerRow; + + const uint8* sourceRows = reinterpret_cast<const uint8*>(imageData.m_bitmap.Bits()); + uint32 sourceBytesPerRow = imageData.m_bitmap.BytesPerRow(); + // Offset the source pointer to point at the first pixel of the + // intersection rect. + sourceRows += static_cast<int>(sourceRect.left) * 4 + + static_cast<int>(sourceRect.top) * sourceBytesPerRow; + + unsigned rows = sourceRect.IntegerHeight() + 1; + unsigned columns = sourceRect.IntegerWidth() + 1; + convertFromInternalData(sourceRows, sourceBytesPerRow, destRows, destBytesPerRow, + rows, columns, premultiplied); + + return result; +} + + +PassRefPtr<ImageData> ImageBuffer::getUnmultipliedImageData(const IntRect& rect) const { - notImplemented(); - return 0; + // Make sure all asynchronous drawing has finished + m_data.m_view.Sync(); + return getImageData(rect, m_data, m_size, false); } -void ImageBuffer::platformTransformColorSpace(const Vector<int>& lookUpTable) +PassRefPtr<ImageData> ImageBuffer::getPremultipliedImageData(const IntRect& rect) const +{ + // Make sure all asynchronous drawing has finished + m_data.m_view.Sync(); + return getImageData(rect, m_data, m_size, true); +} + +static void putImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint, ImageBufferData& imageData, const IntSize& size, bool premultiplied) +{ + // If the source image is outside the destination image, we can return at + // this point. + // FIXME: Check if this isn't already done in WebCore. + if (destPoint.x() > size.width() || destPoint.y() > size.height() + || destPoint.x() + sourceRect.width() < 0 + || destPoint.y() + sourceRect.height() < 0) { + return; + } + + const unsigned char* sourceRows = source->data()->data()->data(); + unsigned sourceBytesPerRow = 4 * source->width(); + // Offset the source pointer to the first pixel of the source rect. + sourceRows += sourceRect.x() * 4 + sourceRect.y() * sourceBytesPerRow; + + // We know there must be an intersection rect. + BRect destRect(destPoint.x(), destPoint.y(), sourceRect.width() - 1, sourceRect.height() - 1); + destRect = destRect & BRect(0, 0, size.width() - 1, size.height() - 1); + + unsigned char* destRows = reinterpret_cast<unsigned char*>(imageData.m_bitmap.Bits()); + uint32 destBytesPerRow = imageData.m_bitmap.BytesPerRow(); + // Offset the source pointer to point at the first pixel of the + // intersection rect. + destRows += static_cast<int>(destRect.left) * 4 + + static_cast<int>(destRect.top) * destBytesPerRow; + + unsigned rows = sourceRect.height(); + unsigned columns = sourceRect.width(); + convertToInternalData(sourceRows, sourceBytesPerRow, destRows, destBytesPerRow, + rows, columns, premultiplied); +} + +void ImageBuffer::putUnmultipliedImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +{ + // Make sure all asynchronous drawing has finished + m_data.m_view.Sync(); + putImageData(source, sourceRect, destPoint, m_data, m_size, false); +} + +void ImageBuffer::putPremultipliedImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) { - notImplemented(); + // Make sure all asynchronous drawing has finished + m_data.m_view.Sync(); + putImageData(source, sourceRect, destPoint, m_data, m_size, true); +} + +String ImageBuffer::toDataURL(const String& mimeType) const +{ + if (!MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)) + return "data:,"; + + BString mimeTypeString(mimeType); + + uint32 translatorType = 0; + + BTranslatorRoster* roster = BTranslatorRoster::Default(); + translator_id* translators; + int32 translatorCount; + roster->GetAllTranslators(&translators, &translatorCount); + for (int32 i = 0; i < translatorCount; i++) { + // Skip translators that don't support archived BBitmaps as input data. + const translation_format* inputFormats; + int32 formatCount; + roster->GetInputFormats(translators[i], &inputFormats, &formatCount); + bool supportsBitmaps = false; + for (int32 j = 0; j < formatCount; j++) { + if (inputFormats[j].type == B_TRANSLATOR_BITMAP) { + supportsBitmaps = true; + break; + } + } + if (!supportsBitmaps) + continue; + + const translation_format* outputFormats; + roster->GetOutputFormats(translators[i], &outputFormats, &formatCount); + for (int32 j = 0; j < formatCount; j++) { + if (outputFormats[j].group == B_TRANSLATOR_BITMAP + && mimeTypeString == outputFormats[j].MIME) { + translatorType = outputFormats[j].type; + } + } + if (translatorType) + break; + } + + + BMallocIO translatedStream; + BBitmap* bitmap = const_cast<BBitmap*>(&m_data.m_bitmap); + // BBitmapStream doesn't take "const Bitmap*"... + BBitmapStream bitmapStream(bitmap); + if (roster->Translate(&bitmapStream, 0, 0, &translatedStream, translatorType, + B_TRANSLATOR_BITMAP, mimeType.utf8().data()) != B_OK) { + bitmapStream.DetachBitmap(&bitmap); + return "data:,"; + } + + bitmapStream.DetachBitmap(&bitmap); + + Vector<char> encodedBuffer; + base64Encode(reinterpret_cast<const char*>(translatedStream.Buffer()), + translatedStream.BufferLength(), encodedBuffer); + + return String::format("data:%s;base64,%s", mimeType.utf8().data(), + encodedBuffer.data()); } } // namespace WebCore diff --git a/WebCore/platform/graphics/haiku/SimpleFontDataHaiku.cpp b/WebCore/platform/graphics/haiku/SimpleFontDataHaiku.cpp index f429ab5..96027cc 100644 --- a/WebCore/platform/graphics/haiku/SimpleFontDataHaiku.cpp +++ b/WebCore/platform/graphics/haiku/SimpleFontDataHaiku.cpp @@ -34,18 +34,15 @@ #include "FontCache.h" #include "FontDescription.h" #include "NotImplemented.h" -#include <Rect.h> -#include <unicode/uchar.h> -#include <unicode/unorm.h> +#include "TextEncoding.h" +#include <wtf/text/CString.h> -extern int charUnicodeToUTF8HACK(unsigned short, char*); - namespace WebCore { void SimpleFontData::platformInit() { - BFont* font = m_platformData.font(); + const BFont* font = m_platformData.font(); if (!font) return; @@ -76,8 +73,8 @@ SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDes if (!m_smallCapsFontData) { FontDescription desc = FontDescription(fontDescription); desc.setSpecifiedSize(0.70f * fontDescription.computedSize()); - const FontPlatformData* fontPlatformData = new FontPlatformData(desc, desc.family().family()); - m_smallCapsFontData = new SimpleFontData(*fontPlatformData); + FontPlatformData fontPlatformData(desc, desc.family().family()); + m_smallCapsFontData = new SimpleFontData(fontPlatformData); } return m_smallCapsFontData; } @@ -95,15 +92,14 @@ void SimpleFontData::determinePitch() GlyphMetrics SimpleFontData::platformMetricsForGlyph(Glyph glyph, GlyphMetricsMode) const { + GlyphMetrics metrics; if (!m_platformData.font()) - return 0; + return metrics; - char charArray[4]; + CString encoded = UTF8Encoding().encode(static_cast<UChar*>(&glyph), 1, + URLEncodedEntitiesForUnencodables); float escapements[1]; - - charUnicodeToUTF8HACK(glyph, charArray); - m_platformData.font()->GetEscapements(charArray, 1, escapements); - GlyphMetrics metrics; + m_platformData.font()->GetEscapements(encoded.data(), 1, escapements); metrics.horizontalAdvance = escapements[0] * m_platformData.font()->Size(); return metrics; } diff --git a/WebCore/platform/graphics/mac/ComplexTextController.cpp b/WebCore/platform/graphics/mac/ComplexTextController.cpp index b501293..efb92f8 100644 --- a/WebCore/platform/graphics/mac/ComplexTextController.cpp +++ b/WebCore/platform/graphics/mac/ComplexTextController.cpp @@ -25,7 +25,9 @@ #include "config.h" #include "ComplexTextController.h" +#include <ApplicationServices/ApplicationServices.h> #include "CharacterNames.h" +#include "FloatSize.h" #include "Font.h" #include "TextBreakIterator.h" @@ -547,12 +549,12 @@ void ComplexTextController::adjustGlyphsAndAdvances() m_adjustedAdvances.append(advance); m_adjustedGlyphs.append(glyph); - GlyphMetrics glyphMetrics = fontData->metricsForGlyph(glyph); - glyphMetrics.boundingBox.move(glyphOrigin.x, glyphOrigin.y); - m_minGlyphBoundingBoxX = min(m_minGlyphBoundingBoxX, glyphMetrics.boundingBox.x()); - m_maxGlyphBoundingBoxX = max(m_maxGlyphBoundingBoxX, glyphMetrics.boundingBox.right()); - m_minGlyphBoundingBoxY = min(m_minGlyphBoundingBoxY, glyphMetrics.boundingBox.y()); - m_maxGlyphBoundingBoxY = max(m_maxGlyphBoundingBoxY, glyphMetrics.boundingBox.bottom()); + FloatRect glyphBounds = fontData->boundsForGlyph(glyph); + glyphBounds.move(glyphOrigin.x, glyphOrigin.y); + m_minGlyphBoundingBoxX = min(m_minGlyphBoundingBoxX, glyphBounds.x()); + m_maxGlyphBoundingBoxX = max(m_maxGlyphBoundingBoxX, glyphBounds.right()); + m_minGlyphBoundingBoxY = min(m_minGlyphBoundingBoxY, glyphBounds.y()); + m_maxGlyphBoundingBoxY = max(m_maxGlyphBoundingBoxY, glyphBounds.bottom()); glyphOrigin.x += advance.width; glyphOrigin.y += advance.height; diff --git a/WebCore/platform/graphics/mac/ComplexTextController.h b/WebCore/platform/graphics/mac/ComplexTextController.h index 280327f..55cde29 100644 --- a/WebCore/platform/graphics/mac/ComplexTextController.h +++ b/WebCore/platform/graphics/mac/ComplexTextController.h @@ -25,6 +25,7 @@ #ifndef ComplexTextController_h #define ComplexTextController_h +#include <ApplicationServices/ApplicationServices.h> #include "GlyphBuffer.h" #include <wtf/HashSet.h> #include <wtf/PassRefPtr.h> diff --git a/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp b/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp index 82c314e..af210df 100644 --- a/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp +++ b/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp @@ -235,6 +235,11 @@ void GraphicsContext3D::endPaint() { } +bool GraphicsContext3D::isGLES2Compliant() const +{ + return false; +} + void GraphicsContext3D::reshape(int width, int height) { if (width == m_currentWidth && height == m_currentHeight || !m_contextObj) @@ -1141,8 +1146,20 @@ void GraphicsContext3D::getFramebufferAttachmentParameteriv(unsigned long target void GraphicsContext3D::getIntegerv(unsigned long pname, int* value) { - ensureContext(m_contextObj); - ::glGetIntegerv(pname, value); + // Need to emulate IMPLEMENTATION_COLOR_READ_FORMAT/TYPE for GL. Any valid + // combination should work, but GL_RGB/GL_UNSIGNED_BYTE might be the most + // useful for desktop WebGL users. + ensureContext(m_contextObj); + switch (pname) { + case IMPLEMENTATION_COLOR_READ_FORMAT: + *value = GL_RGB; + break; + case IMPLEMENTATION_COLOR_READ_TYPE: + *value = GL_UNSIGNED_BYTE; + break; + default: + ::glGetIntegerv(pname, value); + } } void GraphicsContext3D::getProgramiv(WebGLProgram* program, unsigned long pname, int* value) @@ -1278,39 +1295,18 @@ long GraphicsContext3D::getVertexAttribOffset(unsigned long index, unsigned long int GraphicsContext3D::texImage2D(unsigned target, unsigned level, unsigned internalformat, unsigned width, unsigned height, unsigned border, unsigned format, unsigned type, void* pixels) { - // FIXME: Need to do bounds checking on the buffer here. + ensureContext(m_contextObj); + ::glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); return 0; } -int GraphicsContext3D::texImage2D(unsigned target, unsigned level, Image* image, bool flipY, bool premultiplyAlpha) -{ - ensureContext(m_contextObj); - Vector<uint8_t> imageData; - unsigned int format, internalFormat; - if (!extractImageData(image, flipY, premultiplyAlpha, imageData, &format, &internalFormat)) - return -1; - ::glTexImage2D(target, level, internalFormat, image->width(), image->height(), 0, format, GL_UNSIGNED_BYTE, imageData.data()); - return 0; -} - int GraphicsContext3D::texSubImage2D(unsigned target, unsigned level, unsigned xoff, unsigned yoff, unsigned width, unsigned height, unsigned format, unsigned type, void* pixels) { - // FIXME: we will need to deal with PixelStore params when dealing with image buffers that differ from the subimage size - // FIXME: Need to do bounds checking on the buffer here. - ::glTexSubImage2D(target, level, xoff, yoff, width, height, format, type, pixels); - return 0; -} + ensureContext(m_contextObj); -int GraphicsContext3D::texSubImage2D(unsigned target, unsigned level, unsigned xoff, unsigned yoff, Image* image, bool flipY, bool premultiplyAlpha) -{ // FIXME: we will need to deal with PixelStore params when dealing with image buffers that differ from the subimage size - ensureContext(m_contextObj); - Vector<uint8_t> imageData; - unsigned int format, internalFormat; - if (!extractImageData(image, flipY, premultiplyAlpha, imageData, &format, &internalFormat)) - return -1; - ::glTexSubImage2D(target, level, xoff, yoff, image->width(), image->height(), format, GL_UNSIGNED_BYTE, imageData.data()); + ::glTexSubImage2D(target, level, xoff, yoff, width, height, format, type, pixels); return 0; } diff --git a/WebCore/platform/graphics/mac/SimpleFontDataATSUI.mm b/WebCore/platform/graphics/mac/SimpleFontDataATSUI.mm new file mode 100644 index 0000000..beea018 --- /dev/null +++ b/WebCore/platform/graphics/mac/SimpleFontDataATSUI.mm @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Alexey Proskuryakov + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must 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 "config.h" +#import "SimpleFontData.h" + +#if USE(ATSUI) + +#import "Font.h" +#import "FontCache.h" +#import "FontDescription.h" +#import <ApplicationServices/ApplicationServices.h> +#import <AppKit/AppKit.h> +#import <wtf/Assertions.h> + +using namespace std; + +namespace WebCore { + +void SimpleFontData::checkShapesArabic() const +{ + ASSERT(!m_checkedShapesArabic); + + m_checkedShapesArabic = true; + + ATSUFontID fontID = m_platformData.m_atsuFontID; + if (!fontID) { + LOG_ERROR("unable to get ATSUFontID for %@", m_platformData.font()); + return; + } + + // This function is called only on fonts that contain Arabic glyphs. Our + // heuristic is that if such a font has a glyph metamorphosis table, then + // it includes shaping information for Arabic. + FourCharCode tables[] = { 'morx', 'mort' }; + for (unsigned i = 0; i < sizeof(tables) / sizeof(tables[0]); ++i) { + ByteCount tableSize; + OSStatus status = ATSFontGetTable(fontID, tables[i], 0, 0, 0, &tableSize); + if (status == noErr) { + m_shapesArabic = true; + return; + } + + if (status != kATSInvalidFontTableAccess) + LOG_ERROR("ATSFontGetTable failed (%d)", status); + } +} + +} // namespace WebCore + +#endif diff --git a/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp b/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp new file mode 100644 index 0000000..fc67a19 --- /dev/null +++ b/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Alexey Proskuryakov + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must 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 "config.h" +#import "SimpleFontData.h" + +#if USE(CORE_TEXT) + +#import "Font.h" +#import "FontCache.h" +#import "FontDescription.h" +#import <ApplicationServices/ApplicationServices.h> + +using namespace std; + +namespace WebCore { + +CTFontRef SimpleFontData::getCTFont() const +{ + if (getNSFont()) + return toCTFontRef(getNSFont()); + if (!m_CTFont) + m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_platformData.cgFont(), m_platformData.size(), 0, 0)); + return m_CTFont.get(); +} + +CFDictionaryRef SimpleFontData::getCFStringAttributes(TypesettingFeatures typesettingFeatures) const +{ + unsigned key = typesettingFeatures + 1; + pair<HashMap<unsigned, RetainPtr<CFDictionaryRef> >::iterator, bool> addResult = m_CFStringAttributes.add(key, RetainPtr<CFDictionaryRef>()); + RetainPtr<CFDictionaryRef>& attributesDictionary = addResult.first->second; + if (!addResult.second) + return attributesDictionary.get(); + + bool allowLigatures = platformData().allowsLigatures() || (typesettingFeatures & Ligatures); + + static const int ligaturesNotAllowedValue = 0; + static CFNumberRef ligaturesNotAllowed = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &ligaturesNotAllowedValue); + + static const int ligaturesAllowedValue = 1; + static CFNumberRef ligaturesAllowed = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &ligaturesAllowedValue); + + if (!(typesettingFeatures & Kerning)) { + static const float kerningAdjustmentValue = 0; + static CFNumberRef kerningAdjustment = CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &kerningAdjustmentValue); + static const void* keysWithKerningDisabled[] = { kCTFontAttributeName, kCTKernAttributeName, kCTLigatureAttributeName }; + const void* valuesWithKerningDisabled[] = { getCTFont(), kerningAdjustment, allowLigatures + ? ligaturesAllowed : ligaturesNotAllowed }; + attributesDictionary.adoptCF(CFDictionaryCreate(0, keysWithKerningDisabled, valuesWithKerningDisabled, + sizeof(keysWithKerningDisabled) / sizeof(*keysWithKerningDisabled), + &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); + } else { + // By omitting the kCTKernAttributeName attribute, we get Core Text's standard kerning. + static const void* keysWithKerningEnabled[] = { kCTFontAttributeName, kCTLigatureAttributeName }; + const void* valuesWithKerningEnabled[] = { getCTFont(), allowLigatures ? ligaturesAllowed : ligaturesNotAllowed }; + attributesDictionary.adoptCF(CFDictionaryCreate(0, keysWithKerningEnabled, valuesWithKerningEnabled, + sizeof(keysWithKerningEnabled) / sizeof(*keysWithKerningEnabled), + &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); + } + + return attributesDictionary.get(); +} + +} // namespace WebCore + +#endif diff --git a/WebCore/platform/graphics/mac/SimpleFontDataMac.mm b/WebCore/platform/graphics/mac/SimpleFontDataMac.mm index 562f56e..7f1a72e 100644 --- a/WebCore/platform/graphics/mac/SimpleFontDataMac.mm +++ b/WebCore/platform/graphics/mac/SimpleFontDataMac.mm @@ -45,6 +45,7 @@ #import <wtf/Assertions.h> #import <wtf/StdLibExtras.h> #import <wtf/RetainPtr.h> +#import <wtf/UnusedParam.h> @interface NSFont (WebAppKitSecretAPI) - (BOOL)_isFakeFixedPitch; @@ -407,7 +408,24 @@ void SimpleFontData::determinePitch() [name caseInsensitiveCompare:@"MonotypeCorsiva"] != NSOrderedSame; } -GlyphMetrics SimpleFontData::platformMetricsForGlyph(Glyph glyph, GlyphMetricsMode metricsMode) const +FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const +{ + FloatRect boundingBox; +#ifndef BUILDING_ON_TIGER + CGRect box; + CGFontGetGlyphBBoxes(platformData().cgFont(), &glyph, 1, &box); + float pointSize = platformData().m_size; + CGFloat scale = pointSize / unitsPerEm(); + boundingBox = CGRectApplyAffineTransform(box, CGAffineTransformMakeScale(scale, -scale)); + if (m_syntheticBoldOffset) + boundingBox.setWidth(boundingBox.width() + m_syntheticBoldOffset); +#else + UNUSED_PARAM(glyph); +#endif + return boundingBox; +} + +float SimpleFontData::platformWidthForGlyph(Glyph glyph) const { NSFont* font = platformData().font(); float pointSize = platformData().m_size; @@ -417,99 +435,7 @@ GlyphMetrics SimpleFontData::platformMetricsForGlyph(Glyph glyph, GlyphMetricsMo LOG_ERROR("Unable to cache glyph widths for %@ %f", [font displayName], pointSize); advance.width = 0; } - GlyphMetrics metrics; - metrics.horizontalAdvance = advance.width + m_syntheticBoldOffset; - if (metricsMode == GlyphBoundingBox) { -#ifndef BUILDING_ON_TIGER - CGRect boundingBox; - CGFontGetGlyphBBoxes(platformData().cgFont(), &glyph, 1, &boundingBox); - CGFloat scale = pointSize / unitsPerEm(); - metrics.boundingBox = CGRectApplyAffineTransform(boundingBox, CGAffineTransformMakeScale(scale, -scale)); - if (m_syntheticBoldOffset) - metrics.boundingBox.setWidth(metrics.boundingBox.width() + m_syntheticBoldOffset); -#endif - } - return metrics; -} - -#if USE(ATSUI) -void SimpleFontData::checkShapesArabic() const -{ - ASSERT(!m_checkedShapesArabic); - - m_checkedShapesArabic = true; - - ATSUFontID fontID = m_platformData.m_atsuFontID; - if (!fontID) { - LOG_ERROR("unable to get ATSUFontID for %@", m_platformData.font()); - return; - } - - // This function is called only on fonts that contain Arabic glyphs. Our - // heuristic is that if such a font has a glyph metamorphosis table, then - // it includes shaping information for Arabic. - FourCharCode tables[] = { 'morx', 'mort' }; - for (unsigned i = 0; i < sizeof(tables) / sizeof(tables[0]); ++i) { - ByteCount tableSize; - OSStatus status = ATSFontGetTable(fontID, tables[i], 0, 0, 0, &tableSize); - if (status == noErr) { - m_shapesArabic = true; - return; - } - - if (status != kATSInvalidFontTableAccess) - LOG_ERROR("ATSFontGetTable failed (%d)", status); - } -} -#endif - -#if USE(CORE_TEXT) -CTFontRef SimpleFontData::getCTFont() const -{ - if (getNSFont()) - return toCTFontRef(getNSFont()); - if (!m_CTFont) - m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_platformData.cgFont(), m_platformData.size(), NULL, NULL)); - return m_CTFont.get(); -} - -CFDictionaryRef SimpleFontData::getCFStringAttributes(TypesettingFeatures typesettingFeatures) const -{ - unsigned key = typesettingFeatures + 1; - pair<HashMap<unsigned, RetainPtr<CFDictionaryRef> >::iterator, bool> addResult = m_CFStringAttributes.add(key, RetainPtr<CFDictionaryRef>()); - RetainPtr<CFDictionaryRef>& attributesDictionary = addResult.first->second; - if (!addResult.second) - return attributesDictionary.get(); - - bool allowLigatures = platformData().allowsLigatures() || (typesettingFeatures & Ligatures); - - static const int ligaturesNotAllowedValue = 0; - static CFNumberRef ligaturesNotAllowed = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &ligaturesNotAllowedValue); - - static const int ligaturesAllowedValue = 1; - static CFNumberRef ligaturesAllowed = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &ligaturesAllowedValue); - - if (!(typesettingFeatures & Kerning)) { - static const float kerningAdjustmentValue = 0; - static CFNumberRef kerningAdjustment = CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &kerningAdjustmentValue); - static const void* keysWithKerningDisabled[] = { kCTFontAttributeName, kCTKernAttributeName, kCTLigatureAttributeName }; - const void* valuesWithKerningDisabled[] = { getCTFont(), kerningAdjustment, allowLigatures - ? ligaturesAllowed : ligaturesNotAllowed }; - attributesDictionary.adoptCF(CFDictionaryCreate(NULL, keysWithKerningDisabled, valuesWithKerningDisabled, - sizeof(keysWithKerningDisabled) / sizeof(*keysWithKerningDisabled), - &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); - } else { - // By omitting the kCTKernAttributeName attribute, we get Core Text's standard kerning. - static const void* keysWithKerningEnabled[] = { kCTFontAttributeName, kCTLigatureAttributeName }; - const void* valuesWithKerningEnabled[] = { getCTFont(), allowLigatures ? ligaturesAllowed : ligaturesNotAllowed }; - attributesDictionary.adoptCF(CFDictionaryCreate(NULL, keysWithKerningEnabled, valuesWithKerningEnabled, - sizeof(keysWithKerningEnabled) / sizeof(*keysWithKerningEnabled), - &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); - } - - return attributesDictionary.get(); + return advance.width + m_syntheticBoldOffset; } -#endif - } // namespace WebCore diff --git a/WebCore/platform/graphics/opentype/OpenTypeSanitizer.cpp b/WebCore/platform/graphics/opentype/OpenTypeSanitizer.cpp index b4cdb09..14aed0d 100644 --- a/WebCore/platform/graphics/opentype/OpenTypeSanitizer.cpp +++ b/WebCore/platform/graphics/opentype/OpenTypeSanitizer.cpp @@ -52,15 +52,16 @@ PassRefPtr<SharedBuffer> OpenTypeSanitizer::sanitize() // A transcoded font is usually smaller than an original font. // However, it can be slightly bigger than the original one due to // name table replacement and/or padding for glyf table. - static const size_t padLen = 20 * 1024; // 20 kB + // + // With WOFF fonts, however, we'll be decompressing, so the result can be + // much larger than the original. - OwnArrayPtr<unsigned char> transcodeRawBuffer(new unsigned char[m_buffer->size() + padLen]); - ots::MemoryStream output(transcodeRawBuffer.get(), m_buffer->size() + padLen); + ots::ExpandingMemoryStream output(m_buffer->size(), maxWebFontSize); if (!ots::Process(&output, reinterpret_cast<const uint8_t*>(m_buffer->data()), m_buffer->size())) return 0; const size_t transcodeLen = output.Tell(); - return SharedBuffer::create(transcodeRawBuffer.get(), transcodeLen); + return SharedBuffer::create(static_cast<unsigned char*>(output.get()), transcodeLen); } } // namespace WebCore diff --git a/WebCore/platform/graphics/qt/FontQt.cpp b/WebCore/platform/graphics/qt/FontQt.cpp index 974c179..946faeb 100644 --- a/WebCore/platform/graphics/qt/FontQt.cpp +++ b/WebCore/platform/graphics/qt/FontQt.cpp @@ -180,13 +180,7 @@ float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon String sanitized = Font::normalizeSpaces(String(run.characters(), run.length())); QString string = fromRawDataWithoutRef(sanitized); - QTextLayout layout(string, font()); - QTextLine line = setupLayout(&layout, run); -#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) - int w = int(line.horizontalAdvance()); -#else - int w = int(line.naturalTextWidth()); -#endif + int w = QFontMetrics(font()).width(string); // WebKit expects us to ignore word spacing on the first character (as opposed to what Qt does) if (treatAsSpace(run[0])) w -= m_wordSpacing; diff --git a/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp index b0dd289..8dfb967 100644 --- a/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp +++ b/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp @@ -154,8 +154,7 @@ public: ~GraphicsContext3DInternal(); bool isContextValid() { return m_contextValid; } - - + QGLWidget* getOwnerGLWidget(QWebPageClient* webPageClient); glActiveTextureType activeTexture; glAttachShaderType attachShader; @@ -248,6 +247,7 @@ public: glVertexAttribPointerType vertexAttribPointer; GraphicsContext3D::Attributes m_attrs; + HostWindow* m_hostWindow; QGLWidget* m_glWidget; GLuint m_texture; GLuint m_mainFbo; @@ -258,7 +258,6 @@ public: private: - QGLWidget* getOwnerGLWidget(QWebPageClient* webPageClient); void* getProcAddress(const String& proc); bool m_contextValid; }; @@ -268,9 +267,20 @@ private: #else #define GET_PROC_ADDRESS(Proc) reinterpret_cast<Proc##Type>(getProcAddress(#Proc)); #endif + +bool GraphicsContext3D::isGLES2Compliant() const +{ +#if defined (QT_OPENGL_ES_2) + return true; +#else + return false; +#endif +} + GraphicsContext3DInternal::GraphicsContext3DInternal(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow) : m_attrs(attrs) + , m_hostWindow(hostWindow) , m_glWidget(0) , m_texture(0) , m_mainFbo(0) @@ -515,7 +525,7 @@ void GraphicsContext3D::beginPaint(WebGLRenderingContext* context) glReadPixels(/* x */ 0, /* y */ 0, m_currentWidth, m_currentHeight, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, m_internal->m_pixels.bits()); QPainter* p = imageBuffer->context()->platformContext(); - p->drawImage(/* x */ 0, /* y */ 0, m_internal->m_pixels.transformed(QMatrix().rotate(180))); + p->drawImage(/* x */ 0, /* y */ 0, m_internal->m_pixels.rgbSwapped().transformed(QMatrix().rotate(180))); m_internal->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_internal->m_currentFbo); } @@ -524,6 +534,23 @@ void GraphicsContext3D::endPaint() { } +void GraphicsContext3D::paint(QPainter* painter, const QRect& rect) const +{ +#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) + QWebPageClient* webPageClient = m_internal->m_hostWindow->platformPageClient(); + QGLWidget* ownerGLWidget = m_internal->getOwnerGLWidget(webPageClient); + if (ownerGLWidget) { + ownerGLWidget->drawTexture(QPointF(0, 0), m_internal->m_texture); + return; + } +#endif + m_internal->m_glWidget->makeCurrent(); + m_internal->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_internal->m_mainFbo); + glReadPixels(/* x */ 0, /* y */ 0, m_currentWidth, m_currentHeight, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, m_internal->m_pixels.bits()); + painter->drawImage(/* x */ 0, /* y */ 0, m_internal->m_pixels.rgbSwapped().transformed(QMatrix().rotate(180))); + m_internal->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_internal->m_currentFbo); +} + void GraphicsContext3D::reshape(int width, int height) { if (((width == m_currentWidth) && (height == m_currentHeight)) || (!m_internal)) @@ -1466,56 +1493,19 @@ long GraphicsContext3D::getVertexAttribOffset(unsigned long index, unsigned long int GraphicsContext3D::texImage2D(unsigned target, unsigned level, unsigned internalformat, unsigned width, unsigned height, unsigned border, unsigned format, unsigned type, void* pixels) { + m_internal->m_glWidget->makeCurrent(); glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); return 0; } -int GraphicsContext3D::texImage2D(unsigned target, unsigned level, Image* image, bool flipY, bool premultiplyAlpha) -{ - ASSERT(image); - - m_internal->m_glWidget->makeCurrent(); - - Vector<uint8_t> imageData; - GLuint format; - GLuint internalFormat; - - if (!extractImageData(image, flipY, premultiplyAlpha, imageData, &format, &internalFormat)) { - LOG_ERROR("GraphicsContext3D::texImage2D: could not extract Image data"); - return -1; - } - - glTexImage2D(target, level, internalFormat, image->width(), image->height(), - /* border */ 0, format, GraphicsContext3D::UNSIGNED_BYTE, imageData.data()); - - return 0; -} - + int GraphicsContext3D::texSubImage2D(unsigned target, unsigned level, unsigned xoff, unsigned yoff, unsigned width, unsigned height, unsigned format, unsigned type, void* pixels) { + m_internal->m_glWidget->makeCurrent(); glTexSubImage2D(target, level, xoff, yoff, width, height, format, type, pixels); return 0; } -int GraphicsContext3D::texSubImage2D(unsigned target, unsigned level, unsigned xoff, unsigned yoff, Image* image, bool flipY, bool premultiplyAlpha) -{ - ASSERT(image); - - Vector<uint8_t> imageData; - GLuint format; - GLuint internalFormat; - - if (!extractImageData(image, flipY, premultiplyAlpha, imageData, &format, &internalFormat)) { - LOG_ERROR("GraphicsContext3D::texSubImage2D: could not extract Image data"); - return -1; - } - - glTexSubImage2D(target, level, xoff, yoff, image->width(), image->height(), - format, GraphicsContext3D::UNSIGNED_BYTE, imageData.data()); - - return 0; -} - unsigned GraphicsContext3D::createBuffer() { m_internal->m_glWidget->makeCurrent(); @@ -1630,18 +1620,17 @@ bool GraphicsContext3D::getImageData(Image* image, AlphaOp* neededAlphaOp, unsigned int* format) { - QImage::Format imageFormat = (!premultiplyAlpha) ? - QImage::Format_ARGB32 : - QImage::Format_ARGB32_Premultiplied; - - QPixmap* nativePixmap = image->nativeImageForCurrentFrame(); *hasAlphaChannel = true; - *neededAlphaOp = kAlphaDoNothing; *format = GraphicsContext3D::RGBA; - QImage nativeImage = nativePixmap->toImage().convertToFormat(imageFormat); - outputVector.append(nativeImage.bits(), nativeImage.byteCount()); + *neededAlphaOp = kAlphaDoNothing; + if (!premultiplyAlpha && *hasAlphaChannel) + *neededAlphaOp = kAlphaDoUnmultiply; + + QPixmap* nativePixmap = image->nativeImageForCurrentFrame(); + QImage nativeImage = nativePixmap->toImage().convertToFormat(QImage::Format_ARGB32); + outputVector.append(nativeImage.rgbSwapped().bits(), nativeImage.byteCount()); return true; } diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index edac268..0100b72 100644 --- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -641,12 +641,12 @@ void GraphicsContext::fillRect(const FloatRect& rect) } } -void GraphicsContext::fillRect(const FloatRect& rect, const Color& c, ColorSpace colorSpace) +void GraphicsContext::fillRect(const FloatRect& rect, const Color& color, ColorSpace colorSpace) { - if (paintingDisabled()) + if (paintingDisabled() || !color.isValid()) return; - m_data->solidColor.setColor(c); + m_data->solidColor.setColor(color); QPainter* p = m_data->p(); if (m_common->state.shadowColor.isValid()) drawBorderlessRectShadow(this, p, rect); @@ -655,7 +655,7 @@ void GraphicsContext::fillRect(const FloatRect& rect, const Color& c, ColorSpace void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const Color& color, ColorSpace colorSpace) { - if (paintingDisabled() || !color.alpha()) + if (paintingDisabled() || !color.isValid() || !color.alpha()) return; Path path = Path::createRoundedRectangle(rect, topLeft, topRight, bottomLeft, bottomRight); @@ -717,7 +717,7 @@ void GraphicsContext::drawFocusRing(const Vector<Path>& paths, int width, int of */ void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int /* width */, int /* offset */, const Color& color) { - if (paintingDisabled()) + if (paintingDisabled() || !color.isValid()) return; unsigned rectCount = rects.size(); @@ -1141,8 +1141,9 @@ void GraphicsContext::setURLForRect(const KURL&, const IntRect&) void GraphicsContext::setPlatformStrokeColor(const Color& color, ColorSpace colorSpace) { - if (paintingDisabled()) + if (paintingDisabled() || !color.isValid()) return; + QPainter* p = m_data->p(); QPen newPen(p->pen()); m_data->solidColor.setColor(color); @@ -1172,8 +1173,9 @@ void GraphicsContext::setPlatformStrokeThickness(float thickness) void GraphicsContext::setPlatformFillColor(const Color& color, ColorSpace colorSpace) { - if (paintingDisabled()) + if (paintingDisabled() || !color.isValid()) return; + m_data->solidColor.setColor(color); m_data->p()->setBrush(m_data->solidColor); } diff --git a/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp b/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp index 834cd4f..86c01de 100644 --- a/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp +++ b/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp @@ -32,15 +32,13 @@ #include <QtCore/qmetaobject.h> #include <QtCore/qset.h> #include <QtCore/qtimer.h> -#include <QtGui/qbitmap.h> #include <QtGui/qcolor.h> #include <QtGui/qgraphicseffect.h> #include <QtGui/qgraphicsitem.h> #include <QtGui/qgraphicsscene.h> -#include <QtGui/qmatrix4x4.h> #include <QtGui/qpainter.h> -#include <QtGui/qpalette.h> #include <QtGui/qpixmap.h> +#include <QtGui/qpixmapcache.h> #include <QtGui/qstyleoption.h> namespace WebCore { @@ -132,7 +130,9 @@ public: }; // the compositor lets us special-case images and colors, so we try to do so - enum StaticContentType { HTMLContentType, PixmapContentType, ColorContentType, MediaContentType}; + enum StaticContentType { HTMLContentType, PixmapContentType, ColorContentType, MediaContentType, Canvas3DContentType}; + + const GraphicsLayerQtImpl* rootLayer() const; GraphicsLayerQtImpl(GraphicsLayerQt* newLayer); virtual ~GraphicsLayerQtImpl(); @@ -142,24 +142,25 @@ public: virtual QRectF boundingRect() const; virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*); - // we manage transforms ourselves because transform-origin acts differently in webkit and in Qt + // We manage transforms ourselves because transform-origin acts differently in webkit and in Qt, and we need it as a fallback in case we encounter an un-invertible matrix void setBaseTransform(const TransformationMatrix&); - QTransform computeTransform(const TransformationMatrix& baseTransform) const; void updateTransform(); // let the compositor-API tell us which properties were changed void notifyChange(ChangeMask); + // actual rendering of the web-content into a QPixmap + // We prefer to use our own caching because it gives us a higher level of granularity than QGraphicsItem cache modes - + // sometimes we need to cache the contents even `though the item needs to be updated, e.g. when the background-color is changed. + // TODO: investigate if QGraphicsItem caching can be improved to support that out of the box. + QPixmap recache(const QRegion&); + // called when the compositor is ready for us to show the changes on screen // this is called indirectly from ChromeClientQt::setNeedsOneShotDrawingSynchronization // (meaning the sync would happen together with the next draw) // or ChromeClientQt::scheduleCompositingLayerSync (meaning the sync will happen ASAP) void flushChanges(bool recursive = true, bool forceTransformUpdate = false); - // optimization: returns true if this or an ancestor has a transform animation running. - // this enables us to use ItemCoordinatesCache while the animation is running, otherwise we have to recache for every frame - bool isTransformAnimationRunning() const; - public slots: // we need to notify the client (aka the layer compositor) when the animation actually starts void notifyAnimationStarted(); @@ -175,6 +176,7 @@ public: GraphicsLayerQt* m_layer; TransformationMatrix m_baseTransform; + TransformationMatrix m_transformRelativeToRootLayer; bool m_transformAnimationRunning; bool m_opacityAnimationRunning; QWeakPointer<MaskEffectQt> m_maskEffect; @@ -203,6 +205,7 @@ public: int m_changeMask; QSizeF m_size; + QPixmapCache::Key m_backingStoreKey; #ifndef QT_NO_ANIMATION QList<QWeakPointer<QAbstractAnimation> > m_animations; #endif @@ -236,6 +239,10 @@ public: } } m_state; +#if ENABLE(3D_CANVAS) + const GraphicsContext3D* m_gc3D; +#endif + #ifndef QT_NO_ANIMATION friend class AnimationQtBase; #endif @@ -247,6 +254,9 @@ GraphicsLayerQtImpl::GraphicsLayerQtImpl(GraphicsLayerQt* newLayer) , m_transformAnimationRunning(false) , m_opacityAnimationRunning(false) , m_changeMask(NoChanges) +#if ENABLE(3D_CANVAS) + , m_gc3D(0) +#endif { // we use graphics-view for compositing, not for interactivity setAcceptedMouseButtons(Qt::NoButton); @@ -255,9 +265,6 @@ GraphicsLayerQtImpl::GraphicsLayerQtImpl(GraphicsLayerQt* newLayer) // they are ignored and passed to the item below. setEnabled(true); - // we'll set the cache when we know what's going on - setCacheMode(ItemCoordinateCache); - connect(this, SIGNAL(notifyAnimationStartedAsync()), this, SLOT(notifyAnimationStarted()), Qt::QueuedConnection); } @@ -283,65 +290,138 @@ GraphicsLayerQtImpl::~GraphicsLayerQtImpl() #endif } -void GraphicsLayerQtImpl::updateTransform() +const GraphicsLayerQtImpl* GraphicsLayerQtImpl::rootLayer() const { - setBaseTransform(isTransformAnimationRunning() ? m_baseTransform : m_layer->transform()); + if (const GraphicsLayerQtImpl* parent = qobject_cast<const GraphicsLayerQtImpl*>(parentObject())) + return parent->rootLayer(); + return this; } -void GraphicsLayerQtImpl::setBaseTransform(const TransformationMatrix& baseTransform) -{ - m_baseTransform = baseTransform; - setTransform(computeTransform(baseTransform)); -} -QTransform GraphicsLayerQtImpl::computeTransform(const TransformationMatrix& baseTransform) const + +QPixmap GraphicsLayerQtImpl::recache(const QRegion& regionToUpdate) { - if (!m_layer) - return baseTransform; + if (!m_layer->drawsContent()) + return QPixmap(); - TransformationMatrix computedTransform; + QRegion region = regionToUpdate; + QPixmap pixmap; - // The origin for childrenTransform is always the center of the ancestor which contains the childrenTransform. - // this has to do with how WebCore implements -webkit-perspective and -webkit-perspective-origin, which are the CSS - // attribute that call setChildrenTransform - QPointF offset = -pos() - boundingRect().bottomRight() / 2; + // We might be drawing into an existing cache. + if (!QPixmapCache::find(m_backingStoreKey, &pixmap)) + region = QRegion(QRect(0, 0, m_size.width(), m_size.height())); - for (const GraphicsLayerQtImpl* ancestor = this; (ancestor = qobject_cast<GraphicsLayerQtImpl*>(ancestor->parentObject())); ) { - if (!ancestor->m_state.childrenTransform.isIdentity()) { - const QPointF offset = mapFromItem(ancestor, QPointF(ancestor->m_size.width() / 2, ancestor->m_size.height() / 2)); - computedTransform - .translate(offset.x(), offset.y()) - .multLeft(ancestor->m_state.childrenTransform) - .translate(-offset.x(), -offset.y()); - break; - } + if (m_size != pixmap.size()) { + pixmap = QPixmap(m_size.toSize()); + if (!m_layer->contentsOpaque()) + pixmap.fill(Qt::transparent); + m_pendingContent.regionToUpdate = QRegion(QRect(QPoint(0, 0), m_size.toSize())); } + QPainter painter(&pixmap); + GraphicsContext gc(&painter); + + // Clear the area in cache that we're drawing into + painter.setCompositionMode(QPainter::CompositionMode_Clear); + painter.fillRect(region.boundingRect(), Qt::transparent); + + // Render the actual contents into the cache + painter.setCompositionMode(QPainter::CompositionMode_SourceOver); + m_layer->paintGraphicsLayerContents(gc, region.boundingRect()); + + m_backingStoreKey = QPixmapCache::insert(pixmap); + return pixmap; +} + +void GraphicsLayerQtImpl::updateTransform() +{ + if (!m_transformAnimationRunning) + m_baseTransform = m_layer->transform(); + + TransformationMatrix localTransform; + + GraphicsLayerQtImpl* parent = qobject_cast<GraphicsLayerQtImpl*>(parentObject()); + // webkit has relative-to-size originPoint, graphics-view has a pixel originPoint, here we convert // we have to manage this ourselves because QGraphicsView's transformOrigin is incompatible const qreal originX = m_state.anchorPoint.x() * m_size.width(); const qreal originY = m_state.anchorPoint.y() * m_size.height(); - computedTransform - .translate3d(originX, originY, m_state.anchorPoint.z()) - .multLeft(baseTransform) + + // We ignore QGraphicsItem::pos completely, and use only transforms - because we have to maintain that ourselves for 3D. + localTransform + .translate3d(originX + m_state.pos.x(), originY + m_state.pos.y(), m_state.anchorPoint.z()) + .multLeft(m_baseTransform) .translate3d(-originX, -originY, -m_state.anchorPoint.z()); - // now we project to 2D - return QTransform(computedTransform); + // This is the actual 3D transform of this item, with the ancestors' transform baked in. + m_transformRelativeToRootLayer = TransformationMatrix(parent ? parent->m_transformRelativeToRootLayer : TransformationMatrix()) + .multLeft(localTransform); + + // Now we have enough information to determine if the layer is facing backwards. + if (!m_state.backfaceVisibility && m_transformRelativeToRootLayer.inverse().m33() < 0) { + setVisible(false); + // No point in making extra calculations for invisible elements. + return; + } + + // Simplistic depth test - we stack the item behind its parent if its computed z is lower than the parent's computed z at the item's center point. + if (parent) { + const QPointF centerPointMappedToRoot = rootLayer()->mapFromItem(this, m_size.width() / 2, m_size.height() / 2); + setFlag(ItemStacksBehindParent, + m_transformRelativeToRootLayer.mapPoint(FloatPoint3D(centerPointMappedToRoot.x(), centerPointMappedToRoot.y(), 0)).z() < + parent->m_transformRelativeToRootLayer.mapPoint(FloatPoint3D(centerPointMappedToRoot.x(), centerPointMappedToRoot.y(), 0)).z()); + } + + // The item is front-facing or backface-visibility is on. + setVisible(true); + + // Flatten to 2D-space of this item if it doesn't preserve 3D. + if (!m_state.preserves3D) { + m_transformRelativeToRootLayer.setM13(0); + m_transformRelativeToRootLayer.setM23(0); + m_transformRelativeToRootLayer.setM31(0); + m_transformRelativeToRootLayer.setM32(0); + m_transformRelativeToRootLayer.setM33(1); + m_transformRelativeToRootLayer.setM34(0); + m_transformRelativeToRootLayer.setM43(0); + } + + // Apply perspective for the use of this item's children. Perspective is always applied from the item's center. + if (!m_state.childrenTransform.isIdentity()) + m_transformRelativeToRootLayer + .translate(m_size.width() / 2, m_size.height() /2) + .multLeft(m_state.childrenTransform) + .translate(-m_size.width() / 2, -m_size.height() /2); + + bool inverseOk = true; + // Use QTransform::inverse to extrapolate the relative transform of this item, based on the parent's transform relative to + // the root layer and the desired transform for this item relative to the root layer. + const QTransform parentTransform = parent ? parent->itemTransform(rootLayer()) : QTransform(); + const QTransform transform2D = QTransform(m_transformRelativeToRootLayer) * parentTransform.inverted(&inverseOk); + + // In rare cases the transformation cannot be inversed - in that case we don't apply the transformation at all, otherwise we'd flicker. + // FIXME: This should be amended when Qt moves to a real 3D scene-graph. + if (!inverseOk) + return; + + setTransform(transform2D); + + const QList<QGraphicsItem*> children = childItems(); + for (QList<QGraphicsItem*>::const_iterator it = children.begin(); it != children.end(); ++it) + if (GraphicsLayerQtImpl* layer= qobject_cast<GraphicsLayerQtImpl*>((*it)->toGraphicsObject())) + layer->updateTransform(); } -bool GraphicsLayerQtImpl::isTransformAnimationRunning() const +void GraphicsLayerQtImpl::setBaseTransform(const TransformationMatrix& baseTransform) { - if (m_transformAnimationRunning) - return true; - if (GraphicsLayerQtImpl* parent = qobject_cast<GraphicsLayerQtImpl*>(parentObject())) - return parent->isTransformAnimationRunning(); - return false; + m_baseTransform = baseTransform; + updateTransform(); } QPainterPath GraphicsLayerQtImpl::opaqueArea() const { QPainterPath painterPath; + // we try out best to return the opaque area, maybe it will help graphics-view render less items if (m_currentContent.backgroundColor.isValid() && m_currentContent.backgroundColor.alpha() == 0xff) painterPath.addRect(boundingRect()); @@ -370,9 +450,11 @@ void GraphicsLayerQtImpl::paint(QPainter* painter, const QStyleOptionGraphicsIte switch (m_currentContent.contentType) { case HTMLContentType: if (m_state.drawsContent) { - // this is the expensive bit. we try to minimize calls to this area by proper caching - GraphicsContext gc(painter); - m_layer->paintGraphicsLayerContents(gc, option->rect); + QPixmap backingStore; + // We might need to recache, in case we try to paint and the cache was purged (e.g. if it was full). + if (!QPixmapCache::find(m_backingStoreKey, &backingStore) || backingStore.size() != m_size.toSize()) + backingStore = recache(QRegion(m_state.contentsRect)); + painter->drawPixmap(0, 0, backingStore); } break; case PixmapContentType: @@ -384,6 +466,11 @@ void GraphicsLayerQtImpl::paint(QPainter* painter, const QStyleOptionGraphicsIte case MediaContentType: // we don't need to paint anything: we have a QGraphicsItem from the media element break; +#if ENABLE(3D_CANVAS) + case Canvas3DContentType: + m_gc3D->paint(painter, option->rect); + break; +#endif } } @@ -457,9 +544,6 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive, bool forceUpdateTransform } } - if ((m_changeMask & PositionChange) && (m_layer->position() != m_state.pos)) - setPos(m_layer->position().x(), m_layer->position().y()); - if (m_changeMask & SizeChange) { if (m_layer->size() != m_state.size) { prepareGeometryChange(); @@ -472,7 +556,7 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive, bool forceUpdateTransform if (scene()) scene()->update(); - if (m_changeMask & (ChildrenTransformChange | Preserves3DChange | TransformChange | AnchorPointChange | SizeChange)) { + if (m_changeMask & (ChildrenTransformChange | Preserves3DChange | TransformChange | AnchorPointChange | SizeChange | BackfaceVisibilityChange | PositionChange)) { // due to the differences between the way WebCore handles transforms and the way Qt handles transforms, // all these elements affect the transforms of all the descendants. forceUpdateTransform = true; @@ -484,19 +568,13 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive, bool forceUpdateTransform update(); setFlag(ItemHasNoContents, false); - // no point in caching a directly composited pixmap into another pixmap - setCacheMode(NoCache); - break; case MediaContentType: setFlag(ItemHasNoContents, true); - setCacheMode(NoCache); m_pendingContent.mediaLayer.data()->setParentItem(this); break; case ColorContentType: - // no point in caching a solid-color rectangle - setCacheMode(NoCache); if (m_pendingContent.contentType != m_currentContent.contentType || m_pendingContent.contentsBackgroundColor != m_currentContent.contentsBackgroundColor) update(); m_state.drawsContent = false; @@ -509,15 +587,21 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive, bool forceUpdateTransform case HTMLContentType: if (m_pendingContent.contentType != m_currentContent.contentType) update(); - if (!m_state.drawsContent && m_layer->drawsContent()) { + if (!m_state.drawsContent && m_layer->drawsContent()) update(); - if (m_layer->drawsContent() && !m_maskEffect) - setCacheMode(ItemCoordinateCache); - } else if (!m_layer->drawsContent()) - setCacheMode(NoCache); setFlag(ItemHasNoContents, !m_layer->drawsContent()); break; + +#if ENABLE(3D_CANVAS) + case Canvas3DContentType: + if (m_pendingContent.contentType != m_currentContent.contentType) + update(); + + setCacheMode(NoCache); + setFlag(ItemHasNoContents, false); + break; +#endif } } @@ -544,15 +628,16 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive, bool forceUpdateTransform if (m_maskEffect) m_maskEffect.data()->update(); - else if (m_changeMask & DisplayChange) + else if (m_changeMask & DisplayChange) { + // Recache now: all the content is ready and we don't want to wait until the paint event. + recache(m_pendingContent.regionToUpdate); update(m_pendingContent.regionToUpdate.boundingRect()); + m_pendingContent.regionToUpdate = QRegion(); + } if ((m_changeMask & BackgroundColorChange) && (m_pendingContent.backgroundColor != m_currentContent.backgroundColor)) update(); - // FIXME: the following flags are currently not handled, as they don't have a clear test or are in low priority - // GeometryOrientationChange, ContentsOrientationChange, BackfaceVisibilityChange, ChildrenTransformChange, Preserves3DChange - m_state.maskLayer = m_layer->maskLayer(); m_state.pos = m_layer->position(); m_state.anchorPoint = m_layer->anchorPoint(); @@ -572,7 +657,6 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive, bool forceUpdateTransform m_currentContent.contentType = m_pendingContent.contentType; m_currentContent.mediaLayer = m_pendingContent.mediaLayer; m_currentContent.backgroundColor = m_pendingContent.backgroundColor; - m_currentContent.regionToUpdate |= m_pendingContent.regionToUpdate; m_currentContent.contentsBackgroundColor = m_pendingContent.contentsBackgroundColor; m_pendingContent.regionToUpdate = QRegion(); m_changeMask = NoChanges; @@ -871,6 +955,23 @@ void GraphicsLayerQt::setContentsBackgroundColor(const Color& color) GraphicsLayer::setContentsBackgroundColor(color); } +#if ENABLE(3D_CANVAS) +void GraphicsLayerQt::setContentsToGraphicsContext3D(const GraphicsContext3D* ctx) +{ + if (ctx == m_impl->m_gc3D) + return; + + m_impl->m_pendingContent.contentType = GraphicsLayerQtImpl::Canvas3DContentType; + m_impl->m_gc3D = ctx; + m_impl->notifyChange(GraphicsLayerQtImpl::ContentChange); +} + +void GraphicsLayerQt::setGraphicsContext3DNeedsDisplay() +{ + setNeedsDisplay(); +} +#endif + void GraphicsLayerQt::setContentsToMedia(PlatformLayer* media) { if (media) { @@ -1106,8 +1207,6 @@ public: { if (m_fillsForwards) setCurrentTime(1); - else if (m_layer && m_layer.data()->m_layer) - m_layer.data()->setBaseTransform(m_layer.data()->m_layer->transform()); } // the idea is that we let WebCore manage the transform-operations @@ -1118,33 +1217,25 @@ public: { TransformationMatrix transformMatrix; - // sometimes the animation values from WebCore are misleading and we have to use the actual matrix as source - // The Mac implementation simply doesn't try to accelerate those (e.g. 360deg rotation), but we do. - if (progress == 1 || !targetOperations.size() || sourceOperations == targetOperations) { - TransformationMatrix sourceMatrix; - sourceOperations.apply(m_boxSize, sourceMatrix); - transformMatrix = m_sourceMatrix; - transformMatrix.blend(sourceMatrix, 1 - progress); - } else { - bool validTransformLists = true; - const int sourceOperationCount = sourceOperations.size(); - if (sourceOperationCount) { - if (targetOperations.size() != sourceOperationCount) - validTransformLists = false; - else - for (size_t j = 0; j < sourceOperationCount && validTransformLists; ++j) - if (!sourceOperations.operations()[j]->isSameType(*targetOperations.operations()[j])) - validTransformLists = false; - } + bool validTransformLists = true; + const int sourceOperationCount = sourceOperations.size(); + if (sourceOperationCount) { + if (targetOperations.size() != sourceOperationCount) + validTransformLists = false; + else + for (size_t j = 0; j < sourceOperationCount && validTransformLists; ++j) + if (!sourceOperations.operations()[j]->isSameType(*targetOperations.operations()[j])) + validTransformLists = false; + } - if (validTransformLists) { - for (size_t i = 0; i < targetOperations.size(); ++i) - targetOperations.operations()[i]->blend(sourceOperations.at(i), progress)->apply(transformMatrix, m_boxSize); - } else { - targetOperations.apply(m_boxSize, transformMatrix); - transformMatrix.blend(m_sourceMatrix, progress); - } + if (validTransformLists) { + for (size_t i = 0; i < targetOperations.size(); ++i) + targetOperations.operations()[i]->blend(sourceOperations.at(i), progress)->apply(transformMatrix, m_boxSize); + } else { + targetOperations.apply(m_boxSize, transformMatrix); + transformMatrix.blend(m_sourceMatrix, progress); } + m_layer.data()->setBaseTransform(transformMatrix); if (m_fillsForwards) m_layer.data()->m_layer->setTransform(m_layer.data()->m_baseTransform); @@ -1163,7 +1254,10 @@ public: m_sourceMatrix = m_layer.data()->m_layer->transform(); m_layer.data()->m_transformAnimationRunning = true; } else if (newState == QAbstractAnimation::Stopped) { + // We update the transform back to the default. This already takes fill-modes into account. m_layer.data()->m_transformAnimationRunning = false; + if (m_layer && m_layer.data()->m_layer) + m_layer.data()->setBaseTransform(m_layer.data()->m_layer->transform()); } } @@ -1181,8 +1275,6 @@ public: { if (m_fillsForwards) setCurrentTime(1); - else if (m_layer && m_layer.data()->m_layer) - m_layer.data()->setOpacity(m_layer.data()->m_layer->opacity()); } virtual void applyFrame(const qreal& fromValue, const qreal& toValue, qreal progress) { @@ -1204,6 +1296,12 @@ public: if (m_layer) m_layer.data()->m_opacityAnimationRunning = (newState == QAbstractAnimation::Running); + + // If stopped, we update the opacity back to the default. This already takes fill-modes into account. + if (newState == Stopped) + if (m_layer && m_layer.data()->m_layer) + m_layer.data()->setOpacity(m_layer.data()->m_layer->opacity()); + } }; @@ -1269,6 +1367,8 @@ void GraphicsLayerQt::removeAnimationsForProperty(AnimatedPropertyID id) if (*it) { AnimationQtBase* anim = static_cast<AnimationQtBase*>(it->data()); if (anim && anim->m_webkitPropertyID == id) { + // We need to stop the animation right away, or it might flicker before it's deleted. + anim->stop(); anim->deleteLater(); it = m_impl->m_animations.erase(it); --it; @@ -1283,7 +1383,9 @@ void GraphicsLayerQt::removeAnimationsForKeyframes(const String& name) if (*it) { AnimationQtBase* anim = static_cast<AnimationQtBase*>((*it).data()); if (anim && anim->m_keyframesName == QString(name)) { - (*it).data()->deleteLater(); + // We need to stop the animation right away, or it might flicker before it's deleted. + anim->stop(); + anim->deleteLater(); it = m_impl->m_animations.erase(it); --it; } diff --git a/WebCore/platform/graphics/qt/GraphicsLayerQt.h b/WebCore/platform/graphics/qt/GraphicsLayerQt.h index 9e5832f..6de5a6e 100644 --- a/WebCore/platform/graphics/qt/GraphicsLayerQt.h +++ b/WebCore/platform/graphics/qt/GraphicsLayerQt.h @@ -74,6 +74,10 @@ public: virtual void setContentsToImage(Image*); virtual void setContentsToMedia(PlatformLayer*); virtual void setContentsBackgroundColor(const Color&); +#if ENABLE(3D_CANVAS) + virtual void setContentsToGraphicsContext3D(const GraphicsContext3D*); + virtual void setGraphicsContext3DNeedsDisplay(); +#endif virtual void setGeometryOrientation(CompositingCoordinatesOrientation orientation); virtual void setContentsOrientation(CompositingCoordinatesOrientation orientation); virtual void distributeOpacity(float); diff --git a/WebCore/platform/graphics/qt/ImageDecoderQt.cpp b/WebCore/platform/graphics/qt/ImageDecoderQt.cpp index b48b278..a8110ca 100644 --- a/WebCore/platform/graphics/qt/ImageDecoderQt.cpp +++ b/WebCore/platform/graphics/qt/ImageDecoderQt.cpp @@ -123,12 +123,14 @@ int ImageDecoderQt::repetitionCount() const // Qt | WebCore | description // -1 | 0 | infinite animation // 0 | cAnimationLoopOnce | show every frame once - // n | n | no idea if that is supported + // n | n+1 | Qt returns the # of iterations - 1 // n/a | cAnimationNone | show only the first frame if (m_repetitionCount == -1) m_repetitionCount = 0; else if (m_repetitionCount == 0) m_repetitionCount = cAnimationLoopOnce; + else + ++m_repetitionCount; } return m_repetitionCount; diff --git a/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp b/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp index bdac2a4..4d7b7b0 100644 --- a/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp +++ b/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp @@ -77,7 +77,7 @@ MediaPlayer::SupportsType MediaPlayerPrivate::supportsType(const String& mime, c if (!mime.startsWith("audio/") && !mime.startsWith("video/")) return MediaPlayer::IsNotSupported; - if (QMediaPlayer::hasSupport(mime, QStringList(codec)) >= QtMultimedia::ProbablySupported) + if (QMediaPlayer::hasSupport(mime, QStringList(codec)) >= QtMediaServices::ProbablySupported) return MediaPlayer::IsSupported; return MediaPlayer::MayBeSupported; @@ -344,8 +344,8 @@ unsigned MediaPlayerPrivate::bytesLoaded() const unsigned MediaPlayerPrivate::totalBytes() const { - if (m_mediaPlayer->availableMetaData().contains(QtMultimedia::Size)) - return m_mediaPlayer->metaData(QtMultimedia::Size).toInt(); + if (m_mediaPlayer->availableMetaData().contains(QtMediaServices::Size)) + return m_mediaPlayer->metaData(QtMediaServices::Size).toInt(); return 100; } diff --git a/WebCore/platform/graphics/qt/PathQt.cpp b/WebCore/platform/graphics/qt/PathQt.cpp index ee4af7f..4b0c21f 100644 --- a/WebCore/platform/graphics/qt/PathQt.cpp +++ b/WebCore/platform/graphics/qt/PathQt.cpp @@ -69,12 +69,41 @@ Path& Path::operator=(const Path& other) return *this; } +// Check whether a point is on the border +bool isPointOnPathBorder(const QPolygonF& border, const QPointF& p) +{ + QPointF p1 = border.at(0); + QPointF p2; + + for (int i = 1; i < border.size(); ++i) { + p2 = border.at(i); + // (x1<=x<=x2||x1=>x>=x2) && (y1<=y<=y2||y1=>y>=y2) && (y2-y1)(x-x1) == (y-y1)(x2-x1) + // In which, (y2-y1)(x-x1) == (y-y1)(x2-x1) is from (y2-y1)/(x2-x1) == (y-y1)/(x-x1) + // it want to check the slope between p1 and p2 is same with slope between p and p1, + // if so then the three points lie on the same line. + // In which, (x1<=x<=x2||x1=>x>=x2) && (y1<=y<=y2||y1=>y>=y2) want to make sure p is + // between p1 and p2, not outside. + if (((p.x() <= p1.x() && p.x() >= p2.x()) || (p.x() >= p1.x() && p.x() <= p2.x())) + && ((p.y() <= p1.y() && p.y() >= p2.y()) || (p.y() >= p1.y() && p.y() <= p2.y())) + && (p2.y() - p1.y()) * (p.x() - p1.x()) == (p.y() - p1.y()) * (p2.x() - p1.x())) { + return true; + } + p1 = p2; + } + return false; +} + bool Path::contains(const FloatPoint& point, WindRule rule) const { Qt::FillRule savedRule = m_path.fillRule(); const_cast<QPainterPath*>(&m_path)->setFillRule(rule == RULE_EVENODD ? Qt::OddEvenFill : Qt::WindingFill); bool contains = m_path.contains(point); + + if (!contains) { + // check whether the point is on the border + contains = isPointOnPathBorder(m_path.toFillPolygon(), point); + } const_cast<QPainterPath*>(&m_path)->setFillRule(savedRule); return contains; diff --git a/WebCore/platform/graphics/skia/GraphicsContext3DSkia.cpp b/WebCore/platform/graphics/skia/GraphicsContext3DSkia.cpp index cc4ca2e..e76ed7b 100644 --- a/WebCore/platform/graphics/skia/GraphicsContext3DSkia.cpp +++ b/WebCore/platform/graphics/skia/GraphicsContext3DSkia.cpp @@ -55,10 +55,9 @@ bool GraphicsContext3D::getImageData(Image* image, return false; SkBitmap& skiaImageRef = *skiaImage; SkAutoLockPixels lock(skiaImageRef); - int width = skiaImage->width(); int height = skiaImage->height(); int rowBytes = skiaImage->rowBytes(); - ASSERT(rowBytes == width * 4); + ASSERT(rowBytes == skiaImage->width() * 4); uint8_t* pixels = reinterpret_cast<uint8_t*>(skiaImage->getPixels()); outputVector.resize(rowBytes * height); int size = rowBytes * height; diff --git a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp index 8986685..e16b373 100644 --- a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp +++ b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp @@ -91,9 +91,9 @@ inline float square(float n) // bugs. Leaving the code in for now, so we can revert easily if necessary. // #define ENSURE_VALUE_SAFETY_FOR_SKIA +#ifdef ENSURE_VALUE_SAFETY_FOR_SKIA static bool isCoordinateSkiaSafe(float coord) { -#ifdef ENSURE_VALUE_SAFETY_FOR_SKIA // First check for valid floats. #if defined(_MSC_VER) if (!_finite(coord)) @@ -110,10 +110,8 @@ static bool isCoordinateSkiaSafe(float coord) return false; return true; -#else - return true; -#endif } +#endif static bool isPointSkiaSafe(const SkMatrix& transform, const SkPoint& pt) { @@ -734,8 +732,6 @@ void GraphicsContext::fillRect(const FloatRect& rect) ClipRectToCanvas(*platformContext()->canvas(), r, &r); } - const GraphicsContextState& state = m_common->state; - SkPaint paint; platformContext()->setupPaintForFilling(&paint); platformContext()->canvas()->drawRect(r, paint); @@ -1122,11 +1118,8 @@ void GraphicsContext::strokePath() if (!isPathSkiaSafe(getCTM(), path)) return; - const GraphicsContextState& state = m_common->state; - SkPaint paint; platformContext()->setupPaintForStroking(&paint, 0, 0); - platformContext()->canvas()->drawPath(path, paint); } @@ -1138,12 +1131,9 @@ void GraphicsContext::strokeRect(const FloatRect& rect, float lineWidth) if (!isRectSkiaSafe(getCTM(), rect)) return; - const GraphicsContextState& state = m_common->state; - SkPaint paint; platformContext()->setupPaintForStroking(&paint, 0, 0); paint.setStrokeWidth(WebCoreFloatToSkScalar(lineWidth)); - platformContext()->canvas()->drawRect(rect, paint); } diff --git a/WebCore/platform/graphics/transforms/TransformationMatrix.cpp b/WebCore/platform/graphics/transforms/TransformationMatrix.cpp index 0400d40..10c7f70 100644 --- a/WebCore/platform/graphics/transforms/TransformationMatrix.cpp +++ b/WebCore/platform/graphics/transforms/TransformationMatrix.cpp @@ -54,6 +54,22 @@ namespace WebCore { // webmasters - are to be held responsible. Basically, don't be a jerk, and remember that anything free comes // with no guarantee. +// A Note About row-major vs. column major matrixes +// +// The clients of this class (CSSMatrix and SVGMatrix) assume a column-major ordering. +// That means that when the matrix is initialized with 16 values, the first 4 values +// go in the 4 rows of the first column, etc. And in the dereferencing calls, the first +// digit is the column (e.g., m23() is column 2 row 3). Because C++ uses row-major arrays +// the internal matrix is stored in row-major order, so m[2][0] means row 2, column 0. This +// has no bearing on how the matrix is viewed on the outside, since all access is done +// with function calls. But it does help make the code more clear if you know that. +// +// FIXME: Multiply calls are named for what they do in the internal, row-major world. +// multLeft is actually a multRight in a column-major world, and multiply is a multLeft +// in a column-major world. For now I've left it that way to avoid too many confusing +// changes to the code. In particular AffineTransform uses these same terms for the +// opposite operations. So we have to be VERY careful when we change them. + typedef double Vector4[4]; typedef double Vector3[3]; diff --git a/WebCore/platform/graphics/transforms/TransformationMatrix.h b/WebCore/platform/graphics/transforms/TransformationMatrix.h index cdf101d..96b4baa 100644 --- a/WebCore/platform/graphics/transforms/TransformationMatrix.h +++ b/WebCore/platform/graphics/transforms/TransformationMatrix.h @@ -47,7 +47,7 @@ #endif #if PLATFORM(WIN) || (PLATFORM(QT) && OS(WINDOWS)) || (PLATFORM(WX) && OS(WINDOWS)) -#if COMPILER(MINGW) +#if COMPILER(MINGW) && !COMPILER(MINGW64) typedef struct _XFORM XFORM; #else typedef struct tagXFORM XFORM; diff --git a/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp b/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp index ed9073f..a804432 100644 --- a/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp +++ b/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp @@ -115,7 +115,7 @@ void FontPlatformData::platformDataInit(HFONT font, float size, HDC hdc, WCHAR* } FontPlatformData::FontPlatformData(HFONT hfont, CGFontRef font, float size, bool bold, bool oblique, bool useGDI) - : m_font(RefCountedHFONT::create(hfont)) + : m_font(RefCountedGDIHandle<HFONT>::create(hfont)) , m_size(size) , m_cgFont(font) , m_syntheticBold(bold) diff --git a/WebCore/platform/graphics/win/FontPlatformDataWin.cpp b/WebCore/platform/graphics/win/FontPlatformDataWin.cpp index cc02c4c..99f364c 100644 --- a/WebCore/platform/graphics/win/FontPlatformDataWin.cpp +++ b/WebCore/platform/graphics/win/FontPlatformDataWin.cpp @@ -36,7 +36,7 @@ using std::min; namespace WebCore { FontPlatformData::FontPlatformData(HFONT font, float size, bool bold, bool oblique, bool useGDI) - : m_font(RefCountedHFONT::create(font)) + : m_font(RefCountedGDIHandle<HFONT>::create(font)) , m_size(size) #if PLATFORM(CG) , m_cgFont(0) diff --git a/WebCore/platform/graphics/win/GraphicsContextWin.cpp b/WebCore/platform/graphics/win/GraphicsContextWin.cpp index b110145..161b9c6 100644 --- a/WebCore/platform/graphics/win/GraphicsContextWin.cpp +++ b/WebCore/platform/graphics/win/GraphicsContextWin.cpp @@ -43,8 +43,6 @@ using namespace std; namespace WebCore { -class SVGResourceImage; - static void fillWithClearColor(HBITMAP bitmap) { BITMAP bmpInfo; @@ -199,13 +197,4 @@ void GraphicsContextPlatformPrivate::concatCTM(const AffineTransform& transform) ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY); } -#if ENABLE(SVG) -GraphicsContext* contextForImage(SVGResourceImage*) -{ - // FIXME: This should go in GraphicsContextCG.cpp - notImplemented(); - return 0; -} -#endif - } diff --git a/WebCore/platform/graphics/win/RefCountedHFONT.h b/WebCore/platform/graphics/win/RefCountedGDIHandle.h index b1b691b..65f66f1 100755 --- a/WebCore/platform/graphics/win/RefCountedHFONT.h +++ b/WebCore/platform/graphics/win/RefCountedGDIHandle.h @@ -17,40 +17,54 @@ * Boston, MA 02110-1301, USA. * */ -#ifndef RefCountedHFONT_h -#define RefCountedHFONT_h -#include "StringImpl.h" +#ifndef RefCountedGDIHandle_h +#define RefCountedGDIHandle_h + +#include <windows.h> +#include <wtf/HashFunctions.h> +#include <wtf/OwnPtr.h> #include <wtf/RefCounted.h> namespace WebCore { -class RefCountedHFONT : public RefCounted<RefCountedHFONT> { +template <typename T> class RefCountedGDIHandle : public RefCounted<RefCountedGDIHandle<T> > { public: - static PassRefPtr<RefCountedHFONT> create(HFONT hfont) { return adoptRef(new RefCountedHFONT(hfont)); } - static PassRefPtr<RefCountedHFONT> createDeleted() { return adoptRef(new RefCountedHFONT(reinterpret_cast<HFONT>(-1))); } + static PassRefPtr<RefCountedGDIHandle> create(T handle) + { + return adoptRef(new RefCountedGDIHandle<T>(handle)); + } + + static PassRefPtr<RefCountedGDIHandle<T> > createDeleted() + { + return adoptRef(new RefCountedGDIHandle<T>(reinterpret_cast<T>(-1))); + } + + ~RefCountedGDIHandle() + { + if (m_handle != reinterpret_cast<T>(-1)) + WTF::deleteOwnedPtr(m_handle); + } - ~RefCountedHFONT() + T handle() const { - if (m_hfont != reinterpret_cast<HFONT>(-1)) - DeleteObject(m_hfont); + return m_handle; } - HFONT hfont() const { return m_hfont; } unsigned hash() const { - return StringImpl::computeHash(reinterpret_cast<const UChar*>(&m_hfont), sizeof(HFONT) / sizeof(UChar)); + return WTF::PtrHash<T>::hash(m_handle); } private: - RefCountedHFONT(HFONT hfont) - : m_hfont(hfont) + RefCountedGDIHandle(T handle) + : m_handle(handle) { } - HFONT m_hfont; + T m_handle; }; -} +} // namespace WebCore -#endif +#endif // RefCountedGDIHandle_h diff --git a/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp b/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp index ee3a980..20d42ff 100644 --- a/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp +++ b/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp @@ -125,11 +125,26 @@ void SimpleFontData::platformCharWidthInit() initCharWidths(); } } +FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const +{ + if (m_platformData.useGDI()) + return boundsForGDIGlyph(glyph); + + CGRect box; + CGFontGetGlyphBBoxes(m_platformData.cgFont(), &glyph, 1, &box); + float pointSize = m_platformData.size(); + CGFloat scale = pointSize / unitsPerEm(); + FloatRect boundingBox = CGRectApplyAffineTransform(box, CGAffineTransformMakeScale(scale, -scale)); + if (m_syntheticBoldOffset) + boundingBox.setWidth(boundingBox.width() + m_syntheticBoldOffset); -GlyphMetrics SimpleFontData::platformMetricsForGlyph(Glyph glyph, GlyphMetricsMode metricsMode) const + return boundingBox; +} + +float SimpleFontData::platformWidthForGlyph(Glyph glyph) const { if (m_platformData.useGDI()) - return metricsForGDIGlyph(glyph); + return widthForGDIGlyph(glyph); CGFontRef font = m_platformData.cgFont(); float pointSize = m_platformData.size(); @@ -139,18 +154,8 @@ GlyphMetrics SimpleFontData::platformMetricsForGlyph(Glyph glyph, GlyphMetricsMo // FIXME: Need to add real support for printer fonts. bool isPrinterFont = false; wkGetGlyphAdvances(font, m, m_isSystemFont, isPrinterFont, glyph, advance); - GlyphMetrics metrics; - metrics.horizontalAdvance = advance.width + m_syntheticBoldOffset; - - if (metricsMode == GlyphBoundingBox) { - CGRect boundingBox; - CGFontGetGlyphBBoxes(font, &glyph, 1, &boundingBox); - CGFloat scale = pointSize / unitsPerEm(); - metrics.boundingBox = CGRectApplyAffineTransform(boundingBox, CGAffineTransformMakeScale(scale, -scale)); - if (m_syntheticBoldOffset) - metrics.boundingBox.setWidth(metrics.boundingBox.width() + m_syntheticBoldOffset); - } - return metrics; + + return advance.width + m_syntheticBoldOffset; } } diff --git a/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp b/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp index e845d85..62ea060 100644 --- a/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp +++ b/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp @@ -96,6 +96,14 @@ void SimpleFontData::platformCharWidthInit() // charwidths are set in platformInit. } +FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const +{ + if (m_platformData.useGDI()) + return boundsForGDIGlyph(glyph); + //FIXME: Implement this + return FloatRect(); +} + float SimpleFontData::platformWidthForGlyph(Glyph glyph) const { if (m_platformData.useGDI()) diff --git a/WebCore/platform/graphics/win/SimpleFontDataWin.cpp b/WebCore/platform/graphics/win/SimpleFontDataWin.cpp index f85f9ba..7010c8a 100644 --- a/WebCore/platform/graphics/win/SimpleFontDataWin.cpp +++ b/WebCore/platform/graphics/win/SimpleFontDataWin.cpp @@ -179,7 +179,24 @@ void SimpleFontData::determinePitch() ReleaseDC(0, dc); } -GlyphMetrics SimpleFontData::metricsForGDIGlyph(Glyph glyph) const +FloatRect SimpleFontData::boundsForGDIGlyph(Glyph glyph) const +{ + HDC hdc = GetDC(0); + SetGraphicsMode(hdc, GM_ADVANCED); + HGDIOBJ oldFont = SelectObject(hdc, m_platformData.hfont()); + + GLYPHMETRICS gdiMetrics; + static const MAT2 identity = { 0, 1, 0, 0, 0, 0, 0, 1 }; + GetGlyphOutline(hdc, glyph, GGO_METRICS | GGO_GLYPH_INDEX, &gdiMetrics, 0, 0, &identity); + + SelectObject(hdc, oldFont); + ReleaseDC(0, hdc); + + return FloatRect(gdiMetrics.gmptGlyphOrigin.x, -gdiMetrics.gmptGlyphOrigin.y, + gdiMetrics.gmBlackBoxX + m_syntheticBoldOffset, gdiMetrics.gmBlackBoxY); +} + +float SimpleFontData::widthForGDIGlyph(Glyph glyph) const { HDC hdc = GetDC(0); SetGraphicsMode(hdc, GM_ADVANCED); @@ -192,12 +209,7 @@ GlyphMetrics SimpleFontData::metricsForGDIGlyph(Glyph glyph) const SelectObject(hdc, oldFont); ReleaseDC(0, hdc); - GlyphMetrics glyphMetrics; - glyphMetrics.horizontalAdvance = gdiMetrics.gmCellIncX + m_syntheticBoldOffset; - glyphMetrics.boundingBox = FloatRect(gdiMetrics.gmptGlyphOrigin.x, -gdiMetrics.gmptGlyphOrigin.y, - gdiMetrics.gmBlackBoxX + m_syntheticBoldOffset, gdiMetrics.gmBlackBoxY); - - return glyphMetrics; + return gdiMetrics.gmCellIncX + m_syntheticBoldOffset; } SCRIPT_FONTPROPERTIES* SimpleFontData::scriptFontProperties() const diff --git a/WebCore/platform/graphics/win/UniscribeController.cpp b/WebCore/platform/graphics/win/UniscribeController.cpp index cfa15a2..bcf7578 100644 --- a/WebCore/platform/graphics/win/UniscribeController.cpp +++ b/WebCore/platform/graphics/win/UniscribeController.cpp @@ -380,12 +380,12 @@ bool UniscribeController::shapeAndPlaceItem(const UChar* cp, unsigned i, const S glyphBuffer->add(glyph, fontData, advance, &size); } - GlyphMetrics glyphMetrics = fontData->metricsForGlyph(glyph); - glyphMetrics.boundingBox.move(m_glyphOrigin.x(), m_glyphOrigin.y()); - m_minGlyphBoundingBoxX = min(m_minGlyphBoundingBoxX, glyphMetrics.boundingBox.x()); - m_maxGlyphBoundingBoxX = max(m_maxGlyphBoundingBoxX, glyphMetrics.boundingBox.right()); - m_minGlyphBoundingBoxY = min(m_minGlyphBoundingBoxY, glyphMetrics.boundingBox.y()); - m_maxGlyphBoundingBoxY = max(m_maxGlyphBoundingBoxY, glyphMetrics.boundingBox.bottom()); + FloatRect glyphBounds = fontData->boundsForGlyph(glyph); + glyphBounds.move(m_glyphOrigin.x(), m_glyphOrigin.y()); + m_minGlyphBoundingBoxX = min(m_minGlyphBoundingBoxX, glyphBounds.x()); + m_maxGlyphBoundingBoxX = max(m_maxGlyphBoundingBoxX, glyphBounds.right()); + m_minGlyphBoundingBoxY = min(m_minGlyphBoundingBoxY, glyphBounds.y()); + m_maxGlyphBoundingBoxY = max(m_maxGlyphBoundingBoxY, glyphBounds.bottom()); m_glyphOrigin.move(advance + offsetX, -offsetY); // Mutate the glyph array to contain our altered advances. diff --git a/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp b/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp index 1b14846..714a4ac 100644 --- a/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp +++ b/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp @@ -275,6 +275,13 @@ void WKCACFLayerRenderer::setRootContents(CGImageRef image) renderSoon(); } +void WKCACFLayerRenderer::setRootContentsAndDisplay(CGImageRef image) +{ + ASSERT(m_rootLayer); + m_rootLayer->setContents(image); + paint(); +} + void WKCACFLayerRenderer::setRootChildLayer(WKCACFLayer* layer) { if (!m_scrollLayer) diff --git a/WebCore/platform/graphics/win/WKCACFLayerRenderer.h b/WebCore/platform/graphics/win/WKCACFLayerRenderer.h index ea710b6..b708464 100644 --- a/WebCore/platform/graphics/win/WKCACFLayerRenderer.h +++ b/WebCore/platform/graphics/win/WKCACFLayerRenderer.h @@ -62,6 +62,7 @@ public: void setScrollFrame(const IntPoint&, const IntSize&); void setRootContents(CGImageRef); + void setRootContentsAndDisplay(CGImageRef); void setRootChildLayer(WKCACFLayer* layer); void setNeedsDisplay(); void setHostWindow(HWND window) { m_hostWindow = window; } diff --git a/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp b/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp index d5f8a5a..f8a1e26 100644 --- a/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp +++ b/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp @@ -63,7 +63,7 @@ static String createUniqueFontName() unsigned int* ptr = reinterpret_cast<unsigned int*>(fontUuid.data()); for (int i = 0; i < sizeof(GUID) / sizeof(int) ; ++i) - *(ptr + i) = static_cast<unsigned int>(WTF::randomNumber() * (std::numeric_limits<unsigned>::max() + 1.0)); + *(ptr + i) = static_cast<unsigned int>(randomNumber() * (std::numeric_limits<unsigned>::max() + 1.0)); Vector<char> fontNameVector; base64Encode(fontUuid, fontNameVector); diff --git a/WebCore/platform/graphics/wince/SimpleFontDataWince.cpp b/WebCore/platform/graphics/wince/SimpleFontDataWince.cpp index 1195294..6c815fc 100644 --- a/WebCore/platform/graphics/wince/SimpleFontDataWince.cpp +++ b/WebCore/platform/graphics/wince/SimpleFontDataWince.cpp @@ -131,6 +131,11 @@ void SimpleFontData::determinePitch() m_treatAsFixedPitch = !(tm.tmPitchAndFamily & TMPF_FIXED_PITCH); } +FloatRect SimpleFontData::platformBoundsForGlyph(Glyph) const +{ + return FloatRect(); +} + float SimpleFontData::platformWidthForGlyph(Glyph glyph) const { if (m_platformData.isDisabled()) diff --git a/WebCore/platform/graphics/wx/FontCacheWx.cpp b/WebCore/platform/graphics/wx/FontCacheWx.cpp index b2dea2e..5b02bdb 100644 --- a/WebCore/platform/graphics/wx/FontCacheWx.cpp +++ b/WebCore/platform/graphics/wx/FontCacheWx.cpp @@ -42,7 +42,13 @@ void FontCache::platformInit() const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, const UChar* characters, int length) { SimpleFontData* fontData = 0; - fontData = new SimpleFontData(FontPlatformData(font.fontDescription(), font.family().family())); + fontData = getCachedFontData(font.fontDescription(), font.family().family()); + if (!fontData->containsCharacters(characters, length)) + fontData = getSimilarFontPlatformData(font); + if (!fontData->containsCharacters(characters, length)) + fontData = getLastResortFallbackFont(font.fontDescription()); + + ASSERT(fontData->containsCharacters(characters, length)); return fontData; } @@ -55,8 +61,15 @@ SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& font { // FIXME: Would be even better to somehow get the user's default font here. For now we'll pick // the default that the user would get without changing any prefs. - static AtomicString timesStr("systemfont"); - return getCachedFontData(fontDescription, timesStr); + SimpleFontData* fallback = 0; +#if OS(WINDOWS) || (OS(DARWIN) && !defined(BUILDING_ON_TIGER)) + static AtomicString fallbackName("Arial Unicode MS"); +#else + static AtomicString fallbackName("Times New Roman"); +#endif + fallback = getCachedFontData(fontDescription, fallbackName); + + return fallback; } FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family) diff --git a/WebCore/platform/graphics/wx/FontPlatformData.h b/WebCore/platform/graphics/wx/FontPlatformData.h index ecb957e..94585e6 100644 --- a/WebCore/platform/graphics/wx/FontPlatformData.h +++ b/WebCore/platform/graphics/wx/FontPlatformData.h @@ -37,6 +37,22 @@ #include <wx/defs.h> #include <wx/font.h> +#include <wx/gdicmn.h> + +#if OS(DARWIN) +#include <ApplicationServices/ApplicationServices.h> + +#if __OBJC__ +@class NSFont; +#else +class NSFont; +#endif + +#ifndef BUILDING_ON_TIGER +inline CTFontRef toCTFontRef(NSFont *nsFont) { return reinterpret_cast<CTFontRef>(nsFont); } +#endif + +#endif namespace WebCore { @@ -64,9 +80,12 @@ public: enum FontState { UNINITIALIZED, DELETED, VALID }; FontPlatformData(WTF::HashTableDeletedValueType) - : m_fontState(DELETED), - m_font(0), - m_size(0) + : m_fontState(DELETED) + , m_font(0) + , m_size(0) +#if OS(DARWIN) + , m_atsuFontID(0) +#endif { } ~FontPlatformData(); @@ -77,6 +96,9 @@ public: : m_fontState(UNINITIALIZED) , m_font(0) , m_size(size) +#if OS(DARWIN) + , m_atsuFontID(0) +#endif { } @@ -84,6 +106,9 @@ public: : m_fontState(UNINITIALIZED) , m_font(0) , m_size(0) +#if OS(DARWIN) + , m_atsuFontID(0) +#endif { } @@ -121,11 +146,23 @@ public: bool roundsGlyphAdvances() const { return false; } + bool allowsLigatures() const { return false; } + #if OS(WINDOWS) bool useGDI() const; HFONT hfont() const; #endif +#if OS(DARWIN) + ATSUFontID m_atsuFontID; + CGFontRef cgFont() const; + NSFont* nsFont() const; + void cacheNSFont(); + +#endif + + float m_size; + #ifndef NDEBUG String description() const; #endif @@ -133,7 +170,9 @@ public: private: WTF::RefPtr<FontHolder> m_font; FontState m_fontState; - float m_size; +#if OS(DARWIN) + NSFont* m_nsFont; +#endif }; } diff --git a/WebCore/platform/graphics/wx/FontPlatformDataWx.cpp b/WebCore/platform/graphics/wx/FontPlatformDataWx.cpp index a75d244..601d6b4 100644 --- a/WebCore/platform/graphics/wx/FontPlatformDataWx.cpp +++ b/WebCore/platform/graphics/wx/FontPlatformDataWx.cpp @@ -99,6 +99,11 @@ FontPlatformData::FontPlatformData(const FontDescription& desc, const AtomicStri ) ); #endif +#if OS(DARWIN) + m_atsuFontID = m_font->font()->MacGetATSUFontID(); + cacheNSFont(); +#endif + m_size = desc.computedPixelSize(); m_fontState = VALID; m_size = desc.computedPixelSize(); @@ -142,4 +147,24 @@ HFONT FontPlatformData::hfont() const } #endif +#if OS(DARWIN) +CGFontRef FontPlatformData::cgFont() const +{ + CGFontRef cgFont = 0; +#ifdef wxOSX_USE_CORE_TEXT && wxOSX_USE_CORE_TEXT + cgFont = CTFontCopyGraphicsFont((CTFontRef)m_font->font()->OSXGetCTFont(), 0); +#else + ATSFontRef fontRef; + + fontRef = FMGetATSFontRefFromFont(m_atsuFontID); + + if (fontRef) + cgFont = CGFontCreateWithPlatformFont((void*)&fontRef); +#endif + return cgFont; +} +#endif + + + } diff --git a/WebCore/platform/graphics/GlyphMetricsMap.cpp b/WebCore/platform/graphics/wx/FontPlatformDataWxMac.mm index d3c3180..b719656 100644 --- a/WebCore/platform/graphics/GlyphMetricsMap.cpp +++ b/WebCore/platform/graphics/wx/FontPlatformDataWxMac.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2010 Kevin Ollivier All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -25,38 +25,26 @@ * (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 "GlyphMetricsMap.h" +#include "FontPlatformData.h" + +#include <wx/defs.h> +#include <wx/font.h> namespace WebCore { -GlyphMetricsMap::GlyphMetricsPage* GlyphMetricsMap::locatePageSlowCase(unsigned pageNumber) +NSFont* FontPlatformData::nsFont() const { - GlyphMetricsPage* page; - if (!pageNumber) { - ASSERT(!m_filledPrimaryPage); - page = &m_primaryPage; - m_filledPrimaryPage = true; - } else { - if (m_pages) { - if ((page = m_pages->get(pageNumber))) - return page; - } else - m_pages.set(new HashMap<int, GlyphMetricsPage*>); - page = new GlyphMetricsPage; - m_pages->set(pageNumber, page); - } +#if wxCHECK_VERSION(2,9,1) && wxOSX_USE_COCOA + if (m_font && m_font->font()) + return (NSFont*)m_font->font()->OSXGetNSFont(); +#endif +} - GlyphMetrics unknownMetrics; - unknownMetrics.horizontalAdvance = cGlyphSizeUnknown; - unknownMetrics.boundingBox.setWidth(cGlyphSizeUnknown); - unknownMetrics.boundingBox.setHeight(cGlyphSizeUnknown); - // Fill in the whole page with the unknown glyph information. - for (unsigned i = 0; i < GlyphMetricsPage::size; i++) - page->setMetricsForIndex(i, unknownMetrics); +void FontPlatformData::cacheNSFont() +{ - return page; } } diff --git a/WebCore/platform/graphics/wx/FontWx.cpp b/WebCore/platform/graphics/wx/FontWx.cpp index dce3841..c00c622 100644 --- a/WebCore/platform/graphics/wx/FontWx.cpp +++ b/WebCore/platform/graphics/wx/FontWx.cpp @@ -35,6 +35,11 @@ #if OS(WINDOWS) #include "UniscribeController.h" +typedef UniscribeController ComplexTextController +#endif + +#if OS(DARWIN) +#include "mac/ComplexTextController.h" #endif #include <wx/dcclient.h> @@ -45,7 +50,7 @@ namespace WebCore { bool Font::canReturnFallbackFontsForComplexText() { -#if OS(WINDOWS) +#if OS(WINDOWS) || OS(DARWIN) return true; #else return false; @@ -67,8 +72,8 @@ void Font::drawGlyphs(GraphicsContext* graphicsContext, const SimpleFontData* fo FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& point, int h, int from, int to) const { -#if OS(WINDOWS) - UniscribeController it(this, run); +#if OS(WINDOWS) || OS(DARWIN) + ComplexTextController it(this, run); it.advance(from); float beforeWidth = it.runWidthSoFar(); it.advance(to); @@ -76,9 +81,14 @@ FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& // Using roundf() rather than ceilf() for the right edge as a compromise to ensure correct caret positioning if (run.rtl()) { +#if OS(WINDOWS) it.advance(run.length()); float totalWidth = it.runWidthSoFar(); return FloatRect(point.x() + floorf(totalWidth - afterWidth), point.y(), roundf(totalWidth - beforeWidth) - floorf(totalWidth - afterWidth), h); +#else + float totalWidth = it.totalWidth(); + return FloatRect(point.x() + floorf(totalWidth - afterWidth), point.y(), roundf(totalWidth - beforeWidth) - floorf(totalWidth - afterWidth), h); +#endif } return FloatRect(point.x() + floorf(beforeWidth), point.y(), roundf(afterWidth) - floorf(beforeWidth), h); @@ -90,12 +100,12 @@ FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const { -#if OS(WINDOWS) +#if OS(WINDOWS) || OS(DARWIN) // This glyph buffer holds our glyphs + advances + font data for each glyph. GlyphBuffer glyphBuffer; float startX = point.x(); - UniscribeController controller(this, run); + ComplexTextController controller(this, run); controller.advance(from); float beforeWidth = controller.runWidthSoFar(); controller.advance(to, &glyphBuffer); @@ -107,8 +117,14 @@ void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const F float afterWidth = controller.runWidthSoFar(); if (run.rtl()) { +#if OS(WINDOWS) controller.advance(run.length()); startX += controller.runWidthSoFar() - afterWidth; +#else + startX += controller.totalWidth() + controller.finalRoundingWidth() - afterWidth; + for (int i = 0, end = glyphBuffer.size() - 1; i < glyphBuffer.size() / 2; ++i, --end) + glyphBuffer.swap(i, end); +#endif } else startX += beforeWidth; @@ -123,11 +139,15 @@ void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const F float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow*) const { +#if OS(WINDOWS) || OS(DARWIN) + ComplexTextController controller(this, run, fallbackFonts); #if OS(WINDOWS) - UniscribeController controller(this, run, fallbackFonts); controller.advance(run.length()); return controller.runWidthSoFar(); #else + return controller.totalWidth(); +#endif +#else notImplemented(); return 0; #endif @@ -135,8 +155,8 @@ float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon int Font::offsetForPositionForComplexText(const TextRun& run, int x, bool includePartialGlyphs) const { -#if OS(WINDOWS) - UniscribeController controller(this, run); +#if OS(WINDOWS) || OS(DARWIN) + ComplexTextController controller(this, run); return controller.offsetForPosition(x, includePartialGlyphs); #else notImplemented(); diff --git a/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp b/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp index 3c8a1da..e899715 100644 --- a/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp +++ b/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp @@ -36,8 +36,13 @@ #include <unicode/uchar.h> #include <unicode/unorm.h> +#if OS(DARWIN) +#include "WebCoreSystemInterface.h" +#endif + #include <wx/defs.h> #include <wx/dcscreen.h> +#include <wx/string.h> #include "fontprops.h" namespace WebCore @@ -56,11 +61,12 @@ void SimpleFontData::platformInit() m_lineGap = props.GetLineGap(); } + m_syntheticBoldOffset = 0.0f; + #if OS(WINDOWS) m_scriptCache = 0; m_scriptFontProperties = 0; m_isSystemFont = false; - m_syntheticBoldOffset = 0.0f; #endif } @@ -91,9 +97,9 @@ SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDes { if (!m_smallCapsFontData){ FontDescription desc = FontDescription(fontDescription); - desc.setSpecifiedSize(0.70f*fontDescription.computedSize()); - const FontPlatformData* pdata = new FontPlatformData(desc, desc.family().family()); - m_smallCapsFontData = new SimpleFontData(*pdata); + desc.setSpecifiedSize(0.70f * fontDescription.computedSize()); + FontPlatformData platformData(desc, desc.family().family()); + m_smallCapsFontData = new SimpleFontData(platformData); } return m_smallCapsFontData; } @@ -101,7 +107,12 @@ SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDes bool SimpleFontData::containsCharacters(const UChar* characters, int length) const { // FIXME: We will need to implement this to load non-ASCII encoding sites - return wxFontContainsCharacters(*m_platformData.font(), characters, length); +#if OS(WINDOWS) + return wxFontContainsCharacters(m_platformData.hfont(), characters, length); +#elif OS(DARWIN) + return wxFontContainsCharacters(m_platformData.nsFont(), characters, length); +#endif + return true; } void SimpleFontData::determinePitch() @@ -112,19 +123,32 @@ void SimpleFontData::determinePitch() m_treatAsFixedPitch = false; } -GlyphMetrics SimpleFontData::platformMetricsForGlyph(Glyph glyph, GlyphMetricsMode) const +FloatRect SimpleFontData::platformBoundsForGlyph(Glyph) const +{ + return FloatRect(); +} + +float SimpleFontData::platformWidthForGlyph(Glyph glyph) const { - GlyphMetrics metrics; #if __WXMSW__ // under Windows / wxMSW we currently always use GDI fonts. - metrics.horizontalAdvance = widthForGDIGlyph(glyph); + return widthForGDIGlyph(glyph); +#elif OS(DARWIN) + float pointSize = m_platformData.size(); + CGAffineTransform m = CGAffineTransformMakeScale(pointSize, pointSize); + CGSize advance; + NSFont* nsfont = (NSFont*)m_platformData.nsFont(); + if (!wkGetGlyphTransformedAdvances(m_platformData.cgFont(), nsfont, &m, &glyph, &advance)) { + // LOG_ERROR("Unable to cache glyph widths for %@ %f", [nsfont displayName], pointSize); + advance.width = 0; + } + return advance.width + m_syntheticBoldOffset; #else // TODO: fix this! Make GetTextExtents a method of wxFont in 2.9 int width = 10; GetTextExtent(*m_platformData.font(), (wxChar)glyph, &width, NULL); - metrics.horizontalAdvance = width; + return width; #endif - return metrics; } #if OS(WINDOWS) diff --git a/WebCore/platform/gtk/ClipboardGtk.cpp b/WebCore/platform/gtk/ClipboardGtk.cpp index 93a21e2..9bee55a 100644 --- a/WebCore/platform/gtk/ClipboardGtk.cpp +++ b/WebCore/platform/gtk/ClipboardGtk.cpp @@ -24,6 +24,8 @@ #include "Frame.h" #include "Image.h" #include "NotImplemented.h" +#include "Pasteboard.h" +#include "PasteboardHelper.h" #include "RenderImage.h" #include "StringHash.h" #include "markup.h" @@ -32,13 +34,33 @@ namespace WebCore { +enum ClipboardType { + ClipboardTypeText, + ClipboardTypeMarkup, + ClipboardTypeURIList, + ClipboardTypeURL, + ClipboardTypeImage, + ClipboardTypeUnknown +}; + PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy) { - return ClipboardGtk::create(policy, false); + return ClipboardGtk::create(policy, gtk_clipboard_get_for_display(gdk_display_get_default(), GDK_SELECTION_CLIPBOARD), false); +} + +ClipboardGtk::ClipboardGtk(ClipboardAccessPolicy policy, GtkClipboard* clipboard) + : Clipboard(policy, false) + , m_dataObject(DataObjectGtk::forClipboard(clipboard)) + , m_clipboard(clipboard) + , m_helper(Pasteboard::generalPasteboard()->helper()) +{ } -ClipboardGtk::ClipboardGtk(ClipboardAccessPolicy policy, bool forDragging) +ClipboardGtk::ClipboardGtk(ClipboardAccessPolicy policy, PassRefPtr<DataObjectGtk> dataObject, bool forDragging) : Clipboard(policy, forDragging) + , m_dataObject(dataObject) + , m_clipboard(0) + , m_helper(Pasteboard::generalPasteboard()->helper()) { } @@ -46,39 +68,197 @@ ClipboardGtk::~ClipboardGtk() { } -void ClipboardGtk::clearData(const String&) +static ClipboardType dataObjectTypeFromHTMLClipboardType(const String& rawType) { - notImplemented(); + String type(rawType.stripWhiteSpace()); + + // Two special cases for IE compatibility + if (type == "Text") + return ClipboardTypeText; + if (type == "URL") + return ClipboardTypeURL; + + // From the Mac port: Ignore any trailing charset - JS strings are + // Unicode, which encapsulates the charset issue. + if (type == "text/plain" || type.startsWith("text/plain;")) + return ClipboardTypeText; + if (type == "text/html" || type.startsWith("text/html;")) + return ClipboardTypeMarkup; + if (type == "Files" || type == "text/uri-list" || type.startsWith("text/uri-list;")) + return ClipboardTypeURIList; + + // Not a known type, so just default to using the text portion. + return ClipboardTypeUnknown; } +void ClipboardGtk::clearData(const String& typeString) +{ + if (policy() != ClipboardWritable) + return; + + ClipboardType type = dataObjectTypeFromHTMLClipboardType(typeString); + switch (type) { + case ClipboardTypeURIList: + case ClipboardTypeURL: + m_dataObject->clearURIList(); + break; + case ClipboardTypeMarkup: + m_dataObject->clearMarkup(); + break; + case ClipboardTypeText: + m_dataObject->clearText(); + break; + case ClipboardTypeUnknown: + default: + m_dataObject->clear(); + } + + if (m_clipboard) + m_helper->writeClipboardContents(m_clipboard); +} + + void ClipboardGtk::clearAllData() { - notImplemented(); + if (policy() != ClipboardWritable) + return; + + m_dataObject->clear(); + + if (m_clipboard) + m_helper->writeClipboardContents(m_clipboard); } -String ClipboardGtk::getData(const String&, bool &success) const +static String joinURIList(Vector<KURL> uriList) { - notImplemented(); - success = false; + if (uriList.isEmpty()) + return String(); + + String joined(uriList[0].string()); + for (size_t i = 1; i < uriList.size(); i++) { + joined.append("\r\n"); + joined.append(uriList[i].string()); + } + + return joined; +} + +String ClipboardGtk::getData(const String& typeString, bool& success) const +{ + success = false; // Pessimism. + if (policy() != ClipboardReadable || !m_dataObject) + return String(); + + if (m_clipboard) + m_helper->getClipboardContents(m_clipboard); + + ClipboardType type = dataObjectTypeFromHTMLClipboardType(typeString); + if (type == ClipboardTypeURIList) { + if (!m_dataObject->hasURIList()) + return String(); + success = true; + return joinURIList(m_dataObject->uriList()); + } + + if (type == ClipboardTypeURL) { + if (!m_dataObject->hasURL()) + return String(); + success = true; + return m_dataObject->url(); + } + + if (type == ClipboardTypeMarkup) { + if (!m_dataObject->hasMarkup()) + return String(); + success = true; + return m_dataObject->markup(); + } + + if (type == ClipboardTypeText) { + if (!m_dataObject->hasText()) + return String(); + success = true; + return m_dataObject->text(); + } + return String(); } -bool ClipboardGtk::setData(const String&, const String&) +bool ClipboardGtk::setData(const String& typeString, const String& data) { - notImplemented(); - return false; + if (policy() != ClipboardWritable) + return false; + + bool success = false; + ClipboardType type = dataObjectTypeFromHTMLClipboardType(typeString); + if (type == ClipboardTypeURIList || type == ClipboardTypeURL) { + Vector<KURL> uriList; + gchar** uris = g_uri_list_extract_uris(data.utf8().data()); + if (uris) { + gchar** currentURI = uris; + while (*currentURI) { + uriList.append(KURL(KURL(), *currentURI)); + currentURI++; + } + g_strfreev(uris); + m_dataObject->setURIList(uriList); + success = true; + } + } else if (type == ClipboardTypeMarkup) { + m_dataObject->setMarkup(data); + success = true; + } else if (type == ClipboardTypeText) { + m_dataObject->setText(data); + success = true; + } + + if (success && m_clipboard) + m_helper->writeClipboardContents(m_clipboard); + + return success; } HashSet<String> ClipboardGtk::types() const { - notImplemented(); - return HashSet<String>(); + if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable) + return HashSet<String>(); + + if (m_clipboard) + m_helper->getClipboardContents(m_clipboard); + + HashSet<String> types; + if (m_dataObject->hasText()) { + types.add("text/plain"); + types.add("Text"); + } + + if (m_dataObject->hasMarkup()) + types.add("text/html"); + + if (m_dataObject->hasURIList()) { + types.add("text/uri-list"); + types.add("URL"); + types.add("Files"); + } + + return types; } PassRefPtr<FileList> ClipboardGtk::files() const { - notImplemented(); - return 0; + if (policy() != ClipboardReadable) + return FileList::create(); + + if (m_clipboard) + m_helper->getClipboardContents(m_clipboard); + + RefPtr<FileList> fileList = FileList::create(); + Vector<String> fileVector(m_dataObject->files()); + + for (size_t i = 0; i < fileVector.size(); i++) + fileList->append(File::create(fileVector[i])); + + return fileList.release(); } IntPoint ClipboardGtk::dragLocation() const @@ -151,44 +331,54 @@ void ClipboardGtk::declareAndWriteDragImage(Element* element, const KURL& url, c void ClipboardGtk::writeURL(const KURL& url, const String& label, Frame*) { - GtkClipboard* textClipboard = gtk_clipboard_get(gdk_atom_intern_static_string("WebKitClipboardText")); - GtkClipboard* urlClipboard = gtk_clipboard_get(gdk_atom_intern_static_string("WebKitClipboardUrl")); - GtkClipboard* urlLabelClipboard = gtk_clipboard_get(gdk_atom_intern_static_string("WebKitClipboardUrlLabel")); - - gtk_clipboard_clear(textClipboard); - gtk_clipboard_clear(urlClipboard); - gtk_clipboard_clear(urlLabelClipboard); - - gtk_clipboard_set_text(textClipboard, url.string().utf8().data(), -1); - gtk_clipboard_set_text(urlClipboard, url.string().utf8().data(), -1); - gtk_clipboard_set_text(urlLabelClipboard, label.utf8().data(), -1); + String actualLabel(label); + if (actualLabel.isEmpty()) + actualLabel = url; + + m_dataObject->setText(url.string()); + + Vector<UChar> markup; + append(markup, "<a href=\""); + append(markup, url.string()); + append(markup, "\">"); + append(markup, label); + append(markup, "</a>"); + m_dataObject->setMarkup(String::adopt(markup)); + + Vector<KURL> uriList; + uriList.append(url); + m_dataObject->setURIList(uriList); + + if (m_clipboard) + m_helper->writeClipboardContents(m_clipboard); } void ClipboardGtk::writeRange(Range* range, Frame* frame) { - GtkClipboard* textClipboard = gtk_clipboard_get(gdk_atom_intern_static_string("WebKitClipboardText")); - GtkClipboard* htmlClipboard = gtk_clipboard_get(gdk_atom_intern_static_string("WebKitClipboardHtml")); + ASSERT(range); - gtk_clipboard_clear(textClipboard); - gtk_clipboard_clear(htmlClipboard); + m_dataObject->setText(frame->selectedText()); + m_dataObject->setMarkup(createMarkup(range, 0, AnnotateForInterchange)); - gtk_clipboard_set_text(textClipboard, frame->selectedText().utf8().data(), -1); - gtk_clipboard_set_text(htmlClipboard, createMarkup(range, 0, AnnotateForInterchange).utf8().data(), -1); + if (m_clipboard) + m_helper->writeClipboardContents(m_clipboard); } void ClipboardGtk::writePlainText(const String& text) { - GtkClipboard* textClipboard = gtk_clipboard_get(gdk_atom_intern_static_string("WebKitClipboardText")); - - gtk_clipboard_clear(textClipboard); - - gtk_clipboard_set_text(textClipboard, text.utf8().data(), -1); + m_dataObject->setText(text); + + if (m_clipboard) + m_helper->writeClipboardContents(m_clipboard); } - + bool ClipboardGtk::hasData() { - notImplemented(); - return false; + if (m_clipboard) + m_helper->getClipboardContents(m_clipboard); + + return m_dataObject->hasText() || m_dataObject->hasMarkup() + || m_dataObject->hasURIList() || m_dataObject->hasImage(); } } diff --git a/WebCore/platform/gtk/ClipboardGtk.h b/WebCore/platform/gtk/ClipboardGtk.h index 74e36b1..c3438c4 100644 --- a/WebCore/platform/gtk/ClipboardGtk.h +++ b/WebCore/platform/gtk/ClipboardGtk.h @@ -28,17 +28,26 @@ #define ClipboardGtk_h #include "Clipboard.h" +#include "DataObjectGtk.h" + +typedef struct _GtkClipboard GtkClipboard; namespace WebCore { class CachedImage; + class PasteboardHelper; // State available during IE's events for drag and drop and copy/paste // Created from the EventHandlerGtk to be used by the dom class ClipboardGtk : public Clipboard { public: - static PassRefPtr<ClipboardGtk> create(ClipboardAccessPolicy policy, bool isForDragging) + static PassRefPtr<ClipboardGtk> create(ClipboardAccessPolicy policy, GtkClipboard* clipboard, bool isForDragging) + { + return adoptRef(new ClipboardGtk(policy, clipboard)); + } + + static PassRefPtr<ClipboardGtk> create(ClipboardAccessPolicy policy, PassRefPtr<DataObjectGtk> dataObject, bool isForDragging) { - return adoptRef(new ClipboardGtk(policy, isForDragging)); + return adoptRef(new ClipboardGtk(policy, dataObject, isForDragging)); } virtual ~ClipboardGtk(); @@ -64,8 +73,16 @@ namespace WebCore { virtual bool hasData(); + PasteboardHelper* helper() { return m_helper; } + PassRefPtr<DataObjectGtk> dataObject() { return m_dataObject; } + private: - ClipboardGtk(ClipboardAccessPolicy, bool); + ClipboardGtk(ClipboardAccessPolicy, GtkClipboard*); + ClipboardGtk(ClipboardAccessPolicy, PassRefPtr<DataObjectGtk>, bool); + + RefPtr<DataObjectGtk> m_dataObject; + GtkClipboard* m_clipboard; + PasteboardHelper* m_helper; }; } diff --git a/WebCore/platform/gtk/CursorGtk.cpp b/WebCore/platform/gtk/CursorGtk.cpp index 1c669f3..705c2ae 100644 --- a/WebCore/platform/gtk/CursorGtk.cpp +++ b/WebCore/platform/gtk/CursorGtk.cpp @@ -88,13 +88,15 @@ Cursor::Cursor(GdkCursor* c) : m_impl(c) { m_impl = c; - ASSERT(c); - gdk_cursor_ref(c); + + // The GdkCursor may be NULL - the default cursor for the window. + if (c) + gdk_cursor_ref(c); } const Cursor& pointerCursor() { - static Cursor c = gdk_cursor_new(GDK_LEFT_PTR); + static Cursor c = 0; return c; } diff --git a/WebCore/platform/gtk/DataObjectGtk.cpp b/WebCore/platform/gtk/DataObjectGtk.cpp index 900fe8e..57d920c 100644 --- a/WebCore/platform/gtk/DataObjectGtk.cpp +++ b/WebCore/platform/gtk/DataObjectGtk.cpp @@ -24,6 +24,13 @@ namespace WebCore { +static void replaceNonBreakingSpaceWithSpace(String& str) +{ + static const UChar NonBreakingSpaceCharacter = 0xA0; + static const UChar SpaceCharacter = ' '; + str.replace(NonBreakingSpaceCharacter, SpaceCharacter); +} + String DataObjectGtk::text() { if (m_range) @@ -34,7 +41,7 @@ String DataObjectGtk::text() String DataObjectGtk::markup() { if (m_range) - createMarkup(m_range.get(), 0, AnnotateForInterchange); + return createMarkup(m_range.get(), 0, AnnotateForInterchange); return m_markup; } @@ -42,6 +49,7 @@ void DataObjectGtk::setText(const String& newText) { m_range = 0; m_text = newText; + replaceNonBreakingSpaceWithSpace(m_text); } void DataObjectGtk::setMarkup(const String& newMarkup) @@ -50,6 +58,18 @@ void DataObjectGtk::setMarkup(const String& newMarkup) m_markup = newMarkup; } +void DataObjectGtk::clearText() +{ + m_range = 0; + m_text = ""; +} + +void DataObjectGtk::clearMarkup() +{ + m_range = 0; + m_markup = ""; +} + Vector<String> DataObjectGtk::files() { Vector<KURL> uris(uriList()); diff --git a/WebCore/platform/gtk/DataObjectGtk.h b/WebCore/platform/gtk/DataObjectGtk.h index 22158d4..41f8f49 100644 --- a/WebCore/platform/gtk/DataObjectGtk.h +++ b/WebCore/platform/gtk/DataObjectGtk.h @@ -50,6 +50,8 @@ public: bool hasMarkup() { return m_range || !m_markup.isEmpty(); } bool hasURIList() { return !m_uriList.isEmpty(); } bool hasImage() { return m_image; } + void clearURIList() { m_uriList.clear(); } + void clearImage() { m_image = 0; } GdkDragContext* dragContext() { return m_dragContext.get(); } String text(); @@ -61,6 +63,8 @@ public: String url(); String urlLabel(); void clear(); + void clearText(); + void clearMarkup(); static DataObjectGtk* forClipboard(GtkClipboard*); diff --git a/WebCore/platform/gtk/PasteboardGtk.cpp b/WebCore/platform/gtk/PasteboardGtk.cpp index 907a55e..9e7b23a 100644 --- a/WebCore/platform/gtk/PasteboardGtk.cpp +++ b/WebCore/platform/gtk/PasteboardGtk.cpp @@ -61,7 +61,7 @@ static void clipboard_get_contents_cb(GtkClipboard *clipboard, GtkSelectionData if (info == Pasteboard::generalPasteboard()->helper()->getIdForTargetType(PasteboardHelper::TargetTypeMarkup)) gtk_selection_data_set(selection_data, selection_data->target, 8, reinterpret_cast<const guchar*>(clipboardData->markup()), - g_utf8_strlen(clipboardData->markup(), -1)); + strlen(clipboardData->markup())); else gtk_selection_data_set_text(selection_data, clipboardData->text(), -1); } diff --git a/WebCore/platform/gtk/PasteboardHelper.cpp b/WebCore/platform/gtk/PasteboardHelper.cpp index be32ea5..3dc4cc0 100644 --- a/WebCore/platform/gtk/PasteboardHelper.cpp +++ b/WebCore/platform/gtk/PasteboardHelper.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2010 Martin Robinson <mrobinson@webkit.org> + * Copyright (C) Igalia S.L. * All rights reserved. * * This library is free software; you can redistribute it and/or @@ -26,12 +27,15 @@ #include "Frame.h" #include "Page.h" #include "Pasteboard.h" +#include "TextResourceDecoder.h" #include <gtk/gtk.h> #include <wtf/gobject/GOwnPtr.h> namespace WebCore { static GdkAtom gdkMarkupAtom = gdk_atom_intern("text/html", FALSE); +static GdkAtom netscapeURLAtom = gdk_atom_intern("_NETSCAPE_URL", FALSE); +static GdkAtom uriListAtom = gdk_atom_intern("text/uri-list", FALSE); PasteboardHelper::PasteboardHelper() : m_targetList(gtk_target_list_new(0, 0)) @@ -48,6 +52,8 @@ void PasteboardHelper::initializeTargetList() { gtk_target_list_add_text_targets(m_targetList, getIdForTargetType(TargetTypeText)); gtk_target_list_add(m_targetList, gdkMarkupAtom, 0, getIdForTargetType(TargetTypeMarkup)); + gtk_target_list_add_uri_targets(m_targetList, getIdForTargetType(TargetTypeURIList)); + gtk_target_list_add(m_targetList, netscapeURLAtom, 0, getIdForTargetType(TargetTypeNetscapeURL)); } static inline GtkWidget* widgetFromFrame(Frame* frame) @@ -84,16 +90,85 @@ GtkTargetList* PasteboardHelper::targetList() const return m_targetList; } +static Vector<KURL> urisToKURLVector(gchar** uris) +{ + ASSERT(uris); + + Vector<KURL> uriList; + for (int i = 0; *(uris + i); i++) + uriList.append(KURL(KURL(), *(uris + i))); + + return uriList; +} + +void PasteboardHelper::getClipboardContents(GtkClipboard* clipboard) +{ + DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard); + ASSERT(dataObject); + + if (gtk_clipboard_wait_is_text_available(clipboard)) { + GOwnPtr<gchar> textData(gtk_clipboard_wait_for_text(clipboard)); + if (textData) + dataObject->setText(String::fromUTF8(textData.get())); + } + + if (gtk_clipboard_wait_is_target_available(clipboard, gdkMarkupAtom)) { + if (GtkSelectionData* data = gtk_clipboard_wait_for_contents(clipboard, gdkMarkupAtom)) { + RefPtr<TextResourceDecoder> decoder(TextResourceDecoder::create("text/plain", "UTF-8", true)); + String markup(decoder->decode(reinterpret_cast<char*>(data->data), data->length)); + markup += decoder->flush(); + dataObject->setMarkup(markup); + gtk_selection_data_free(data); + } + } + + if (gtk_clipboard_wait_is_target_available(clipboard, uriListAtom)) { + if (GtkSelectionData* data = gtk_clipboard_wait_for_contents(clipboard, uriListAtom)) { + gchar** uris = gtk_selection_data_get_uris(data); + if (uris) { + dataObject->setURIList(urisToKURLVector(uris)); + g_strfreev(uris); + } + gtk_selection_data_free(data); + } + } +} + void PasteboardHelper::fillSelectionData(GtkSelectionData* selectionData, guint info, DataObjectGtk* dataObject) { if (info == getIdForTargetType(TargetTypeText)) gtk_selection_data_set_text(selectionData, dataObject->text().utf8().data(), -1); + else if (info == getIdForTargetType(TargetTypeMarkup)) { GOwnPtr<gchar> markup(g_strdup(dataObject->markup().utf8().data())); gtk_selection_data_set(selectionData, selectionData->target, 8, - reinterpret_cast<const guchar*>(markup.get()), - strlen(markup.get())); - } + reinterpret_cast<const guchar*>(markup.get()), strlen(markup.get())); + + } else if (info == getIdForTargetType(TargetTypeURIList)) { + Vector<KURL> uriList(dataObject->uriList()); + gchar** uris = g_new0(gchar*, uriList.size() + 1); + for (size_t i = 0; i < uriList.size(); i++) + uris[i] = g_strdup(uriList[i].string().utf8().data()); + + gtk_selection_data_set_uris(selectionData, uris); + g_strfreev(uris); + + } else if (info == getIdForTargetType(TargetTypeNetscapeURL) && dataObject->hasURL()) { + String url(dataObject->url()); + String result(url); + result.append("\n"); + + if (dataObject->hasText()) + result.append(dataObject->text()); + else + result.append(url); + + GOwnPtr<gchar> resultData(g_strdup(result.utf8().data())); + gtk_selection_data_set(selectionData, selectionData->target, 8, + reinterpret_cast<const guchar*>(resultData.get()), strlen(resultData.get())); + + } else if (info == getIdForTargetType(TargetTypeImage)) + gtk_selection_data_set_pixbuf(selectionData, dataObject->image()); } GtkTargetList* PasteboardHelper::targetListForDataObject(DataObjectGtk* dataObject) @@ -106,6 +181,14 @@ GtkTargetList* PasteboardHelper::targetListForDataObject(DataObjectGtk* dataObje if (dataObject->hasMarkup()) gtk_target_list_add(list, gdkMarkupAtom, 0, getIdForTargetType(TargetTypeMarkup)); + if (dataObject->hasURIList()) { + gtk_target_list_add_uri_targets(list, getIdForTargetType(TargetTypeURIList)); + gtk_target_list_add(list, netscapeURLAtom, 0, getIdForTargetType(TargetTypeNetscapeURL)); + } + + if (dataObject->hasImage()) + gtk_target_list_add_image_targets(list, getIdForTargetType(TargetTypeImage), TRUE); + return list; } diff --git a/WebCore/platform/gtk/PasteboardHelper.h b/WebCore/platform/gtk/PasteboardHelper.h index 6e5d366..2d46adc 100644 --- a/WebCore/platform/gtk/PasteboardHelper.h +++ b/WebCore/platform/gtk/PasteboardHelper.h @@ -2,6 +2,7 @@ * Copyright (C) 2007 Luca Bruno <lethalman88@gmail.com> * Copyright (C) 2009 Holger Hans Peter Freyther * Copyright (C) 2010 Martin Robinson <mrobinson@webkit.org> + * Copyright (C) 2010 Igalia S.L. * All rights reserved. * * This library is free software; you can redistribute it and/or @@ -49,8 +50,10 @@ public: GtkClipboard* getClipboard(Frame*) const; GtkClipboard* getPrimarySelectionClipboard(Frame*) const; GtkTargetList* targetList() const; + GtkTargetList* targetListForDataObject(DataObjectGtk*); void fillSelectionData(GtkSelectionData*, guint, DataObjectGtk*); - void writeClipboardContents(GtkClipboard*, GClosure*); + void writeClipboardContents(GtkClipboard*, GClosure* closure = 0); + void getClipboardContents(GtkClipboard*); enum PasteboardTargetType { TargetTypeText, TargetTypeMarkup, TargetTypeURIList, TargetTypeNetscapeURL, TargetTypeImage, TargetTypeUnknown }; virtual guint getIdForTargetType(PasteboardTargetType) = 0; @@ -61,7 +64,6 @@ protected: private: GtkTargetList* m_targetList; - GtkTargetList* targetListForDataObject(DataObjectGtk*); }; } diff --git a/WebCore/platform/gtk/RenderThemeGtk.cpp b/WebCore/platform/gtk/RenderThemeGtk.cpp index 93794ff..31af1a9 100644 --- a/WebCore/platform/gtk/RenderThemeGtk.cpp +++ b/WebCore/platform/gtk/RenderThemeGtk.cpp @@ -92,8 +92,11 @@ void RenderThemeGtk::initMediaStyling(GtkStyle* style, bool force) m_seekForwardButton.clear(); m_fullscreenButton = Image::loadPlatformThemeIcon("gtk-fullscreen", m_mediaIconSize); - m_muteButton = Image::loadPlatformThemeIcon("audio-volume-muted", m_mediaIconSize); - m_unmuteButton = Image::loadPlatformThemeIcon("audio-volume-high", m_mediaIconSize); + // Note that the muteButton and unmuteButton take icons reflecting + // the *current* state. Hence, the unmuteButton represents the *muted* + // status, the muteButton represents the then current *unmuted* status. + m_muteButton = Image::loadPlatformThemeIcon("audio-volume-high", m_mediaIconSize); + m_unmuteButton = Image::loadPlatformThemeIcon("audio-volume-muted", m_mediaIconSize); m_playButton = Image::loadPlatformThemeIcon(reinterpret_cast<const char*>(playButtonIconName), m_mediaIconSize); m_pauseButton = Image::loadPlatformThemeIcon("gtk-media-pause", m_mediaIconSize).releaseRef(); m_seekBackButton = Image::loadPlatformThemeIcon(reinterpret_cast<const char*>(seekBackButtonIconName), m_mediaIconSize); diff --git a/WebCore/platform/gtk/ScrollViewGtk.cpp b/WebCore/platform/gtk/ScrollViewGtk.cpp index 3df3cb5..5c258ad 100644 --- a/WebCore/platform/gtk/ScrollViewGtk.cpp +++ b/WebCore/platform/gtk/ScrollViewGtk.cpp @@ -72,6 +72,29 @@ PassRefPtr<Scrollbar> ScrollView::createScrollbar(ScrollbarOrientation orientati return Scrollbar::createNativeScrollbar(this, orientation, RegularScrollbar); } +#if !GTK_CHECK_VERSION(2, 14, 0) +#define gtk_adjustment_configure AdjustmentConfigure + +static void AdjustmentConfigure(GtkAdjustment* adjustment, gdouble value, gdouble lower, gdouble upper, + gdouble stepIncrement, gdouble pageIncrement, gdouble pageSize) +{ + g_object_freeze_notify(G_OBJECT(adjustment)); + + g_object_set(adjustment, + "lower", lower, + "upper", upper, + "step-increment", stepIncrement, + "page-increment", pageIncrement, + "page-size", pageSize, + NULL); + + g_object_thaw_notify(G_OBJECT(adjustment)); + + gtk_adjustment_changed(adjustment); + gtk_adjustment_value_changed(adjustment); +} +#endif + /* * The following is assumed: * (hadj && vadj) || (!hadj && !vadj) @@ -100,17 +123,22 @@ void ScrollView::setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj, boo // set in the normal case), we make sure they are up-to-date // here. This is needed for the parent scrolling widget to be // able to report correct values. - m_horizontalAdjustment->lower = 0; - m_horizontalAdjustment->upper = resetValues ? 0 : frameRect().width(); - m_horizontalAdjustment->value = resetValues ? 0 : scrollOffset().width(); - gtk_adjustment_changed(m_horizontalAdjustment); - gtk_adjustment_value_changed(m_horizontalAdjustment); - - m_verticalAdjustment->lower = 0; - m_verticalAdjustment->upper = resetValues ? 0 : frameRect().height(); - m_verticalAdjustment->value = resetValues ? 0 : scrollOffset().height(); - gtk_adjustment_changed(m_verticalAdjustment); - gtk_adjustment_value_changed(m_verticalAdjustment); + + int horizontalPageStep = max(max<int>(frameRect().width() * Scrollbar::minFractionToStepWhenPaging(), frameRect().width() - Scrollbar::maxOverlapBetweenPages()), 1); + gtk_adjustment_configure(m_horizontalAdjustment, + resetValues ? 0 : scrollOffset().width(), 0, + resetValues ? 0 : contentsSize().width(), + resetValues ? 0 : Scrollbar::pixelsPerLineStep(), + resetValues ? 0 : horizontalPageStep, + resetValues ? 0 : frameRect().width()); + + int verticalPageStep = max(max<int>(frameRect().height() * Scrollbar::minFractionToStepWhenPaging(), frameRect().height() - Scrollbar::maxOverlapBetweenPages()), 1); + gtk_adjustment_configure(m_verticalAdjustment, + resetValues ? 0 : scrollOffset().height(), 0, + resetValues ? 0 : contentsSize().height(), + resetValues ? 0 : Scrollbar::pixelsPerLineStep(), + resetValues ? 0 : verticalPageStep, + resetValues ? 0 : frameRect().height()); } else { ScrollbarGtk* hScrollbar = reinterpret_cast<ScrollbarGtk*>(horizontalScrollbar()); if (hScrollbar) diff --git a/WebCore/platform/gtk/WidgetGtk.cpp b/WebCore/platform/gtk/WidgetGtk.cpp index 834c21a..71addfd 100644 --- a/WebCore/platform/gtk/WidgetGtk.cpp +++ b/WebCore/platform/gtk/WidgetGtk.cpp @@ -53,9 +53,10 @@ Widget::~Widget() releasePlatformWidget(); } -void Widget::setFocus() +void Widget::setFocus(bool focused) { - gtk_widget_grab_focus(platformWidget() ? platformWidget() : GTK_WIDGET(root()->hostWindow()->platformPageClient())); + if (focused) + gtk_widget_grab_focus(platformWidget() ? platformWidget() : GTK_WIDGET(root()->hostWindow()->platformPageClient())); } static GdkDrawable* gdkDrawable(PlatformWidget widget) diff --git a/WebCore/platform/haiku/WidgetHaiku.cpp b/WebCore/platform/haiku/WidgetHaiku.cpp index 5ff504f..3663d67 100644 --- a/WebCore/platform/haiku/WidgetHaiku.cpp +++ b/WebCore/platform/haiku/WidgetHaiku.cpp @@ -80,11 +80,13 @@ void Widget::setFrameRect(const IntRect& rect) m_frame = rect; } -void Widget::setFocus() +void Widget::setFocus(bool focused) { - AutoPlatformWidgetLocker locker(topLevelPlatformWidget()); - if (locker.isLocked()) - topLevelPlatformWidget()->MakeFocus(); + if (focused) { + AutoPlatformWidgetLocker locker(topLevelPlatformWidget()); + if (locker.isLocked()) + topLevelPlatformWidget()->MakeFocus(); + } } void Widget::setCursor(const Cursor& cursor) diff --git a/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp b/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp index 5965ae4..147085f 100644 --- a/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp +++ b/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp @@ -235,13 +235,13 @@ bool GIFImageDecoder::haveDecodedRow(unsigned frameIndex, unsigned char* rowBuff return true; } -void GIFImageDecoder::frameComplete(unsigned frameIndex, unsigned frameDuration, RGBA32Buffer::FrameDisposalMethod disposalMethod) +bool GIFImageDecoder::frameComplete(unsigned frameIndex, unsigned frameDuration, RGBA32Buffer::FrameDisposalMethod disposalMethod) { // Initialize the frame if necessary. Some GIFs insert do-nothing frames, // in which case we never reach haveDecodedRow() before getting here. RGBA32Buffer& buffer = m_frameBufferCache[frameIndex]; if ((buffer.status() == RGBA32Buffer::FrameEmpty) && !initFrameBuffer(frameIndex)) - return; + return false; // initFrameBuffer() has already called setFailed(). buffer.setStatus(RGBA32Buffer::FrameComplete); buffer.setDuration(frameDuration); @@ -277,6 +277,8 @@ void GIFImageDecoder::frameComplete(unsigned frameIndex, unsigned frameDuration, buffer.setHasAlpha(false); } } + + return true; } void GIFImageDecoder::gifComplete() @@ -294,7 +296,9 @@ void GIFImageDecoder::decode(unsigned haltAtFrame, GIFQuery query) if (!m_reader) m_reader.set(new GIFImageReader(this)); - if (!m_reader->read((const unsigned char*)m_data->data() + m_readOffset, m_data->size() - m_readOffset, query, haltAtFrame)) + // If we couldn't decode the image but we've received all the data, decoding + // has failed. + if (!m_reader->read((const unsigned char*)m_data->data() + m_readOffset, m_data->size() - m_readOffset, query, haltAtFrame) && isAllDataReceived()) setFailed(); if (failed()) diff --git a/WebCore/platform/image-decoders/gif/GIFImageDecoder.h b/WebCore/platform/image-decoders/gif/GIFImageDecoder.h index 28a9a59..1c3378c 100644 --- a/WebCore/platform/image-decoders/gif/GIFImageDecoder.h +++ b/WebCore/platform/image-decoders/gif/GIFImageDecoder.h @@ -54,13 +54,14 @@ namespace WebCore { // Callbacks from the GIF reader. void decodingHalted(unsigned bytesLeft); bool haveDecodedRow(unsigned frameIndex, unsigned char* rowBuffer, unsigned char* rowEnd, unsigned rowNumber, unsigned repeatCount, bool writeTransparentPixels); - void frameComplete(unsigned frameIndex, unsigned frameDuration, RGBA32Buffer::FrameDisposalMethod disposalMethod); + bool frameComplete(unsigned frameIndex, unsigned frameDuration, RGBA32Buffer::FrameDisposalMethod disposalMethod); void gifComplete(); private: // If the query is GIFFullQuery, decodes the image up to (but not // including) |haltAtFrame|. Otherwise, decodes as much as is needed to - // answer the query, ignoring bitmap data. + // answer the query, ignoring bitmap data. If decoding fails but there + // is no more data coming, sets the "decode failure" flag. void decode(unsigned haltAtFrame, GIFQuery); // Called to initialize the frame buffer with the given index, based on diff --git a/WebCore/platform/image-decoders/gif/GIFImageReader.cpp b/WebCore/platform/image-decoders/gif/GIFImageReader.cpp index 677853e..be77426 100644 --- a/WebCore/platform/image-decoders/gif/GIFImageReader.cpp +++ b/WebCore/platform/image-decoders/gif/GIFImageReader.cpp @@ -290,7 +290,9 @@ bool GIFImageReader::do_lzw(const unsigned char *q) /* Check for explicit end-of-stream code */ if (code == (clear_code + 1)) { /* end-of-stream should only appear after all image data */ - return !rows_remaining; + if (!rows_remaining) + return true; + return clientptr ? clientptr->setFailed() : false; } if (oldcode == -1) { @@ -308,13 +310,13 @@ bool GIFImageReader::do_lzw(const unsigned char *q) code = oldcode; if (stackp == stack + MAX_BITS) - return false; + return clientptr ? clientptr->setFailed() : false; } while (code >= clear_code) { if (code >= MAX_BITS || code == prefix[code]) - return false; + return clientptr ? clientptr->setFailed() : false; // Even though suffix[] only holds characters through suffix[avail - 1], // allowing code >= avail here lets us be more tolerant of malformed @@ -324,7 +326,7 @@ bool GIFImageReader::do_lzw(const unsigned char *q) code = prefix[code]; if (stackp == stack + MAX_BITS) - return false; + return clientptr ? clientptr->setFailed() : false; } *stackp++ = firstchar = suffix[code]; @@ -415,7 +417,7 @@ bool GIFImageReader::read(const unsigned char *buf, unsigned len, bytes_to_consume -= l; if (clientptr) clientptr->decodingHalted(0); - return true; + return false; } // Reset hold buffer count bytes_in_hold = 0; @@ -440,10 +442,9 @@ bool GIFImageReader::read(const unsigned char *buf, unsigned len, switch (state) { case gif_lzw: - if (!do_lzw(q)) { - state = gif_error; - break; - } + if (!do_lzw(q)) + return false; // If do_lzw() encountered an error, it has already called + // clientptr->setFailed(). GETN(1, gif_sub_block); break; @@ -454,15 +455,11 @@ bool GIFImageReader::read(const unsigned char *buf, unsigned len, // Since we use a codesize of 1 more than the datasize, we need to ensure // that our datasize is strictly less than the MAX_LZW_BITS value (12). // This sets the largest possible codemask correctly at 4095. - if (datasize >= MAX_LZW_BITS) { - state = gif_error; - break; - } + if (datasize >= MAX_LZW_BITS) + return clientptr ? clientptr->setFailed() : false; int clear_code = 1 << datasize; - if (clear_code >= MAX_BITS) { - state = gif_error; - break; - } + if (clear_code >= MAX_BITS) + return clientptr ? clientptr->setFailed() : false; if (frame_reader) { frame_reader->datasize = datasize; @@ -498,10 +495,8 @@ bool GIFImageReader::read(const unsigned char *buf, unsigned len, version = 89; else if (!strncmp((char*)q, "GIF87a", 6)) version = 87; - else { - state = gif_error; - break; - } + else + return clientptr ? clientptr->setFailed() : false; GETN(7, gif_global_header); } break; @@ -586,7 +581,7 @@ bool GIFImageReader::read(const unsigned char *buf, unsigned len, state = gif_done; } else { /* No images decoded, there is nothing to display. */ - state = gif_error; + return clientptr ? clientptr->setFailed() : false; } break; } else @@ -714,7 +709,7 @@ bool GIFImageReader::read(const unsigned char *buf, unsigned len, GETN(1, gif_netscape_extension_block); } else { // 0,3-7 are yet to be defined netscape extension codes - state = gif_error; + return clientptr ? clientptr->setFailed() : false; } break; @@ -755,10 +750,8 @@ bool GIFImageReader::read(const unsigned char *buf, unsigned len, if (!height || !width) { height = screen_height; width = screen_width; - if (!height || !width) { - state = gif_error; - break; - } + if (!height || !width) + return clientptr ? clientptr->setFailed() : false; } if (query == GIFImageDecoder::GIFSizeQuery || haltAtFrame == images_decoded) { @@ -794,10 +787,8 @@ bool GIFImageReader::read(const unsigned char *buf, unsigned len, frame_reader->rowbuf = new unsigned char[screen_width]; } - if (!frame_reader->rowbuf) { - state = gif_oom; - break; - } + if (!frame_reader->rowbuf) + return clientptr ? clientptr->setFailed() : false; if (screen_height < height) screen_height = height; @@ -838,10 +829,8 @@ bool GIFImageReader::read(const unsigned char *buf, unsigned len, if (frame_reader && (!map || (num_colors > frame_reader->local_colormap_size))) { delete []map; map = new unsigned char[size]; - if (!map) { - state = gif_oom; - break; - } + if (!map) + return clientptr ? clientptr->setFailed() : false; } /* Switch to the new local palette after it loads */ @@ -893,8 +882,9 @@ bool GIFImageReader::read(const unsigned char *buf, unsigned len, images_decoded++; // CALLBACK: The frame is now complete. - if (clientptr && frame_reader) - clientptr->frameComplete(images_decoded - 1, frame_reader->delay_time, frame_reader->disposal_method); + if (clientptr && frame_reader && !clientptr->frameComplete(images_decoded - 1, frame_reader->delay_time, frame_reader->disposal_method)) + return false; // frameComplete() has already called + // clientptr->setFailed(). /* Clear state from this image */ if (frame_reader) { @@ -913,14 +903,6 @@ bool GIFImageReader::read(const unsigned char *buf, unsigned len, clientptr->gifComplete(); return true; - // Handle out of memory errors - case gif_oom: - return false; - - // Handle general errors - case gif_error: - return false; - // We shouldn't ever get here. default: break; @@ -945,5 +927,5 @@ bool GIFImageReader::read(const unsigned char *buf, unsigned len, if (clientptr) clientptr->decodingHalted(0); - return true; + return false; } diff --git a/WebCore/platform/image-decoders/gif/GIFImageReader.h b/WebCore/platform/image-decoders/gif/GIFImageReader.h index 5982827..be5be19 100644 --- a/WebCore/platform/image-decoders/gif/GIFImageReader.h +++ b/WebCore/platform/image-decoders/gif/GIFImageReader.h @@ -69,8 +69,6 @@ typedef enum { gif_consume_block, gif_skip_block, gif_done, - gif_oom, - gif_error, gif_comment_extension, gif_application_extension, gif_netscape_extension_block, diff --git a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp index 3d9fb8e..8375693 100644 --- a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp +++ b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp @@ -69,7 +69,6 @@ enum jstate { JPEG_DECOMPRESS_PROGRESSIVE, // Output progressive pixels JPEG_DECOMPRESS_SEQUENTIAL, // Output sequential pixels JPEG_DONE, - JPEG_SINK_NON_JPEG_TRAILER, // Some image files have a non-JPEG trailer JPEG_ERROR }; @@ -169,16 +168,15 @@ public: // We need to do the setjmp here. Otherwise bad things will happen if (setjmp(m_err.setjmp_buffer)) { - m_state = JPEG_SINK_NON_JPEG_TRAILER; close(); - return false; + return m_decoder->setFailed(); } switch (m_state) { case JPEG_HEADER: // Read file parameters with jpeg_read_header(). if (jpeg_read_header(&m_info, true) == JPEG_SUSPENDED) - return true; // I/O suspension. + return false; // I/O suspension. // Let libjpeg take care of gray->RGB and YCbCr->RGB conversions. switch (m_info.jpeg_color_space) { @@ -194,7 +192,7 @@ public: m_info.out_color_space = JCS_CMYK; break; default: - return false; + return m_decoder->setFailed(); } // Don't allocate a giant and superfluous memory buffer when the @@ -214,7 +212,7 @@ public: // We can fill in the size now that the header is available. if (!m_decoder->setSize(m_info.image_width, m_info.image_height)) - return false; + return m_decoder->setFailed(); if (m_decodingSizeOnly) { // We can stop here. Reduce our buffer length and available @@ -237,7 +235,7 @@ public: // Start decompressor. if (!jpeg_start_decompress(&m_info)) - return true; // I/O suspension. + return false; // I/O suspension. // If this is a progressive JPEG ... m_state = (m_info.buffered_image) ? JPEG_DECOMPRESS_PROGRESSIVE : JPEG_DECOMPRESS_SEQUENTIAL; @@ -247,7 +245,7 @@ public: if (m_state == JPEG_DECOMPRESS_SEQUENTIAL) { if (!m_decoder->outputScanlines()) - return true; // I/O suspension. + return false; // I/O suspension. // If we've completed image output... ASSERT(m_info.output_scanline == m_info.output_height); @@ -273,7 +271,7 @@ public: --scan; if (!jpeg_start_output(&m_info, scan)) - return true; // I/O suspension. + return false; // I/O suspension. } if (m_info.output_scanline == 0xffffff) @@ -285,12 +283,12 @@ public: // don't call jpeg_start_output() multiple times for // the same scan. m_info.output_scanline = 0xffffff; - return true; // I/O suspension. + return false; // I/O suspension. } if (m_info.output_scanline == m_info.output_height) { if (!jpeg_finish_output(&m_info)) - return true; // I/O suspension. + return false; // I/O suspension. if (jpeg_input_complete(&m_info) && (m_info.input_scan_number == m_info.output_scan_number)) break; @@ -305,15 +303,8 @@ public: case JPEG_DONE: // Finish decompression. - if (!jpeg_finish_decompress(&m_info)) - return true; // I/O suspension. - - m_state = JPEG_SINK_NON_JPEG_TRAILER; - break; + return jpeg_finish_decompress(&m_info); - case JPEG_SINK_NON_JPEG_TRAILER: - break; - case JPEG_ERROR: // We can get here if the constructor failed. return m_decoder->setFailed(); @@ -487,7 +478,9 @@ void JPEGImageDecoder::decode(bool onlySize) if (!m_reader) m_reader.set(new JPEGImageReader(this)); - if (!m_reader->decode(m_data->buffer(), onlySize)) + // If we couldn't decode the image but we've received all the data, decoding + // has failed. + if (!m_reader->decode(m_data->buffer(), onlySize) && isAllDataReceived()) setFailed(); if (failed() || (!m_frameBufferCache.isEmpty() && m_frameBufferCache[0].status() == RGBA32Buffer::FrameComplete)) diff --git a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h index 45e14bc..79bad47 100644 --- a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h +++ b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h @@ -52,7 +52,8 @@ namespace WebCore { private: // Decodes the image. If |onlySize| is true, stops decoding after - // calculating the image size. + // calculating the image size. If decoding fails but there is no more + // data coming, sets the "decode failure" flag. void decode(bool onlySize); OwnPtr<JPEGImageReader> m_reader; diff --git a/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp b/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp index de01d55..1dcf6c7 100644 --- a/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp +++ b/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp @@ -119,7 +119,7 @@ public: unsigned currentBufferSize() const { return m_currentBufferSize; } - void decode(const SharedBuffer& data, bool sizeOnly) + bool decode(const SharedBuffer& data, bool sizeOnly) { m_decodingSizeOnly = sizeOnly; PNGImageDecoder* decoder = static_cast<PNGImageDecoder*>(png_get_progressive_ptr(m_png)); @@ -127,8 +127,7 @@ public: // We need to do the setjmp here. Otherwise bad things will happen. if (setjmp(m_png->jmpbuf)) { close(); - decoder->setFailed(); - return; + return decoder->setFailed(); } const char* segment; @@ -140,10 +139,9 @@ public: // merely want to check if we've managed to set the size, not // (recursively) trigger additional decoding if we haven't. if (sizeOnly ? decoder->ImageDecoder::isSizeAvailable() : decoder->isComplete()) - return; + return true; } - if (!decoder->isComplete() && decoder->isAllDataReceived()) - decoder->pngComplete(); + return false; } bool decodingSizeOnly() const { return m_decodingSizeOnly; } @@ -371,7 +369,10 @@ void PNGImageDecoder::decode(bool onlySize) if (!m_reader) m_reader.set(new PNGImageReader(this)); - m_reader->decode(*m_data, onlySize); + // If we couldn't decode the image but we've received all the data, decoding + // has failed. + if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived()) + setFailed(); if (failed() || isComplete()) m_reader.clear(); diff --git a/WebCore/platform/image-decoders/png/PNGImageDecoder.h b/WebCore/platform/image-decoders/png/PNGImageDecoder.h index 3f0602c..287a794 100644 --- a/WebCore/platform/image-decoders/png/PNGImageDecoder.h +++ b/WebCore/platform/image-decoders/png/PNGImageDecoder.h @@ -57,7 +57,8 @@ namespace WebCore { private: // Decodes the image. If |onlySize| is true, stops decoding after - // calculating the image size. + // calculating the image size. If decoding fails but there is no more + // data coming, sets the "decode failure" flag. void decode(bool onlySize); OwnPtr<PNGImageReader> m_reader; diff --git a/WebCore/platform/image-encoders/skia/PNGImageEncoder.cpp b/WebCore/platform/image-encoders/skia/PNGImageEncoder.cpp index aa20c62..19363c8 100644 --- a/WebCore/platform/image-encoders/skia/PNGImageEncoder.cpp +++ b/WebCore/platform/image-encoders/skia/PNGImageEncoder.cpp @@ -129,10 +129,7 @@ bool PNGImageEncoder::encode(const unsigned char* input, const IntSize& size, return false; } - png_struct* pngPtr = png_create_write_struct(PNG_LIBPNG_VER_STRING, - png_voidp_NULL, - png_error_ptr_NULL, - png_error_ptr_NULL); + png_struct* pngPtr = png_create_write_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0); if (!pngPtr) return false; diff --git a/WebCore/platform/mac/KeyEventMac.mm b/WebCore/platform/mac/KeyEventMac.mm index b8bf500..7b8b2ce 100644 --- a/WebCore/platform/mac/KeyEventMac.mm +++ b/WebCore/platform/mac/KeyEventMac.mm @@ -169,7 +169,14 @@ static int windowsKeyCodeForKeyEvent(NSEvent *event) // 3. Certain punctuation keys. On Windows, these are also remapped depending on current keyboard layout, // but see comment in windowsKeyCodeForCharCode(). if ([event type] == NSKeyDown || [event type] == NSKeyUp) { - NSString* s = [event characters]; // Cannot use charactersIgnoringModifiers, because Cmd switches Roman letters for Dvorak-QWERTY layout. + // Cmd switches Roman letters for Dvorak-QWERTY layout, so try modified characters first. + NSString* s = [event characters]; + code = [s length] > 0 ? windowsKeyCodeForCharCode([s characterAtIndex:0]) : 0; + if (code) + return code; + + // Ctrl+A on an AZERTY keyboard would get VK_Q keyCode if we relied on -[NSEvent keyCode] below. + s = [event charactersIgnoringModifiers]; code = [s length] > 0 ? windowsKeyCodeForCharCode([s characterAtIndex:0]) : 0; if (code) return code; diff --git a/WebCore/platform/mac/PopupMenuMac.mm b/WebCore/platform/mac/PopupMenuMac.mm index 0ecaa13..6c067b9 100644 --- a/WebCore/platform/mac/PopupMenuMac.mm +++ b/WebCore/platform/mac/PopupMenuMac.mm @@ -114,8 +114,6 @@ void PopupMenu::populate() [[m_popup.get() menu] setMenuChangedMessagesEnabled:messagesEnabled]; } -#if !ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE) - void PopupMenu::show(const IntRect& r, FrameView* v, int index) { populate(); @@ -196,14 +194,6 @@ void PopupMenu::show(const IntRect& r, FrameView* v, int index) [event release]; } -#else - -void PopupMenu::show(const IntRect&, FrameView*, int) -{ -} - -#endif - void PopupMenu::hide() { [m_popup.get() dismissPopUp]; diff --git a/WebCore/platform/mac/SharedBufferMac.mm b/WebCore/platform/mac/SharedBufferMac.mm index c4e7528..3f5e5d4 100644 --- a/WebCore/platform/mac/SharedBufferMac.mm +++ b/WebCore/platform/mac/SharedBufferMac.mm @@ -50,6 +50,7 @@ using namespace WebCore; + (void)initialize { JSC::initializeThreading(); + WTF::initializeMainThreadToProcessMainThread(); #ifndef BUILDING_ON_TIGER WebCoreObjCFinalizeOnMainThread(self); #endif diff --git a/WebCore/platform/mac/ThemeMac.mm b/WebCore/platform/mac/ThemeMac.mm index bbc6d6b..7cc913f 100644 --- a/WebCore/platform/mac/ThemeMac.mm +++ b/WebCore/platform/mac/ThemeMac.mm @@ -46,6 +46,11 @@ using namespace std; return YES; } +- (NSText *)currentEditor +{ + return nil; +} + @end // FIXME: Default buttons really should be more like push buttons and not like buttons. @@ -77,9 +82,9 @@ static NSControlSize controlSizeForFont(const Font& font) return NSMiniControlSize; } -static LengthSize sizeFromFont(const Font& font, const LengthSize& zoomedSize, float zoomFactor, const IntSize* sizes) +static LengthSize sizeFromNSControlSize(NSControlSize nsControlSize, const LengthSize& zoomedSize, float zoomFactor, const IntSize* sizes) { - IntSize controlSize = sizes[controlSizeForFont(font)]; + IntSize controlSize = sizes[nsControlSize]; if (zoomFactor != 1.0f) controlSize = IntSize(controlSize.width() * zoomFactor, controlSize.height() * zoomFactor); LengthSize result = zoomedSize; @@ -90,6 +95,11 @@ static LengthSize sizeFromFont(const Font& font, const LengthSize& zoomedSize, f return result; } +static LengthSize sizeFromFont(const Font& font, const LengthSize& zoomedSize, float zoomFactor, const IntSize* sizes) +{ + return sizeFromNSControlSize(controlSizeForFont(font), zoomedSize, zoomFactor, sizes); +} + static void setControlSize(NSCell* cell, const IntSize* sizes, const IntSize& minZoomedSize, float zoomFactor) { NSControlSize size; @@ -439,6 +449,65 @@ static void paintButton(ControlPart part, ControlStates states, GraphicsContext* END_BLOCK_OBJC_EXCEPTIONS } +// Stepper + +static const IntSize* stepperSizes() +{ + static const IntSize sizes[3] = { IntSize(19, 27), IntSize(15, 22), IntSize(13, 15) }; + return sizes; +} + +// We don't use controlSizeForFont() for steppers because the stepper height +// should be equal to or less than the corresponding text field height, +static NSControlSize stepperControlSizeForFont(const Font& font) +{ + int fontSize = font.pixelSize(); + if (fontSize >= 18) + return NSRegularControlSize; + if (fontSize >= 13) + return NSSmallControlSize; + return NSMiniControlSize; +} + +static NSStepperCell* stepper(ControlStates states, const IntRect& zoomedRect, float zoomFactor) +{ + static NSStepperCell* cell = [[NSStepperCell alloc] init]; + setControlSize(cell, stepperSizes(), zoomedRect.size(), zoomFactor); + + updateStates(cell, states); + if (states & PressedState && states & SpinUpState) { + // FIXME: There is no way to draw a NSSteperCell with the up button hilighted. + // Disables the hilight of the down button if the up button is pressed. + [cell setHighlighted:NO]; + } + return cell; +} + +static void paintStepper(ControlStates states, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView* scrollView) +{ + NSStepperCell* cell = stepper(states, zoomedRect, zoomFactor); + + context->save(); + NSControlSize controlSize = [cell controlSize]; + IntSize zoomedSize = stepperSizes()[controlSize]; + IntRect rect(zoomedRect); + + if (zoomFactor != 1.0f) { + rect.setWidth(rect.width() / zoomFactor); + rect.setHeight(rect.height() / zoomFactor); + context->translate(rect.x(), rect.y()); + context->scale(FloatSize(zoomFactor, zoomFactor)); + context->translate(-rect.x(), -rect.y()); + } + + BEGIN_BLOCK_OBJC_EXCEPTIONS + [cell drawWithFrame:NSRect(rect) inView:ThemeMac::ensuredView(scrollView)]; + [cell setControlView:nil]; + END_BLOCK_OBJC_EXCEPTIONS + + context->restore(); +} + // This will ensure that we always return a valid NSView, even if ScrollView doesn't have an associated document NSView. // If the ScrollView doesn't have an NSView, we will return a fake NSView whose sole purpose is to tell AppKit that it's flipped. NSView *ThemeMac::ensuredView(ScrollView* scrollView) @@ -494,6 +563,13 @@ LengthSize ThemeMac::controlSize(ControlPart part, const Font& font, const Lengt case ListButtonPart: return sizeFromFont(font, LengthSize(zoomedSize.width(), Length()), zoomFactor, listButtonSizes()); #endif + case InnerSpinButtonPart: + // We don't use inner spin buttons on Mac. + return LengthSize(Length(Fixed), Length(Fixed)); + case OuterSpinButtonPart: + if (!zoomedSize.width().isIntrinsicOrAuto() && !zoomedSize.height().isIntrinsicOrAuto()) + return zoomedSize; + return sizeFromNSControlSize(stepperControlSizeForFont(font), zoomedSize, zoomFactor, stepperSizes()); default: return zoomedSize; } @@ -507,6 +583,14 @@ LengthSize ThemeMac::minimumControlSize(ControlPart part, const Font& font, floa case ButtonPart: case ListButtonPart: return LengthSize(Length(0, Fixed), Length(static_cast<int>(15 * zoomFactor), Fixed)); + case InnerSpinButtonPart: + // We don't use inner spin buttons on Mac. + return LengthSize(Length(Fixed), Length(Fixed)); + case OuterSpinButtonPart: { + IntSize base = stepperSizes()[NSMiniControlSize]; + return LengthSize(Length(static_cast<int>(base.width() * zoomFactor), Fixed), + Length(static_cast<int>(base.height() * zoomFactor), Fixed)); + } default: return Theme::minimumControlSize(part, font, zoomFactor); } @@ -583,6 +667,16 @@ void ThemeMac::inflateControlPaintRect(ControlPart part, ControlStates states, I } break; } + case OuterSpinButtonPart: { + static const int stepperMargin[4] = { 0, 0, 0, 0}; + NSCell *cell = stepper(states, zoomedRect, zoomFactor); + NSControlSize controlSize = [cell controlSize]; + IntSize zoomedSize = stepperSizes()[controlSize]; + zoomedSize.setHeight(zoomedSize.height() * zoomFactor); + zoomedSize.setWidth(zoomedSize.width() * zoomFactor); + zoomedRect = inflateRect(zoomedRect, zoomedSize, stepperMargin, zoomFactor); + break; + } default: break; } @@ -605,6 +699,9 @@ void ThemeMac::paint(ControlPart part, ControlStates states, GraphicsContext* co case ListButtonPart: paintButton(part, states, context, zoomedRect, zoomFactor, scrollView); break; + case OuterSpinButtonPart: + paintStepper(states, context, zoomedRect, zoomFactor, scrollView); + break; default: break; } diff --git a/WebCore/platform/mac/WebCoreObjCExtras.mm b/WebCore/platform/mac/WebCoreObjCExtras.mm index 4fc757c..05d3e01 100644 --- a/WebCore/platform/mac/WebCoreObjCExtras.mm +++ b/WebCore/platform/mac/WebCoreObjCExtras.mm @@ -71,14 +71,9 @@ static void deallocCallback(void* context) bool WebCoreObjCScheduleDeallocateOnMainThread(Class cls, id object) { ASSERT([object isKindOfClass:cls]); - -#if USE(WEB_THREAD) + if (isMainThread()) return false; -#else - if (pthread_main_np() != 0) - return false; -#endif ClassAndIdPair* pair = new ClassAndIdPair(cls, object); callOnMainThread(deallocCallback, pair); diff --git a/WebCore/platform/mac/WidgetMac.mm b/WebCore/platform/mac/WidgetMac.mm index 1aad76f..37c9e9f 100644 --- a/WebCore/platform/mac/WidgetMac.mm +++ b/WebCore/platform/mac/WidgetMac.mm @@ -105,8 +105,11 @@ Widget::~Widget() } // FIXME: Should move this to Chrome; bad layering that this knows about Frame. -void Widget::setFocus() +void Widget::setFocus(bool focused) { + if (!focused) + return; + Frame* frame = Frame::frameForWidget(this); if (!frame) return; diff --git a/WebCore/platform/network/FormData.cpp b/WebCore/platform/network/FormData.cpp index 4ad82fb..918002a 100644 --- a/WebCore/platform/network/FormData.cpp +++ b/WebCore/platform/network/FormData.cpp @@ -286,13 +286,18 @@ String FormData::flattenToString() const return Latin1Encoding().decode(bytes.data(), bytes.size()); } -void FormData::generateFiles(ChromeClient* client) +void FormData::generateFiles(Document* document) { ASSERT(!m_hasGeneratedFiles); if (m_hasGeneratedFiles) return; + Page* page = document->page(); + if (!page) + return; + ChromeClient* client = page->chrome()->client(); + size_t n = m_elements.size(); for (size_t i = 0; i < n; ++i) { FormDataElement& e = m_elements[i]; diff --git a/WebCore/platform/network/FormData.h b/WebCore/platform/network/FormData.h index f89dad7..a439023 100644 --- a/WebCore/platform/network/FormData.h +++ b/WebCore/platform/network/FormData.h @@ -26,7 +26,6 @@ namespace WebCore { -class ChromeClient; class DOMFormData; class Document; @@ -101,7 +100,7 @@ public: const Vector<FormDataElement>& elements() const { return m_elements; } const Vector<char>& boundary() const { return m_boundary; } - void generateFiles(ChromeClient*); + void generateFiles(Document*); void removeGeneratedFilesIfNeeded(); bool alwaysStream() const { return m_alwaysStream; } diff --git a/WebCore/platform/network/FormDataBuilder.cpp b/WebCore/platform/network/FormDataBuilder.cpp index 436dc8b..13a457b 100644 --- a/WebCore/platform/network/FormDataBuilder.cpp +++ b/WebCore/platform/network/FormDataBuilder.cpp @@ -162,7 +162,7 @@ Vector<char> FormDataBuilder::generateUniqueBoundaryString() Vector<char> randomBytes; for (unsigned i = 0; i < 4; ++i) { - unsigned randomness = static_cast<unsigned>(WTF::randomNumber() * (std::numeric_limits<unsigned>::max() + 1.0)); + unsigned randomness = static_cast<unsigned>(randomNumber() * (std::numeric_limits<unsigned>::max() + 1.0)); randomBytes.append(alphaNumericEncodingMap[(randomness >> 24) & 0x3F]); randomBytes.append(alphaNumericEncodingMap[(randomness >> 16) & 0x3F]); randomBytes.append(alphaNumericEncodingMap[(randomness >> 8) & 0x3F]); diff --git a/WebCore/platform/network/NetworkStateNotifier.h b/WebCore/platform/network/NetworkStateNotifier.h index 7b94ac8..ade27fd 100644 --- a/WebCore/platform/network/NetworkStateNotifier.h +++ b/WebCore/platform/network/NetworkStateNotifier.h @@ -48,6 +48,15 @@ typedef const struct __SCDynamicStore * SCDynamicStoreRef; #include <windows.h> +#elif PLATFORM(QT) + +#include <QtCore/qglobal.h> + +#ifdef QT_NO_BEARERMANAGEMENT +#undef ENABLE_QT_BEARER +#define ENABLE_QT_BEARER 0 +#endif + #endif namespace WebCore { diff --git a/WebCore/platform/network/ProtectionSpace.h b/WebCore/platform/network/ProtectionSpace.h index 42cbc8a..deb59d2 100644 --- a/WebCore/platform/network/ProtectionSpace.h +++ b/WebCore/platform/network/ProtectionSpace.h @@ -30,26 +30,28 @@ namespace WebCore { enum ProtectionSpaceServerType { - ProtectionSpaceServerHTTP = 1, - ProtectionSpaceServerHTTPS = 2, - ProtectionSpaceServerFTP = 3, - ProtectionSpaceServerFTPS = 4, - ProtectionSpaceProxyHTTP = 5, - ProtectionSpaceProxyHTTPS = 6, - ProtectionSpaceProxyFTP = 7, - ProtectionSpaceProxySOCKS = 8 + ProtectionSpaceServerHTTP = 1, + ProtectionSpaceServerHTTPS = 2, + ProtectionSpaceServerFTP = 3, + ProtectionSpaceServerFTPS = 4, + ProtectionSpaceProxyHTTP = 5, + ProtectionSpaceProxyHTTPS = 6, + ProtectionSpaceProxyFTP = 7, + ProtectionSpaceProxySOCKS = 8 }; enum ProtectionSpaceAuthenticationScheme { - ProtectionSpaceAuthenticationSchemeDefault = 1, - ProtectionSpaceAuthenticationSchemeHTTPBasic = 2, - ProtectionSpaceAuthenticationSchemeHTTPDigest = 3, - ProtectionSpaceAuthenticationSchemeHTMLForm = 4, - ProtectionSpaceAuthenticationSchemeNTLM = 5, - ProtectionSpaceAuthenticationSchemeNegotiate = 6, - ProtectionSpaceAuthenticationSchemeUnknown = 100, + ProtectionSpaceAuthenticationSchemeDefault = 1, + ProtectionSpaceAuthenticationSchemeHTTPBasic = 2, + ProtectionSpaceAuthenticationSchemeHTTPDigest = 3, + ProtectionSpaceAuthenticationSchemeHTMLForm = 4, + ProtectionSpaceAuthenticationSchemeNTLM = 5, + ProtectionSpaceAuthenticationSchemeNegotiate = 6, + ProtectionSpaceAuthenticationSchemeClientCertificateRequested = 7, + ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested = 8, + ProtectionSpaceAuthenticationSchemeUnknown = 100, }; - + class ProtectionSpace { public: diff --git a/WebCore/platform/network/ResourceHandle.h b/WebCore/platform/network/ResourceHandle.h index 24decd5..b86c922 100644 --- a/WebCore/platform/network/ResourceHandle.h +++ b/WebCore/platform/network/ResourceHandle.h @@ -82,6 +82,7 @@ class Credential; class FormData; class Frame; class KURL; +class ProtectionSpace; class ResourceError; class ResourceHandleClient; class ResourceHandleInternal; @@ -131,6 +132,9 @@ public: #if PLATFORM(MAC) void didCancelAuthenticationChallenge(const AuthenticationChallenge&); +#if USE(PROTECTION_SPACE_AUTH_CALLBACK) + bool canAuthenticateAgainstProtectionSpace(const ProtectionSpace&); +#endif NSURLConnection *connection() const; WebCoreResourceHandleAsDelegate *delegate(); void releaseDelegate(); diff --git a/WebCore/platform/network/ResourceHandleClient.h b/WebCore/platform/network/ResourceHandleClient.h index 0fe77a1..bbc3cf8 100644 --- a/WebCore/platform/network/ResourceHandleClient.h +++ b/WebCore/platform/network/ResourceHandleClient.h @@ -47,6 +47,7 @@ namespace WebCore { class AuthenticationChallenge; class Credential; class KURL; + class ProtectionSpace; class ResourceHandle; class ResourceError; class ResourceRequest; @@ -78,6 +79,9 @@ namespace WebCore { virtual bool shouldUseCredentialStorage(ResourceHandle*) { return false; } virtual void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) { } virtual void didCancelAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) { } +#if USE(PROTECTION_SPACE_AUTH_CALLBACK) + virtual bool canAuthenticateAgainstProtectionSpace(ResourceHandle*, const ProtectionSpace&) { return false; } +#endif virtual void receivedCancellation(ResourceHandle*, const AuthenticationChallenge&) { } #if PLATFORM(MAC) diff --git a/WebCore/platform/network/ResourceRequestBase.cpp b/WebCore/platform/network/ResourceRequestBase.cpp index 42c1c6e..fd8832f 100644 --- a/WebCore/platform/network/ResourceRequestBase.cpp +++ b/WebCore/platform/network/ResourceRequestBase.cpp @@ -45,6 +45,7 @@ PassOwnPtr<ResourceRequest> ResourceRequestBase::adopt(PassOwnPtr<CrossThreadRes request->setTimeoutInterval(data->m_timeoutInterval); request->setFirstPartyForCookies(data->m_firstPartyForCookies); request->setHTTPMethod(data->m_httpMethod); + request->setTargetType(data->m_targetType); request->updateResourceRequest(); request->m_httpHeaderFields.adopt(data->m_httpHeaders.release()); @@ -76,6 +77,7 @@ PassOwnPtr<CrossThreadResourceRequestData> ResourceRequestBase::copyData() const data->m_firstPartyForCookies = firstPartyForCookies().copy(); data->m_httpMethod = httpMethod().crossThreadString(); data->m_httpHeaders = httpHeaderFields().copyData(); + data->m_targetType = m_targetType; data->m_responseContentDispositionEncodingFallbackArray.reserveInitialCapacity(m_responseContentDispositionEncodingFallbackArray.size()); size_t encodingArraySize = m_responseContentDispositionEncodingFallbackArray.size(); diff --git a/WebCore/platform/network/ResourceRequestBase.h b/WebCore/platform/network/ResourceRequestBase.h index 2ca5d7d..0b634cb 100644 --- a/WebCore/platform/network/ResourceRequestBase.h +++ b/WebCore/platform/network/ResourceRequestBase.h @@ -61,7 +61,9 @@ namespace WebCore { TargetIsFontResource, TargetIsImage, TargetIsObject, - TargetIsMedia + TargetIsMedia, + TargetIsWorker, + TargetIsSharedWorker }; static PassOwnPtr<ResourceRequest> adopt(PassOwnPtr<CrossThreadResourceRequestData>); @@ -195,6 +197,7 @@ namespace WebCore { Vector<String> m_responseContentDispositionEncodingFallbackArray; RefPtr<FormData> m_httpBody; bool m_allowCookies; + ResourceRequestBase::TargetType m_targetType; }; unsigned initializeMaximumHTTPConnectionCountPerHost(); diff --git a/WebCore/platform/network/mac/AuthenticationMac.mm b/WebCore/platform/network/mac/AuthenticationMac.mm index 077a53d..1c05917 100644 --- a/WebCore/platform/network/mac/AuthenticationMac.mm +++ b/WebCore/platform/network/mac/AuthenticationMac.mm @@ -197,6 +197,14 @@ NSURLProtectionSpace *mac(const ProtectionSpace& coreSpace) case ProtectionSpaceAuthenticationSchemeNTLM: method = NSURLAuthenticationMethodNTLM; break; +#if USE(PROTECTION_SPACE_AUTH_CALLBACK) + case ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested: + method = NSURLAuthenticationMethodServerTrust; + break; + case ProtectionSpaceAuthenticationSchemeClientCertificateRequested: + method = NSURLAuthenticationMethodClientCertificate; + break; +#endif default: ASSERT_NOT_REACHED(); } @@ -295,6 +303,12 @@ ProtectionSpace core(NSURLProtectionSpace *macSpace) scheme = ProtectionSpaceAuthenticationSchemeHTMLForm; else if ([method isEqualToString:NSURLAuthenticationMethodNTLM]) scheme = ProtectionSpaceAuthenticationSchemeNTLM; +#if USE(PROTECTION_SPACE_AUTH_CALLBACK) + else if ([method isEqualToString:NSURLAuthenticationMethodClientCertificate]) + scheme = ProtectionSpaceAuthenticationSchemeClientCertificateRequested; + else if ([method isEqualToString:NSURLAuthenticationMethodServerTrust]) + scheme = ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested; +#endif else { scheme = ProtectionSpaceAuthenticationSchemeUnknown; ASSERT_NOT_REACHED(); diff --git a/WebCore/platform/network/mac/ResourceHandleMac.mm b/WebCore/platform/network/mac/ResourceHandleMac.mm index 3ea29c5..a70da68 100644 --- a/WebCore/platform/network/mac/ResourceHandleMac.mm +++ b/WebCore/platform/network/mac/ResourceHandleMac.mm @@ -567,11 +567,26 @@ void ResourceHandle::didCancelAuthenticationChallenge(const AuthenticationChalle client()->didCancelAuthenticationChallenge(this, challenge); } +#if USE(PROTECTION_SPACE_AUTH_CALLBACK) +bool ResourceHandle::canAuthenticateAgainstProtectionSpace(const ProtectionSpace& protectionSpace) +{ + if (client()) + return client()->canAuthenticateAgainstProtectionSpace(this, protectionSpace); + + return false; +} +#endif + void ResourceHandle::receivedCredential(const AuthenticationChallenge& challenge, const Credential& credential) { ASSERT(!challenge.isNull()); if (challenge != d->m_currentWebChallenge) return; + + if (credential.isEmpty()) { + receivedRequestToContinueWithoutCredential(challenge); + return; + } #ifdef BUILDING_ON_TIGER if (credential.persistence() == CredentialPersistenceNone) { @@ -734,6 +749,19 @@ void ResourceHandle::receivedCancellation(const AuthenticationChallenge& challen m_handle->didCancelAuthenticationChallenge(core(challenge)); } +#if USE(PROTECTION_SPACE_AUTH_CALLBACK) +- (BOOL)connection:(NSURLConnection *)unusedConnection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace +{ + UNUSED_PARAM(unusedConnection); + + if (!m_handle) + return NO; + + CallbackGuard guard; + return m_handle->canAuthenticateAgainstProtectionSpace(core(protectionSpace)); +} +#endif + - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)r { UNUSED_PARAM(connection); @@ -744,7 +772,10 @@ void ResourceHandle::receivedCancellation(const AuthenticationChallenge& challen return; CallbackGuard guard; - [r adjustMIMETypeIfNecessary]; + // Avoid MIME type sniffing if the response comes back as 304 Not Modified. + int statusCode = [r respondsToSelector:@selector(statusCode)] ? [(id)r statusCode] : 0; + if (statusCode != 304) + [r adjustMIMETypeIfNecessary]; if ([m_handle->request().nsURLRequest() _propertyForKey:@"ForceHTMLMIMEType"]) [r _setMIMEType:@"text/html"]; diff --git a/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp b/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp index 52512aa..3aae92a 100644 --- a/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp +++ b/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp @@ -20,6 +20,8 @@ #include "config.h" #include "NetworkStateNotifier.h" +#if PLATFORM(QT) && ENABLE(QT_BEARER) + #include "NetworkStateNotifierPrivate.h" #include "qnetworkconfigmanager.h" @@ -89,4 +91,6 @@ void NetworkStateNotifier::setNetworkAccessAllowed(bool isAllowed) } // namespace WebCore +#endif + #include "moc_NetworkStateNotifierPrivate.cpp" diff --git a/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/WebCore/platform/network/qt/QNetworkReplyHandler.cpp index 27b57b7..e52dd1d 100644 --- a/WebCore/platform/network/qt/QNetworkReplyHandler.cpp +++ b/WebCore/platform/network/qt/QNetworkReplyHandler.cpp @@ -41,8 +41,9 @@ // What type of connection should be used for the signals of the // QNetworkReply? This depends on if Qt has a bugfix for this or not. -// It is fixed in Qt 4.6.1. See https://bugs.webkit.org/show_bug.cgi?id=32113 -#if QT_VERSION > QT_VERSION_CHECK(4, 6, 0) +// It is fixed in Qt 4.6.3. See https://bugs.webkit.org/show_bug.cgi?id=32113 +// and https://bugs.webkit.org/show_bug.cgi?id=36755 +#if QT_VERSION > QT_VERSION_CHECK(4, 6, 2) #define SIGNAL_CONN Qt::DirectConnection #else #define SIGNAL_CONN Qt::QueuedConnection diff --git a/WebCore/platform/network/qt/ResourceRequestQt.cpp b/WebCore/platform/network/qt/ResourceRequestQt.cpp index 341e6ae..fea64a0 100644 --- a/WebCore/platform/network/qt/ResourceRequestQt.cpp +++ b/WebCore/platform/network/qt/ResourceRequestQt.cpp @@ -32,12 +32,14 @@ namespace WebCore { // To achieve the best result we want WebKit to schedule the jobs so we // are using the limit as found in Qt. To allow Qt to fill its queue // and prepare jobs we will schedule two more downloads. +// Per TCP connection there is 1 current processed, 3 possibly pipelined +// and 2 ready to re-fill the pipeline. unsigned initializeMaximumHTTPConnectionCountPerHost() { #ifdef Q_OS_SYMBIAN - return 3 + 2; + return 3 * (1 + 3 + 2); #else - return 6 + 2; + return 6 * (1 + 3 + 2); #endif } diff --git a/WebCore/platform/posix/FileSystemPOSIX.cpp b/WebCore/platform/posix/FileSystemPOSIX.cpp index ac8c7fa..ba17d39 100644 --- a/WebCore/platform/posix/FileSystemPOSIX.cpp +++ b/WebCore/platform/posix/FileSystemPOSIX.cpp @@ -116,6 +116,7 @@ bool truncateFile(PlatformFileHandle handle, long long offset) return !ftruncate(handle, offset); } +#if !PLATFORM(ANDROID) int writeToFile(PlatformFileHandle handle, const char* data, int length) { do { @@ -125,6 +126,7 @@ int writeToFile(PlatformFileHandle handle, const char* data, int length) } while (errno == EINTR); return -1; } +#endif int readFromFile(PlatformFileHandle handle, char* data, int length) { diff --git a/WebCore/platform/qt/PasteboardQt.cpp b/WebCore/platform/qt/PasteboardQt.cpp index 70ec546..484fa60 100644 --- a/WebCore/platform/qt/PasteboardQt.cpp +++ b/WebCore/platform/qt/PasteboardQt.cpp @@ -58,7 +58,7 @@ Pasteboard* Pasteboard::generalPasteboard() return pasteboard; } -void Pasteboard::writeSelection(Range* selectedRange, bool, Frame* frame) +void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame) { QMimeData* md = new QMimeData; QString text = frame->selectedText(); @@ -74,10 +74,14 @@ void Pasteboard::writeSelection(Range* selectedRange, bool, Frame* frame) QApplication::clipboard()->setMimeData(md, m_selectionMode ? QClipboard::Selection : QClipboard::Clipboard); #endif + if (canSmartCopyOrDelete) + md->setData("application/vnd.qtwebkit.smartpaste", QByteArray()); } bool Pasteboard::canSmartReplace() { + if (QApplication::clipboard()->mimeData()->hasFormat((QLatin1String("application/vnd.qtwebkit.smartpaste")))) + return true; return false; } diff --git a/WebCore/platform/qt/QWebPageClient.h b/WebCore/platform/qt/QWebPageClient.h index 467941f..a9a81eb 100644 --- a/WebCore/platform/qt/QWebPageClient.h +++ b/WebCore/platform/qt/QWebPageClient.h @@ -61,24 +61,23 @@ public: #if QT_VERSION >= 0x040600 virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable) = 0; #endif + +#ifndef QT_NO_CURSOR inline void resetCursor() { -#ifndef QT_NO_CURSOR if (!cursor().bitmap() && cursor().shape() == m_lastCursor.shape()) return; updateCursor(m_lastCursor); -#endif } inline void setCursor(const QCursor& cursor) { -#ifndef QT_NO_CURSOR m_lastCursor = cursor; if (!cursor.bitmap() && cursor.shape() == this->cursor().shape()) return; updateCursor(cursor); -#endif } +#endif virtual QPalette palette() const = 0; virtual int screenNumber() const = 0; diff --git a/WebCore/platform/qt/RenderThemeQt.cpp b/WebCore/platform/qt/RenderThemeQt.cpp index 9cc32ad..ee66a35 100644 --- a/WebCore/platform/qt/RenderThemeQt.cpp +++ b/WebCore/platform/qt/RenderThemeQt.cpp @@ -42,7 +42,7 @@ #include "HTMLInputElement.h" #include "HTMLMediaElement.h" #include "HTMLNames.h" -#ifdef Q_WS_MAEMO_5 +#if USE(QT_MOBILE_THEME) #include "Maemo5Webstyle.h" #endif #include "NotImplemented.h" @@ -153,7 +153,7 @@ RenderThemeQt::RenderThemeQt(Page* page) m_buttonFontPixelSize = fontInfo.pixelSize(); #endif -#ifdef Q_WS_MAEMO_5 +#if USE(QT_MOBILE_THEME) m_fallbackStyle = new Maemo5WebStyle; #else m_fallbackStyle = QStyleFactory::create(QLatin1String("windows")); @@ -163,10 +163,12 @@ RenderThemeQt::RenderThemeQt(Page* page) RenderThemeQt::~RenderThemeQt() { delete m_fallbackStyle; +#ifndef QT_NO_LINEEDIT delete m_lineEdit; +#endif } -#ifdef Q_WS_MAEMO_5 +#if USE(QT_MOBILE_THEME) bool RenderThemeQt::isControlStyled(const RenderStyle* style, const BorderData& border, const FillLayer& fill, const Color& backgroundColor) const { switch (style->appearance()) { @@ -198,7 +200,7 @@ QStyle* RenderThemeQt::fallbackStyle() const QStyle* RenderThemeQt::qStyle() const { -#ifdef Q_WS_MAEMO_5 +#if USE(QT_MOBILE_THEME) return fallbackStyle(); #endif @@ -218,7 +220,7 @@ String RenderThemeQt::extraDefaultStyleSheet() #if ENABLE(NO_LISTBOX_RENDERING) result += String(themeQtNoListboxesUserAgentStyleSheet, sizeof(themeQtNoListboxesUserAgentStyleSheet)); #endif -#ifdef Q_WS_MAEMO_5 +#if USE(QT_MOBILE_THEME) result += String(themeQtMaemo5UserAgentStyleSheet, sizeof(themeQtMaemo5UserAgentStyleSheet)); #endif return result; @@ -264,11 +266,17 @@ bool RenderThemeQt::supportsControlTints() const int RenderThemeQt::findFrameLineWidth(QStyle* style) const { +#ifndef QT_NO_LINEEDIT if (!m_lineEdit) m_lineEdit = new QLineEdit(); +#endif QStyleOptionFrameV2 opt; - return style->pixelMetric(QStyle::PM_DefaultFrameWidth, &opt, m_lineEdit); + QWidget* widget = 0; +#ifndef QT_NO_LINEEDIT + widget = m_lineEdit; +#endif + return style->pixelMetric(QStyle::PM_DefaultFrameWidth, &opt, widget); } static QRect inflateButtonRect(const QRect& originalRect, QStyle* style) @@ -648,7 +656,9 @@ bool RenderThemeQt::paintMenuList(RenderObject* o, const RenderObject::PaintInfo void RenderThemeQt::adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle* style, Element*) const { -#ifndef Q_WS_MAEMO_5 +#if USE(QT_MOBILE_THEME) + // Mobile theme uses border radius. +#else // WORKAROUND because html.css specifies -webkit-border-radius for <select> so we override it here // see also http://bugs.webkit.org/show_bug.cgi?id=18399 style->resetBorderRadius(); @@ -898,7 +908,7 @@ bool RenderThemeQt::supportsFocus(ControlPart appearance) const void RenderThemeQt::setPaletteFromPageClientIfExists(QPalette& palette) const { -#ifdef Q_WS_MAEMO_5 +#if USE(QT_MOBILE_THEME) static QPalette lightGrayPalette(Qt::lightGray); palette = lightGrayPalette; return; @@ -960,7 +970,7 @@ ControlPart RenderThemeQt::initializeCommonQStyleOptions(QStyleOption& option, R case SearchFieldCancelButtonPart: { if (isPressed(o)) option.state |= QStyle::State_Sunken; - else if (result == PushButtonPart) + else if (result == PushButtonPart || result == ButtonPart) option.state |= QStyle::State_Raised; break; } diff --git a/WebCore/platform/qt/RenderThemeQt.h b/WebCore/platform/qt/RenderThemeQt.h index c10659a..fdd8d6b 100644 --- a/WebCore/platform/qt/RenderThemeQt.h +++ b/WebCore/platform/qt/RenderThemeQt.h @@ -78,7 +78,7 @@ public: virtual double caretBlinkInterval() const; -#ifdef Q_WS_MAEMO_5 +#if USE(QT_MOBILE_THEME) virtual bool isControlStyled(const RenderStyle*, const BorderData&, const FillLayer&, const Color& backgroundColor) const; virtual int popupInternalPaddingBottom(RenderStyle*) const; #endif diff --git a/WebCore/platform/qt/TemporaryLinkStubs.cpp b/WebCore/platform/qt/TemporaryLinkStubsQt.cpp index 432bd2b..432bd2b 100644 --- a/WebCore/platform/qt/TemporaryLinkStubs.cpp +++ b/WebCore/platform/qt/TemporaryLinkStubsQt.cpp diff --git a/WebCore/platform/qt/WidgetQt.cpp b/WebCore/platform/qt/WidgetQt.cpp index 252bdb4..43252a8 100644 --- a/WebCore/platform/qt/WidgetQt.cpp +++ b/WebCore/platform/qt/WidgetQt.cpp @@ -75,7 +75,7 @@ void Widget::setFrameRect(const IntRect& rect) frameRectsChanged(); } -void Widget::setFocus() +void Widget::setFocus(bool focused) { } diff --git a/WebCore/platform/sql/SQLiteDatabase.cpp b/WebCore/platform/sql/SQLiteDatabase.cpp index 58fdc7c..75fc032 100644 --- a/WebCore/platform/sql/SQLiteDatabase.cpp +++ b/WebCore/platform/sql/SQLiteDatabase.cpp @@ -102,14 +102,17 @@ void SQLiteDatabase::setFullsync(bool fsync) int64_t SQLiteDatabase::maximumSize() { - MutexLocker locker(m_authorizerLock); - enableAuthorizer(false); - - SQLiteStatement statement(*this, "PRAGMA max_page_count"); - int64_t size = statement.getColumnInt64(0) * pageSize(); - - enableAuthorizer(true); - return size; + int64_t maxPageCount = 0; + + { + MutexLocker locker(m_authorizerLock); + enableAuthorizer(false); + SQLiteStatement statement(*this, "PRAGMA max_page_count"); + maxPageCount = statement.getColumnInt64(0); + enableAuthorizer(true); + } + + return maxPageCount * pageSize(); } void SQLiteDatabase::setMaximumSize(int64_t size) @@ -128,7 +131,7 @@ void SQLiteDatabase::setMaximumSize(int64_t size) SQLiteStatement statement(*this, "PRAGMA max_page_count = " + String::number(newMaxPageCount)); statement.prepare(); if (statement.step() != SQLResultRow) - LOG_ERROR("Failed to set maximum size of database to %lli bytes", size); + LOG_ERROR("Failed to set maximum size of database to %lli bytes", static_cast<long long>(size)); enableAuthorizer(true); @@ -153,14 +156,33 @@ int SQLiteDatabase::pageSize() int64_t SQLiteDatabase::freeSpaceSize() { - MutexLocker locker(m_authorizerLock); - enableAuthorizer(false); - // Note: freelist_count was added in SQLite 3.4.1. - SQLiteStatement statement(*this, "PRAGMA freelist_count"); - int64_t size = statement.getColumnInt64(0) * pageSize(); + int64_t freelistCount = 0; - enableAuthorizer(true); - return size; + { + MutexLocker locker(m_authorizerLock); + enableAuthorizer(false); + // Note: freelist_count was added in SQLite 3.4.1. + SQLiteStatement statement(*this, "PRAGMA freelist_count"); + freelistCount = statement.getColumnInt64(0); + enableAuthorizer(true); + } + + return freelistCount * pageSize(); +} + +int64_t SQLiteDatabase::totalSize() +{ + int64_t pageCount = 0; + + { + MutexLocker locker(m_authorizerLock); + enableAuthorizer(false); + SQLiteStatement statement(*this, "PRAGMA page_count"); + pageCount = statement.getColumnInt64(0); + enableAuthorizer(true); + } + + return pageCount * pageSize(); } void SQLiteDatabase::setSynchronous(SynchronousPragma sync) @@ -229,6 +251,17 @@ void SQLiteDatabase::runVacuumCommand() LOG(SQLDatabase, "Unable to vacuum database - %s", lastErrorMsg()); } +void SQLiteDatabase::runIncrementalVacuumCommand() +{ + MutexLocker locker(m_authorizerLock); + enableAuthorizer(false); + + if (!executeCommand("PRAGMA incremental_vacuum")) + LOG(SQLDatabase, "Unable to run incremental vacuum - %s", lastErrorMsg()); + + enableAuthorizer(true); +} + int64_t SQLiteDatabase::lastInsertRowID() { if (!m_db) @@ -379,4 +412,34 @@ bool SQLiteDatabase::isAutoCommitOn() const return sqlite3_get_autocommit(m_db); } +bool SQLiteDatabase::turnOnIncrementalAutoVacuum() +{ + SQLiteStatement statement(*this, "PRAGMA auto_vacuum"); + int autoVacuumMode = statement.getColumnInt(0); + int error = lastError(); + + // Check if we got an error while trying to get the value of the auto_vacuum flag. + // If we got a SQLITE_BUSY error, then there's probably another transaction in + // progress on this database. In this case, keep the current value of the + // auto_vacuum flag and try to set it to INCREMENTAL the next time we open this + // database. If the error is not SQLITE_BUSY, then we probably ran into a more + // serious problem and should return false (to log an error message). + if (error != SQLITE_ROW) + return false; + + switch (autoVacuumMode) { + case AutoVacuumIncremental: + return true; + case AutoVacuumFull: + return executeCommand("PRAGMA auto_vacuum = 2"); + case AutoVacuumNone: + default: + if (!executeCommand("PRAGMA auto_vacuum = 2")) + return false; + runVacuumCommand(); + error = lastError(); + return (error == SQLITE_OK); + } +} + } // namespace WebCore diff --git a/WebCore/platform/sql/SQLiteDatabase.h b/WebCore/platform/sql/SQLiteDatabase.h index bc58a32..c5924c0 100644 --- a/WebCore/platform/sql/SQLiteDatabase.h +++ b/WebCore/platform/sql/SQLiteDatabase.h @@ -65,6 +65,7 @@ public: bool tableExists(const String&); void clearAllTables(); void runVacuumCommand(); + void runIncrementalVacuumCommand(); bool transactionInProgress() const { return m_transactionInProgress; } @@ -85,6 +86,7 @@ public: // Gets the number of unused bytes in the database file. int64_t freeSpaceSize(); + int64_t totalSize(); // The SQLite SYNCHRONOUS pragma can be either FULL, NORMAL, or OFF // FULL - Any writing calls to the DB block until the data is actually on the disk surface @@ -108,6 +110,18 @@ public: void unlock(); bool isAutoCommitOn() const; + // The SQLite AUTO_VACUUM pragma can be either NONE, FULL, or INCREMENTAL. + // NONE - SQLite does not do any vacuuming + // FULL - SQLite moves all empty pages to the end of the DB file and truncates + // the file to remove those pages after every transaction. This option + // requires SQLite to store additional information about each page in + // the database file. + // INCREMENTAL - SQLite stores extra information for each page in the database + // file, but removes the empty pages only when PRAGMA INCREMANTAL_VACUUM + // is called. + enum AutoVacuumPragma { AutoVacuumNone = 0, AutoVacuumFull = 1, AutoVacuumIncremental = 2 }; + bool turnOnIncrementalAutoVacuum(); + // Set this flag to allow access from multiple threads. Not all multi-threaded accesses are safe! // See http://www.sqlite.org/cvstrac/wiki?p=MultiThreading for more info. #ifndef NDEBUG diff --git a/WebCore/platform/sql/SQLiteStatement.cpp b/WebCore/platform/sql/SQLiteStatement.cpp index 8963adb..cd2a467 100644 --- a/WebCore/platform/sql/SQLiteStatement.cpp +++ b/WebCore/platform/sql/SQLiteStatement.cpp @@ -65,6 +65,15 @@ int SQLiteStatement::prepare() LOG(SQLDatabase, "SQL - prepare - %s", m_query.ascii().data()); String strippedQuery = m_query.stripWhiteSpace(); int error = sqlite3_prepare16_v2(m_database.sqlite3Handle(), strippedQuery.charactersWithNullTermination(), -1, &m_statement, &tail); + + // Starting with version 3.6.16, sqlite has a patch (http://www.sqlite.org/src/ci/256ec3c6af) + // that should make sure sqlite3_prepare16_v2 doesn't return a SQLITE_SCHEMA error. + // If we're using an older sqlite version, try to emulate the patch. + if (error == SQLITE_SCHEMA) { + sqlite3_finalize(m_statement); + error = sqlite3_prepare16_v2(m_database.sqlite3Handle(), m_query.charactersWithNullTermination(), -1, &m_statement, &tail); + } + if (error != SQLITE_OK) LOG(SQLDatabase, "sqlite3_prepare16 failed (%i)\n%s\n%s", error, m_query.ascii().data(), sqlite3_errmsg(m_database.sqlite3Handle())); const UChar* ch = static_cast<const UChar*>(tail); @@ -87,6 +96,7 @@ int SQLiteStatement::step() LOG(SQLDatabase, "sqlite3_step failed (%i)\nQuery - %s\nError - %s", error, m_query.ascii().data(), sqlite3_errmsg(m_database.sqlite3Handle())); } + return error; } diff --git a/WebCore/platform/text/CharacterNames.h b/WebCore/platform/text/CharacterNames.h index c0b1750..fbb9466 100644 --- a/WebCore/platform/text/CharacterNames.h +++ b/WebCore/platform/text/CharacterNames.h @@ -30,40 +30,42 @@ namespace WebCore { - // Names here are taken from the Unicode standard. +// 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. +// 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 ethiopicPrefaceColon = 0x1366; - const UChar hebrewPunctuationGeresh = 0x05F3; - const UChar hebrewPunctuationGershayim = 0x05F4; - const UChar horizontalEllipsis = 0x2026; - const UChar hyphenMinus = 0x002D; - const UChar ideographicComma = 0x3001; - const UChar ideographicFullStop = 0x3002; - const UChar ideographicSpace = 0x3000; - const UChar leftDoubleQuotationMark = 0x201C; - const UChar leftSingleQuotationMark = 0x2018; - const UChar leftToRightEmbed = 0x202A; - const UChar leftToRightMark = 0x200E; - 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 rightDoubleQuotationMark = 0x201D; - const UChar rightSingleQuotationMark = 0x2019; - const UChar rightToLeftEmbed = 0x202B; - const UChar rightToLeftMark = 0x200F; - const UChar rightToLeftOverride = 0x202E; - const UChar softHyphen = 0x00AD; - const UChar space = 0x0020; - const UChar whiteBullet = 0x25E6; - const UChar zeroWidthSpace = 0x200B; +const UChar blackSquare = 0x25A0; +const UChar bullet = 0x2022; +const UChar ethiopicPrefaceColon = 0x1366; +const UChar hebrewPunctuationGeresh = 0x05F3; +const UChar hebrewPunctuationGershayim = 0x05F4; +const UChar horizontalEllipsis = 0x2026; +const UChar hyphenMinus = 0x002D; +const UChar ideographicComma = 0x3001; +const UChar ideographicFullStop = 0x3002; +const UChar ideographicSpace = 0x3000; +const UChar leftDoubleQuotationMark = 0x201C; +const UChar leftSingleQuotationMark = 0x2018; +const UChar leftToRightEmbed = 0x202A; +const UChar leftToRightMark = 0x200E; +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 rightDoubleQuotationMark = 0x201D; +const UChar rightSingleQuotationMark = 0x2019; +const UChar rightToLeftEmbed = 0x202B; +const UChar rightToLeftMark = 0x200F; +const UChar rightToLeftOverride = 0x202E; +const UChar softHyphen = 0x00AD; +const UChar space = 0x0020; +const UChar whiteBullet = 0x25E6; +const UChar zeroWidthJoiner = 0x200D; +const UChar zeroWidthNonJoiner = 0x200C; +const UChar zeroWidthSpace = 0x200B; } diff --git a/WebCore/platform/text/TextEncodingRegistry.cpp b/WebCore/platform/text/TextEncodingRegistry.cpp index 00ad2c9..dad0f39 100644 --- a/WebCore/platform/text/TextEncodingRegistry.cpp +++ b/WebCore/platform/text/TextEncodingRegistry.cpp @@ -316,4 +316,19 @@ bool noExtendedTextEncodingNameUsed() return !didExtendTextCodecMaps; } +#ifndef NDEBUG +void dumpTextEncodingNameMap() +{ + unsigned size = textEncodingNameMap->size(); + fprintf(stderr, "Dumping %u entries in WebCore::textEncodingNameMap...\n", size); + + MutexLocker lock(encodingRegistryMutex()); + + TextEncodingNameMap::const_iterator it = textEncodingNameMap->begin(); + TextEncodingNameMap::const_iterator end = textEncodingNameMap->end(); + for (; it != end; ++it) + fprintf(stderr, "'%s' => '%s'\n", it->first, it->second); +} +#endif + } // namespace WebCore diff --git a/WebCore/platform/text/TextEncodingRegistry.h b/WebCore/platform/text/TextEncodingRegistry.h index e6950cf..81b7c4c 100644 --- a/WebCore/platform/text/TextEncodingRegistry.h +++ b/WebCore/platform/text/TextEncodingRegistry.h @@ -46,6 +46,9 @@ namespace WebCore { // Only TextEncoding should use this function directly. bool noExtendedTextEncodingNameUsed(); +#ifndef NDEBUG + void dumpTextEncodingNameMap(); +#endif } #endif // TextEncodingRegistry_h diff --git a/WebCore/platform/text/TextStream.cpp b/WebCore/platform/text/TextStream.cpp index 4386059..646de3f 100644 --- a/WebCore/platform/text/TextStream.cpp +++ b/WebCore/platform/text/TextStream.cpp @@ -108,7 +108,7 @@ String TextStream::release() return String::adopt(m_text); } -#if OS(WINDOWS) && PLATFORM(X86_64) && COMPILER(MSVC) +#if OS(WINDOWS) && CPU(X86_64) TextStream& TextStream::operator<<(__int64 i) { char buffer[printBufferSize]; diff --git a/WebCore/platform/text/TextStream.h b/WebCore/platform/text/TextStream.h index d69e34b..f5e512c 100644 --- a/WebCore/platform/text/TextStream.h +++ b/WebCore/platform/text/TextStream.h @@ -45,7 +45,7 @@ public: TextStream& operator<<(const char*); TextStream& operator<<(const void*); TextStream& operator<<(const String&); -#if OS(WINDOWS) && PLATFORM(X86_64) && COMPILER(MSVC) +#if OS(WINDOWS) && CPU(X86_64) TextStream& operator<<(unsigned __int64); TextStream& operator<<(__int64); #endif diff --git a/WebCore/platform/win/WidgetWin.cpp b/WebCore/platform/win/WidgetWin.cpp index 74a22f6..607c0d8 100644 --- a/WebCore/platform/win/WidgetWin.cpp +++ b/WebCore/platform/win/WidgetWin.cpp @@ -101,7 +101,7 @@ void Widget::paint(GraphicsContext*, const IntRect&) { } -void Widget::setFocus() +void Widget::setFocus(bool focused) { } diff --git a/WebCore/platform/wince/SharedTimerWince.cpp b/WebCore/platform/wince/SharedTimerWince.cpp index 5f6a386..2328017 100644 --- a/WebCore/platform/wince/SharedTimerWince.cpp +++ b/WebCore/platform/wince/SharedTimerWince.cpp @@ -36,7 +36,7 @@ #include <windows.h> namespace JSC { -extern void* g_stackBase; +JS_EXPORTDATA extern void* g_stackBase; } namespace WebCore { diff --git a/WebCore/platform/wx/WidgetWx.cpp b/WebCore/platform/wx/WidgetWx.cpp index a384914..9de4c3d 100644 --- a/WebCore/platform/wx/WidgetWx.cpp +++ b/WebCore/platform/wx/WidgetWx.cpp @@ -44,10 +44,12 @@ Widget::~Widget() { } -void Widget::setFocus() +void Widget::setFocus(bool focused) { - if (PlatformWidget widget = platformWidget()) - widget->SetFocus(); + if (focused) { + if (PlatformWidget widget = platformWidget()) + widget->SetFocus(); + } } void Widget::setCursor(const Cursor& cursor) diff --git a/WebCore/platform/wx/wxcode/fontprops.h b/WebCore/platform/wx/wxcode/fontprops.h index 3f99462..7702db2 100644 --- a/WebCore/platform/wx/wxcode/fontprops.h +++ b/WebCore/platform/wx/wxcode/fontprops.h @@ -48,4 +48,4 @@ private: }; -bool wxFontContainsCharacters(const wxFont& font, const UChar* characters, int length); +bool wxFontContainsCharacters(void* font, const UChar* characters, int length); diff --git a/WebCore/platform/wx/wxcode/mac/carbon/fontprops.mm b/WebCore/platform/wx/wxcode/mac/carbon/fontprops.mm index ff4c18a..9da47fd 100644 --- a/WebCore/platform/wx/wxcode/mac/carbon/fontprops.mm +++ b/WebCore/platform/wx/wxcode/mac/carbon/fontprops.mm @@ -28,6 +28,7 @@ #include <wtf/unicode/Unicode.h> #include "fontprops.h" +#include "WebCoreSystemInterface.h" #include <ApplicationServices/ApplicationServices.h> @@ -35,10 +36,6 @@ #include <wx/gdicmn.h> #include <wx/graphics.h> -#ifdef BUILDING_ON_TIGER -void (*wkGetFontMetrics)(CGFontRef, int* ascent, int* descent, int* lineGap, unsigned* unitsPerEm); -#endif - const float smallCapsFontSizeMultiplier = 0.7f; const float contextDPI = 72.0f; static inline float scaleEmToUnits(float x, unsigned unitsPerEm) { return x * (contextDPI / (contextDPI * unitsPerEm)); } @@ -92,23 +89,20 @@ m_ascent(0), m_descent(0), m_lineGap(0), m_lineSpacing(0), m_xHeight(0) } -bool wxFontContainsCharacters(const wxFont& font, const UChar* characters, int length) +bool wxFontContainsCharacters(void* font, const UChar* characters, int length) { -#if wxOSX_USE_COCOA NSString* string = [[NSString alloc] initWithCharactersNoCopy:const_cast<unichar*>(characters) length:length freeWhenDone:NO]; - NSCharacterSet* set = [[font.OSXGetNSFont() coveredCharacterSet] invertedSet]; + NSCharacterSet* set = [[(NSFont*)font coveredCharacterSet] invertedSet]; bool result = set && [string rangeOfCharacterFromSet:set].location == NSNotFound; [string release]; return result; -#else - return true; -#endif } void GetTextExtent( const wxFont& font, const wxString& str, wxCoord *width, wxCoord *height, wxCoord *descent, wxCoord *externalLeading ) { wxGraphicsContext * const gc = wxGraphicsContext::Create(); + gc->SetFont(font, *wxBLACK); // colour doesn't matter but must be specified struct GCTextExtent { diff --git a/WebCore/platform/wx/wxcode/mac/carbon/non-kerned-drawing.cpp b/WebCore/platform/wx/wxcode/mac/carbon/non-kerned-drawing.cpp index 47eb1f8..82259f4 100644 --- a/WebCore/platform/wx/wxcode/mac/carbon/non-kerned-drawing.cpp +++ b/WebCore/platform/wx/wxcode/mac/carbon/non-kerned-drawing.cpp @@ -39,14 +39,6 @@ #include <wx/dcgraph.h> #include <wx/gdicmn.h> - -// Unfortunately we need access to a private function to get the character -> glyph conversion needed to -// allow us to use CGContextShowGlyphsWithAdvances -// Note that on < 10.5, the function is called CGFontGetGlyphsForUnicodes, so we need to detect and deal -// with this. -typedef void (*CGFontGetGlyphsForUnicharsPtr)(CGFontRef, const UniChar[], const CGGlyph[], size_t); -static CGFontGetGlyphsForUnicharsPtr CGFontGetGlyphsForUnichars = (CGFontGetGlyphsForUnicharsPtr)dlsym(RTLD_DEFAULT, "CGFontGetGlyphsForUnichars"); - namespace WebCore { void drawTextWithSpacing(GraphicsContext* graphicsContext, const SimpleFontData* font, const wxColour& color, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point) @@ -60,18 +52,7 @@ void drawTextWithSpacing(GraphicsContext* graphicsContext, const SimpleFontData* CGContextRef cgContext = static_cast<CGContextRef>(dc->GetGraphicsContext()->GetNativeContext()); - CGFontRef cgFont; - -#ifdef wxOSX_USE_CORE_TEXT && wxOSX_USE_CORE_TEXT - cgFont = CTFontCopyGraphicsFont((CTFontRef)wxfont->OSXGetCTFont(), NULL); -#else - ATSFontRef fontRef; - - fontRef = FMGetATSFontRefFromFont(wxfont->MacGetATSUFontID()); - - if (fontRef) - cgFont = CGFontCreateWithPlatformFont((void*)&fontRef); -#endif + CGFontRef cgFont = font->platformData().cgFont(); CGContextSetFont(cgContext, cgFont); @@ -89,26 +70,7 @@ void drawTextWithSpacing(GraphicsContext* graphicsContext, const SimpleFontData* CGContextSetTextPosition(cgContext, point.x(), point.y()); - const FloatSize* advanceSizes = static_cast<const FloatSize*>(glyphBuffer.advances(from)); - int size = glyphBuffer.size() - from; - CGSize sizes[size]; - CGGlyph glyphs[numGlyphs]; - - // if the function doesn't exist, we're probably on tiger and need to grab the - // function under its old name, CGFontGetGlyphsForUnicodes - if (!CGFontGetGlyphsForUnichars) - CGFontGetGlyphsForUnichars = (CGFontGetGlyphsForUnicharsPtr)dlsym(RTLD_DEFAULT, "CGFontGetGlyphsForUnicodes"); - - // Let's make sure we got the function under one name or another! - ASSERT(CGFontGetGlyphsForUnichars); - CGFontGetGlyphsForUnichars(cgFont, glyphBuffer.glyphs(from), glyphs, numGlyphs); - - for (int i = 0; i < size; i++) { - FloatSize fsize = advanceSizes[i]; - sizes[i] = CGSizeMake(fsize.width(), fsize.height()); - } - - CGContextShowGlyphsWithAdvances(cgContext, glyphs, sizes, numGlyphs); + CGContextShowGlyphsWithAdvances(cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs); if (cgFont) CGFontRelease(cgFont); diff --git a/WebCore/platform/wx/wxcode/win/fontprops.cpp b/WebCore/platform/wx/wxcode/win/fontprops.cpp index d6ba964..f3e4fda 100644 --- a/WebCore/platform/wx/wxcode/win/fontprops.cpp +++ b/WebCore/platform/wx/wxcode/win/fontprops.cpp @@ -66,7 +66,7 @@ m_ascent(0), m_descent(0), m_lineGap(0), m_lineSpacing(0), m_xHeight(0) ReleaseDC(0, dc); } -bool wxFontContainsCharacters(const wxFont& font, const UChar* characters, int length) +bool wxFontContainsCharacters(void* font, const UChar* characters, int length) { // FIXME: Microsoft documentation seems to imply that characters can be output using a given font and DC // merely by testing code page intersection. This seems suspect though. Can't a font only partially @@ -89,7 +89,7 @@ bool wxFontContainsCharacters(const wxFont& font, const UChar* characters, int l langFontLink->CodePageToCodePages(CP_ACP, &acpCodePages); DWORD fontCodePages; - langFontLink->GetFontCodePages(dc, static_cast<HFONT>(font.GetHFONT()), &fontCodePages); + langFontLink->GetFontCodePages(dc, (HFONT)font, &fontCodePages); DWORD actualCodePages; long numCharactersProcessed; diff --git a/WebCore/plugins/PluginPackage.h b/WebCore/plugins/PluginPackage.h index aa2d272..4fc9341 100644 --- a/WebCore/plugins/PluginPackage.h +++ b/WebCore/plugins/PluginPackage.h @@ -55,7 +55,7 @@ namespace WebCore { const String& path() const { return m_path; } const String& fileName() const { return m_fileName; } const String& parentDirectory() const { return m_parentDirectory; } - uint16 NPVersion() const; + uint16_t NPVersion() const; time_t lastModified() const { return m_lastModified; } const MIMEToDescriptionsMap& mimeToDescriptions() const { return m_mimeToDescriptions; } diff --git a/WebCore/plugins/PluginStream.cpp b/WebCore/plugins/PluginStream.cpp index 9bd497a..bdf7a40 100644 --- a/WebCore/plugins/PluginStream.cpp +++ b/WebCore/plugins/PluginStream.cpp @@ -336,13 +336,13 @@ void PluginStream::deliverData() if (!m_stream.ndata || m_deliveryData->size() == 0) return; - int32 totalBytes = m_deliveryData->size(); - int32 totalBytesDelivered = 0; + int32_t totalBytes = m_deliveryData->size(); + int32_t totalBytesDelivered = 0; if (m_loader) m_loader->setDefersLoading(true); while (totalBytesDelivered < totalBytes) { - int32 deliveryBytes = m_pluginFuncs->writeready(m_instance, &m_stream); + int32_t deliveryBytes = m_pluginFuncs->writeready(m_instance, &m_stream); if (deliveryBytes <= 0) { #if PLATFORM(ANDROID) @@ -359,7 +359,7 @@ void PluginStream::deliverData() break; } else { deliveryBytes = min(deliveryBytes, totalBytes - totalBytesDelivered); - int32 dataLength = deliveryBytes; + int32_t dataLength = deliveryBytes; char* data = m_deliveryData->data() + totalBytesDelivered; // Write the data diff --git a/WebCore/plugins/PluginStream.h b/WebCore/plugins/PluginStream.h index c0487e3..b937ff0 100644 --- a/WebCore/plugins/PluginStream.h +++ b/WebCore/plugins/PluginStream.h @@ -111,8 +111,8 @@ namespace WebCore { const NPPluginFuncs* m_pluginFuncs; NPP m_instance; - uint16 m_transferMode; - int32 m_offset; + uint16_t m_transferMode; + int32_t m_offset; WTF::CString m_headers; WTF::CString m_path; NPReason m_reason; diff --git a/WebCore/plugins/PluginView.cpp b/WebCore/plugins/PluginView.cpp index 889afe0..b9eca2a 100644 --- a/WebCore/plugins/PluginView.cpp +++ b/WebCore/plugins/PluginView.cpp @@ -377,7 +377,7 @@ void PluginView::stop() WNDPROC currentWndProc = (WNDPROC)GetWindowLongPtr(platformPluginWidget(), GWLP_WNDPROC); if (currentWndProc == PluginViewWndProc) - SetWindowLongPtr(platformPluginWidget(), GWLP_WNDPROC, (LONG)m_pluginWndProc); + SetWindowLongPtr(platformPluginWidget(), GWLP_WNDPROC, (LONG_PTR)m_pluginWndProc); #endif } #endif // XP_WIN @@ -638,12 +638,12 @@ NPError PluginView::getURL(const char* url, const char* target) return load(frameLoadRequest, false, 0); } -NPError PluginView::postURLNotify(const char* url, const char* target, uint32 len, const char* buf, NPBool file, void* notifyData) +NPError PluginView::postURLNotify(const char* url, const char* target, uint32_t len, const char* buf, NPBool file, void* notifyData) { return handlePost(url, target, len, buf, file, notifyData, true, true); } -NPError PluginView::postURL(const char* url, const char* target, uint32 len, const char* buf, NPBool file) +NPError PluginView::postURL(const char* url, const char* target, uint32_t len, const char* buf, NPBool file) { // As documented, only allow headers to be specified via NPP_PostURL when using a file. return handlePost(url, target, len, buf, file, 0, false, file); @@ -656,7 +656,7 @@ NPError PluginView::newStream(NPMIMEType type, const char* target, NPStream** st return NPERR_GENERIC_ERROR; } -int32 PluginView::write(NPStream* stream, int32 len, void* buffer) +int32_t PluginView::write(NPStream* stream, int32_t len, void* buffer) { notImplemented(); // Unsupported @@ -1234,7 +1234,7 @@ static inline HTTPHeaderMap parseRFC822HeaderFields(const Vector<char>& buffer, return headerFields; } -NPError PluginView::handlePost(const char* url, const char* target, uint32 len, const char* buf, bool file, void* notifyData, bool sendNotification, bool allowHeaders) +NPError PluginView::handlePost(const char* url, const char* target, uint32_t len, const char* buf, bool file, void* notifyData, bool sendNotification, bool allowHeaders) { if (!url || !len || !buf) return NPERR_INVALID_PARAM; @@ -1409,7 +1409,6 @@ void PluginView::keepAlive(NPP instance) view->keepAlive(); } -#endif NPError PluginView::getValueStatic(NPNVariable variable, void* value) { @@ -1434,7 +1433,6 @@ NPError PluginView::getValue(NPNVariable variable, void* value) return result; switch (variable) { -#if ENABLE(NETSCAPE_PLUGIN_API) case NPNVWindowNPObject: { if (m_isJavaScriptPaused) return NPERR_GENERIC_ERROR; @@ -1469,7 +1467,6 @@ NPError PluginView::getValue(NPNVariable variable, void* value) return NPERR_NO_ERROR; } -#endif case NPNVprivateModeBool: { Page* page = m_parentFrame->page(); @@ -1483,6 +1480,7 @@ NPError PluginView::getValue(NPNVariable variable, void* value) return NPERR_GENERIC_ERROR; } } +#endif void PluginView::privateBrowsingStateChanged(bool privateBrowsingEnabled) { diff --git a/WebCore/plugins/PluginView.h b/WebCore/plugins/PluginView.h index d769581..6042b0f 100644 --- a/WebCore/plugins/PluginView.h +++ b/WebCore/plugins/PluginView.h @@ -149,18 +149,19 @@ namespace WebCore { // NPN functions NPError getURLNotify(const char* url, const char* target, void* notifyData); NPError getURL(const char* url, const char* target); - NPError postURLNotify(const char* url, const char* target, uint32 len, const char* but, NPBool file, void* notifyData); - NPError postURL(const char* url, const char* target, uint32 len, const char* but, NPBool file); + NPError postURLNotify(const char* url, const char* target, uint32_t len, const char* but, NPBool file, void* notifyData); + NPError postURL(const char* url, const char* target, uint32_t len, const char* but, NPBool file); NPError newStream(NPMIMEType type, const char* target, NPStream** stream); - int32 write(NPStream* stream, int32 len, void* buffer); + int32_t write(NPStream* stream, int32_t len, void* buffer); NPError destroyStream(NPStream* stream, NPReason reason); const char* userAgent(); #if ENABLE(NETSCAPE_PLUGIN_API) static const char* userAgentStatic(); #endif void status(const char* message); - NPError getValue(NPNVariable variable, void* value); + #if ENABLE(NETSCAPE_PLUGIN_API) + NPError getValue(NPNVariable variable, void* value); static NPError getValueStatic(NPNVariable variable, void* value); #endif NPError setValue(NPPVariable variable, void* value); @@ -189,7 +190,7 @@ namespace WebCore { // Widget functions virtual void setFrameRect(const IntRect&); virtual void frameRectsChanged(); - virtual void setFocus(); + virtual void setFocus(bool); virtual void show(); virtual void hide(); virtual void paint(GraphicsContext*, const IntRect&); @@ -260,8 +261,8 @@ namespace WebCore { void platformDestroy(); static void setCurrentPluginView(PluginView*); NPError load(const FrameLoadRequest&, bool sendNotification, void* notifyData); - NPError handlePost(const char* url, const char* target, uint32 len, const char* buf, bool file, void* notifyData, bool sendNotification, bool allowHeaders); - NPError handlePostReadFile(Vector<char>& buffer, uint32 len, const char* buf); + NPError handlePost(const char* url, const char* target, uint32_t len, const char* buf, bool file, void* notifyData, bool sendNotification, bool allowHeaders); + NPError handlePostReadFile(Vector<char>& buffer, uint32_t len, const char* buf); static void freeStringArray(char** stringArray, int length); void setCallingPlugin(bool) const; diff --git a/WebCore/plugins/PluginViewNone.cpp b/WebCore/plugins/PluginViewNone.cpp index bb27357..d7b03ca 100644 --- a/WebCore/plugins/PluginViewNone.cpp +++ b/WebCore/plugins/PluginViewNone.cpp @@ -30,7 +30,7 @@ using namespace WTF; namespace WebCore { -void PluginView::setFocus() +void PluginView::setFocus(bool) { } @@ -62,17 +62,17 @@ void PluginView::setNPWindowRect(const IntRect&) { } -NPError PluginView::handlePostReadFile(Vector<char>&, uint32, const char*) +NPError PluginView::handlePostReadFile(Vector<char>&, uint32_t, const char*) { return 0; } +#if ENABLE(NETSCAPE_PLUGIN_API) bool PluginView::platformGetValue(NPNVariable, void*, NPError*) { return false; } -#if ENABLE(NETSCAPE_PLUGIN_API) bool PluginView::platformGetValueStatic(NPNVariable, void*, NPError*) { return false; @@ -126,6 +126,7 @@ void PluginView::keepAlive(NPP) } #endif +#if PLATFORM(MAC) || PLATFORM(CHROMIUM) || PLATFORM(EFL) void PluginView::privateBrowsingStateChanged(bool) { } @@ -133,6 +134,7 @@ void PluginView::privateBrowsingStateChanged(bool) void PluginView::setJavaScriptPaused(bool) { } +#endif #if defined(XP_UNIX) && ENABLE(NETSCAPE_PLUGIN_API) void PluginView::handleFocusInEvent() diff --git a/WebCore/plugins/gtk/PluginPackageGtk.cpp b/WebCore/plugins/gtk/PluginPackageGtk.cpp index d975666..97553a1 100644 --- a/WebCore/plugins/gtk/PluginPackageGtk.cpp +++ b/WebCore/plugins/gtk/PluginPackageGtk.cpp @@ -168,7 +168,7 @@ abort: return false; } -uint16 PluginPackage::NPVersion() const +uint16_t PluginPackage::NPVersion() const { return NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL; } diff --git a/WebCore/plugins/gtk/PluginViewGtk.cpp b/WebCore/plugins/gtk/PluginViewGtk.cpp index 8de63e0..400ba6f 100644 --- a/WebCore/plugins/gtk/PluginViewGtk.cpp +++ b/WebCore/plugins/gtk/PluginViewGtk.cpp @@ -148,10 +148,10 @@ void PluginView::updatePluginWidget() setNPWindowIfNeeded(); } -void PluginView::setFocus() +void PluginView::setFocus(bool focused) { ASSERT(platformPluginWidget() == platformWidget()); - Widget::setFocus(); + Widget::setFocus(focused); } void PluginView::show() @@ -558,7 +558,7 @@ void PluginView::setParentVisible(bool visible) } } -NPError PluginView::handlePostReadFile(Vector<char>& buffer, uint32 len, const char* buf) +NPError PluginView::handlePostReadFile(Vector<char>& buffer, uint32_t len, const char* buf) { String filename(buf, len); @@ -592,9 +592,9 @@ bool PluginView::platformGetValueStatic(NPNVariable variable, void* value, NPErr switch (variable) { case NPNVToolkit: #if defined(XP_UNIX) - *static_cast<uint32*>(value) = 2; + *static_cast<uint32_t*>(value) = 2; #else - *static_cast<uint32*>(value) = 0; + *static_cast<uint32_t*>(value) = 0; #endif *result = NPERR_NO_ERROR; return true; diff --git a/WebCore/plugins/mac/PluginPackageMac.cpp b/WebCore/plugins/mac/PluginPackageMac.cpp index 9a297de..865ea32 100644 --- a/WebCore/plugins/mac/PluginPackageMac.cpp +++ b/WebCore/plugins/mac/PluginPackageMac.cpp @@ -300,7 +300,7 @@ abort: return false; } -uint16 PluginPackage::NPVersion() const +uint16_t PluginPackage::NPVersion() const { return NP_VERSION_MINOR; } diff --git a/WebCore/plugins/mac/PluginViewMac.cpp b/WebCore/plugins/mac/PluginViewMac.cpp index 1fd4676..562e975 100644 --- a/WebCore/plugins/mac/PluginViewMac.cpp +++ b/WebCore/plugins/mac/PluginViewMac.cpp @@ -254,7 +254,7 @@ bool PluginView::platformGetValueStatic(NPNVariable variable, void* value, NPErr { switch (variable) { case NPNVToolkit: - *static_cast<uint32*>(value) = 0; + *static_cast<uint32_t*>(value) = 0; *result = NPERR_NO_ERROR; return true; @@ -332,9 +332,13 @@ void PluginView::hide() Widget::hide(); } -void PluginView::setFocus() +void PluginView::setFocus(bool focused) { - LOG(Plugins, "PluginView::setFocus()"); + LOG(Plugins, "PluginView::setFocus(%d)", focused); + if (!focused) { + Widget::setFocus(focused); + return; + } if (platformPluginWidget()) #if PLATFORM(QT) @@ -343,7 +347,7 @@ void PluginView::setFocus() platformPluginWidget()->SetFocus(); #endif else - Widget::setFocus(); + Widget::setFocus(focused); // TODO: Also handle and pass on blur events (focus lost) @@ -356,7 +360,7 @@ void PluginView::setFocus() record.modifiers = GetCurrentKeyModifiers(); if (!dispatchNPEvent(record)) - LOG(Events, "PluginView::setFocus(): Get-focus event not accepted"); + LOG(Events, "PluginView::setFocus(%d): Focus event not accepted", focused); #endif } @@ -794,7 +798,7 @@ bool PluginView::dispatchNPEvent(NPEvent& event) // ------------------- Miscellaneous ------------------ -NPError PluginView::handlePostReadFile(Vector<char>& buffer, uint32 len, const char* buf) +NPError PluginView::handlePostReadFile(Vector<char>& buffer, uint32_t len, const char* buf) { String filename(buf, len); diff --git a/WebCore/plugins/npapi.cpp b/WebCore/plugins/npapi.cpp index 05d7c06..d5ab757 100644 --- a/WebCore/plugins/npapi.cpp +++ b/WebCore/plugins/npapi.cpp @@ -43,7 +43,7 @@ static PluginView* pluginViewForInstance(NPP instance) return PluginView::currentPluginView(); } -void* NPN_MemAlloc(uint32 size) +void* NPN_MemAlloc(uint32_t size) { return malloc(size); } @@ -53,7 +53,7 @@ void NPN_MemFree(void* ptr) free(ptr); } -uint32 NPN_MemFlush(uint32 size) +uint32_t NPN_MemFlush(uint32_t size) { // Do nothing return 0; @@ -79,12 +79,12 @@ NPError NPN_GetURL(NPP instance, const char* url, const char* target) return pluginViewForInstance(instance)->getURL(url, target); } -NPError NPN_PostURLNotify(NPP instance, const char* url, const char* target, uint32 len, const char* buf, NPBool file, void* notifyData) +NPError NPN_PostURLNotify(NPP instance, const char* url, const char* target, uint32_t len, const char* buf, NPBool file, void* notifyData) { return pluginViewForInstance(instance)->postURLNotify(url, target, len, buf, file, notifyData); } -NPError NPN_PostURL(NPP instance, const char* url, const char* target, uint32 len, const char* buf, NPBool file) +NPError NPN_PostURL(NPP instance, const char* url, const char* target, uint32_t len, const char* buf, NPBool file) { return pluginViewForInstance(instance)->postURL(url, target, len, buf, file); } @@ -94,7 +94,7 @@ NPError NPN_NewStream(NPP instance, NPMIMEType type, const char* target, NPStrea return pluginViewForInstance(instance)->newStream(type, target, stream); } -int32 NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer) +int32_t NPN_Write(NPP instance, NPStream* stream, int32_t len, void* buffer) { return pluginViewForInstance(instance)->write(stream, len, buffer); } diff --git a/WebCore/plugins/npfunctions.h b/WebCore/plugins/npfunctions.h index 8bf5acb..675ccb9 100644 --- a/WebCore/plugins/npfunctions.h +++ b/WebCore/plugins/npfunctions.h @@ -43,16 +43,16 @@ extern "C" { #endif typedef NPError (*NPN_GetURLNotifyProcPtr)(NPP instance, const char* URL, const char* window, void* notifyData); -typedef NPError (*NPN_PostURLNotifyProcPtr)(NPP instance, const char* URL, const char* window, uint32 len, const char* buf, NPBool file, void* notifyData); +typedef NPError (*NPN_PostURLNotifyProcPtr)(NPP instance, const char* URL, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData); typedef NPError (*NPN_RequestReadProcPtr)(NPStream* stream, NPByteRange* rangeList); typedef NPError (*NPN_NewStreamProcPtr)(NPP instance, NPMIMEType type, const char* window, NPStream** stream); -typedef int32 (*NPN_WriteProcPtr)(NPP instance, NPStream* stream, int32 len, void* buffer); +typedef int32_t (*NPN_WriteProcPtr)(NPP instance, NPStream* stream, int32_t len, void* buffer); typedef NPError (*NPN_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason); typedef void (*NPN_StatusProcPtr)(NPP instance, const char* message); typedef const char*(*NPN_UserAgentProcPtr)(NPP instance); -typedef void* (*NPN_MemAllocProcPtr)(uint32 size); +typedef void* (*NPN_MemAllocProcPtr)(uint32_t size); typedef void (*NPN_MemFreeProcPtr)(void* ptr); -typedef uint32 (*NPN_MemFlushProcPtr)(uint32 size); +typedef uint32_t (*NPN_MemFlushProcPtr)(uint32_t size); typedef void (*NPN_ReloadPluginsProcPtr)(NPBool reloadPages); typedef NPError (*NPN_GetValueProcPtr)(NPP instance, NPNVariable variable, void *ret_value); typedef NPError (*NPN_SetValueProcPtr)(NPP instance, NPPVariable variable, void *value); @@ -60,18 +60,18 @@ typedef void (*NPN_InvalidateRectProcPtr)(NPP instance, NPRect *rect); typedef void (*NPN_InvalidateRegionProcPtr)(NPP instance, NPRegion region); typedef void (*NPN_ForceRedrawProcPtr)(NPP instance); typedef NPError (*NPN_GetURLProcPtr)(NPP instance, const char* URL, const char* window); -typedef NPError (*NPN_PostURLProcPtr)(NPP instance, const char* URL, const char* window, uint32 len, const char* buf, NPBool file); +typedef NPError (*NPN_PostURLProcPtr)(NPP instance, const char* URL, const char* window, uint32_t len, const char* buf, NPBool file); typedef void* (*NPN_GetJavaEnvProcPtr)(void); typedef void* (*NPN_GetJavaPeerProcPtr)(NPP instance); typedef void (*NPN_PushPopupsEnabledStateProcPtr)(NPP instance, NPBool enabled); typedef void (*NPN_PopPopupsEnabledStateProcPtr)(NPP instance); typedef void (*NPN_PluginThreadAsyncCallProcPtr)(NPP npp, void (*func)(void *), void *userData); -typedef NPError (*NPN_GetValueForURLProcPtr)(NPP npp, NPNURLVariable variable, const char* url, char** value, uint32* len); -typedef NPError (*NPN_SetValueForURLProcPtr)(NPP npp, NPNURLVariable variable, const char* url, const char* value, uint32 len); -typedef NPError (*NPN_GetAuthenticationInfoProcPtr)(NPP npp, const char* protocol, const char* host, int32 port, const char* scheme, const char *realm, char** username, uint32* ulen, char** password, uint32* plen); +typedef NPError (*NPN_GetValueForURLProcPtr)(NPP npp, NPNURLVariable variable, const char* url, char** value, uint32_t* len); +typedef NPError (*NPN_SetValueForURLProcPtr)(NPP npp, NPNURLVariable variable, const char* url, const char* value, uint32_t len); +typedef NPError (*NPN_GetAuthenticationInfoProcPtr)(NPP npp, const char* protocol, const char* host, int32_t port, const char* scheme, const char *realm, char** username, uint32_t* ulen, char** password, uint32_t* plen); -typedef uint32 (*NPN_ScheduleTimerProcPtr)(NPP npp, uint32 interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32 timerID)); -typedef void (*NPN_UnscheduleTimerProcPtr)(NPP npp, uint32 timerID); +typedef uint32_t (*NPN_ScheduleTimerProcPtr)(NPP npp, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID)); +typedef void (*NPN_UnscheduleTimerProcPtr)(NPP npp, uint32_t timerID); typedef NPError (*NPN_PopUpContextMenuProcPtr)(NPP instance, NPMenu* menu); typedef NPBool (*NPN_ConvertPointProcPtr)(NPP npp, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace); @@ -99,16 +99,16 @@ typedef void (*NPN_SetExceptionProcPtr) (NPObject *obj, const NPUTF8 *message); typedef bool (*NPN_EnumerateProcPtr) (NPP npp, NPObject *npobj, NPIdentifier **identifier, uint32_t *count); typedef bool (*NPN_ConstructProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result); -typedef NPError (*NPP_NewProcPtr)(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved); +typedef NPError (*NPP_NewProcPtr)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved); typedef NPError (*NPP_DestroyProcPtr)(NPP instance, NPSavedData** save); typedef NPError (*NPP_SetWindowProcPtr)(NPP instance, NPWindow* window); -typedef NPError (*NPP_NewStreamProcPtr)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype); +typedef NPError (*NPP_NewStreamProcPtr)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype); typedef NPError (*NPP_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason); typedef void (*NPP_StreamAsFileProcPtr)(NPP instance, NPStream* stream, const char* fname); -typedef int32 (*NPP_WriteReadyProcPtr)(NPP instance, NPStream* stream); -typedef int32 (*NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer); +typedef int32_t (*NPP_WriteReadyProcPtr)(NPP instance, NPStream* stream); +typedef int32_t (*NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer); typedef void (*NPP_PrintProcPtr)(NPP instance, NPPrint* platformPrint); -typedef int16 (*NPP_HandleEventProcPtr)(NPP instance, void* event); +typedef int16_t (*NPP_HandleEventProcPtr)(NPP instance, void* event); typedef void (*NPP_URLNotifyProcPtr)(NPP instance, const char* URL, NPReason reason, void* notifyData); typedef NPError (*NPP_GetValueProcPtr)(NPP instance, NPPVariable variable, void *ret_value); typedef NPError (*NPP_SetValueProcPtr)(NPP instance, NPNVariable variable, void *value); @@ -117,8 +117,8 @@ typedef void *(*NPP_GetJavaClassProcPtr)(void); typedef void* JRIGlobalRef; //not using this right now typedef struct _NPNetscapeFuncs { - uint16 size; - uint16 version; + uint16_t size; + uint16_t version; NPN_GetURLProcPtr geturl; NPN_PostURLProcPtr posturl; @@ -176,8 +176,8 @@ typedef struct _NPNetscapeFuncs { } NPNetscapeFuncs; typedef struct _NPPluginFuncs { - uint16 size; - uint16 version; + uint16_t size; + uint16_t version; NPP_NewProcPtr newp; NPP_DestroyProcPtr destroy; NPP_SetWindowProcPtr setwindow; diff --git a/WebCore/plugins/qt/PluginPackageQt.cpp b/WebCore/plugins/qt/PluginPackageQt.cpp index 018c64f..5694148 100644 --- a/WebCore/plugins/qt/PluginPackageQt.cpp +++ b/WebCore/plugins/qt/PluginPackageQt.cpp @@ -83,7 +83,7 @@ bool PluginPackage::fetchInfo() static NPError staticPluginQuirkRequiresGtkToolKit_NPN_GetValue(NPP instance, NPNVariable variable, void* value) { if (variable == NPNVToolkit) { - *static_cast<uint32*>(value) = 2; + *static_cast<uint32_t*>(value) = 2; return NPERR_NO_ERROR; } @@ -143,7 +143,7 @@ abort: return false; } -uint16 PluginPackage::NPVersion() const +uint16_t PluginPackage::NPVersion() const { return NP_VERSION_MINOR; } diff --git a/WebCore/plugins/qt/PluginViewQt.cpp b/WebCore/plugins/qt/PluginViewQt.cpp index fb88b87..ff52070 100644 --- a/WebCore/plugins/qt/PluginViewQt.cpp +++ b/WebCore/plugins/qt/PluginViewQt.cpp @@ -134,12 +134,14 @@ void PluginView::updatePluginWidget() invalidate(); } -void PluginView::setFocus() +void PluginView::setFocus(bool focused) { - if (platformPluginWidget()) - platformPluginWidget()->setFocus(Qt::OtherFocusReason); - else - Widget::setFocus(); + if (platformPluginWidget()) { + if (focused) + platformPluginWidget()->setFocus(Qt::OtherFocusReason); + } else { + Widget::setFocus(focused); + } } void PluginView::show() @@ -527,7 +529,7 @@ void PluginView::setParentVisible(bool visible) platformPluginWidget()->setVisible(visible); } -NPError PluginView::handlePostReadFile(Vector<char>& buffer, uint32 len, const char* buf) +NPError PluginView::handlePostReadFile(Vector<char>& buffer, uint32_t len, const char* buf) { String filename(buf, len); @@ -557,7 +559,7 @@ bool PluginView::platformGetValueStatic(NPNVariable variable, void* value, NPErr { switch (variable) { case NPNVToolkit: - *static_cast<uint32*>(value) = 0; + *static_cast<uint32_t*>(value) = 0; *result = NPERR_NO_ERROR; return true; @@ -603,7 +605,7 @@ bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* re case NPNVToolkit: if (m_plugin->quirks().contains(PluginQuirkRequiresGtkToolKit)) { - *((uint32 *)value) = 2; + *((uint32_t *)value) = 2; *result = NPERR_NO_ERROR; return true; } diff --git a/WebCore/plugins/symbian/PluginPackageSymbian.cpp b/WebCore/plugins/symbian/PluginPackageSymbian.cpp index d30f80e..7fca625 100644 --- a/WebCore/plugins/symbian/PluginPackageSymbian.cpp +++ b/WebCore/plugins/symbian/PluginPackageSymbian.cpp @@ -174,7 +174,7 @@ void PluginPackage::unload() m_pluginLoader = 0; } -uint16 PluginPackage::NPVersion() const +uint16_t PluginPackage::NPVersion() const { return NP_VERSION_MINOR; } diff --git a/WebCore/plugins/symbian/PluginViewSymbian.cpp b/WebCore/plugins/symbian/PluginViewSymbian.cpp index bae3b7f..361f946 100644 --- a/WebCore/plugins/symbian/PluginViewSymbian.cpp +++ b/WebCore/plugins/symbian/PluginViewSymbian.cpp @@ -101,12 +101,14 @@ void PluginView::updatePluginWidget() setNPWindowIfNeeded(); } -void PluginView::setFocus() +void PluginView::setFocus(bool focused) { - if (platformPluginWidget()) - platformPluginWidget()->setFocus(Qt::OtherFocusReason); - else - Widget::setFocus(); + if (platformPluginWidget()) { + if (focused) + platformPluginWidget()->setFocus(Qt::OtherFocusReason); + } else { + Widget::setFocus(focused); + } } void PluginView::show() @@ -304,7 +306,7 @@ void PluginView::setParentVisible(bool visible) platformPluginWidget()->setVisible(visible); } -NPError PluginView::handlePostReadFile(Vector<char>& buffer, uint32 len, const char* buf) +NPError PluginView::handlePostReadFile(Vector<char>& buffer, uint32_t len, const char* buf) { notImplemented(); return NPERR_NO_ERROR; @@ -414,11 +416,11 @@ bool PluginView::platformStart() void PluginView::platformDestroy() { - QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient(); - if (client && qobject_cast<QGraphicsWebView*>(client->pluginParent())) - delete static_cast<PluginContainerSymbian*>(platformPluginWidget())->proxy(); - else - delete platformPluginWidget(); + if (platformPluginWidget()) { + PluginContainerSymbian* container = static_cast<PluginContainerSymbian*>(platformPluginWidget()); + delete container->proxy(); + delete container; + } } void PluginView::halt() diff --git a/WebCore/plugins/win/PluginPackageWin.cpp b/WebCore/plugins/win/PluginPackageWin.cpp index e70c2c2..80dea93 100644 --- a/WebCore/plugins/win/PluginPackageWin.cpp +++ b/WebCore/plugins/win/PluginPackageWin.cpp @@ -335,7 +335,7 @@ bool PluginPackage::equal(const PluginPackage& a, const PluginPackage& b) return true; } -uint16 PluginPackage::NPVersion() const +uint16_t PluginPackage::NPVersion() const { return NP_VERSION_MINOR; } diff --git a/WebCore/plugins/win/PluginViewWin.cpp b/WebCore/plugins/win/PluginViewWin.cpp index 01e425f..96fa9e4 100644 --- a/WebCore/plugins/win/PluginViewWin.cpp +++ b/WebCore/plugins/win/PluginViewWin.cpp @@ -140,7 +140,7 @@ static BYTE* endPaint; typedef HDC (WINAPI *PtrBeginPaint)(HWND, PAINTSTRUCT*); typedef BOOL (WINAPI *PtrEndPaint)(HWND, const PAINTSTRUCT*); -#if OS(WINDOWS) && PLATFORM(X86_64) && COMPILER(MSVC) +#if OS(WINDOWS) && CPU(X86_64) && COMPILER(MSVC) extern "C" HDC __stdcall _HBeginPaint(HWND hWnd, LPPAINTSTRUCT lpPaint); extern "C" BOOL __stdcall _HEndPaint(HWND hWnd, const PAINTSTRUCT* lpPaint); #endif @@ -463,12 +463,12 @@ void PluginView::updatePluginWidget() } } -void PluginView::setFocus() +void PluginView::setFocus(bool focused) { - if (platformPluginWidget()) + if (focused && platformPluginWidget()) SetFocus(platformPluginWidget()); - Widget::setFocus(); + Widget::setFocus(focused); } void PluginView::show() @@ -544,7 +544,7 @@ void PluginView::paintIntoTransformedContext(HDC hdc) NPEvent npEvent; npEvent.event = WM_WINDOWPOSCHANGED; - npEvent.lParam = reinterpret_cast<uint32>(&windowpos); + npEvent.lParam = reinterpret_cast<uintptr_t>(&windowpos); npEvent.wParam = 0; dispatchNPEvent(npEvent); @@ -552,7 +552,7 @@ void PluginView::paintIntoTransformedContext(HDC hdc) setNPWindowRect(frameRect()); npEvent.event = WM_PAINT; - npEvent.wParam = reinterpret_cast<uint32>(hdc); + npEvent.wParam = reinterpret_cast<uintptr_t>(hdc); // This is supposed to be a pointer to the dirty rect, but it seems that the Flash plugin // ignores it so we just pass null. @@ -829,12 +829,12 @@ void PluginView::setNPWindowRect(const IntRect& rect) #else WNDPROC currentWndProc = (WNDPROC)GetWindowLongPtr(platformPluginWidget(), GWLP_WNDPROC); if (currentWndProc != PluginViewWndProc) - m_pluginWndProc = (WNDPROC)SetWindowLongPtr(platformPluginWidget(), GWLP_WNDPROC, (LONG)PluginViewWndProc); + m_pluginWndProc = (WNDPROC)SetWindowLongPtr(platformPluginWidget(), GWLP_WNDPROC, (LONG_PTR)PluginViewWndProc); #endif } } -NPError PluginView::handlePostReadFile(Vector<char>& buffer, uint32 len, const char* buf) +NPError PluginView::handlePostReadFile(Vector<char>& buffer, uint32_t len, const char* buf) { String filename(buf, len); @@ -978,7 +978,7 @@ bool PluginView::platformStart() // Calling SetWindowLongPtrA here makes the window proc ASCII, which is required by at least // the Shockwave Director plug-in. -#if OS(WINDOWS) && PLATFORM(X86_64) && COMPILER(MSVC) +#if OS(WINDOWS) && CPU(X86_64) ::SetWindowLongPtrA(platformPluginWidget(), GWLP_WNDPROC, (LONG_PTR)DefWindowProcA); #elif OS(WINCE) ::SetWindowLong(platformPluginWidget(), GWL_WNDPROC, (LONG)DefWindowProc); diff --git a/WebCore/rendering/InlineBox.cpp b/WebCore/rendering/InlineBox.cpp index 2575fb7..213737c 100644 --- a/WebCore/rendering/InlineBox.cpp +++ b/WebCore/rendering/InlineBox.cpp @@ -102,7 +102,7 @@ int InlineBox::height() const const Font& font = renderer()->style(m_firstLine)->font(); int result = font.height(); if (parent()) - result += flowObject->borderTop() + flowObject->paddingTop() + flowObject->borderBottom() + flowObject->paddingBottom(); + result += flowObject->borderAndPaddingHeight(); return result; } diff --git a/WebCore/rendering/MediaControlElements.cpp b/WebCore/rendering/MediaControlElements.cpp index 569f214..16827f5 100644 --- a/WebCore/rendering/MediaControlElements.cpp +++ b/WebCore/rendering/MediaControlElements.cpp @@ -74,7 +74,7 @@ MediaControlShadowRootElement::MediaControlShadowRootElement(Document* document, renderer->setStyle(rootStyle.release()); setRenderer(renderer); setAttached(); - setInDocument(true); + setInDocument(); } void MediaControlShadowRootElement::updateStyle() @@ -92,7 +92,7 @@ MediaControlElement::MediaControlElement(Document* document, PseudoId pseudo, HT , m_mediaElement(mediaElement) , m_pseudoStyleId(pseudo) { - setInDocument(true); + setInDocument(); switch (pseudo) { case MEDIA_CONTROLS_CURRENT_TIME_DISPLAY: m_displayType = MediaCurrentTimeDisplay; @@ -318,7 +318,7 @@ MediaControlInputElement::MediaControlInputElement(Document* document, PseudoId , m_pseudoStyleId(pseudo) { setInputType(type); - setInDocument(true); + setInDocument(); switch (pseudo) { case MEDIA_CONTROLS_MUTE_BUTTON: diff --git a/WebCore/rendering/RenderApplet.cpp b/WebCore/rendering/RenderApplet.cpp index 062641e..7411c54 100644 --- a/WebCore/rendering/RenderApplet.cpp +++ b/WebCore/rendering/RenderApplet.cpp @@ -59,9 +59,9 @@ void RenderApplet::createWidgetIfNecessary() // use fixed widths/heights from the style system when we can, since the widget might // not have an accurate m_width/m_height. int contentWidth = style()->width().isFixed() ? style()->width().value() : - width() - borderLeft() - borderRight() - paddingLeft() - paddingRight(); + width() - borderAndPaddingWidth(); int contentHeight = style()->height().isFixed() ? style()->height().value() : - height() - borderTop() - borderBottom() - paddingTop() - paddingBottom(); + height() - borderAndPaddingHeight(); for (Node* child = element->firstChild(); child; child = child->nextSibling()) { if (child->hasTagName(paramTag)) { HTMLParamElement* p = static_cast<HTMLParamElement*>(child); diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp index 3f53456..cf4101b 100644 --- a/WebCore/rendering/RenderBlock.cpp +++ b/WebCore/rendering/RenderBlock.cpp @@ -589,10 +589,10 @@ bool RenderBlock::isSelfCollapsingBlock() const // (c) have border/padding, // (d) have a min-height // (e) have specified that one of our margins can't collapse using a CSS extension - if (height() > 0 || - isTable() || (borderBottom() + paddingBottom() + borderTop() + paddingTop()) != 0 || - style()->minHeight().isPositive() || - style()->marginTopCollapse() == MSEPARATE || style()->marginBottomCollapse() == MSEPARATE) + if (height() > 0 + || isTable() || borderAndPaddingHeight() + || style()->minHeight().isPositive() + || style()->marginTopCollapse() == MSEPARATE || style()->marginBottomCollapse() == MSEPARATE) return false; bool hasAutoHeight = style()->height().isAuto(); @@ -4011,7 +4011,7 @@ void RenderBlock::calcPrefWidths() } int toAdd = 0; - toAdd = borderLeft() + borderRight() + paddingLeft() + paddingRight(); + toAdd = borderAndPaddingWidth(); if (hasOverflowClip() && style()->overflowY() == OSCROLL) toAdd += verticalScrollbarWidth(); diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp index bd82683..e38cf25 100644 --- a/WebCore/rendering/RenderBox.cpp +++ b/WebCore/rendering/RenderBox.cpp @@ -514,7 +514,7 @@ int RenderBox::overrideHeight() const int RenderBox::calcBorderBoxWidth(int width) const { - int bordersPlusPadding = borderLeft() + borderRight() + paddingLeft() + paddingRight(); + int bordersPlusPadding = borderAndPaddingWidth(); if (style()->boxSizing() == CONTENT_BOX) return width + bordersPlusPadding; return max(width, bordersPlusPadding); @@ -522,7 +522,7 @@ int RenderBox::calcBorderBoxWidth(int width) const int RenderBox::calcBorderBoxHeight(int height) const { - int bordersPlusPadding = borderTop() + borderBottom() + paddingTop() + paddingBottom(); + int bordersPlusPadding = borderAndPaddingHeight(); if (style()->boxSizing() == CONTENT_BOX) return height + bordersPlusPadding; return max(height, bordersPlusPadding); @@ -531,14 +531,14 @@ int RenderBox::calcBorderBoxHeight(int height) const int RenderBox::calcContentBoxWidth(int width) const { if (style()->boxSizing() == BORDER_BOX) - width -= (borderLeft() + borderRight() + paddingLeft() + paddingRight()); + width -= borderAndPaddingWidth(); return max(0, width); } int RenderBox::calcContentBoxHeight(int height) const { if (style()->boxSizing() == BORDER_BOX) - height -= (borderTop() + borderBottom() + paddingTop() + paddingBottom()); + height -= borderAndPaddingHeight(); return max(0, height); } @@ -635,34 +635,36 @@ void RenderBox::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty) return; } - int w = width(); - int h = height(); + return paintBoxDecorationsWithSize(paintInfo, tx, ty, width(), height()); +} +void RenderBox::paintBoxDecorationsWithSize(PaintInfo& paintInfo, int tx, int ty, int width, int height) +{ // border-fit can adjust where we paint our border and background. If set, we snugly fit our line box descendants. (The iChat // balloon layout is an example of this). - borderFitAdjust(tx, w); + borderFitAdjust(tx, width); // FIXME: Should eventually give the theme control over whether the box shadow should paint, since controls could have // custom shadows of their own. - paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Normal); + paintBoxShadow(paintInfo.context, tx, ty, width, height, style(), Normal); // If we have a native theme appearance, paint that before painting our background. // The theme will tell us whether or not we should also paint the CSS background. - bool themePainted = style()->hasAppearance() && !theme()->paint(this, paintInfo, IntRect(tx, ty, w, h)); + bool themePainted = style()->hasAppearance() && !theme()->paint(this, paintInfo, IntRect(tx, ty, width, height)); if (!themePainted) { // The <body> only paints its background if the root element has defined a background // independent of the body. Go through the DOM to get to the root element's render object, // since the root could be inline and wrapped in an anonymous block. if (!isBody() || document()->documentElement()->renderer()->style()->hasBackground()) - paintFillLayers(paintInfo, style()->backgroundColor(), style()->backgroundLayers(), tx, ty, w, h); + paintFillLayers(paintInfo, style()->backgroundColor(), style()->backgroundLayers(), tx, ty, width, height); if (style()->hasAppearance()) - theme()->paintDecorations(this, paintInfo, IntRect(tx, ty, w, h)); + theme()->paintDecorations(this, paintInfo, IntRect(tx, ty, width, height)); } - paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Inset); + paintBoxShadow(paintInfo.context, tx, ty, width, height, style(), Inset); // The theme will tell us whether or not we should also paint the CSS border. - if ((!style()->hasAppearance() || (!themePainted && theme()->paintBorderOnly(this, paintInfo, IntRect(tx, ty, w, h)))) && style()->hasBorder()) - paintBorder(paintInfo.context, tx, ty, w, h, style()); + if ((!style()->hasAppearance() || (!themePainted && theme()->paintBorderOnly(this, paintInfo, IntRect(tx, ty, width, height)))) && style()->hasBorder()) + paintBorder(paintInfo.context, tx, ty, width, height, style()); } void RenderBox::paintMask(PaintInfo& paintInfo, int tx, int ty) @@ -1318,8 +1320,12 @@ void RenderBox::calcWidth() if (treatAsReplaced) { #else if (treatAsReplaced) +<<<<<<< HEAD:WebCore/rendering/RenderBox.cpp #endif setWidth(max(w.value() + borderLeft() + borderRight() + paddingLeft() + paddingRight(), minPrefWidth())); +======= + setWidth(max(w.value() + borderAndPaddingWidth(), minPrefWidth())); +>>>>>>> webkit.org at r58956:WebCore/rendering/RenderBox.cpp #ifdef ANDROID_LAYOUT // in SSR mode with replaced box, if the box width is wider than the container width, @@ -1337,7 +1343,7 @@ void RenderBox::calcWidth() // Width calculations if (treatAsReplaced) - setWidth(w.value() + borderLeft() + borderRight() + paddingLeft() + paddingRight()); + setWidth(w.value() + borderAndPaddingWidth()); else { // Calculate Width setWidth(calcWidthUsing(Width, containerWidth)); @@ -1508,7 +1514,7 @@ void RenderBox::calcHeight() // grab our cached flexible height. if (hasOverrideSize() && parent()->isFlexibleBox() && parent()->style()->boxOrient() == VERTICAL && parent()->isFlexingChildren()) - h = Length(overrideSize() - borderTop() - borderBottom() - paddingTop() - paddingBottom(), Fixed); + h = Length(overrideSize() - borderAndPaddingHeight(), Fixed); else if (treatAsReplaced) h = Length(calcReplacedHeight(), Fixed); else { @@ -1519,8 +1525,7 @@ void RenderBox::calcHeight() // Block children of horizontal flexible boxes fill the height of the box. if (h.isAuto() && parent()->isFlexibleBox() && parent()->style()->boxOrient() == HORIZONTAL && parent()->isStretchingChildren()) { - h = Length(parentBox()->contentHeight() - marginTop() - marginBottom() - - borderTop() - paddingTop() - borderBottom() - paddingBottom(), Fixed); + h = Length(parentBox()->contentHeight() - marginTop() - marginBottom() - borderAndPaddingHeight(), Fixed); checkMinMaxHeight = false; } @@ -1545,7 +1550,7 @@ void RenderBox::calcHeight() // The only times we don't check min/max height are when a fixed length has // been given as an override. Just use that. The value has already been adjusted // for box-sizing. - heightResult = h.value() + borderTop() + borderBottom() + paddingTop() + paddingBottom(); + heightResult = h.value() + borderAndPaddingHeight(); } setHeight(heightResult); @@ -1564,9 +1569,7 @@ void RenderBox::calcHeight() if (isRoot()) setHeight(max(height(), visHeight - margins)); else { - int marginsBordersPadding = margins + parentBox()->marginTop() + parentBox()->marginBottom() - + parentBox()->borderTop() + parentBox()->borderBottom() - + parentBox()->paddingTop() + parentBox()->paddingBottom(); + int marginsBordersPadding = margins + parentBox()->marginTop() + parentBox()->marginBottom() + parentBox()->borderAndPaddingHeight(); setHeight(max(height(), visHeight - marginsBordersPadding)); } } @@ -1660,7 +1663,7 @@ int RenderBox::calcPercentageHeight(const Length& height) // It is necessary to use the border-box to match WinIE's broken // box model. This is essential for sizing inside // table cells using percentage heights. - result -= (borderTop() + paddingTop() + borderBottom() + paddingBottom()); + result -= borderAndPaddingHeight(); result = max(0, result); } } @@ -1733,8 +1736,7 @@ int RenderBox::calcReplacedHeightUsing(Length height) const // Don't let table cells squeeze percent-height replaced elements // <http://bugs.webkit.org/show_bug.cgi?id=15359> availableHeight = max(availableHeight, intrinsicSize().height()); - return height.calcValue(availableHeight - (borderTop() + borderBottom() - + paddingTop() + paddingBottom())); + return height.calcValue(availableHeight - borderAndPaddingHeight()); } return calcContentBoxHeight(height.calcValue(availableHeight)); @@ -1761,7 +1763,7 @@ int RenderBox::availableHeightUsing(const Length& h) const // artificially. We're going to rely on this cell getting expanded to some new // height, and then when we lay out again we'll use the calculation below. if (isTableCell() && (h.isAuto() || h.isPercent())) - return overrideSize() - (borderLeft() + borderRight() + paddingLeft() + paddingRight()); + return overrideSize() - borderAndPaddingWidth(); if (h.isPercent()) return calcContentBoxHeight(h.calcValue(containingBlock()->availableHeight())); @@ -1878,7 +1880,7 @@ void RenderBox::calcAbsoluteHorizontal() // instead of the the container block's. TextDirection containerDirection = (style()->htmlHacks()) ? parent()->style()->direction() : containerBlock->style()->direction(); - const int bordersPlusPadding = borderLeft() + borderRight() + paddingLeft() + paddingRight(); + const int bordersPlusPadding = borderAndPaddingWidth(); const Length marginLeft = style()->marginLeft(); const Length marginRight = style()->marginRight(); Length left = style()->left(); @@ -2187,7 +2189,7 @@ void RenderBox::calcAbsoluteVertical() const int containerHeight = containingBlockHeightForPositioned(containerBlock); - const int bordersPlusPadding = borderTop() + borderBottom() + paddingTop() + paddingBottom(); + const int bordersPlusPadding = borderAndPaddingHeight(); const Length marginTop = style()->marginTop(); const Length marginBottom = style()->marginBottom(); Length top = style()->top(); @@ -2428,7 +2430,7 @@ void RenderBox::calcAbsoluteHorizontalReplaced() // NOTE: This value of width is FINAL in that the min/max width calculations // are dealt with in calcReplacedWidth(). This means that the steps to produce // correct max/min in the non-replaced version, are not necessary. - setWidth(calcReplacedWidth() + borderLeft() + borderRight() + paddingLeft() + paddingRight()); + setWidth(calcReplacedWidth() + borderAndPaddingWidth()); const int availableSpace = containerWidth - width(); /*-----------------------------------------------------------------------*\ @@ -2601,7 +2603,7 @@ void RenderBox::calcAbsoluteVerticalReplaced() // NOTE: This value of height is FINAL in that the min/max height calculations // are dealt with in calcReplacedHeight(). This means that the steps to produce // correct max/min in the non-replaced version, are not necessary. - setHeight(calcReplacedHeight() + borderTop() + borderBottom() + paddingTop() + paddingBottom()); + setHeight(calcReplacedHeight() + borderAndPaddingHeight()); const int availableSpace = containerHeight - height(); /*-----------------------------------------------------------------------*\ @@ -2787,8 +2789,8 @@ VisiblePosition RenderBox::positionForPoint(const IntPoint& point) int yPos = point.y(); if (isTable() && node()) { - int right = contentWidth() + borderRight() + paddingRight() + borderLeft() + paddingLeft(); - int bottom = contentHeight() + borderTop() + paddingTop() + borderBottom() + paddingBottom(); + int right = contentWidth() + borderAndPaddingWidth(); + int bottom = contentHeight() + borderAndPaddingHeight(); if (xPos < 0 || xPos > right || yPos < 0 || yPos > bottom) { if (xPos <= right / 2) diff --git a/WebCore/rendering/RenderBox.h b/WebCore/rendering/RenderBox.h index 68bbd51..1c766aa 100644 --- a/WebCore/rendering/RenderBox.h +++ b/WebCore/rendering/RenderBox.h @@ -308,6 +308,7 @@ protected: void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, int tx, int ty, int width, int height, CompositeOperator op, RenderObject* backgroundObject); void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, int tx, int ty, int width, int height, CompositeOperator = CompositeSourceOver, RenderObject* backgroundObject = 0); + void paintBoxDecorationsWithSize(PaintInfo&, int tx, int ty, int width, int height); void paintMaskImages(const PaintInfo&, int tx, int ty, int width, int height); #if PLATFORM(MAC) diff --git a/WebCore/rendering/RenderBoxModelObject.h b/WebCore/rendering/RenderBoxModelObject.h index db7538d..a4cf54a 100644 --- a/WebCore/rendering/RenderBoxModelObject.h +++ b/WebCore/rendering/RenderBoxModelObject.h @@ -75,6 +75,9 @@ public: virtual int borderLeft() const { return style()->borderLeftWidth(); } virtual int borderRight() const { return style()->borderRightWidth(); } + int borderAndPaddingHeight() const { return borderTop() + borderBottom() + paddingTop() + paddingBottom(); } + int borderAndPaddingWidth() const { return borderLeft() + borderRight() + paddingLeft() + paddingRight(); } + virtual int marginTop() const = 0; virtual int marginBottom() const = 0; virtual int marginLeft() const = 0; diff --git a/WebCore/rendering/RenderDataGrid.cpp b/WebCore/rendering/RenderDataGrid.cpp index bdf723f..00cbd7c 100644 --- a/WebCore/rendering/RenderDataGrid.cpp +++ b/WebCore/rendering/RenderDataGrid.cpp @@ -111,7 +111,7 @@ void RenderDataGrid::calcPrefWidths() m_minPrefWidth = min(m_minPrefWidth, calcContentBoxWidth(style()->maxWidth().value())); } - int toAdd = paddingLeft() + paddingRight() + borderLeft() + borderRight(); + int toAdd = borderAndPaddingWidth(); m_minPrefWidth += toAdd; m_maxPrefWidth += toAdd; diff --git a/WebCore/rendering/RenderFieldset.cpp b/WebCore/rendering/RenderFieldset.cpp index d8cbd00..306e111 100644 --- a/WebCore/rendering/RenderFieldset.cpp +++ b/WebCore/rendering/RenderFieldset.cpp @@ -59,7 +59,7 @@ void RenderFieldset::calcPrefWidths() if (legendMarginRight.isFixed()) legendMinWidth += legendMarginRight.value(); - m_minPrefWidth = max(m_minPrefWidth, legendMinWidth + paddingLeft() + paddingRight() + borderLeft() + borderRight()); + m_minPrefWidth = max(m_minPrefWidth, legendMinWidth + borderAndPaddingWidth()); } } diff --git a/WebCore/rendering/RenderFileUploadControl.cpp b/WebCore/rendering/RenderFileUploadControl.cpp index 6a5c1e0..fa2a998 100644 --- a/WebCore/rendering/RenderFileUploadControl.cpp +++ b/WebCore/rendering/RenderFileUploadControl.cpp @@ -152,7 +152,7 @@ void RenderFileUploadControl::updateFromElement() renderer->setStyle(buttonStyle.release()); renderer->updateFromElement(); m_button->setAttached(); - m_button->setInDocument(true); + m_button->setInDocument(); addChild(renderer); } @@ -285,7 +285,7 @@ void RenderFileUploadControl::calcPrefWidths() m_minPrefWidth = min(m_minPrefWidth, calcContentBoxWidth(style()->maxWidth().value())); } - int toAdd = paddingLeft() + paddingRight() + borderLeft() + borderRight(); + int toAdd = borderAndPaddingWidth(); m_minPrefWidth += toAdd; m_maxPrefWidth += toAdd; diff --git a/WebCore/rendering/RenderFlexibleBox.cpp b/WebCore/rendering/RenderFlexibleBox.cpp index 6882097..d0222cb 100644 --- a/WebCore/rendering/RenderFlexibleBox.cpp +++ b/WebCore/rendering/RenderFlexibleBox.cpp @@ -195,7 +195,7 @@ void RenderFlexibleBox::calcPrefWidths() m_minPrefWidth = min(m_minPrefWidth, calcContentBoxWidth(style()->maxWidth().value())); } - int toAdd = borderLeft() + borderRight() + paddingLeft() + paddingRight(); + int toAdd = borderAndPaddingWidth(); if (hasOverflowClip() && style()->overflowY() == OSCROLL) toAdd += verticalScrollbarWidth(); @@ -1035,7 +1035,7 @@ int RenderFlexibleBox::allowedChildFlex(RenderBox* child, bool expanding, unsign if (isHorizontal()) { // FIXME: For now just handle fixed values. int maxW = INT_MAX; - int w = child->overrideWidth() - (child->borderLeft() + child->borderRight() + child->paddingLeft() + child->paddingRight()); + int w = child->overrideWidth() - child->borderAndPaddingWidth(); if (!child->style()->maxWidth().isUndefined() && child->style()->maxWidth().isFixed()) maxW = child->style()->maxWidth().value(); @@ -1049,7 +1049,7 @@ int RenderFlexibleBox::allowedChildFlex(RenderBox* child, bool expanding, unsign } else { // FIXME: For now just handle fixed values. int maxH = INT_MAX; - int h = child->overrideHeight() - (child->borderTop() + child->borderBottom() + child->paddingTop() + child->paddingBottom()); + int h = child->overrideHeight() - child->borderAndPaddingHeight(); if (!child->style()->maxHeight().isUndefined() && child->style()->maxHeight().isFixed()) maxH = child->style()->maxHeight().value(); @@ -1062,7 +1062,7 @@ int RenderFlexibleBox::allowedChildFlex(RenderBox* child, bool expanding, unsign // FIXME: For now just handle fixed values. if (isHorizontal()) { int minW = child->minPrefWidth(); - int w = child->overrideWidth() - (child->borderLeft() + child->borderRight() + child->paddingLeft() + child->paddingRight()); + int w = child->overrideWidth() - child->borderAndPaddingWidth(); if (child->style()->minWidth().isFixed()) minW = child->style()->minWidth().value(); else if (child->style()->minWidth().type() == Intrinsic) @@ -1075,7 +1075,7 @@ int RenderFlexibleBox::allowedChildFlex(RenderBox* child, bool expanding, unsign } else { if (child->style()->minHeight().isFixed()) { int minH = child->style()->minHeight().value(); - int h = child->overrideHeight() - (child->borderLeft() + child->borderRight() + child->paddingLeft() + child->paddingRight()); + int h = child->overrideHeight() - child->borderAndPaddingHeight(); int allowedShrinkage = min(0, minH - h); return allowedShrinkage; } diff --git a/WebCore/rendering/RenderIFrame.cpp b/WebCore/rendering/RenderIFrame.cpp index 5852468..90cac14 100644 --- a/WebCore/rendering/RenderIFrame.cpp +++ b/WebCore/rendering/RenderIFrame.cpp @@ -77,6 +77,8 @@ void RenderIFrame::calcHeight() if (isScrollable || !style()->height().isFixed()) { FrameView* view = static_cast<FrameView*>(widget()); + if (!view) + return; int border = borderTop() + borderBottom(); setHeight(max(height(), view->contentsHeight() + border)); } @@ -126,6 +128,8 @@ void RenderIFrame::calcWidth() if (isScrollable || !style()->width().isFixed()) { FrameView* view = static_cast<FrameView*>(widget()); + if (!view) + return; int border = borderLeft() + borderRight(); setWidth(max(width(), view->contentsWidth() + border)); } diff --git a/WebCore/rendering/RenderImage.cpp b/WebCore/rendering/RenderImage.cpp index a2052fe..73cf73c 100644 --- a/WebCore/rendering/RenderImage.cpp +++ b/WebCore/rendering/RenderImage.cpp @@ -679,11 +679,11 @@ void RenderImage::calcPrefWidths() { ASSERT(prefWidthsDirty()); - int paddingAndBorders = paddingLeft() + paddingRight() + borderLeft() + borderRight(); - m_maxPrefWidth = calcReplacedWidth(false) + paddingAndBorders; + int borderAndPadding = borderAndPaddingWidth(); + m_maxPrefWidth = calcReplacedWidth(false) + borderAndPadding; if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) - m_maxPrefWidth = min(m_maxPrefWidth, style()->maxWidth().value() + (style()->boxSizing() == CONTENT_BOX ? paddingAndBorders : 0)); + m_maxPrefWidth = min(m_maxPrefWidth, style()->maxWidth().value() + (style()->boxSizing() == CONTENT_BOX ? borderAndPadding : 0)); if (style()->width().isPercent() || style()->height().isPercent() || style()->maxWidth().isPercent() || style()->maxHeight().isPercent() || diff --git a/WebCore/rendering/RenderInline.cpp b/WebCore/rendering/RenderInline.cpp index 6d3f462..69e6eab 100644 --- a/WebCore/rendering/RenderInline.cpp +++ b/WebCore/rendering/RenderInline.cpp @@ -274,7 +274,7 @@ void RenderInline::splitInlines(RenderBlock* fromBlock, RenderBlock* toBlock, // has to move into the inline continuation. Call updateBeforeAfterContent to ensure that the inline's :after // content gets properly destroyed. if (document()->usesBeforeAfterRules()) - inlineCurr->children()->updateBeforeAfterContent(this, AFTER); + inlineCurr->children()->updateBeforeAfterContent(inlineCurr, AFTER); // Now we need to take all of the children starting from the first child // *after* currChild and append them all to the clone. diff --git a/WebCore/rendering/RenderInline.h b/WebCore/rendering/RenderInline.h index 7fcb516..4084b6e 100644 --- a/WebCore/rendering/RenderInline.h +++ b/WebCore/rendering/RenderInline.h @@ -71,6 +71,8 @@ public: int verticalPositionFromCache(bool firstLine) const; void invalidateVerticalPosition() { m_verticalPosition = PositionUndefined; } + RenderInline* inlineContinuation() const; + private: virtual RenderObjectChildList* virtualChildren() { return children(); } virtual const RenderObjectChildList* virtualChildren() const { return children(); } @@ -126,7 +128,6 @@ private: virtual int lineHeight(bool firstLine, bool isRootLineBox = false) const; - RenderInline* inlineContinuation() const; void setContinuation(RenderBoxModelObject* c) { m_continuation = c; } virtual void childBecameNonInline(RenderObject* child); diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp index 7994325..ea29087 100644 --- a/WebCore/rendering/RenderLayer.cpp +++ b/WebCore/rendering/RenderLayer.cpp @@ -47,6 +47,7 @@ #include "CSSPropertyNames.h" #include "CSSStyleDeclaration.h" #include "CSSStyleSelector.h" +#include "Chrome.h" #include "Document.h" #include "EventHandler.h" #include "EventNames.h" @@ -79,12 +80,12 @@ #include "ScrollbarTheme.h" #include "SelectionController.h" #include "TextStream.h" -#include "TransformationMatrix.h" #include "TransformState.h" +#include "TransformationMatrix.h" #include "TranslateTransformOperation.h" -#include <wtf/text/CString.h> #include <wtf/StdLibExtras.h> #include <wtf/UnusedParam.h> +#include <wtf/text/CString.h> #if USE(ACCELERATED_COMPOSITING) #include "RenderLayerBacking.h" @@ -1277,17 +1278,6 @@ void RenderLayer::scrollToOffset(int x, int y, bool updateScrollbars, bool repai for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) child->updateLayerPositions(0); -#if USE(ACCELERATED_COMPOSITING) - if (compositor()->inCompositingMode()) { - // Our stacking context is guaranteed to contain all of our descendants that may need - // repositioning, so update compositing layers from there. - if (RenderLayer* compositingAncestor = stackingContext()->enclosingCompositingLayer()) { - bool isUpdateRoot = true; - compositingAncestor->backing()->updateAfterLayout(RenderLayerBacking::AllDescendants, isUpdateRoot); - } - } -#endif - RenderView* view = renderer()->view(); // We should have a RenderView if we're trying to scroll. @@ -1302,6 +1292,21 @@ void RenderLayer::scrollToOffset(int x, int y, bool updateScrollbars, bool repai view->updateWidgetPositions(); } +#if USE(ACCELERATED_COMPOSITING) + if (compositor()->inCompositingMode()) { + // Our stacking context is guaranteed to contain all of our descendants that may need + // repositioning, so update compositing layers from there. + if (RenderLayer* compositingAncestor = stackingContext()->enclosingCompositingLayer()) { + if (compositor()->compositingConsultsOverlap()) + compositor()->updateCompositingLayers(CompositingUpdateOnScroll, compositingAncestor); + else { + bool isUpdateRoot = true; + compositingAncestor->backing()->updateAfterLayout(RenderLayerBacking::AllDescendants, isUpdateRoot); + } + } + } +#endif + RenderBoxModelObject* repaintContainer = renderer()->containerForRepaint(); IntRect rectForRepaint = renderer()->clippedOverflowRectForRepaint(repaintContainer); @@ -1334,7 +1339,7 @@ void RenderLayer::scrollToOffset(int x, int y, bool updateScrollbars, bool repai } } -void RenderLayer::scrollRectToVisible(const IntRect &rect, bool scrollToAnchor, const ScrollAlignment& alignX, const ScrollAlignment& alignY) +void RenderLayer::scrollRectToVisible(const IntRect& rect, bool scrollToAnchor, const ScrollAlignment& alignX, const ScrollAlignment& alignY) { RenderLayer* parentLayer = 0; IntRect newRect = rect; @@ -1399,9 +1404,17 @@ void RenderLayer::scrollRectToVisible(const IntRect &rect, bool scrollToAnchor, IntRect viewRect = frameView->visibleContentRect(true); IntRect r = getRectToExpose(viewRect, rect, alignX, alignY); - // If this is the outermost view that RenderLayer needs to scroll, then we should scroll the view recursively - // Other apps, like Mail, rely on this feature. - frameView->scrollRectIntoViewRecursively(r); + frameView->setScrollPosition(r.location()); + + // This is the outermost view of a web page, so after scrolling this view we + // scroll its container by calling Page::scrollRectIntoView. + // This only has an effect on the Mac platform in applications + // that put web views into scrolling containers, such as Mac OS X Mail. + // The canAutoscroll function in EventHandler also knows about this. + if (Frame* frame = frameView->frame()) { + if (Page* page = frame->page()) + page->chrome()->scrollRectIntoView(rect); + } } } } @@ -1548,8 +1561,7 @@ void RenderLayer::resize(const PlatformMouseEvent& evt, const IntSize& oldOffset style->setProperty(CSSPropertyMarginLeft, String::number(renderer->marginLeft() / zoomFactor) + "px", false, ec); style->setProperty(CSSPropertyMarginRight, String::number(renderer->marginRight() / zoomFactor) + "px", false, ec); } - int baseWidth = renderer->width() - (isBoxSizingBorder ? 0 - : renderer->borderLeft() + renderer->paddingLeft() + renderer->borderRight() + renderer->paddingRight()); + int baseWidth = renderer->width() - (isBoxSizingBorder ? 0 : renderer->borderAndPaddingWidth()); baseWidth = baseWidth / zoomFactor; style->setProperty(CSSPropertyWidth, String::number(baseWidth + difference.width()) + "px", false, ec); } @@ -1560,8 +1572,7 @@ void RenderLayer::resize(const PlatformMouseEvent& evt, const IntSize& oldOffset style->setProperty(CSSPropertyMarginTop, String::number(renderer->marginTop() / zoomFactor) + "px", false, ec); style->setProperty(CSSPropertyMarginBottom, String::number(renderer->marginBottom() / zoomFactor) + "px", false, ec); } - int baseHeight = renderer->height() - (isBoxSizingBorder ? 0 - : renderer->borderTop() + renderer->paddingTop() + renderer->borderBottom() + renderer->paddingBottom()); + int baseHeight = renderer->height() - (isBoxSizingBorder ? 0 : renderer->borderAndPaddingHeight()); baseHeight = baseHeight / zoomFactor; style->setProperty(CSSPropertyHeight, String::number(baseHeight + difference.height()) + "px", false, ec); } @@ -3186,7 +3197,7 @@ void RenderLayer::updateHoverActiveState(const HitTestRequest& request, HitTestR // We are clearing the :active chain because the mouse has been released. for (RenderObject* curr = activeNode->renderer(); curr; curr = curr->parent()) { if (curr->node() && !curr->isText()) - curr->node()->setInActiveChain(false); + curr->node()->clearInActiveChain(); } doc->setActiveNode(0); } else { @@ -3196,7 +3207,7 @@ void RenderLayer::updateHoverActiveState(const HitTestRequest& request, HitTestR // will need to reference this chain. for (RenderObject* curr = newActiveNode->renderer(); curr; curr = curr->parent()) { if (curr->node() && !curr->isText()) { - curr->node()->setInActiveChain(true); + curr->node()->setInActiveChain(); } } doc->setActiveNode(newActiveNode); diff --git a/WebCore/rendering/RenderLayerBacking.cpp b/WebCore/rendering/RenderLayerBacking.cpp index b5f74c6..b857420 100644 --- a/WebCore/rendering/RenderLayerBacking.cpp +++ b/WebCore/rendering/RenderLayerBacking.cpp @@ -38,6 +38,7 @@ #include "GraphicsLayer.h" #include "HTMLCanvasElement.h" #include "HTMLElement.h" +#include "HTMLIFrameElement.h" #include "HTMLMediaElement.h" #include "HTMLNames.h" #include "InspectorTimelineAgent.h" @@ -384,6 +385,24 @@ void RenderLayerBacking::updateGraphicsLayerGeometry() m_graphicsLayer->setContentsRect(contentsBox()); m_graphicsLayer->setDrawsContent(containsPaintedContent()); + + // If this is an iframe parent, update the iframe content's box + RenderLayerCompositor* innerCompositor = innerRenderLayerCompositor(); + if (innerCompositor) + innerCompositor->setRootPlatformLayerClippingBox(contentsBox()); +} + +RenderLayerCompositor* RenderLayerBacking::innerRenderLayerCompositor() const +{ + if (renderer()->isRenderIFrame()) { + HTMLIFrameElement* element = static_cast<HTMLIFrameElement*>(renderer()->node()); + if (Document* contentDocument = element->contentDocument()) { + if (RenderView* view = contentDocument->renderView()) + return view->compositor(); + } + } + + return 0; } void RenderLayerBacking::updateInternalHierarchy() @@ -823,7 +842,11 @@ FloatPoint RenderLayerBacking::contentsToGraphicsLayerCoordinates(const Graphics bool RenderLayerBacking::paintingGoesToWindow() const { - return m_owningLayer->isRootLayer(); + if (!m_owningLayer->isRootLayer()) + return false; + + // Iframe root layers paint into backing store. + return !toRenderView(renderer())->document()->ownerElement(); } void RenderLayerBacking::setContentsNeedDisplay() diff --git a/WebCore/rendering/RenderLayerBacking.h b/WebCore/rendering/RenderLayerBacking.h index a6907e7..8e0ee23 100644 --- a/WebCore/rendering/RenderLayerBacking.h +++ b/WebCore/rendering/RenderLayerBacking.h @@ -124,6 +124,8 @@ public: IntRect contentsBox() const; + RenderLayerCompositor* innerRenderLayerCompositor() const; + private: void createGraphicsLayer(); void destroyGraphicsLayer(); diff --git a/WebCore/rendering/RenderLayerCompositor.cpp b/WebCore/rendering/RenderLayerCompositor.cpp index 25d8eda..e96e375 100644 --- a/WebCore/rendering/RenderLayerCompositor.cpp +++ b/WebCore/rendering/RenderLayerCompositor.cpp @@ -37,6 +37,7 @@ #include "GraphicsLayer.h" #include "HitTestResult.h" #include "HTMLCanvasElement.h" +#include "HTMLIFrameElement.h" #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) #include "HTMLMediaElement.h" #include "HTMLNames.h" @@ -124,7 +125,12 @@ void RenderLayerCompositor::enableCompositingMode(bool enable /* = true */) else destroyRootPlatformLayer(); - m_renderView->compositingStateChanged(m_compositing); + if (shouldPropagateCompositingToIFrameParent()) { + if (Element* ownerElement = m_renderView->document()->ownerElement()) { + // Trigger a recalcStyle in the parent document, to update compositing in that document. + ownerElement->setNeedsStyleRecalc(SyntheticStyleChange); + } + } } } @@ -592,6 +598,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O childState.m_compositingAncestor = layer; if (overlapMap) addToOverlapMap(*overlapMap, layer, absBounds, haveComputedBounds); + willBeComposited = true; } } } @@ -622,6 +629,8 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O } } + ASSERT(willBeComposited == needsToBeComposited(layer)); + // If we have a software transform, and we have layers under us, we need to also // be composited. Also, if we have opacity < 1, then we need to be a layer so that // the child layers are opaque, then rendered with opacity on this layer. @@ -699,19 +708,6 @@ void RenderLayerCompositor::removeCompositedChildren(RenderLayer* layer) hostingLayer->removeAllChildren(); } -void RenderLayerCompositor::parentInRootLayer(RenderLayer* layer) -{ - ASSERT(layer->isComposited()); - - GraphicsLayer* layerAnchor = layer->backing()->childForSuperlayers(); - - if (layerAnchor->parent() != m_rootPlatformLayer) { - layerAnchor->removeFromParent(); - if (m_rootPlatformLayer) - m_rootPlatformLayer->addChild(layerAnchor); - } -} - #if ENABLE(VIDEO) bool RenderLayerCompositor::canAccelerateVideoRendering(RenderVideo* o) const { @@ -799,11 +795,30 @@ void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer* layer, cons } if (layerBacking) { - layerBacking->parentForSublayers()->setChildren(layerChildren); + if (shouldPropagateCompositingToIFrameParent() && layer->renderer()->isRenderIFrame()) { + // This is an iframe parent. Make it the parent of the iframe document's root + layerBacking->parentForSublayers()->removeAllChildren(); + + RenderLayerCompositor* innerCompositor = layerBacking->innerRenderLayerCompositor(); + if (innerCompositor) { + GraphicsLayer* innerRootLayer = innerCompositor->rootPlatformLayer(); + if (innerRootLayer) + layerBacking->parentForSublayers()->addChild(innerRootLayer); + } + } else + layerBacking->parentForSublayers()->setChildren(layerChildren); childLayersOfEnclosingLayer.append(layerBacking->childForSuperlayers()); } } +void RenderLayerCompositor::setRootPlatformLayerClippingBox(const IntRect& contentsBox) +{ + if (m_clippingLayer) { + m_clippingLayer->setPosition(FloatPoint(contentsBox.x(), contentsBox.y())); + m_clippingLayer->setSize(FloatSize(contentsBox.width(), contentsBox.height())); + } +} + // This just updates layer geometry without changing the hierarchy. void RenderLayerCompositor::updateLayerTreeGeometry(RenderLayer* layer) { @@ -957,7 +972,7 @@ RenderLayer* RenderLayerCompositor::rootRenderLayer() const GraphicsLayer* RenderLayerCompositor::rootPlatformLayer() const { - return m_rootPlatformLayer.get(); + return m_clippingLayer ? m_clippingLayer.get() : m_rootPlatformLayer.get(); } void RenderLayerCompositor::didMoveOnscreen() @@ -965,13 +980,28 @@ void RenderLayerCompositor::didMoveOnscreen() if (!m_rootPlatformLayer) return; - Frame* frame = m_renderView->frameView()->frame(); - Page* page = frame ? frame->page() : 0; - if (!page) - return; + bool attached = false; + if (shouldPropagateCompositingToIFrameParent()) { + if (Element* ownerElement = m_renderView->document()->ownerElement()) { + RenderObject* renderer = ownerElement->renderer(); + if (renderer && renderer->isRenderIFrame()) { + // The layer will get hooked up via RenderLayerBacking::updateGraphicsLayerConfiguration() + // for the iframe's renderer in the parent document. + ownerElement->setNeedsStyleRecalc(SyntheticStyleChange); + attached = true; + } + } + } + + if (!attached) { + Frame* frame = m_renderView->frameView()->frame(); + Page* page = frame ? frame->page() : 0; + if (!page) + return; - page->chrome()->client()->attachRootGraphicsLayer(frame, m_rootPlatformLayer.get()); - m_rootLayerAttached = true; + page->chrome()->client()->attachRootGraphicsLayer(frame, m_rootPlatformLayer.get()); + } + m_rootLayerAttached = true; } void RenderLayerCompositor::willMoveOffscreen() @@ -979,19 +1009,45 @@ void RenderLayerCompositor::willMoveOffscreen() if (!m_rootPlatformLayer || !m_rootLayerAttached) return; - Frame* frame = m_renderView->frameView()->frame(); - Page* page = frame ? frame->page() : 0; - if (!page) - return; + bool detached = false; + if (shouldPropagateCompositingToIFrameParent()) { + if (Element* ownerElement = m_renderView->document()->ownerElement()) { + RenderObject* renderer = ownerElement->renderer(); + if (renderer->isRenderIFrame()) { + // The layer will get hooked up via RenderLayerBacking::updateGraphicsLayerConfiguration() + // for the iframe's renderer in the parent document. + ownerElement->setNeedsStyleRecalc(SyntheticStyleChange); + detached = true; + } + } + } + + if (!detached) { + Frame* frame = m_renderView->frameView()->frame(); + Page* page = frame ? frame->page() : 0; + if (!page) + return; - page->chrome()->client()->attachRootGraphicsLayer(frame, 0); + page->chrome()->client()->attachRootGraphicsLayer(frame, 0); + } m_rootLayerAttached = false; } void RenderLayerCompositor::updateRootLayerPosition() { - if (m_rootPlatformLayer) - m_rootPlatformLayer->setSize(FloatSize(m_renderView->rightLayoutOverflow(), m_renderView->bottomLayoutOverflow())); + if (m_rootPlatformLayer) { + // FIXME: Adjust the y position of the m_rootPlatformLayer if we are clipping by its top edge + // Eventually this will be taken care of by scrolling logic + // https://bugs.webkit.org/show_bug.cgi?id=38518 + float height = m_renderView->bottomLayoutOverflow(); + float yOffset = 0; + + if (m_clippingLayer && height > m_clippingLayer->size().height()) + yOffset = m_clippingLayer->size().height() - height; + + m_rootPlatformLayer->setPosition(FloatPoint(0, yOffset)); + m_rootPlatformLayer->setSize(FloatSize(m_renderView->rightLayoutOverflow(), height)); + } } void RenderLayerCompositor::didStartAcceleratedAnimation() @@ -1007,6 +1063,18 @@ bool RenderLayerCompositor::has3DContent() const return layerHas3DContent(rootRenderLayer()); } +bool RenderLayerCompositor::shouldPropagateCompositingToIFrameParent() +{ + // Parent document content needs to be able to render on top of a composited iframe, so correct behavior + // is to have the parent document become composited too. However, this can cause problems on platforms that + // use native views for frames (like Mac), so disable that behavior on those platforms for now. +#if !PLATFORM(MAC) + return true; +#else + return false; +#endif +} + bool RenderLayerCompositor::needsToBeComposited(const RenderLayer* layer) const { if (!canBeComposited(layer)) @@ -1194,7 +1262,9 @@ bool RenderLayerCompositor::requiresCompositingForPlugin(RenderObject* renderer) bool RenderLayerCompositor::requiresCompositingForIFrame(RenderObject* renderer) const { - return renderer->isRenderIFrame() && toRenderIFrame(renderer)->requiresAcceleratedCompositing(); + return shouldPropagateCompositingToIFrameParent() + && renderer->isRenderIFrame() + && toRenderIFrame(renderer)->requiresAcceleratedCompositing(); } bool RenderLayerCompositor::requiresCompositingForAnimation(RenderObject* renderer) const @@ -1226,13 +1296,31 @@ void RenderLayerCompositor::ensureRootPlatformLayer() m_rootPlatformLayer = GraphicsLayer::create(0); m_rootPlatformLayer->setSize(FloatSize(m_renderView->rightLayoutOverflow(), m_renderView->bottomLayoutOverflow())); - m_rootPlatformLayer->setPosition(FloatPoint(0, 0)); + m_rootPlatformLayer->setPosition(FloatPoint()); + // The root layer does flipping if we need it on this platform. m_rootPlatformLayer->setGeometryOrientation(GraphicsLayer::compositingCoordinatesOrientation()); // Need to clip to prevent transformed content showing outside this frame m_rootPlatformLayer->setMasksToBounds(true); + if (shouldPropagateCompositingToIFrameParent()) { + // Create a clipping layer if this is an iframe + if (Element* ownerElement = m_renderView->document()->ownerElement()) { + RenderObject* renderer = ownerElement->renderer(); + if (renderer && renderer->isRenderIFrame()) { + m_clippingLayer = GraphicsLayer::create(0); + m_clippingLayer->setGeometryOrientation(GraphicsLayer::compositingCoordinatesOrientation()); +#ifndef NDEBUG + m_clippingLayer->setName("iframe Clipping"); +#endif + m_clippingLayer->setMasksToBounds(true); + m_clippingLayer->setAnchorPoint(FloatPoint()); + m_clippingLayer->addChild(m_rootPlatformLayer.get()); + } + } + } + didMoveOnscreen(); } diff --git a/WebCore/rendering/RenderLayerCompositor.h b/WebCore/rendering/RenderLayerCompositor.h index 43b8a17..36f7c15 100644 --- a/WebCore/rendering/RenderLayerCompositor.h +++ b/WebCore/rendering/RenderLayerCompositor.h @@ -136,6 +136,12 @@ public: // Walk the tree looking for layers with 3d transforms. Useful in case you need // to know if there is non-affine content, e.g. for drawing into an image. bool has3DContent() const; + + // Some platforms may wish to connect compositing layer trees between iframes and + // their parent document. + static bool shouldPropagateCompositingToIFrameParent(); + + void setRootPlatformLayerClippingBox(const IntRect& contentsBox); private: // Whether the given RL needs a compositing layer. @@ -168,8 +174,6 @@ private: void setCompositingParent(RenderLayer* childLayer, RenderLayer* parentLayer); void removeCompositedChildren(RenderLayer*); - void parentInRootLayer(RenderLayer*); - bool layerHas3DContent(const RenderLayer*) const; void ensureRootPlatformLayer(); @@ -199,6 +203,9 @@ private: bool m_compositing; bool m_rootLayerAttached; bool m_compositingLayersNeedRebuild; + + // Enclosing clipping layer for iframe content + OwnPtr<GraphicsLayer> m_clippingLayer; #if PROFILE_LAYER_REBUILD int m_rootLayerUpdateCount; diff --git a/WebCore/rendering/RenderListBox.cpp b/WebCore/rendering/RenderListBox.cpp index 15c652c..68591d6 100644 --- a/WebCore/rendering/RenderListBox.cpp +++ b/WebCore/rendering/RenderListBox.cpp @@ -188,7 +188,7 @@ void RenderListBox::calcPrefWidths() m_minPrefWidth = min(m_minPrefWidth, calcContentBoxWidth(style()->maxWidth().value())); } - int toAdd = paddingLeft() + paddingRight() + borderLeft() + borderRight(); + int toAdd = borderAndPaddingWidth(); m_minPrefWidth += toAdd; m_maxPrefWidth += toAdd; @@ -221,7 +221,7 @@ int RenderListBox::listHeight() const void RenderListBox::calcHeight() { - int toAdd = paddingTop() + paddingBottom() + borderTop() + borderBottom(); + int toAdd = borderAndPaddingHeight(); int itemHeight = RenderListBox::itemHeight(); setHeight(itemHeight * size() - rowSpacing + toAdd); diff --git a/WebCore/rendering/RenderMenuList.cpp b/WebCore/rendering/RenderMenuList.cpp index 518925a..e2c6fd5 100644 --- a/WebCore/rendering/RenderMenuList.cpp +++ b/WebCore/rendering/RenderMenuList.cpp @@ -262,7 +262,7 @@ void RenderMenuList::calcPrefWidths() m_minPrefWidth = min(m_minPrefWidth, calcContentBoxWidth(style()->maxWidth().value())); } - int toAdd = paddingLeft() + paddingRight() + borderLeft() + borderRight(); + int toAdd = borderAndPaddingWidth(); m_minPrefWidth += toAdd; m_maxPrefWidth += toAdd; diff --git a/WebCore/rendering/RenderObject.cpp b/WebCore/rendering/RenderObject.cpp index d63997a..1c93ac4 100644 --- a/WebCore/rendering/RenderObject.cpp +++ b/WebCore/rendering/RenderObject.cpp @@ -69,7 +69,7 @@ #endif #if ENABLE(SVG) -#include "RenderSVGResource.h" +#include "RenderSVGResourceContainer.h" #include "SVGRenderSupport.h" #endif @@ -2494,19 +2494,19 @@ VisiblePosition RenderObject::createVisiblePosition(const Position& position) } #if ENABLE(SVG) -const SVGRenderBase* RenderObject::toSVGRenderBase() const +RenderSVGResourceContainer* RenderObject::toRenderSVGResourceContainer() { ASSERT_NOT_REACHED(); return 0; } -RenderSVGResource* RenderObject::toRenderSVGResource() +FloatRect RenderObject::objectBoundingBox() const { ASSERT_NOT_REACHED(); - return 0; + return FloatRect(); } -FloatRect RenderObject::objectBoundingBox() const +FloatRect RenderObject::strokeBoundingBox() const { ASSERT_NOT_REACHED(); return FloatRect(); diff --git a/WebCore/rendering/RenderObject.h b/WebCore/rendering/RenderObject.h index ae12758..9d8a306 100644 --- a/WebCore/rendering/RenderObject.h +++ b/WebCore/rendering/RenderObject.h @@ -54,8 +54,7 @@ class RenderTheme; class TransformState; class VisiblePosition; #if ENABLE(SVG) -class RenderSVGResource; -class SVGRenderBase; +class RenderSVGResourceContainer; #endif /* @@ -332,16 +331,16 @@ public: // to add SVG renderer methods to RenderObject with an ASSERT_NOT_REACHED() default implementation. virtual bool isSVGRoot() const { return false; } virtual bool isSVGContainer() const { return false; } + virtual bool isSVGGradientStop() const { return false; } virtual bool isSVGHiddenContainer() const { return false; } virtual bool isRenderPath() const { return false; } virtual bool isSVGText() const { return false; } virtual bool isSVGImage() const { return false; } virtual bool isSVGForeignObject() const { return false; } - virtual bool isSVGResource() const { return false; } + virtual bool isSVGResourceContainer() const { return false; } virtual bool isSVGShadowTreeRootContainer() const { return false; } - virtual const SVGRenderBase* toSVGRenderBase() const; - virtual RenderSVGResource* toRenderSVGResource(); + virtual RenderSVGResourceContainer* toRenderSVGResourceContainer(); // FIXME: Those belong into a SVG specific base-class for all renderers (see above) // Unfortunately we don't have such a class yet, because it's not possible for all renderers @@ -356,6 +355,7 @@ public: // objectBoundingBox is returned local coordinates. // The name objectBoundingBox is taken from the SVG 1.1 spec. virtual FloatRect objectBoundingBox() const; + virtual FloatRect strokeBoundingBox() const; // Returns the smallest rectangle enclosing all of the painted content // respecting clipping, masking, filters, opacity, stroke-width and markers diff --git a/WebCore/rendering/RenderPath.cpp b/WebCore/rendering/RenderPath.cpp index b1e2a8f..ccb9562 100644 --- a/WebCore/rendering/RenderPath.cpp +++ b/WebCore/rendering/RenderPath.cpp @@ -4,6 +4,7 @@ 2005, 2007 Eric Seidel <eric@webkit.org> 2009 Google, Inc. 2009 Dirk Schulze <krit@webkit.org> + Copyright (C) Research In Motion Limited 2010. 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 @@ -34,7 +35,6 @@ #include "RenderSVGResourceFilter.h" #include "RenderSVGResourceMarker.h" #include "StrokeStyleApplier.h" -#include "SVGPaintServer.h" #include "SVGRenderSupport.h" #include "SVGStyledTransformableElement.h" #include "SVGTransformList.h" @@ -65,7 +65,7 @@ private: RenderPath::RenderPath(SVGStyledTransformableElement* node) : RenderSVGModelObject(node) - , m_needsBoundariesUpdate(false) // default is false, as this is only used when a RenderSVGResource tells us that the boundaries need to be recached + , m_needsBoundariesUpdate(false) // default is false, the cached rects are empty from the beginning , m_needsPathUpdate(true) // default is true, so we grab a Path object once from SVGStyledTransformableElement , m_needsTransformUpdate(true) // default is true, so we grab a AffineTransform object once from SVGStyledTransformableElement { @@ -73,10 +73,10 @@ RenderPath::RenderPath(SVGStyledTransformableElement* node) bool RenderPath::fillContains(const FloatPoint& point, bool requiresFill) const { - if (m_path.isEmpty()) + if (!m_fillBoundingBox.contains(point)) return false; - if (requiresFill && !SVGPaintServer::fillPaintServer(style(), this)) + if (requiresFill && !RenderSVGResource::fillPaintingResource(this, style())) return false; return m_path.contains(point, style()->svgStyle()->fillRule()); @@ -84,87 +84,16 @@ bool RenderPath::fillContains(const FloatPoint& point, bool requiresFill) const bool RenderPath::strokeContains(const FloatPoint& point, bool requiresStroke) const { - if (m_path.isEmpty()) + if (!m_strokeAndMarkerBoundingBox.contains(point)) return false; - if (requiresStroke && !SVGPaintServer::strokePaintServer(style(), this)) + if (requiresStroke && !RenderSVGResource::strokePaintingResource(this, style())) return false; BoundingRectStrokeStyleApplier strokeStyle(this, style()); return m_path.strokeContains(&strokeStyle, point); } -FloatRect RenderPath::objectBoundingBox() const -{ - if (m_path.isEmpty()) - return FloatRect(); - - if (m_cachedLocalFillBBox.isEmpty()) - m_cachedLocalFillBBox = m_path.boundingRect(); - - return m_cachedLocalFillBBox; -} - -FloatRect RenderPath::strokeBoundingBox() const -{ - if (m_path.isEmpty()) - return FloatRect(); - - if (!m_cachedLocalStrokeBBox.isEmpty()) - return m_cachedLocalStrokeBBox; - - m_cachedLocalStrokeBBox = objectBoundingBox(); - if (style()->svgStyle()->hasStroke()) { - BoundingRectStrokeStyleApplier strokeStyle(this, style()); - m_cachedLocalStrokeBBox.unite(m_path.strokeBoundingRect(&strokeStyle)); - } - - return m_cachedLocalStrokeBBox; -} - -FloatRect RenderPath::markerBoundingBox() const -{ - if (m_path.isEmpty()) - return FloatRect(); - - if (m_cachedLocalMarkerBBox.isEmpty()) - calculateMarkerBoundsIfNeeded(); - - return m_cachedLocalMarkerBBox; -} - -FloatRect RenderPath::repaintRectInLocalCoordinates() const -{ - if (m_path.isEmpty()) - return FloatRect(); - - // If we already have a cached repaint rect, return that - if (!m_cachedLocalRepaintRect.isEmpty()) - return m_cachedLocalRepaintRect; - - // FIXME: We need to be careful here. We assume that there is no filter, - // clipper, marker or masker if the rects are empty. - FloatRect rect = filterBoundingBoxForRenderer(this); - if (!rect.isEmpty()) - m_cachedLocalRepaintRect = rect; - else { - m_cachedLocalRepaintRect = strokeBoundingBox(); - m_cachedLocalRepaintRect.unite(markerBoundingBox()); - } - - rect = clipperBoundingBoxForRenderer(this); - if (!rect.isEmpty()) - m_cachedLocalRepaintRect.intersect(rect); - - rect = maskerBoundingBoxForRenderer(this); - if (!rect.isEmpty()) - m_cachedLocalRepaintRect.intersect(rect); - - style()->svgStyle()->inflateForShadow(m_cachedLocalRepaintRect); - - return m_cachedLocalRepaintRect; -} - void RenderPath::layout() { LayoutRepainter repainter(*this, checkForRepaintDuringLayout() && selfNeedsLayout()); @@ -173,15 +102,11 @@ void RenderPath::layout() // We need to update the Path object whenever the underlying SVGStyledTransformableElement uses relative values // as the viewport size may have changed. It would be nice to optimize this to detect these changes, and only // update when needed, even when using relative values. - if (!m_needsPathUpdate && element->hasRelativeValues()) - m_needsPathUpdate = true; - - bool needsUpdate = m_needsPathUpdate || m_needsTransformUpdate || m_needsBoundariesUpdate; + bool needsPathUpdate = m_needsPathUpdate; + if (!needsPathUpdate && element->hasRelativeValues()) + needsPathUpdate = true; - if (m_needsBoundariesUpdate) - m_needsBoundariesUpdate = false; - - if (m_needsPathUpdate) { + if (needsPathUpdate) { m_path = element->toPathData(); m_needsPathUpdate = false; } @@ -191,27 +116,31 @@ void RenderPath::layout() m_needsTransformUpdate = false; } - if (needsUpdate) - invalidateCachedBoundaries(); + // At this point LayoutRepainter already grabbed the old bounds, + // recalculate them now so repaintAfterLayout() uses the new bounds + if (needsPathUpdate || m_needsBoundariesUpdate) { + updateCachedBoundaries(); + m_needsBoundariesUpdate = false; + } repainter.repaintAfterLayout(); setNeedsLayout(false); } -static inline void fillAndStrokePath(const Path& path, GraphicsContext* context, RenderStyle* style, RenderPath* object) +static inline void fillAndStrokePath(const Path& path, GraphicsContext* context, RenderPath* object) { context->beginPath(); - SVGPaintServer* fillPaintServer = SVGPaintServer::fillPaintServer(style, object); - if (fillPaintServer) { + if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(object, object->style())) { context->addPath(path); - fillPaintServer->draw(context, object, ApplyToFillTargetType); + if (fillPaintingResource->applyResource(object, object->style(), context, ApplyToFillMode)) + fillPaintingResource->postApplyResource(object, context, ApplyToFillMode); } - - SVGPaintServer* strokePaintServer = SVGPaintServer::strokePaintServer(style, object); - if (strokePaintServer) { - context->addPath(path); // path is cleared when filled. - strokePaintServer->draw(context, object, ApplyToStrokeTargetType); + + if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(object, object->style())) { + context->addPath(path); + if (strokePaintingResource->applyResource(object, object->style(), context, ApplyToStrokeMode)) + strokePaintingResource->postApplyResource(object, context, ApplyToStrokeMode); } } @@ -222,10 +151,7 @@ void RenderPath::paint(PaintInfo& paintInfo, int, int) FloatRect boundingBox = repaintRectInLocalCoordinates(); FloatRect nonLocalBoundingBox = m_localTransform.mapRect(boundingBox); - // FIXME: The empty rect check is to deal with incorrect initial clip in renderSubtreeToImage - // unfortunately fixing that problem is fairly complex unless we were willing to just futz the - // rect to something "close enough" - if (!nonLocalBoundingBox.intersects(paintInfo.rect) && !paintInfo.rect.isEmpty()) + if (!nonLocalBoundingBox.intersects(paintInfo.rect)) return; PaintInfo childPaintInfo(paintInfo); @@ -239,13 +165,16 @@ void RenderPath::paint(PaintInfo& paintInfo, int, int) PaintInfo savedInfo(childPaintInfo); if (prepareToRenderSVGContent(this, childPaintInfo, boundingBox, filter)) { - if (style()->svgStyle()->shapeRendering() == SR_CRISPEDGES) + const SVGRenderStyle* svgStyle = style()->svgStyle(); + if (svgStyle->shapeRendering() == SR_CRISPEDGES) childPaintInfo.context->setShouldAntialias(false); - fillAndStrokePath(m_path, childPaintInfo.context, style(), this); - if (static_cast<SVGStyledElement*>(node())->supportsMarkers()) + fillAndStrokePath(m_path, childPaintInfo.context, this); + + if (svgStyle->hasMarkers()) m_markerLayoutInfo.drawMarkers(childPaintInfo); } + finishRenderSVGContent(this, childPaintInfo, filter, savedInfo.context); } @@ -288,20 +217,22 @@ bool RenderPath::nodeAtFloatPoint(const HitTestRequest&, HitTestResult& result, return false; } -void RenderPath::calculateMarkerBoundsIfNeeded() const +FloatRect RenderPath::calculateMarkerBoundsIfNeeded() { Document* doc = document(); SVGElement* svgElement = static_cast<SVGElement*>(node()); ASSERT(svgElement && svgElement->document()); if (!svgElement->isStyled()) - return; + return FloatRect(); SVGStyledElement* styledElement = static_cast<SVGStyledElement*>(svgElement); if (!styledElement->supportsMarkers()) - return; + return FloatRect(); const SVGRenderStyle* svgStyle = style()->svgStyle(); + ASSERT(svgStyle->hasMarkers()); + AtomicString startMarkerId(svgStyle->markerStartResource()); AtomicString midMarkerId(svgStyle->markerMidResource()); AtomicString endMarkerId(svgStyle->markerEndResource()); @@ -326,24 +257,63 @@ void RenderPath::calculateMarkerBoundsIfNeeded() const endMarker->addClient(this); if (!startMarker && !midMarker && !endMarker) - return; + return FloatRect(); float strokeWidth = SVGRenderStyle::cssPrimitiveToLength(this, svgStyle->strokeWidth(), 1.0f); - m_cachedLocalMarkerBBox = m_markerLayoutInfo.calculateBoundaries(startMarker, midMarker, endMarker, strokeWidth, m_path); + return m_markerLayoutInfo.calculateBoundaries(startMarker, midMarker, endMarker, strokeWidth, m_path); } -void RenderPath::invalidateCachedBoundaries() +void RenderPath::styleWillChange(StyleDifference diff, const RenderStyle* newStyle) { - m_cachedLocalRepaintRect = FloatRect(); - m_cachedLocalStrokeBBox = FloatRect(); - m_cachedLocalFillBBox = FloatRect(); - m_cachedLocalMarkerBBox = FloatRect(); + setNeedsBoundariesUpdate(); + RenderSVGModelObject::styleWillChange(diff, newStyle); } -void RenderPath::styleWillChange(StyleDifference diff, const RenderStyle* newStyle) +void RenderPath::updateCachedBoundaries() { - invalidateCachedBoundaries(); - RenderSVGModelObject::styleWillChange(diff, newStyle); + if (m_path.isEmpty()) { + m_fillBoundingBox = FloatRect(); + m_strokeAndMarkerBoundingBox = FloatRect(); + m_repaintBoundingBox = FloatRect(); + return; + } + + // Cache _unclipped_ fill bounding box, used for calculations in resources + m_fillBoundingBox = m_path.boundingRect(); + + // Cache _unclipped_ stroke bounding box, used for calculations in resources (includes marker boundaries) + m_strokeAndMarkerBoundingBox = m_fillBoundingBox; + + const SVGRenderStyle* svgStyle = style()->svgStyle(); + if (svgStyle->hasStroke()) { + BoundingRectStrokeStyleApplier strokeStyle(this, style()); + m_strokeAndMarkerBoundingBox.unite(m_path.strokeBoundingRect(&strokeStyle)); + } + + if (svgStyle->hasMarkers()) { + FloatRect markerBounds = calculateMarkerBoundsIfNeeded(); + if (!markerBounds.isEmpty()) + m_strokeAndMarkerBoundingBox.unite(markerBounds); + } + + // Cache smallest possible repaint rectangle + + // FIXME: We need to be careful here. We assume that there is no resource, if the rect is empty. + FloatRect rect = filterBoundingBoxForRenderer(this); + if (rect.isEmpty()) + m_repaintBoundingBox = m_strokeAndMarkerBoundingBox; + else + m_repaintBoundingBox = rect; + + rect = clipperBoundingBoxForRenderer(this); + if (!rect.isEmpty()) + m_repaintBoundingBox.intersect(rect); + + rect = maskerBoundingBoxForRenderer(this); + if (!rect.isEmpty()) + m_repaintBoundingBox.intersect(rect); + + svgStyle->inflateForShadow(m_repaintBoundingBox); } } diff --git a/WebCore/rendering/RenderPath.h b/WebCore/rendering/RenderPath.h index ea4de40..5509057 100644 --- a/WebCore/rendering/RenderPath.h +++ b/WebCore/rendering/RenderPath.h @@ -50,11 +50,9 @@ private: bool fillContains(const FloatPoint&, bool requiresFill = true) const; bool strokeContains(const FloatPoint&, bool requiresStroke = true) const; - virtual FloatRect objectBoundingBox() const; - virtual FloatRect strokeBoundingBox() const; - virtual FloatRect markerBoundingBox() const; - virtual FloatRect repaintRectInLocalCoordinates() const; - + virtual FloatRect objectBoundingBox() const { return m_fillBoundingBox; } + virtual FloatRect strokeBoundingBox() const { return m_strokeAndMarkerBoundingBox; } + virtual FloatRect repaintRectInLocalCoordinates() const { return m_repaintBoundingBox; } virtual const AffineTransform& localToParentTransform() const { return m_localTransform; } virtual bool isRenderPath() const { return true; } @@ -67,8 +65,8 @@ private: virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction); virtual void styleWillChange(StyleDifference, const RenderStyle*); - void calculateMarkerBoundsIfNeeded() const; - void invalidateCachedBoundaries(); + FloatRect calculateMarkerBoundsIfNeeded(); + void updateCachedBoundaries(); private: virtual AffineTransform localTransform() const { return m_localTransform; } @@ -78,11 +76,10 @@ private: bool m_needsTransformUpdate : 1; mutable Path m_path; - mutable FloatRect m_cachedLocalFillBBox; - mutable FloatRect m_cachedLocalStrokeBBox; - mutable FloatRect m_cachedLocalRepaintRect; - mutable FloatRect m_cachedLocalMarkerBBox; - mutable SVGMarkerLayoutInfo m_markerLayoutInfo; + FloatRect m_fillBoundingBox; + FloatRect m_strokeAndMarkerBoundingBox; + FloatRect m_repaintBoundingBox; + SVGMarkerLayoutInfo m_markerLayoutInfo; AffineTransform m_localTransform; }; diff --git a/WebCore/rendering/RenderProgress.cpp b/WebCore/rendering/RenderProgress.cpp index a9dbfe8..b42cc8b 100644 --- a/WebCore/rendering/RenderProgress.cpp +++ b/WebCore/rendering/RenderProgress.cpp @@ -23,9 +23,12 @@ #include "RenderProgress.h" +#include "HTMLDivElement.h" #include "HTMLProgressElement.h" #include "RenderTheme.h" +#include "RenderView.h" #include <wtf/CurrentTime.h> +#include <wtf/RefPtr.h> using namespace std; @@ -33,6 +36,23 @@ namespace WebCore { using namespace HTMLNames; +class ProgressValueElement : public HTMLDivElement { +public: + ProgressValueElement(Document*, Node* shadowParent); + +private: + virtual bool isShadowNode() const { return true; } + virtual Node* shadowParentNode() { return m_shadowParent; } + + Node* m_shadowParent; +}; + +ProgressValueElement::ProgressValueElement(Document* document, Node* shadowParent) +: HTMLDivElement(divTag, document) +, m_shadowParent(shadowParent) +{ +} + RenderProgress::RenderProgress(HTMLProgressElement* element) : RenderBlock(element) , m_position(-1) @@ -41,19 +61,48 @@ RenderProgress::RenderProgress(HTMLProgressElement* element) , m_animationDuration(0) , m_animating(false) , m_animationTimer(this, &RenderProgress::animationTimerFired) + , m_valuePart(0) { } +RenderProgress::~RenderProgress() +{ + if (m_valuePart) + m_valuePart->detach(); +} + void RenderProgress::layout() { ASSERT(needsLayout()); LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); + IntSize oldSize = size(); + calcWidth(); calcHeight(); - - m_overflow.clear(); + if (m_valuePart) { + IntRect valuePartRect(borderLeft() + paddingLeft(), borderTop() + paddingTop(), lround((width() - borderLeft() - paddingLeft() - borderRight() - paddingRight()) * position()), height() - borderTop() - paddingTop() - borderBottom() - paddingBottom()); + if (style()->direction() == RTL) + valuePartRect.setX(width() - borderRight() - paddingRight() - valuePartRect.width()); + toRenderBox(m_valuePart->renderer())->setFrameRect(valuePartRect); + + if (oldSize != size()) + m_valuePart->renderer()->setChildNeedsLayout(true, false); + + LayoutStateMaintainer statePusher(view(), this, size()); + + IntRect oldRect = toRenderBox(m_valuePart->renderer())->frameRect(); + + m_valuePart->renderer()->layoutIfNeeded(); + + toRenderBox(m_valuePart->renderer())->setFrameRect(valuePartRect); + if (m_valuePart->renderer()->checkForRepaintDuringLayout()) + m_valuePart->renderer()->repaintDuringLayoutIfMoved(oldRect); + + statePusher.pop(); + addOverflowFromChild(toRenderBox(m_valuePart->renderer())); + } updateAnimationState(); @@ -62,6 +111,13 @@ void RenderProgress::layout() setNeedsLayout(false); } +void RenderProgress::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) +{ + RenderBlock::styleDidChange(diff, oldStyle); + + updateValuePartState(); +} + void RenderProgress::updateFromElement() { HTMLProgressElement* element = progressElement(); @@ -71,9 +127,46 @@ void RenderProgress::updateFromElement() updateAnimationState(); + updateValuePartState(); + repaint(); } +void RenderProgress::updateValuePartState() +{ + bool needLayout = !style()->hasAppearance() || m_valuePart; + if (!style()->hasAppearance() && !m_valuePart) { + m_valuePart = new ProgressValueElement(document(), node()); + RefPtr<RenderStyle> styleForValuePart = createStyleForValuePart(style()); + m_valuePart->setRenderer(m_valuePart->createRenderer(renderArena(), styleForValuePart.get())); + m_valuePart->renderer()->setStyle(styleForValuePart.release()); + m_valuePart->setAttached(); + m_valuePart->setInDocument(); + addChild(m_valuePart->renderer()); + } else if (style()->hasAppearance() && m_valuePart) { + m_valuePart->detach(); + m_valuePart = 0; + } + if (needLayout) + setNeedsLayout(true); +} + +PassRefPtr<RenderStyle> RenderProgress::createStyleForValuePart(RenderStyle* parentStyle) +{ + RefPtr<RenderStyle> styleForValuePart; + RenderStyle* pseudoStyle = getCachedPseudoStyle(PROGRESS_BAR_VALUE); + if (pseudoStyle) + styleForValuePart = RenderStyle::clone(pseudoStyle); + else + styleForValuePart = RenderStyle::create(); + + if (parentStyle) + styleForValuePart->inheritFrom(parentStyle); + styleForValuePart->setDisplay(BLOCK); + styleForValuePart->setAppearance(ProgressBarValuePart); + return styleForValuePart.release(); +} + double RenderProgress::animationProgress() { return m_animating ? (fmod((currentTime() - m_animationStartTime), m_animationDuration) / m_animationDuration) : 0; @@ -99,7 +192,7 @@ void RenderProgress::updateAnimationState() m_animationDuration = theme()->animationDurationForProgressBar(this); m_animationRepeatInterval = theme()->animationRepeatIntervalForProgressBar(this); - bool animating = m_animationDuration > 0; + bool animating = style()->hasAppearance() && m_animationDuration > 0; if (animating == m_animating) return; diff --git a/WebCore/rendering/RenderProgress.h b/WebCore/rendering/RenderProgress.h index d6f5078..0d93ae7 100644 --- a/WebCore/rendering/RenderProgress.h +++ b/WebCore/rendering/RenderProgress.h @@ -27,10 +27,13 @@ namespace WebCore { class HTMLProgressElement; +class ProgressValueElement; class RenderProgress : public RenderBlock { public: RenderProgress(HTMLProgressElement*); + virtual ~RenderProgress(); + double position() { return m_position; } double animationProgress(); @@ -42,9 +45,12 @@ private: virtual void layout(); virtual void updateFromElement(); virtual void paint(PaintInfo&, int tx, int ty); + virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); void animationTimerFired(Timer<RenderProgress>*); void updateAnimationState(); + void updateValuePartState(); + PassRefPtr<RenderStyle> createStyleForValuePart(RenderStyle*); double m_position; double m_animationStartTime; @@ -52,6 +58,7 @@ private: double m_animationDuration; bool m_animating; Timer<RenderProgress> m_animationTimer; + RefPtr<ProgressValueElement> m_valuePart; }; inline RenderProgress* toRenderProgress(RenderObject* object) diff --git a/WebCore/rendering/RenderReplaced.cpp b/WebCore/rendering/RenderReplaced.cpp index 0ba99f5..d579b99 100644 --- a/WebCore/rendering/RenderReplaced.cpp +++ b/WebCore/rendering/RenderReplaced.cpp @@ -196,11 +196,11 @@ void RenderReplaced::calcPrefWidths() { ASSERT(prefWidthsDirty()); - int paddingAndBorders = paddingLeft() + paddingRight() + borderLeft() + borderRight(); - int width = calcReplacedWidth(false) + paddingAndBorders; + int borderAndPadding = borderAndPaddingWidth(); + int width = calcReplacedWidth(false) + borderAndPadding; if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) - width = min(width, style()->maxWidth().value() + (style()->boxSizing() == CONTENT_BOX ? paddingAndBorders : 0)); + width = min(width, style()->maxWidth().value() + (style()->boxSizing() == CONTENT_BOX ? borderAndPadding : 0)); if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent())) { m_minPrefWidth = 0; diff --git a/WebCore/rendering/RenderSVGBlock.h b/WebCore/rendering/RenderSVGBlock.h index 19cac62..a250c00 100644 --- a/WebCore/rendering/RenderSVGBlock.h +++ b/WebCore/rendering/RenderSVGBlock.h @@ -33,8 +33,6 @@ class RenderSVGBlock : public RenderBlock, protected SVGRenderBase { public: RenderSVGBlock(SVGElement*); - virtual const SVGRenderBase* toSVGRenderBase() const { return this; } - private: virtual void setStyle(PassRefPtr<RenderStyle>); virtual void updateBoxModelInfoFromStyle(); diff --git a/WebCore/rendering/RenderSVGGradientStop.cpp b/WebCore/rendering/RenderSVGGradientStop.cpp index 66391c8..754f31f 100644 --- a/WebCore/rendering/RenderSVGGradientStop.cpp +++ b/WebCore/rendering/RenderSVGGradientStop.cpp @@ -48,10 +48,8 @@ void RenderSVGGradientStop::styleDidChange(StyleDifference diff, const RenderSty // <stop> elements should only be allowed to make renderers under gradient elements // but I can imagine a few cases we might not be catching, so let's not crash if our parent isn't a gradient. - if (SVGGradientElement* gradient = gradientElement()) { - if (SVGResource* resource = gradient->canvasResource(this)) - resource->invalidate(); - } + if (SVGGradientElement* gradient = gradientElement()) + gradient->invalidateResourceClients(); } void RenderSVGGradientStop::layout() diff --git a/WebCore/rendering/RenderSVGGradientStop.h b/WebCore/rendering/RenderSVGGradientStop.h index 1d0858d..45da7b4 100644 --- a/WebCore/rendering/RenderSVGGradientStop.h +++ b/WebCore/rendering/RenderSVGGradientStop.h @@ -27,32 +27,40 @@ namespace WebCore { - class SVGGradientElement; - class SVGStopElement; - - // This class exists mostly so we can hear about gradient stop style changes - class RenderSVGGradientStop : public RenderObject { - public: - RenderSVGGradientStop(SVGStopElement*); - virtual ~RenderSVGGradientStop(); +class SVGGradientElement; +class SVGStopElement; + +// This class exists mostly so we can hear about gradient stop style changes +class RenderSVGGradientStop : public RenderObject { +public: + RenderSVGGradientStop(SVGStopElement*); + virtual ~RenderSVGGradientStop(); + + virtual bool isSVGGradientStop() const { return true; } + virtual const char* renderName() const { return "RenderSVGGradientStop"; } - virtual const char* renderName() const { return "RenderSVGGradientStop"; } + virtual void layout(); - virtual void layout(); + // This overrides are needed to prevent ASSERTs on <svg><stop /></svg> + // RenderObject's default implementations ASSERT_NOT_REACHED() + // https://bugs.webkit.org/show_bug.cgi?id=20400 + virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject*) { return IntRect(); } + virtual FloatRect objectBoundingBox() const { return FloatRect(); } + virtual FloatRect repaintRectInLocalCoordinates() const { return FloatRect(); } - // This overrides are needed to prevent ASSERTs on <svg><stop /></svg> - // RenderObject's default implementations ASSERT_NOT_REACHED() - // https://bugs.webkit.org/show_bug.cgi?id=20400 - virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject*) { return IntRect(); } - virtual FloatRect objectBoundingBox() const { return FloatRect(); } - virtual FloatRect repaintRectInLocalCoordinates() const { return FloatRect(); } +protected: + virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); - protected: - virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); +private: + SVGGradientElement* gradientElement() const; +}; + +inline const RenderSVGGradientStop* toRenderSVGGradientStop(const RenderObject* object) +{ + ASSERT(!object || object->isSVGGradientStop()); + return static_cast<const RenderSVGGradientStop*>(object); +} - private: - SVGGradientElement* gradientElement() const; - }; } #endif // ENABLE(SVG) diff --git a/WebCore/rendering/RenderSVGImage.h b/WebCore/rendering/RenderSVGImage.h index 120ac72..512892c 100644 --- a/WebCore/rendering/RenderSVGImage.h +++ b/WebCore/rendering/RenderSVGImage.h @@ -41,7 +41,6 @@ public: virtual void setNeedsTransformUpdate() { m_needsTransformUpdate = true; } private: - virtual const SVGRenderBase* toSVGRenderBase() const { return this; } virtual const char* renderName() const { return "RenderSVGImage"; } virtual bool isSVGImage() const { return true; } diff --git a/WebCore/rendering/RenderSVGInline.cpp b/WebCore/rendering/RenderSVGInline.cpp index 33459ce..85d148e 100644 --- a/WebCore/rendering/RenderSVGInline.cpp +++ b/WebCore/rendering/RenderSVGInline.cpp @@ -75,14 +75,10 @@ FloatRect RenderSVGInline::objectBoundingBox() const FloatRect RenderSVGInline::strokeBoundingBox() const { - const RenderObject* object = findTextRootObject(this); - ASSERT(object); - - const SVGRenderBase* renderer = object->toSVGRenderBase(); - if (!renderer) - return FloatRect(); + if (const RenderObject* object = findTextRootObject(this)) + return object->strokeBoundingBox(); - return renderer->strokeBoundingBox(); + return FloatRect(); } FloatRect RenderSVGInline::repaintRectInLocalCoordinates() const diff --git a/WebCore/rendering/RenderSVGInline.h b/WebCore/rendering/RenderSVGInline.h index e57b936..1afbb97 100644 --- a/WebCore/rendering/RenderSVGInline.h +++ b/WebCore/rendering/RenderSVGInline.h @@ -35,8 +35,6 @@ class RenderSVGInline : public RenderInline, protected SVGRenderBase { public: RenderSVGInline(Node*); - virtual const SVGRenderBase* toSVGRenderBase() const { return this; } - virtual const char* renderName() const { return "RenderSVGInline"; } virtual bool requiresLayer() const { return false; } diff --git a/WebCore/rendering/RenderSVGModelObject.h b/WebCore/rendering/RenderSVGModelObject.h index 760e79a..affa18d 100644 --- a/WebCore/rendering/RenderSVGModelObject.h +++ b/WebCore/rendering/RenderSVGModelObject.h @@ -49,8 +49,6 @@ class RenderSVGModelObject : public RenderObject, protected SVGRenderBase { public: RenderSVGModelObject(SVGStyledElement*); - virtual const SVGRenderBase* toSVGRenderBase() const { return this; } - virtual bool requiresLayer() const { return false; } virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer); diff --git a/WebCore/rendering/RenderSVGResource.cpp b/WebCore/rendering/RenderSVGResource.cpp new file mode 100644 index 0000000..821e58a --- /dev/null +++ b/WebCore/rendering/RenderSVGResource.cpp @@ -0,0 +1,202 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> + * 2007 Rob Buis <buis@kde.org> + * 2008 Dirk Schulze <krit@webkit.org> + * Copyright (C) Research In Motion Limited 2010. 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. + * + */ + +#include "config.h" + +#if ENABLE(SVG) +#include "RenderSVGResource.h" + +#include "RenderSVGResourceContainer.h" +#include "RenderSVGResourceSolidColor.h" +#include "SVGURIReference.h" + +namespace WebCore { + +static inline void registerPendingResource(const AtomicString& id, const SVGPaint::SVGPaintType& paintType, const RenderObject* object) +{ + if (paintType != SVGPaint::SVG_PAINTTYPE_URI) + return; + + SVGElement* svgElement = static_cast<SVGElement*>(object->node()); + ASSERT(svgElement); + ASSERT(svgElement->isStyled()); + + object->document()->accessSVGExtensions()->addPendingResource(id, static_cast<SVGStyledElement*>(svgElement)); +} + +static inline void adjustColorForPseudoRules(const RenderStyle* style, bool useFillPaint, Color& color) +{ + if (style->insideLink() != InsideVisitedLink) + return; + + RenderStyle* visitedStyle = style->getCachedPseudoStyle(VISITED_LINK); + SVGPaint* visitedPaint = useFillPaint ? visitedStyle->svgStyle()->fillPaint() : visitedStyle->svgStyle()->strokePaint(); + if (visitedPaint->paintType() == SVGPaint::SVG_PAINTTYPE_URI) + return; + + Color visitedColor; + if (visitedPaint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR) + visitedColor = visitedStyle->color(); + else + visitedColor = visitedPaint->color(); + + if (visitedColor.isValid()) + color = Color(visitedColor.red(), visitedColor.green(), visitedColor.blue(), color.alpha()); +} + +// FIXME: This method and strokePaintingResource() should be refactored, to share even more code +RenderSVGResource* RenderSVGResource::fillPaintingResource(const RenderObject* object, const RenderStyle* style) +{ + ASSERT(object); + ASSERT(style); + + const SVGRenderStyle* svgStyle = style->svgStyle(); + if (!svgStyle || !svgStyle->hasFill()) + return 0; + + SVGPaint* fillPaint = svgStyle->fillPaint(); + ASSERT(fillPaint); + + RenderSVGResource* fillPaintingResource = 0; + + SVGPaint::SVGPaintType paintType = fillPaint->paintType(); + if (paintType == SVGPaint::SVG_PAINTTYPE_URI + || paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR) { + AtomicString id(SVGURIReference::getTarget(fillPaint->uri())); + fillPaintingResource = getRenderSVGResourceContainerById(object->document(), id); + + if (!fillPaintingResource) + registerPendingResource(id, paintType, object); + } + + if (paintType != SVGPaint::SVG_PAINTTYPE_URI && !fillPaintingResource) { + RenderSVGResourceSolidColor* solidResource = sharedSolidPaintingResource(); + fillPaintingResource = solidResource; + + Color fillColor; + if (fillPaint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR) + fillColor = style->color(); + else + fillColor = fillPaint->color(); + + adjustColorForPseudoRules(style, true /* useFillPaint */, fillColor); + + // FIXME: Ideally invalid colors would never get set on the RenderStyle and this could turn into an ASSERT + if (fillColor.isValid()) + solidResource->setColor(fillColor); + else + fillPaintingResource = 0; + } + + if (!fillPaintingResource) { + // default value (black), see bug 11017 + RenderSVGResourceSolidColor* solidResource = sharedSolidPaintingResource(); + solidResource->setColor(Color::black); + fillPaintingResource = solidResource; + } + + return fillPaintingResource; +} + +RenderSVGResource* RenderSVGResource::strokePaintingResource(const RenderObject* object, const RenderStyle* style) +{ + ASSERT(object); + ASSERT(style); + + const SVGRenderStyle* svgStyle = style->svgStyle(); + if (!svgStyle || !svgStyle->hasStroke()) + return 0; + + SVGPaint* strokePaint = svgStyle->strokePaint(); + ASSERT(strokePaint); + + RenderSVGResource* strokePaintingResource = 0; + FloatRect objectBoundingBox = object->objectBoundingBox(); + + SVGPaint::SVGPaintType paintType = strokePaint->paintType(); + if (!objectBoundingBox.isEmpty() + && (paintType == SVGPaint::SVG_PAINTTYPE_URI || paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR)) { + AtomicString id(SVGURIReference::getTarget(strokePaint->uri())); + strokePaintingResource = getRenderSVGResourceContainerById(object->document(), id); + + if (!strokePaintingResource) + registerPendingResource(id, paintType, object); + } + + if (paintType != SVGPaint::SVG_PAINTTYPE_URI && !strokePaintingResource) { + RenderSVGResourceSolidColor* solidResource = sharedSolidPaintingResource(); + strokePaintingResource = solidResource; + + Color strokeColor; + if (strokePaint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR) + strokeColor = style->color(); + else + strokeColor = strokePaint->color(); + + adjustColorForPseudoRules(style, false /* useFillPaint */, strokeColor); + + // FIXME: Ideally invalid colors would never get set on the RenderStyle and this could turn into an ASSERT + if (strokeColor.isValid()) + solidResource->setColor(strokeColor); + else + strokePaintingResource = 0; + } + + if (!strokePaintingResource) { + // default value (black), see bug 11017 + RenderSVGResourceSolidColor* solidResource = sharedSolidPaintingResource(); + solidResource->setColor(Color::black); + strokePaintingResource = solidResource; + } + + return strokePaintingResource; +} + +RenderSVGResourceSolidColor* RenderSVGResource::sharedSolidPaintingResource() +{ + static RenderSVGResourceSolidColor* s_sharedSolidPaintingResource = 0; + if (!s_sharedSolidPaintingResource) + s_sharedSolidPaintingResource = new RenderSVGResourceSolidColor; + return s_sharedSolidPaintingResource; +} + +void RenderSVGResource::markForLayoutAndResourceInvalidation(RenderObject* object) +{ + ASSERT(object); + ASSERT(object->node()); + ASSERT(object->node()->isSVGElement()); + + // Mark the renderer for layout + object->setNeedsLayout(true); + + // Notify any resources in the ancestor chain, that we've been invalidated + SVGElement* element = static_cast<SVGElement*>(object->node()); + if (!element->isStyled()) + return; + + static_cast<SVGStyledElement*>(element)->invalidateResourcesInAncestorChain(); +} + +} + +#endif diff --git a/WebCore/rendering/RenderSVGResource.h b/WebCore/rendering/RenderSVGResource.h index 1665404..f14fa4a 100644 --- a/WebCore/rendering/RenderSVGResource.h +++ b/WebCore/rendering/RenderSVGResource.h @@ -22,64 +22,47 @@ #define RenderSVGResource_h #if ENABLE(SVG) -#include "FloatRect.h" -#include "RenderSVGHiddenContainer.h" +#include "SVGDocumentExtensions.h" namespace WebCore { enum RenderSVGResourceType { MaskerResourceType, MarkerResourceType, + PatternResourceType, + LinearGradientResourceType, + RadialGradientResourceType, + SolidColorResourceType, FilterResourceType, ClipperResourceType }; -class RenderSVGResource : public RenderSVGHiddenContainer { -public: - RenderSVGResource(SVGStyledElement* node) - : RenderSVGHiddenContainer(node) - , m_id(node->getIDAttribute()) - { - ASSERT(node->document()); - node->document()->accessSVGExtensions()->addResource(m_id, this); - } - - virtual ~RenderSVGResource() - { - ASSERT(node()); - ASSERT(node()->document()); - node()->document()->accessSVGExtensions()->removeResource(m_id); - } - - void idChanged() - { - ASSERT(node()); - ASSERT(node()->document()); - SVGDocumentExtensions* extensions = node()->document()->accessSVGExtensions(); - - // Remove old id, that is guaranteed to be present in cache - extensions->removeResource(m_id); +enum RenderSVGResourceMode { + ApplyToDefaultMode = 1 << 0, // used for all resources except gradient/pattern + ApplyToFillMode = 1 << 1, + ApplyToStrokeMode = 1 << 2, + ApplyToTextMode = 1 << 3 // used in combination with ApplyTo{Fill|Stroke}Mode +}; - m_id = static_cast<Element*>(node())->getIDAttribute(); +class FloatRect; +class GraphicsContext; +class RenderObject; +class RenderStyle; +class RenderSVGResourceSolidColor; - // It's possible that an element is referencing us with the new id, and has to be notified that we're existing now - if (extensions->isPendingResource(m_id)) { - OwnPtr<HashSet<SVGStyledElement*> > clients(extensions->removePendingResource(m_id)); - if (clients->isEmpty()) - return; +class RenderSVGResource { +public: + RenderSVGResource() { } + virtual ~RenderSVGResource() { } - HashSet<SVGStyledElement*>::const_iterator it = clients->begin(); - const HashSet<SVGStyledElement*>::const_iterator end = clients->end(); + virtual void invalidateClients() = 0; + virtual void invalidateClient(RenderObject*) = 0; - for (; it != end; ++it) { - if (RenderObject* renderer = (*it)->renderer()) - renderer->setNeedsLayout(true); - } - } + virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode) = 0; + virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short) { } + virtual FloatRect resourceBoundingBox(const FloatRect&) const = 0; - // Recache us with the new id - extensions->addResource(m_id, this); - } + virtual RenderSVGResourceType resourceType() const = 0; template<class Renderer> Renderer* cast() @@ -90,35 +73,15 @@ public: return 0; } - virtual RenderSVGResource* toRenderSVGResource() { return this; } - virtual bool isSVGResource() const { return true; } - virtual bool drawsContents() { return false; } - - virtual void invalidateClients() = 0; - virtual void invalidateClient(RenderObject*) = 0; - - virtual bool applyResource(RenderObject*, GraphicsContext*&) = 0; - virtual void postApplyResource(RenderObject*, GraphicsContext*&) { } - virtual FloatRect resourceBoundingBox(const FloatRect&) const = 0; - - virtual RenderSVGResourceType resourceType() const = 0; + // Helper utilities used in the render tree to access resources used for painting shapes/text (gradients & patterns only) + static RenderSVGResource* fillPaintingResource(const RenderObject*, const RenderStyle*); + static RenderSVGResource* strokePaintingResource(const RenderObject*, const RenderStyle*); + static RenderSVGResourceSolidColor* sharedSolidPaintingResource(); -private: - AtomicString m_id; +protected: + void markForLayoutAndResourceInvalidation(RenderObject*); }; -template<typename Renderer> -Renderer* getRenderSVGResourceById(Document* document, const AtomicString& id) -{ - if (id.isEmpty()) - return 0; - - if (RenderSVGResource* renderResource = document->accessSVGExtensions()->resourceById(id)) - return renderResource->cast<Renderer>(); - - return 0; -} - } #endif diff --git a/WebCore/rendering/RenderSVGResourceClipper.cpp b/WebCore/rendering/RenderSVGResourceClipper.cpp index ccb7397..2759976 100644 --- a/WebCore/rendering/RenderSVGResourceClipper.cpp +++ b/WebCore/rendering/RenderSVGResourceClipper.cpp @@ -38,13 +38,14 @@ #include "SVGStyledTransformableElement.h" #include "SVGUnitTypes.h" #include "SVGUseElement.h" +#include <wtf/UnusedParam.h> namespace WebCore { RenderSVGResourceType RenderSVGResourceClipper::s_resourceType = ClipperResourceType; -RenderSVGResourceClipper::RenderSVGResourceClipper(SVGStyledElement* node) - : RenderSVGResource(node) +RenderSVGResourceClipper::RenderSVGResourceClipper(SVGClipPathElement* node) + : RenderSVGResourceContainer(node) { } @@ -78,10 +79,18 @@ void RenderSVGResourceClipper::invalidateClient(RenderObject* object) return; delete m_clipper.take(object); + markForLayoutAndResourceInvalidation(object); } -bool RenderSVGResourceClipper::applyResource(RenderObject* object, GraphicsContext*& context) +bool RenderSVGResourceClipper::applyResource(RenderObject* object, RenderStyle*, GraphicsContext*& context, unsigned short resourceMode) { + ASSERT(object); + ASSERT(context); +#ifndef NDEBUG + ASSERT(resourceMode == ApplyToDefaultMode); +#else + UNUSED_PARAM(resourceMode); +#endif applyClippingToContext(object, object->objectBoundingBox(), object->repaintRectInLocalCoordinates(), context); return true; } @@ -142,9 +151,6 @@ bool RenderSVGResourceClipper::pathOnlyClipping(GraphicsContext* context, const bool RenderSVGResourceClipper::applyClippingToContext(RenderObject* object, const FloatRect& objectBoundingBox, const FloatRect& repaintRect, GraphicsContext* context) { - ASSERT(object); - ASSERT(context); - if (!m_clipper.contains(object)) m_clipper.set(object, new ClipperData); diff --git a/WebCore/rendering/RenderSVGResourceClipper.h b/WebCore/rendering/RenderSVGResourceClipper.h index 8de17d4..0b6f2b3 100644 --- a/WebCore/rendering/RenderSVGResourceClipper.h +++ b/WebCore/rendering/RenderSVGResourceClipper.h @@ -27,7 +27,7 @@ #include "ImageBuffer.h" #include "IntSize.h" #include "Path.h" -#include "RenderSVGResource.h" +#include "RenderSVGResourceContainer.h" #include "SVGClipPathElement.h" #include "SVGUnitTypes.h" @@ -40,10 +40,9 @@ struct ClipperData { OwnPtr<ImageBuffer> clipMaskImage; }; -class RenderSVGResourceClipper : public RenderSVGResource { - +class RenderSVGResourceClipper : public RenderSVGResourceContainer { public: - RenderSVGResourceClipper(SVGStyledElement*); + RenderSVGResourceClipper(SVGClipPathElement*); virtual ~RenderSVGResourceClipper(); virtual const char* renderName() const { return "RenderSVGResourceClipper"; } @@ -51,7 +50,7 @@ public: virtual void invalidateClients(); virtual void invalidateClient(RenderObject*); - virtual bool applyResource(RenderObject*, GraphicsContext*&); + virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode); virtual FloatRect resourceBoundingBox(const FloatRect&) const; virtual RenderSVGResourceType resourceType() const { return ClipperResourceType; } diff --git a/WebCore/rendering/RenderSVGResourceContainer.h b/WebCore/rendering/RenderSVGResourceContainer.h new file mode 100644 index 0000000..b63575d --- /dev/null +++ b/WebCore/rendering/RenderSVGResourceContainer.h @@ -0,0 +1,111 @@ +/* + * Copyright (C) Research In Motion Limited 2010. 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 RenderSVGResourceContainer_h +#define RenderSVGResourceContainer_h + +#if ENABLE(SVG) +#include "RenderSVGHiddenContainer.h" +#include "RenderSVGResource.h" + +namespace WebCore { + +class RenderSVGResourceContainer : public RenderSVGHiddenContainer, + public RenderSVGResource { +public: + RenderSVGResourceContainer(SVGStyledElement* node) + : RenderSVGHiddenContainer(node) + , RenderSVGResource() + , m_id(node->getIDAttribute()) + { + ASSERT(node->document()); + node->document()->accessSVGExtensions()->addResource(m_id, this); + } + + virtual ~RenderSVGResourceContainer() + { + ASSERT(node()); + ASSERT(node()->document()); + node()->document()->accessSVGExtensions()->removeResource(m_id); + } + + void idChanged() + { + ASSERT(node()); + ASSERT(node()->document()); + SVGDocumentExtensions* extensions = node()->document()->accessSVGExtensions(); + + // Remove old id, that is guaranteed to be present in cache + extensions->removeResource(m_id); + + m_id = static_cast<Element*>(node())->getIDAttribute(); + + // It's possible that an element is referencing us with the new id, and has to be notified that we're existing now + if (extensions->isPendingResource(m_id)) { + OwnPtr<HashSet<SVGStyledElement*> > clients(extensions->removePendingResource(m_id)); + if (clients->isEmpty()) + return; + + HashSet<SVGStyledElement*>::const_iterator it = clients->begin(); + const HashSet<SVGStyledElement*>::const_iterator end = clients->end(); + + for (; it != end; ++it) { + if (RenderObject* renderer = (*it)->renderer()) + renderer->setNeedsLayout(true); + } + } + + // Recache us with the new id + extensions->addResource(m_id, this); + } + + virtual bool isSVGResourceContainer() const { return true; } + virtual bool drawsContents() { return false; } + + virtual RenderSVGResourceContainer* toRenderSVGResourceContainer() { return this; } + +private: + AtomicString m_id; +}; + +inline RenderSVGResourceContainer* getRenderSVGResourceContainerById(Document* document, const AtomicString& id) +{ + if (id.isEmpty()) + return 0; + + if (RenderSVGResourceContainer* renderResource = document->accessSVGExtensions()->resourceById(id)) + return renderResource; + + return 0; +} + +template<typename Renderer> +Renderer* getRenderSVGResourceById(Document* document, const AtomicString& id) +{ + if (RenderSVGResourceContainer* container = getRenderSVGResourceContainerById(document, id)) + return container->cast<Renderer>(); + + return 0; +} + +} + +#endif +#endif diff --git a/WebCore/rendering/RenderSVGResourceFilter.cpp b/WebCore/rendering/RenderSVGResourceFilter.cpp index cbedfe3..ac3ea49 100644 --- a/WebCore/rendering/RenderSVGResourceFilter.cpp +++ b/WebCore/rendering/RenderSVGResourceFilter.cpp @@ -43,6 +43,7 @@ #include "SVGStyledElement.h" #include "SVGUnitTypes.h" #include <wtf/Vector.h> +#include <wtf/UnusedParam.h> static const float kMaxFilterSize = 5000.0f; @@ -52,8 +53,8 @@ namespace WebCore { RenderSVGResourceType RenderSVGResourceFilter::s_resourceType = FilterResourceType; -RenderSVGResourceFilter::RenderSVGResourceFilter(SVGStyledElement* node) - : RenderSVGResource(node) +RenderSVGResourceFilter::RenderSVGResourceFilter(SVGFilterElement* node) + : RenderSVGResourceContainer(node) , m_savedContext(0) , m_sourceGraphicBuffer(0) { @@ -88,7 +89,8 @@ void RenderSVGResourceFilter::invalidateClient(RenderObject* object) if (!m_filter.contains(object)) return; - delete m_filter.take(object); + delete m_filter.take(object); + markForLayoutAndResourceInvalidation(object); } PassOwnPtr<SVGFilterBuilder> RenderSVGResourceFilter::buildPrimitives() @@ -134,10 +136,15 @@ bool RenderSVGResourceFilter::fitsInMaximumImageSize(const FloatSize& size, Floa return matchesFilterSize; } -bool RenderSVGResourceFilter::applyResource(RenderObject* object, GraphicsContext*& context) +bool RenderSVGResourceFilter::applyResource(RenderObject* object, RenderStyle*, GraphicsContext*& context, unsigned short resourceMode) { ASSERT(object); ASSERT(context); +#ifndef NDEBUG + ASSERT(resourceMode == ApplyToDefaultMode); +#else + UNUSED_PARAM(resourceMode); +#endif // Returning false here, to avoid drawings onto the context. We just want to // draw the stored filter output, not the unfiltered object as well. @@ -154,12 +161,7 @@ bool RenderSVGResourceFilter::applyResource(RenderObject* object, GraphicsContex if (!filterData->builder) return false; - const SVGRenderBase* renderer = object->toSVGRenderBase(); - if (!renderer) - return false; - - FloatRect paintRect = renderer->strokeBoundingBox(); - paintRect.unite(renderer->markerBoundingBox()); + FloatRect paintRect = object->strokeBoundingBox(); // Calculate the scale factor for the use of filterRes. // Also see http://www.w3.org/TR/SVG/filters.html#FilterEffectsRegion @@ -228,10 +230,15 @@ bool RenderSVGResourceFilter::applyResource(RenderObject* object, GraphicsContex return true; } -void RenderSVGResourceFilter::postApplyResource(RenderObject* object, GraphicsContext*& context) +void RenderSVGResourceFilter::postApplyResource(RenderObject* object, GraphicsContext*& context, unsigned short resourceMode) { ASSERT(object); ASSERT(context); +#ifndef NDEBUG + ASSERT(resourceMode == ApplyToDefaultMode); +#else + UNUSED_PARAM(resourceMode); +#endif if (!m_filter.contains(object)) return; diff --git a/WebCore/rendering/RenderSVGResourceFilter.h b/WebCore/rendering/RenderSVGResourceFilter.h index 2cd4b6c..ce4a7e1 100644 --- a/WebCore/rendering/RenderSVGResourceFilter.h +++ b/WebCore/rendering/RenderSVGResourceFilter.h @@ -28,7 +28,7 @@ #if ENABLE(SVG) && ENABLE(FILTERS) #include "FloatRect.h" #include "ImageBuffer.h" -#include "RenderSVGResource.h" +#include "RenderSVGResourceContainer.h" #include "SVGFilter.h" #include "SVGFilterBuilder.h" #include "SVGFilterElement.h" @@ -55,9 +55,9 @@ struct FilterData { class GraphicsContext; -class RenderSVGResourceFilter : public RenderSVGResource { +class RenderSVGResourceFilter : public RenderSVGResourceContainer { public: - RenderSVGResourceFilter(SVGStyledElement*); + RenderSVGResourceFilter(SVGFilterElement*); virtual ~RenderSVGResourceFilter(); virtual const char* renderName() const { return "RenderSVGResourceFilter"; } @@ -65,8 +65,8 @@ public: virtual void invalidateClients(); virtual void invalidateClient(RenderObject*); - virtual bool applyResource(RenderObject*, GraphicsContext*&); - virtual void postApplyResource(RenderObject*, GraphicsContext*&); + virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode); + virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode); virtual FloatRect resourceBoundingBox(const FloatRect&) const; diff --git a/WebCore/rendering/RenderSVGResourceGradient.cpp b/WebCore/rendering/RenderSVGResourceGradient.cpp new file mode 100644 index 0000000..6c9d784 --- /dev/null +++ b/WebCore/rendering/RenderSVGResourceGradient.cpp @@ -0,0 +1,265 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> + * 2008 Eric Seidel <eric@webkit.org> + * 2008 Dirk Schulze <krit@webkit.org> + * Copyright (C) Research In Motion Limited 2010. 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. + * + */ + +#include "config.h" + +#if ENABLE(SVG) +#include "RenderSVGResourceGradient.h" + +#include "GradientAttributes.h" +#include "GraphicsContext.h" +#include "SVGRenderSupport.h" +#include <wtf/UnusedParam.h> + +namespace WebCore { + +RenderSVGResourceGradient::RenderSVGResourceGradient(SVGGradientElement* node) + : RenderSVGResourceContainer(node) +#if PLATFORM(CG) + , m_savedContext(0) +#endif +{ +} + +RenderSVGResourceGradient::~RenderSVGResourceGradient() +{ + deleteAllValues(m_gradient); + m_gradient.clear(); +} + +void RenderSVGResourceGradient::invalidateClients() +{ + const HashMap<RenderObject*, GradientData*>::const_iterator end = m_gradient.end(); + for (HashMap<RenderObject*, GradientData*>::const_iterator it = m_gradient.begin(); it != end; ++it) + markForLayoutAndResourceInvalidation(it->first); + + deleteAllValues(m_gradient); + m_gradient.clear(); +} + +void RenderSVGResourceGradient::invalidateClient(RenderObject* object) +{ + ASSERT(object); + + // FIXME: The HashMap should always contain the object on calling invalidateClient. A race condition + // during the parsing can causes a call of invalidateClient right before the call of applyResource. + // We return earlier for the moment. This bug should be fixed in: + // https://bugs.webkit.org/show_bug.cgi?id=35181 + if (!m_gradient.contains(object)) + return; + + delete m_gradient.take(object); + markForLayoutAndResourceInvalidation(object); +} + +#if PLATFORM(CG) +static inline AffineTransform absoluteTransformForRenderer(const RenderObject* object) +{ + AffineTransform absoluteTransform; + + const RenderObject* currentObject = object; + while (currentObject) { + absoluteTransform = currentObject->localToParentTransform() * absoluteTransform; + currentObject = currentObject->parent(); + } + + return absoluteTransform; +} + +static inline bool createMaskAndSwapContextForTextGradient(GraphicsContext*& context, + GraphicsContext*& savedContext, + OwnPtr<ImageBuffer>& imageBuffer, + const RenderObject* object) +{ + const RenderObject* textRootBlock = findTextRootObject(object); + + AffineTransform transform = absoluteTransformForRenderer(textRootBlock); + FloatRect maskAbsoluteBoundingBox = transform.mapRect(textRootBlock->repaintRectInLocalCoordinates()); + + IntRect maskImageRect = enclosingIntRect(maskAbsoluteBoundingBox); + if (maskImageRect.isEmpty()) + return false; + + // Allocate an image buffer as big as the absolute unclipped size of the object + OwnPtr<ImageBuffer> maskImage = ImageBuffer::create(maskImageRect.size()); + if (!maskImage) + return false; + + GraphicsContext* maskImageContext = maskImage->context(); + + // Transform the mask image coordinate system to absolute screen coordinates + maskImageContext->translate(-maskAbsoluteBoundingBox.x(), -maskAbsoluteBoundingBox.y()); + maskImageContext->concatCTM(transform); + + imageBuffer.set(maskImage.release()); + savedContext = context; + context = maskImageContext; + + return true; +} + +static inline AffineTransform clipToTextMask(GraphicsContext* context, + OwnPtr<ImageBuffer>& imageBuffer, + const RenderObject* object, + GradientData* gradientData) +{ + const RenderObject* textRootBlock = findTextRootObject(object); + context->clipToImageBuffer(textRootBlock->repaintRectInLocalCoordinates(), imageBuffer.get()); + + AffineTransform matrix; + if (gradientData->boundingBoxMode) { + FloatRect maskBoundingBox = textRootBlock->objectBoundingBox(); + matrix.translate(maskBoundingBox.x(), maskBoundingBox.y()); + matrix.scaleNonUniform(maskBoundingBox.width(), maskBoundingBox.height()); + } + matrix.multiply(gradientData->transform); + return matrix; +} +#endif + +bool RenderSVGResourceGradient::applyResource(RenderObject* object, RenderStyle* style, GraphicsContext*& context, unsigned short resourceMode) +{ + ASSERT(object); + ASSERT(style); + ASSERT(context); + ASSERT(resourceMode != ApplyToDefaultMode); + + // Be sure to synchronize all SVG properties on the gradientElement _before_ processing any further. + // Otherwhise the call to collectGradientAttributes() in createTileImage(), may cause the SVG DOM property + // synchronization to kick in, which causes invalidateClients() to be called, which in turn deletes our + // GradientData object! Leaving out the line below will cause svg/dynamic-updates/SVG*GradientElement-svgdom* to crash. + SVGGradientElement* gradientElement = static_cast<SVGGradientElement*>(node()); + if (!gradientElement) + return false; + + gradientElement->updateAnimatedSVGAttribute(anyQName()); + + if (!m_gradient.contains(object)) + m_gradient.set(object, new GradientData); + + GradientData* gradientData = m_gradient.get(object); + + // Create gradient object + if (!gradientData->gradient) + buildGradient(gradientData, gradientElement); + + if (!gradientData->gradient) + return false; + + // Draw gradient + context->save(); + + bool isPaintingText = resourceMode & ApplyToTextMode; + if (isPaintingText) { +#if PLATFORM(CG) + if (!createMaskAndSwapContextForTextGradient(context, m_savedContext, m_imageBuffer, object)) { + context->restore(); + return false; + } +#endif + + context->setTextDrawingMode(resourceMode & ApplyToFillMode ? cTextFill : cTextStroke); + } + + AffineTransform transform; + + // CG platforms will handle the gradient space transform for text after applying the + // resource, so don't apply it here. For non-CG platforms, we want the text bounding + // box applied to the gradient space transform now, so the gradient shader can use it. +#if PLATFORM(CG) + if (gradientData->boundingBoxMode && !isPaintingText) { +#else + if (gradientData->boundingBoxMode) { +#endif + FloatRect objectBoundingBox = object->objectBoundingBox(); + transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); + transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height()); + } + + transform.multiply(gradientData->transform); + gradientData->gradient->setGradientSpaceTransform(transform); + + const SVGRenderStyle* svgStyle = style->svgStyle(); + ASSERT(svgStyle); + + if (resourceMode & ApplyToFillMode) { + context->setAlpha(svgStyle->fillOpacity()); + context->setFillGradient(gradientData->gradient); + context->setFillRule(svgStyle->fillRule()); + } else if (resourceMode & ApplyToStrokeMode) { + context->setAlpha(svgStyle->strokeOpacity()); + context->setStrokeGradient(gradientData->gradient); + applyStrokeStyleToContext(context, style, object); + } + + return true; +} + +void RenderSVGResourceGradient::postApplyResource(RenderObject* object, GraphicsContext*& context, unsigned short resourceMode) +{ + ASSERT(context); + ASSERT(resourceMode != ApplyToDefaultMode); + + if (resourceMode & ApplyToTextMode) { +#if PLATFORM(CG) + // CG requires special handling for gradient on text + if (m_savedContext && m_gradient.contains(object)) { + GradientData* gradientData = m_gradient.get(object); + + // Restore on-screen drawing context + context = m_savedContext; + m_savedContext = 0; + + gradientData->gradient->setGradientSpaceTransform(clipToTextMask(context, m_imageBuffer, object, gradientData)); + context->setFillGradient(gradientData->gradient); + + const RenderObject* textRootBlock = findTextRootObject(object); + context->fillRect(textRootBlock->repaintRectInLocalCoordinates()); + + m_imageBuffer.clear(); + } +#else + UNUSED_PARAM(object); +#endif + } else { + if (resourceMode & ApplyToFillMode) + context->fillPath(); + else if (resourceMode & ApplyToStrokeMode) + context->strokePath(); + } + + context->restore(); +} + +void RenderSVGResourceGradient::addStops(GradientData* gradientData, const Vector<Gradient::ColorStop>& stops) const +{ + ASSERT(gradientData->gradient); + + const Vector<Gradient::ColorStop>::const_iterator end = stops.end(); + for (Vector<Gradient::ColorStop>::const_iterator it = stops.begin(); it != end; ++it) + gradientData->gradient->addColorStop(*it); +} + +} + +#endif diff --git a/WebCore/rendering/RenderSVGResourceGradient.h b/WebCore/rendering/RenderSVGResourceGradient.h new file mode 100644 index 0000000..2fd9cf4 --- /dev/null +++ b/WebCore/rendering/RenderSVGResourceGradient.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> + * 2008 Eric Seidel <eric@webkit.org> + * Copyright (C) Research In Motion Limited 2010. 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 RenderSVGResourceGradient_h +#define RenderSVGResourceGradient_h + +#if ENABLE(SVG) +#include "AffineTransform.h" +#include "FloatRect.h" +#include "Gradient.h" +#include "ImageBuffer.h" +#include "RenderSVGResourceContainer.h" +#include "SVGGradientElement.h" + +#include <wtf/HashMap.h> + +namespace WebCore { + +struct GradientData { + RefPtr<Gradient> gradient; + + bool boundingBoxMode; + AffineTransform transform; +}; + +class GraphicsContext; + +class RenderSVGResourceGradient : public RenderSVGResourceContainer { +public: + RenderSVGResourceGradient(SVGGradientElement*); + virtual ~RenderSVGResourceGradient(); + + virtual void invalidateClients(); + virtual void invalidateClient(RenderObject*); + + virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode); + virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode); + virtual FloatRect resourceBoundingBox(const FloatRect&) const { return FloatRect(); } + +protected: + void addStops(GradientData*, const Vector<Gradient::ColorStop>&) const; + virtual void buildGradient(GradientData*, SVGGradientElement*) const = 0; + +private: + HashMap<RenderObject*, GradientData*> m_gradient; + +#if PLATFORM(CG) + GraphicsContext* m_savedContext; + OwnPtr<ImageBuffer> m_imageBuffer; +#endif +}; + +} + +#endif +#endif diff --git a/WebCore/rendering/RenderSVGResourceLinearGradient.cpp b/WebCore/rendering/RenderSVGResourceLinearGradient.cpp new file mode 100644 index 0000000..e34e524 --- /dev/null +++ b/WebCore/rendering/RenderSVGResourceLinearGradient.cpp @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) Research In Motion Limited 2010. 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. + * + */ + +#include "config.h" + +#if ENABLE(SVG) +#include "RenderSVGResourceLinearGradient.h" + +#include "LinearGradientAttributes.h" +#include "SVGLinearGradientElement.h" + +namespace WebCore { + +RenderSVGResourceType RenderSVGResourceLinearGradient::s_resourceType = LinearGradientResourceType; + +RenderSVGResourceLinearGradient::RenderSVGResourceLinearGradient(SVGLinearGradientElement* node) + : RenderSVGResourceGradient(node) +{ +} + +RenderSVGResourceLinearGradient::~RenderSVGResourceLinearGradient() +{ +} + +void RenderSVGResourceLinearGradient::buildGradient(GradientData* gradientData, SVGGradientElement* gradientElement) const +{ + SVGLinearGradientElement* linearGradientElement = static_cast<SVGLinearGradientElement*>(gradientElement); + LinearGradientAttributes attributes = linearGradientElement->collectGradientProperties(); + + // Determine gradient start/end points + FloatPoint startPoint; + FloatPoint endPoint; + linearGradientElement->calculateStartEndPoints(attributes, startPoint, endPoint); + + gradientData->gradient = Gradient::create(startPoint, endPoint); + gradientData->gradient->setSpreadMethod(attributes.spreadMethod()); + + // Record current gradient transform + gradientData->transform = attributes.gradientTransform(); + gradientData->boundingBoxMode = attributes.boundingBoxMode(); + + // Add stops + addStops(gradientData, attributes.stops()); +} + +} + +#endif diff --git a/WebCore/rendering/RenderSVGResourceLinearGradient.h b/WebCore/rendering/RenderSVGResourceLinearGradient.h new file mode 100644 index 0000000..c1f84c2 --- /dev/null +++ b/WebCore/rendering/RenderSVGResourceLinearGradient.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) Research In Motion Limited 2010. 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 RenderSVGResourceLinearGradient_h +#define RenderSVGResourceLinearGradient_h + +#if ENABLE(SVG) +#include "RenderSVGResourceGradient.h" + +namespace WebCore { + +class SVGLinearGradientElement; + +class RenderSVGResourceLinearGradient : public RenderSVGResourceGradient { +public: + RenderSVGResourceLinearGradient(SVGLinearGradientElement*); + virtual ~RenderSVGResourceLinearGradient(); + + virtual const char* renderName() const { return "RenderSVGResourceLinearGradient"; } + + virtual RenderSVGResourceType resourceType() const { return s_resourceType; } + static RenderSVGResourceType s_resourceType; + + virtual void buildGradient(GradientData*, SVGGradientElement*) const; +}; + +} + +#endif +#endif diff --git a/WebCore/rendering/RenderSVGResourceMarker.cpp b/WebCore/rendering/RenderSVGResourceMarker.cpp index c526962..460239b 100644 --- a/WebCore/rendering/RenderSVGResourceMarker.cpp +++ b/WebCore/rendering/RenderSVGResourceMarker.cpp @@ -35,8 +35,8 @@ namespace WebCore { RenderSVGResourceType RenderSVGResourceMarker::s_resourceType = MarkerResourceType; -RenderSVGResourceMarker::RenderSVGResourceMarker(SVGStyledElement* node) - : RenderSVGResource(node) +RenderSVGResourceMarker::RenderSVGResourceMarker(SVGMarkerElement* node) + : RenderSVGResourceContainer(node) { } @@ -82,6 +82,7 @@ void RenderSVGResourceMarker::invalidateClient(RenderObject* object) return; m_marker.remove(object); + markForLayoutAndResourceInvalidation(object); } void RenderSVGResourceMarker::applyViewportClip(PaintInfo& paintInfo) diff --git a/WebCore/rendering/RenderSVGResourceMarker.h b/WebCore/rendering/RenderSVGResourceMarker.h index 9e39b99..efbbdfa 100644 --- a/WebCore/rendering/RenderSVGResourceMarker.h +++ b/WebCore/rendering/RenderSVGResourceMarker.h @@ -24,7 +24,7 @@ #if ENABLE(SVG) #include "FloatRect.h" #include "RenderObject.h" -#include "RenderSVGResource.h" +#include "RenderSVGResourceContainer.h" #include "SVGMarkerElement.h" #include "SVGStyledElement.h" @@ -34,10 +34,9 @@ namespace WebCore { class AffineTransform; -class RenderSVGResourceMarker : public RenderSVGResource { - +class RenderSVGResourceMarker : public RenderSVGResourceContainer { public: - RenderSVGResourceMarker(SVGStyledElement*); + RenderSVGResourceMarker(SVGMarkerElement*); virtual ~RenderSVGResourceMarker(); virtual const char* renderName() const { return "RenderSVGResourceMarker"; } @@ -58,7 +57,7 @@ public: virtual const AffineTransform& localToParentTransform() const; AffineTransform markerTransformation(const FloatPoint& origin, float angle, float strokeWidth) const; - virtual bool applyResource(RenderObject*, GraphicsContext*&) { return false; } + virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short) { return false; } virtual FloatRect resourceBoundingBox(const FloatRect&) const { return FloatRect(); } FloatPoint referencePoint() const; diff --git a/WebCore/rendering/RenderSVGResourceMasker.cpp b/WebCore/rendering/RenderSVGResourceMasker.cpp index 8bb16de..abf8e48 100644 --- a/WebCore/rendering/RenderSVGResourceMasker.cpp +++ b/WebCore/rendering/RenderSVGResourceMasker.cpp @@ -37,13 +37,14 @@ #include "SVGStyledElement.h" #include "SVGUnitTypes.h" #include <wtf/Vector.h> +#include <wtf/UnusedParam.h> namespace WebCore { RenderSVGResourceType RenderSVGResourceMasker::s_resourceType = MaskerResourceType; -RenderSVGResourceMasker::RenderSVGResourceMasker(SVGStyledElement* node) - : RenderSVGResource(node) +RenderSVGResourceMasker::RenderSVGResourceMasker(SVGMaskElement* node) + : RenderSVGResourceContainer(node) { } @@ -77,13 +78,19 @@ void RenderSVGResourceMasker::invalidateClient(RenderObject* object) if (!m_masker.contains(object)) return; - delete m_masker.take(object); + delete m_masker.take(object); + markForLayoutAndResourceInvalidation(object); } -bool RenderSVGResourceMasker::applyResource(RenderObject* object, GraphicsContext*& context) +bool RenderSVGResourceMasker::applyResource(RenderObject* object, RenderStyle*, GraphicsContext*& context, unsigned short resourceMode) { ASSERT(object); ASSERT(context); +#ifndef NDEBUG + ASSERT(resourceMode == ApplyToDefaultMode); +#else + UNUSED_PARAM(resourceMode); +#endif if (!m_masker.contains(object)) m_masker.set(object, new MaskerData); @@ -151,7 +158,7 @@ void RenderSVGResourceMasker::createMaskImage(MaskerData* maskerData, const SVGM maskImageRect.setLocation(IntPoint()); // Don't create ImageBuffers with image size of 0 - if (!maskImageRect.width() || !maskImageRect.height()) { + if (maskImageRect.isEmpty()) { maskerData->emptyMask = true; return; } diff --git a/WebCore/rendering/RenderSVGResourceMasker.h b/WebCore/rendering/RenderSVGResourceMasker.h index 3127e3c..b022f7b 100644 --- a/WebCore/rendering/RenderSVGResourceMasker.h +++ b/WebCore/rendering/RenderSVGResourceMasker.h @@ -26,7 +26,7 @@ #include "GraphicsContext.h" #include "ImageBuffer.h" #include "IntSize.h" -#include "RenderSVGResource.h" +#include "RenderSVGResourceContainer.h" #include "SVGMaskElement.h" #include "SVGUnitTypes.h" @@ -36,9 +36,8 @@ namespace WebCore { struct MaskerData { - MaskerData(FloatRect rect = FloatRect(), bool emptyObject = false) - : maskRect(rect) - , emptyMask(emptyObject) + MaskerData() + : emptyMask(false) { } @@ -47,10 +46,9 @@ struct MaskerData { bool emptyMask; }; -class RenderSVGResourceMasker : public RenderSVGResource { - +class RenderSVGResourceMasker : public RenderSVGResourceContainer { public: - RenderSVGResourceMasker(SVGStyledElement*); + RenderSVGResourceMasker(SVGMaskElement*); virtual ~RenderSVGResourceMasker(); virtual const char* renderName() const { return "RenderSVGResourceMasker"; } @@ -58,7 +56,7 @@ public: virtual void invalidateClients(); virtual void invalidateClient(RenderObject*); - virtual bool applyResource(RenderObject*, GraphicsContext*&); + virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode); virtual FloatRect resourceBoundingBox(const FloatRect&) const; SVGUnitTypes::SVGUnitType maskUnits() const { return toUnitType(static_cast<SVGMaskElement*>(node())->maskUnits()); } diff --git a/WebCore/rendering/RenderSVGResourcePattern.cpp b/WebCore/rendering/RenderSVGResourcePattern.cpp new file mode 100644 index 0000000..8302030 --- /dev/null +++ b/WebCore/rendering/RenderSVGResourcePattern.cpp @@ -0,0 +1,329 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) Research In Motion Limited 2010. 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. + * + */ + +#include "config.h" + +#if ENABLE(SVG) +#include "RenderSVGResourcePattern.h" + +#include "GraphicsContext.h" +#include "PatternAttributes.h" +#include "SVGRenderSupport.h" + +namespace WebCore { + +RenderSVGResourceType RenderSVGResourcePattern::s_resourceType = PatternResourceType; + +RenderSVGResourcePattern::RenderSVGResourcePattern(SVGPatternElement* node) + : RenderSVGResourceContainer(node) +{ +} + +RenderSVGResourcePattern::~RenderSVGResourcePattern() +{ + deleteAllValues(m_pattern); + m_pattern.clear(); +} + +void RenderSVGResourcePattern::invalidateClients() +{ + const HashMap<RenderObject*, PatternData*>::const_iterator end = m_pattern.end(); + for (HashMap<RenderObject*, PatternData*>::const_iterator it = m_pattern.begin(); it != end; ++it) + markForLayoutAndResourceInvalidation(it->first); + + deleteAllValues(m_pattern); + m_pattern.clear(); +} + +void RenderSVGResourcePattern::invalidateClient(RenderObject* object) +{ + ASSERT(object); + + // FIXME: The HashMap should always contain the object on calling invalidateClient. A race condition + // during the parsing can causes a call of invalidateClient right before the call of applyResource. + // We return earlier for the moment. This bug should be fixed in: + // https://bugs.webkit.org/show_bug.cgi?id=35181 + if (!m_pattern.contains(object)) + return; + + delete m_pattern.take(object); + markForLayoutAndResourceInvalidation(object); +} + +bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle* style, GraphicsContext*& context, unsigned short resourceMode) +{ + ASSERT(object); + ASSERT(style); + ASSERT(context); + ASSERT(resourceMode != ApplyToDefaultMode); + + // Be sure to synchronize all SVG properties on the patternElement _before_ processing any further. + // Otherwhise the call to collectPatternAttributes() in createTileImage(), may cause the SVG DOM property + // synchronization to kick in, which causes invalidateClients() to be called, which in turn deletes our + // PatternData object! Leaving out the line below will cause svg/dynamic-updates/SVGPatternElement-svgdom* to crash. + SVGPatternElement* patternElement = static_cast<SVGPatternElement*>(node()); + if (!patternElement) + return false; + + patternElement->updateAnimatedSVGAttribute(anyQName()); + + if (!m_pattern.contains(object)) + m_pattern.set(object, new PatternData); + + PatternData* patternData = m_pattern.get(object); + if (!patternData->pattern) { + FloatRect patternBoundaries; + AffineTransform patternTransform; + + // Create tile image + OwnPtr<ImageBuffer> tileImage = createTileImage(patternBoundaries, patternTransform, patternElement, object); + if (!tileImage) + return false; + + // Create pattern object + buildPattern(patternData, patternBoundaries, tileImage.release()); + + if (!patternData->pattern) + return false; + + // Compute pattern transformation + AffineTransform transform; + transform.translate(patternBoundaries.x(), patternBoundaries.y()); + transform.multiply(patternTransform); + patternData->pattern->setPatternSpaceTransform(transform); + } + + // Draw pattern + context->save(); + + const SVGRenderStyle* svgStyle = style->svgStyle(); + ASSERT(svgStyle); + + if (resourceMode & ApplyToFillMode) { + context->setAlpha(svgStyle->fillOpacity()); + context->setFillPattern(patternData->pattern); + context->setFillRule(svgStyle->fillRule()); + } else if (resourceMode & ApplyToStrokeMode) { + context->setAlpha(svgStyle->strokeOpacity()); + context->setStrokePattern(patternData->pattern); + applyStrokeStyleToContext(context, style, object); + } + + if (resourceMode & ApplyToTextMode) { + if (resourceMode & ApplyToFillMode) { + context->setTextDrawingMode(cTextFill); + +#if PLATFORM(CG) + context->applyFillPattern(); +#endif + } else if (resourceMode & ApplyToStrokeMode) { + context->setTextDrawingMode(cTextStroke); + +#if PLATFORM(CG) + context->applyStrokePattern(); +#endif + } + } + + return true; +} + +void RenderSVGResourcePattern::postApplyResource(RenderObject*, GraphicsContext*& context, unsigned short resourceMode) +{ + ASSERT(context); + ASSERT(resourceMode != ApplyToDefaultMode); + + if (!(resourceMode & ApplyToTextMode)) { + if (resourceMode & ApplyToFillMode) + context->fillPath(); + else if (resourceMode & ApplyToStrokeMode) + context->strokePath(); + } + + context->restore(); +} + +static inline FloatRect calculatePatternBoundaries(PatternAttributes& attributes, + const FloatRect& objectBoundingBox, + const SVGPatternElement* patternElement) +{ + if (attributes.boundingBoxMode()) + return FloatRect(attributes.x().valueAsPercentage() * objectBoundingBox.width(), + attributes.y().valueAsPercentage() * objectBoundingBox.height(), + attributes.width().valueAsPercentage() * objectBoundingBox.width(), + attributes.height().valueAsPercentage() * objectBoundingBox.height()); + + return FloatRect(attributes.x().value(patternElement), + attributes.y().value(patternElement), + attributes.width().value(patternElement), + attributes.height().value(patternElement)); +} + +FloatRect RenderSVGResourcePattern::calculatePatternBoundariesIncludingOverflow(PatternAttributes& attributes, + const FloatRect& objectBoundingBox, + const AffineTransform& viewBoxCTM, + const FloatRect& patternBoundaries) const +{ + // Eventually calculate the pattern content boundaries (only needed with overflow="visible"). + FloatRect patternContentBoundaries; + + const RenderStyle* style = this->style(); + if (style->overflowX() == OVISIBLE && style->overflowY() == OVISIBLE) { + for (Node* node = attributes.patternContentElement()->firstChild(); node; node = node->nextSibling()) { + if (!node->isSVGElement() || !static_cast<SVGElement*>(node)->isStyledTransformable() || !node->renderer()) + continue; + patternContentBoundaries.unite(node->renderer()->repaintRectInLocalCoordinates()); + } + } + + if (patternContentBoundaries.isEmpty()) + return patternBoundaries; + + FloatRect patternBoundariesIncludingOverflow = patternBoundaries; + + // Respect objectBoundingBoxMode for patternContentUnits, if viewBox is not set. + if (!viewBoxCTM.isIdentity()) + patternContentBoundaries = viewBoxCTM.mapRect(patternContentBoundaries); + else if (attributes.boundingBoxModeContent()) + patternContentBoundaries = FloatRect(patternContentBoundaries.x() * objectBoundingBox.width(), + patternContentBoundaries.y() * objectBoundingBox.height(), + patternContentBoundaries.width() * objectBoundingBox.width(), + patternContentBoundaries.height() * objectBoundingBox.height()); + + patternBoundariesIncludingOverflow.unite(patternContentBoundaries); + return patternBoundariesIncludingOverflow; +} + +PassOwnPtr<ImageBuffer> RenderSVGResourcePattern::createTileImage(FloatRect& patternBoundaries, + AffineTransform& patternTransform, + const SVGPatternElement* patternElement, + RenderObject* object) const +{ + PatternAttributes attributes = patternElement->collectPatternProperties(); + + // If we couldn't determine the pattern content element root, stop here. + if (!attributes.patternContentElement()) + return 0; + + FloatRect objectBoundingBox = object->objectBoundingBox(); + patternBoundaries = calculatePatternBoundaries(attributes, objectBoundingBox, patternElement); + patternTransform = attributes.patternTransform(); + + AffineTransform viewBoxCTM = patternElement->viewBoxToViewTransform(patternElement->viewBox(), + patternElement->preserveAspectRatio(), + patternBoundaries.width(), + patternBoundaries.height()); + + FloatRect patternBoundariesIncludingOverflow = calculatePatternBoundariesIncludingOverflow(attributes, + objectBoundingBox, + viewBoxCTM, + patternBoundaries); + + IntSize imageSize(lroundf(patternBoundariesIncludingOverflow.width()), lroundf(patternBoundariesIncludingOverflow.height())); + + // FIXME: We should be able to clip this more, needs investigation + clampImageBufferSizeToViewport(object->document()->view(), imageSize); + + // Don't create ImageBuffers with image size of 0 + if (imageSize.isEmpty()) + return 0; + + OwnPtr<ImageBuffer> tileImage = ImageBuffer::create(imageSize); + + GraphicsContext* context = tileImage->context(); + ASSERT(context); + + context->save(); + + // Translate to pattern start origin + if (patternBoundariesIncludingOverflow.location() != patternBoundaries.location()) { + context->translate(patternBoundaries.x() - patternBoundariesIncludingOverflow.x(), + patternBoundaries.y() - patternBoundariesIncludingOverflow.y()); + + patternBoundaries.setLocation(patternBoundariesIncludingOverflow.location()); + } + + // Process viewBox or boundingBoxModeContent correction + if (!viewBoxCTM.isIdentity()) + context->concatCTM(viewBoxCTM); + else if (attributes.boundingBoxModeContent()) { + context->translate(objectBoundingBox.x(), objectBoundingBox.y()); + context->scale(FloatSize(objectBoundingBox.width(), objectBoundingBox.height())); + } + + // Render subtree into ImageBuffer + for (Node* node = attributes.patternContentElement()->firstChild(); node; node = node->nextSibling()) { + if (!node->isSVGElement() || !static_cast<SVGElement*>(node)->isStyled() || !node->renderer()) + continue; + renderSubtreeToImage(tileImage.get(), node->renderer()); + } + + context->restore(); + return tileImage.release(); +} + +void RenderSVGResourcePattern::buildPattern(PatternData* patternData, const FloatRect& patternBoundaries, PassOwnPtr<ImageBuffer> tileImage) const +{ + if (!tileImage->image()) { + patternData->pattern = 0; + return; + } + + IntRect tileRect = tileImage->image()->rect(); + if (tileRect.width() <= patternBoundaries.width() && tileRect.height() <= patternBoundaries.height()) { + patternData->pattern = Pattern::create(tileImage->image(), true, true); + return; + } + + // Draw the first cell of the pattern manually to support overflow="visible" on all platforms. + int tileWidth = static_cast<int>(patternBoundaries.width() + 0.5f); + int tileHeight = static_cast<int>(patternBoundaries.height() + 0.5f); + + // Don't create ImageBuffers with image size of 0 + if (!tileWidth || !tileHeight) { + patternData->pattern = 0; + return; + } + + OwnPtr<ImageBuffer> newTileImage = ImageBuffer::create(IntSize(tileWidth, tileHeight)); + GraphicsContext* newTileImageContext = newTileImage->context(); + + int numY = static_cast<int>(ceilf(tileRect.height() / tileHeight)) + 1; + int numX = static_cast<int>(ceilf(tileRect.width() / tileWidth)) + 1; + + newTileImageContext->save(); + newTileImageContext->translate(-patternBoundaries.width() * numX, -patternBoundaries.height() * numY); + for (int i = numY; i > 0; --i) { + newTileImageContext->translate(0, patternBoundaries.height()); + for (int j = numX; j > 0; --j) { + newTileImageContext->translate(patternBoundaries.width(), 0); + newTileImageContext->drawImage(tileImage->image(), style()->colorSpace(), tileRect, tileRect); + } + newTileImageContext->translate(-patternBoundaries.width() * numX, 0); + } + newTileImageContext->restore(); + + patternData->pattern = Pattern::create(newTileImage->image(), true, true); +} + +} + +#endif diff --git a/WebCore/rendering/RenderSVGResourcePattern.h b/WebCore/rendering/RenderSVGResourcePattern.h new file mode 100644 index 0000000..2f9d553 --- /dev/null +++ b/WebCore/rendering/RenderSVGResourcePattern.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) Research In Motion Limited 2010. 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 RenderSVGResourcePattern_h +#define RenderSVGResourcePattern_h + +#if ENABLE(SVG) +#include "AffineTransform.h" +#include "FloatRect.h" +#include "ImageBuffer.h" +#include "Pattern.h" +#include "RenderSVGResourceContainer.h" +#include "SVGPatternElement.h" +#include "SVGUnitTypes.h" + +#include <wtf/HashMap.h> +#include <wtf/OwnPtr.h> + +namespace WebCore { + +struct PatternData { + RefPtr<Pattern> pattern; +}; + +struct PatternAttributes; + +class RenderSVGResourcePattern : public RenderSVGResourceContainer { +public: + RenderSVGResourcePattern(SVGPatternElement*); + virtual ~RenderSVGResourcePattern(); + + virtual const char* renderName() const { return "RenderSVGResourcePattern"; } + + virtual void invalidateClients(); + virtual void invalidateClient(RenderObject*); + + virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode); + virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode); + virtual FloatRect resourceBoundingBox(const FloatRect&) const { return FloatRect(); } + + virtual RenderSVGResourceType resourceType() const { return s_resourceType; } + static RenderSVGResourceType s_resourceType; + +private: + PassOwnPtr<ImageBuffer> createTileImage(FloatRect& patternBoundaries, AffineTransform& patternTransform, const SVGPatternElement*, RenderObject*) const; + void buildPattern(PatternData*, const FloatRect& patternBoundaries, PassOwnPtr<ImageBuffer> tileImage) const; + FloatRect calculatePatternBoundariesIncludingOverflow(PatternAttributes&, const FloatRect& objectBoundingBox, + const AffineTransform& viewBoxCTM, const FloatRect& patternBoundaries) const; + + HashMap<RenderObject*, PatternData*> m_pattern; +}; + +} + +#endif +#endif diff --git a/WebCore/rendering/RenderSVGResourceRadialGradient.cpp b/WebCore/rendering/RenderSVGResourceRadialGradient.cpp new file mode 100644 index 0000000..a8904c8 --- /dev/null +++ b/WebCore/rendering/RenderSVGResourceRadialGradient.cpp @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) Research In Motion Limited 2010. 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. + * + */ + +#include "config.h" + +#if ENABLE(SVG) +#include "RenderSVGResourceRadialGradient.h" + +#include "RadialGradientAttributes.h" +#include "SVGRadialGradientElement.h" + +namespace WebCore { + +RenderSVGResourceType RenderSVGResourceRadialGradient::s_resourceType = RadialGradientResourceType; + +RenderSVGResourceRadialGradient::RenderSVGResourceRadialGradient(SVGRadialGradientElement* node) + : RenderSVGResourceGradient(node) +{ +} + +RenderSVGResourceRadialGradient::~RenderSVGResourceRadialGradient() +{ +} + +void RenderSVGResourceRadialGradient::buildGradient(GradientData* gradientData, SVGGradientElement* gradientElement) const +{ + SVGRadialGradientElement* radialGradientElement = static_cast<SVGRadialGradientElement*>(gradientElement); + RadialGradientAttributes attributes = radialGradientElement->collectGradientProperties(); + + // Determine gradient focal/center points and radius + FloatPoint focalPoint; + FloatPoint centerPoint; + float radius; + radialGradientElement->calculateFocalCenterPointsAndRadius(attributes, focalPoint, centerPoint, radius); + + gradientData->gradient = Gradient::create(focalPoint, + 0.0f, // SVG does not support a "focus radius" + centerPoint, + radius); + + gradientData->gradient->setSpreadMethod(attributes.spreadMethod()); + + // Record current gradient transform + gradientData->transform = attributes.gradientTransform(); + gradientData->boundingBoxMode = attributes.boundingBoxMode(); + + // Add stops + addStops(gradientData, attributes.stops()); +} + +} + +#endif diff --git a/WebCore/rendering/RenderSVGResourceRadialGradient.h b/WebCore/rendering/RenderSVGResourceRadialGradient.h new file mode 100644 index 0000000..0583f99 --- /dev/null +++ b/WebCore/rendering/RenderSVGResourceRadialGradient.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) Research In Motion Limited 2010. 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 RenderSVGResourceRadialGradient_h +#define RenderSVGResourceRadialGradient_h + +#if ENABLE(SVG) +#include "RenderSVGResourceGradient.h" + +namespace WebCore { + +class SVGRadialGradientElement; + +class RenderSVGResourceRadialGradient : public RenderSVGResourceGradient { +public: + RenderSVGResourceRadialGradient(SVGRadialGradientElement*); + virtual ~RenderSVGResourceRadialGradient(); + + virtual const char* renderName() const { return "RenderSVGResourceRadialGradient"; } + + virtual RenderSVGResourceType resourceType() const { return s_resourceType; } + static RenderSVGResourceType s_resourceType; + + virtual void buildGradient(GradientData*, SVGGradientElement*) const; +}; + +} + +#endif +#endif diff --git a/WebCore/rendering/RenderSVGResourceSolidColor.cpp b/WebCore/rendering/RenderSVGResourceSolidColor.cpp new file mode 100644 index 0000000..9d34d79 --- /dev/null +++ b/WebCore/rendering/RenderSVGResourceSolidColor.cpp @@ -0,0 +1,103 @@ +/* + * Copyright (C) Research In Motion Limited 2010. 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. + * + */ + +#include "config.h" + +#if ENABLE(SVG) +#include "RenderSVGResourceSolidColor.h" + +#include "GraphicsContext.h" +#include "SVGRenderSupport.h" + +#if PLATFORM(SKIA) +#include "PlatformContextSkia.h" +#endif + +namespace WebCore { + +RenderSVGResourceType RenderSVGResourceSolidColor::s_resourceType = SolidColorResourceType; + +RenderSVGResourceSolidColor::RenderSVGResourceSolidColor() +{ +} + +RenderSVGResourceSolidColor::~RenderSVGResourceSolidColor() +{ +} + +bool RenderSVGResourceSolidColor::applyResource(RenderObject* object, RenderStyle* style, GraphicsContext*& context, unsigned short resourceMode) +{ + // We are NOT allowed to ASSERT(object) here, unlike all other resources. + // RenderSVGResourceSolidColor is the only resource which may be used from HTML, when rendering + // SVG Fonts for a HTML document. This will be indicated by a null RenderObject pointer. + ASSERT(context); + ASSERT(resourceMode != ApplyToDefaultMode); + + const SVGRenderStyle* svgStyle = style ? style->svgStyle() : 0; + ColorSpace colorSpace = style ? style->colorSpace() : DeviceColorSpace; + + if (resourceMode & ApplyToFillMode) { + context->setAlpha(svgStyle ? svgStyle->fillOpacity() : 1.0f); + context->setFillColor(m_color, colorSpace); + context->setFillRule(svgStyle ? svgStyle->fillRule() : RULE_NONZERO); + + if (resourceMode & ApplyToTextMode) + context->setTextDrawingMode(cTextFill); + } else if (resourceMode & ApplyToStrokeMode) { + context->setAlpha(svgStyle ? svgStyle->strokeOpacity() : 1.0f); + context->setStrokeColor(m_color, colorSpace); + + if (style) + applyStrokeStyleToContext(context, style, object); + + if (resourceMode & ApplyToTextMode) + context->setTextDrawingMode(cTextStroke); + } + + return true; +} + +void RenderSVGResourceSolidColor::postApplyResource(RenderObject*, GraphicsContext*& context, unsigned short resourceMode) +{ + ASSERT(context); + ASSERT(resourceMode != ApplyToDefaultMode); + + if (!(resourceMode & ApplyToTextMode)) { + if (resourceMode & ApplyToFillMode) + context->fillPath(); + else if (resourceMode & ApplyToStrokeMode) + context->strokePath(); + } + +#if PLATFORM(SKIA) + // FIXME: Move this into the GraphicsContext + // WebKit implicitly expects us to reset the path. + // For example in fillAndStrokePath() of RenderPath.cpp the path is + // added back to the context after filling. This is because internally it + // calls CGContextFillPath() which closes the path. + context->beginPath(); + context->platformContext()->setFillShader(0); + context->platformContext()->setStrokeShader(0); +#endif +} + +} + +#endif diff --git a/WebCore/rendering/RenderSVGResourceSolidColor.h b/WebCore/rendering/RenderSVGResourceSolidColor.h new file mode 100644 index 0000000..a1a8863 --- /dev/null +++ b/WebCore/rendering/RenderSVGResourceSolidColor.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) Research In Motion Limited 2010. 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 RenderSVGResourceSolidColor_h +#define RenderSVGResourceSolidColor_h + +#if ENABLE(SVG) +#include "Color.h" +#include "FloatRect.h" +#include "RenderSVGResource.h" + +namespace WebCore { + +class RenderSVGResourceSolidColor : public RenderSVGResource { +public: + RenderSVGResourceSolidColor(); + virtual ~RenderSVGResourceSolidColor(); + + virtual void invalidateClients() { } + virtual void invalidateClient(RenderObject*) { } + + virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode); + virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode); + virtual FloatRect resourceBoundingBox(const FloatRect&) const { return FloatRect(); } + + virtual RenderSVGResourceType resourceType() const { return s_resourceType; } + static RenderSVGResourceType s_resourceType; + + const Color& color() const { return m_color; } + void setColor(const Color& color) { m_color = color; } + +private: + Color m_color; +}; + +} + +#endif +#endif diff --git a/WebCore/rendering/RenderSVGRoot.cpp b/WebCore/rendering/RenderSVGRoot.cpp index 5ed0871..67a3b2a 100644 --- a/WebCore/rendering/RenderSVGRoot.cpp +++ b/WebCore/rendering/RenderSVGRoot.cpp @@ -62,11 +62,11 @@ void RenderSVGRoot::calcPrefWidths() { ASSERT(prefWidthsDirty()); - int paddingAndBorders = paddingLeft() + paddingRight() + borderLeft() + borderRight(); - int width = calcReplacedWidth(false) + paddingAndBorders; + int borderAndPadding = borderAndPaddingWidth(); + int width = calcReplacedWidth(false) + borderAndPadding; if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) - width = min(width, style()->maxWidth().value() + (style()->boxSizing() == CONTENT_BOX ? paddingAndBorders : 0)); + width = min(width, style()->maxWidth().value() + (style()->boxSizing() == CONTENT_BOX ? borderAndPadding : 0)); if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent())) { m_minPrefWidth = 0; diff --git a/WebCore/rendering/RenderSVGText.cpp b/WebCore/rendering/RenderSVGText.cpp index c0c4650..966196b 100644 --- a/WebCore/rendering/RenderSVGText.cpp +++ b/WebCore/rendering/RenderSVGText.cpp @@ -160,7 +160,10 @@ void RenderSVGText::absoluteQuads(Vector<FloatQuad>& quads) } void RenderSVGText::paint(PaintInfo& paintInfo, int, int) -{ +{ + if (paintInfo.context->paintingDisabled()) + return; + PaintInfo pi(paintInfo); pi.context->save(); applyTransformToPaintInfo(pi, localToParentTransform()); diff --git a/WebCore/rendering/RenderSVGText.h b/WebCore/rendering/RenderSVGText.h index fe53086..66f7eb3 100644 --- a/WebCore/rendering/RenderSVGText.h +++ b/WebCore/rendering/RenderSVGText.h @@ -42,8 +42,6 @@ public: private: virtual const char* renderName() const { return "RenderSVGText"; } - virtual const SVGRenderBase* toSVGRenderBase() const { return this; } - virtual bool isSVGText() const { return true; } virtual const AffineTransform& localToParentTransform() const { return m_localTransform; } diff --git a/WebCore/rendering/RenderSlider.cpp b/WebCore/rendering/RenderSlider.cpp index 37b5e19..ed5fe76 100644 --- a/WebCore/rendering/RenderSlider.cpp +++ b/WebCore/rendering/RenderSlider.cpp @@ -30,6 +30,7 @@ #include "HTMLInputElement.h" #include "HTMLDivElement.h" #include "HTMLNames.h" +#include "HTMLParser.h" #include "MediaControlElements.h" #include "MouseEvent.h" #include "RenderLayer.h" @@ -186,7 +187,7 @@ void RenderSlider::calcPrefWidths() m_minPrefWidth = min(m_minPrefWidth, calcContentBoxWidth(style()->maxWidth().value())); } - int toAdd = paddingLeft() + paddingRight() + borderLeft() + borderRight(); + int toAdd = borderAndPaddingWidth(); m_minPrefWidth += toAdd; m_maxPrefWidth += toAdd; @@ -260,8 +261,7 @@ void RenderSlider::layout() RenderBox* thumb = m_thumb ? toRenderBox(m_thumb->renderer()) : 0; - IntSize baseSize(borderLeft() + paddingLeft() + paddingRight() + borderRight(), - borderTop() + paddingTop() + paddingBottom() + borderBottom()); + IntSize baseSize(borderAndPaddingWidth(), borderAndPaddingHeight()); if (thumb) { // Allow the theme to set the size of the thumb. @@ -314,7 +314,7 @@ void RenderSlider::updateFromElement() m_thumb->setRenderer(m_thumb->createRenderer(renderArena(), thumbStyle.get())); m_thumb->renderer()->setStyle(thumbStyle.release()); m_thumb->setAttached(); - m_thumb->setInDocument(true); + m_thumb->setInDocument(); addChild(m_thumb->renderer()); } setNeedsLayout(true); @@ -361,7 +361,7 @@ void RenderSlider::setValueForPosition(int position) if (style()->appearance() == SliderVerticalPart || style()->appearance() == MediaVolumeSliderPart) fraction = 1 - fraction; double value = range.clampValue(range.valueFromProportion(fraction)); - element->setValueFromRenderer(HTMLInputElement::serializeForNumberType(value)); + element->setValueFromRenderer(serializeForNumberType(value)); // Also update the position if appropriate. if (position != currentPosition()) { diff --git a/WebCore/rendering/RenderTableCell.cpp b/WebCore/rendering/RenderTableCell.cpp index 4506e77..5779422 100644 --- a/WebCore/rendering/RenderTableCell.cpp +++ b/WebCore/rendering/RenderTableCell.cpp @@ -120,7 +120,7 @@ Length RenderTableCell::styleOrColWidth() const // Percentages don't need to be handled since they're always treated this way (even when specified on the cells). // See Bugzilla bug 8126 for details. if (colWidthSum.isFixed() && colWidthSum.value() > 0) - colWidthSum = Length(max(0, colWidthSum.value() - borderLeft() - borderRight() - paddingLeft() - paddingRight()), Fixed); + colWidthSum = Length(max(0, colWidthSum.value() - borderAndPaddingWidth()), Fixed); return colWidthSum; } diff --git a/WebCore/rendering/RenderText.cpp b/WebCore/rendering/RenderText.cpp index 90ad6d8..bede6a6 100644 --- a/WebCore/rendering/RenderText.cpp +++ b/WebCore/rendering/RenderText.cpp @@ -455,23 +455,40 @@ IntRect RenderText::localCaretRect(InlineBox* inlineBox, int caretOffset, int* e *extraWidthToEndOfLine = (box->root()->width() + rootLeft) - (left + 1); RenderBlock* cb = containingBlock(); + RenderStyle* cbStyle = cb->style(); + int leftEdge; + int rightEdge; if (style()->autoWrap()) { - int availableWidth = cb->lineWidth(top, false); - if (box->direction() == LTR) - left = min(left, rootLeft + availableWidth - caretWidthRightOfOffset); - else - left = max(left, cb->x()); + leftEdge = cb->x(); + rightEdge = cb->frameRect().right(); } else { - // If there is no wrapping, the caret can leave its containing block, but not its root line box. - if (cb->style()->direction() == LTR) { - int rightEdge = max(cb->width(), rootRight); - left = min(left, rightEdge - caretWidthRightOfOffset); - left = max(left, rootLeft); - } else { - int leftEdge = min(cb->x(), rootLeft); - left = max(left, leftEdge); - left = min(left, rootRight - caretWidth); - } + leftEdge = min(cb->x(), rootLeft); + rightEdge = max(cb->frameRect().right(), rootRight); + } + + bool rightAligned = false; + switch (cbStyle->textAlign()) { + case TAAUTO: + case JUSTIFY: + rightAligned = cbStyle->direction() == RTL; + break; + case RIGHT: + case WEBKIT_RIGHT: + rightAligned = true; + break; + case LEFT: + case WEBKIT_LEFT: + case CENTER: + case WEBKIT_CENTER: + break; + } + + if (rightAligned) { + left = max(left, leftEdge); + left = min(left, rootRight - caretWidth); + } else { + left = min(left, rightEdge - caretWidthRightOfOffset); + left = max(left, rootLeft); } return IntRect(left, top, caretWidth, height); diff --git a/WebCore/rendering/RenderTextControl.cpp b/WebCore/rendering/RenderTextControl.cpp index 5e19362..1e80ff0 100644 --- a/WebCore/rendering/RenderTextControl.cpp +++ b/WebCore/rendering/RenderTextControl.cpp @@ -151,13 +151,12 @@ void RenderTextControl::createSubtreeIfNeeded(TextControlInnerElement* innerBloc int RenderTextControl::textBlockHeight() const { - return height() - paddingTop() - paddingBottom() - borderTop() - borderBottom(); + return height() - borderAndPaddingHeight(); } int RenderTextControl::textBlockWidth() const { - return width() - paddingLeft() - paddingRight() - borderLeft() - borderRight() - - m_innerText->renderBox()->paddingLeft() - m_innerText->renderBox()->paddingRight(); + return width() - borderAndPaddingWidth() - m_innerText->renderBox()->paddingLeft() - m_innerText->renderBox()->paddingRight(); } void RenderTextControl::updateFromElement() @@ -410,7 +409,7 @@ void RenderTextControl::calcHeight() m_innerText->renderBox()->marginTop() + m_innerText->renderBox()->marginBottom()); adjustControlHeightBasedOnLineHeight(m_innerText->renderer()->lineHeight(true, true)); - setHeight(height() + paddingTop() + paddingBottom() + borderTop() + borderBottom()); + setHeight(height() + borderAndPaddingHeight()); // We are able to have a horizontal scrollbar if the overflow style is scroll, or if its auto and there's no word wrap. if (style()->overflowX() == OSCROLL || (style()->overflowX() == OAUTO && m_innerText->renderer()->style()->wordWrap() == NormalWordWrap)) @@ -434,13 +433,6 @@ void RenderTextControl::forwardEvent(Event* event) m_innerText->defaultEventHandler(event); } -IntRect RenderTextControl::controlClipRect(int tx, int ty) const -{ - IntRect clipRect = contentBoxRect(); - clipRect.move(tx, ty); - return clipRect; -} - static const char* fontFamiliesWithInvalidCharWidth[] = { "American Typewriter", "Arial Hebrew", @@ -541,7 +533,7 @@ void RenderTextControl::calcPrefWidths() m_minPrefWidth = min(m_minPrefWidth, calcContentBoxWidth(style()->maxWidth().value())); } - int toAdd = paddingLeft() + paddingRight() + borderLeft() + borderRight(); + int toAdd = borderAndPaddingWidth(); m_minPrefWidth += toAdd; m_maxPrefWidth += toAdd; diff --git a/WebCore/rendering/RenderTextControl.h b/WebCore/rendering/RenderTextControl.h index 2fc8edc..b76d1f2 100644 --- a/WebCore/rendering/RenderTextControl.h +++ b/WebCore/rendering/RenderTextControl.h @@ -95,8 +95,6 @@ protected: private: virtual const char* renderName() const { return "RenderTextControl"; } virtual bool isTextControl() const { return true; } - virtual bool hasControlClip() const { return false; } - virtual IntRect controlClipRect(int tx, int ty) const; virtual void calcPrefWidths(); virtual void removeLeftoverAnonymousBlock(RenderBlock*) { } virtual bool canHaveChildren() const { return false; } diff --git a/WebCore/rendering/RenderTextControlSingleLine.cpp b/WebCore/rendering/RenderTextControlSingleLine.cpp index 4edd203..37d44c4 100644 --- a/WebCore/rendering/RenderTextControlSingleLine.cpp +++ b/WebCore/rendering/RenderTextControlSingleLine.cpp @@ -1,5 +1,5 @@ /** - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2010 Apple Inc. All rights reserved. * (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) * * This library is free software; you can redistribute it and/or @@ -66,6 +66,9 @@ RenderTextControlSingleLine::~RenderTextControlSingleLine() if (m_innerBlock) m_innerBlock->detach(); + + if (m_outerSpinButton) + m_outerSpinButton->detach(); } RenderStyle* RenderTextControlSingleLine::textBaseStyle() const @@ -185,12 +188,27 @@ void RenderTextControlSingleLine::paint(PaintInfo& paintInfo, int tx, int ty) if (paintInfo.phase == PaintPhaseBlockBackground && m_shouldDrawCapsLockIndicator) { IntRect contentsRect = contentBoxRect(); + // Center vertically like the text. + contentsRect.setY((height() - contentsRect.height()) / 2); + // Convert the rect into the coords used for painting the content contentsRect.move(tx + x(), ty + y()); theme()->paintCapsLockIndicator(this, paintInfo, contentsRect); } } +void RenderTextControlSingleLine::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty) +{ + paintBoxDecorationsWithSize(paintInfo, tx, ty, width() - decorationWidthRight(), height()); +} + +void RenderTextControlSingleLine::addFocusRingRects(Vector<IntRect>& rects, int tx, int ty) +{ + int w = width() - decorationWidthRight(); + if (w && height()) + rects.append(IntRect(tx, ty, w, height())); +} + void RenderTextControlSingleLine::layout() { int oldHeight = height(); @@ -234,7 +252,7 @@ void RenderTextControlSingleLine::layout() innerTextRenderer->style()->setWidth(Length(desiredWidth, Fixed)); if (m_innerBlock) { - int innerBlockWidth = width() - paddingLeft() - paddingRight() - borderLeft() - borderRight(); + int innerBlockWidth = width() - borderAndPaddingWidth(); if (innerBlockWidth != innerBlockRenderer->width()) relayoutChildren = true; innerBlockRenderer->style()->setWidth(Length(innerBlockWidth, Fixed)); @@ -246,7 +264,18 @@ void RenderTextControlSingleLine::layout() RenderBox* childBlock = innerBlockRenderer ? innerBlockRenderer : innerTextRenderer; currentHeight = childBlock->height(); if (currentHeight < height()) - childBlock->setLocation(childBlock->x(), (height() - currentHeight) / 2); + childBlock->setY((height() - currentHeight) / 2); + + // Center the spin button vertically, and move it to the right by + // padding + border of the text fields. + if (RenderBox* spinBox = m_outerSpinButton ? m_outerSpinButton->renderBox() : 0) { + int diff = height() - spinBox->height(); + // If the diff is odd, the top area over the spin button takes the + // remaining one pixel. It's good for Mac NSStepper because it has + // shadow at the bottom. + int y = (diff / 2) + (diff % 2); + spinBox->setLocation(spinBox->x() + paddingRight() + borderRight(), y); + } } bool RenderTextControlSingleLine::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int xPos, int yPos, int tx, int ty, HitTestAction hitTestAction) @@ -266,6 +295,9 @@ bool RenderTextControlSingleLine::nodeAtPoint(const HitTestRequest& request, Hit if (result.innerNode()->isDescendantOf(innerTextElement()) || result.innerNode() == node()) hitInnerTextElement(result, xPos, yPos, tx, ty); + // If we found a spin button, we're done. + if (m_outerSpinButton && result.innerNode() == m_outerSpinButton) + return true; // If we're not a search field, or we already found the results or cancel buttons, we're done. if (!m_innerBlock || result.innerNode() == m_resultsButton || result.innerNode() == m_cancelButton) return true; @@ -316,10 +348,13 @@ void RenderTextControlSingleLine::forwardEvent(Event* event) } FloatPoint localPoint = innerTextRenderer->absoluteToLocal(static_cast<MouseEvent*>(event)->absoluteLocation(), false, true); + int textRight = innerTextRenderer->borderBoxRect().right(); if (m_resultsButton && localPoint.x() < innerTextRenderer->borderBoxRect().x()) m_resultsButton->defaultEventHandler(event); - else if (m_cancelButton && localPoint.x() > innerTextRenderer->borderBoxRect().right()) + else if (m_cancelButton && localPoint.x() > textRight) m_cancelButton->defaultEventHandler(event); + else if (m_outerSpinButton && localPoint.x() > textRight) + m_outerSpinButton->defaultEventHandler(event); else RenderTextControl::forwardEvent(event); } @@ -342,6 +377,9 @@ void RenderTextControlSingleLine::styleDidChange(StyleDifference diff, const Ren if (RenderObject* cancelRenderer = m_cancelButton ? m_cancelButton->renderer() : 0) cancelRenderer->setStyle(createCancelButtonStyle(style())); + if (RenderObject* spinRenderer = m_outerSpinButton ? m_outerSpinButton->renderer() : 0) + spinRenderer->setStyle(createOuterSpinButtonStyle()); + setHasOverflowClip(false); } @@ -369,6 +407,16 @@ void RenderTextControlSingleLine::capsLockStateMayHaveChanged() } } +IntRect RenderTextControlSingleLine::controlClipRect(int tx, int ty) const +{ + // This should only get called for search inputs. + ASSERT(hasControlClip()); + + IntRect clipRect = IntRect(m_innerBlock->renderBox()->frameRect()); + clipRect.move(tx, ty); + return clipRect; +} + int RenderTextControlSingleLine::textBlockWidth() const { int width = RenderTextControl::textBlockWidth(); @@ -383,6 +431,18 @@ int RenderTextControlSingleLine::textBlockWidth() const width -= cancelRenderer->width() + cancelRenderer->marginLeft() + cancelRenderer->marginRight(); } + return width - decorationWidthRight(); +} + +int RenderTextControlSingleLine::decorationWidthRight() const +{ + int width = 0; + if (RenderBox* spinRenderer = m_outerSpinButton ? m_outerSpinButton->renderBox() : 0) { + spinRenderer->calcWidth(); + width += spinRenderer->width() + spinRenderer->marginLeft() + spinRenderer->marginRight(); + } + if (width > 0) + width += paddingRight() + borderRight(); return width; } @@ -432,6 +492,18 @@ int RenderTextControlSingleLine::preferredContentWidth(float charWidth) const return result; } +int RenderTextControlSingleLine::preferredDecorationWidthRight() const +{ + int width = 0; + if (RenderBox* spinRenderer = m_outerSpinButton ? m_outerSpinButton->renderBox() : 0) { + spinRenderer->calcWidth(); + width += spinRenderer->minPrefWidth() + spinRenderer->marginLeft() + spinRenderer->marginRight(); + } + if (width > 0) + width += paddingRight() + borderRight(); + return width; +} + void RenderTextControlSingleLine::adjustControlHeightBasedOnLineHeight(int lineHeight) { if (RenderBox* resultsRenderer = m_resultsButton ? m_resultsButton->renderBox() : 0) { @@ -459,6 +531,10 @@ void RenderTextControlSingleLine::createSubtreeIfNeeded() { if (!inputElement()->isSearchField()) { RenderTextControl::createSubtreeIfNeeded(m_innerBlock.get()); + if (inputElement()->hasSpinButton() && !m_outerSpinButton) { + m_outerSpinButton = new SpinButtonElement(document(), node()); + m_outerSpinButton->attachInnerElement(node(), createOuterSpinButtonStyle(), renderArena()); + } return; } @@ -535,7 +611,7 @@ PassRefPtr<RenderStyle> RenderTextControlSingleLine::createInnerTextStyle(const if (textBlockStyle->font().lineSpacing() > lineHeight(true, true)) textBlockStyle->setLineHeight(Length(-100.0f, Percent)); - textBlockStyle->setDisplay(m_innerBlock ? INLINE_BLOCK : BLOCK); + textBlockStyle->setDisplay(m_innerBlock || inputElement()->hasSpinButton() ? INLINE_BLOCK : BLOCK); // We're adding one extra pixel of padding to match WinIE. textBlockStyle->setPaddingLeft(Length(1, Fixed)); @@ -607,6 +683,16 @@ PassRefPtr<RenderStyle> RenderTextControlSingleLine::createCancelButtonStyle(con return cancelBlockStyle.release(); } +PassRefPtr<RenderStyle> RenderTextControlSingleLine::createOuterSpinButtonStyle() const +{ + ASSERT(node()->isHTMLElement()); + RefPtr<RenderStyle> buttonStyle = getCachedPseudoStyle(OUTER_SPIN_BUTTON); + if (!buttonStyle) + buttonStyle = RenderStyle::create(); + buttonStyle->inheritFrom(style()); + return buttonStyle.release(); +} + void RenderTextControlSingleLine::updateCancelButtonVisibility() const { if (!m_cancelButton->renderer()) diff --git a/WebCore/rendering/RenderTextControlSingleLine.h b/WebCore/rendering/RenderTextControlSingleLine.h index e1bcc84..b093954 100644 --- a/WebCore/rendering/RenderTextControlSingleLine.h +++ b/WebCore/rendering/RenderTextControlSingleLine.h @@ -32,6 +32,7 @@ class InputElement; class SearchFieldCancelButtonElement; class SearchFieldResultsButtonElement; class SearchPopupMenu; +class SpinButtonElement; class TextControlInnerElement; class RenderTextControlSingleLine : public RenderTextControl, private PopupMenuClient { @@ -53,12 +54,19 @@ public: void capsLockStateMayHaveChanged(); + // Decoration width outside of the text field. + int decorationWidthRight() const; + private: + int preferredDecorationWidthRight() const; virtual bool hasControlClip() const { return m_cancelButton; } + virtual IntRect controlClipRect(int tx, int ty) const; virtual bool isTextField() const { return true; } virtual void subtreeHasChanged(); virtual void paint(PaintInfo&, int tx, int ty); + virtual void paintBoxDecorations(PaintInfo&, int tx, int ty); + virtual void addFocusRingRects(Vector<IntRect>&, int tx, int ty); virtual void layout(); virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction); @@ -89,6 +97,7 @@ private: PassRefPtr<RenderStyle> createInnerBlockStyle(const RenderStyle* startStyle) const; PassRefPtr<RenderStyle> createResultsButtonStyle(const RenderStyle* startStyle) const; PassRefPtr<RenderStyle> createCancelButtonStyle(const RenderStyle* startStyle) const; + PassRefPtr<RenderStyle> createOuterSpinButtonStyle() const; void updateCancelButtonVisibility() const; EVisibility visibilityForCancelButton() const; @@ -130,6 +139,7 @@ private: RefPtr<TextControlInnerElement> m_innerBlock; RefPtr<SearchFieldResultsButtonElement> m_resultsButton; RefPtr<SearchFieldCancelButtonElement> m_cancelButton; + RefPtr<TextControlInnerElement> m_outerSpinButton; Timer<RenderTextControlSingleLine> m_searchEventTimer; RefPtr<SearchPopupMenu> m_searchPopup; diff --git a/WebCore/rendering/RenderTheme.cpp b/WebCore/rendering/RenderTheme.cpp index b3b7a1e..76af001 100644 --- a/WebCore/rendering/RenderTheme.cpp +++ b/WebCore/rendering/RenderTheme.cpp @@ -36,6 +36,7 @@ #include "RenderView.h" #include "SelectionController.h" #include "Settings.h" +#include "TextControlInnerElements.h" // The methods in this file are shared by all themes on every platform. @@ -617,6 +618,7 @@ bool RenderTheme::isControlStyled(const RenderStyle* style, const BorderData& bo case ButtonPart: case ListboxPart: case MenulistPart: + case ProgressBarPart: // FIXME: Uncomment this when making search fields style-able. // case SearchFieldPart: case TextFieldPart: @@ -660,10 +662,16 @@ bool RenderTheme::stateChanged(RenderObject* o, ControlState state) const ControlStates RenderTheme::controlStatesForRenderer(const RenderObject* o) const { ControlStates result = 0; - if (isHovered(o)) + if (isHovered(o)) { result |= HoverState; - if (isPressed(o)) + if (isSpinUpButtonPartHovered(o)) + result |= SpinUpState; + } + if (isPressed(o)) { result |= PressedState; + if (isSpinUpButtonPartPressed(o)) + result |= SpinUpState; + } if (isFocused(o) && o->style()->outlineStyleIsAuto()) result |= FocusState; if (isEnabled(o)) @@ -747,6 +755,16 @@ bool RenderTheme::isPressed(const RenderObject* o) const return o->node()->active(); } +bool RenderTheme::isSpinUpButtonPartPressed(const RenderObject* o) const +{ + Node* node = o->node(); + if (!node || !node->active() || !node->isElementNode() + || !static_cast<Element*>(node)->isSpinButtonElement()) + return false; + SpinButtonElement* element = static_cast<SpinButtonElement*>(node); + return element->onUpButton(); +} + bool RenderTheme::isReadOnlyControl(const RenderObject* o) const { Node* node = o->node(); @@ -762,6 +780,16 @@ bool RenderTheme::isHovered(const RenderObject* o) const return o->node()->hovered(); } +bool RenderTheme::isSpinUpButtonPartHovered(const RenderObject* o) const +{ + Node* node = o->node(); + if (!node || !node->active() || !node->isElementNode() + || !static_cast<Element*>(node)->isSpinButtonElement()) + return false; + SpinButtonElement* element = static_cast<SpinButtonElement*>(node); + return element->onUpButton(); +} + bool RenderTheme::isDefault(const RenderObject* o) const { // A button should only have the default appearance if the page is active diff --git a/WebCore/rendering/RenderTheme.h b/WebCore/rendering/RenderTheme.h index 1526138..6edc878 100644 --- a/WebCore/rendering/RenderTheme.h +++ b/WebCore/rendering/RenderTheme.h @@ -292,7 +292,9 @@ public: bool isEnabled(const RenderObject*) const; bool isFocused(const RenderObject*) const; bool isPressed(const RenderObject*) const; + bool isSpinUpButtonPartPressed(const RenderObject*) const; bool isHovered(const RenderObject*) const; + bool isSpinUpButtonPartHovered(const RenderObject*) const; bool isReadOnlyControl(const RenderObject*) const; bool isDefault(const RenderObject*) const; diff --git a/WebCore/rendering/RenderThemeChromiumMac.h b/WebCore/rendering/RenderThemeChromiumMac.h index 8101038..aaaade0 100644 --- a/WebCore/rendering/RenderThemeChromiumMac.h +++ b/WebCore/rendering/RenderThemeChromiumMac.h @@ -24,173 +24,32 @@ #ifndef RenderThemeChromiumMac_h #define RenderThemeChromiumMac_h -#import "RenderTheme.h" -#import <wtf/HashMap.h> -#import <wtf/RetainPtr.h> - -#ifdef __OBJC__ -@class WebCoreRenderThemeNotificationObserver; -#else -class WebCoreRenderThemeNotificationObserver; -#endif - -// This file (and its associated .mm file) is a clone of RenderThemeMac.h. See -// the .mm file for details. +#import "RenderThemeMac.h" namespace WebCore { -class RenderStyle; - -class RenderThemeChromiumMac : public RenderTheme { +class RenderThemeChromiumMac : public RenderThemeMac { public: static PassRefPtr<RenderTheme> create(); - - // A method asking if the control changes its tint when the window has focus or not. - virtual bool controlSupportsTints(const RenderObject*) const; - - // A general method asking if any control tinting is supported at all. - virtual bool supportsControlTints() const { return true; } - - virtual void adjustRepaintRect(const RenderObject*, IntRect&); - - virtual bool isControlStyled(const RenderStyle*, const BorderData&, - const FillLayer&, const Color& backgroundColor) const; - - virtual Color platformActiveSelectionBackgroundColor() const; - virtual Color platformInactiveSelectionBackgroundColor() const; - virtual Color platformActiveListBoxSelectionBackgroundColor() const; - virtual Color platformActiveListBoxSelectionForegroundColor() const; - virtual Color platformInactiveListBoxSelectionBackgroundColor() const; - virtual Color platformInactiveListBoxSelectionForegroundColor() const; - virtual Color platformFocusRingColor() const; - - virtual ScrollbarControlSize scrollbarControlSizeForPart(ControlPart) { return SmallScrollbar; } - - virtual void platformColorsDidChange(); - - // System fonts. - virtual void systemFont(int cssValueId, FontDescription&) const; - - virtual int minimumMenuListSize(RenderStyle*) const; - - virtual void adjustSliderThumbSize(RenderObject*) const; - - virtual int popupInternalPaddingLeft(RenderStyle*) const; - virtual int popupInternalPaddingRight(RenderStyle*) const; - virtual int popupInternalPaddingTop(RenderStyle*) const; - virtual int popupInternalPaddingBottom(RenderStyle*) const; - - virtual bool paintCapsLockIndicator(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - - virtual Color systemColor(int cssValueId) const; - protected: - virtual bool supportsSelectionForegroundColors() const { return false; } - - virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual void adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - - virtual bool paintTextArea(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual void adjustTextAreaStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - - virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - - virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - - virtual bool paintSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual void adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - - virtual bool paintSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual void adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - - virtual bool paintSearchField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - - virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldCancelButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - - virtual void adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - - virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldResultsDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - - virtual void adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldResultsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - #if ENABLE(VIDEO) - virtual bool shouldRenderMediaControlPart(ControlPart, Element*); + virtual void adjustMediaSliderThumbSize(RenderObject*) const; virtual bool paintMediaPlayButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); virtual bool paintMediaMuteButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaVolumeSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaVolumeSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); virtual bool paintMediaControlsBackground(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - - // Media controls + virtual bool shouldRenderMediaControlPart(ControlPart, Element*); virtual String extraMediaControlsStyleSheet(); -#endif - -private: - RenderThemeChromiumMac(); - virtual ~RenderThemeChromiumMac(); - - IntRect inflateRect(const IntRect&, const IntSize&, const int* margins, float zoomLevel = 1.0f) const; - - FloatRect convertToPaintingRect(const RenderObject* inputRenderer, const RenderObject* partRenderer, const FloatRect& inputRect, const IntRect& r) const; - - // Get the control size based off the font. Used by some of the controls (like buttons). - NSControlSize controlSizeForFont(RenderStyle*) const; - NSControlSize controlSizeForSystemFont(RenderStyle*) const; - void setControlSize(NSCell*, const IntSize* sizes, const IntSize& minSize, float zoomLevel = 1.0f); - void setSizeFromFont(RenderStyle*, const IntSize* sizes) const; - IntSize sizeForFont(RenderStyle*, const IntSize* sizes) const; - IntSize sizeForSystemFont(RenderStyle*, const IntSize* sizes) const; - void setFontFromControlSize(CSSStyleSelector*, RenderStyle*, NSControlSize) const; - void updateActiveState(NSCell*, const RenderObject*); - void updateCheckedState(NSCell*, const RenderObject*); - void updateEnabledState(NSCell*, const RenderObject*); - void updateFocusedState(NSCell*, const RenderObject*); - void updatePressedState(NSCell*, const RenderObject*); - - // Helpers for adjusting appearance and for painting - - void setPopupButtonCellState(const RenderObject*, const IntRect&); - const IntSize* popupButtonSizes() const; - const int* popupButtonMargins() const; - const int* popupButtonPadding(NSControlSize) const; - void paintMenuListButtonGradients(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - const IntSize* menuListSizes() const; + virtual bool paintMediaVolumeSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMediaVolumeSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - const IntSize* searchFieldSizes() const; - const IntSize* cancelButtonSizes() const; - const IntSize* resultsButtonSizes() const; - void setSearchCellState(RenderObject*, const IntRect&); - void setSearchFieldSize(RenderStyle*) const; - - NSPopUpButtonCell* popupButton() const; - NSSearchFieldCell* search() const; - NSMenu* searchMenuTemplate() const; - NSSliderCell* sliderThumbHorizontal() const; - NSSliderCell* sliderThumbVertical() const; +#endif + virtual bool usesTestModeFocusRingColor() const; + virtual NSView* documentViewFor(RenderObject*) const; private: - mutable RetainPtr<NSPopUpButtonCell> m_popupButton; - mutable RetainPtr<NSSearchFieldCell> m_search; - mutable RetainPtr<NSMenu> m_searchMenuTemplate; - mutable RetainPtr<NSSliderCell> m_sliderThumbHorizontal; - mutable RetainPtr<NSSliderCell> m_sliderThumbVertical; - - bool m_isSliderThumbHorizontalPressed; - bool m_isSliderThumbVerticalPressed; - - mutable HashMap<int, RGBA32> m_systemColorCache; - - RetainPtr<WebCoreRenderThemeNotificationObserver> m_notificationObserver; + virtual void updateActiveState(NSCell*, const RenderObject*); }; } // namespace WebCore diff --git a/WebCore/rendering/RenderThemeChromiumMac.mm b/WebCore/rendering/RenderThemeChromiumMac.mm index 03aab1c..47a872d 100644 --- a/WebCore/rendering/RenderThemeChromiumMac.mm +++ b/WebCore/rendering/RenderThemeChromiumMac.mm @@ -20,29 +20,8 @@ #import "config.h" #import "RenderThemeChromiumMac.h" - -#import "BitmapImage.h" #import "ChromiumBridge.h" -#import "ColorMac.h" -#import "CSSStyleSelector.h" -#import "CSSValueKeywords.h" -#import "Document.h" -#import "Element.h" -#import "FrameView.h" -#import "GraphicsContext.h" -#import "HTMLInputElement.h" -#import "HTMLMediaElement.h" -#import "HTMLNames.h" -#import "Image.h" -#import "LocalCurrentGraphicsContext.h" -#import "MediaControlElements.h" -#import "RenderMedia.h" #import "RenderMediaControlsChromium.h" -#import "RenderSlider.h" -#import "RenderView.h" -#import "SharedBuffer.h" -#import "TimeRanges.h" -#import "WebCoreSystemInterface.h" #import "UserAgentStyleSheets.h" #import <Carbon/Carbon.h> #import <Cocoa/Cocoa.h> @@ -50,64 +29,6 @@ #import <wtf/StdLibExtras.h> #import <math.h> -#ifdef BUILDING_ON_TIGER -typedef int NSInteger; -typedef unsigned NSUInteger; -#endif - -using std::min; - -// This file (and its associated .h file) is a clone of RenderThemeMac.mm. -// Because the original file is designed to run in-process inside a Cocoa view, -// we must maintain a fork. Please maintain this file by performing parallel -// changes to it. -// -// The only changes from RenderThemeMac should be: -// - The classname change from RenderThemeMac to RenderThemeChromiumMac. -// - The introduction of RTCMFlippedView and FlippedView() and its use as the -// parent view for cell rendering. -// - In platformFocusRingColor(), the use of ChromiumBridge to determine if -// we're in layout test mode. -// - updateActiveState() and its use to update the cells' visual appearance. -// - All the paintMedia*() functions and extraMediaControlsStyleSheet() -// are forked from RenderThemeChromiumSkia instead of RenderThemeMac. -// -// For all other differences, if it was introduced in this file, then the -// maintainer forgot to include it in the list; otherwise it is an update that -// should have been applied to this file but was not. - -// The methods in this file are specific to the Mac OS X platform. - -// FIXME: The platform-independent code in this class should be factored out and merged with RenderThemeSafari. - -@interface WebCoreRenderThemeNotificationObserver : NSObject -{ - WebCore::RenderTheme *_theme; -} - -- (id)initWithTheme:(WebCore::RenderTheme *)theme; -- (void)systemColorsDidChange:(NSNotification *)notification; - -@end - -@implementation WebCoreRenderThemeNotificationObserver - -- (id)initWithTheme:(WebCore::RenderTheme *)theme -{ - [super init]; - _theme = theme; - - return self; -} - -- (void)systemColorsDidChange:(NSNotification *)unusedNotification -{ - ASSERT_UNUSED(unusedNotification, [[unusedNotification name] isEqualToString:NSSystemColorsDidChangeNotification]); - _theme->platformColorsDidChange(); -} - -@end - @interface RTCMFlippedView : NSView {} @@ -130,26 +51,6 @@ using std::min; namespace WebCore { -using namespace HTMLNames; - -enum { - topMargin, - rightMargin, - bottomMargin, - leftMargin -}; - -enum { - topPadding, - rightPadding, - bottomPadding, - leftPadding -}; - -// In Snow Leopard, many cells only check to see if the view they're passed is -// flipped, and if a nil view is passed, neglect to check if the current -// graphics context is flipped. Thus we pass a sham view to them, one whose -// flipped state just reflects the state of the context. NSView* FlippedView() { static NSView* view = [[RTCMFlippedView alloc] init]; @@ -167,422 +68,14 @@ PassRefPtr<RenderTheme> RenderThemeChromiumMac::create() return adoptRef(new RenderThemeChromiumMac); } -RenderThemeChromiumMac::RenderThemeChromiumMac() - : m_isSliderThumbHorizontalPressed(false) - , m_isSliderThumbVerticalPressed(false) - , m_notificationObserver(AdoptNS, [[WebCoreRenderThemeNotificationObserver alloc] initWithTheme:this]) +bool RenderThemeChromiumMac::usesTestModeFocusRingColor() const { - [[NSNotificationCenter defaultCenter] addObserver:m_notificationObserver.get() - selector:@selector(systemColorsDidChange:) - name:NSSystemColorsDidChangeNotification - object:nil]; + return ChromiumBridge::layoutTestMode(); } -RenderThemeChromiumMac::~RenderThemeChromiumMac() +NSView* RenderThemeChromiumMac::documentViewFor(RenderObject*) const { - [[NSNotificationCenter defaultCenter] removeObserver:m_notificationObserver.get()]; -} - -Color RenderThemeChromiumMac::platformActiveSelectionBackgroundColor() const -{ - NSColor* color = [[NSColor selectedTextBackgroundColor] colorUsingColorSpaceName:NSDeviceRGBColorSpace]; - return Color(static_cast<int>(255.0 * [color redComponent]), static_cast<int>(255.0 * [color greenComponent]), static_cast<int>(255.0 * [color blueComponent])); -} - -Color RenderThemeChromiumMac::platformInactiveSelectionBackgroundColor() const -{ - NSColor* color = [[NSColor secondarySelectedControlColor] colorUsingColorSpaceName:NSDeviceRGBColorSpace]; - return Color(static_cast<int>(255.0 * [color redComponent]), static_cast<int>(255.0 * [color greenComponent]), static_cast<int>(255.0 * [color blueComponent])); -} - -Color RenderThemeChromiumMac::platformActiveListBoxSelectionBackgroundColor() const -{ - NSColor* color = [[NSColor alternateSelectedControlColor] colorUsingColorSpaceName:NSDeviceRGBColorSpace]; - return Color(static_cast<int>(255.0 * [color redComponent]), static_cast<int>(255.0 * [color greenComponent]), static_cast<int>(255.0 * [color blueComponent])); -} - -Color RenderThemeChromiumMac::platformActiveListBoxSelectionForegroundColor() const -{ - return Color::white; -} - -Color RenderThemeChromiumMac::platformInactiveListBoxSelectionForegroundColor() const -{ - return Color::black; -} - -Color RenderThemeChromiumMac::platformFocusRingColor() const -{ - if (ChromiumBridge::layoutTestMode()) - return oldAquaFocusRingColor(); - - return systemColor(CSSValueWebkitFocusRingColor); -} - -Color RenderThemeChromiumMac::platformInactiveListBoxSelectionBackgroundColor() const -{ - return platformInactiveSelectionBackgroundColor(); -} - -static FontWeight toFontWeight(NSInteger appKitFontWeight) -{ - ASSERT(appKitFontWeight > 0 && appKitFontWeight < 15); - if (appKitFontWeight > 14) - appKitFontWeight = 14; - else if (appKitFontWeight < 1) - appKitFontWeight = 1; - - static FontWeight fontWeights[] = { - FontWeight100, - FontWeight100, - FontWeight200, - FontWeight300, - FontWeight400, - FontWeight500, - FontWeight600, - FontWeight600, - FontWeight700, - FontWeight800, - FontWeight800, - FontWeight900, - FontWeight900, - FontWeight900 - }; - return fontWeights[appKitFontWeight - 1]; -} - -void RenderThemeChromiumMac::systemFont(int cssValueId, FontDescription& fontDescription) const -{ - DEFINE_STATIC_LOCAL(FontDescription, systemFont, ()); - DEFINE_STATIC_LOCAL(FontDescription, smallSystemFont, ()); - DEFINE_STATIC_LOCAL(FontDescription, menuFont, ()); - DEFINE_STATIC_LOCAL(FontDescription, labelFont, ()); - DEFINE_STATIC_LOCAL(FontDescription, miniControlFont, ()); - DEFINE_STATIC_LOCAL(FontDescription, smallControlFont, ()); - DEFINE_STATIC_LOCAL(FontDescription, controlFont, ()); - - FontDescription* cachedDesc; - NSFont* font = nil; - switch (cssValueId) { - case CSSValueSmallCaption: - cachedDesc = &smallSystemFont; - if (!smallSystemFont.isAbsoluteSize()) - font = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]; - break; - case CSSValueMenu: - cachedDesc = &menuFont; - if (!menuFont.isAbsoluteSize()) - font = [NSFont menuFontOfSize:[NSFont systemFontSize]]; - break; - case CSSValueStatusBar: - cachedDesc = &labelFont; - if (!labelFont.isAbsoluteSize()) - font = [NSFont labelFontOfSize:[NSFont labelFontSize]]; - break; - case CSSValueWebkitMiniControl: - cachedDesc = &miniControlFont; - if (!miniControlFont.isAbsoluteSize()) - font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSMiniControlSize]]; - break; - case CSSValueWebkitSmallControl: - cachedDesc = &smallControlFont; - if (!smallControlFont.isAbsoluteSize()) - font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]]; - break; - case CSSValueWebkitControl: - cachedDesc = &controlFont; - if (!controlFont.isAbsoluteSize()) - font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSRegularControlSize]]; - break; - default: - cachedDesc = &systemFont; - if (!systemFont.isAbsoluteSize()) - font = [NSFont systemFontOfSize:[NSFont systemFontSize]]; - } - - if (font) { - NSFontManager *fontManager = [NSFontManager sharedFontManager]; - cachedDesc->setIsAbsoluteSize(true); - cachedDesc->setGenericFamily(FontDescription::NoFamily); - cachedDesc->firstFamily().setFamily([font familyName]); - cachedDesc->setSpecifiedSize([font pointSize]); - cachedDesc->setWeight(toFontWeight([fontManager weightOfFont:font])); - cachedDesc->setItalic([fontManager traitsOfFont:font] & NSItalicFontMask); - } - fontDescription = *cachedDesc; -} - -static RGBA32 convertNSColorToColor(NSColor *color) -{ - NSColor *colorInColorSpace = [color colorUsingColorSpaceName:NSDeviceRGBColorSpace]; - if (colorInColorSpace) { - static const double scaleFactor = nextafter(256.0, 0.0); - return makeRGB(static_cast<int>(scaleFactor * [colorInColorSpace redComponent]), - static_cast<int>(scaleFactor * [colorInColorSpace greenComponent]), - static_cast<int>(scaleFactor * [colorInColorSpace blueComponent])); - } - - // This conversion above can fail if the NSColor in question is an NSPatternColor - // (as many system colors are). These colors are actually a repeating pattern - // not just a solid color. To work around this we simply draw a 1x1 image of - // the color and use that pixel's color. It might be better to use an average of - // the colors in the pattern instead. - NSBitmapImageRep *offscreenRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:nil - pixelsWide:1 - pixelsHigh:1 - bitsPerSample:8 - samplesPerPixel:4 - hasAlpha:YES - isPlanar:NO - colorSpaceName:NSDeviceRGBColorSpace - bytesPerRow:4 - bitsPerPixel:32]; - - [NSGraphicsContext saveGraphicsState]; - [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithBitmapImageRep:offscreenRep]]; - NSEraseRect(NSMakeRect(0, 0, 1, 1)); - [color drawSwatchInRect:NSMakeRect(0, 0, 1, 1)]; - [NSGraphicsContext restoreGraphicsState]; - - NSUInteger pixel[4]; - [offscreenRep getPixel:pixel atX:0 y:0]; - - [offscreenRep release]; - - return makeRGB(pixel[0], pixel[1], pixel[2]); -} - -static RGBA32 menuBackgroundColor() -{ - NSBitmapImageRep *offscreenRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:nil - pixelsWide:1 - pixelsHigh:1 - bitsPerSample:8 - samplesPerPixel:4 - hasAlpha:YES - isPlanar:NO - colorSpaceName:NSDeviceRGBColorSpace - bytesPerRow:4 - bitsPerPixel:32]; - - CGContextRef context = static_cast<CGContextRef>([[NSGraphicsContext graphicsContextWithBitmapImageRep:offscreenRep] graphicsPort]); - CGRect rect = CGRectMake(0, 0, 1, 1); - HIThemeMenuDrawInfo drawInfo; - drawInfo.version = 0; - drawInfo.menuType = kThemeMenuTypePopUp; - HIThemeDrawMenuBackground(&rect, &drawInfo, context, kHIThemeOrientationInverted); - - NSUInteger pixel[4]; - [offscreenRep getPixel:pixel atX:0 y:0]; - - [offscreenRep release]; - - return makeRGB(pixel[0], pixel[1], pixel[2]); -} - -void RenderThemeChromiumMac::platformColorsDidChange() -{ - m_systemColorCache.clear(); - RenderTheme::platformColorsDidChange(); -} - -Color RenderThemeChromiumMac::systemColor(int cssValueId) const -{ - if (m_systemColorCache.contains(cssValueId)) - return m_systemColorCache.get(cssValueId); - - Color color; - switch (cssValueId) { - case CSSValueActiveborder: - color = convertNSColorToColor([NSColor keyboardFocusIndicatorColor]); - break; - case CSSValueActivecaption: - color = convertNSColorToColor([NSColor windowFrameTextColor]); - break; - case CSSValueAppworkspace: - color = convertNSColorToColor([NSColor headerColor]); - break; - case CSSValueBackground: - // Use theme independent default - break; - case CSSValueButtonface: - // We use this value instead of NSColor's controlColor to avoid website incompatibilities. - // We may want to change this to use the NSColor in future. - color = 0xFFC0C0C0; - break; - case CSSValueButtonhighlight: - color = convertNSColorToColor([NSColor controlHighlightColor]); - break; - case CSSValueButtonshadow: - color = convertNSColorToColor([NSColor controlShadowColor]); - break; - case CSSValueButtontext: - color = convertNSColorToColor([NSColor controlTextColor]); - break; - case CSSValueCaptiontext: - color = convertNSColorToColor([NSColor textColor]); - break; - case CSSValueGraytext: - color = convertNSColorToColor([NSColor disabledControlTextColor]); - break; - case CSSValueHighlight: - color = convertNSColorToColor([NSColor selectedTextBackgroundColor]); - break; - case CSSValueHighlighttext: - color = convertNSColorToColor([NSColor selectedTextColor]); - break; - case CSSValueInactiveborder: - color = convertNSColorToColor([NSColor controlBackgroundColor]); - break; - case CSSValueInactivecaption: - color = convertNSColorToColor([NSColor controlBackgroundColor]); - break; - case CSSValueInactivecaptiontext: - color = convertNSColorToColor([NSColor textColor]); - break; - case CSSValueInfobackground: - // There is no corresponding NSColor for this so we use a hard coded value. - color = 0xFFFBFCC5; - break; - case CSSValueInfotext: - color = convertNSColorToColor([NSColor textColor]); - break; - case CSSValueMenu: - color = menuBackgroundColor(); - break; - case CSSValueMenutext: - color = convertNSColorToColor([NSColor selectedMenuItemTextColor]); - break; - case CSSValueScrollbar: - color = convertNSColorToColor([NSColor scrollBarColor]); - break; - case CSSValueText: - color = convertNSColorToColor([NSColor textColor]); - break; - case CSSValueThreeddarkshadow: - color = convertNSColorToColor([NSColor controlDarkShadowColor]); - break; - case CSSValueThreedshadow: - color = convertNSColorToColor([NSColor shadowColor]); - break; - case CSSValueThreedface: - // We use this value instead of NSColor's controlColor to avoid website incompatibilities. - // We may want to change this to use the NSColor in future. - color = 0xFFC0C0C0; - break; - case CSSValueThreedhighlight: - color = convertNSColorToColor([NSColor highlightColor]); - break; - case CSSValueThreedlightshadow: - color = convertNSColorToColor([NSColor controlLightHighlightColor]); - break; - case CSSValueWebkitFocusRingColor: - color = convertNSColorToColor([NSColor keyboardFocusIndicatorColor]); - break; - case CSSValueWindow: - color = convertNSColorToColor([NSColor windowBackgroundColor]); - break; - case CSSValueWindowframe: - color = convertNSColorToColor([NSColor windowFrameColor]); - break; - case CSSValueWindowtext: - color = convertNSColorToColor([NSColor windowFrameTextColor]); - break; - } - - if (!color.isValid()) - color = RenderTheme::systemColor(cssValueId); - - if (color.isValid()) - m_systemColorCache.set(cssValueId, color.rgb()); - - return color; -} - -bool RenderThemeChromiumMac::isControlStyled(const RenderStyle* style, const BorderData& border, - const FillLayer& background, const Color& backgroundColor) const -{ - if (style->appearance() == TextFieldPart || style->appearance() == TextAreaPart || style->appearance() == ListboxPart) - return style->border() != border; - - // FIXME: This is horrible, but there is not much else that can be done. Menu lists cannot draw properly when - // scaled. They can't really draw properly when transformed either. We can't detect the transform case at style - // adjustment time so that will just have to stay broken. We can however detect that we're zooming. If zooming - // is in effect we treat it like the control is styled. - if (style->appearance() == MenulistPart && style->effectiveZoom() != 1.0f) - return true; - - return RenderTheme::isControlStyled(style, border, background, backgroundColor); -} - -void RenderThemeChromiumMac::adjustRepaintRect(const RenderObject* o, IntRect& r) -{ - ControlPart part = o->style()->appearance(); - -#if USE(NEW_THEME) - switch (part) { - case CheckboxPart: - case RadioPart: - case PushButtonPart: - case SquareButtonPart: - case ListButtonPart: - case DefaultButtonPart: - case ButtonPart: - return RenderTheme::adjustRepaintRect(o, r); - default: - break; - } -#endif - - float zoomLevel = o->style()->effectiveZoom(); - - if (part == MenulistPart) { - setPopupButtonCellState(o, r); - IntSize size = popupButtonSizes()[[popupButton() controlSize]]; - size.setHeight(size.height() * zoomLevel); - size.setWidth(r.width()); - r = inflateRect(r, size, popupButtonMargins(), zoomLevel); - } -} - -IntRect RenderThemeChromiumMac::inflateRect(const IntRect& r, const IntSize& size, const int* margins, float zoomLevel) const -{ - // Only do the inflation if the available width/height are too small. Otherwise try to - // fit the glow/check space into the available box's width/height. - int widthDelta = r.width() - (size.width() + margins[leftMargin] * zoomLevel + margins[rightMargin] * zoomLevel); - int heightDelta = r.height() - (size.height() + margins[topMargin] * zoomLevel + margins[bottomMargin] * zoomLevel); - IntRect result(r); - if (widthDelta < 0) { - result.setX(result.x() - margins[leftMargin] * zoomLevel); - result.setWidth(result.width() - widthDelta); - } - if (heightDelta < 0) { - result.setY(result.y() - margins[topMargin] * zoomLevel); - result.setHeight(result.height() - heightDelta); - } - return result; -} - -FloatRect RenderThemeChromiumMac::convertToPaintingRect(const RenderObject* inputRenderer, const RenderObject* partRenderer, const FloatRect& inputRect, const IntRect& r) const -{ - FloatRect partRect(inputRect); - - // Compute an offset between the part renderer and the input renderer - FloatSize offsetFromInputRenderer; - const RenderObject* renderer = partRenderer; - while (renderer && renderer != inputRenderer) { - RenderObject* containingRenderer = renderer->container(); - offsetFromInputRenderer -= renderer->offsetFromContainer(containingRenderer, IntPoint()); - renderer = containingRenderer; - } - // If the input renderer was not a container, something went wrong - ASSERT(renderer == inputRenderer); - // Move the rect into partRenderer's coords - partRect.move(offsetFromInputRenderer); - // Account for the local drawing offset (tx, ty) - partRect.move(r.x(), r.y()); - - return partRect; + return FlippedView(); } // Updates the control tint (a.k.a. active state) of |cell| (from |o|). @@ -604,917 +97,13 @@ void RenderThemeChromiumMac::updateActiveState(NSCell* cell, const RenderObject* [cell setControlTint:tint]; } -void RenderThemeChromiumMac::updateCheckedState(NSCell* cell, const RenderObject* o) -{ - bool oldIndeterminate = [cell state] == NSMixedState; - bool indeterminate = isIndeterminate(o); - bool checked = isChecked(o); - - if (oldIndeterminate != indeterminate) { - [cell setState:indeterminate ? NSMixedState : (checked ? NSOnState : NSOffState)]; - return; - } - - bool oldChecked = [cell state] == NSOnState; - if (checked != oldChecked) - [cell setState:checked ? NSOnState : NSOffState]; -} - -void RenderThemeChromiumMac::updateEnabledState(NSCell* cell, const RenderObject* o) -{ - bool oldEnabled = [cell isEnabled]; - bool enabled = isEnabled(o); - if (enabled != oldEnabled) - [cell setEnabled:enabled]; -} - -void RenderThemeChromiumMac::updateFocusedState(NSCell* cell, const RenderObject* o) -{ - bool oldFocused = [cell showsFirstResponder]; - bool focused = isFocused(o) && o->style()->outlineStyleIsAuto(); - if (focused != oldFocused) - [cell setShowsFirstResponder:focused]; -} - -void RenderThemeChromiumMac::updatePressedState(NSCell* cell, const RenderObject* o) -{ - bool oldPressed = [cell isHighlighted]; - bool pressed = (o->node() && o->node()->active()); - if (pressed != oldPressed) - [cell setHighlighted:pressed]; -} - -bool RenderThemeChromiumMac::controlSupportsTints(const RenderObject* o) const -{ - // An alternate way to implement this would be to get the appropriate cell object - // and call the private _needRedrawOnWindowChangedKeyState method. An advantage of - // that would be that we would match AppKit behavior more closely, but a disadvantage - // would be that we would rely on an AppKit SPI method. - - if (!isEnabled(o)) - return false; - - // Checkboxes only have tint when checked. - if (o->style()->appearance() == CheckboxPart) - return isChecked(o); - - // For now assume other controls have tint if enabled. - return true; -} - -NSControlSize RenderThemeChromiumMac::controlSizeForFont(RenderStyle* style) const -{ - int fontSize = style->fontSize(); - if (fontSize >= 16) - return NSRegularControlSize; - if (fontSize >= 11) - return NSSmallControlSize; - return NSMiniControlSize; -} - -void RenderThemeChromiumMac::setControlSize(NSCell* cell, const IntSize* sizes, const IntSize& minSize, float zoomLevel) -{ - NSControlSize size; - if (minSize.width() >= static_cast<int>(sizes[NSRegularControlSize].width() * zoomLevel) && - minSize.height() >= static_cast<int>(sizes[NSRegularControlSize].height() * zoomLevel)) - size = NSRegularControlSize; - else if (minSize.width() >= static_cast<int>(sizes[NSSmallControlSize].width() * zoomLevel) && - minSize.height() >= static_cast<int>(sizes[NSSmallControlSize].height() * zoomLevel)) - size = NSSmallControlSize; - else - size = NSMiniControlSize; - if (size != [cell controlSize]) // Only update if we have to, since AppKit does work even if the size is the same. - [cell setControlSize:size]; -} - -IntSize RenderThemeChromiumMac::sizeForFont(RenderStyle* style, const IntSize* sizes) const -{ - if (style->effectiveZoom() != 1.0f) { - IntSize result = sizes[controlSizeForFont(style)]; - return IntSize(result.width() * style->effectiveZoom(), result.height() * style->effectiveZoom()); - } - return sizes[controlSizeForFont(style)]; -} - -IntSize RenderThemeChromiumMac::sizeForSystemFont(RenderStyle* style, const IntSize* sizes) const -{ - if (style->effectiveZoom() != 1.0f) { - IntSize result = sizes[controlSizeForSystemFont(style)]; - return IntSize(result.width() * style->effectiveZoom(), result.height() * style->effectiveZoom()); - } - return sizes[controlSizeForSystemFont(style)]; -} - -void RenderThemeChromiumMac::setSizeFromFont(RenderStyle* style, const IntSize* sizes) const -{ - // FIXME: Check is flawed, since it doesn't take min-width/max-width into account. - IntSize size = sizeForFont(style, sizes); - if (style->width().isIntrinsicOrAuto() && size.width() > 0) - style->setWidth(Length(size.width(), Fixed)); - if (style->height().isAuto() && size.height() > 0) - style->setHeight(Length(size.height(), Fixed)); -} - -void RenderThemeChromiumMac::setFontFromControlSize(CSSStyleSelector*, RenderStyle* style, NSControlSize controlSize) const -{ - FontDescription fontDescription; - fontDescription.setIsAbsoluteSize(true); - fontDescription.setGenericFamily(FontDescription::SerifFamily); - - NSFont* font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:controlSize]]; - fontDescription.firstFamily().setFamily([font familyName]); - fontDescription.setComputedSize([font pointSize] * style->effectiveZoom()); - fontDescription.setSpecifiedSize([font pointSize] * style->effectiveZoom()); - - // Reset line height - style->setLineHeight(RenderStyle::initialLineHeight()); - - if (style->setFontDescription(fontDescription)) - style->font().update(0); -} - -NSControlSize RenderThemeChromiumMac::controlSizeForSystemFont(RenderStyle* style) const -{ - int fontSize = style->fontSize(); - if (fontSize >= [NSFont systemFontSizeForControlSize:NSRegularControlSize]) - return NSRegularControlSize; - if (fontSize >= [NSFont systemFontSizeForControlSize:NSSmallControlSize]) - return NSSmallControlSize; - return NSMiniControlSize; -} - -bool RenderThemeChromiumMac::paintTextField(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) -{ - LocalCurrentGraphicsContext localContext(paintInfo.context); - wkDrawBezeledTextFieldCell(r, isEnabled(o) && !isReadOnlyControl(o)); - return false; -} - -void RenderThemeChromiumMac::adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const -{ -} - -bool RenderThemeChromiumMac::paintCapsLockIndicator(RenderObject*, const RenderObject::PaintInfo& paintInfo, const IntRect& r) -{ - if (paintInfo.context->paintingDisabled()) - return true; - - LocalCurrentGraphicsContext localContext(paintInfo.context); - wkDrawCapsLockIndicator(paintInfo.context->platformContext(), r); - - return false; -} - -bool RenderThemeChromiumMac::paintTextArea(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) -{ - LocalCurrentGraphicsContext localContext(paintInfo.context); - wkDrawBezeledTextArea(r, isEnabled(o) && !isReadOnlyControl(o)); - return false; -} - -void RenderThemeChromiumMac::adjustTextAreaStyle(CSSStyleSelector*, RenderStyle*, Element*) const -{ -} - -const int* RenderThemeChromiumMac::popupButtonMargins() const -{ - static const int margins[3][4] = - { - { 0, 3, 1, 3 }, - { 0, 3, 2, 3 }, - { 0, 1, 0, 1 } - }; - return margins[[popupButton() controlSize]]; -} - -const IntSize* RenderThemeChromiumMac::popupButtonSizes() const -{ - static const IntSize sizes[3] = { IntSize(0, 21), IntSize(0, 18), IntSize(0, 15) }; - return sizes; -} - -const int* RenderThemeChromiumMac::popupButtonPadding(NSControlSize size) const -{ - static const int padding[3][4] = - { - { 2, 26, 3, 8 }, - { 2, 23, 3, 8 }, - { 2, 22, 3, 10 } - }; - return padding[size]; -} - -bool RenderThemeChromiumMac::paintMenuList(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) -{ - setPopupButtonCellState(o, r); - - NSPopUpButtonCell* popupButton = this->popupButton(); - - float zoomLevel = o->style()->effectiveZoom(); - IntSize size = popupButtonSizes()[[popupButton controlSize]]; - size.setHeight(size.height() * zoomLevel); - size.setWidth(r.width()); - - // Now inflate it to account for the shadow. - IntRect inflatedRect = r; - if (r.width() >= minimumMenuListSize(o->style())) - inflatedRect = inflateRect(inflatedRect, size, popupButtonMargins(), zoomLevel); - - paintInfo.context->save(); - -#ifndef BUILDING_ON_TIGER - // On Leopard, the cell will draw outside of the given rect, so we have to clip to the rect - paintInfo.context->clip(inflatedRect); -#endif - - if (zoomLevel != 1.0f) { - inflatedRect.setWidth(inflatedRect.width() / zoomLevel); - inflatedRect.setHeight(inflatedRect.height() / zoomLevel); - paintInfo.context->translate(inflatedRect.x(), inflatedRect.y()); - paintInfo.context->scale(FloatSize(zoomLevel, zoomLevel)); - paintInfo.context->translate(-inflatedRect.x(), -inflatedRect.y()); - } - - [popupButton drawWithFrame:inflatedRect inView:FlippedView()]; - [popupButton setControlView:nil]; - - paintInfo.context->restore(); - - return false; -} - -const float baseFontSize = 11.0f; -const float baseArrowHeight = 4.0f; -const float baseArrowWidth = 5.0f; -const float baseSpaceBetweenArrows = 2.0f; -const int arrowPaddingLeft = 6; -const int arrowPaddingRight = 6; -const int paddingBeforeSeparator = 4; -const int baseBorderRadius = 5; -const int styledPopupPaddingLeft = 8; -const int styledPopupPaddingTop = 1; -const int styledPopupPaddingBottom = 2; - -static void TopGradientInterpolate(void*, const CGFloat* inData, CGFloat* outData) -{ - static float dark[4] = { 1.0f, 1.0f, 1.0f, 0.4f }; - static float light[4] = { 1.0f, 1.0f, 1.0f, 0.15f }; - float a = inData[0]; - int i = 0; - for (i = 0; i < 4; i++) - outData[i] = (1.0f - a) * dark[i] + a * light[i]; -} - -static void BottomGradientInterpolate(void*, const CGFloat* inData, CGFloat* outData) -{ - static float dark[4] = { 1.0f, 1.0f, 1.0f, 0.0f }; - static float light[4] = { 1.0f, 1.0f, 1.0f, 0.3f }; - float a = inData[0]; - int i = 0; - for (i = 0; i < 4; i++) - outData[i] = (1.0f - a) * dark[i] + a * light[i]; -} - -static void MainGradientInterpolate(void*, const CGFloat* inData, CGFloat* outData) -{ - static float dark[4] = { 0.0f, 0.0f, 0.0f, 0.15f }; - static float light[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; - float a = inData[0]; - int i = 0; - for (i = 0; i < 4; i++) - outData[i] = (1.0f - a) * dark[i] + a * light[i]; -} - -static void TrackGradientInterpolate(void*, const CGFloat* inData, CGFloat* outData) -{ - static float dark[4] = { 0.0f, 0.0f, 0.0f, 0.678f }; - static float light[4] = { 0.0f, 0.0f, 0.0f, 0.13f }; - float a = inData[0]; - int i = 0; - for (i = 0; i < 4; i++) - outData[i] = (1.0f - a) * dark[i] + a * light[i]; -} - -void RenderThemeChromiumMac::paintMenuListButtonGradients(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) -{ - if (r.isEmpty()) - return; - - CGContextRef context = paintInfo.context->platformContext(); - - paintInfo.context->save(); - - IntSize topLeftRadius; - IntSize topRightRadius; - IntSize bottomLeftRadius; - IntSize bottomRightRadius; - - o->style()->getBorderRadiiForRect(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); - - int radius = topLeftRadius.width(); - - RetainPtr<CGColorSpaceRef> cspace(AdoptCF, CGColorSpaceCreateDeviceRGB()); - - FloatRect topGradient(r.x(), r.y(), r.width(), r.height() / 2.0f); - struct CGFunctionCallbacks topCallbacks = { 0, TopGradientInterpolate, NULL }; - RetainPtr<CGFunctionRef> topFunction(AdoptCF, CGFunctionCreate(NULL, 1, NULL, 4, NULL, &topCallbacks)); - RetainPtr<CGShadingRef> topShading(AdoptCF, CGShadingCreateAxial(cspace.get(), CGPointMake(topGradient.x(), topGradient.y()), CGPointMake(topGradient.x(), topGradient.bottom()), topFunction.get(), false, false)); - - FloatRect bottomGradient(r.x() + radius, r.y() + r.height() / 2.0f, r.width() - 2.0f * radius, r.height() / 2.0f); - struct CGFunctionCallbacks bottomCallbacks = { 0, BottomGradientInterpolate, NULL }; - RetainPtr<CGFunctionRef> bottomFunction(AdoptCF, CGFunctionCreate(NULL, 1, NULL, 4, NULL, &bottomCallbacks)); - RetainPtr<CGShadingRef> bottomShading(AdoptCF, CGShadingCreateAxial(cspace.get(), CGPointMake(bottomGradient.x(), bottomGradient.y()), CGPointMake(bottomGradient.x(), bottomGradient.bottom()), bottomFunction.get(), false, false)); - - struct CGFunctionCallbacks mainCallbacks = { 0, MainGradientInterpolate, NULL }; - RetainPtr<CGFunctionRef> mainFunction(AdoptCF, CGFunctionCreate(NULL, 1, NULL, 4, NULL, &mainCallbacks)); - RetainPtr<CGShadingRef> mainShading(AdoptCF, CGShadingCreateAxial(cspace.get(), CGPointMake(r.x(), r.y()), CGPointMake(r.x(), r.bottom()), mainFunction.get(), false, false)); - - RetainPtr<CGShadingRef> leftShading(AdoptCF, CGShadingCreateAxial(cspace.get(), CGPointMake(r.x(), r.y()), CGPointMake(r.x() + radius, r.y()), mainFunction.get(), false, false)); - - RetainPtr<CGShadingRef> rightShading(AdoptCF, CGShadingCreateAxial(cspace.get(), CGPointMake(r.right(), r.y()), CGPointMake(r.right() - radius, r.y()), mainFunction.get(), false, false)); - paintInfo.context->save(); - CGContextClipToRect(context, r); - paintInfo.context->addRoundedRectClip(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); - CGContextDrawShading(context, mainShading.get()); - paintInfo.context->restore(); - - paintInfo.context->save(); - CGContextClipToRect(context, topGradient); - paintInfo.context->addRoundedRectClip(enclosingIntRect(topGradient), topLeftRadius, topRightRadius, IntSize(), IntSize()); - CGContextDrawShading(context, topShading.get()); - paintInfo.context->restore(); - - if (!bottomGradient.isEmpty()) { - paintInfo.context->save(); - CGContextClipToRect(context, bottomGradient); - paintInfo.context->addRoundedRectClip(enclosingIntRect(bottomGradient), IntSize(), IntSize(), bottomLeftRadius, bottomRightRadius); - CGContextDrawShading(context, bottomShading.get()); - paintInfo.context->restore(); - } - - paintInfo.context->save(); - CGContextClipToRect(context, r); - paintInfo.context->addRoundedRectClip(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); - CGContextDrawShading(context, leftShading.get()); - CGContextDrawShading(context, rightShading.get()); - paintInfo.context->restore(); - - paintInfo.context->restore(); -} - -bool RenderThemeChromiumMac::paintMenuListButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) -{ - IntRect bounds = IntRect(r.x() + o->style()->borderLeftWidth(), - r.y() + o->style()->borderTopWidth(), - r.width() - o->style()->borderLeftWidth() - o->style()->borderRightWidth(), - r.height() - o->style()->borderTopWidth() - o->style()->borderBottomWidth()); - // Draw the gradients to give the styled popup menu a button appearance - paintMenuListButtonGradients(o, paintInfo, bounds); - - // Since we actually know the size of the control here, we restrict the font scale to make sure the arrows will fit vertically in the bounds - float fontScale = min(o->style()->fontSize() / baseFontSize, bounds.height() / (baseArrowHeight * 2 + baseSpaceBetweenArrows)); - float centerY = bounds.y() + bounds.height() / 2.0f; - float arrowHeight = baseArrowHeight * fontScale; - float arrowWidth = baseArrowWidth * fontScale; - float leftEdge = bounds.right() - arrowPaddingRight * o->style()->effectiveZoom() - arrowWidth; - float spaceBetweenArrows = baseSpaceBetweenArrows * fontScale; - - if (bounds.width() < arrowWidth + arrowPaddingLeft * o->style()->effectiveZoom()) - return false; - - paintInfo.context->save(); - - paintInfo.context->setFillColor(o->style()->color(), o->style()->colorSpace()); - paintInfo.context->setStrokeStyle(NoStroke); - - FloatPoint arrow1[3]; - arrow1[0] = FloatPoint(leftEdge, centerY - spaceBetweenArrows / 2.0f); - arrow1[1] = FloatPoint(leftEdge + arrowWidth, centerY - spaceBetweenArrows / 2.0f); - arrow1[2] = FloatPoint(leftEdge + arrowWidth / 2.0f, centerY - spaceBetweenArrows / 2.0f - arrowHeight); - - // Draw the top arrow - paintInfo.context->drawConvexPolygon(3, arrow1, true); - - FloatPoint arrow2[3]; - arrow2[0] = FloatPoint(leftEdge, centerY + spaceBetweenArrows / 2.0f); - arrow2[1] = FloatPoint(leftEdge + arrowWidth, centerY + spaceBetweenArrows / 2.0f); - arrow2[2] = FloatPoint(leftEdge + arrowWidth / 2.0f, centerY + spaceBetweenArrows / 2.0f + arrowHeight); - - // Draw the bottom arrow - paintInfo.context->drawConvexPolygon(3, arrow2, true); - - Color leftSeparatorColor(0, 0, 0, 40); - Color rightSeparatorColor(255, 255, 255, 40); - - // FIXME: Should the separator thickness and space be scaled up by fontScale? - int separatorSpace = 2; // Deliberately ignores zoom since it looks nicer if it stays thin. - int leftEdgeOfSeparator = static_cast<int>(leftEdge - arrowPaddingLeft * o->style()->effectiveZoom()); // FIXME: Round? - - // Draw the separator to the left of the arrows - paintInfo.context->setStrokeThickness(1.0f); // Deliberately ignores zoom since it looks nicer if it stays thin. - paintInfo.context->setStrokeStyle(SolidStroke); - paintInfo.context->setStrokeColor(leftSeparatorColor, DeviceColorSpace); - paintInfo.context->drawLine(IntPoint(leftEdgeOfSeparator, bounds.y()), - IntPoint(leftEdgeOfSeparator, bounds.bottom())); - - paintInfo.context->setStrokeColor(rightSeparatorColor, DeviceColorSpace); - paintInfo.context->drawLine(IntPoint(leftEdgeOfSeparator + separatorSpace, bounds.y()), - IntPoint(leftEdgeOfSeparator + separatorSpace, bounds.bottom())); - - paintInfo.context->restore(); - return false; -} - -static const IntSize* menuListButtonSizes() -{ - static const IntSize sizes[3] = { IntSize(0, 21), IntSize(0, 18), IntSize(0, 15) }; - return sizes; -} - -void RenderThemeChromiumMac::adjustMenuListStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const -{ - NSControlSize controlSize = controlSizeForFont(style); - - style->resetBorder(); - style->resetPadding(); - - // Height is locked to auto. - style->setHeight(Length(Auto)); - - // White-space is locked to pre - style->setWhiteSpace(PRE); - - // Set the foreground color to black or gray when we have the aqua look. - // Cast to RGB32 is to work around a compiler bug. - style->setColor(e && e->isEnabledFormControl() ? static_cast<RGBA32>(Color::black) : Color::darkGray); - - // Set the button's vertical size. - setSizeFromFont(style, menuListButtonSizes()); - - // Our font is locked to the appropriate system font size for the control. To clarify, we first use the CSS-specified font to figure out - // a reasonable control size, but once that control size is determined, we throw that font away and use the appropriate - // system font for the control size instead. - setFontFromControlSize(selector, style, controlSize); - - style->setBoxShadow(0); -} - -int RenderThemeChromiumMac::popupInternalPaddingLeft(RenderStyle* style) const -{ - if (style->appearance() == MenulistPart) - return popupButtonPadding(controlSizeForFont(style))[leftPadding] * style->effectiveZoom(); - if (style->appearance() == MenulistButtonPart) - return styledPopupPaddingLeft * style->effectiveZoom(); - return 0; -} - -int RenderThemeChromiumMac::popupInternalPaddingRight(RenderStyle* style) const -{ - if (style->appearance() == MenulistPart) - return popupButtonPadding(controlSizeForFont(style))[rightPadding] * style->effectiveZoom(); - if (style->appearance() == MenulistButtonPart) { - float fontScale = style->fontSize() / baseFontSize; - float arrowWidth = baseArrowWidth * fontScale; - return static_cast<int>(ceilf(arrowWidth + (arrowPaddingLeft + arrowPaddingRight + paddingBeforeSeparator) * style->effectiveZoom())); - } - return 0; -} - -int RenderThemeChromiumMac::popupInternalPaddingTop(RenderStyle* style) const -{ - if (style->appearance() == MenulistPart) - return popupButtonPadding(controlSizeForFont(style))[topPadding] * style->effectiveZoom(); - if (style->appearance() == MenulistButtonPart) - return styledPopupPaddingTop * style->effectiveZoom(); - return 0; -} - -int RenderThemeChromiumMac::popupInternalPaddingBottom(RenderStyle* style) const -{ - if (style->appearance() == MenulistPart) - return popupButtonPadding(controlSizeForFont(style))[bottomPadding] * style->effectiveZoom(); - if (style->appearance() == MenulistButtonPart) - return styledPopupPaddingBottom * style->effectiveZoom(); - return 0; -} - -void RenderThemeChromiumMac::adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle* style, Element*) const -{ - float fontScale = style->fontSize() / baseFontSize; - - style->resetPadding(); - style->setBorderRadius(IntSize(int(baseBorderRadius + fontScale - 1), int(baseBorderRadius + fontScale - 1))); // FIXME: Round up? - - const int minHeight = 15; - style->setMinHeight(Length(minHeight, Fixed)); - - style->setLineHeight(RenderStyle::initialLineHeight()); -} - -void RenderThemeChromiumMac::setPopupButtonCellState(const RenderObject* o, const IntRect& r) -{ - NSPopUpButtonCell* popupButton = this->popupButton(); - - // Set the control size based off the rectangle we're painting into. - setControlSize(popupButton, popupButtonSizes(), r.size(), o->style()->effectiveZoom()); - - // Update the various states we respond to. - updateActiveState(popupButton, o); - updateCheckedState(popupButton, o); - updateEnabledState(popupButton, o); - updatePressedState(popupButton, o); - updateFocusedState(popupButton, o); -} - -const IntSize* RenderThemeChromiumMac::menuListSizes() const -{ - static const IntSize sizes[3] = { IntSize(9, 0), IntSize(5, 0), IntSize(0, 0) }; - return sizes; -} - -int RenderThemeChromiumMac::minimumMenuListSize(RenderStyle* style) const -{ - return sizeForSystemFont(style, menuListSizes()).width(); -} - -const int trackWidth = 5; -const int trackRadius = 2; - -void RenderThemeChromiumMac::adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle* style, Element*) const -{ - style->setBoxShadow(0); -} - -bool RenderThemeChromiumMac::paintSliderTrack(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) -{ - IntRect bounds = r; - float zoomLevel = o->style()->effectiveZoom(); - float zoomedTrackWidth = trackWidth * zoomLevel; - - if (o->style()->appearance() == SliderHorizontalPart || o->style()->appearance() == MediaSliderPart) { - bounds.setHeight(zoomedTrackWidth); - bounds.setY(r.y() + r.height() / 2 - zoomedTrackWidth / 2); - } else if (o->style()->appearance() == SliderVerticalPart) { - bounds.setWidth(zoomedTrackWidth); - bounds.setX(r.x() + r.width() / 2 - zoomedTrackWidth / 2); - } - - LocalCurrentGraphicsContext localContext(paintInfo.context); - CGContextRef context = paintInfo.context->platformContext(); - RetainPtr<CGColorSpaceRef> cspace(AdoptCF, CGColorSpaceCreateDeviceRGB()); - - paintInfo.context->save(); - CGContextClipToRect(context, bounds); - - struct CGFunctionCallbacks mainCallbacks = { 0, TrackGradientInterpolate, NULL }; - RetainPtr<CGFunctionRef> mainFunction(AdoptCF, CGFunctionCreate(NULL, 1, NULL, 4, NULL, &mainCallbacks)); - RetainPtr<CGShadingRef> mainShading; - if (o->style()->appearance() == SliderVerticalPart) - mainShading.adoptCF(CGShadingCreateAxial(cspace.get(), CGPointMake(bounds.x(), bounds.bottom()), CGPointMake(bounds.right(), bounds.bottom()), mainFunction.get(), false, false)); - else - mainShading.adoptCF(CGShadingCreateAxial(cspace.get(), CGPointMake(bounds.x(), bounds.y()), CGPointMake(bounds.x(), bounds.bottom()), mainFunction.get(), false, false)); - - IntSize radius(trackRadius, trackRadius); - paintInfo.context->addRoundedRectClip(bounds, - radius, radius, - radius, radius); - CGContextDrawShading(context, mainShading.get()); - paintInfo.context->restore(); - - return false; -} - -void RenderThemeChromiumMac::adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle* style, Element*) const -{ - style->setBoxShadow(0); -} - -const float verticalSliderHeightPadding = 0.1f; - -bool RenderThemeChromiumMac::paintSliderThumb(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) -{ - ASSERT(o->parent()->isSlider()); - - NSSliderCell* sliderThumbCell = o->style()->appearance() == SliderThumbVerticalPart - ? sliderThumbVertical() - : sliderThumbHorizontal(); - - LocalCurrentGraphicsContext localContext(paintInfo.context); - - // Update the various states we respond to. - updateActiveState(sliderThumbCell, o->parent()); - updateEnabledState(sliderThumbCell, o->parent()); - updateFocusedState(sliderThumbCell, o->parent()); - - // Update the pressed state using the NSCell tracking methods, since that's how NSSliderCell keeps track of it. - bool oldPressed; - if (o->style()->appearance() == SliderThumbVerticalPart) - oldPressed = m_isSliderThumbVerticalPressed; - else - oldPressed = m_isSliderThumbHorizontalPressed; - - bool pressed = toRenderSlider(o->parent())->inDragMode(); - - if (o->style()->appearance() == SliderThumbVerticalPart) - m_isSliderThumbVerticalPressed = pressed; - else - m_isSliderThumbHorizontalPressed = pressed; - - if (pressed != oldPressed) { - if (pressed) - [sliderThumbCell startTrackingAt:NSPoint() inView:nil]; - else - [sliderThumbCell stopTracking:NSPoint() at:NSPoint() inView:nil mouseIsUp:YES]; - } - - FloatRect bounds = r; - // Make the height of the vertical slider slightly larger so NSSliderCell will draw a vertical slider. - if (o->style()->appearance() == SliderThumbVerticalPart) - bounds.setHeight(bounds.height() + verticalSliderHeightPadding * o->style()->effectiveZoom()); - - paintInfo.context->save(); - float zoomLevel = o->style()->effectiveZoom(); - - FloatRect unzoomedRect = bounds; - if (zoomLevel != 1.0f) { - unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); - unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); - paintInfo.context->translate(unzoomedRect.x(), unzoomedRect.y()); - paintInfo.context->scale(FloatSize(zoomLevel, zoomLevel)); - paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); - } - - [sliderThumbCell drawWithFrame:unzoomedRect inView:FlippedView()]; - [sliderThumbCell setControlView:nil]; - - paintInfo.context->restore(); - - return false; -} - -bool RenderThemeChromiumMac::paintSearchField(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) -{ - NSSearchFieldCell* search = this->search(); - LocalCurrentGraphicsContext localContext(paintInfo.context); - - setSearchCellState(o, r); - - paintInfo.context->save(); - - float zoomLevel = o->style()->effectiveZoom(); - - IntRect unzoomedRect = r; - - if (zoomLevel != 1.0f) { - unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); - unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); - paintInfo.context->translate(unzoomedRect.x(), unzoomedRect.y()); - paintInfo.context->scale(FloatSize(zoomLevel, zoomLevel)); - paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); - } - - // Set the search button to nil before drawing. Then reset it so we can draw it later. - [search setSearchButtonCell:nil]; - - [search drawWithFrame:NSRect(unzoomedRect) inView:FlippedView()]; -#ifdef BUILDING_ON_TIGER - if ([search showsFirstResponder]) - wkDrawTextFieldCellFocusRing(search, NSRect(unzoomedRect)); -#endif - - [search setControlView:nil]; - [search resetSearchButtonCell]; - - paintInfo.context->restore(); - - return false; -} - -void RenderThemeChromiumMac::setSearchCellState(RenderObject* o, const IntRect&) -{ - NSSearchFieldCell* search = this->search(); - - [search setControlSize:controlSizeForFont(o->style())]; - - // Update the various states we respond to. - updateActiveState(search, o); - updateEnabledState(search, o); - updateFocusedState(search, o); -} - -const IntSize* RenderThemeChromiumMac::searchFieldSizes() const -{ - static const IntSize sizes[3] = { IntSize(0, 22), IntSize(0, 19), IntSize(0, 17) }; - return sizes; -} - -void RenderThemeChromiumMac::setSearchFieldSize(RenderStyle* style) const -{ - // If the width and height are both specified, then we have nothing to do. - if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) - return; - - // Use the font size to determine the intrinsic width of the control. - setSizeFromFont(style, searchFieldSizes()); -} - -void RenderThemeChromiumMac::adjustSearchFieldStyle(CSSStyleSelector* selector, RenderStyle* style, Element*) const -{ - // Override border. - style->resetBorder(); - const short borderWidth = 2 * style->effectiveZoom(); - style->setBorderLeftWidth(borderWidth); - style->setBorderLeftStyle(INSET); - style->setBorderRightWidth(borderWidth); - style->setBorderRightStyle(INSET); - style->setBorderBottomWidth(borderWidth); - style->setBorderBottomStyle(INSET); - style->setBorderTopWidth(borderWidth); - style->setBorderTopStyle(INSET); - - // Override height. - style->setHeight(Length(Auto)); - setSearchFieldSize(style); - - // Override padding size to match AppKit text positioning. - const int padding = 1 * style->effectiveZoom(); - style->setPaddingLeft(Length(padding, Fixed)); - style->setPaddingRight(Length(padding, Fixed)); - style->setPaddingTop(Length(padding, Fixed)); - style->setPaddingBottom(Length(padding, Fixed)); - - NSControlSize controlSize = controlSizeForFont(style); - setFontFromControlSize(selector, style, controlSize); - - style->setBoxShadow(0); -} - -bool RenderThemeChromiumMac::paintSearchFieldCancelButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) -{ - Node* input = o->node()->shadowAncestorNode(); - if (!input->renderer()->isBox()) - return false; - - setSearchCellState(input->renderer(), r); - - NSSearchFieldCell* search = this->search(); - - updateActiveState([search cancelButtonCell], o); - updatePressedState([search cancelButtonCell], o); - - paintInfo.context->save(); - - float zoomLevel = o->style()->effectiveZoom(); - - FloatRect localBounds = [search cancelButtonRectForBounds:NSRect(input->renderBox()->borderBoxRect())]; - localBounds = convertToPaintingRect(input->renderer(), o, localBounds, r); - - FloatRect unzoomedRect(localBounds); - if (zoomLevel != 1.0f) { - unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); - unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); - paintInfo.context->translate(unzoomedRect.x(), unzoomedRect.y()); - paintInfo.context->scale(FloatSize(zoomLevel, zoomLevel)); - paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); - } - - [[search cancelButtonCell] drawWithFrame:unzoomedRect inView:FlippedView()]; - [[search cancelButtonCell] setControlView:nil]; - - paintInfo.context->restore(); - return false; -} - -const IntSize* RenderThemeChromiumMac::cancelButtonSizes() const -{ - static const IntSize sizes[3] = { IntSize(16, 13), IntSize(13, 11), IntSize(13, 9) }; - return sizes; -} - -void RenderThemeChromiumMac::adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle* style, Element*) const -{ - IntSize size = sizeForSystemFont(style, cancelButtonSizes()); - style->setWidth(Length(size.width(), Fixed)); - style->setHeight(Length(size.height(), Fixed)); - style->setBoxShadow(0); -} - -const IntSize* RenderThemeChromiumMac::resultsButtonSizes() const -{ - static const IntSize sizes[3] = { IntSize(19, 13), IntSize(17, 11), IntSize(17, 9) }; - return sizes; -} - -const int emptyResultsOffset = 9; -void RenderThemeChromiumMac::adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle* style, Element*) const -{ - IntSize size = sizeForSystemFont(style, resultsButtonSizes()); - style->setWidth(Length(size.width() - emptyResultsOffset, Fixed)); - style->setHeight(Length(size.height(), Fixed)); - style->setBoxShadow(0); -} - -bool RenderThemeChromiumMac::paintSearchFieldDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) -{ - return false; -} - -void RenderThemeChromiumMac::adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle* style, Element*) const -{ - IntSize size = sizeForSystemFont(style, resultsButtonSizes()); - style->setWidth(Length(size.width(), Fixed)); - style->setHeight(Length(size.height(), Fixed)); - style->setBoxShadow(0); -} - -bool RenderThemeChromiumMac::paintSearchFieldResultsDecoration(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) -{ - Node* input = o->node()->shadowAncestorNode(); - if (!input->renderer()->isBox()) - return false; - - setSearchCellState(input->renderer(), r); - - NSSearchFieldCell* search = this->search(); - - updateActiveState([search searchButtonCell], o); - - if ([search searchMenuTemplate] != nil) - [search setSearchMenuTemplate:nil]; - - FloatRect localBounds = [search searchButtonRectForBounds:NSRect(input->renderBox()->borderBoxRect())]; - localBounds = convertToPaintingRect(input->renderer(), o, localBounds, r); - - [[search searchButtonCell] drawWithFrame:localBounds inView:FlippedView()]; - [[search searchButtonCell] setControlView:nil]; - return false; -} - -const int resultsArrowWidth = 5; -void RenderThemeChromiumMac::adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle* style, Element*) const -{ - IntSize size = sizeForSystemFont(style, resultsButtonSizes()); - style->setWidth(Length(size.width() + resultsArrowWidth, Fixed)); - style->setHeight(Length(size.height(), Fixed)); - style->setBoxShadow(0); -} - -bool RenderThemeChromiumMac::paintSearchFieldResultsButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) -{ - Node* input = o->node()->shadowAncestorNode(); - if (!input->renderer()->isBox()) - return false; - - setSearchCellState(input->renderer(), r); - - NSSearchFieldCell* search = this->search(); - - updateActiveState([search searchButtonCell], o); - - if (![search searchMenuTemplate]) - [search setSearchMenuTemplate:searchMenuTemplate()]; - - paintInfo.context->save(); - - float zoomLevel = o->style()->effectiveZoom(); - - FloatRect localBounds = [search searchButtonRectForBounds:NSRect(input->renderBox()->borderBoxRect())]; - localBounds = convertToPaintingRect(input->renderer(), o, localBounds, r); - - IntRect unzoomedRect(localBounds); - if (zoomLevel != 1.0f) { - unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); - unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); - paintInfo.context->translate(unzoomedRect.x(), unzoomedRect.y()); - paintInfo.context->scale(FloatSize(zoomLevel, zoomLevel)); - paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); - } - - [[search searchButtonCell] drawWithFrame:unzoomedRect inView:FlippedView()]; - [[search searchButtonCell] setControlView:nil]; - - paintInfo.context->restore(); - - return false; -} - -const int sliderThumbWidth = 15; -const int sliderThumbHeight = 15; +#if ENABLE(VIDEO) -void RenderThemeChromiumMac::adjustSliderThumbSize(RenderObject* o) const +void RenderThemeChromiumMac::adjustMediaSliderThumbSize(RenderObject* o) const { - float zoomLevel = o->style()->effectiveZoom(); - if (o->style()->appearance() == SliderThumbHorizontalPart || o->style()->appearance() == SliderThumbVerticalPart) { - o->style()->setWidth(Length(static_cast<int>(sliderThumbWidth * zoomLevel), Fixed)); - o->style()->setHeight(Length(static_cast<int>(sliderThumbHeight * zoomLevel), Fixed)); - } - -#if ENABLE(VIDEO) RenderMediaControlsChromium::adjustMediaSliderThumbSize(o); -#endif } -#if ENABLE(VIDEO) bool RenderThemeChromiumMac::shouldRenderMediaControlPart(ControlPart part, Element* e) { return RenderMediaControlsChromium::shouldRenderMediaControlPart(part, e); @@ -1535,21 +124,6 @@ bool RenderThemeChromiumMac::paintMediaSliderTrack(RenderObject* object, const R return RenderMediaControlsChromium::paintMediaControlsPart(MediaSlider, object, paintInfo, rect); } -bool RenderThemeChromiumMac::paintMediaVolumeSliderTrack(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) -{ - return RenderMediaControlsChromium::paintMediaControlsPart(MediaVolumeSlider, object, paintInfo, rect); -} - -bool RenderThemeChromiumMac::paintMediaSliderThumb(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) -{ - return RenderMediaControlsChromium::paintMediaControlsPart(MediaSliderThumb, object, paintInfo, rect); -} - -bool RenderThemeChromiumMac::paintMediaVolumeSliderThumb(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) -{ - return RenderMediaControlsChromium::paintMediaControlsPart(MediaVolumeSliderThumb, object, paintInfo, rect); -} - bool RenderThemeChromiumMac::paintMediaControlsBackground(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) { return RenderMediaControlsChromium::paintMediaControlsPart(MediaTimelineContainer, object, paintInfo, rect); @@ -1560,64 +134,16 @@ String RenderThemeChromiumMac::extraMediaControlsStyleSheet() return String(mediaControlsChromiumUserAgentStyleSheet, sizeof(mediaControlsChromiumUserAgentStyleSheet)); } -#endif - -NSPopUpButtonCell* RenderThemeChromiumMac::popupButton() const -{ - if (!m_popupButton) { - m_popupButton.adoptNS([[NSPopUpButtonCell alloc] initTextCell:@"" pullsDown:NO]); - [m_popupButton.get() setUsesItemFromMenu:NO]; - [m_popupButton.get() setFocusRingType:NSFocusRingTypeExterior]; - } - - return m_popupButton.get(); -} - -NSSearchFieldCell* RenderThemeChromiumMac::search() const -{ - if (!m_search) { - m_search.adoptNS([[NSSearchFieldCell alloc] initTextCell:@""]); - [m_search.get() setBezelStyle:NSTextFieldRoundedBezel]; - [m_search.get() setBezeled:YES]; - [m_search.get() setEditable:YES]; - [m_search.get() setFocusRingType:NSFocusRingTypeExterior]; - } - - return m_search.get(); -} - -NSMenu* RenderThemeChromiumMac::searchMenuTemplate() const +bool RenderThemeChromiumMac::paintMediaVolumeSliderTrack(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) { - if (!m_searchMenuTemplate) - m_searchMenuTemplate.adoptNS([[NSMenu alloc] initWithTitle:@""]); - - return m_searchMenuTemplate.get(); + return RenderMediaControlsChromium::paintMediaControlsPart(MediaVolumeSlider, object, paintInfo, rect); } -NSSliderCell* RenderThemeChromiumMac::sliderThumbHorizontal() const +bool RenderThemeChromiumMac::paintMediaVolumeSliderThumb(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) { - if (!m_sliderThumbHorizontal) { - m_sliderThumbHorizontal.adoptNS([[NSSliderCell alloc] init]); - [m_sliderThumbHorizontal.get() setTitle:nil]; - [m_sliderThumbHorizontal.get() setSliderType:NSLinearSlider]; - [m_sliderThumbHorizontal.get() setControlSize:NSSmallControlSize]; - [m_sliderThumbHorizontal.get() setFocusRingType:NSFocusRingTypeExterior]; - } - - return m_sliderThumbHorizontal.get(); + return RenderMediaControlsChromium::paintMediaControlsPart(MediaVolumeSliderThumb, object, paintInfo, rect); } -NSSliderCell* RenderThemeChromiumMac::sliderThumbVertical() const -{ - if (!m_sliderThumbVertical) { - m_sliderThumbVertical.adoptNS([[NSSliderCell alloc] init]); - [m_sliderThumbVertical.get() setTitle:nil]; - [m_sliderThumbVertical.get() setSliderType:NSLinearSlider]; - [m_sliderThumbVertical.get() setControlSize:NSSmallControlSize]; - [m_sliderThumbVertical.get() setFocusRingType:NSFocusRingTypeExterior]; - } - - return m_sliderThumbVertical.get(); -} +#endif } // namespace WebCore diff --git a/WebCore/rendering/RenderThemeMac.h b/WebCore/rendering/RenderThemeMac.h index cba927f..cb604b9 100644 --- a/WebCore/rendering/RenderThemeMac.h +++ b/WebCore/rendering/RenderThemeMac.h @@ -88,8 +88,14 @@ public: #endif virtual Color systemColor(int cssValueId) const; - + // Controls color values returned from platformFocusRingColor(). systemColor() will be used when false. + virtual bool usesTestModeFocusRingColor() const; + // A view associated to the contained document. Subclasses may not have such a view and return a fake. + virtual NSView* documentViewFor(RenderObject*) const; protected: + RenderThemeMac(); + virtual ~RenderThemeMac(); + virtual bool supportsSelectionForegroundColors() const { return false; } virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); @@ -149,11 +155,10 @@ protected: virtual String extraMediaControlsStyleSheet(); virtual bool shouldRenderMediaControlPart(ControlPart, Element*); + virtual void adjustMediaSliderThumbSize(RenderObject*) const; #endif private: - RenderThemeMac(); - virtual ~RenderThemeMac(); IntRect inflateRect(const IntRect&, const IntSize&, const int* margins, float zoomLevel = 1.0f) const; @@ -172,6 +177,8 @@ private: void updateEnabledState(NSCell*, const RenderObject*); void updateFocusedState(NSCell*, const RenderObject*); void updatePressedState(NSCell*, const RenderObject*); + // An optional hook for subclasses to update the control tint of NSCell. + virtual void updateActiveState(NSCell*, const RenderObject*) {} // Helpers for adjusting appearance and for painting diff --git a/WebCore/rendering/RenderThemeMac.mm b/WebCore/rendering/RenderThemeMac.mm index c0d8020..d1a3965 100644 --- a/WebCore/rendering/RenderThemeMac.mm +++ b/WebCore/rendering/RenderThemeMac.mm @@ -115,11 +115,13 @@ enum { leftPadding }; +#if PLATFORM(MAC) PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page*) { static RenderTheme* rt = RenderThemeMac::create().releaseRef(); return rt; } +#endif PassRefPtr<RenderTheme> RenderThemeMac::create() { @@ -458,6 +460,21 @@ Color RenderThemeMac::systemColor(int cssValueId) const return color; } +bool RenderThemeMac::usesTestModeFocusRingColor() const +{ + return WebCore::usesTestModeFocusRingColor(); +} + +NSView* RenderThemeMac::documentViewFor(RenderObject* o) const +{ +#if PLATFORM(MAC) + return ThemeMac::ensuredView(o->view()->frameView()); +#else + ASSERT_NOT_REACHED(); + return 0; +#endif +} + bool RenderThemeMac::isControlStyled(const RenderStyle* style, const BorderData& border, const FillLayer& background, const Color& backgroundColor) const { @@ -487,6 +504,7 @@ void RenderThemeMac::adjustRepaintRect(const RenderObject* o, IntRect& r) case ListButtonPart: case DefaultButtonPart: case ButtonPart: + case OuterSpinButtonPart: return RenderTheme::adjustRepaintRect(o, r); default: break; @@ -776,7 +794,7 @@ bool RenderThemeMac::paintMenuList(RenderObject* o, const RenderObject::PaintInf paintInfo.context->translate(-inflatedRect.x(), -inflatedRect.y()); } - [popupButton drawWithFrame:inflatedRect inView:ThemeMac::ensuredView(o->view()->frameView())]; + [popupButton drawWithFrame:inflatedRect inView:documentViewFor(o)]; [popupButton setControlView:nil]; paintInfo.context->restore(); @@ -1111,6 +1129,7 @@ void RenderThemeMac::setPopupButtonCellState(const RenderObject* o, const IntRec setControlSize(popupButton, popupButtonSizes(), r.size(), o->style()->effectiveZoom()); // Update the various states we respond to. + updateActiveState(popupButton, o); updateCheckedState(popupButton, o); updateEnabledState(popupButton, o); updatePressedState(popupButton, o); @@ -1193,6 +1212,7 @@ bool RenderThemeMac::paintSliderThumb(RenderObject* o, const RenderObject::Paint LocalCurrentGraphicsContext localContext(paintInfo.context); // Update the various states we respond to. + updateActiveState(sliderThumbCell, o->parent()); updateEnabledState(sliderThumbCell, o->parent()); updateFocusedState(sliderThumbCell, o->parent()); @@ -1234,7 +1254,7 @@ bool RenderThemeMac::paintSliderThumb(RenderObject* o, const RenderObject::Paint paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); } - [sliderThumbCell drawWithFrame:unzoomedRect inView:ThemeMac::ensuredView(o->view()->frameView())]; + [sliderThumbCell drawWithFrame:unzoomedRect inView:documentViewFor(o)]; [sliderThumbCell setControlView:nil]; paintInfo.context->restore(); @@ -1266,7 +1286,7 @@ bool RenderThemeMac::paintSearchField(RenderObject* o, const RenderObject::Paint // Set the search button to nil before drawing. Then reset it so we can draw it later. [search setSearchButtonCell:nil]; - [search drawWithFrame:NSRect(unzoomedRect) inView:ThemeMac::ensuredView(o->view()->frameView())]; + [search drawWithFrame:NSRect(unzoomedRect) inView:documentViewFor(o)]; #ifdef BUILDING_ON_TIGER if ([search showsFirstResponder]) wkDrawTextFieldCellFocusRing(search, NSRect(unzoomedRect)); @@ -1287,6 +1307,7 @@ void RenderThemeMac::setSearchCellState(RenderObject* o, const IntRect&) [search setControlSize:controlSizeForFont(o->style())]; // Update the various states we respond to. + updateActiveState(search, o); updateEnabledState(search, o); updateFocusedState(search, o); } @@ -1348,6 +1369,7 @@ bool RenderThemeMac::paintSearchFieldCancelButton(RenderObject* o, const RenderO NSSearchFieldCell* search = this->search(); + updateActiveState([search cancelButtonCell], o); updatePressedState([search cancelButtonCell], o); paintInfo.context->save(); @@ -1366,7 +1388,7 @@ bool RenderThemeMac::paintSearchFieldCancelButton(RenderObject* o, const RenderO paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); } - [[search cancelButtonCell] drawWithFrame:unzoomedRect inView:ThemeMac::ensuredView(o->view()->frameView())]; + [[search cancelButtonCell] drawWithFrame:unzoomedRect inView:documentViewFor(o)]; [[search cancelButtonCell] setControlView:nil]; paintInfo.context->restore(); @@ -1428,10 +1450,12 @@ bool RenderThemeMac::paintSearchFieldResultsDecoration(RenderObject* o, const Re if ([search searchMenuTemplate] != nil) [search setSearchMenuTemplate:nil]; + updateActiveState([search searchButtonCell], o); + FloatRect localBounds = [search searchButtonRectForBounds:NSRect(input->renderBox()->borderBoxRect())]; localBounds = convertToPaintingRect(input->renderer(), o, localBounds, r); - [[search searchButtonCell] drawWithFrame:localBounds inView:ThemeMac::ensuredView(o->view()->frameView())]; + [[search searchButtonCell] drawWithFrame:localBounds inView:documentViewFor(o)]; [[search searchButtonCell] setControlView:nil]; return false; } @@ -1455,6 +1479,8 @@ bool RenderThemeMac::paintSearchFieldResultsButton(RenderObject* o, const Render NSSearchFieldCell* search = this->search(); + updateActiveState([search searchButtonCell], o); + if (![search searchMenuTemplate]) [search setSearchMenuTemplate:searchMenuTemplate()]; @@ -1474,7 +1500,7 @@ bool RenderThemeMac::paintSearchFieldResultsButton(RenderObject* o, const Render paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); } - [[search searchButtonCell] drawWithFrame:unzoomedRect inView:ThemeMac::ensuredView(o->view()->frameView())]; + [[search searchButtonCell] drawWithFrame:unzoomedRect inView:documentViewFor(o)]; [[search searchButtonCell] setControlView:nil]; paintInfo.context->restore(); @@ -1527,7 +1553,15 @@ void RenderThemeMac::adjustSliderThumbSize(RenderObject* o) const } #if ENABLE(VIDEO) - else if (o->style()->appearance() == MediaSliderThumbPart) { + adjustMediaSliderThumbSize(o); +#endif +} + +#if ENABLE(VIDEO) + +void RenderThemeMac::adjustMediaSliderThumbSize(RenderObject* o) const +{ + if (o->style()->appearance() == MediaSliderThumbPart) { int width = mediaSliderThumbWidth; int height = mediaSliderThumbHeight; @@ -1539,15 +1573,12 @@ void RenderThemeMac::adjustSliderThumbSize(RenderObject* o) const height = size.height; } + float zoomLevel = o->style()->effectiveZoom(); o->style()->setWidth(Length(static_cast<int>(width * zoomLevel), Fixed)); o->style()->setHeight(Length(static_cast<int>(height * zoomLevel), Fixed)); } -#endif } - -#if ENABLE(VIDEO) - enum WKMediaControllerThemeState { MediaUIPartDisabledFlag = 1 << 0, MediaUIPartPressedFlag = 1 << 1, @@ -1759,10 +1790,15 @@ bool RenderThemeMac::paintMediaTimeRemaining(RenderObject* o, const RenderObject String RenderThemeMac::extraMediaControlsStyleSheet() { +#if PLATFORM(MAC) if (mediaControllerTheme() == MediaControllerThemeQuickTime) return String(mediaControlsQuickTimeUserAgentStyleSheet, sizeof(mediaControlsQuickTimeUserAgentStyleSheet)); else return String(); +#else + ASSERT_NOT_REACHED(); + return String(); +#endif } bool RenderThemeMac::shouldRenderMediaControlPart(ControlPart part, Element* element) diff --git a/WebCore/rendering/RenderTreeAsText.cpp b/WebCore/rendering/RenderTreeAsText.cpp index 75c35ba..311854e 100644 --- a/WebCore/rendering/RenderTreeAsText.cpp +++ b/WebCore/rendering/RenderTreeAsText.cpp @@ -34,6 +34,7 @@ #include "HTMLElement.h" #include "HTMLNames.h" #include "InlineTextBox.h" +#include "PrintContext.h" #include "RenderBR.h" #include "RenderFileUploadControl.h" #include "RenderInline.h" @@ -51,6 +52,7 @@ #if ENABLE(SVG) #include "RenderPath.h" #include "RenderSVGContainer.h" +#include "RenderSVGGradientStop.h" #include "RenderSVGImage.h" #include "RenderSVGInlineText.h" #include "RenderSVGRoot.h" @@ -396,8 +398,12 @@ void write(TextStream& ts, const RenderObject& o, int indent, RenderAsTextBehavi write(ts, *toRenderPath(&o), indent); return; } - if (o.isSVGResource()) { - writeSVGResource(ts, o, indent); + if (o.isSVGGradientStop()) { + writeSVGGradientStop(ts, *toRenderSVGGradientStop(&o), indent); + return; + } + if (o.isSVGResourceContainer()) { + writeSVGResourceContainer(ts, o, indent); return; } if (o.isSVGContainer()) { @@ -612,6 +618,13 @@ static void writeSelection(TextStream& ts, const RenderObject* o) String externalRepresentation(Frame* frame, RenderAsTextBehavior behavior) { + PrintContext printContext(frame); + if (behavior & RenderAsTextPrintingMode) { + if (!frame->contentRenderer()) + return String(); + printContext.begin(frame->contentRenderer()->width()); + } + frame->document()->updateLayout(); RenderObject* o = frame->contentRenderer(); @@ -619,9 +632,6 @@ String externalRepresentation(Frame* frame, RenderAsTextBehavior behavior) return String(); TextStream ts; -#if ENABLE(SVG) - writeRenderResources(ts, o->document()); -#endif if (o->hasLayer()) { RenderLayer* l = toRenderBox(o)->layer(); writeLayers(ts, l, l, IntRect(l->x(), l->y(), l->width(), l->height()), 0, behavior); diff --git a/WebCore/rendering/RenderTreeAsText.h b/WebCore/rendering/RenderTreeAsText.h index 4da0bab..1427342 100644 --- a/WebCore/rendering/RenderTreeAsText.h +++ b/WebCore/rendering/RenderTreeAsText.h @@ -39,10 +39,12 @@ enum RenderAsTextBehaviorFlags { RenderAsTextShowAllLayers = 1 << 0, // Dump all layers, not just those that would paint. RenderAsTextShowLayerNesting = 1 << 1, // Annotate the layer lists. RenderAsTextShowCompositedLayers = 1 << 2, // Show which layers are composited. - RenderAsTextShowAddresses = 1 << 3 // Show layer and renderer addresses. + RenderAsTextShowAddresses = 1 << 3, // Show layer and renderer addresses. + RenderAsTextPrintingMode = 1 << 4 // Dump the tree in printing mode. }; typedef unsigned RenderAsTextBehavior; +// You don't need pageWidthInPixels if you don't specify RenderAsTextInPrintingMode. String externalRepresentation(Frame*, RenderAsTextBehavior = RenderAsTextBehaviorNormal); void write(TextStream&, const RenderObject&, int indent = 0, RenderAsTextBehavior = RenderAsTextBehaviorNormal); diff --git a/WebCore/rendering/RenderVideo.cpp b/WebCore/rendering/RenderVideo.cpp index ad25c22..610fb5f 100644 --- a/WebCore/rendering/RenderVideo.cpp +++ b/WebCore/rendering/RenderVideo.cpp @@ -50,7 +50,7 @@ using namespace HTMLNames; RenderVideo::RenderVideo(HTMLVideoElement* video) : RenderMedia(video) { - if (video->player()) + if (video->player() && video->readyState() >= HTMLVideoElement::HAVE_METADATA) setIntrinsicSize(video->player()->naturalSize()); else { // When the natural size of the video is unavailable, we use the provided @@ -101,7 +101,11 @@ void RenderVideo::videoSizeChanged() if (!player()) return; IntSize size = player()->naturalSize(); - if (!size.isEmpty() && size != intrinsicSize()) { + if (size.isEmpty()) { + if (node()->ownerDocument() && node()->ownerDocument()->isMediaDocument()) + return; + } + if (size != intrinsicSize()) { setIntrinsicSize(size); setPrefWidthsDirty(true); setNeedsLayout(true); diff --git a/WebCore/rendering/RenderView.cpp b/WebCore/rendering/RenderView.cpp index a95ffdd..449e293 100644 --- a/WebCore/rendering/RenderView.cpp +++ b/WebCore/rendering/RenderView.cpp @@ -747,16 +747,6 @@ bool RenderView::usesCompositing() const return m_compositor && m_compositor->inCompositingMode(); } -void RenderView::compositingStateChanged(bool) -{ - Element* elt = document()->ownerElement(); - if (!elt) - return; - - // Trigger a recalcStyle in the parent document, to update compositing in that document. - elt->setNeedsStyleRecalc(SyntheticStyleChange); -} - RenderLayerCompositor* RenderView::compositor() { if (!m_compositor) diff --git a/WebCore/rendering/RenderView.h b/WebCore/rendering/RenderView.h index 0751866..05c3876 100644 --- a/WebCore/rendering/RenderView.h +++ b/WebCore/rendering/RenderView.h @@ -166,7 +166,6 @@ public: #if USE(ACCELERATED_COMPOSITING) RenderLayerCompositor* compositor(); bool usesCompositing() const; - void compositingStateChanged(bool nowComposited); #endif protected: diff --git a/WebCore/rendering/RenderWidget.cpp b/WebCore/rendering/RenderWidget.cpp index 485baa3..15c75f1 100644 --- a/WebCore/rendering/RenderWidget.cpp +++ b/WebCore/rendering/RenderWidget.cpp @@ -320,8 +320,8 @@ void RenderWidget::updateWidgetPosition() FloatPoint absPos = localToAbsolute(); absPos.move(borderLeft() + paddingLeft(), borderTop() + paddingTop()); - int w = width() - borderLeft() - borderRight() - paddingLeft() - paddingRight(); - int h = height() - borderTop() - borderBottom() - paddingTop() - paddingBottom(); + int w = width() - borderAndPaddingWidth(); + int h = height() - borderAndPaddingHeight(); bool boundsChanged = setWidgetGeometry(IntRect(absPos.x(), absPos.y(), w, h)); diff --git a/WebCore/rendering/SVGCharacterData.cpp b/WebCore/rendering/SVGCharacterData.cpp new file mode 100644 index 0000000..394a303 --- /dev/null +++ b/WebCore/rendering/SVGCharacterData.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) Research In Motion Limited 2010. 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. + * + */ + +#include "config.h" +#include "SVGCharacterData.h" + +#if ENABLE(SVG) +#include "AffineTransform.h" + +namespace WebCore { + +bool SVGChar::isHidden() const +{ + return pathData && pathData->hidden; +} + +AffineTransform SVGChar::characterTransform() const +{ + AffineTransform ctm; + + // Rotate character around angle, and possibly scale. + ctm.translate(x, y); + ctm.rotate(angle); + + if (pathData) { + ctm.scaleNonUniform(pathData->xScale, pathData->yScale); + ctm.translate(pathData->xShift, pathData->yShift); + ctm.rotate(pathData->orientationAngle); + } + + ctm.translate(orientationShiftX - x, orientationShiftY - y); + return ctm; +} + +} // namespace WebCore + +#endif // ENABLE(SVG) diff --git a/WebCore/rendering/SVGCharacterData.h b/WebCore/rendering/SVGCharacterData.h new file mode 100644 index 0000000..68682c9 --- /dev/null +++ b/WebCore/rendering/SVGCharacterData.h @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) Research In Motion Limited 2010. 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 SVGCharacterData_h +#define SVGCharacterData_h + +#if ENABLE(SVG) +#include <wtf/HashMap.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class AffineTransform; +class RenderObject; + +// Holds extra data, when the character is laid out on a path +struct SVGCharOnPath : RefCounted<SVGCharOnPath> { + static PassRefPtr<SVGCharOnPath> create() { return adoptRef(new SVGCharOnPath); } + + float xScale; + float yScale; + + float xShift; + float yShift; + + float orientationAngle; + + bool hidden : 1; + +private: + SVGCharOnPath() + : xScale(1.0f) + , yScale(1.0f) + , xShift(0.0f) + , yShift(0.0f) + , orientationAngle(0.0f) + , hidden(false) + { + } +}; + +struct SVGChar { + SVGChar() + : x(0.0f) + , y(0.0f) + , angle(0.0f) + , orientationShiftX(0.0f) + , orientationShiftY(0.0f) + , drawnSeperated(false) + , newTextChunk(false) + { + } + + float x; + float y; + float angle; + + float orientationShiftX; + float orientationShiftY; + + RefPtr<SVGCharOnPath> pathData; + + // Determines wheter this char needs to be drawn seperated + bool drawnSeperated : 1; + + // Determines wheter this char starts a new chunk + bool newTextChunk : 1; + + // Helper methods + bool isHidden() const; + AffineTransform characterTransform() const; +}; + +struct SVGTextDecorationInfo { + // ETextDecoration is meant to be used here + HashMap<int, RenderObject*> fillServerMap; + HashMap<int, RenderObject*> strokeServerMap; +}; + +} // namespace WebCore + +#endif // ENABLE(SVG) +#endif // SVGCharacterData_h diff --git a/WebCore/rendering/SVGCharacterLayoutInfo.cpp b/WebCore/rendering/SVGCharacterLayoutInfo.cpp index 7e85672..04f0067 100644 --- a/WebCore/rendering/SVGCharacterLayoutInfo.cpp +++ b/WebCore/rendering/SVGCharacterLayoutInfo.cpp @@ -1,6 +1,4 @@ /* - * This file is part of the WebKit project. - * * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> * * This library is free software; you can redistribute it and/or @@ -21,16 +19,16 @@ */ #include "config.h" - -#if ENABLE(SVG) #include "SVGCharacterLayoutInfo.h" +#if ENABLE(SVG) #include "InlineFlowBox.h" #include "InlineTextBox.h" +#include "RenderSVGTextPath.h" +#include "SVGCharacterData.h" #include "SVGLengthList.h" #include "SVGNumberList.h" #include "SVGTextPositioningElement.h" -#include "RenderSVGTextPath.h" #include <float.h> @@ -161,6 +159,19 @@ float SVGCharacterLayoutInfo::baselineShiftValueNext() const return baselineShiftStack.last(); } + +bool SVGCharacterLayoutInfo::isInitialLayout() const +{ + return xStack.isEmpty() + && yStack.isEmpty() + && dxStack.isEmpty() + && dyStack.isEmpty() + && angleStack.isEmpty() + && baselineShiftStack.isEmpty() + && curx == 0.0f + && cury == 0.0f; +} + void SVGCharacterLayoutInfo::processedSingleCharacter() { xStackWalk(); @@ -249,7 +260,6 @@ bool SVGCharacterLayoutInfo::nextPathLayoutPointAndAngle(float glyphAdvance, flo angle = layoutPath.normalAngleAtLength(offset, ok); ASSERT(ok); - // fprintf(stderr, "t: %f, x: %f, y: %f, angle: %f, glyphAdvance: %f\n", currentOffset, x, y, angle, glyphAdvance); return true; } @@ -269,10 +279,7 @@ void SVGCharacterLayoutInfo::setInPathLayout(bool value) void SVGCharacterLayoutInfo::addLayoutInformation(InlineFlowBox* flowBox, float textAnchorStartOffset) { - bool isInitialLayout = xStack.isEmpty() && yStack.isEmpty() && - dxStack.isEmpty() && dyStack.isEmpty() && - angleStack.isEmpty() && baselineShiftStack.isEmpty() && - curx == 0.0f && cury == 0.0f; + bool wasInitialLayout = isInitialLayout(); RenderSVGTextPath* textPath = toRenderSVGTextPath(flowBox->renderer()); Path path = textPath->layoutPath(); @@ -296,7 +303,7 @@ void SVGCharacterLayoutInfo::addLayoutInformation(InlineFlowBox* flowBox, float // Only baseline-shift is handled through the normal layout system addStackContent(BaselineShiftStack, baselineShift); - if (isInitialLayout) { + if (wasInitialLayout) { xStackChanged = false; yStackChanged = false; dxStackChanged = false; @@ -308,11 +315,7 @@ void SVGCharacterLayoutInfo::addLayoutInformation(InlineFlowBox* flowBox, float void SVGCharacterLayoutInfo::addLayoutInformation(SVGTextPositioningElement* element) { - bool isInitialLayout = xStack.isEmpty() && yStack.isEmpty() && - dxStack.isEmpty() && dyStack.isEmpty() && - angleStack.isEmpty() && baselineShiftStack.isEmpty() && - curx == 0.0f && cury == 0.0f; - + bool wasInitialLayout = isInitialLayout(); float baselineShift = calculateBaselineShift(element->renderer()); addStackContent(XStack, element->x(), element); @@ -322,7 +325,7 @@ void SVGCharacterLayoutInfo::addLayoutInformation(SVGTextPositioningElement* ele addStackContent(AngleStack, element->rotate()); addStackContent(BaselineShiftStack, baselineShift); - if (isInitialLayout) { + if (wasInitialLayout) { xStackChanged = false; yStackChanged = false; dxStackChanged = false; @@ -344,7 +347,7 @@ void SVGCharacterLayoutInfo::addStackContent(StackType type, SVGNumberList* list ExceptionCode ec = 0; for (unsigned i = 0; i < length; ++i) { float value = list->getItem(i, ec); - ASSERT(ec == 0); + ASSERT(!ec); newLayoutInfo.append(value); } @@ -363,7 +366,7 @@ void SVGCharacterLayoutInfo::addStackContent(StackType type, SVGLengthList* list ExceptionCode ec = 0; for (unsigned i = 0; i < length; ++i) { float value = list->getItem(i, ec).value(context); - ASSERT(ec == 0); + ASSERT(!ec); newLayoutInfo.append(value); } @@ -507,29 +510,6 @@ void SVGCharacterLayoutInfo::baselineShiftStackWalk() } } -bool SVGChar::isHidden() const -{ - return pathData && pathData->hidden; -} - -AffineTransform SVGChar::characterTransform() const -{ - AffineTransform ctm; - - // Rotate character around angle, and possibly scale. - ctm.translate(x, y); - ctm.rotate(angle); - - if (pathData) { - ctm.scaleNonUniform(pathData->xScale, pathData->yScale); - ctm.translate(pathData->xShift, pathData->yShift); - ctm.rotate(pathData->orientationAngle); - } - - ctm.translate(orientationShiftX - x, orientationShiftY - y); - return ctm; -} - } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/rendering/SVGCharacterLayoutInfo.h b/WebCore/rendering/SVGCharacterLayoutInfo.h index f0d1fa4..16fd740 100644 --- a/WebCore/rendering/SVGCharacterLayoutInfo.h +++ b/WebCore/rendering/SVGCharacterLayoutInfo.h @@ -1,6 +1,4 @@ /* - * This file is part of the WebKit project. - * * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> * * This library is free software; you can redistribute it and/or @@ -24,21 +22,14 @@ #define SVGCharacterLayoutInfo_h #if ENABLE(SVG) -#include "AffineTransform.h" -#include "SVGRenderStyle.h" -#include "SVGTextContentElement.h" - +#include "Path.h" #include <wtf/Assertions.h> -#include <wtf/HashMap.h> -#include <wtf/HashSet.h> -#include <wtf/RefCounted.h> #include <wtf/Vector.h> namespace WebCore { -class InlineBox; class InlineFlowBox; -class SVGInlineTextBox; +class SVGElement; class SVGLengthList; class SVGNumberList; class SVGTextPositioningElement; @@ -151,6 +142,8 @@ private: void angleStackWalk(); void baselineShiftStackWalk(); + bool isInitialLayout() const; + private: bool xStackChanged : 1; bool yStackChanged : 1; @@ -174,211 +167,6 @@ private: Vector<float> baselineShiftStack; }; -// Holds extra data, when the character is laid out on a path -struct SVGCharOnPath : RefCounted<SVGCharOnPath> { - static PassRefPtr<SVGCharOnPath> create() { return adoptRef(new SVGCharOnPath); } - - float xScale; - float yScale; - - float xShift; - float yShift; - - float orientationAngle; - - bool hidden : 1; - -private: - SVGCharOnPath() - : xScale(1.0f) - , yScale(1.0f) - , xShift(0.0f) - , yShift(0.0f) - , orientationAngle(0.0f) - , hidden(false) - { - } -}; - -struct SVGChar { - SVGChar() - : x(0.0f) - , y(0.0f) - , angle(0.0f) - , orientationShiftX(0.0f) - , orientationShiftY(0.0f) - , pathData() - , drawnSeperated(false) - , newTextChunk(false) - { - } - - ~SVGChar() - { - } - - float x; - float y; - float angle; - - float orientationShiftX; - float orientationShiftY; - - RefPtr<SVGCharOnPath> pathData; - - // Determines wheter this char needs to be drawn seperated - bool drawnSeperated : 1; - - // Determines wheter this char starts a new chunk - bool newTextChunk : 1; - - // Helper methods - bool isHidden() const; - AffineTransform characterTransform() const; -}; - -struct SVGInlineBoxCharacterRange { - SVGInlineBoxCharacterRange() - : startOffset(INT_MIN) - , endOffset(INT_MIN) - , box(0) - { - } - - bool isOpen() const { return (startOffset == endOffset) && (endOffset == INT_MIN); } - bool isClosed() const { return startOffset != INT_MIN && endOffset != INT_MIN; } - - int startOffset; - int endOffset; - - InlineBox* box; -}; - -// Convenience typedef -typedef SVGTextContentElement::SVGLengthAdjustType ELengthAdjust; - -struct SVGTextChunk { - SVGTextChunk() - : anchor(TA_START) - , textLength(0.0f) - , lengthAdjust(SVGTextContentElement::LENGTHADJUST_SPACING) - , ctm() - , isVerticalText(false) - , isTextPath(false) - , start(0) - , end(0) - { } - - // text-anchor support - ETextAnchor anchor; - - // textLength & lengthAdjust support - float textLength; - ELengthAdjust lengthAdjust; - AffineTransform ctm; - - // status flags - bool isVerticalText : 1; - bool isTextPath : 1; - - // main chunk data - Vector<SVGChar>::iterator start; - Vector<SVGChar>::iterator end; - - Vector<SVGInlineBoxCharacterRange> boxes; -}; - -struct SVGTextChunkWalkerBase { - virtual ~SVGTextChunkWalkerBase() { } - - virtual void operator()(SVGInlineTextBox* textBox, int startOffset, const AffineTransform& chunkCtm, - const Vector<SVGChar>::iterator& start, const Vector<SVGChar>::iterator& end) = 0; - - // Followings methods are only used for painting text chunks - virtual void start(InlineBox*) = 0; - virtual void end(InlineBox*) = 0; -}; - -template<typename CallbackClass> -struct SVGTextChunkWalker : public SVGTextChunkWalkerBase { -public: - typedef void (CallbackClass::*SVGTextChunkWalkerCallback)(SVGInlineTextBox* textBox, - int startOffset, - const AffineTransform& chunkCtm, - const Vector<SVGChar>::iterator& start, - const Vector<SVGChar>::iterator& end); - - // These callbacks are only used for painting! - typedef void (CallbackClass::*SVGTextChunkStartCallback)(InlineBox* box); - typedef void (CallbackClass::*SVGTextChunkEndCallback)(InlineBox* box); - - SVGTextChunkWalker(CallbackClass* object, - SVGTextChunkWalkerCallback walker, - SVGTextChunkStartCallback start = 0, - SVGTextChunkEndCallback end = 0) - : m_object(object) - , m_walkerCallback(walker) - , m_startCallback(start) - , m_endCallback(end) - { - ASSERT(object); - ASSERT(walker); - } - - virtual void operator()(SVGInlineTextBox* textBox, int startOffset, const AffineTransform& chunkCtm, - const Vector<SVGChar>::iterator& start, const Vector<SVGChar>::iterator& end) - { - (*m_object.*m_walkerCallback)(textBox, startOffset, chunkCtm, start, end); - } - - // Followings methods are only used for painting text chunks - virtual void start(InlineBox* box) - { - if (m_startCallback) - (*m_object.*m_startCallback)(box); - else - ASSERT_NOT_REACHED(); - } - - virtual void end(InlineBox* box) - { - if (m_endCallback) - (*m_object.*m_endCallback)(box); - else - ASSERT_NOT_REACHED(); - } - -private: - CallbackClass* m_object; - SVGTextChunkWalkerCallback m_walkerCallback; - SVGTextChunkStartCallback m_startCallback; - SVGTextChunkEndCallback m_endCallback; -}; - -struct SVGTextChunkLayoutInfo { - SVGTextChunkLayoutInfo(Vector<SVGTextChunk>& textChunks) - : assignChunkProperties(true) - , handlingTextPath(false) - , svgTextChunks(textChunks) - , it(0) - { - } - - bool assignChunkProperties : 1; - bool handlingTextPath : 1; - - Vector<SVGTextChunk>& svgTextChunks; - Vector<SVGChar>::iterator it; - - SVGTextChunk chunk; -}; - -struct SVGTextDecorationInfo { - // ETextDecoration is meant to be used here - HashMap<int, RenderObject*> fillServerMap; - HashMap<int, RenderObject*> strokeServerMap; -}; - } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/rendering/SVGInlineTextBox.cpp b/WebCore/rendering/SVGInlineTextBox.cpp index bda512f..8b35507 100644 --- a/WebCore/rendering/SVGInlineTextBox.cpp +++ b/WebCore/rendering/SVGInlineTextBox.cpp @@ -30,7 +30,7 @@ #include "GraphicsContext.h" #include "InlineFlowBox.h" #include "Range.h" -#include "SVGPaintServer.h" +#include "RenderSVGResource.h" #include "SVGRootInlineBox.h" #include "Text.h" @@ -418,10 +418,9 @@ void SVGInlineTextBox::paintCharacters(RenderObject::PaintInfo& paintInfo, int t TextRun run = svgTextRunForInlineTextBox(chars, length, styleToUse, this, svgChar.x); #if ENABLE(SVG_FONTS) - // SVG Fonts need access to the paint server used to draw the current text chunk. - // They need to be able to call renderPath() on a SVGPaintServer object. - ASSERT(textPaintInfo.activePaintServer); - run.setActivePaintServer(textPaintInfo.activePaintServer); + // SVG Fonts need access to the painting resource used to draw the current text chunk. + ASSERT(textPaintInfo.activePaintingResource); + run.setActivePaintingResource(textPaintInfo.activePaintingResource); #endif int selectionStart = 0; @@ -569,18 +568,20 @@ void SVGInlineTextBox::paintDecoration(ETextDecoration decoration, GraphicsConte if (isFilled) { if (RenderObject* fillObject = info.fillServerMap.get(decoration)) { - if (SVGPaintServer* fillPaintServer = SVGPaintServer::fillPaintServer(fillObject->style(), fillObject)) { + if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(fillObject, fillObject->style())) { context->addPath(pathForDecoration(decoration, fillObject, tx, ty, width)); - fillPaintServer->draw(context, fillObject, ApplyToFillTargetType); + if (fillPaintingResource->applyResource(fillObject, fillObject->style(), context, ApplyToFillMode)) + fillPaintingResource->postApplyResource(fillObject, context, ApplyToFillMode); } } } if (isStroked) { if (RenderObject* strokeObject = info.strokeServerMap.get(decoration)) { - if (SVGPaintServer* strokePaintServer = SVGPaintServer::strokePaintServer(strokeObject->style(), strokeObject)) { + if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(strokeObject, strokeObject->style())) { context->addPath(pathForDecoration(decoration, strokeObject, tx, ty, width)); - strokePaintServer->draw(context, strokeObject, ApplyToStrokeTargetType); + if (strokePaintingResource->applyResource(strokeObject, strokeObject->style(), context, ApplyToStrokeMode)) + strokePaintingResource->postApplyResource(strokeObject, context, ApplyToStrokeMode); } } } diff --git a/WebCore/rendering/SVGInlineTextBox.h b/WebCore/rendering/SVGInlineTextBox.h index 596fdf3..c586ddd 100644 --- a/WebCore/rendering/SVGInlineTextBox.h +++ b/WebCore/rendering/SVGInlineTextBox.h @@ -24,6 +24,7 @@ #if ENABLE(SVG) #include "InlineTextBox.h" +#include "RenderSVGResource.h" namespace WebCore { @@ -42,9 +43,13 @@ namespace WebCore { }; struct SVGTextPaintInfo { - SVGTextPaintInfo() : activePaintServer(0), subphase(SVGTextPaintSubphaseBackground) {} + SVGTextPaintInfo() + : activePaintingResource(0) + , subphase(SVGTextPaintSubphaseBackground) + { + } - SVGPaintServer* activePaintServer; + RenderSVGResource* activePaintingResource; SVGTextPaintSubphase subphase; }; diff --git a/WebCore/rendering/SVGRenderSupport.cpp b/WebCore/rendering/SVGRenderSupport.cpp index dd67746..2600512 100644 --- a/WebCore/rendering/SVGRenderSupport.cpp +++ b/WebCore/rendering/SVGRenderSupport.cpp @@ -31,6 +31,7 @@ #include "AffineTransform.h" #include "Document.h" #include "ImageBuffer.h" +#include "NodeRenderStyle.h" #include "RenderObject.h" #include "RenderSVGContainer.h" #include "RenderSVGResource.h" @@ -92,7 +93,7 @@ bool SVGRenderBase::prepareToRenderSVGContent(RenderObject* object, RenderObject ASSERT(svgElement && svgElement->document() && svgElement->isStyled()); SVGStyledElement* styledElement = static_cast<SVGStyledElement*>(svgElement); - const RenderStyle* style = object->style(); + RenderStyle* style = object->style(); ASSERT(style); const SVGRenderStyle* svgStyle = style->svgStyle(); @@ -132,19 +133,19 @@ bool SVGRenderBase::prepareToRenderSVGContent(RenderObject* object, RenderObject #endif if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(document, maskerId)) { - if (!masker->applyResource(object, paintInfo.context)) + if (!masker->applyResource(object, style, paintInfo.context, ApplyToDefaultMode)) return false; } else if (!maskerId.isEmpty()) svgElement->document()->accessSVGExtensions()->addPendingResource(maskerId, styledElement); if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(document, clipperId)) - clipper->applyResource(object, paintInfo.context); + clipper->applyResource(object, style, paintInfo.context, ApplyToDefaultMode); else if (!clipperId.isEmpty()) svgElement->document()->accessSVGExtensions()->addPendingResource(clipperId, styledElement); #if ENABLE(FILTERS) if (filter) { - if (!filter->applyResource(object, paintInfo.context)) + if (!filter->applyResource(object, style, paintInfo.context, ApplyToDefaultMode)) return false; } else if (!filterId.isEmpty()) svgElement->document()->accessSVGExtensions()->addPendingResource(filterId, styledElement); @@ -167,7 +168,7 @@ void SVGRenderBase::finishRenderSVGContent(RenderObject* object, RenderObject::P #if ENABLE(FILTERS) if (filter) { - filter->postApplyResource(object, paintInfo.context); + filter->postApplyResource(object, paintInfo.context, ApplyToDefaultMode); paintInfo.context = savedContext; } #endif @@ -306,23 +307,57 @@ FloatRect SVGRenderBase::maskerBoundingBoxForRenderer(const RenderObject* object return FloatRect(); } +static inline void invalidatePaintingResource(SVGPaint* paint, RenderObject* object) +{ + ASSERT(paint); + + SVGPaint::SVGPaintType paintType = paint->paintType(); + if (paintType != SVGPaint::SVG_PAINTTYPE_URI && paintType != SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR) + return; + + AtomicString id(SVGURIReference::getTarget(paint->uri())); + if (RenderSVGResourceContainer* paintingResource = getRenderSVGResourceContainerById(object->document(), id)) + paintingResource->invalidateClient(object); +} + void deregisterFromResources(RenderObject* object) { - // We only have the renderer for masker and clipper at the moment. - if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(object->document(), object->style()->svgStyle()->maskerResource())) + ASSERT(object); + ASSERT(object->style()); + + Document* document = object->document(); + ASSERT(document); + + const SVGRenderStyle* svgStyle = object->style()->svgStyle(); + ASSERT(svgStyle); + + // Masker + if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(document, svgStyle->maskerResource())) masker->invalidateClient(object); - if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(object->document(), object->style()->svgStyle()->clipperResource())) + + // Clipper + if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(document, svgStyle->clipperResource())) clipper->invalidateClient(object); + + // Filter #if ENABLE(FILTERS) - if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(object->document(), object->style()->svgStyle()->filterResource())) + if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(document, svgStyle->filterResource())) filter->invalidateClient(object); #endif - if (RenderSVGResourceMarker* startMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(object->document(), object->style()->svgStyle()->markerStartResource())) + + // Markers + if (RenderSVGResourceMarker* startMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(document, svgStyle->markerStartResource())) startMarker->invalidateClient(object); - if (RenderSVGResourceMarker* midMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(object->document(), object->style()->svgStyle()->markerMidResource())) + if (RenderSVGResourceMarker* midMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(document, svgStyle->markerMidResource())) midMarker->invalidateClient(object); - if (RenderSVGResourceMarker* endMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(object->document(), object->style()->svgStyle()->markerEndResource())) + if (RenderSVGResourceMarker* endMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(document, svgStyle->markerEndResource())) endMarker->invalidateClient(object); + + // Gradients/Patterns + if (svgStyle->hasFill()) + invalidatePaintingResource(svgStyle->fillPaint(), object); + if (svgStyle->hasStroke()) + invalidatePaintingResource(svgStyle->strokePaint(), object); } void applyTransformToPaintInfo(RenderObject::PaintInfo& paintInfo, const AffineTransform& localToAncestorTransform) @@ -334,6 +369,42 @@ void applyTransformToPaintInfo(RenderObject::PaintInfo& paintInfo, const AffineT paintInfo.rect = localToAncestorTransform.inverse().mapRect(paintInfo.rect); } +DashArray dashArrayFromRenderingStyle(const RenderStyle* style, RenderStyle* rootStyle) +{ + DashArray array; + + CSSValueList* dashes = style->svgStyle()->strokeDashArray(); + if (dashes) { + CSSPrimitiveValue* dash = 0; + unsigned long len = dashes->length(); + for (unsigned long i = 0; i < len; i++) { + dash = static_cast<CSSPrimitiveValue*>(dashes->itemWithoutBoundsCheck(i)); + if (!dash) + continue; + + array.append((float) dash->computeLengthFloat(const_cast<RenderStyle*>(style), rootStyle)); + } + } + + return array; +} + +void applyStrokeStyleToContext(GraphicsContext* context, const RenderStyle* style, const RenderObject* object) +{ + context->setStrokeThickness(SVGRenderStyle::cssPrimitiveToLength(object, style->svgStyle()->strokeWidth(), 1.0f)); + context->setLineCap(style->svgStyle()->capStyle()); + context->setLineJoin(style->svgStyle()->joinStyle()); + if (style->svgStyle()->joinStyle() == MiterJoin) + context->setMiterLimit(style->svgStyle()->strokeMiterLimit()); + + const DashArray& dashes = dashArrayFromRenderingStyle(object->style(), object->document()->documentElement()->renderStyle()); + float dashOffset = SVGRenderStyle::cssPrimitiveToLength(object, style->svgStyle()->strokeDashOffset(), 0.0f); + if (dashes.isEmpty()) + context->setStrokeStyle(SolidStroke); + else + context->setLineDash(dashes, dashOffset); +} + const RenderObject* findTextRootObject(const RenderObject* start) { while (start && !start->isSVGText()) diff --git a/WebCore/rendering/SVGRenderSupport.h b/WebCore/rendering/SVGRenderSupport.h index 4b59b71..b8a014a 100644 --- a/WebCore/rendering/SVGRenderSupport.h +++ b/WebCore/rendering/SVGRenderSupport.h @@ -25,6 +25,7 @@ #define SVGRenderBase_h #if ENABLE(SVG) +#include "DashArray.h" #include "RenderObject.h" #include "SVGElement.h" #include "SVGStyledElement.h" @@ -42,8 +43,6 @@ class SVGRenderBase { public: virtual ~SVGRenderBase(); - virtual const SVGRenderBase* toSVGRenderBase() const { return this; } - // FIXME: These are only public for SVGRootInlineBox. // It's unclear if these should be exposed or not. SVGRootInlineBox may // pass the wrong RenderObject* and boundingBox to these functions. @@ -56,8 +55,8 @@ public: // Helper function determining wheter overflow is hidden static bool isOverflowHidden(const RenderObject*); + // strokeBoundingBox() includes the marker boundaries for a RenderPath object virtual FloatRect strokeBoundingBox() const { return FloatRect(); } - virtual FloatRect markerBoundingBox() const { return FloatRect(); } // returns the bounding box of filter, clipper, marker and masker (or the empty rect if no filter) in local coordinates FloatRect filterBoundingBoxForRenderer(const RenderObject*) const; @@ -85,7 +84,11 @@ void renderSubtreeToImage(ImageBuffer*, RenderObject*); void deregisterFromResources(RenderObject*); void clampImageBufferSizeToViewport(FrameView*, IntSize& imageBufferSize); +void applyStrokeStyleToContext(GraphicsContext*, const RenderStyle*, const RenderObject*); +DashArray dashArrayFromRenderingStyle(const RenderStyle* style, RenderStyle* rootStyle); + const RenderObject* findTextRootObject(const RenderObject* start); + } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/rendering/SVGRenderTreeAsText.cpp b/WebCore/rendering/SVGRenderTreeAsText.cpp index 0f1f15d..f6fbae2 100644 --- a/WebCore/rendering/SVGRenderTreeAsText.cpp +++ b/WebCore/rendering/SVGRenderTreeAsText.cpp @@ -34,26 +34,37 @@ #include "GraphicsTypes.h" #include "HTMLNames.h" #include "InlineTextBox.h" +#include "LinearGradientAttributes.h" #include "NodeRenderStyle.h" #include "Path.h" +#include "PatternAttributes.h" +#include "RadialGradientAttributes.h" #include "RenderImage.h" #include "RenderPath.h" #include "RenderSVGContainer.h" +#include "RenderSVGGradientStop.h" #include "RenderSVGInlineText.h" #include "RenderSVGResourceClipper.h" #include "RenderSVGResourceFilter.h" +#include "RenderSVGResourceGradient.h" +#include "RenderSVGResourceLinearGradient.h" #include "RenderSVGResourceMarker.h" #include "RenderSVGResourceMasker.h" +#include "RenderSVGResourcePattern.h" +#include "RenderSVGResourceRadialGradient.h" +#include "RenderSVGResourceSolidColor.h" #include "RenderSVGRoot.h" #include "RenderSVGText.h" #include "RenderTreeAsText.h" #include "SVGCharacterLayoutInfo.h" #include "SVGInlineTextBox.h" -#include "SVGPaintServerGradient.h" -#include "SVGPaintServerPattern.h" -#include "SVGPaintServerSolid.h" +#include "SVGLinearGradientElement.h" +#include "SVGPatternElement.h" +#include "SVGRadialGradientElement.h" #include "SVGRootInlineBox.h" +#include "SVGStopElement.h" #include "SVGStyledElement.h" + #include <math.h> namespace WebCore { @@ -307,6 +318,47 @@ static TextStream& operator<<(TextStream& ts, LineJoin style) return ts; } +// FIXME: Maybe this should be in Gradient.cpp +static TextStream& operator<<(TextStream& ts, GradientSpreadMethod mode) +{ + switch (mode) { + case SpreadMethodPad: + ts << "PAD"; + break; + case SpreadMethodRepeat: + ts << "REPEAT"; + break; + case SpreadMethodReflect: + ts << "REFLECT"; + break; + } + + return ts; +} + +static void writeSVGPaintingResource(TextStream& ts, RenderSVGResource* resource) +{ + if (resource->resourceType() == SolidColorResourceType) { + ts << "[type=SOLID] [color=" << static_cast<RenderSVGResourceSolidColor*>(resource)->color() << "]"; + return; + } + + // All other resources derive from RenderSVGResourceContainer + RenderSVGResourceContainer* container = static_cast<RenderSVGResourceContainer*>(resource); + Node* node = container->node(); + ASSERT(node); + ASSERT(node->isSVGElement()); + + if (resource->resourceType() == PatternResourceType) + ts << "[type=PATTERN]"; + else if (resource->resourceType() == LinearGradientResourceType) + ts << "[type=LINEAR-GRADIENT]"; + else if (resource->resourceType() == RadialGradientResourceType) + ts << "[type=RADIAL-GRADIENT]"; + + ts << " [id=\"" << static_cast<SVGElement*>(node)->getIDAttribute() << "\"]"; +} + static void writeStyle(TextStream& ts, const RenderObject& object) { const RenderStyle* style = object.style(); @@ -318,12 +370,11 @@ static void writeStyle(TextStream& ts, const RenderObject& object) writeIfNotDefault(ts, "opacity", style->opacity(), RenderStyle::initialOpacity()); if (object.isRenderPath()) { const RenderPath& path = static_cast<const RenderPath&>(object); - SVGPaintServer* strokePaintServer = SVGPaintServer::strokePaintServer(style, &path); - if (strokePaintServer) { + + if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(&path, path.style())) { TextStreamSeparator s(" "); - ts << " [stroke={"; - if (strokePaintServer) - ts << s << *strokePaintServer; + ts << " [stroke={" << s; + writeSVGPaintingResource(ts, strokePaintingResource); double dashOffset = SVGRenderStyle::cssPrimitiveToLength(&path, svgStyle->strokeDashOffset(), 0.0f); const DashArray& dashArray = dashArrayFromRenderingStyle(style, object.document()->documentElement()->renderStyle()); @@ -340,12 +391,11 @@ static void writeStyle(TextStream& ts, const RenderObject& object) ts << "}]"; } - SVGPaintServer* fillPaintServer = SVGPaintServer::fillPaintServer(style, &path); - if (fillPaintServer) { + + if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(&path, path.style())) { TextStreamSeparator s(" "); - ts << " [fill={"; - if (fillPaintServer) - ts << s << *fillPaintServer; + ts << " [fill={" << s; + writeSVGPaintingResource(ts, fillPaintingResource); writeIfNotDefault(ts, "opacity", svgStyle->fillOpacity(), 1.0f); writeIfNotDefault(ts, "fill rule", svgStyle->fillRule(), RULE_NONZERO); @@ -515,7 +565,23 @@ static void writeChildren(TextStream& ts, const RenderObject& object, int indent write(ts, *child, indent + 1); } -void writeSVGResource(TextStream& ts, const RenderObject& object, int indent) +static inline String boundingBoxModeString(bool boundingBoxMode) +{ + return boundingBoxMode ? "objectBoundingBox" : "userSpaceOnUse"; +} + +static inline void writeCommonGradientProperties(TextStream& ts, GradientSpreadMethod spreadMethod, const AffineTransform& gradientTransform, bool boundingBoxMode) +{ + writeNameValuePair(ts, "gradientUnits", boundingBoxModeString(boundingBoxMode)); + + if (spreadMethod != SpreadMethodPad) + ts << " [spreadMethod=" << spreadMethod << "]"; + + if (!gradientTransform.isIdentity()) + ts << " [gradientTransform=" << gradientTransform << "]"; +} + +void writeSVGResourceContainer(TextStream& ts, const RenderObject& object, int indent) { writeStandardPrefix(ts, object, indent); @@ -523,16 +589,16 @@ void writeSVGResource(TextStream& ts, const RenderObject& object, int indent) const AtomicString& id = element->getIDAttribute(); writeNameAndQuotedValue(ts, "id", id); - RenderSVGResource* resource = const_cast<RenderObject&>(object).toRenderSVGResource(); + RenderSVGResourceContainer* resource = const_cast<RenderObject&>(object).toRenderSVGResourceContainer(); + ASSERT(resource); + if (resource->resourceType() == MaskerResourceType) { RenderSVGResourceMasker* masker = static_cast<RenderSVGResourceMasker*>(resource); - ASSERT(masker); writeNameValuePair(ts, "maskUnits", masker->maskUnits()); writeNameValuePair(ts, "maskContentUnits", masker->maskContentUnits()); #if ENABLE(FILTERS) } else if (resource->resourceType() == FilterResourceType) { RenderSVGResourceFilter* filter = static_cast<RenderSVGResourceFilter*>(resource); - ASSERT(filter); writeNameValuePair(ts, "filterUnits", filter->filterUnits()); writeNameValuePair(ts, "primitiveUnits", filter->primitiveUnits()); if (OwnPtr<SVGFilterBuilder> builder = filter->buildPrimitives()) { @@ -558,11 +624,9 @@ void writeSVGResource(TextStream& ts, const RenderObject& object, int indent) #endif } else if (resource->resourceType() == ClipperResourceType) { RenderSVGResourceClipper* clipper = static_cast<RenderSVGResourceClipper*>(resource); - ASSERT(clipper); writeNameValuePair(ts, "clipPathUnits", clipper->clipPathUnits()); } else if (resource->resourceType() == MarkerResourceType) { RenderSVGResourceMarker* marker = static_cast<RenderSVGResourceMarker*>(resource); - ASSERT(marker); writeNameValuePair(ts, "markerUnits", marker->markerUnits()); ts << " [ref at " << marker->referencePoint() << "]"; ts << " [angle="; @@ -570,6 +634,49 @@ void writeSVGResource(TextStream& ts, const RenderObject& object, int indent) ts << "auto" << "]"; else ts << marker->angle() << "]"; + } else if (resource->resourceType() == PatternResourceType) { + RenderSVGResourcePattern* pattern = static_cast<RenderSVGResourcePattern*>(resource); + + // Dump final results that are used for rendering. No use in asking SVGPatternElement for its patternUnits(), as it may + // link to other patterns using xlink:href, we need to build the full inheritance chain, aka. collectPatternProperties() + PatternAttributes attributes = static_cast<SVGPatternElement*>(pattern->node())->collectPatternProperties(); + writeNameValuePair(ts, "patternUnits", boundingBoxModeString(attributes.boundingBoxMode())); + writeNameValuePair(ts, "patternContentUnits", boundingBoxModeString(attributes.boundingBoxModeContent())); + + AffineTransform transform = attributes.patternTransform(); + if (!transform.isIdentity()) + ts << " [patternTransform=" << transform << "]"; + } else if (resource->resourceType() == LinearGradientResourceType) { + RenderSVGResourceLinearGradient* gradient = static_cast<RenderSVGResourceLinearGradient*>(resource); + + // Dump final results that are used for rendering. No use in asking SVGGradientElement for its gradientUnits(), as it may + // link to other gradients using xlink:href, we need to build the full inheritance chain, aka. collectGradientProperties() + SVGLinearGradientElement* linearGradientElement = static_cast<SVGLinearGradientElement*>(gradient->node()); + + LinearGradientAttributes attributes = linearGradientElement->collectGradientProperties(); + writeCommonGradientProperties(ts, attributes.spreadMethod(), attributes.gradientTransform(), attributes.boundingBoxMode()); + + FloatPoint startPoint; + FloatPoint endPoint; + linearGradientElement->calculateStartEndPoints(attributes, startPoint, endPoint); + + ts << " [start=" << startPoint << "] [end=" << endPoint << "]"; + } else if (resource->resourceType() == RadialGradientResourceType) { + RenderSVGResourceRadialGradient* gradient = static_cast<RenderSVGResourceRadialGradient*>(resource); + + // Dump final results that are used for rendering. No use in asking SVGGradientElement for its gradientUnits(), as it may + // link to other gradients using xlink:href, we need to build the full inheritance chain, aka. collectGradientProperties() + SVGRadialGradientElement* radialGradientElement = static_cast<SVGRadialGradientElement*>(gradient->node()); + + RadialGradientAttributes attributes = radialGradientElement->collectGradientProperties(); + writeCommonGradientProperties(ts, attributes.spreadMethod(), attributes.gradientTransform(), attributes.boundingBoxMode()); + + FloatPoint focalPoint; + FloatPoint centerPoint; + float radius; + radialGradientElement->calculateFocalCenterPointsAndRadius(attributes, focalPoint, centerPoint, radius); + + ts << " [center=" << centerPoint << "] [focal=" << focalPoint << "] [radius=" << radius << "]"; } ts << "\n"; @@ -626,6 +733,20 @@ void write(TextStream& ts, const RenderPath& path, int indent) writeResources(ts, path, indent); } +void writeSVGGradientStop(TextStream& ts, const RenderSVGGradientStop& stop, int indent) +{ + writeStandardPrefix(ts, stop, indent); + + SVGStopElement* stopElement = static_cast<SVGStopElement*>(stop.node()); + ASSERT(stopElement); + + RenderStyle* style = stop.style(); + if (!style) + return; + + ts << " [offset=" << stopElement->offset() << "] [color=" << stopElement->stopColorIncludingOpacity() << "]\n"; +} + void writeResources(TextStream& ts, const RenderObject& object, int indent) { const RenderStyle* style = object.style(); @@ -665,31 +786,6 @@ void writeResources(TextStream& ts, const RenderObject& object, int indent) #endif } -void writeRenderResources(TextStream& ts, Node* parent) -{ - ASSERT(parent); - Node* node = parent; - do { - if (!node->isSVGElement()) - continue; - SVGElement* svgElement = static_cast<SVGElement*>(node); - if (!svgElement->isStyled()) - continue; - - SVGStyledElement* styled = static_cast<SVGStyledElement*>(svgElement); - RefPtr<SVGResource> resource(styled->canvasResource(node->renderer())); - if (!resource) - continue; - - String elementId = svgElement->getAttribute(svgElement->idAttributeName()); - // FIXME: These names are lies! - if (resource->isPaintServer()) { - RefPtr<SVGPaintServer> paintServer = WTF::static_pointer_cast<SVGPaintServer>(resource); - ts << "KRenderingPaintServer {id=\"" << elementId << "\" " << *paintServer << "}" << "\n"; - } - } while ((node = node->traverseNextNode(parent))); -} - } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/rendering/SVGRenderTreeAsText.h b/WebCore/rendering/SVGRenderTreeAsText.h index 905652b..0fda958 100644 --- a/WebCore/rendering/SVGRenderTreeAsText.h +++ b/WebCore/rendering/SVGRenderTreeAsText.h @@ -43,6 +43,7 @@ namespace WebCore { class RenderImage; class RenderObject; class RenderPath; + class RenderSVGGradientStop; class RenderSVGRoot; class RenderText; class AffineTransform; @@ -51,15 +52,14 @@ namespace WebCore { // functions used by the main RenderTreeAsText code void write(TextStream&, const RenderPath&, int indent); void write(TextStream&, const RenderSVGRoot&, int indent); -void writeSVGResource(TextStream&, const RenderObject&, int indent); +void writeSVGGradientStop(TextStream&, const RenderSVGGradientStop&, int indent); +void writeSVGResourceContainer(TextStream&, const RenderObject&, int indent); void writeSVGContainer(TextStream&, const RenderObject&, int indent); void writeSVGImage(TextStream&, const RenderImage&, int indent); void writeSVGInlineText(TextStream&, const RenderText&, int indent); void writeSVGText(TextStream&, const RenderBlock&, int indent); void writeResources(TextStream&, const RenderObject&, int indent); -void writeRenderResources(TextStream&, Node* parent); - // helper operators defined used in various classes to dump the render tree. TextStream& operator<<(TextStream&, const AffineTransform&); TextStream& operator<<(TextStream&, const IntRect&); diff --git a/WebCore/rendering/SVGRootInlineBox.cpp b/WebCore/rendering/SVGRootInlineBox.cpp index 89b4375..6c99b1a 100644 --- a/WebCore/rendering/SVGRootInlineBox.cpp +++ b/WebCore/rendering/SVGRootInlineBox.cpp @@ -4,6 +4,7 @@ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> * (C) 2006 Apple Computer Inc. * (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) Research In Motion Limited 2010. 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 @@ -32,12 +33,12 @@ #include "Frame.h" #include "GraphicsContext.h" #include "RenderBlock.h" +#include "RenderSVGResource.h" #include "RenderSVGResourceFilter.h" #include "RenderSVGRoot.h" #include "SVGInlineFlowBox.h" #include "SVGInlineTextBox.h" #include "SVGFontElement.h" -#include "SVGPaintServer.h" #include "SVGRenderStyleDefs.h" #include "SVGRenderSupport.h" #include "SVGTextPositioningElement.h" @@ -319,7 +320,7 @@ FloatPoint topLeftPositionOfCharacterRange(Vector<SVGChar>::iterator it, Vector< } // Helper function -static float calculateKerning(RenderObject* item) +static float calculateCSSKerning(RenderObject* item) { const Font& font = item->style()->font(); const SVGRenderStyle* svgStyle = item->style()->svgStyle(); @@ -335,6 +336,40 @@ static float calculateKerning(RenderObject* item) return kerning; } +static bool applySVGKerning(SVGCharacterLayoutInfo& info, RenderObject* item, LastGlyphInfo& lastGlyph, const String& unicodeString, const String& glyphName) +{ +#if ENABLE(SVG_FONTS) + float kerning = 0.0f; + const RenderStyle* style = item->style(); + SVGFontElement* svgFont = 0; + if (style->font().isSVGFont()) + svgFont = style->font().svgFont(); + + if (lastGlyph.isValid && style->font().isSVGFont()) + kerning = svgFont->getHorizontalKerningPairForStringsAndGlyphs(lastGlyph.unicode, lastGlyph.glyphName, unicodeString, glyphName); + + if (style->font().isSVGFont()) { + lastGlyph.unicode = unicodeString; + lastGlyph.glyphName = glyphName; + lastGlyph.isValid = true; + kerning *= style->font().size() / style->font().primaryFont()->unitsPerEm(); + } else + lastGlyph.isValid = false; + + if (kerning != 0.0f) { + info.curx -= kerning; + return true; + } +#else + UNUSED_PARAM(info); + UNUSED_PARAM(item); + UNUSED_PARAM(lastGlyph); + UNUSED_PARAM(unicodeString); + UNUSED_PARAM(glyphName); +#endif + return false; +} + // Helper class for paint() struct SVGRootInlineBoxPaintWalker { SVGRootInlineBoxPaintWalker(SVGRootInlineBox* rootBox, RenderSVGResourceFilter* rootFilter, RenderObject::PaintInfo paintInfo, int tx, int ty) @@ -345,10 +380,10 @@ struct SVGRootInlineBoxPaintWalker { , m_boundingBox(tx + rootBox->x(), ty + rootBox->y(), rootBox->width(), rootBox->height()) , m_filter(0) , m_rootFilter(rootFilter) - , m_fillPaintServer(0) - , m_strokePaintServer(0) - , m_fillPaintServerObject(0) - , m_strokePaintServerObject(0) + , m_fillPaintingResource(0) + , m_strokePaintingResource(0) + , m_fillPaintingResourceObject(0) + , m_strokePaintingResourceObject(0) , m_tx(tx) , m_ty(ty) { @@ -357,10 +392,10 @@ struct SVGRootInlineBoxPaintWalker { ~SVGRootInlineBoxPaintWalker() { ASSERT(!m_filter); - ASSERT(!m_fillPaintServer); - ASSERT(!m_fillPaintServerObject); - ASSERT(!m_strokePaintServer); - ASSERT(!m_strokePaintServerObject); + ASSERT(!m_fillPaintingResource); + ASSERT(!m_fillPaintingResourceObject); + ASSERT(!m_strokePaintingResource); + ASSERT(!m_strokePaintingResourceObject); ASSERT(!m_chunkStarted); } @@ -373,24 +408,22 @@ struct SVGRootInlineBoxPaintWalker { void teardownFillPaintServer() { - if (!m_fillPaintServer) + if (!m_fillPaintingResource) return; - m_fillPaintServer->teardown(m_paintInfo.context, m_fillPaintServerObject, ApplyToFillTargetType, true); - - m_fillPaintServer = 0; - m_fillPaintServerObject = 0; + m_fillPaintingResource->postApplyResource(m_fillPaintingResourceObject, m_paintInfo.context, ApplyToFillMode | ApplyToTextMode); + m_fillPaintingResource = 0; + m_fillPaintingResourceObject = 0; } void teardownStrokePaintServer() { - if (!m_strokePaintServer) + if (!m_strokePaintingResource) return; - m_strokePaintServer->teardown(m_paintInfo.context, m_strokePaintServerObject, ApplyToStrokeTargetType, true); - - m_strokePaintServer = 0; - m_strokePaintServerObject = 0; + m_strokePaintingResource->postApplyResource(m_strokePaintingResourceObject, m_paintInfo.context, ApplyToStrokeMode | ApplyToTextMode); + m_strokePaintingResource = 0; + m_strokePaintingResourceObject = 0; } void chunkStartCallback(InlineBox* box) @@ -437,7 +470,7 @@ struct SVGRootInlineBoxPaintWalker { m_paintInfo.rect = m_savedInfo.rect; } - bool setupBackground(SVGInlineTextBox* /*box*/) + bool setupBackground(SVGInlineTextBox*) { m_textPaintInfo.subphase = SVGTextPaintSubphaseBackground; return true; @@ -451,14 +484,14 @@ struct SVGRootInlineBoxPaintWalker { RenderObject* object = flowBox->renderer(); ASSERT(object); - ASSERT(!m_strokePaintServer); + ASSERT(!m_strokePaintingResource); teardownFillPaintServer(); m_textPaintInfo.subphase = SVGTextPaintSubphaseGlyphFill; - m_fillPaintServer = SVGPaintServer::fillPaintServer(object->style(), object); - if (m_fillPaintServer) { - m_fillPaintServer->setup(m_paintInfo.context, object, ApplyToFillTargetType, true); - m_fillPaintServerObject = object; + m_fillPaintingResource = RenderSVGResource::fillPaintingResource(object, object->style()); + if (m_fillPaintingResource) { + m_fillPaintingResource->applyResource(object, object->style(), m_paintInfo.context, ApplyToFillMode | ApplyToTextMode); + m_fillPaintingResourceObject = object; return true; } @@ -476,17 +509,17 @@ struct SVGRootInlineBoxPaintWalker { if (!style) style = object->style(); - ASSERT(!m_strokePaintServer); + ASSERT(!m_strokePaintingResource); teardownFillPaintServer(); if (!mayHaveSelection(box)) return false; m_textPaintInfo.subphase = SVGTextPaintSubphaseGlyphFillSelection; - m_fillPaintServer = SVGPaintServer::fillPaintServer(style, object); - if (m_fillPaintServer) { - m_fillPaintServer->setup(m_paintInfo.context, object, style, ApplyToFillTargetType, true); - m_fillPaintServerObject = object; + m_fillPaintingResource = RenderSVGResource::fillPaintingResource(object, style); + if (m_fillPaintingResource) { + m_fillPaintingResource->applyResource(object, style, m_paintInfo.context, ApplyToFillMode | ApplyToTextMode); + m_fillPaintingResourceObject = object; return true; } @@ -506,11 +539,10 @@ struct SVGRootInlineBoxPaintWalker { teardownStrokePaintServer(); m_textPaintInfo.subphase = SVGTextPaintSubphaseGlyphStroke; - m_strokePaintServer = SVGPaintServer::strokePaintServer(object->style(), object); - - if (m_strokePaintServer) { - m_strokePaintServer->setup(m_paintInfo.context, object, ApplyToStrokeTargetType, true); - m_strokePaintServerObject = object; + m_strokePaintingResource = RenderSVGResource::strokePaintingResource(object, object->style()); + if (m_strokePaintingResource) { + m_strokePaintingResource->applyResource(object, object->style(), m_paintInfo.context, ApplyToStrokeMode | ApplyToTextMode); + m_strokePaintingResourceObject = object; return true; } @@ -536,17 +568,17 @@ struct SVGRootInlineBoxPaintWalker { return false; m_textPaintInfo.subphase = SVGTextPaintSubphaseGlyphStrokeSelection; - m_strokePaintServer = SVGPaintServer::strokePaintServer(style, object); - if (m_strokePaintServer) { - m_strokePaintServer->setup(m_paintInfo.context, object, style, ApplyToStrokeTargetType, true); - m_strokePaintServerObject = object; + m_strokePaintingResource = RenderSVGResource::strokePaintingResource(object, style); + if (m_strokePaintingResource) { + m_strokePaintingResource->applyResource(object, style, m_paintInfo.context, ApplyToStrokeMode | ApplyToTextMode); + m_strokePaintingResourceObject = object; return true; } return false; } - bool setupForeground(SVGInlineTextBox* /*box*/) + bool setupForeground(SVGInlineTextBox*) { teardownFillPaintServer(); teardownStrokePaintServer(); @@ -556,17 +588,17 @@ struct SVGRootInlineBoxPaintWalker { return true; } - SVGPaintServer* activePaintServer() const + RenderSVGResource* activePaintingResource() const { switch (m_textPaintInfo.subphase) { case SVGTextPaintSubphaseGlyphFill: case SVGTextPaintSubphaseGlyphFillSelection: - ASSERT(m_fillPaintServer); - return m_fillPaintServer; + ASSERT(m_fillPaintingResource); + return m_fillPaintingResource; case SVGTextPaintSubphaseGlyphStroke: case SVGTextPaintSubphaseGlyphStrokeSelection: - ASSERT(m_strokePaintServer); - return m_strokePaintServer; + ASSERT(m_strokePaintingResource); + return m_strokePaintingResource; case SVGTextPaintSubphaseBackground: case SVGTextPaintSubphaseForeground: default: @@ -646,7 +678,7 @@ struct SVGRootInlineBoxPaintWalker { textBox->paintDecoration(OVERLINE, m_paintInfo.context, decorationOrigin.x(), decorationOrigin.y(), textWidth, *it, info); // Paint text - m_textPaintInfo.activePaintServer = activePaintServer(); + m_textPaintInfo.activePaintingResource = activePaintingResource(); textBox->paintCharacters(m_paintInfo, m_tx, m_ty, *it, stringStart, stringLength, m_textPaintInfo); // Paint decorations, that have to be drawn afterwards @@ -672,11 +704,11 @@ private: RenderSVGResourceFilter* m_filter; RenderSVGResourceFilter* m_rootFilter; - SVGPaintServer* m_fillPaintServer; - SVGPaintServer* m_strokePaintServer; + RenderSVGResource* m_fillPaintingResource; + RenderSVGResource* m_strokePaintingResource; - RenderObject* m_fillPaintServerObject; - RenderObject* m_strokePaintServerObject; + RenderObject* m_fillPaintingResourceObject; + RenderObject* m_strokePaintingResourceObject; int m_tx; int m_ty; @@ -1296,7 +1328,7 @@ void SVGRootInlineBox::buildLayoutInformationForTextBox(SVGCharacterLayoutInfo& } // Take letter & word spacing and kerning into account - float spacing = font.letterSpacing() + calculateKerning(textBox->renderer()->node()->renderer()); + float spacing = font.letterSpacing() + calculateCSSKerning(textBox->renderer()->node()->renderer()); const UChar* currentCharacter = text->characters() + (textBox->direction() == RTL ? textBox->end() - i : textBox->start() + i); const UChar* lastCharacter = 0; @@ -1309,7 +1341,9 @@ void SVGRootInlineBox::buildLayoutInformationForTextBox(SVGCharacterLayoutInfo& lastCharacter = text->characters() + textBox->start() + i - 1; } - if (info.nextDrawnSeperated || spacing != 0.0f) { + // FIXME: SVG Kerning doesn't get applied on texts on path. + bool appliedSVGKerning = applySVGKerning(info, textBox->renderer()->node()->renderer(), lastGlyph, unicodeStr, glyphName); + if (info.nextDrawnSeperated || spacing != 0.0f || appliedSVGKerning) { info.nextDrawnSeperated = false; svgChar.drawnSeperated = true; } @@ -1414,35 +1448,12 @@ void SVGRootInlineBox::buildLayoutInformationForTextBox(SVGCharacterLayoutInfo& } } - float kerning = 0.0f; -#if ENABLE(SVG_FONTS) - SVGFontElement* svgFont = 0; - if (style->font().isSVGFont()) - svgFont = style->font().svgFont(); - - if (lastGlyph.isValid && style->font().isSVGFont()) { - SVGHorizontalKerningPair kerningPair; - if (svgFont->getHorizontalKerningPairForStringsAndGlyphs(lastGlyph.unicode, lastGlyph.glyphName, unicodeStr, glyphName, kerningPair)) - kerning = narrowPrecisionToFloat(kerningPair.kerning); - } - - if (style->font().isSVGFont()) { - lastGlyph.unicode = unicodeStr; - lastGlyph.glyphName = glyphName; - lastGlyph.isValid = true; - kerning *= style->font().size() / style->font().primaryFont()->unitsPerEm(); - } else - lastGlyph.isValid = false; -#endif - - svgChar.x -= kerning; - // Advance to new position if (isVerticalText) { svgChar.drawnSeperated = true; info.cury += glyphAdvance + spacing; } else - info.curx += glyphAdvance + spacing - kerning; + info.curx += glyphAdvance + spacing; // Advance to next character group for (int k = 0; k < charsConsumed; ++k) { diff --git a/WebCore/rendering/SVGRootInlineBox.h b/WebCore/rendering/SVGRootInlineBox.h index 7b1dcc4..73c88a1 100644 --- a/WebCore/rendering/SVGRootInlineBox.h +++ b/WebCore/rendering/SVGRootInlineBox.h @@ -27,7 +27,9 @@ #if ENABLE(SVG) #include "RootInlineBox.h" +#include "SVGCharacterData.h" #include "SVGCharacterLayoutInfo.h" +#include "SVGTextChunkLayoutInfo.h" #include "SVGRenderSupport.h" namespace WebCore { @@ -51,7 +53,6 @@ public: , m_height(0) { } - virtual const SVGRenderBase* toSVGRenderBase() const { return this; } virtual bool isSVGRootInlineBox() { return true; } diff --git a/WebCore/rendering/SVGShadowTreeElements.cpp b/WebCore/rendering/SVGShadowTreeElements.cpp index d9ce640..f26f87e 100644 --- a/WebCore/rendering/SVGShadowTreeElements.cpp +++ b/WebCore/rendering/SVGShadowTreeElements.cpp @@ -49,7 +49,7 @@ SVGShadowTreeRootElement::SVGShadowTreeRootElement(Document* document, Node* sha : SVGShadowTreeContainerElement(document) , m_shadowParent(shadowParent) { - setInDocument(true); + setInDocument(); } SVGShadowTreeRootElement::~SVGShadowTreeRootElement() diff --git a/WebCore/rendering/SVGTextChunkLayoutInfo.h b/WebCore/rendering/SVGTextChunkLayoutInfo.h new file mode 100644 index 0000000..524c983 --- /dev/null +++ b/WebCore/rendering/SVGTextChunkLayoutInfo.h @@ -0,0 +1,178 @@ +/* + * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) Research In Motion Limited 2010. 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 SVGTextChunkLayoutInfo_h +#define SVGTextChunkLayoutInfo_h + +#if ENABLE(SVG) +#include "AffineTransform.h" +#include "SVGTextContentElement.h" + +#include <wtf/Assertions.h> +#include <wtf/Vector.h> + +namespace WebCore { + +class InlineBox; +class SVGInlineTextBox; + +struct SVGInlineBoxCharacterRange { + SVGInlineBoxCharacterRange() + : startOffset(INT_MIN) + , endOffset(INT_MIN) + , box(0) + { + } + + bool isOpen() const { return (startOffset == endOffset) && (endOffset == INT_MIN); } + bool isClosed() const { return startOffset != INT_MIN && endOffset != INT_MIN; } + + int startOffset; + int endOffset; + + InlineBox* box; +}; + +struct SVGChar; + +// Convenience typedef +typedef SVGTextContentElement::SVGLengthAdjustType ELengthAdjust; + +struct SVGTextChunk { + SVGTextChunk() + : anchor(TA_START) + , textLength(0.0f) + , lengthAdjust(SVGTextContentElement::LENGTHADJUST_SPACING) + , ctm() + , isVerticalText(false) + , isTextPath(false) + , start(0) + , end(0) + { } + + // text-anchor support + ETextAnchor anchor; + + // textLength & lengthAdjust support + float textLength; + ELengthAdjust lengthAdjust; + AffineTransform ctm; + + // status flags + bool isVerticalText : 1; + bool isTextPath : 1; + + // main chunk data + Vector<SVGChar>::iterator start; + Vector<SVGChar>::iterator end; + + Vector<SVGInlineBoxCharacterRange> boxes; +}; + +struct SVGTextChunkWalkerBase { + virtual ~SVGTextChunkWalkerBase() { } + + virtual void operator()(SVGInlineTextBox* textBox, int startOffset, const AffineTransform& chunkCtm, + const Vector<SVGChar>::iterator& start, const Vector<SVGChar>::iterator& end) = 0; + + // Followings methods are only used for painting text chunks + virtual void start(InlineBox*) = 0; + virtual void end(InlineBox*) = 0; +}; + +template<typename CallbackClass> +struct SVGTextChunkWalker : public SVGTextChunkWalkerBase { +public: + typedef void (CallbackClass::*SVGTextChunkWalkerCallback)(SVGInlineTextBox* textBox, + int startOffset, + const AffineTransform& chunkCtm, + const Vector<SVGChar>::iterator& start, + const Vector<SVGChar>::iterator& end); + + // These callbacks are only used for painting! + typedef void (CallbackClass::*SVGTextChunkStartCallback)(InlineBox* box); + typedef void (CallbackClass::*SVGTextChunkEndCallback)(InlineBox* box); + + SVGTextChunkWalker(CallbackClass* object, + SVGTextChunkWalkerCallback walker, + SVGTextChunkStartCallback start = 0, + SVGTextChunkEndCallback end = 0) + : m_object(object) + , m_walkerCallback(walker) + , m_startCallback(start) + , m_endCallback(end) + { + ASSERT(object); + ASSERT(walker); + } + + virtual void operator()(SVGInlineTextBox* textBox, int startOffset, const AffineTransform& chunkCtm, + const Vector<SVGChar>::iterator& start, const Vector<SVGChar>::iterator& end) + { + (*m_object.*m_walkerCallback)(textBox, startOffset, chunkCtm, start, end); + } + + // Followings methods are only used for painting text chunks + virtual void start(InlineBox* box) + { + if (m_startCallback) + (*m_object.*m_startCallback)(box); + else + ASSERT_NOT_REACHED(); + } + + virtual void end(InlineBox* box) + { + if (m_endCallback) + (*m_object.*m_endCallback)(box); + else + ASSERT_NOT_REACHED(); + } + +private: + CallbackClass* m_object; + SVGTextChunkWalkerCallback m_walkerCallback; + SVGTextChunkStartCallback m_startCallback; + SVGTextChunkEndCallback m_endCallback; +}; + +struct SVGTextChunkLayoutInfo { + SVGTextChunkLayoutInfo(Vector<SVGTextChunk>& textChunks) + : assignChunkProperties(true) + , handlingTextPath(false) + , svgTextChunks(textChunks) + , it(0) + { + } + + bool assignChunkProperties : 1; + bool handlingTextPath : 1; + + Vector<SVGTextChunk>& svgTextChunks; + Vector<SVGChar>::iterator it; + + SVGTextChunk chunk; +}; + +} // namespace WebCore + +#endif // ENABLE(SVG) +#endif // SVGTextChunkLayoutInfo_h diff --git a/WebCore/rendering/TextControlInnerElements.cpp b/WebCore/rendering/TextControlInnerElements.cpp index 4cd55c5..84f7c0f 100644 --- a/WebCore/rendering/TextControlInnerElements.cpp +++ b/WebCore/rendering/TextControlInnerElements.cpp @@ -96,7 +96,7 @@ void TextControlInnerElement::attachInnerElement(Node* parent, PassRefPtr<Render // Set these explicitly since this normally happens during an attach() setAttached(); - setInDocument(true); + setInDocument(); // For elements without a shadow parent, add the node to the DOM normally. if (!m_shadowParent) @@ -116,16 +116,9 @@ void TextControlInnerTextElement::defaultEventHandler(Event* evt) { // FIXME: In the future, we should add a way to have default event listeners. Then we would add one to the text field's inner div, and we wouldn't need this subclass. Node* shadowAncestor = shadowAncestorNode(); - if (shadowAncestor && shadowAncestor->renderer()) { - ASSERT(shadowAncestor->renderer()->isTextControl()); - if (evt->isBeforeTextInsertedEvent()) { - if (shadowAncestor->renderer()->isTextField()) - static_cast<HTMLInputElement*>(shadowAncestor)->defaultEventHandler(evt); - else - static_cast<HTMLTextAreaElement*>(shadowAncestor)->defaultEventHandler(evt); - } - if (evt->type() == eventNames().webkitEditableContentChangedEvent) - toRenderTextControl(shadowAncestor->renderer())->subtreeHasChanged(); + if (shadowAncestor) { + if (evt->isBeforeTextInsertedEvent() || evt->type() == eventNames().webkitEditableContentChangedEvent) + shadowAncestor->defaultEventHandler(evt); } if (!evt->defaultHandled()) HTMLDivElement::defaultEventHandler(evt); @@ -211,4 +204,62 @@ void SearchFieldCancelButtonElement::defaultEventHandler(Event* evt) HTMLDivElement::defaultEventHandler(evt); } +SpinButtonElement::SpinButtonElement(Document* doc, Node* shadowParent) + : TextControlInnerElement(doc, shadowParent) + , m_capturing(false) + , m_onUpButton(false) +{ +} + +void SpinButtonElement::defaultEventHandler(Event* evt) +{ + if (!evt->isMouseEvent()) { + if (!evt->defaultHandled()) + HTMLDivElement::defaultEventHandler(evt); + return; + } + const MouseEvent* mevt = static_cast<MouseEvent*>(evt); + if (mevt->button() != LeftButton) { + if (!evt->defaultHandled()) + HTMLDivElement::defaultEventHandler(evt); + return; + } + + HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowAncestorNode()); + IntPoint local = roundedIntPoint(renderBox()->absoluteToLocal(mevt->absoluteLocation(), false, true)); + if (evt->type() == eventNames().clickEvent) { + if (renderBox()->borderBoxRect().contains(local)) { + input->focus(); + input->select(); + if (local.y() < renderBox()->y() + renderBox()->height() / 2) + input->stepUpFromRenderer(1); + else + input->stepUpFromRenderer(-1); + evt->setDefaultHandled(); + } + } else if (evt->type() == eventNames().mousemoveEvent) { + if (renderBox()->borderBoxRect().contains(local)) { + if (!m_capturing) { + if (Frame* frame = document()->frame()) { + frame->eventHandler()->setCapturingMouseEventsNode(input); + m_capturing = true; + } + } + bool oldOnUpButton = m_onUpButton; + m_onUpButton = local.y() < renderBox()->y() + renderBox()->height() / 2; + if (m_onUpButton != oldOnUpButton) + renderer()->repaint(); + } else { + if (m_capturing) { + if (Frame* frame = document()->frame()) { + frame->eventHandler()->setCapturingMouseEventsNode(0); + m_capturing = false; + } + } + } + } + if (!evt->defaultHandled()) + HTMLDivElement::defaultEventHandler(evt); +} + } diff --git a/WebCore/rendering/TextControlInnerElements.h b/WebCore/rendering/TextControlInnerElements.h index f72ddf2..f59ac96 100644 --- a/WebCore/rendering/TextControlInnerElements.h +++ b/WebCore/rendering/TextControlInnerElements.h @@ -68,6 +68,21 @@ private: bool m_capturing; }; +class SpinButtonElement : public TextControlInnerElement { +public: + SpinButtonElement(Document*, Node*); + virtual bool isSpinButtonElement() const { return true; } + virtual bool isEnabledFormControl() { return static_cast<Element*>(shadowAncestorNode())->isEnabledFormControl(); } + virtual void defaultEventHandler(Event*); + + bool onUpButton() const { return m_onUpButton; } + static const AtomicString& spinButtonNodeName(); + +private: + bool m_capturing; + bool m_onUpButton; +}; + } //namespace #endif diff --git a/WebCore/rendering/style/RenderStyle.cpp b/WebCore/rendering/style/RenderStyle.cpp index f1cf0bc..f3b3f0c 100644 --- a/WebCore/rendering/style/RenderStyle.cpp +++ b/WebCore/rendering/style/RenderStyle.cpp @@ -58,7 +58,7 @@ PassRefPtr<RenderStyle> RenderStyle::clone(const RenderStyle* other) return adoptRef(new RenderStyle(*other)); } -RenderStyle::RenderStyle() +ALWAYS_INLINE RenderStyle::RenderStyle() : m_affectedByAttributeSelectors(false) , m_unique(false) , m_affectedByEmpty(false) @@ -85,7 +85,7 @@ RenderStyle::RenderStyle() setBitDefaults(); // Would it be faster to copy this from the default style? } -RenderStyle::RenderStyle(bool) +ALWAYS_INLINE RenderStyle::RenderStyle(bool) : m_affectedByAttributeSelectors(false) , m_unique(false) , m_affectedByEmpty(false) @@ -118,7 +118,7 @@ RenderStyle::RenderStyle(bool) #endif } -RenderStyle::RenderStyle(const RenderStyle& o) +ALWAYS_INLINE RenderStyle::RenderStyle(const RenderStyle& o) : RefCounted<RenderStyle>() , m_affectedByAttributeSelectors(false) , m_unique(false) diff --git a/WebCore/rendering/style/RenderStyle.h b/WebCore/rendering/style/RenderStyle.h index fe42339..815fb30 100644 --- a/WebCore/rendering/style/RenderStyle.h +++ b/WebCore/rendering/style/RenderStyle.h @@ -302,7 +302,7 @@ protected: noninherited_flags._isLink = false; } -protected: +private: RenderStyle(); // used to create the default style. RenderStyle(bool); diff --git a/WebCore/rendering/style/RenderStyleConstants.h b/WebCore/rendering/style/RenderStyleConstants.h index b899d57..b6dce18 100644 --- a/WebCore/rendering/style/RenderStyleConstants.h +++ b/WebCore/rendering/style/RenderStyleConstants.h @@ -74,7 +74,7 @@ enum PseudoId { MEDIA_CONTROLS_SEEK_BACK_BUTTON, MEDIA_CONTROLS_SEEK_FORWARD_BUTTON, MEDIA_CONTROLS_FULLSCREEN_BUTTON, MEDIA_CONTROLS_REWIND_BUTTON, MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON, MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON, MEDIA_CONTROLS_STATUS_DISPLAY, SCROLLBAR_THUMB, SCROLLBAR_BUTTON, SCROLLBAR_TRACK, SCROLLBAR_TRACK_PIECE, SCROLLBAR_CORNER, RESIZER, - INPUT_LIST_BUTTON, INNER_SPIN_BUTTON, OUTER_SPIN_BUTTON, VISITED_LINK, + INPUT_LIST_BUTTON, INNER_SPIN_BUTTON, OUTER_SPIN_BUTTON, VISITED_LINK, PROGRESS_BAR_VALUE, AFTER_LAST_INTERNAL_PSEUDOID, FIRST_PUBLIC_PSEUDOID = FIRST_LINE, diff --git a/WebCore/rendering/style/SVGRenderStyle.h b/WebCore/rendering/style/SVGRenderStyle.h index c6d5022..3d6a7da 100644 --- a/WebCore/rendering/style/SVGRenderStyle.h +++ b/WebCore/rendering/style/SVGRenderStyle.h @@ -108,8 +108,9 @@ public: SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, inheritedResources, markerEnd, MarkerEndResource, markerEndResource, String()) // convenience - bool hasStroke() const { return (strokePaint()->paintType() != SVGPaint::SVG_PAINTTYPE_NONE); } - bool hasFill() const { return (fillPaint()->paintType() != SVGPaint::SVG_PAINTTYPE_NONE); } + bool hasMarkers() const { return !markerStartResource().isEmpty() || !markerMidResource().isEmpty() || !markerEndResource().isEmpty(); } + bool hasStroke() const { return strokePaint()->paintType() != SVGPaint::SVG_PAINTTYPE_NONE; } + bool hasFill() const { return fillPaint()->paintType() != SVGPaint::SVG_PAINTTYPE_NONE; } static float cssPrimitiveToLength(const RenderObject*, CSSValue*, float defaultValue = 0.0f); diff --git a/WebCore/rendering/style/StyleRareInheritedData.h b/WebCore/rendering/style/StyleRareInheritedData.h index 1aa7b05..8f128fd 100644 --- a/WebCore/rendering/style/StyleRareInheritedData.h +++ b/WebCore/rendering/style/StyleRareInheritedData.h @@ -32,7 +32,7 @@ namespace WebCore { -struct ShadowData; +class ShadowData; // This struct is for rarely used inherited CSS3, CSS2, and WebKit-specific properties. // By grouping them together, we save space, and only allocate this object when someone diff --git a/WebCore/rendering/style/StyleRareNonInheritedData.h b/WebCore/rendering/style/StyleRareNonInheritedData.h index 452b273..21bbe94 100644 --- a/WebCore/rendering/style/StyleRareNonInheritedData.h +++ b/WebCore/rendering/style/StyleRareNonInheritedData.h @@ -40,13 +40,14 @@ namespace WebCore { class AnimationList; class CSSStyleSelector; +class ShadowData; class StyleFlexibleBoxData; class StyleMarqueeData; class StyleMultiColData; class StyleReflection; class StyleTransformData; + struct ContentData; -struct ShadowData; #if ENABLE(DASHBOARD_SUPPORT) class StyleDashboardRegion; diff --git a/WebCore/storage/Database.cpp b/WebCore/storage/Database.cpp index cb61d48..0644df5 100644 --- a/WebCore/storage/Database.cpp +++ b/WebCore/storage/Database.cpp @@ -543,6 +543,8 @@ bool Database::performOpenAndVerify(ExceptionCode& e) e = INVALID_STATE_ERR; return false; } + if (!m_sqliteDatabase.turnOnIncrementalAutoVacuum()) + LOG_ERROR("Unable to turn on incremental auto-vacuum for database %s", m_filename.ascii().data()); ASSERT(m_databaseAuthorizer); m_sqliteDatabase.setAuthorizer(m_databaseAuthorizer); @@ -808,6 +810,14 @@ String Database::fileName() const return m_filename.threadsafeCopy(); } +void Database::incrementalVacuumIfNeeded() +{ + int64_t freeSpaceSize = m_sqliteDatabase.freeSpaceSize(); + int64_t totalSize = m_sqliteDatabase.totalSize(); + if (totalSize <= 10 * freeSpaceSize) + m_sqliteDatabase.runIncrementalVacuumCommand(); +} + #endif // ENABLE(DATABASE) } // namespace WebCore diff --git a/WebCore/storage/Database.h b/WebCore/storage/Database.h index f7b88a2..890d98c 100644 --- a/WebCore/storage/Database.h +++ b/WebCore/storage/Database.h @@ -73,7 +73,7 @@ public: ~Database(); -// Direct support for the DOM API + // Direct support for the DOM API static PassRefPtr<Database> openDatabase(ScriptExecutionContext* context, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback, @@ -85,7 +85,7 @@ public: void transaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback, PassRefPtr<VoidCallback> successCallback, bool readOnly); -// Internal engine support + // Internal engine support static const String& databaseInfoTableName(); void disableAuthorizer(); @@ -121,7 +121,7 @@ public: unsigned long long databaseSize() const; unsigned long long maximumSize() const; -// Called from DatabaseThread, must be prepared to work on the background thread + // Called from DatabaseThread, must be prepared to work on the background thread void resetAuthorizer(); void performPolicyChecks(); @@ -133,6 +133,8 @@ public: SQLTransactionClient* transactionClient() const; SQLTransactionCoordinator* transactionCoordinator() const; + void incrementalVacuumIfNeeded(); + private: Database(ScriptExecutionContext* context, const String& name, const String& expectedVersion, const String& displayName, diff --git a/WebCore/storage/DatabaseCallback.h b/WebCore/storage/DatabaseCallback.h index 2115a21..f87732f 100644 --- a/WebCore/storage/DatabaseCallback.h +++ b/WebCore/storage/DatabaseCallback.h @@ -43,7 +43,7 @@ class ScriptExecutionContext; class DatabaseCallback : public ThreadSafeShared<DatabaseCallback> { public: virtual ~DatabaseCallback() { } - virtual void handleEvent(ScriptExecutionContext*, Database*) = 0; + virtual bool handleEvent(ScriptExecutionContext*, Database*) = 0; }; } diff --git a/WebCore/bindings/js/JSCustomSQLTransactionCallback.h b/WebCore/storage/DatabaseCallback.idl index bf2ae68..7d060fe 100644 --- a/WebCore/bindings/js/JSCustomSQLTransactionCallback.h +++ b/WebCore/storage/DatabaseCallback.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2010 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,41 +26,11 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef JSCustomSQLTransactionCallback_h -#define JSCustomSQLTransactionCallback_h - -#if ENABLE(DATABASE) - -#include "JSDOMGlobalObject.h" -#include "SQLTransactionCallback.h" -#include <wtf/Forward.h> - -namespace WebCore { - -class Frame; -class JSCallbackData; -class JSDOMGlobalObject; - -class JSCustomSQLTransactionCallback : public SQLTransactionCallback { -public: - static PassRefPtr<JSCustomSQLTransactionCallback> create(JSC::JSObject* callback, JSDOMGlobalObject* globalObject) - { - return adoptRef(new JSCustomSQLTransactionCallback(callback, globalObject)); - } - - virtual ~JSCustomSQLTransactionCallback(); - - virtual void handleEvent(ScriptExecutionContext*, SQLTransaction*, bool& raisedException); - -private: - JSCustomSQLTransactionCallback(JSC::JSObject* callback, JSDOMGlobalObject*); - - JSCallbackData* m_data; - RefPtr<DOMWrapperWorld> m_isolatedWorld; -}; - +module storage { + interface [ + Conditional=DATABASE, + Callback + ] DatabaseCallback { + boolean handleEvent(in Database database); + }; } - -#endif // ENABLE(DATABASE) - -#endif // JSCustomSQLTransactionCallback_h diff --git a/WebCore/storage/DatabaseSync.cpp b/WebCore/storage/DatabaseSync.cpp new file mode 100644 index 0000000..3c36803 --- /dev/null +++ b/WebCore/storage/DatabaseSync.cpp @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "DatabaseSync.h" + +#if ENABLE(DATABASE) +#include "DatabaseCallback.h" +#include "ExceptionCode.h" +#include "SQLTransactionSyncCallback.h" +#include "ScriptExecutionContext.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> +#include <wtf/StdLibExtras.h> + +namespace WebCore { + +const String& DatabaseSync::databaseInfoTableName() +{ + DEFINE_STATIC_LOCAL(String, name, ("__WebKitDatabaseInfoTable__")); + return name; +} + +static bool isSyncDatabaseAvailable = true; + +void DatabaseSync::setIsAvailable(bool available) +{ + isSyncDatabaseAvailable = available; +} + +bool DatabaseSync::isAvailable() +{ + return isSyncDatabaseAvailable; +} + +PassRefPtr<DatabaseSync> DatabaseSync::openDatabaseSync(ScriptExecutionContext*, const String&, const String&, const String&, + unsigned long, PassRefPtr<DatabaseCallback>, ExceptionCode& ec) +{ + // FIXME: uncomment the assert once we use the ScriptExecutionContext* parameter + //ASSERT(context->isContextThread()); + + ec = SECURITY_ERR; + return 0; +} + +DatabaseSync::DatabaseSync(ScriptExecutionContext* context, const String& name, const String& expectedVersion, + const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback) + : m_scriptExecutionContext(context) + , m_name(name.crossThreadString()) + , m_expectedVersion(expectedVersion.crossThreadString()) + , m_displayName(displayName.crossThreadString()) + , m_estimatedSize(estimatedSize) + , m_creationCallback(creationCallback) +{ + ASSERT(context->isContextThread()); +} + +DatabaseSync::~DatabaseSync() +{ + ASSERT(m_scriptExecutionContext->isContextThread()); +} + +String DatabaseSync::version() const +{ + ASSERT(m_scriptExecutionContext->isContextThread()); + return String(); +} + +void DatabaseSync::changeVersion(const String&, const String&, PassRefPtr<SQLTransactionSyncCallback>) +{ + ASSERT(m_scriptExecutionContext->isContextThread()); +} + +void DatabaseSync::transaction(PassRefPtr<SQLTransactionSyncCallback>, bool) +{ + ASSERT(m_scriptExecutionContext->isContextThread()); +} + +ScriptExecutionContext* DatabaseSync::scriptExecutionContext() const +{ + ASSERT(m_scriptExecutionContext->isContextThread()); + return m_scriptExecutionContext.get(); +} + +#endif // ENABLE(DATABASE) + +} // namespace WebCore diff --git a/WebCore/storage/DatabaseSync.h b/WebCore/storage/DatabaseSync.h new file mode 100644 index 0000000..c398607 --- /dev/null +++ b/WebCore/storage/DatabaseSync.h @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must 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 DatabaseSync_h +#define DatabaseSync_h + +#if ENABLE(DATABASE) +#include "PlatformString.h" +#include <wtf/Forward.h> + +namespace WebCore { + +class DatabaseCallback; +class SQLTransactionSyncCallback; +class ScriptExecutionContext; + +typedef int ExceptionCode; + +// Instances of this class should be created and used only on the worker's context thread. +class DatabaseSync : public RefCounted<DatabaseSync> { +public: + static void setIsAvailable(bool); + static bool isAvailable(); + + ~DatabaseSync(); + + // Direct support for the DOM API + static PassRefPtr<DatabaseSync> openDatabaseSync(ScriptExecutionContext*, const String& name, const String& expectedVersion, + const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback>, ExceptionCode&); + String version() const; + void changeVersion(const String& oldVersion, const String& newVersion, PassRefPtr<SQLTransactionSyncCallback>); + void transaction(PassRefPtr<SQLTransactionSyncCallback>, bool readOnly); + + // Internal engine support + ScriptExecutionContext* scriptExecutionContext() const; + + static const String& databaseInfoTableName(); + +private: + DatabaseSync(ScriptExecutionContext*, const String& name, const String& expectedVersion, + const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback>); + + RefPtr<ScriptExecutionContext> m_scriptExecutionContext; + String m_name; + String m_expectedVersion; + String m_displayName; + unsigned long m_estimatedSize; + RefPtr<DatabaseCallback> m_creationCallback; + +#ifndef NDEBUG + String databaseDebugName() const { return String(); } +#endif +}; + +} // namespace WebCore + +#endif // ENABLE(DATABASE) + +#endif // DatabaseSync_h diff --git a/WebCore/storage/SQLStatement.cpp b/WebCore/storage/SQLStatement.cpp index 64f2634..2e1aea2 100644 --- a/WebCore/storage/SQLStatement.cpp +++ b/WebCore/storage/SQLStatement.cpp @@ -174,7 +174,7 @@ bool SQLStatement::performCallback(SQLTransaction* transaction) ASSERT(m_statementErrorCallback); callbackError = m_statementErrorCallback->handleEvent(transaction->database()->scriptExecutionContext(), transaction, m_error.get()); } else if (m_statementCallback) - m_statementCallback->handleEvent(transaction->database()->scriptExecutionContext(), transaction, m_resultSet.get(), callbackError); + callbackError = !m_statementCallback->handleEvent(transaction->database()->scriptExecutionContext(), transaction, m_resultSet.get()); // Now release our callbacks, to break reference cycles. m_statementCallback = 0; diff --git a/WebCore/storage/SQLStatementCallback.h b/WebCore/storage/SQLStatementCallback.h index ccb8fa7..68e7cb8 100644 --- a/WebCore/storage/SQLStatementCallback.h +++ b/WebCore/storage/SQLStatementCallback.h @@ -41,7 +41,7 @@ class SQLResultSet; class SQLStatementCallback : public ThreadSafeShared<SQLStatementCallback> { public: virtual ~SQLStatementCallback() { } - virtual void handleEvent(ScriptExecutionContext*, SQLTransaction*, SQLResultSet*, bool& raisedException) = 0; + virtual bool handleEvent(ScriptExecutionContext*, SQLTransaction*, SQLResultSet*) = 0; }; } diff --git a/WebCore/bindings/js/JSCustomSQLTransactionErrorCallback.h b/WebCore/storage/SQLStatementCallback.idl index bb92393..cc25711 100644 --- a/WebCore/bindings/js/JSCustomSQLTransactionErrorCallback.h +++ b/WebCore/storage/SQLStatementCallback.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2010 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,39 +26,11 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef JSCustomSQLTransactionErrorCallback_h -#define JSCustomSQLTransactionErrorCallback_h - -#if ENABLE(DATABASE) - -#include "JSCallbackData.h" -#include "SQLTransactionErrorCallback.h" -#include <wtf/Forward.h> - -namespace WebCore { - -class JSCallbackData; -class SQLError; - -class JSCustomSQLTransactionErrorCallback : public SQLTransactionErrorCallback { -public: - static PassRefPtr<JSCustomSQLTransactionErrorCallback> create(JSC::JSObject* callback, JSDOMGlobalObject* globalObject) - { - return adoptRef(new JSCustomSQLTransactionErrorCallback(callback, globalObject)); - } - - virtual ~JSCustomSQLTransactionErrorCallback(); - - virtual void handleEvent(ScriptExecutionContext*, SQLError*); - -private: - JSCustomSQLTransactionErrorCallback(JSC::JSObject* callback, JSDOMGlobalObject* globalObject); - - JSCallbackData* m_data; - RefPtr<DOMWrapperWorld> m_isolatedWorld; -}; - +module storage { + interface [ + Conditional=DATABASE, + Callback + ] SQLStatementCallback { + boolean handleEvent(in SQLTransaction transaction, in SQLResultSet resultSet); + }; } -#endif // ENABLE(DATABASE) - -#endif // JSCustomSQLTransactionErrorCallback_h diff --git a/WebCore/storage/SQLStatementErrorCallback.idl b/WebCore/storage/SQLStatementErrorCallback.idl new file mode 100644 index 0000000..315500d --- /dev/null +++ b/WebCore/storage/SQLStatementErrorCallback.idl @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must 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. + */ + +module storage { + interface [ + Conditional=DATABASE, + Callback + ] SQLStatementErrorCallback { + [Custom] boolean handleEvent(in SQLTransaction transaction, in SQLError error); + }; +} diff --git a/WebCore/storage/SQLTransaction.cpp b/WebCore/storage/SQLTransaction.cpp index ea7deee..aebc293 100644 --- a/WebCore/storage/SQLTransaction.cpp +++ b/WebCore/storage/SQLTransaction.cpp @@ -290,7 +290,7 @@ void SQLTransaction::deliverTransactionCallback() if (m_callback) { m_executeSqlAllowed = true; - m_callback->handleEvent(m_database->scriptExecutionContext(), this, shouldDeliverErrorCallback); + shouldDeliverErrorCallback = !m_callback->handleEvent(m_database->scriptExecutionContext(), this); m_executeSqlAllowed = false; } else shouldDeliverErrorCallback = true; @@ -466,6 +466,9 @@ void SQLTransaction::postflightAndCommit() return; } + // The commit was successful, so vacuum the database if needed + m_database->incrementalVacuumIfNeeded(); + // The commit was successful, notify the delegates if the transaction modified this database if (m_modifiedDatabase) m_database->transactionClient()->didCommitTransaction(this); diff --git a/WebCore/storage/SQLTransactionCallback.h b/WebCore/storage/SQLTransactionCallback.h index 34b7613..048410f 100644 --- a/WebCore/storage/SQLTransactionCallback.h +++ b/WebCore/storage/SQLTransactionCallback.h @@ -37,12 +37,11 @@ namespace WebCore { class ScriptExecutionContext; class SQLTransaction; -class SQLError; class SQLTransactionCallback : public ThreadSafeShared<SQLTransactionCallback> { public: virtual ~SQLTransactionCallback() { } - virtual void handleEvent(ScriptExecutionContext*, SQLTransaction*, bool& raisedException) = 0; + virtual bool handleEvent(ScriptExecutionContext*, SQLTransaction*) = 0; }; } diff --git a/WebCore/storage/SQLTransactionCallback.idl b/WebCore/storage/SQLTransactionCallback.idl new file mode 100644 index 0000000..d1bc77c --- /dev/null +++ b/WebCore/storage/SQLTransactionCallback.idl @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must 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. + */ + +module storage { + interface [ + Conditional=DATABASE, + Callback + ] SQLTransactionCallback { + boolean handleEvent(in SQLTransaction transaction); + }; +} diff --git a/WebCore/storage/SQLTransactionErrorCallback.h b/WebCore/storage/SQLTransactionErrorCallback.h index 6c0d13a..2fe2cb3 100644 --- a/WebCore/storage/SQLTransactionErrorCallback.h +++ b/WebCore/storage/SQLTransactionErrorCallback.h @@ -41,7 +41,7 @@ class SQLError; class SQLTransactionErrorCallback : public ThreadSafeShared<SQLTransactionErrorCallback> { public: virtual ~SQLTransactionErrorCallback() { } - virtual void handleEvent(ScriptExecutionContext*, SQLError*) = 0; + virtual bool handleEvent(ScriptExecutionContext*, SQLError*) = 0; }; } diff --git a/WebCore/storage/SQLTransactionErrorCallback.idl b/WebCore/storage/SQLTransactionErrorCallback.idl new file mode 100644 index 0000000..779ba69 --- /dev/null +++ b/WebCore/storage/SQLTransactionErrorCallback.idl @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must 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. + */ + +module storage { + interface [ + Conditional=DATABASE, + Callback + ] SQLTransactionErrorCallback { + boolean handleEvent(in SQLError error); + }; +} diff --git a/WebCore/bindings/js/JSCustomSQLTransactionErrorCallback.cpp b/WebCore/storage/SQLTransactionSync.cpp index 09ff340..5e7c879 100644 --- a/WebCore/bindings/js/JSCustomSQLTransactionErrorCallback.cpp +++ b/WebCore/storage/SQLTransactionSync.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2010 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,53 +27,47 @@ */ #include "config.h" -#include "JSCustomSQLTransactionErrorCallback.h" +#include "SQLTransactionSync.h" #if ENABLE(DATABASE) -#include "Frame.h" -#include "JSCallbackData.h" -#include "JSSQLError.h" +#include "DatabaseSync.h" +#include "ExceptionCode.h" +#include "PlatformString.h" +#include "SQLResultSet.h" +#include "SQLTransactionSyncCallback.h" +#include "SQLValue.h" #include "ScriptExecutionContext.h" -#include <runtime/JSLock.h> -#include <wtf/MainThread.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> namespace WebCore { -using namespace JSC; - -JSCustomSQLTransactionErrorCallback::JSCustomSQLTransactionErrorCallback(JSObject* callback, JSDOMGlobalObject* globalObject) - : m_data(new JSCallbackData(callback, globalObject)) - , m_isolatedWorld(globalObject->world()) +PassRefPtr<SQLTransactionSync> SQLTransactionSync::create(DatabaseSync* db, PassRefPtr<SQLTransactionSyncCallback> callback, bool readOnly) { + return adoptRef(new SQLTransactionSync(db, callback, readOnly)); } -JSCustomSQLTransactionErrorCallback::~JSCustomSQLTransactionErrorCallback() +SQLTransactionSync::SQLTransactionSync(DatabaseSync* db, PassRefPtr<SQLTransactionSyncCallback> callback, bool readOnly) + : m_database(db) + , m_callback(callback) + , m_readOnly(readOnly) { - callOnMainThread(JSCallbackData::deleteData, m_data); -#ifndef NDEBUG - m_data = 0; -#endif + ASSERT(m_database->scriptExecutionContext()->isContextThread()); + ASSERT(callback); } -void JSCustomSQLTransactionErrorCallback::handleEvent(ScriptExecutionContext* context, SQLError* error) +SQLTransactionSync::~SQLTransactionSync() { - ASSERT(m_data); - ASSERT(context); - - RefPtr<JSCustomSQLTransactionErrorCallback> protect(this); - - JSC::JSLock lock(SilenceAssertionsOnly); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, m_isolatedWorld.get()); - if (!globalObject) - return; - - ExecState* exec = globalObject->globalExec(); - MarkedArgumentBuffer args; - args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), error)); - m_data->invokeCallback(args); + ASSERT(m_database->scriptExecutionContext()->isContextThread()); } +PassRefPtr<SQLResultSet> SQLTransactionSync::executeSQL(const String&, const Vector<SQLValue>&, ExceptionCode&) +{ + ASSERT(m_database->scriptExecutionContext()->isContextThread()); + return 0; } +} // namespace WebCore + #endif // ENABLE(DATABASE) diff --git a/WebCore/storage/SQLTransactionSync.h b/WebCore/storage/SQLTransactionSync.h new file mode 100644 index 0000000..7c03927 --- /dev/null +++ b/WebCore/storage/SQLTransactionSync.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must 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 SQLTransactionSync_h +#define SQLTransactionSync_h + +#if ENABLE(DATABASE) + +#include <wtf/Forward.h> +#include <wtf/RefCounted.h> +#include <wtf/Vector.h> + +namespace WebCore { + +typedef int ExceptionCode; + +class DatabaseSync; +class SQLResultSet; +class SQLTransactionSyncCallback; +class SQLValue; +class String; + +// Instances of this class should be created and used only on the worker's context thread. +class SQLTransactionSync : public RefCounted<SQLTransactionSync> { +public: + static PassRefPtr<SQLTransactionSync> create(DatabaseSync*, PassRefPtr<SQLTransactionSyncCallback>, bool readOnly = false); + + ~SQLTransactionSync(); + + PassRefPtr<SQLResultSet> executeSQL(const String& sqlStatement, const Vector<SQLValue>& arguments, ExceptionCode&); + + DatabaseSync* database() { return m_database.get(); } + bool isReadOnly() const { return m_readOnly; } + +private: + SQLTransactionSync(DatabaseSync*, PassRefPtr<SQLTransactionSyncCallback>, bool readOnly); + + RefPtr<DatabaseSync> m_database; + RefPtr<SQLTransactionSyncCallback> m_callback; + bool m_readOnly; +}; + +} // namespace WebCore + +#endif + +#endif // SQLTransactionSync_h diff --git a/WebCore/bindings/js/JSCustomSQLStatementCallback.h b/WebCore/storage/SQLTransactionSyncCallback.h index cb7b34d..d32bbfa 100644 --- a/WebCore/bindings/js/JSCustomSQLStatementCallback.h +++ b/WebCore/storage/SQLTransactionSyncCallback.h @@ -1,10 +1,10 @@ /* - * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2010 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + *Transaction * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright @@ -26,39 +26,27 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef JSCustomSQLStatementCallback_h -#define JSCustomSQLStatementCallback_h +#ifndef SQLTransactionSyncCallback_h +#define SQLTransactionSyncCallback_h #if ENABLE(DATABASE) -#include "JSCallbackData.h" -#include "SQLStatementCallback.h" -#include <wtf/Forward.h> +#include <wtf/Threading.h> namespace WebCore { -class SQLResultSet; +class ScriptExecutionContext; +class SQLTransactionSync; -class JSCustomSQLStatementCallback : public SQLStatementCallback { +// Instances of this class should be created and used only on the worker's context thread. +class SQLTransactionSyncCallback : public RefCounted<SQLTransactionSyncCallback> { public: - static PassRefPtr<JSCustomSQLStatementCallback> create(JSC::JSObject* callback, JSDOMGlobalObject* globalObject) - { - return adoptRef(new JSCustomSQLStatementCallback(callback, globalObject)); - } - - virtual ~JSCustomSQLStatementCallback(); - - virtual void handleEvent(ScriptExecutionContext*, SQLTransaction*, SQLResultSet*, bool& raisedException); - -private: - JSCustomSQLStatementCallback(JSC::JSObject* callback, JSDOMGlobalObject*); - - JSCallbackData* m_data; - RefPtr<DOMWrapperWorld> m_isolatedWorld; + virtual ~SQLTransactionSyncCallback() { } + virtual void handleEvent(ScriptExecutionContext*, SQLTransactionSync*, bool& raisedException) = 0; }; } -#endif // ENABLE(DATABASE) +#endif -#endif // JSCustomSQLStatementCallback_h +#endif // SQLTransactionSyncCallback_h diff --git a/WebCore/storage/StorageEvent.cpp b/WebCore/storage/StorageEvent.cpp index f2b1339..a08cde2 100644 --- a/WebCore/storage/StorageEvent.cpp +++ b/WebCore/storage/StorageEvent.cpp @@ -45,22 +45,22 @@ StorageEvent::~StorageEvent() { } -PassRefPtr<StorageEvent> StorageEvent::create(const AtomicString& type, const String& key, const String& oldValue, const String& newValue, const String& uri, Storage* storageArea) +PassRefPtr<StorageEvent> StorageEvent::create(const AtomicString& type, const String& key, const String& oldValue, const String& newValue, const String& url, Storage* storageArea) { - return adoptRef(new StorageEvent(type, key, oldValue, newValue, uri, storageArea)); + return adoptRef(new StorageEvent(type, key, oldValue, newValue, url, storageArea)); } -StorageEvent::StorageEvent(const AtomicString& type, const String& key, const String& oldValue, const String& newValue, const String& uri, Storage* storageArea) +StorageEvent::StorageEvent(const AtomicString& type, const String& key, const String& oldValue, const String& newValue, const String& url, Storage* storageArea) : Event(type, false, false) , m_key(key) , m_oldValue(oldValue) , m_newValue(newValue) - , m_uri(uri) + , m_url(url) , m_storageArea(storageArea) { } -void StorageEvent::initStorageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& key, const String& oldValue, const String& newValue, const String& uri, Storage* storageArea) +void StorageEvent::initStorageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& key, const String& oldValue, const String& newValue, const String& url, Storage* storageArea) { if (dispatched()) return; @@ -70,7 +70,7 @@ void StorageEvent::initStorageEvent(const AtomicString& type, bool canBubble, bo m_key = key; m_oldValue = oldValue; m_newValue = newValue; - m_uri = uri; + m_url = url; m_storageArea = storageArea; } diff --git a/WebCore/storage/StorageEvent.h b/WebCore/storage/StorageEvent.h index 918515a..8e558a8 100644 --- a/WebCore/storage/StorageEvent.h +++ b/WebCore/storage/StorageEvent.h @@ -38,30 +38,30 @@ namespace WebCore { class StorageEvent : public Event { public: static PassRefPtr<StorageEvent> create(); - static PassRefPtr<StorageEvent> create(const AtomicString& type, const String& key, const String& oldValue, const String& newValue, const String& uri, Storage* storageArea); + static PassRefPtr<StorageEvent> create(const AtomicString& type, const String& key, const String& oldValue, const String& newValue, const String& url, Storage* storageArea); virtual ~StorageEvent(); const String& key() const { return m_key; } const String& oldValue() const { return m_oldValue; } const String& newValue() const { return m_newValue; } - const String& uri() const { return m_uri; } + const String& url() const { return m_url; } Storage* storageArea() const { return m_storageArea.get(); } - void initStorageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& key, const String& oldValue, const String& newValue, const String& uri, Storage* storageArea); + void initStorageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& key, const String& oldValue, const String& newValue, const String& url, Storage* storageArea); // Needed once we support init<blank>EventNS - // void initStorageEventNS(in DOMString namespaceURI, in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString keyArg, in DOMString oldValueArg, in DOMString newValueArg, in DOMString uriArg, Storage storageAreaArg); + // void initStorageEventNS(in DOMString namespaceURI, in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString keyArg, in DOMString oldValueArg, in DOMString newValueArg, in DOMString urlArg, Storage storageAreaArg); virtual bool isStorageEvent() const { return true; } private: StorageEvent(); - StorageEvent(const AtomicString& type, const String& key, const String& oldValue, const String& newValue, const String& uri, Storage* storageArea); + StorageEvent(const AtomicString& type, const String& key, const String& oldValue, const String& newValue, const String& url, Storage* storageArea); String m_key; String m_oldValue; String m_newValue; - String m_uri; + String m_url; RefPtr<Storage> m_storageArea; }; diff --git a/WebCore/storage/StorageEvent.idl b/WebCore/storage/StorageEvent.idl index 3e77eda..3464caa 100644 --- a/WebCore/storage/StorageEvent.idl +++ b/WebCore/storage/StorageEvent.idl @@ -31,12 +31,12 @@ module storage { readonly attribute [ConvertNullStringTo=Null] DOMString key; readonly attribute [ConvertNullStringTo=Null] DOMString oldValue; readonly attribute [ConvertNullStringTo=Null] DOMString newValue; - readonly attribute DOMString uri; + readonly attribute DOMString url; readonly attribute Storage storageArea; - void initStorageEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString keyArg, in [ConvertNullToNullString] DOMString oldValueArg, in [ConvertNullToNullString] DOMString newValueArg, in DOMString uriArg, in Storage storageAreaArg); + void initStorageEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString keyArg, in [ConvertNullToNullString] DOMString oldValueArg, in [ConvertNullToNullString] DOMString newValueArg, in DOMString urlArg, in Storage storageAreaArg); // Needed once we support init<blank>EventNS - // void initStorageEventNS(in DOMString namespaceURI, in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString keyArg, in DOMString oldValueArg, in DOMString newValueArg, in DOMString uriArg, in Storage storageAreaArg); + // void initStorageEventNS(in DOMString namespaceURI, in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString keyArg, in DOMString oldValueArg, in DOMString newValueArg, in DOMString urlArg, in Storage storageAreaArg); }; } diff --git a/WebCore/storage/StorageEventDispatcher.cpp b/WebCore/storage/StorageEventDispatcher.cpp index 2118a83..5833c59 100644 --- a/WebCore/storage/StorageEventDispatcher.cpp +++ b/WebCore/storage/StorageEventDispatcher.cpp @@ -54,8 +54,12 @@ void StorageEventDispatcher::dispatch(const String& key, const String& oldValue, frames.append(frame); } - for (unsigned i = 0; i < frames.size(); ++i) - frames[i]->document()->enqueueEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), frames[i]->domWindow()->sessionStorage())); + for (unsigned i = 0; i < frames.size(); ++i) { + ExceptionCode ec = 0; + Storage* storage = frames[i]->domWindow()->sessionStorage(ec); + if (!ec) + frames[i]->document()->enqueueEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage)); + } } else { // Send events to every page. const HashSet<Page*>& pages = page->group().pages(); diff --git a/WebCore/svg/GradientAttributes.h b/WebCore/svg/GradientAttributes.h index ba513b8..473c1b9 100644 --- a/WebCore/svg/GradientAttributes.h +++ b/WebCore/svg/GradientAttributes.h @@ -21,51 +21,72 @@ #define GradientAttributes_h #if ENABLE(SVG) +#include "Color.h" +#include "Gradient.h" +#include "SVGLength.h" namespace WebCore { - struct GradientAttributes { - GradientAttributes() - : m_spreadMethod(SpreadMethodPad) - , m_boundingBoxMode(true) - , m_spreadMethodSet(false) - , m_boundingBoxModeSet(false) - , m_gradientTransformSet(false) - , m_stopsSet(false) - { - } - - GradientSpreadMethod spreadMethod() const { return m_spreadMethod; } - bool boundingBoxMode() const { return m_boundingBoxMode; } - AffineTransform gradientTransform() const { return m_gradientTransform; } - const Vector<SVGGradientStop>& stops() const { return m_stops; } - - void setSpreadMethod(GradientSpreadMethod value) { m_spreadMethod = value; m_spreadMethodSet = true; } - void setBoundingBoxMode(bool value) { m_boundingBoxMode = value; m_boundingBoxModeSet = true; } - void setGradientTransform(const AffineTransform& value) { m_gradientTransform = value; m_gradientTransformSet = true; } - void setStops(const Vector<SVGGradientStop>& value) { m_stops = value; m_stopsSet = true; } - - bool hasSpreadMethod() const { return m_spreadMethodSet; } - bool hasBoundingBoxMode() const { return m_boundingBoxModeSet; } - bool hasGradientTransform() const { return m_gradientTransformSet; } - bool hasStops() const { return m_stopsSet; } - - private: - // Properties - GradientSpreadMethod m_spreadMethod; - bool m_boundingBoxMode; - AffineTransform m_gradientTransform; - Vector<SVGGradientStop> m_stops; - - // Property states - bool m_spreadMethodSet : 1; - bool m_boundingBoxModeSet : 1; - bool m_gradientTransformSet : 1; - bool m_stopsSet : 1; - }; + +struct GradientAttributes { + GradientAttributes() + : m_spreadMethod(SpreadMethodPad) + , m_boundingBoxMode(true) + , m_spreadMethodSet(false) + , m_boundingBoxModeSet(false) + , m_gradientTransformSet(false) + , m_stopsSet(false) + { + } + + GradientSpreadMethod spreadMethod() const { return m_spreadMethod; } + bool boundingBoxMode() const { return m_boundingBoxMode; } + AffineTransform gradientTransform() const { return m_gradientTransform; } + const Vector<Gradient::ColorStop>& stops() const { return m_stops; } + + void setSpreadMethod(GradientSpreadMethod value) + { + m_spreadMethod = value; + m_spreadMethodSet = true; + } + + void setBoundingBoxMode(bool value) + { + m_boundingBoxMode = value; + m_boundingBoxModeSet = true; + } + + void setGradientTransform(const AffineTransform& value) + { + m_gradientTransform = value; + m_gradientTransformSet = true; + } + + void setStops(const Vector<Gradient::ColorStop>& value) + { + m_stops = value; + m_stopsSet = true; + } + + bool hasSpreadMethod() const { return m_spreadMethodSet; } + bool hasBoundingBoxMode() const { return m_boundingBoxModeSet; } + bool hasGradientTransform() const { return m_gradientTransformSet; } + bool hasStops() const { return m_stopsSet; } + +private: + // Properties + GradientSpreadMethod m_spreadMethod; + bool m_boundingBoxMode; + AffineTransform m_gradientTransform; + Vector<Gradient::ColorStop> m_stops; + + // Property states + bool m_spreadMethodSet : 1; + bool m_boundingBoxModeSet : 1; + bool m_gradientTransformSet : 1; + bool m_stopsSet : 1; +}; } // namespace WebCore #endif // ENABLE(SVG) #endif - -// vim:ts=4:noet diff --git a/WebCore/svg/LinearGradientAttributes.h b/WebCore/svg/LinearGradientAttributes.h index b71dc22..af16b8a 100644 --- a/WebCore/svg/LinearGradientAttributes.h +++ b/WebCore/svg/LinearGradientAttributes.h @@ -20,9 +20,8 @@ #ifndef LinearGradientAttributes_h #define LinearGradientAttributes_h -#include "GradientAttributes.h" - #if ENABLE(SVG) +#include "GradientAttributes.h" namespace WebCore { struct LinearGradientAttributes : GradientAttributes { diff --git a/WebCore/svg/PatternAttributes.h b/WebCore/svg/PatternAttributes.h index 2d25763..feaabd9 100644 --- a/WebCore/svg/PatternAttributes.h +++ b/WebCore/svg/PatternAttributes.h @@ -21,80 +21,121 @@ #define PatternAttributes_h #if ENABLE(SVG) +#include "SVGLength.h" namespace WebCore { - struct PatternAttributes { - PatternAttributes() - : m_x() - , m_y() - , m_width() - , m_height() - , m_boundingBoxMode(true) - , m_boundingBoxModeContent(false) - , m_patternContentElement(0) - , m_xSet(false) - , m_ySet(false) - , m_widthSet(false) - , m_heightSet(false) - , m_boundingBoxModeSet(false) - , m_boundingBoxModeContentSet(false) - , m_patternTransformSet(false) - , m_patternContentElementSet(false) - { - } - - SVGLength x() const { return m_x; } - SVGLength y() const { return m_y; } - SVGLength width() const { return m_width; } - SVGLength height() const { return m_height; } - bool boundingBoxMode() const { return m_boundingBoxMode; } - bool boundingBoxModeContent() const { return m_boundingBoxModeContent; } - AffineTransform patternTransform() const { return m_patternTransform; } - const SVGPatternElement* patternContentElement() const { return m_patternContentElement; } - - void setX(const SVGLength& value) { m_x = value; m_xSet = true; } - void setY(const SVGLength& value) { m_y = value; m_ySet = true; } - void setWidth(const SVGLength& value) { m_width = value; m_widthSet = true; } - void setHeight(const SVGLength& value) { m_height = value; m_heightSet = true; } - void setBoundingBoxMode(bool value) { m_boundingBoxMode = value; m_boundingBoxModeSet = true; } - void setBoundingBoxModeContent(bool value) { m_boundingBoxModeContent = value; m_boundingBoxModeContentSet = true; } - void setPatternTransform(const AffineTransform& value) { m_patternTransform = value; m_patternTransformSet = true; } - void setPatternContentElement(const SVGPatternElement* value) { m_patternContentElement = value; m_patternContentElementSet = true; } - - bool hasX() const { return m_xSet; } - bool hasY() const { return m_ySet; } - bool hasWidth() const { return m_widthSet; } - bool hasHeight() const { return m_heightSet; } - bool hasBoundingBoxMode() const { return m_boundingBoxModeSet; } - bool hasBoundingBoxModeContent() const { return m_boundingBoxModeContentSet; } - bool hasPatternTransform() const { return m_patternTransformSet; } - bool hasPatternContentElement() const { return m_patternContentElementSet; } - - private: - // Properties - SVGLength m_x; - SVGLength m_y; - SVGLength m_width; - SVGLength m_height; - bool m_boundingBoxMode; - bool m_boundingBoxModeContent; - AffineTransform m_patternTransform; - const SVGPatternElement* m_patternContentElement; - - // Property states - bool m_xSet : 1; - bool m_ySet : 1; - bool m_widthSet : 1; - bool m_heightSet : 1; - bool m_boundingBoxModeSet : 1; - bool m_boundingBoxModeContentSet : 1; - bool m_patternTransformSet : 1; - bool m_patternContentElementSet : 1; - }; + +class SVGPatternElement; + +struct PatternAttributes { + PatternAttributes() + : m_x() + , m_y() + , m_width() + , m_height() + , m_boundingBoxMode(true) + , m_boundingBoxModeContent(false) + , m_patternContentElement(0) + , m_xSet(false) + , m_ySet(false) + , m_widthSet(false) + , m_heightSet(false) + , m_boundingBoxModeSet(false) + , m_boundingBoxModeContentSet(false) + , m_patternTransformSet(false) + , m_patternContentElementSet(false) + { + } + + SVGLength x() const { return m_x; } + SVGLength y() const { return m_y; } + SVGLength width() const { return m_width; } + SVGLength height() const { return m_height; } + bool boundingBoxMode() const { return m_boundingBoxMode; } + bool boundingBoxModeContent() const { return m_boundingBoxModeContent; } + AffineTransform patternTransform() const { return m_patternTransform; } + const SVGPatternElement* patternContentElement() const { return m_patternContentElement; } + + void setX(const SVGLength& value) + { + m_x = value; + m_xSet = true; + } + + void setY(const SVGLength& value) + { + m_y = value; + m_ySet = true; + } + + void setWidth(const SVGLength& value) + { + m_width = value; + m_widthSet = true; + } + + void setHeight(const SVGLength& value) + { + m_height = value; + m_heightSet = true; + } + + void setBoundingBoxMode(bool value) + { + m_boundingBoxMode = value; + m_boundingBoxModeSet = true; + } + + void setBoundingBoxModeContent(bool value) + { + m_boundingBoxModeContent = value; + m_boundingBoxModeContentSet = true; + } + + void setPatternTransform(const AffineTransform& value) + { + m_patternTransform = value; + m_patternTransformSet = true; + } + + void setPatternContentElement(const SVGPatternElement* value) + { + m_patternContentElement = value; + m_patternContentElementSet = true; + } + + bool hasX() const { return m_xSet; } + bool hasY() const { return m_ySet; } + bool hasWidth() const { return m_widthSet; } + bool hasHeight() const { return m_heightSet; } + bool hasBoundingBoxMode() const { return m_boundingBoxModeSet; } + bool hasBoundingBoxModeContent() const { return m_boundingBoxModeContentSet; } + bool hasPatternTransform() const { return m_patternTransformSet; } + bool hasPatternContentElement() const { return m_patternContentElementSet; } + +private: + // Properties + SVGLength m_x; + SVGLength m_y; + SVGLength m_width; + SVGLength m_height; + bool m_boundingBoxMode; + bool m_boundingBoxModeContent; + AffineTransform m_patternTransform; + const SVGPatternElement* m_patternContentElement; + + // Property states + bool m_xSet : 1; + bool m_ySet : 1; + bool m_widthSet : 1; + bool m_heightSet : 1; + bool m_boundingBoxModeSet : 1; + bool m_boundingBoxModeContentSet : 1; + bool m_patternTransformSet : 1; + bool m_patternContentElementSet : 1; +}; } // namespace WebCore #endif // ENABLE(SVG) #endif - -// vim:ts=4:noet diff --git a/WebCore/svg/RadialGradientAttributes.h b/WebCore/svg/RadialGradientAttributes.h index 76a78ec..b461854 100644 --- a/WebCore/svg/RadialGradientAttributes.h +++ b/WebCore/svg/RadialGradientAttributes.h @@ -20,9 +20,8 @@ #ifndef RadialGradientAttributes_h #define RadialGradientAttributes_h -#include "GradientAttributes.h" - #if ENABLE(SVG) +#include "GradientAttributes.h" namespace WebCore { struct RadialGradientAttributes : GradientAttributes { diff --git a/WebCore/svg/SVGAElement.cpp b/WebCore/svg/SVGAElement.cpp index b344a4e..4a1f18a 100644 --- a/WebCore/svg/SVGAElement.cpp +++ b/WebCore/svg/SVGAElement.cpp @@ -60,7 +60,13 @@ SVGAElement::~SVGAElement() String SVGAElement::title() const { - return getAttribute(XLinkNames::titleAttr); + // If the xlink:title is set (non-empty string), use it. + const AtomicString& title = getAttribute(XLinkNames::titleAttr); + if (!title.isEmpty()) + return title; + + // Otherwise, use the title of this element. + return SVGStyledElement::title(); } void SVGAElement::parseMappedAttribute(MappedAttribute* attr) diff --git a/WebCore/svg/SVGAnimateElement.cpp b/WebCore/svg/SVGAnimateElement.cpp index d431583..ff3317b 100644 --- a/WebCore/svg/SVGAnimateElement.cpp +++ b/WebCore/svg/SVGAnimateElement.cpp @@ -178,7 +178,7 @@ bool SVGAnimateElement::calculateFromAndToValues(const String& fromString, const if (m_propertyType == ColorProperty) { m_fromColor = SVGColor::colorFromRGBColorString(fromString); m_toColor = SVGColor::colorFromRGBColorString(toString); - if (m_fromColor.isValid() && m_toColor.isValid() || m_toColor.isValid() && animationMode() == ToAnimation) + if ((m_fromColor.isValid() && m_toColor.isValid()) || (m_toColor.isValid() && animationMode() == ToAnimation)) return true; } else if (m_propertyType == NumberProperty) { m_numberUnit = String(); diff --git a/WebCore/svg/SVGAnimatedProperty.h b/WebCore/svg/SVGAnimatedProperty.h index 0e3ceda..b963265 100644 --- a/WebCore/svg/SVGAnimatedProperty.h +++ b/WebCore/svg/SVGAnimatedProperty.h @@ -48,13 +48,13 @@ public: virtual void setBaseVal(PassType type) { m_creator.setBaseValue(type); - m_contextElement->setSynchronizedSVGAttributes(false); + m_contextElement->invalidateSVGAttributes(); } virtual void setAnimVal(PassType type) { m_creator.setValue(type); - m_contextElement->setSynchronizedSVGAttributes(false); + m_contextElement->invalidateSVGAttributes(); } virtual ReturnType baseVal() const { return m_creator.baseValue(); } @@ -181,14 +181,14 @@ public: \ { \ m_##LowerProperty.setValue(type); \ SVGElement* contextElement = GetOwnerElementForType<OwnerType, IsDerivedFromSVGElement<OwnerType>::value>::ownerElement(this); \ - contextElement->setSynchronizedSVGAttributes(false); \ + contextElement->invalidateSVGAttributes(); \ } \ \ void set##UpperProperty##BaseValue(SVGAnimatedPropertyTraits<AnimatedType>::PassType type) \ { \ m_##LowerProperty.setBaseValue(type); \ SVGElement* contextElement = GetOwnerElementForType<OwnerType, IsDerivedFromSVGElement<OwnerType>::value>::ownerElement(this); \ - contextElement->setSynchronizedSVGAttributes(false); \ + contextElement->invalidateSVGAttributes(); \ } \ \ void synchronize##UpperProperty() \ diff --git a/WebCore/svg/SVGClipPathElement.cpp b/WebCore/svg/SVGClipPathElement.cpp index 694e0bc..dd880f5 100644 --- a/WebCore/svg/SVGClipPathElement.cpp +++ b/WebCore/svg/SVGClipPathElement.cpp @@ -74,7 +74,7 @@ void SVGClipPathElement::svgAttributeChanged(const QualifiedName& attrName) SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName) || SVGStyledTransformableElement::isKnownAttribute(attrName)) - invalidateCanvasResources(); + invalidateResourceClients(); } void SVGClipPathElement::synchronizeProperty(const QualifiedName& attrName) @@ -96,7 +96,9 @@ void SVGClipPathElement::synchronizeProperty(const QualifiedName& attrName) void SVGClipPathElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) { SVGStyledTransformableElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); - invalidateCanvasResources(); + + if (!changedByParser) + invalidateResourceClients(); } RenderObject* SVGClipPathElement::createRenderer(RenderArena* arena, RenderStyle*) diff --git a/WebCore/svg/SVGClipPathElement.h b/WebCore/svg/SVGClipPathElement.h index dbf5380..40e34f0 100644 --- a/WebCore/svg/SVGClipPathElement.h +++ b/WebCore/svg/SVGClipPathElement.h @@ -29,6 +29,7 @@ #include "SVGTests.h" namespace WebCore { + class SVGClipPathElement : public SVGStyledTransformableElement, public SVGTests, public SVGLangSpace, diff --git a/WebCore/svg/SVGDocumentExtensions.cpp b/WebCore/svg/SVGDocumentExtensions.cpp index ef2e40c..0db682f 100644 --- a/WebCore/svg/SVGDocumentExtensions.cpp +++ b/WebCore/svg/SVGDocumentExtensions.cpp @@ -62,7 +62,7 @@ void SVGDocumentExtensions::removeTimeContainer(SVGSVGElement* element) m_timeContainers.remove(element); } -void SVGDocumentExtensions::addResource(const String& id, RenderSVGResource* resource) +void SVGDocumentExtensions::addResource(const AtomicString& id, RenderSVGResourceContainer* resource) { ASSERT(resource); @@ -73,16 +73,15 @@ void SVGDocumentExtensions::addResource(const String& id, RenderSVGResource* res m_resources.set(id, resource); } -void SVGDocumentExtensions::removeResource(const String& id) +void SVGDocumentExtensions::removeResource(const AtomicString& id) { - if (id.isEmpty()) + if (id.isEmpty() || !m_resources.contains(id)) return; - ASSERT(m_resources.contains(id)); m_resources.remove(id); } -RenderSVGResource* SVGDocumentExtensions::resourceById(const String& id) const +RenderSVGResourceContainer* SVGDocumentExtensions::resourceById(const AtomicString& id) const { if (id.isEmpty()) return 0; @@ -148,7 +147,7 @@ void SVGDocumentExtensions::addPendingResource(const AtomicString& id, SVGStyled if (m_pendingResources.contains(id)) m_pendingResources.get(id)->add(obj); else { - HashSet<SVGStyledElement*>* set = new HashSet<SVGStyledElement*>(); + HashSet<SVGStyledElement*>* set = new HashSet<SVGStyledElement*>; set->add(obj); m_pendingResources.add(id, set); diff --git a/WebCore/svg/SVGDocumentExtensions.h b/WebCore/svg/SVGDocumentExtensions.h index f5de647..d31536c 100644 --- a/WebCore/svg/SVGDocumentExtensions.h +++ b/WebCore/svg/SVGDocumentExtensions.h @@ -24,18 +24,16 @@ #define SVGDocumentExtensions_h #if ENABLE(SVG) - -#include <wtf/PassOwnPtr.h> -#include <wtf/HashSet.h> -#include <wtf/HashMap.h> - -#include "StringHash.h" +#include "AtomicStringHash.h" #include "StringImpl.h" +#include <wtf/HashMap.h> +#include <wtf/HashSet.h> +#include <wtf/PassOwnPtr.h> namespace WebCore { class Document; -class RenderSVGResource; +class RenderSVGResourceContainer; class String; class SVGStyledElement; class SVGSMILElement; @@ -49,9 +47,9 @@ public: void addTimeContainer(SVGSVGElement*); void removeTimeContainer(SVGSVGElement*); - void addResource(const String& id, RenderSVGResource*); - void removeResource(const String& id); - RenderSVGResource* resourceById(const String& id) const; + void addResource(const AtomicString& id, RenderSVGResourceContainer*); + void removeResource(const AtomicString& id); + RenderSVGResourceContainer* resourceById(const AtomicString& id) const; void startAnimations(); void pauseAnimations(); @@ -64,8 +62,8 @@ public: private: Document* m_doc; // weak reference HashSet<SVGSVGElement*> m_timeContainers; // For SVG 1.2 support this will need to be made more general. - HashMap<String, RenderSVGResource*> m_resources; - HashMap<String, HashSet<SVGStyledElement*>*> m_pendingResources; + HashMap<AtomicString, RenderSVGResourceContainer*> m_resources; + HashMap<AtomicString, HashSet<SVGStyledElement*>*> m_pendingResources; SVGDocumentExtensions(const SVGDocumentExtensions&); SVGDocumentExtensions& operator=(const SVGDocumentExtensions&); diff --git a/WebCore/svg/SVGElement.cpp b/WebCore/svg/SVGElement.cpp index 41bbba4..ab146bb 100644 --- a/WebCore/svg/SVGElement.cpp +++ b/WebCore/svg/SVGElement.cpp @@ -41,7 +41,6 @@ #include "SVGElementInstance.h" #include "SVGElementRareData.h" #include "SVGNames.h" -#include "SVGResource.h" #include "SVGSVGElement.h" #include "SVGURIReference.h" #include "SVGUseElement.h" @@ -53,7 +52,7 @@ namespace WebCore { using namespace HTMLNames; SVGElement::SVGElement(const QualifiedName& tagName, Document* document) - : StyledElement(tagName, document, CreateElementZeroRefCount) + : StyledElement(tagName, document, CreateSVGElementZeroRefCount) { } @@ -96,7 +95,7 @@ SVGElementRareData* SVGElement::ensureRareSVGData() ASSERT(!SVGElementRareData::rareDataMap().contains(this)); SVGElementRareData* data = new SVGElementRareData; SVGElementRareData::rareDataMap().set(this, data); - m_hasRareSVGData = true; + setHasRareSVGData(); return data; } @@ -281,7 +280,7 @@ void SVGElement::insertedIntoDocument() StyledElement::insertedIntoDocument(); SVGDocumentExtensions* extensions = document()->accessSVGExtensions(); - String resourceId = SVGURIReference::getTarget(getAttribute(idAttributeName())); + String resourceId = getAttribute(idAttributeName()); if (extensions->isPendingResource(resourceId)) { OwnPtr<HashSet<SVGStyledElement*> > clients(extensions->removePendingResource(resourceId)); if (clients->isEmpty()) @@ -292,8 +291,6 @@ void SVGElement::insertedIntoDocument() for (; it != end; ++it) (*it)->buildPendingResource(); - - SVGResource::invalidateClients(*clients); } } @@ -309,18 +306,16 @@ void SVGElement::attributeChanged(Attribute* attr, bool preserveDecls) void SVGElement::updateAnimatedSVGAttribute(const QualifiedName& name) const { - ASSERT(!m_areSVGAttributesValid); - - if (m_synchronizingSVGAttributes) + if (isSynchronizingSVGAttributes() || areSVGAttributesValid()) return; - m_synchronizingSVGAttributes = true; + setIsSynchronizingSVGAttributes(); const_cast<SVGElement*>(this)->synchronizeProperty(name); if (name == anyQName()) - m_areSVGAttributesValid = true; + setAreSVGAttributesValid(); - m_synchronizingSVGAttributes = false; + clearIsSynchronizingSVGAttributes(); } ContainerNode* SVGElement::eventParentNode() diff --git a/WebCore/svg/SVGElement.h b/WebCore/svg/SVGElement.h index 88d7412..9467250 100644 --- a/WebCore/svg/SVGElement.h +++ b/WebCore/svg/SVGElement.h @@ -72,20 +72,21 @@ namespace WebCore { virtual AffineTransform* supplementalTransform() { return 0; } - void setSynchronizedSVGAttributes(bool value) { m_areSVGAttributesValid = value; } + void invalidateSVGAttributes() { clearAreSVGAttributesValid(); } const HashSet<SVGElementInstance*>& instancesForElement() const; void setCursorElement(SVGCursorElement*); void setCursorImageValue(CSSCursorImageValue*); + virtual void updateAnimatedSVGAttribute(const QualifiedName&) const; + protected: SVGElement(const QualifiedName&, Document*); virtual void finishParsingChildren(); virtual void insertedIntoDocument(); virtual void attributeChanged(Attribute*, bool preserveDecls = false); - virtual void updateAnimatedSVGAttribute(const QualifiedName&) const; SVGElementRareData* rareSVGData() const; SVGElementRareData* ensureRareSVGData(); @@ -93,7 +94,6 @@ namespace WebCore { private: friend class SVGElementInstance; - virtual bool isSVGElement() const { return true; } virtual bool isSupported(StringImpl* feature, StringImpl* version) const; virtual ContainerNode* eventParentNode(); diff --git a/WebCore/svg/SVGElementInstance.idl b/WebCore/svg/SVGElementInstance.idl index d23fea2..3fcadb9 100644 --- a/WebCore/svg/SVGElementInstance.idl +++ b/WebCore/svg/SVGElementInstance.idl @@ -90,12 +90,12 @@ module svg { attribute [DontEnum] EventListener onsubmit; attribute [DontEnum] EventListener onunload; - [JSCCustom] void addEventListener(in DOMString type, - in EventListener listener, - in boolean useCapture); - [JSCCustom] void removeEventListener(in DOMString type, - in EventListener listener, - in boolean useCapture); + void addEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); + void removeEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); boolean dispatchEvent(in Event event) raises(EventException); #endif /* defined(LANGUAGE_OBJECTIVE_C) */ diff --git a/WebCore/svg/SVGFont.cpp b/WebCore/svg/SVGFont.cpp index dacbac2..049d35e 100644 --- a/WebCore/svg/SVGFont.cpp +++ b/WebCore/svg/SVGFont.cpp @@ -27,6 +27,7 @@ #include "CSSFontSelector.h" #include "GraphicsContext.h" #include "RenderObject.h" +#include "RenderSVGResourceSolidColor.h" #include "SimpleFontData.h" #include "SVGAltGlyphElement.h" #include "SVGFontData.h" @@ -35,8 +36,6 @@ #include "SVGFontElement.h" #include "SVGFontFaceElement.h" #include "SVGMissingGlyphElement.h" -#include "SVGPaintServer.h" -#include "SVGPaintServerSolid.h" #include "XMLNames.h" using namespace WTF::Unicode; @@ -471,20 +470,20 @@ void Font::drawTextUsingSVGFont(GraphicsContext* context, const TextRun& run, FloatPoint currentPoint = point; float scale = convertEmUnitToPixel(size(), fontFaceElement->unitsPerEm(), 1.0f); - SVGPaintServer* activePaintServer = run.activePaintServer(); + RenderSVGResource* activePaintingResource = run.activePaintingResource(); // If renderObject is not set, we're dealing for HTML text rendered using SVG Fonts. if (!run.referencingRenderObject()) { - ASSERT(!activePaintServer); + ASSERT(!activePaintingResource); // TODO: We're only supporting simple filled HTML text so far. - SVGPaintServerSolid* solidPaintServer = SVGPaintServer::sharedSolidPaintServer(); - solidPaintServer->setColor(context->fillColor()); + RenderSVGResourceSolidColor* solidPaintingResource = RenderSVGResource::sharedSolidPaintingResource(); + solidPaintingResource->setColor(context->fillColor()); - activePaintServer = solidPaintServer; + activePaintingResource = solidPaintingResource; } - ASSERT(activePaintServer); + ASSERT(activePaintingResource); int charsConsumed; String glyphName; @@ -513,7 +512,7 @@ void Font::drawTextUsingSVGFont(GraphicsContext* context, const TextRun& run, SVGTextRunWalker<SVGTextRunWalkerDrawTextData> runWalker(fontData, fontElement, data, drawTextUsingSVGFontCallback, drawTextMissingGlyphCallback); runWalker.walk(run, isVerticalText, language, from, to); - SVGPaintTargetType targetType = context->textDrawingMode() == cTextStroke ? ApplyToStrokeTargetType : ApplyToFillTargetType; + RenderSVGResourceMode resourceMode = context->textDrawingMode() == cTextStroke ? ApplyToStrokeMode : ApplyToFillMode; unsigned numGlyphs = data.glyphIdentifiers.size(); unsigned fallbackCharacterIndex = 0; @@ -538,10 +537,10 @@ void Font::drawTextUsingSVGFont(GraphicsContext* context, const TextRun& run, context->beginPath(); context->addPath(glyphPath); - if (activePaintServer->setup(context, run.referencingRenderObject(), targetType)) { - activePaintServer->renderPath(context, run.referencingRenderObject(), targetType); - activePaintServer->teardown(context, run.referencingRenderObject(), targetType); - } + + RenderStyle* style = run.referencingRenderObject() ? run.referencingRenderObject()->style() : 0; + if (activePaintingResource->applyResource(run.referencingRenderObject(), style, context, resourceMode)) + activePaintingResource->postApplyResource(run.referencingRenderObject(), context, resourceMode); context->restore(); } diff --git a/WebCore/svg/SVGFontElement.cpp b/WebCore/svg/SVGFontElement.cpp index 91d222c..a573350 100644 --- a/WebCore/svg/SVGFontElement.cpp +++ b/WebCore/svg/SVGFontElement.cpp @@ -95,149 +95,64 @@ void SVGFontElement::ensureGlyphCache() const m_isGlyphCacheValid = true; } - -// Returns the number of characters consumed or 0 if no range was found. -static unsigned parseUnicodeRange(const UChar* characters, unsigned length, pair<unsigned, unsigned>& range) + +static bool stringMatchesUnicodeRange(const String& unicodeString, const UnicodeRanges& ranges, const HashSet<String>& unicodeValues) { - if (length < 2) - return 0; - if (characters[0] != 'U') - return 0; - if (characters[1] != '+') - return 0; - - // Parse the starting hex number (or its prefix). - unsigned start = 0; - unsigned startLength = 0; - for (unsigned i = 2; i < length; ++i) { - if (!isASCIIHexDigit(characters[i])) - break; - if (++startLength > 6) - return 0; - start = (start << 4) | toASCIIHexValue(characters[i]); - } - - // Handle the case of ranges separated by "-" sign. - if (2 + startLength < length && characters[2 + startLength] == '-') { - if (!startLength) - return 0; - - // Parse the ending hex number (or its prefix). - unsigned end = 0; - unsigned endLength = 0; - for (unsigned i = 2 + startLength + 1; i < length; ++i) { - if (!isASCIIHexDigit(characters[i])) - break; - if (++endLength > 6) - return 0; - end = (end << 4) | toASCIIHexValue(characters[i]); + if (unicodeString.isEmpty()) + return false; + + if (!ranges.isEmpty()) { + UChar firstChar = unicodeString[0]; + const UnicodeRanges::const_iterator end = ranges.end(); + for (UnicodeRanges::const_iterator it = ranges.begin(); it != end; ++it) { + if (firstChar >= it->first && firstChar <= it->second) + return true; } - - if (!endLength) - return 0; - - range.first = start; - range.second = end; - return 2 + startLength + 1 + endLength; } + + if (!unicodeValues.isEmpty()) + return unicodeValues.contains(unicodeString); - // Handle the case of a number with some optional trailing question marks. - unsigned end = start; - for (unsigned i = 2 + startLength; i < length; ++i) { - if (characters[i] != '?') - break; - if (++startLength > 6) - return 0; - start <<= 4; - end = (end << 4) | 0xF; - } - - if (!startLength) - return 0; - - range.first = start; - range.second = end; - return 2 + startLength; -} - -static bool parseUnicodeRangeList(const UChar* characters, unsigned length, Vector<pair<unsigned, unsigned> >& ranges) -{ - ranges.clear(); - if (!length) - return true; - - const UChar* remainingCharacters = characters; - unsigned remainingLength = length; - - while (1) { - pair<unsigned, unsigned> range; - unsigned charactersConsumed = parseUnicodeRange(remainingCharacters, remainingLength, range); - if (charactersConsumed) { - ranges.append(range); - remainingCharacters += charactersConsumed; - remainingLength -= charactersConsumed; - } else { - if (!remainingLength) - return false; - UChar character = remainingCharacters[0]; - if (character == ',') - return false; - ranges.append(make_pair(character, character)); - ++remainingCharacters; - --remainingLength; - } - if (!remainingLength) - return true; - if (remainingCharacters[0] != ',') - return false; - ++remainingCharacters; - --remainingLength; - } + return false; } -static bool stringMatchesUnicodeRange(const String& unicodeString, const String& unicodeRangeSpec) +static bool stringMatchesGlyphName(const String& glyphName, const HashSet<String>& glyphValues) { - Vector<pair<unsigned, unsigned> > ranges; - if (!parseUnicodeRangeList(unicodeRangeSpec.characters(), unicodeRangeSpec.length(), ranges)) - return false; - - if (unicodeString.length() != ranges.size()) + if (glyphName.isEmpty()) return false; + + if (!glyphValues.isEmpty()) + return glyphValues.contains(glyphName); - for (size_t i = 0; i < unicodeString.length(); ++i) { - UChar c = unicodeString[i]; - if (c < ranges[i].first || c > ranges[i].second) - return false; - } - - return true; + return false; } static bool matches(const String& u1, const String& g1, const String& u2, const String& g2, const SVGHorizontalKerningPair& kerningPair) { - if (kerningPair.unicode1.length() && !stringMatchesUnicodeRange(u1, kerningPair.unicode1)) + if (!stringMatchesUnicodeRange(u1, kerningPair.unicodeRange1, kerningPair.unicodeName1) + && !stringMatchesGlyphName(g1, kerningPair.glyphName1)) return false; - if (kerningPair.glyphName1.length() && kerningPair.glyphName1 != g1) - return false; - - if (kerningPair.unicode2.length() && !stringMatchesUnicodeRange(u2, kerningPair.unicode2)) - return false; - if (kerningPair.glyphName2.length() && kerningPair.glyphName2 != g2) + + if (!stringMatchesUnicodeRange(u2, kerningPair.unicodeRange2, kerningPair.unicodeName2) + && !stringMatchesGlyphName(g2, kerningPair.glyphName2)) return false; - + return true; } -bool SVGFontElement::getHorizontalKerningPairForStringsAndGlyphs(const String& u1, const String& g1, const String& u2, const String& g2, SVGHorizontalKerningPair& kerningPair) const +float SVGFontElement::getHorizontalKerningPairForStringsAndGlyphs(const String& u1, const String& g1, const String& u2, const String& g2) const { - for (size_t i = 0; i < m_kerningPairs.size(); ++i) { - if (matches(u1, g1, u2, g2, m_kerningPairs[i])) { - kerningPair = m_kerningPairs[i]; - return true; - } + if (m_kerningPairs.isEmpty()) + return 0.0f; + + KerningPairVector::const_iterator it = m_kerningPairs.end() - 1; + const KerningPairVector::const_iterator begin = m_kerningPairs.begin() - 1; + for (; it != begin; --it) { + if (matches(u1, g1, u2, g2, *it)) + return it->kerning; } - - return false; + + return 0.0f; } void SVGFontElement::getGlyphIdentifiersForString(const String& string, Vector<SVGGlyphIdentifier>& glyphs) const diff --git a/WebCore/svg/SVGFontElement.h b/WebCore/svg/SVGFontElement.h index 90641a8..31d83c4 100644 --- a/WebCore/svg/SVGFontElement.h +++ b/WebCore/svg/SVGFontElement.h @@ -44,7 +44,7 @@ namespace WebCore { void getGlyphIdentifiersForString(const String&, Vector<SVGGlyphIdentifier>&) const; - bool getHorizontalKerningPairForStringsAndGlyphs(const String& u1, const String& g1, const String& u2, const String& g2, SVGHorizontalKerningPair& kerningPair) const; + float getHorizontalKerningPairForStringsAndGlyphs(const String& u1, const String& g1, const String& u2, const String& g2) const; SVGMissingGlyphElement* firstMissingGlyphElement() const; diff --git a/WebCore/svg/SVGGElement.cpp b/WebCore/svg/SVGGElement.cpp index 6e39bf5..d429400 100644 --- a/WebCore/svg/SVGGElement.cpp +++ b/WebCore/svg/SVGGElement.cpp @@ -23,6 +23,7 @@ #if ENABLE(SVG) #include "SVGGElement.h" +#include "RenderSVGHiddenContainer.h" #include "RenderSVGTransformableContainer.h" namespace WebCore { @@ -79,16 +80,15 @@ void SVGGElement::synchronizeProperty(const QualifiedName& attrName) synchronizeExternalResourcesRequired(); } -void SVGGElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) +RenderObject* SVGGElement::createRenderer(RenderArena* arena, RenderStyle* style) { - SVGStyledTransformableElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); + // SVG 1.1 testsuite explicitely uses constructs like <g display="none"><linearGradient> + // We still have to create renderers for the <g> & <linearGradient> element, though the + // subtree may be hidden - we only want the resource renderers to exist so they can be + // referenced from somewhere else. + if (style->display() == NONE) + return new (arena) RenderSVGHiddenContainer(this); - if (renderer()) - renderer()->setNeedsLayout(true); -} - -RenderObject* SVGGElement::createRenderer(RenderArena* arena, RenderStyle*) -{ return new (arena) RenderSVGTransformableContainer(this); } diff --git a/WebCore/svg/SVGGElement.h b/WebCore/svg/SVGGElement.h index 3e0dd8e..b90eddb 100644 --- a/WebCore/svg/SVGGElement.h +++ b/WebCore/svg/SVGGElement.h @@ -43,8 +43,8 @@ namespace WebCore { virtual void parseMappedAttribute(MappedAttribute*); virtual void svgAttributeChanged(const QualifiedName&); virtual void synchronizeProperty(const QualifiedName&); - virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); + virtual bool rendererIsNeeded(RenderStyle*) { return true; } virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); private: diff --git a/WebCore/svg/SVGGradientElement.cpp b/WebCore/svg/SVGGradientElement.cpp index f573265..b4bdb16 100644 --- a/WebCore/svg/SVGGradientElement.cpp +++ b/WebCore/svg/SVGGradientElement.cpp @@ -1,6 +1,7 @@ /* Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> + Copyright (C) Research In Motion Limited 2010. 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 @@ -27,9 +28,9 @@ #include "MappedAttribute.h" #include "RenderPath.h" #include "RenderSVGHiddenContainer.h" +#include "RenderSVGResourceLinearGradient.h" +#include "RenderSVGResourceRadialGradient.h" #include "SVGNames.h" -#include "SVGPaintServerLinearGradient.h" -#include "SVGPaintServerRadialGradient.h" #include "SVGStopElement.h" #include "SVGTransformList.h" #include "SVGTransformable.h" @@ -84,16 +85,13 @@ void SVGGradientElement::svgAttributeChanged(const QualifiedName& attrName) { SVGStyledElement::svgAttributeChanged(attrName); - if (!m_resource) - return; - - if (attrName == SVGNames::gradientUnitsAttr || - attrName == SVGNames::gradientTransformAttr || - attrName == SVGNames::spreadMethodAttr || - SVGURIReference::isKnownAttribute(attrName) || - SVGExternalResourcesRequired::isKnownAttribute(attrName) || - SVGStyledElement::isKnownAttribute(attrName)) - m_resource->invalidate(); + if (attrName == SVGNames::gradientUnitsAttr + || attrName == SVGNames::gradientTransformAttr + || attrName == SVGNames::spreadMethodAttr + || SVGURIReference::isKnownAttribute(attrName) + || SVGExternalResourcesRequired::isKnownAttribute(attrName) + || SVGStyledElement::isKnownAttribute(attrName)) + invalidateResourceClients(); } void SVGGradientElement::synchronizeProperty(const QualifiedName& attrName) @@ -125,61 +123,34 @@ void SVGGradientElement::childrenChanged(bool changedByParser, Node* beforeChang { SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); - if (m_resource) - m_resource->invalidate(); + if (!changedByParser) + invalidateResourceClients(); } -RenderObject* SVGGradientElement::createRenderer(RenderArena* arena, RenderStyle*) +Vector<Gradient::ColorStop> SVGGradientElement::buildStops() { - return new (arena) RenderSVGHiddenContainer(this); -} - -SVGResource* SVGGradientElement::canvasResource(const RenderObject*) -{ - if (!m_resource) { - if (gradientType() == LinearGradientPaintServer) - m_resource = SVGPaintServerLinearGradient::create(this); - else - m_resource = SVGPaintServerRadialGradient::create(this); - } - - return m_resource.get(); -} - -Vector<SVGGradientStop> SVGGradientElement::buildStops() const -{ - Vector<SVGGradientStop> stops; - RefPtr<RenderStyle> gradientStyle; + Vector<Gradient::ColorStop> stops; + float previousOffset = 0.0f; for (Node* n = firstChild(); n; n = n->nextSibling()) { SVGElement* element = n->isSVGElement() ? static_cast<SVGElement*>(n) : 0; + if (!element || !element->isGradientStop()) + continue; - if (element && element->isGradientStop()) { - SVGStopElement* stop = static_cast<SVGStopElement*>(element); - float stopOffset = stop->offset(); + SVGStopElement* stop = static_cast<SVGStopElement*>(element); + Color color = stop->stopColorIncludingOpacity(); - Color color; - float opacity; + // Figure out right monotonic offset + float offset = stop->offset(); + offset = std::min(std::max(previousOffset, offset), 1.0f); + previousOffset = offset; - if (stop->renderer()) { - RenderStyle* stopStyle = stop->renderer()->style(); - color = stopStyle->svgStyle()->stopColor(); - opacity = stopStyle->svgStyle()->stopOpacity(); - } else { - // If there is no renderer for this stop element, then a parent element - // set display="none" - ie. <g display="none"><linearGradient><stop>.. - // Unfortunately we have to manually rebuild the stop style. See pservers-grad-19-b.svg - if (!gradientStyle) - gradientStyle = const_cast<SVGGradientElement*>(this)->styleForRenderer(); + // Extract individual channel values + // FIXME: Why doesn't ColorStop take a Color and an offset?? + float r, g, b, a; + color.getRGBA(r, g, b, a); - RefPtr<RenderStyle> stopStyle = stop->resolveStyle(gradientStyle.get()); - - color = stopStyle->svgStyle()->stopColor(); - opacity = stopStyle->svgStyle()->stopOpacity(); - } - - stops.append(makeGradientStop(stopOffset, makeRGBA(color.red(), color.green(), color.blue(), int(opacity * 255.)))); - } + stops.append(Gradient::ColorStop(offset, r, g, b, a)); } return stops; diff --git a/WebCore/svg/SVGGradientElement.h b/WebCore/svg/SVGGradientElement.h index 122e1d9..4447ec4 100644 --- a/WebCore/svg/SVGGradientElement.h +++ b/WebCore/svg/SVGGradientElement.h @@ -22,8 +22,7 @@ #define SVGGradientElement_h #if ENABLE(SVG) -#include "RenderObject.h" -#include "SVGPaintServerGradient.h" +#include "Gradient.h" #include "SVGExternalResourcesRequired.h" #include "SVGStyledElement.h" #include "SVGTransformList.h" @@ -43,20 +42,8 @@ namespace WebCore { virtual void synchronizeProperty(const QualifiedName&); virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual SVGResource* canvasResource(const RenderObject*); - - protected: - friend class SVGPaintServerGradient; - friend class SVGLinearGradientElement; - friend class SVGRadialGradientElement; - - virtual void buildGradient() const = 0; - virtual SVGPaintServerType gradientType() const = 0; - - Vector<SVGGradientStop> buildStops() const; - mutable RefPtr<SVGPaintServerGradient> m_resource; + Vector<Gradient::ColorStop> buildStops(); protected: DECLARE_ANIMATED_PROPERTY(SVGGradientElement, SVGNames::spreadMethodAttr, int, SpreadMethod, spreadMethod) diff --git a/WebCore/svg/SVGHKernElement.cpp b/WebCore/svg/SVGHKernElement.cpp index 0ee3e76..1b8746b 100644 --- a/WebCore/svg/SVGHKernElement.cpp +++ b/WebCore/svg/SVGHKernElement.cpp @@ -28,7 +28,6 @@ #include "SVGFontFaceElement.h" #include "SVGFontData.h" #include "SVGNames.h" -#include "SVGParserUtilities.h" #include "SimpleFontData.h" #include "XMLNames.h" @@ -67,11 +66,12 @@ SVGHorizontalKerningPair SVGHKernElement::buildHorizontalKerningPair() const { SVGHorizontalKerningPair kerningPair; - kerningPair.unicode1 = getAttribute(u1Attr); - kerningPair.glyphName1 = getAttribute(g1Attr); - kerningPair.unicode2 = getAttribute(u2Attr); - kerningPair.glyphName2 = getAttribute(g2Attr); - kerningPair.kerning = getAttribute(kAttr).string().toDouble(); + // FIXME: KerningPairs shouldn't be created on parsing errors. + parseGlyphName(getAttribute(g1Attr), kerningPair.glyphName1); + parseGlyphName(getAttribute(g2Attr), kerningPair.glyphName2); + parseKerningUnicodeString(getAttribute(u1Attr), kerningPair.unicodeRange1, kerningPair.unicodeName1); + parseKerningUnicodeString(getAttribute(u2Attr), kerningPair.unicodeRange2, kerningPair.unicodeName2); + kerningPair.kerning = getAttribute(kAttr).string().toFloat(); return kerningPair; } diff --git a/WebCore/svg/SVGHKernElement.h b/WebCore/svg/SVGHKernElement.h index 32772bd..3d13119 100644 --- a/WebCore/svg/SVGHKernElement.h +++ b/WebCore/svg/SVGHKernElement.h @@ -23,10 +23,10 @@ #define SVGHKernElement_h #if ENABLE(SVG_FONTS) +#include "SVGParserUtilities.h" #include "SVGStyledElement.h" #include <limits> -#include "Path.h" namespace WebCore { @@ -35,11 +35,13 @@ namespace WebCore { // Describe an SVG <hkern> element struct SVGHorizontalKerningPair { - String unicode1; - String glyphName1; - String unicode2; - String glyphName2; - double kerning; + UnicodeRanges unicodeRange1; + HashSet<String> unicodeName1; + HashSet<String> glyphName1; + UnicodeRanges unicodeRange2; + HashSet<String> unicodeName2; + HashSet<String> glyphName2; + float kerning; SVGHorizontalKerningPair() : kerning(0) diff --git a/WebCore/svg/SVGLinearGradientElement.cpp b/WebCore/svg/SVGLinearGradientElement.cpp index 665a1da..87021b1 100644 --- a/WebCore/svg/SVGLinearGradientElement.cpp +++ b/WebCore/svg/SVGLinearGradientElement.cpp @@ -3,6 +3,7 @@ 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 2008 Eric Seidel <eric@webkit.org> 2008 Dirk Schulze <krit@webkit.org> + Copyright (C) Research In Motion Limited 2010. 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 @@ -29,9 +30,9 @@ #include "FloatPoint.h" #include "LinearGradientAttributes.h" #include "MappedAttribute.h" +#include "RenderSVGResourceLinearGradient.h" #include "SVGLength.h" #include "SVGNames.h" -#include "SVGPaintServerLinearGradient.h" #include "SVGTransform.h" #include "SVGTransformList.h" #include "SVGUnitTypes.h" @@ -70,12 +71,11 @@ void SVGLinearGradientElement::svgAttributeChanged(const QualifiedName& attrName { SVGGradientElement::svgAttributeChanged(attrName); - if (!m_resource) - return; - - if (attrName == SVGNames::x1Attr || attrName == SVGNames::y1Attr || - attrName == SVGNames::x2Attr || attrName == SVGNames::y2Attr) - m_resource->invalidate(); + if (attrName == SVGNames::x1Attr + || attrName == SVGNames::y1Attr + || attrName == SVGNames::x2Attr + || attrName == SVGNames::y2Attr) + invalidateResourceClients(); } void SVGLinearGradientElement::synchronizeProperty(const QualifiedName& attrName) @@ -100,56 +100,18 @@ void SVGLinearGradientElement::synchronizeProperty(const QualifiedName& attrName synchronizeY2(); } -void SVGLinearGradientElement::buildGradient() const +RenderObject* SVGLinearGradientElement::createRenderer(RenderArena* arena, RenderStyle*) { - LinearGradientAttributes attributes = collectGradientProperties(); - - RefPtr<SVGPaintServerLinearGradient> linearGradient = WTF::static_pointer_cast<SVGPaintServerLinearGradient>(m_resource); - - FloatPoint startPoint; - FloatPoint endPoint; - if (attributes.boundingBoxMode()) { - startPoint = FloatPoint(attributes.x1().valueAsPercentage(), attributes.y1().valueAsPercentage()); - endPoint = FloatPoint(attributes.x2().valueAsPercentage(), attributes.y2().valueAsPercentage()); - } else { - startPoint = FloatPoint(attributes.x1().value(this), attributes.y1().value(this)); - endPoint = FloatPoint(attributes.x2().value(this), attributes.y2().value(this)); - } - - RefPtr<Gradient> gradient = Gradient::create(startPoint, endPoint); - gradient->setSpreadMethod(attributes.spreadMethod()); - - Vector<SVGGradientStop> m_stops = attributes.stops(); - float previousOffset = 0.0f; - for (unsigned i = 0; i < m_stops.size(); ++i) { - float offset = std::min(std::max(previousOffset, m_stops[i].first), 1.0f); - previousOffset = offset; - gradient->addColorStop(offset, m_stops[i].second); - } - - linearGradient->setGradient(gradient); - - if (attributes.stops().isEmpty()) - return; - - // This code should go away. PaintServers should go away too. - // Only this code should care about bounding boxes - linearGradient->setBoundingBoxMode(attributes.boundingBoxMode()); - linearGradient->setGradientStops(attributes.stops()); - - // These should possibly be supported on Gradient - linearGradient->setGradientTransform(attributes.gradientTransform()); - linearGradient->setGradientStart(startPoint); - linearGradient->setGradientEnd(endPoint); + return new (arena) RenderSVGResourceLinearGradient(this); } -LinearGradientAttributes SVGLinearGradientElement::collectGradientProperties() const +LinearGradientAttributes SVGLinearGradientElement::collectGradientProperties() { LinearGradientAttributes attributes; - HashSet<const SVGGradientElement*> processedGradients; + HashSet<SVGGradientElement*> processedGradients; bool isLinear = true; - const SVGGradientElement* current = this; + SVGGradientElement* current = this; while (current) { if (!attributes.hasSpreadMethod() && current->hasAttribute(SVGNames::spreadMethodAttr)) @@ -162,13 +124,13 @@ LinearGradientAttributes SVGLinearGradientElement::collectGradientProperties() c attributes.setGradientTransform(current->gradientTransform()->consolidate().matrix()); if (!attributes.hasStops()) { - const Vector<SVGGradientStop>& stops(current->buildStops()); + const Vector<Gradient::ColorStop>& stops(current->buildStops()); if (!stops.isEmpty()) attributes.setStops(stops); } if (isLinear) { - const SVGLinearGradientElement* linear = static_cast<const SVGLinearGradientElement*>(current); + SVGLinearGradientElement* linear = static_cast<SVGLinearGradientElement*>(current); if (!attributes.hasX1() && current->hasAttribute(SVGNames::x1Attr)) attributes.setX1(linear->x1()); @@ -188,13 +150,13 @@ LinearGradientAttributes SVGLinearGradientElement::collectGradientProperties() c // Respect xlink:href, take attributes from referenced element Node* refNode = ownerDocument()->getElementById(SVGURIReference::getTarget(current->href())); if (refNode && (refNode->hasTagName(SVGNames::linearGradientTag) || refNode->hasTagName(SVGNames::radialGradientTag))) { - current = static_cast<const SVGGradientElement*>(const_cast<const Node*>(refNode)); + current = static_cast<SVGGradientElement*>(refNode); // Cycle detection if (processedGradients.contains(current)) return LinearGradientAttributes(); - isLinear = current->gradientType() == LinearGradientPaintServer; + isLinear = current->hasTagName(SVGNames::linearGradientTag); } else current = 0; } @@ -202,6 +164,18 @@ LinearGradientAttributes SVGLinearGradientElement::collectGradientProperties() c return attributes; } +void SVGLinearGradientElement::calculateStartEndPoints(const LinearGradientAttributes& attributes, FloatPoint& startPoint, FloatPoint& endPoint) +{ + // Determine gradient start/end points + if (attributes.boundingBoxMode()) { + startPoint = FloatPoint(attributes.x1().valueAsPercentage(), attributes.y1().valueAsPercentage()); + endPoint = FloatPoint(attributes.x2().valueAsPercentage(), attributes.y2().valueAsPercentage()); + } else { + startPoint = FloatPoint(attributes.x1().value(this), attributes.y1().value(this)); + endPoint = FloatPoint(attributes.x2().value(this), attributes.y2().value(this)); + } +} + } #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGLinearGradientElement.h b/WebCore/svg/SVGLinearGradientElement.h index 0308c0e..f92fe80 100644 --- a/WebCore/svg/SVGLinearGradientElement.h +++ b/WebCore/svg/SVGLinearGradientElement.h @@ -38,11 +38,10 @@ namespace WebCore { virtual void svgAttributeChanged(const QualifiedName&); virtual void synchronizeProperty(const QualifiedName&); - protected: - virtual void buildGradient() const; - virtual SVGPaintServerType gradientType() const { return LinearGradientPaintServer; } + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - LinearGradientAttributes collectGradientProperties() const; + LinearGradientAttributes collectGradientProperties(); + void calculateStartEndPoints(const LinearGradientAttributes&, FloatPoint& startPoint, FloatPoint& endPoint); private: DECLARE_ANIMATED_PROPERTY(SVGLinearGradientElement, SVGNames::x1Attr, SVGLength, X1, x1) diff --git a/WebCore/svg/SVGMarkerElement.cpp b/WebCore/svg/SVGMarkerElement.cpp index ba9728f..79a445c 100644 --- a/WebCore/svg/SVGMarkerElement.cpp +++ b/WebCore/svg/SVGMarkerElement.cpp @@ -111,7 +111,7 @@ void SVGMarkerElement::svgAttributeChanged(const QualifiedName& attrName) SVGExternalResourcesRequired::isKnownAttribute(attrName) || SVGFitToViewBox::isKnownAttribute(attrName) || SVGStyledElement::isKnownAttribute(attrName)) - invalidateCanvasResources(); + invalidateResourceClients(); } void SVGMarkerElement::synchronizeProperty(const QualifiedName& attrName) @@ -157,7 +157,8 @@ void SVGMarkerElement::childrenChanged(bool changedByParser, Node* beforeChange, { SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); - invalidateCanvasResources(); + if (!changedByParser) + invalidateResourceClients(); } void SVGMarkerElement::setOrientToAuto() @@ -165,7 +166,7 @@ void SVGMarkerElement::setOrientToAuto() setOrientTypeBaseValue(SVG_MARKER_ORIENT_AUTO); setOrientAngleBaseValue(SVGAngle()); - invalidateCanvasResources(); + invalidateResourceClients(); } void SVGMarkerElement::setOrientToAngle(const SVGAngle& angle) @@ -173,7 +174,7 @@ void SVGMarkerElement::setOrientToAngle(const SVGAngle& angle) setOrientTypeBaseValue(SVG_MARKER_ORIENT_ANGLE); setOrientAngleBaseValue(angle); - invalidateCanvasResources(); + invalidateResourceClients(); } RenderObject* SVGMarkerElement::createRenderer(RenderArena* arena, RenderStyle*) diff --git a/WebCore/svg/SVGMaskElement.cpp b/WebCore/svg/SVGMaskElement.cpp index 67b0a98..6eb19fc 100644 --- a/WebCore/svg/SVGMaskElement.cpp +++ b/WebCore/svg/SVGMaskElement.cpp @@ -104,7 +104,7 @@ void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName) SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName) || SVGStyledElement::isKnownAttribute(attrName)) - invalidateCanvasResources(); + invalidateResourceClients(); } void SVGMaskElement::synchronizeProperty(const QualifiedName& attrName) @@ -138,7 +138,9 @@ void SVGMaskElement::synchronizeProperty(const QualifiedName& attrName) void SVGMaskElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) { SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); - invalidateCanvasResources(); + + if (!changedByParser) + invalidateResourceClients(); } FloatRect SVGMaskElement::maskBoundingBox(const FloatRect& objectBoundingBox) const diff --git a/WebCore/svg/SVGParserUtilities.cpp b/WebCore/svg/SVGParserUtilities.cpp index fc9ca5d..b24c3cc 100644 --- a/WebCore/svg/SVGParserUtilities.cpp +++ b/WebCore/svg/SVGParserUtilities.cpp @@ -44,6 +44,7 @@ #include "SVGPointList.h" #include "SVGPathElement.h" #include <math.h> +#include <wtf/ASCIICType.h> #include <wtf/MathExtras.h> namespace WebCore { @@ -840,6 +841,125 @@ bool pathSegListFromSVGData(SVGPathSegList* path, const String& d, bool process) return builder.build(path, d, process); } +void parseGlyphName(const String& input, HashSet<String>& values) +{ + values.clear(); + + const UChar* ptr = input.characters(); + const UChar* end = ptr + input.length(); + skipOptionalSpaces(ptr, end); + + while (ptr < end) { + // Leading and trailing white space, and white space before and after separators, will be ignored. + const UChar* inputStart = ptr; + while (ptr < end && *ptr != ',') + ++ptr; + + if (ptr == inputStart) + break; + + // walk backwards from the ; to ignore any whitespace + const UChar* inputEnd = ptr - 1; + while (inputStart < inputEnd && isWhitespace(*inputEnd)) + --inputEnd; + + values.add(String(inputStart, inputEnd - inputStart + 1)); + skipOptionalSpacesOrDelimiter(ptr, end, ','); + } +} + +static bool parseUnicodeRange(const UChar* characters, unsigned length, UnicodeRange& range) +{ + if (length < 2 || characters[0] != 'U' || characters[1] != '+') + return false; + + // Parse the starting hex number (or its prefix). + unsigned startRange = 0; + unsigned startLength = 0; + + const UChar* ptr = characters + 2; + const UChar* end = characters + length; + while (ptr < end) { + if (!isASCIIHexDigit(*ptr)) + break; + ++startLength; + if (startLength > 6) + return false; + startRange = (startRange << 4) | toASCIIHexValue(*ptr); + ++ptr; + } + + // Handle the case of ranges separated by "-" sign. + if (2 + startLength < length && *ptr == '-') { + if (!startLength) + return false; + + // Parse the ending hex number (or its prefix). + unsigned endRange = 0; + unsigned endLength = 0; + ++ptr; + while (ptr < end) { + if (!isASCIIHexDigit(*ptr)) + break; + ++endLength; + if (endLength > 6) + return false; + endRange = (endRange << 4) | toASCIIHexValue(*ptr); + ++ptr; + } + + if (!endLength) + return false; + + range.first = startRange; + range.second = endRange; + return true; + } + + // Handle the case of a number with some optional trailing question marks. + unsigned endRange = startRange; + while (ptr < end) { + if (*ptr != '?') + break; + ++startLength; + if (startLength > 6) + return false; + startRange <<= 4; + endRange = (endRange << 4) | 0xF; + ++ptr; + } + + if (!startLength) + return false; + + range.first = startRange; + range.second = endRange; + return true; +} + +void parseKerningUnicodeString(const String& input, UnicodeRanges& rangeList, HashSet<String>& stringList) +{ + const UChar* ptr = input.characters(); + const UChar* end = ptr + input.length(); + + while (ptr < end) { + const UChar* inputStart = ptr; + while (ptr < end && *ptr != ',') + ++ptr; + + if (ptr == inputStart) + break; + + // Try to parse unicode range first + UnicodeRange range; + if (parseUnicodeRange(inputStart, ptr - inputStart, range)) + rangeList.append(range); + else + stringList.add(String(inputStart, ptr - inputStart)); + ++ptr; + } +} + Vector<String> parseDelimitedString(const String& input, const char seperator) { Vector<String> values; diff --git a/WebCore/svg/SVGParserUtilities.h b/WebCore/svg/SVGParserUtilities.h index 8d3c9b2..3761688 100644 --- a/WebCore/svg/SVGParserUtilities.h +++ b/WebCore/svg/SVGParserUtilities.h @@ -23,6 +23,10 @@ #if ENABLE(SVG) #include "ParserUtilities.h" +#include <wtf/HashSet.h> + +typedef pair<unsigned, unsigned> UnicodeRange; +typedef Vector<UnicodeRange> UnicodeRanges; namespace WebCore { @@ -64,6 +68,8 @@ namespace WebCore { bool pathFromSVGData(Path& path, const String& d); bool pathSegListFromSVGData(SVGPathSegList* pathSegList, const String& d, bool process = false); Vector<String> parseDelimitedString(const String& input, const char seperator); + void parseKerningUnicodeString(const String& input, UnicodeRanges&, HashSet<String>& stringList); + void parseGlyphName(const String& input, HashSet<String>& values); } // namespace WebCore diff --git a/WebCore/svg/SVGPatternElement.cpp b/WebCore/svg/SVGPatternElement.cpp index 7659afa..3df6198 100644 --- a/WebCore/svg/SVGPatternElement.cpp +++ b/WebCore/svg/SVGPatternElement.cpp @@ -1,6 +1,7 @@ /* Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> + Copyright (C) Research In Motion Limited 2010. 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 @@ -31,9 +32,9 @@ #include "MappedAttribute.h" #include "PatternAttributes.h" #include "RenderSVGContainer.h" +#include "RenderSVGResourcePattern.h" #include "SVGLength.h" #include "SVGNames.h" -#include "SVGPaintServerPattern.h" #include "SVGRenderSupport.h" #include "SVGSVGElement.h" #include "SVGStyledTransformableElement.h" @@ -119,19 +120,20 @@ void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName) { SVGStyledElement::svgAttributeChanged(attrName); - if (!m_resource) - return; - - if (attrName == SVGNames::patternUnitsAttr || attrName == SVGNames::patternContentUnitsAttr || - attrName == SVGNames::patternTransformAttr || attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || - attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr || - SVGURIReference::isKnownAttribute(attrName) || - SVGTests::isKnownAttribute(attrName) || - SVGLangSpace::isKnownAttribute(attrName) || - SVGExternalResourcesRequired::isKnownAttribute(attrName) || - SVGFitToViewBox::isKnownAttribute(attrName) || - SVGStyledElement::isKnownAttribute(attrName)) - m_resource->invalidate(); + if (attrName == SVGNames::patternUnitsAttr + || attrName == SVGNames::patternContentUnitsAttr + || attrName == SVGNames::patternTransformAttr + || attrName == SVGNames::xAttr + || attrName == SVGNames::yAttr + || attrName == SVGNames::widthAttr + || attrName == SVGNames::heightAttr + || SVGURIReference::isKnownAttribute(attrName) + || SVGTests::isKnownAttribute(attrName) + || SVGLangSpace::isKnownAttribute(attrName) + || SVGExternalResourcesRequired::isKnownAttribute(attrName) + || SVGFitToViewBox::isKnownAttribute(attrName) + || SVGStyledElement::isKnownAttribute(attrName)) + invalidateResourceClients(); } void SVGPatternElement::synchronizeProperty(const QualifiedName& attrName) @@ -180,126 +182,13 @@ void SVGPatternElement::childrenChanged(bool changedByParser, Node* beforeChange { SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); - if (!m_resource) - return; - - m_resource->invalidate(); -} - -void SVGPatternElement::buildPattern(const FloatRect& targetRect) const -{ - PatternAttributes attributes = collectPatternProperties(); - - // If we didn't find any pattern content, ignore the request. - if (!attributes.patternContentElement() || !renderer() || !renderer()->style()) - return; - - FloatRect patternBoundaries; - FloatRect patternContentBoundaries; - - // Determine specified pattern size - if (attributes.boundingBoxMode()) - patternBoundaries = FloatRect(attributes.x().valueAsPercentage() * targetRect.width(), - attributes.y().valueAsPercentage() * targetRect.height(), - attributes.width().valueAsPercentage() * targetRect.width(), - attributes.height().valueAsPercentage() * targetRect.height()); - else - patternBoundaries = FloatRect(attributes.x().value(this), - attributes.y().value(this), - attributes.width().value(this), - attributes.height().value(this)); - - IntSize patternSize(patternBoundaries.width(), patternBoundaries.height()); - clampImageBufferSizeToViewport(document()->view(), patternSize); - - if (patternSize.width() < static_cast<int>(patternBoundaries.width())) - patternBoundaries.setWidth(patternSize.width()); - - if (patternSize.height() < static_cast<int>(patternBoundaries.height())) - patternBoundaries.setHeight(patternSize.height()); - - // Eventually calculate the pattern content boundaries (only needed with overflow="visible"). - RenderStyle* style = renderer()->style(); - if (style->overflowX() == OVISIBLE && style->overflowY() == OVISIBLE) { - for (Node* n = attributes.patternContentElement()->firstChild(); n; n = n->nextSibling()) { - if (!n->isSVGElement() || !static_cast<SVGElement*>(n)->isStyledTransformable() || !n->renderer()) - continue; - patternContentBoundaries.unite(n->renderer()->repaintRectInLocalCoordinates()); - } - } - - AffineTransform viewBoxCTM = viewBoxToViewTransform(viewBox(), preserveAspectRatio(), patternBoundaries.width(), patternBoundaries.height()); - FloatRect patternBoundariesIncludingOverflow = patternBoundaries; - - // Apply objectBoundingBoxMode fixup for patternContentUnits, if viewBox is not set. - if (!patternContentBoundaries.isEmpty()) { - if (!viewBoxCTM.isIdentity()) - patternContentBoundaries = viewBoxCTM.mapRect(patternContentBoundaries); - else if (attributes.boundingBoxModeContent()) - patternContentBoundaries = FloatRect(patternContentBoundaries.x() * targetRect.width(), - patternContentBoundaries.y() * targetRect.height(), - patternContentBoundaries.width() * targetRect.width(), - patternContentBoundaries.height() * targetRect.height()); - - patternBoundariesIncludingOverflow.unite(patternContentBoundaries); - } - - IntSize imageSize(lroundf(patternBoundariesIncludingOverflow.width()), lroundf(patternBoundariesIncludingOverflow.height())); - clampImageBufferSizeToViewport(document()->view(), imageSize); - - OwnPtr<ImageBuffer> patternImage = ImageBuffer::create(imageSize); - - if (!patternImage) - return; - - GraphicsContext* context = patternImage->context(); - ASSERT(context); - - context->save(); - - // Move to pattern start origin - if (patternBoundariesIncludingOverflow.location() != patternBoundaries.location()) { - context->translate(patternBoundaries.x() - patternBoundariesIncludingOverflow.x(), - patternBoundaries.y() - patternBoundariesIncludingOverflow.y()); - - patternBoundaries.setLocation(patternBoundariesIncludingOverflow.location()); - } - - // Process viewBox or boundingBoxModeContent correction - if (!viewBoxCTM.isIdentity()) - context->concatCTM(viewBoxCTM); - else if (attributes.boundingBoxModeContent()) { - context->translate(targetRect.x(), targetRect.y()); - context->scale(FloatSize(targetRect.width(), targetRect.height())); - } - - // Render subtree into ImageBuffer - for (Node* n = attributes.patternContentElement()->firstChild(); n; n = n->nextSibling()) { - if (!n->isSVGElement() || !static_cast<SVGElement*>(n)->isStyled() || !n->renderer()) - continue; - renderSubtreeToImage(patternImage.get(), n->renderer()); - } - - context->restore(); - - m_resource->setPatternTransform(attributes.patternTransform()); - m_resource->setPatternBoundaries(patternBoundaries); - m_resource->setTile(patternImage.release()); + if (!changedByParser) + invalidateResourceClients(); } RenderObject* SVGPatternElement::createRenderer(RenderArena* arena, RenderStyle*) { - RenderSVGContainer* patternContainer = new (arena) RenderSVGContainer(this); - patternContainer->setDrawsContents(false); - return patternContainer; -} - -SVGResource* SVGPatternElement::canvasResource(const RenderObject*) -{ - if (!m_resource) - m_resource = SVGPaintServerPattern::create(this); - - return m_resource.get(); + return new (arena) RenderSVGResourcePattern(this); } PatternAttributes SVGPatternElement::collectPatternProperties() const diff --git a/WebCore/svg/SVGPatternElement.h b/WebCore/svg/SVGPatternElement.h index fffbbca..014d2b4 100644 --- a/WebCore/svg/SVGPatternElement.h +++ b/WebCore/svg/SVGPatternElement.h @@ -22,11 +22,9 @@ #define SVGPatternElement_h #if ENABLE(SVG) -#include "RenderObject.h" #include "SVGExternalResourcesRequired.h" #include "SVGFitToViewBox.h" #include "SVGLangSpace.h" -#include "SVGPaintServerPattern.h" #include "SVGStyledElement.h" #include "SVGTests.h" #include "SVGTransformList.h" @@ -56,7 +54,8 @@ namespace WebCore { virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual SVGResource* canvasResource(const RenderObject*); + + PatternAttributes collectPatternProperties() const; private: DECLARE_ANIMATED_PROPERTY(SVGPatternElement, SVGNames::xAttr, SVGLength, X, x) @@ -75,15 +74,7 @@ namespace WebCore { // SVGPatternElement DECLARE_ANIMATED_PROPERTY(SVGPatternElement, SVGNames::viewBoxAttr, FloatRect, ViewBox, viewBox) - DECLARE_ANIMATED_PROPERTY(SVGPatternElement, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio) - - mutable RefPtr<SVGPaintServerPattern> m_resource; - - private: - friend class SVGPaintServerPattern; - void buildPattern(const FloatRect& targetRect) const; - - PatternAttributes collectPatternProperties() const; + DECLARE_ANIMATED_PROPERTY(SVGPatternElement, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio) }; } // namespace WebCore diff --git a/WebCore/svg/SVGPolyElement.cpp b/WebCore/svg/SVGPolyElement.cpp index 371c679..73940dc 100644 --- a/WebCore/svg/SVGPolyElement.cpp +++ b/WebCore/svg/SVGPolyElement.cpp @@ -88,7 +88,7 @@ void SVGPolyElement::svgAttributeChanged(const QualifiedName& attrName) // The points property is not a regular SVGAnimatedProperty, still we use the same SVG<->XML DOM synchronization framework. if (attrName == SVGNames::pointsAttr) - setSynchronizedSVGAttributes(false); + invalidateSVGAttributes(); RenderPath* renderer = static_cast<RenderPath*>(this->renderer()); if (!renderer) diff --git a/WebCore/svg/SVGPolyElement.h b/WebCore/svg/SVGPolyElement.h index b881ca2..88947de 100644 --- a/WebCore/svg/SVGPolyElement.h +++ b/WebCore/svg/SVGPolyElement.h @@ -48,7 +48,6 @@ namespace WebCore { virtual void svgAttributeChanged(const QualifiedName&); virtual void synchronizeProperty(const QualifiedName&); - virtual bool rendererIsNeeded(RenderStyle* style) { return StyledElement::rendererIsNeeded(style); } virtual bool supportsMarkers() const { return true; } private: diff --git a/WebCore/svg/SVGRadialGradientElement.cpp b/WebCore/svg/SVGRadialGradientElement.cpp index b153c0f..29cc1cc 100644 --- a/WebCore/svg/SVGRadialGradientElement.cpp +++ b/WebCore/svg/SVGRadialGradientElement.cpp @@ -3,6 +3,7 @@ 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 2008 Eric Seidel <eric@webkit.org> 2008 Dirk Schulze <krit@webkit.org> + Copyright (C) Research In Motion Limited 2010. 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 @@ -29,10 +30,9 @@ #include "FloatPoint.h" #include "MappedAttribute.h" #include "RadialGradientAttributes.h" -#include "RenderObject.h" +#include "RenderSVGResourceRadialGradient.h" #include "SVGLength.h" #include "SVGNames.h" -#include "SVGPaintServerRadialGradient.h" #include "SVGStopElement.h" #include "SVGTransform.h" #include "SVGTransformList.h" @@ -77,13 +77,12 @@ void SVGRadialGradientElement::svgAttributeChanged(const QualifiedName& attrName { SVGGradientElement::svgAttributeChanged(attrName); - if (!m_resource) - return; - - if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr || - attrName == SVGNames::fxAttr || attrName == SVGNames::fyAttr || - attrName == SVGNames::rAttr) - m_resource->invalidate(); + if (attrName == SVGNames::cxAttr + || attrName == SVGNames::cyAttr + || attrName == SVGNames::fxAttr + || attrName == SVGNames::fyAttr + || attrName == SVGNames::rAttr) + invalidateResourceClients(); } void SVGRadialGradientElement::synchronizeProperty(const QualifiedName& attrName) @@ -111,77 +110,18 @@ void SVGRadialGradientElement::synchronizeProperty(const QualifiedName& attrName synchronizeR(); } -void SVGRadialGradientElement::buildGradient() const +RenderObject* SVGRadialGradientElement::createRenderer(RenderArena* arena, RenderStyle*) { - RadialGradientAttributes attributes = collectGradientProperties(); - - RefPtr<SVGPaintServerRadialGradient> radialGradient = WTF::static_pointer_cast<SVGPaintServerRadialGradient>(m_resource); - - FloatPoint focalPoint; - FloatPoint centerPoint; - float radius; - if (attributes.boundingBoxMode()) { - focalPoint = FloatPoint(attributes.fx().valueAsPercentage(), attributes.fy().valueAsPercentage()); - centerPoint = FloatPoint(attributes.cx().valueAsPercentage(), attributes.cy().valueAsPercentage()); - radius = attributes.r().valueAsPercentage(); - } else { - focalPoint = FloatPoint(attributes.fx().value(this), attributes.fy().value(this)); - centerPoint = FloatPoint(attributes.cx().value(this), attributes.cy().value(this)); - radius = attributes.r().value(this); - } - - FloatPoint adjustedFocalPoint = focalPoint; - float dfx = focalPoint.x() - centerPoint.x(); - float dfy = focalPoint.y() - centerPoint.y(); - float rMax = 0.99f * radius; - - // Spec: If (fx, fy) lies outside the circle defined by (cx, cy) and - // r, set (fx, fy) to the point of intersection of the line through - // (fx, fy) and the circle. - // We scale the radius by 0.99 to match the behavior of FireFox. - if (sqrt(dfx * dfx + dfy * dfy) > rMax) { - float angle = atan2f(dfy, dfx); - - dfx = cosf(angle) * rMax; - dfy = sinf(angle) * rMax; - adjustedFocalPoint = FloatPoint(dfx + centerPoint.x(), dfy + centerPoint.y()); - } - - RefPtr<Gradient> gradient = Gradient::create( - adjustedFocalPoint, - 0.f, // SVG does not support a "focus radius" - centerPoint, - radius); - gradient->setSpreadMethod(attributes.spreadMethod()); - - Vector<SVGGradientStop> stops = attributes.stops(); - float previousOffset = 0.0f; - for (unsigned i = 0; i < stops.size(); ++i) { - float offset = std::min(std::max(previousOffset, stops[i].first), 1.0f); - previousOffset = offset; - gradient->addColorStop(offset, stops[i].second); - } - - radialGradient->setGradient(gradient); - - if (attributes.stops().isEmpty()) - return; - - radialGradient->setBoundingBoxMode(attributes.boundingBoxMode()); - radialGradient->setGradientTransform(attributes.gradientTransform()); - radialGradient->setGradientCenter(centerPoint); - radialGradient->setGradientFocal(focalPoint); - radialGradient->setGradientRadius(radius); - radialGradient->setGradientStops(attributes.stops()); + return new (arena) RenderSVGResourceRadialGradient(this); } -RadialGradientAttributes SVGRadialGradientElement::collectGradientProperties() const +RadialGradientAttributes SVGRadialGradientElement::collectGradientProperties() { RadialGradientAttributes attributes; - HashSet<const SVGGradientElement*> processedGradients; + HashSet<SVGGradientElement*> processedGradients; bool isRadial = true; - const SVGGradientElement* current = this; + SVGGradientElement* current = this; while (current) { if (!attributes.hasSpreadMethod() && current->hasAttribute(SVGNames::spreadMethodAttr)) @@ -194,13 +134,13 @@ RadialGradientAttributes SVGRadialGradientElement::collectGradientProperties() c attributes.setGradientTransform(current->gradientTransform()->consolidate().matrix()); if (!attributes.hasStops()) { - const Vector<SVGGradientStop>& stops(current->buildStops()); + const Vector<Gradient::ColorStop>& stops(current->buildStops()); if (!stops.isEmpty()) attributes.setStops(stops); } if (isRadial) { - const SVGRadialGradientElement* radial = static_cast<const SVGRadialGradientElement*>(current); + SVGRadialGradientElement* radial = static_cast<SVGRadialGradientElement*>(current); if (!attributes.hasCx() && current->hasAttribute(SVGNames::cxAttr)) attributes.setCx(radial->cx()); @@ -223,13 +163,13 @@ RadialGradientAttributes SVGRadialGradientElement::collectGradientProperties() c // Respect xlink:href, take attributes from referenced element Node* refNode = ownerDocument()->getElementById(SVGURIReference::getTarget(current->href())); if (refNode && (refNode->hasTagName(SVGNames::radialGradientTag) || refNode->hasTagName(SVGNames::linearGradientTag))) { - current = static_cast<const SVGGradientElement*>(const_cast<const Node*>(refNode)); + current = static_cast<SVGGradientElement*>(refNode); // Cycle detection if (processedGradients.contains(current)) return RadialGradientAttributes(); - isRadial = current->gradientType() == RadialGradientPaintServer; + isRadial = current->hasTagName(SVGNames::radialGradientTag); } else current = 0; } @@ -243,6 +183,37 @@ RadialGradientAttributes SVGRadialGradientElement::collectGradientProperties() c return attributes; } + +void SVGRadialGradientElement::calculateFocalCenterPointsAndRadius(const RadialGradientAttributes& attributes, FloatPoint& focalPoint, FloatPoint& centerPoint, float& radius) +{ + // Determine gradient focal/center points and radius + if (attributes.boundingBoxMode()) { + focalPoint = FloatPoint(attributes.fx().valueAsPercentage(), attributes.fy().valueAsPercentage()); + centerPoint = FloatPoint(attributes.cx().valueAsPercentage(), attributes.cy().valueAsPercentage()); + radius = attributes.r().valueAsPercentage(); + } else { + focalPoint = FloatPoint(attributes.fx().value(this), attributes.fy().value(this)); + centerPoint = FloatPoint(attributes.cx().value(this), attributes.cy().value(this)); + radius = attributes.r().value(this); + } + + // Eventually adjust focal points, as described below + float deltaX = focalPoint.x() - centerPoint.x(); + float deltaY = focalPoint.y() - centerPoint.y(); + float radiusMax = 0.99f * radius; + + // Spec: If (fx, fy) lies outside the circle defined by (cx, cy) and r, set + // (fx, fy) to the point of intersection of the line through (fx, fy) and the circle. + // We scale the radius by 0.99 to match the behavior of FireFox. + if (sqrt(deltaX * deltaX + deltaY * deltaY) > radiusMax) { + float angle = atan2f(deltaY, deltaX); + + deltaX = cosf(angle) * radiusMax; + deltaY = sinf(angle) * radiusMax; + focalPoint = FloatPoint(deltaX + centerPoint.x(), deltaY + centerPoint.y()); + } +} + } #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGRadialGradientElement.h b/WebCore/svg/SVGRadialGradientElement.h index 180948f..25219db 100644 --- a/WebCore/svg/SVGRadialGradientElement.h +++ b/WebCore/svg/SVGRadialGradientElement.h @@ -38,11 +38,10 @@ namespace WebCore { virtual void svgAttributeChanged(const QualifiedName&); virtual void synchronizeProperty(const QualifiedName&); - protected: - virtual void buildGradient() const; - virtual SVGPaintServerType gradientType() const { return RadialGradientPaintServer; } + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - RadialGradientAttributes collectGradientProperties() const; + RadialGradientAttributes collectGradientProperties(); + void calculateFocalCenterPointsAndRadius(const RadialGradientAttributes&, FloatPoint& focalPoint, FloatPoint& centerPoint, float& radius); private: DECLARE_ANIMATED_PROPERTY(SVGRadialGradientElement, SVGNames::cxAttr, SVGLength, Cx, cx) diff --git a/WebCore/svg/SVGStopElement.cpp b/WebCore/svg/SVGStopElement.cpp index 3c97827..3ac2d5b 100644 --- a/WebCore/svg/SVGStopElement.cpp +++ b/WebCore/svg/SVGStopElement.cpp @@ -49,8 +49,6 @@ void SVGStopElement::parseMappedAttribute(MappedAttribute* attr) setOffsetBaseValue(value.left(value.length() - 1).toFloat() / 100.0f); else setOffsetBaseValue(value.toFloat()); - - setNeedsStyleRecalc(); } else SVGStyledElement::parseMappedAttribute(attr); } @@ -68,6 +66,15 @@ RenderObject* SVGStopElement::createRenderer(RenderArena* arena, RenderStyle*) return new (arena) RenderSVGGradientStop(this); } +Color SVGStopElement::stopColorIncludingOpacity() const +{ + ASSERT(renderer()); + ASSERT(renderer()->style()); + + const SVGRenderStyle* svgStyle = renderer()->style()->svgStyle(); + return colorWithOverrideAlpha(svgStyle->stopColor().rgb(), svgStyle->stopOpacity()); +} + } #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGStopElement.h b/WebCore/svg/SVGStopElement.h index 23c09bb..222dd4d 100644 --- a/WebCore/svg/SVGStopElement.h +++ b/WebCore/svg/SVGStopElement.h @@ -32,13 +32,14 @@ namespace WebCore { SVGStopElement(const QualifiedName&, Document*); virtual ~SVGStopElement(); + virtual void parseMappedAttribute(MappedAttribute*); virtual void synchronizeProperty(const QualifiedName&); + Color stopColorIncludingOpacity() const; + private: virtual bool isGradientStop() const { return true; } - virtual void parseMappedAttribute(MappedAttribute*); - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); DECLARE_ANIMATED_PROPERTY(SVGStopElement, SVGNames::offsetAttr, float, Offset, offset) diff --git a/WebCore/svg/SVGStyledElement.cpp b/WebCore/svg/SVGStyledElement.cpp index 22c2008..9a3f950 100644 --- a/WebCore/svg/SVGStyledElement.cpp +++ b/WebCore/svg/SVGStyledElement.cpp @@ -41,8 +41,8 @@ #include "SVGNames.h" #include "SVGRenderStyle.h" #include "SVGRenderSupport.h" -#include "SVGResource.h" #include "SVGSVGElement.h" +#include "SVGUseElement.h" #include <wtf/Assertions.h> namespace WebCore { @@ -63,7 +63,50 @@ SVGStyledElement::SVGStyledElement(const QualifiedName& tagName, Document* doc) SVGStyledElement::~SVGStyledElement() { - SVGResource::removeClient(this); +} + +String SVGStyledElement::title() const +{ + // According to spec, we should not return titles when hovering over <svg> elements (those + // <title> elements are the title of the document, not a tooltip) so we instantly return. + if (hasTagName(SVGNames::svgTag)) + return String(); + + // Walk up the tree, to find out whether we're inside a <use> shadow tree, to find the right title. + Node* parent = const_cast<SVGStyledElement*>(this); + while (parent) { + if (!parent->isShadowNode()) { + parent = parent->parentNode(); + continue; + } + + // Get the <use> element. + Node* shadowParent = parent->shadowParentNode(); + if (shadowParent && shadowParent->isSVGElement() && shadowParent->hasTagName(SVGNames::useTag)) { + SVGUseElement* useElement = static_cast<SVGUseElement*>(shadowParent); + // If the <use> title is not empty we found the title to use. + String useTitle(useElement->title()); + if (useTitle.isEmpty()) + break; + return useTitle; + } + parent = parent->parentNode(); + } + + // If we aren't an instance in a <use> or the <use> title was not found, then find the first + // <title> child of this element. + Element* titleElement = firstElementChild(); + for (; titleElement; titleElement = titleElement->nextElementSibling()) { + if (titleElement->hasTagName(SVGNames::titleTag) && titleElement->isSVGElement()) + break; + } + + // If a title child was found, return the text contents. + if (titleElement) + return titleElement->innerText(); + + // Otherwise return a null/empty string. + return String(); } bool SVGStyledElement::rendererIsNeeded(RenderStyle* style) @@ -200,19 +243,21 @@ void SVGStyledElement::svgAttributeChanged(const QualifiedName& attrName) if (attrName.matches(HTMLNames::classAttr)) classAttributeChanged(className()); + RenderObject* object = renderer(); + if (attrName == idAttributeName()) { // Notify resources about id changes, this is important as we cache resources by id in SVGDocumentExtensions - if (renderer() && renderer()->isSVGResource()) { - RenderSVGResource* resource = renderer()->toRenderSVGResource(); - resource->idChanged(); - } + if (object && object->isSVGResourceContainer()) + object->toRenderSVGResourceContainer()->idChanged(); } - // If we're the child of a resource element, be sure to invalidate it. - invalidateResourcesInAncestorChain(); + if (!document()->parsing() && object) { + // If we're the child of a resource element, tell the resource (and eventually its resources) that we've changed. + invalidateResourcesInAncestorChain(); - // If the element is using resources, invalidate them. - invalidateResources(); + // If we're referencing resources, tell them we've changed. + deregisterFromResources(object); + } // Invalidate all SVGElementInstances associated with us SVGElementInstance::invalidateAllInstancesOfElement(this); @@ -226,20 +271,6 @@ void SVGStyledElement::synchronizeProperty(const QualifiedName& attrName) synchronizeClassName(); } -void SVGStyledElement::invalidateResources() -{ - RenderObject* object = renderer(); - if (!object) - return; - - Document* document = this->document(); - - if (document->parsing()) - return; - - deregisterFromResources(object); -} - void SVGStyledElement::invalidateResourcesInAncestorChain() const { Node* node = parentNode(); @@ -248,25 +279,25 @@ void SVGStyledElement::invalidateResourcesInAncestorChain() const break; SVGElement* element = static_cast<SVGElement*>(node); - if (SVGStyledElement* styledElement = static_cast<SVGStyledElement*>(element->isStyled() ? element : 0)) - styledElement->invalidateCanvasResources(); + if (SVGStyledElement* styledElement = static_cast<SVGStyledElement*>(element->isStyled() ? element : 0)) { + styledElement->invalidateResourceClients(); + + // If we found the first resource in the ancestor chain, immediately stop. + break; + } node = node->parentNode(); } } -void SVGStyledElement::invalidateCanvasResources() +void SVGStyledElement::invalidateResourceClients() { RenderObject* object = renderer(); if (!object) return; - if (object->isSVGResource()) - object->toRenderSVGResource()->invalidateClients(); - - // The following lines will be removed soon, once all resources are handled by renderers. - if (SVGResource* resource = canvasResource(object)) - resource->invalidate(); + if (object->isSVGResourceContainer()) + object->toRenderSVGResourceContainer()->invalidateClients(); } void SVGStyledElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) @@ -274,7 +305,8 @@ void SVGStyledElement::childrenChanged(bool changedByParser, Node* beforeChange, SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); // Invalidate all SVGElementInstances associated with us - SVGElementInstance::invalidateAllInstancesOfElement(this); + if (!changedByParser) + SVGElementInstance::invalidateAllInstancesOfElement(this); } PassRefPtr<RenderStyle> SVGStyledElement::resolveStyle(RenderStyle* parentStyle) @@ -309,12 +341,6 @@ PassRefPtr<CSSValue> SVGStyledElement::getPresentationAttribute(const String& na return cssSVGAttr->style()->getPropertyCSSValue(name); } -void SVGStyledElement::detach() -{ - SVGResource::removeClient(this); - SVGElement::detach(); -} - bool SVGStyledElement::instanceUpdatesBlocked() const { return hasRareSVGData() && rareSVGData()->instanceUpdatesBlocked(); diff --git a/WebCore/svg/SVGStyledElement.h b/WebCore/svg/SVGStyledElement.h index ea19aa5..69d7e96 100644 --- a/WebCore/svg/SVGStyledElement.h +++ b/WebCore/svg/SVGStyledElement.h @@ -29,8 +29,6 @@ namespace WebCore { - class SVGResource; - void mapAttributeToCSSProperty(HashMap<AtomicStringImpl*, int>* propertyNameToIdMap, const QualifiedName& attrName); class SVGStyledElement : public SVGElement, @@ -39,6 +37,8 @@ namespace WebCore { SVGStyledElement(const QualifiedName&, Document*); virtual ~SVGStyledElement(); + virtual String title() const; + virtual bool hasRelativeValues() const { return false; } virtual bool isStyled() const { return true; } virtual bool supportsMarkers() const { return false; } @@ -49,7 +49,6 @@ namespace WebCore { bool isKnownAttribute(const QualifiedName&); virtual bool rendererIsNeeded(RenderStyle*); - virtual SVGResource* canvasResource(const RenderObject*) { return 0; } virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; virtual void parseMappedAttribute(MappedAttribute*); @@ -61,10 +60,8 @@ namespace WebCore { // Centralized place to force a manual style resolution. Hacky but needed for now. PassRefPtr<RenderStyle> resolveStyle(RenderStyle* parentStyle); + void invalidateResourceClients(); void invalidateResourcesInAncestorChain() const; - void invalidateResources(); - - virtual void detach(); bool instanceUpdatesBlocked() const; void setInstanceUpdatesBlocked(bool); @@ -74,8 +71,6 @@ namespace WebCore { protected: static int cssPropertyIdForSVGAttributeName(const QualifiedName&); - void invalidateCanvasResources(); - private: DECLARE_ANIMATED_PROPERTY(SVGStyledElement, HTMLNames::classAttr, String, ClassName, className) }; diff --git a/WebCore/svg/SVGTextContentElement.cpp b/WebCore/svg/SVGTextContentElement.cpp index b28536b..3f1ec49 100644 --- a/WebCore/svg/SVGTextContentElement.cpp +++ b/WebCore/svg/SVGTextContentElement.cpp @@ -32,7 +32,7 @@ #include "MappedAttribute.h" #include "Position.h" #include "RenderSVGText.h" -#include "SVGCharacterLayoutInfo.h" +#include "SVGCharacterData.h" #include "SVGInlineTextBox.h" #include "SVGLength.h" #include "SVGNames.h" diff --git a/WebCore/svg/SVGTextPathElement.h b/WebCore/svg/SVGTextPathElement.h index ff09ed2..0862335 100644 --- a/WebCore/svg/SVGTextPathElement.h +++ b/WebCore/svg/SVGTextPathElement.h @@ -58,7 +58,6 @@ namespace WebCore { virtual void parseMappedAttribute(MappedAttribute*); virtual void synchronizeProperty(const QualifiedName&); - virtual bool rendererIsNeeded(RenderStyle* style) { return StyledElement::rendererIsNeeded(style); } virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); bool childShouldCreateRenderer(Node*) const; diff --git a/WebCore/svg/SVGURIReference.cpp b/WebCore/svg/SVGURIReference.cpp index 5fe71ab..5dbdfb8 100644 --- a/WebCore/svg/SVGURIReference.cpp +++ b/WebCore/svg/SVGURIReference.cpp @@ -60,8 +60,8 @@ String SVGURIReference::getTarget(const String& url) } else if (url.find('#') > -1) { // format is #target unsigned int start = url.find('#') + 1; return url.substring(start, url.length() - start); - } else // Normal Reference, ie. style="color-profile:changeColor" - return url; + } else // The url doesn't have any target. + return String(); } } diff --git a/WebCore/svg/graphics/SVGImage.cpp b/WebCore/svg/graphics/SVGImage.cpp index 11d3f60..97ef710 100644 --- a/WebCore/svg/graphics/SVGImage.cpp +++ b/WebCore/svg/graphics/SVGImage.cpp @@ -186,13 +186,22 @@ void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const Fl context->clip(enclosingIntRect(dstRect)); if (compositeOp != CompositeSourceOver) context->beginTransparencyLayer(1); - context->translate(dstRect.location().x(), dstRect.location().y()); - context->scale(FloatSize(dstRect.width() / srcRect.width(), dstRect.height() / srcRect.height())); + + FloatSize scale(dstRect.width() / srcRect.width(), dstRect.height() / srcRect.height()); + + // We can only draw the entire frame, clipped to the rect we want. So compute where the top left + // of the image would be if we were drawing without clipping, and translate accordingly. + FloatSize topLeftOffset(srcRect.location().x() * scale.width(), srcRect.location().y() * scale.height()); + FloatPoint destOffset = dstRect.location() - topLeftOffset; + + context->translate(destOffset.x(), destOffset.y()); + context->scale(scale); view->resize(size()); if (view->needsLayout()) view->layout(); + view->paint(context, IntRect(0, 0, view->width(), view->height())); if (compositeOp != CompositeSourceOver) diff --git a/WebCore/svg/graphics/SVGPaintServer.h b/WebCore/svg/graphics/SVGPaintServer.h deleted file mode 100644 index d9d2218..0000000 --- a/WebCore/svg/graphics/SVGPaintServer.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SVGPaintServer_h -#define SVGPaintServer_h - -#if ENABLE(SVG) - -#include "DashArray.h" -#include "RenderObject.h" -#include "SVGResource.h" - -#if PLATFORM(CG) -#include <ApplicationServices/ApplicationServices.h> -#endif - -namespace WebCore { - - enum SVGPaintServerType { - // Painting mode - SolidPaintServer = 0, - PatternPaintServer = 1, - LinearGradientPaintServer = 2, - RadialGradientPaintServer = 3 - }; - - enum SVGPaintTargetType { - // Target mode - ApplyToFillTargetType = 1, - ApplyToStrokeTargetType = 2 - }; - - class GraphicsContext; - class RenderObject; - class RenderStyle; - class SVGPaintServerSolid; - - class SVGPaintServer : public SVGResource { - public: - virtual ~SVGPaintServer(); - - virtual SVGResourceType resourceType() const { return PaintServerResourceType; } - - virtual SVGPaintServerType type() const = 0; - virtual TextStream& externalRepresentation(TextStream&) const = 0; - - // To be implemented in platform specific code. - virtual void draw(GraphicsContext*&, const RenderObject*, SVGPaintTargetType) const; - virtual void teardown(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText = false) const; - virtual void renderPath(GraphicsContext*&, const RenderObject*, SVGPaintTargetType) const; - - virtual bool setup(GraphicsContext*&, const RenderObject*, const RenderStyle*, SVGPaintTargetType, bool isPaintingText = false) const = 0; - - bool setup(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText = false) const; - - static SVGPaintServer* strokePaintServer(const RenderStyle*, const RenderObject*); - static SVGPaintServer* fillPaintServer(const RenderStyle*, const RenderObject*); - static SVGPaintServerSolid* sharedSolidPaintServer(); - - protected: - SVGPaintServer(); - }; - - TextStream& operator<<(TextStream&, const SVGPaintServer&); - - SVGPaintServer* getPaintServerById(Document*, const AtomicString&, const RenderObject*); - - void applyStrokeStyleToContext(GraphicsContext*, const RenderStyle*, const RenderObject*); - DashArray dashArrayFromRenderingStyle(const RenderStyle* style, RenderStyle* rootStyle); -} // namespace WebCore - -#endif - -#endif // SVGPaintServer_h diff --git a/WebCore/svg/graphics/SVGPaintServerGradient.cpp b/WebCore/svg/graphics/SVGPaintServerGradient.cpp deleted file mode 100644 index 6e6ebfc..0000000 --- a/WebCore/svg/graphics/SVGPaintServerGradient.cpp +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> - * 2008 Eric Seidel <eric@webkit.org> - * 2008 Dirk Schulze <krit@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. - */ - -#include "config.h" - -#if ENABLE(SVG) -#include "SVGPaintServerGradient.h" - -#include "FloatConversion.h" -#include "GraphicsContext.h" -#include "ImageBuffer.h" -#include "RenderObject.h" -#include "RenderView.h" -#include "SVGGradientElement.h" -#include "SVGPaintServerLinearGradient.h" -#include "SVGPaintServerRadialGradient.h" -#include "SVGRenderSupport.h" -#include "SVGRenderTreeAsText.h" - -using namespace std; - -namespace WebCore { - -static TextStream& operator<<(TextStream& ts, GradientSpreadMethod m) -{ - switch (m) { - case SpreadMethodPad: - ts << "PAD"; break; - case SpreadMethodRepeat: - ts << "REPEAT"; break; - case SpreadMethodReflect: - ts << "REFLECT"; break; - } - - return ts; -} - -static TextStream& operator<<(TextStream& ts, const Vector<SVGGradientStop>& l) -{ - ts << "["; - for (Vector<SVGGradientStop>::const_iterator it = l.begin(); it != l.end(); ++it) { - ts << "(" << it->first << "," << it->second << ")"; - if (it + 1 != l.end()) - ts << ", "; - } - ts << "]"; - return ts; -} - -SVGPaintServerGradient::SVGPaintServerGradient(const SVGGradientElement* owner) - : m_boundingBoxMode(true) - , m_ownerElement(owner) -#if PLATFORM(CG) - , m_savedContext(0) - , m_imageBuffer(0) -#endif -{ - ASSERT(owner); -} - -SVGPaintServerGradient::~SVGPaintServerGradient() -{ -} - -Gradient* SVGPaintServerGradient::gradient() const -{ - return m_gradient.get(); -} - -void SVGPaintServerGradient::setGradient(PassRefPtr<Gradient> gradient) -{ - m_gradient = gradient; -} - -bool SVGPaintServerGradient::boundingBoxMode() const -{ - return m_boundingBoxMode; -} - -void SVGPaintServerGradient::setBoundingBoxMode(bool mode) -{ - m_boundingBoxMode = mode; -} - -AffineTransform SVGPaintServerGradient::gradientTransform() const -{ - return m_gradientTransform; -} - -void SVGPaintServerGradient::setGradientTransform(const AffineTransform& transform) -{ - m_gradientTransform = transform; -} - -#if PLATFORM(CG) -static inline AffineTransform absoluteTransformForRenderer(const RenderObject* object) -{ - AffineTransform absoluteTransform; - - const RenderObject* currentObject = object; - while (currentObject) { - absoluteTransform = currentObject->localToParentTransform() * absoluteTransform; - currentObject = currentObject->parent(); - } - - return absoluteTransform; -} - -static inline bool createMaskAndSwapContextForTextGradient( - GraphicsContext*& context, GraphicsContext*& savedContext, - OwnPtr<ImageBuffer>& imageBuffer, const RenderObject* object) -{ - const RenderObject* textRootBlock = findTextRootObject(object); - - AffineTransform transform = absoluteTransformForRenderer(textRootBlock); - FloatRect maskAbsoluteBoundingBox = transform.mapRect(textRootBlock->repaintRectInLocalCoordinates()); - - IntRect maskImageRect = enclosingIntRect(maskAbsoluteBoundingBox); - if (maskImageRect.isEmpty()) - return false; - - // Allocate an image buffer as big as the absolute unclipped size of the object - OwnPtr<ImageBuffer> maskImage = ImageBuffer::create(maskImageRect.size()); - if (!maskImage) - return false; - - GraphicsContext* maskImageContext = maskImage->context(); - - // Transform the mask image coordinate system to absolute screen coordinates - maskImageContext->translate(-maskAbsoluteBoundingBox.x(), -maskAbsoluteBoundingBox.y()); - maskImageContext->concatCTM(transform); - - imageBuffer.set(maskImage.release()); - savedContext = context; - context = maskImageContext; - - return true; -} - -static inline AffineTransform clipToTextMask(GraphicsContext* context, - OwnPtr<ImageBuffer>& imageBuffer, const RenderObject* object, - const SVGPaintServerGradient* gradientServer) -{ - const RenderObject* textRootBlock = findTextRootObject(object); - context->clipToImageBuffer(textRootBlock->repaintRectInLocalCoordinates(), imageBuffer.get()); - - AffineTransform matrix; - if (gradientServer->boundingBoxMode()) { - FloatRect maskBoundingBox = textRootBlock->objectBoundingBox(); - matrix.translate(maskBoundingBox.x(), maskBoundingBox.y()); - matrix.scaleNonUniform(maskBoundingBox.width(), maskBoundingBox.height()); - } - matrix.multiply(gradientServer->gradientTransform()); - return matrix; -} -#endif - -bool SVGPaintServerGradient::setup(GraphicsContext*& context, const RenderObject* object, const RenderStyle*style, SVGPaintTargetType type, bool isPaintingText) const -{ - m_ownerElement->buildGradient(); - - const SVGRenderStyle* svgStyle = style->svgStyle(); - bool isFilled = (type & ApplyToFillTargetType) && svgStyle->hasFill(); - bool isStroked = (type & ApplyToStrokeTargetType) && svgStyle->hasStroke(); - - ASSERT((isFilled && !isStroked) || (!isFilled && isStroked)); - - context->save(); - - if (isPaintingText) { -#if PLATFORM(CG) - if (!createMaskAndSwapContextForTextGradient(context, m_savedContext, m_imageBuffer, object)) { - context->restore(); - return false; - } -#endif - context->setTextDrawingMode(isFilled ? cTextFill : cTextStroke); - } - - if (isFilled) { - context->setAlpha(svgStyle->fillOpacity()); - context->setFillGradient(m_gradient); - context->setFillRule(svgStyle->fillRule()); - } - if (isStroked) { - context->setAlpha(svgStyle->strokeOpacity()); - context->setStrokeGradient(m_gradient); - applyStrokeStyleToContext(context, style, object); - } - - AffineTransform matrix; - // CG platforms will handle the gradient space transform for text in - // teardown, so we don't apply it here. For non-CG platforms, we - // want the text bounding box applied to the gradient space transform now, - // so the gradient shader can use it. -#if PLATFORM(CG) - if (boundingBoxMode() && !isPaintingText) { -#else - if (boundingBoxMode()) { -#endif - FloatRect bbox = object->objectBoundingBox(); - matrix.translate(bbox.x(), bbox.y()); - matrix.scaleNonUniform(bbox.width(), bbox.height()); - } - matrix.multiply(gradientTransform()); - m_gradient->setGradientSpaceTransform(matrix); - - return true; -} - -void SVGPaintServerGradient::teardown(GraphicsContext*& context, const RenderObject* object, SVGPaintTargetType, bool isPaintingText) const -{ -#if PLATFORM(CG) - // renderPath() is not used when painting text, so we paint the gradient during teardown() - if (isPaintingText && m_savedContext) { - // Restore on-screen drawing context - context = m_savedContext; - m_savedContext = 0; - - AffineTransform matrix = clipToTextMask(context, m_imageBuffer, object, this); - m_gradient->setGradientSpaceTransform(matrix); - context->setFillGradient(m_gradient); - - const RenderObject* textRootBlock = findTextRootObject(object); - context->fillRect(textRootBlock->repaintRectInLocalCoordinates()); - - m_imageBuffer.clear(); - } -#endif - context->restore(); -} - -TextStream& SVGPaintServerGradient::externalRepresentation(TextStream& ts) const -{ - // Gradients/patterns aren't setup, until they are used for painting. Work around that fact. - m_ownerElement->buildGradient(); - - // abstract, don't stream type - ts << "[stops=" << gradientStops() << "]"; - if (m_gradient->spreadMethod() != SpreadMethodPad) - ts << "[method=" << m_gradient->spreadMethod() << "]"; - if (!boundingBoxMode()) - ts << " [bounding box mode=" << boundingBoxMode() << "]"; - if (!gradientTransform().isIdentity()) - ts << " [transform=" << gradientTransform() << "]"; - - return ts; -} - -} // namespace WebCore - -#endif diff --git a/WebCore/svg/graphics/SVGPaintServerGradient.h b/WebCore/svg/graphics/SVGPaintServerGradient.h deleted file mode 100644 index 953b0d9..0000000 --- a/WebCore/svg/graphics/SVGPaintServerGradient.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> - * 2008 Eric Seidel <eric@webkit.org> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SVGPaintServerGradient_h -#define SVGPaintServerGradient_h - -#if ENABLE(SVG) - -#include "AffineTransform.h" -#include "Color.h" -#include "Gradient.h" -#include "GraphicsContext.h" -#include "SVGPaintServer.h" - -#include <wtf/RefCounted.h> -#include <wtf/RefPtr.h> - -namespace WebCore { - - class ImageBuffer; - class SVGGradientElement; - - typedef std::pair<float, Color> SVGGradientStop; - - class SVGPaintServerGradient : public SVGPaintServer { - public: - virtual ~SVGPaintServerGradient(); - - void setGradient(PassRefPtr<Gradient>); - Gradient* gradient() const; - - // Gradient start and end points are percentages when used in boundingBox mode. - // For instance start point with value (0,0) is top-left and end point with - // value (100, 100) is bottom-right. BoundingBox mode is enabled by default. - bool boundingBoxMode() const; - void setBoundingBoxMode(bool mode = true); - - AffineTransform gradientTransform() const; - void setGradientTransform(const AffineTransform&); - - void setGradientStops(const Vector<SVGGradientStop>& stops) { m_stops = stops; } - const Vector<SVGGradientStop>& gradientStops() const { return m_stops; } - - virtual TextStream& externalRepresentation(TextStream&) const; - - virtual bool setup(GraphicsContext*&, const RenderObject*, const RenderStyle*, SVGPaintTargetType, bool isPaintingText) const; - virtual void teardown(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText) const; - - protected: - SVGPaintServerGradient(const SVGGradientElement* owner); - - private: - Vector<SVGGradientStop> m_stops; - RefPtr<Gradient> m_gradient; - bool m_boundingBoxMode; - AffineTransform m_gradientTransform; - const SVGGradientElement* m_ownerElement; - -#if PLATFORM(CG) - public: - mutable GraphicsContext* m_savedContext; - mutable OwnPtr<ImageBuffer> m_imageBuffer; -#endif - }; - - inline SVGGradientStop makeGradientStop(float offset, const Color& color) - { - return std::make_pair(offset, color); - } - -} // namespace WebCore - -#endif - -#endif // SVGPaintServerGradient_h diff --git a/WebCore/svg/graphics/SVGPaintServerLinearGradient.cpp b/WebCore/svg/graphics/SVGPaintServerLinearGradient.cpp deleted file mode 100644 index 08db2d2..0000000 --- a/WebCore/svg/graphics/SVGPaintServerLinearGradient.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(SVG) -#include "SVGPaintServerLinearGradient.h" -#include "SVGRenderTreeAsText.h" - -namespace WebCore { - -SVGPaintServerLinearGradient::SVGPaintServerLinearGradient(const SVGGradientElement* owner) - : SVGPaintServerGradient(owner) -{ -} - -SVGPaintServerLinearGradient::~SVGPaintServerLinearGradient() -{ -} - -FloatPoint SVGPaintServerLinearGradient::gradientStart() const -{ - return m_start; -} - -void SVGPaintServerLinearGradient::setGradientStart(const FloatPoint& start) -{ - m_start = start; -} - -FloatPoint SVGPaintServerLinearGradient::gradientEnd() const -{ - return m_end; -} - -void SVGPaintServerLinearGradient::setGradientEnd(const FloatPoint& end) -{ - m_end = end; -} - -TextStream& SVGPaintServerLinearGradient::externalRepresentation(TextStream& ts) const -{ - ts << "[type=LINEAR-GRADIENT] "; - SVGPaintServerGradient::externalRepresentation(ts); - ts << " [start=" << gradientStart() << "]" - << " [end=" << gradientEnd() << "]"; - return ts; -} - -} // namespace WebCore - -#endif diff --git a/WebCore/svg/graphics/SVGPaintServerLinearGradient.h b/WebCore/svg/graphics/SVGPaintServerLinearGradient.h deleted file mode 100644 index f0568c7..0000000 --- a/WebCore/svg/graphics/SVGPaintServerLinearGradient.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SVGPaintServerLinearGradient_h -#define SVGPaintServerLinearGradient_h - -#if ENABLE(SVG) - -#include "FloatPoint.h" -#include "SVGPaintServerGradient.h" - -namespace WebCore { - - class SVGPaintServerLinearGradient : public SVGPaintServerGradient { - public: - static PassRefPtr<SVGPaintServerLinearGradient> create(const SVGGradientElement* owner) { return adoptRef(new SVGPaintServerLinearGradient(owner)); } - virtual ~SVGPaintServerLinearGradient(); - - virtual SVGPaintServerType type() const { return LinearGradientPaintServer; } - - FloatPoint gradientStart() const; - void setGradientStart(const FloatPoint&); - - FloatPoint gradientEnd() const; - void setGradientEnd(const FloatPoint&); - - virtual TextStream& externalRepresentation(TextStream&) const; - - private: - SVGPaintServerLinearGradient(const SVGGradientElement* owner); - - FloatPoint m_start; - FloatPoint m_end; - }; - -} // namespace WebCore - -#endif - -#endif // SVGPaintServerLinearGradient_h diff --git a/WebCore/svg/graphics/SVGPaintServerPattern.cpp b/WebCore/svg/graphics/SVGPaintServerPattern.cpp deleted file mode 100644 index 7fc75fb..0000000 --- a/WebCore/svg/graphics/SVGPaintServerPattern.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> - * 2008 Dirk Schulze <krit@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. - */ - -#include "config.h" - -#if ENABLE(SVG) -#include "SVGPaintServerPattern.h" - -#include "AffineTransform.h" -#include "GraphicsContext.h" -#include "Image.h" -#include "ImageBuffer.h" -#include "Pattern.h" -#include "RenderObject.h" -#include "SVGPatternElement.h" -#include "SVGRenderTreeAsText.h" - -using namespace std; - -namespace WebCore { - -SVGPaintServerPattern::SVGPaintServerPattern(const SVGPatternElement* owner) - : m_ownerElement(owner) - , m_pattern(0) -{ - ASSERT(owner); -} - -SVGPaintServerPattern::~SVGPaintServerPattern() -{ -} - -FloatRect SVGPaintServerPattern::patternBoundaries() const -{ - return m_patternBoundaries; -} - -void SVGPaintServerPattern::setPatternBoundaries(const FloatRect& rect) -{ - m_patternBoundaries = rect; -} - -ImageBuffer* SVGPaintServerPattern::tile() const -{ - return m_tile.get(); -} - -void SVGPaintServerPattern::setTile(PassOwnPtr<ImageBuffer> tile) -{ - m_tile = tile; -} - -AffineTransform SVGPaintServerPattern::patternTransform() const -{ - return m_patternTransform; -} - -void SVGPaintServerPattern::setPatternTransform(const AffineTransform& transform) -{ - m_patternTransform = transform; -} - -TextStream& SVGPaintServerPattern::externalRepresentation(TextStream& ts) const -{ - // Gradients/patterns aren't setup, until they are used for painting. Work around that fact. - m_ownerElement->buildPattern(FloatRect(0.0f, 0.0f, 1.0f, 1.0f)); - - ts << "[type=PATTERN]" - << " [bbox=" << patternBoundaries() << "]"; - if (!patternTransform().isIdentity()) - ts << " [pattern transform=" << patternTransform() << "]"; - return ts; -} - -bool SVGPaintServerPattern::setup(GraphicsContext*& context, const RenderObject* object, const RenderStyle* style, SVGPaintTargetType type, bool isPaintingText) const -{ - FloatRect targetRect = object->objectBoundingBox(); - - const SVGRenderStyle* svgStyle = style->svgStyle(); - bool isFilled = (type & ApplyToFillTargetType) && svgStyle->hasFill(); - bool isStroked = (type & ApplyToStrokeTargetType) && svgStyle->hasStroke(); - - ASSERT((isFilled && !isStroked) || (!isFilled && isStroked)); - - m_ownerElement->buildPattern(targetRect); - if (!tile()) - return false; - - context->save(); - - ASSERT(!m_pattern); - - IntRect tileRect = tile()->image()->rect(); - if (tileRect.width() > patternBoundaries().width() || tileRect.height() > patternBoundaries().height()) { - // Draw the first cell of the pattern manually to support overflow="visible" on all platforms. - int tileWidth = static_cast<int>(patternBoundaries().width() + 0.5f); - int tileHeight = static_cast<int>(patternBoundaries().height() + 0.5f); - OwnPtr<ImageBuffer> tileImage = ImageBuffer::create(IntSize(tileWidth, tileHeight)); - - GraphicsContext* tileImageContext = tileImage->context(); - - int numY = static_cast<int>(ceilf(tileRect.height() / tileHeight)) + 1; - int numX = static_cast<int>(ceilf(tileRect.width() / tileWidth)) + 1; - - tileImageContext->save(); - tileImageContext->translate(-patternBoundaries().width() * numX, -patternBoundaries().height() * numY); - for (int i = numY; i > 0; i--) { - tileImageContext->translate(0, patternBoundaries().height()); - for (int j = numX; j > 0; j--) { - tileImageContext->translate(patternBoundaries().width(), 0); - tileImageContext->drawImage(tile()->image(), style->colorSpace(), tileRect, tileRect); - } - tileImageContext->translate(-patternBoundaries().width() * numX, 0); - } - tileImageContext->restore(); - - m_pattern = Pattern::create(tileImage->image(), true, true); - } - else - m_pattern = Pattern::create(tile()->image(), true, true); - - if (isFilled) { - context->setAlpha(svgStyle->fillOpacity()); - context->setFillPattern(m_pattern); - context->setFillRule(svgStyle->fillRule()); - } - if (isStroked) { - context->setAlpha(svgStyle->strokeOpacity()); - context->setStrokePattern(m_pattern); - applyStrokeStyleToContext(context, style, object); - } - - AffineTransform matrix; - matrix.translate(patternBoundaries().x(), patternBoundaries().y()); - matrix.multiply(patternTransform()); - m_pattern->setPatternSpaceTransform(matrix); - - if (isPaintingText) { - context->setTextDrawingMode(isFilled ? cTextFill : cTextStroke); -#if PLATFORM(CG) - if (isFilled) - context->applyFillPattern(); - else - context->applyStrokePattern(); -#endif - } - - return true; -} - -void SVGPaintServerPattern::teardown(GraphicsContext*& context, const RenderObject*, SVGPaintTargetType, bool) const -{ - m_pattern = 0; - - context->restore(); -} - -} // namespace WebCore - -#endif diff --git a/WebCore/svg/graphics/SVGPaintServerPattern.h b/WebCore/svg/graphics/SVGPaintServerPattern.h deleted file mode 100644 index 3d3da49..0000000 --- a/WebCore/svg/graphics/SVGPaintServerPattern.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SVGPaintServerPattern_h -#define SVGPaintServerPattern_h - -#if ENABLE(SVG) - -#include "AffineTransform.h" -#include "FloatRect.h" -#include "Pattern.h" -#include "SVGPaintServer.h" - -#include <memory> - -#include <wtf/OwnPtr.h> -#include <wtf/PassOwnPtr.h> - -namespace WebCore { - - class GraphicsContext; - class ImageBuffer; - class SVGPatternElement; - - class SVGPaintServerPattern : public SVGPaintServer { - public: - static PassRefPtr<SVGPaintServerPattern> create(const SVGPatternElement* owner) { return adoptRef(new SVGPaintServerPattern(owner)); } - - virtual ~SVGPaintServerPattern(); - - virtual SVGPaintServerType type() const { return PatternPaintServer; } - - // Pattern boundaries - void setPatternBoundaries(const FloatRect&); - FloatRect patternBoundaries() const; - - ImageBuffer* tile() const; - void setTile(PassOwnPtr<ImageBuffer>); - - AffineTransform patternTransform() const; - void setPatternTransform(const AffineTransform&); - - virtual TextStream& externalRepresentation(TextStream&) const; - - virtual bool setup(GraphicsContext*&, const RenderObject*, const RenderStyle*, SVGPaintTargetType, bool isPaintingText) const; - virtual void teardown(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText) const; - - private: - SVGPaintServerPattern(const SVGPatternElement*); - - OwnPtr<ImageBuffer> m_tile; - const SVGPatternElement* m_ownerElement; - AffineTransform m_patternTransform; - FloatRect m_patternBoundaries; - - mutable RefPtr<Pattern> m_pattern; - }; - -} // namespace WebCore - -#endif - -#endif // SVGPaintServerPattern_h diff --git a/WebCore/svg/graphics/SVGPaintServerRadialGradient.cpp b/WebCore/svg/graphics/SVGPaintServerRadialGradient.cpp deleted file mode 100644 index a795ab5..0000000 --- a/WebCore/svg/graphics/SVGPaintServerRadialGradient.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(SVG) -#include "SVGPaintServerRadialGradient.h" -#include "SVGRenderTreeAsText.h" - -namespace WebCore { - -SVGPaintServerRadialGradient::SVGPaintServerRadialGradient(const SVGGradientElement* owner) - : SVGPaintServerGradient(owner) - , m_radius(0.0f) -{ -} - -SVGPaintServerRadialGradient::~SVGPaintServerRadialGradient() -{ -} - - -FloatPoint SVGPaintServerRadialGradient::gradientCenter() const -{ - return m_center; -} - -void SVGPaintServerRadialGradient::setGradientCenter(const FloatPoint& center) -{ - m_center = center; -} - -FloatPoint SVGPaintServerRadialGradient::gradientFocal() const -{ - return m_focal; -} - -void SVGPaintServerRadialGradient::setGradientFocal(const FloatPoint& focal) -{ - m_focal = focal; -} - -float SVGPaintServerRadialGradient::gradientRadius() const -{ - return m_radius; -} - -void SVGPaintServerRadialGradient::setGradientRadius(float radius) -{ - m_radius = radius; -} - -TextStream& SVGPaintServerRadialGradient::externalRepresentation(TextStream& ts) const -{ - ts << "[type=RADIAL-GRADIENT] "; - SVGPaintServerGradient::externalRepresentation(ts); - ts << " [center=" << gradientCenter() << "]" - << " [focal=" << gradientFocal() << "]" - << " [radius=" << gradientRadius() << "]"; - return ts; -} - -} // namespace WebCore - -#endif diff --git a/WebCore/svg/graphics/SVGPaintServerRadialGradient.h b/WebCore/svg/graphics/SVGPaintServerRadialGradient.h deleted file mode 100644 index 749ba08..0000000 --- a/WebCore/svg/graphics/SVGPaintServerRadialGradient.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SVGPaintServerRadialGradient_h -#define SVGPaintServerRadialGradient_h - -#if ENABLE(SVG) - -#include "FloatPoint.h" -#include "SVGPaintServerGradient.h" - -namespace WebCore { - - class SVGPaintServerRadialGradient : public SVGPaintServerGradient { - public: - static PassRefPtr<SVGPaintServerRadialGradient> create(const SVGGradientElement* owner) { return adoptRef(new SVGPaintServerRadialGradient(owner)); } - virtual ~SVGPaintServerRadialGradient(); - - virtual SVGPaintServerType type() const { return RadialGradientPaintServer; } - - FloatPoint gradientCenter() const; - void setGradientCenter(const FloatPoint&); - - FloatPoint gradientFocal() const; - void setGradientFocal(const FloatPoint&); - - float gradientRadius() const; - void setGradientRadius(float); - - virtual TextStream& externalRepresentation(TextStream&) const; - - private: - SVGPaintServerRadialGradient(const SVGGradientElement* owner); - - float m_radius; - FloatPoint m_center; - FloatPoint m_focal; - }; - -} // namespace WebCore - -#endif - -#endif // SVGPaintServerRadialGradient_h diff --git a/WebCore/svg/graphics/SVGPaintServerSolid.cpp b/WebCore/svg/graphics/SVGPaintServerSolid.cpp deleted file mode 100644 index 8921bb0..0000000 --- a/WebCore/svg/graphics/SVGPaintServerSolid.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> - * Copyright (C) 2008 Dirk Schulze <krit@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. - */ - -#include "config.h" - -#if ENABLE(SVG) -#include "SVGPaintServerSolid.h" - -#include "GraphicsContext.h" -#include "RenderPath.h" -#include "SVGRenderTreeAsText.h" - -namespace WebCore { - -SVGPaintServerSolid::SVGPaintServerSolid() -{ -} - -SVGPaintServerSolid::~SVGPaintServerSolid() -{ -} - -Color SVGPaintServerSolid::color() const -{ - return m_color; -} - -void SVGPaintServerSolid::setColor(const Color& color) -{ - m_color = color; -} - -TextStream& SVGPaintServerSolid::externalRepresentation(TextStream& ts) const -{ - ts << "[type=SOLID]" - << " [color="<< color() << "]"; - return ts; -} - -bool SVGPaintServerSolid::setup(GraphicsContext*& context, const RenderObject* object, const RenderStyle* style, SVGPaintTargetType type, bool isPaintingText) const -{ - const SVGRenderStyle* svgStyle = style ? style->svgStyle() : 0; - ColorSpace colorSpace = style ? style->colorSpace() : DeviceColorSpace; - - if ((type & ApplyToFillTargetType) && (!style || svgStyle->hasFill())) { - context->setAlpha(style ? svgStyle->fillOpacity() : 1); - context->setFillColor(color().rgb(), colorSpace); - context->setFillRule(style ? svgStyle->fillRule() : RULE_NONZERO); - - if (isPaintingText) - context->setTextDrawingMode(cTextFill); - } - - if ((type & ApplyToStrokeTargetType) && (!style || svgStyle->hasStroke())) { - context->setAlpha(style ? svgStyle->strokeOpacity() : 1); - context->setStrokeColor(color().rgb(), colorSpace); - - if (style) - applyStrokeStyleToContext(context, style, object); - - if (isPaintingText) - context->setTextDrawingMode(cTextStroke); - } - - return true; -} - -} // namespace WebCore - -#endif diff --git a/WebCore/svg/graphics/SVGResource.cpp b/WebCore/svg/graphics/SVGResource.cpp deleted file mode 100644 index d1dd0e7..0000000 --- a/WebCore/svg/graphics/SVGResource.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (C) 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(SVG) -#include "SVGResource.h" - -#include "RenderPath.h" -#include "SVGElement.h" -#include "SVGStyledElement.h" -#include <wtf/HashSet.h> -#include <wtf/StdLibExtras.h> - -namespace WebCore { - -typedef HashSet<SVGResource*> ResourceSet; - -static ResourceSet& resourceSet() -{ - DEFINE_STATIC_LOCAL(ResourceSet, set, ()); - return set; -} - -SVGResource::SVGResource() -{ - ASSERT(!resourceSet().contains(this)); - resourceSet().add(this); -} - -SVGResource::~SVGResource() -{ - ASSERT(resourceSet().contains(this)); - resourceSet().remove(this); -} - -void SVGResource::invalidate() -{ - HashSet<SVGStyledElement*>::const_iterator it = m_clients.begin(); - const HashSet<SVGStyledElement*>::const_iterator end = m_clients.end(); - - for (; it != end; ++it) { - SVGStyledElement* cur = *it; - - if (cur->renderer()) - cur->renderer()->setNeedsLayout(true); - - cur->invalidateResourcesInAncestorChain(); - } -} - -void SVGResource::invalidateClients(HashSet<SVGStyledElement*> clients) -{ - HashSet<SVGStyledElement*>::const_iterator it = clients.begin(); - const HashSet<SVGStyledElement*>::const_iterator end = clients.end(); - - for (; it != end; ++it) { - SVGStyledElement* cur = *it; - - if (cur->renderer()) - cur->renderer()->setNeedsLayout(true); - - cur->invalidateResourcesInAncestorChain(); - } -} - -void SVGResource::removeClient(SVGStyledElement* item) -{ - ResourceSet::iterator it = resourceSet().begin(); - ResourceSet::iterator end = resourceSet().end(); - - for (; it != end; ++it) { - SVGResource* resource = *it; - if (!resource->m_clients.contains(item)) - continue; - resource->m_clients.remove(item); - } -} - -void SVGResource::addClient(SVGStyledElement* item) -{ - if (m_clients.contains(item)) - return; - - m_clients.add(item); -} - -TextStream& SVGResource::externalRepresentation(TextStream& ts) const -{ - return ts; -} - -SVGResource* getResourceById(Document* document, const AtomicString& id, const RenderObject* object) -{ - if (id.isEmpty()) - return 0; - - Element* element = document->getElementById(id); - SVGElement* svgElement = 0; - if (element && element->isSVGElement()) - svgElement = static_cast<SVGElement*>(element); - - if (svgElement && svgElement->isStyled()) - return static_cast<SVGStyledElement*>(svgElement)->canvasResource(object); - - return 0; -} - -TextStream& operator<<(TextStream& ts, const SVGResource& r) -{ - return r.externalRepresentation(ts); -} - -} - -#endif diff --git a/WebCore/svg/graphics/SVGResource.h b/WebCore/svg/graphics/SVGResource.h deleted file mode 100644 index 319add7..0000000 --- a/WebCore/svg/graphics/SVGResource.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SVGResource_h -#define SVGResource_h - -#if ENABLE(SVG) -#include "PlatformString.h" -#include "RenderObject.h" -#include "StringHash.h" - -#include <wtf/HashMap.h> -#include <wtf/HashSet.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -class AtomicString; -class Document; -class SVGStyledElement; -class TextStream; - -enum SVGResourceType { - // Painting mode - ImageResourceType, - PaintServerResourceType, - - // For resource tracking we need to know how many types of resource there are - _ResourceTypeCount -}; - -// The SVGResource file represent various graphics resources: -// - Pattern resource -// - Linear/Radial gradient resource -// -// SVG creates/uses these resources. - -class SVGResource : public RefCounted<SVGResource> { -public: - virtual ~SVGResource(); - - virtual void invalidate(); - - void addClient(SVGStyledElement*); - virtual SVGResourceType resourceType() const = 0; - - bool isPaintServer() const { return resourceType() == PaintServerResourceType; } - - virtual TextStream& externalRepresentation(TextStream&) const; - - static void invalidateClients(HashSet<SVGStyledElement*>); - static void removeClient(SVGStyledElement*); - -protected: - SVGResource(); - -private: - HashSet<SVGStyledElement*> m_clients; -}; - -SVGResource* getResourceById(Document*, const AtomicString&, const RenderObject*); - -TextStream& operator<<(TextStream&, const SVGResource&); - -} - -#endif -#endif diff --git a/WebCore/svg/graphics/SVGResourceListener.h b/WebCore/svg/graphics/SVGResourceListener.h deleted file mode 100644 index e69de29..0000000 --- a/WebCore/svg/graphics/SVGResourceListener.h +++ /dev/null diff --git a/WebCore/websockets/WebSocket.idl b/WebCore/websockets/WebSocket.idl index 1707478..cc4a07b 100644 --- a/WebCore/websockets/WebSocket.idl +++ b/WebCore/websockets/WebSocket.idl @@ -57,12 +57,12 @@ module websockets { void close(); // EventTarget interface - [JSCCustom] void addEventListener(in DOMString type, - in EventListener listener, - in boolean useCapture); - [JSCCustom] void removeEventListener(in DOMString type, - in EventListener listener, - in boolean useCapture); + void addEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); + void removeEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); boolean dispatchEvent(in Event evt) raises(EventException); }; diff --git a/WebCore/wml/WMLAnchorElement.cpp b/WebCore/wml/WMLAnchorElement.cpp index b9b3f53..ac9c8f2 100644 --- a/WebCore/wml/WMLAnchorElement.cpp +++ b/WebCore/wml/WMLAnchorElement.cpp @@ -34,10 +34,10 @@ WMLAnchorElement::WMLAnchorElement(const QualifiedName& tagName, Document* doc) : WMLAElement(tagName, doc) , m_task(0) { - // Calling setIsLink(true), and returning a non-null value on CSSStyleSelectors' linkAttribute + // Calling setIsLink(), and returning a non-null value on CSSStyleSelectors' linkAttribute // method, makes it possible to 'appear as link' (just like <a href="..">) without the need to // actually set the href value to an empty value in the DOM tree. - setIsLink(true); + setIsLink(); } WMLAnchorElement::~WMLAnchorElement() diff --git a/WebCore/wml/WMLElement.cpp b/WebCore/wml/WMLElement.cpp index 3004aba..89fd07a 100644 --- a/WebCore/wml/WMLElement.cpp +++ b/WebCore/wml/WMLElement.cpp @@ -39,7 +39,7 @@ namespace WebCore { using namespace WMLNames; WMLElement::WMLElement(const QualifiedName& tagName, Document* document) - : StyledElement(tagName, document, CreateElementZeroRefCount) + : StyledElement(tagName, document, CreateStyledElementZeroRefCount) { } diff --git a/WebCore/wml/WMLInputElement.h b/WebCore/wml/WMLInputElement.h index eea633b..bd4e175 100644 --- a/WebCore/wml/WMLInputElement.h +++ b/WebCore/wml/WMLInputElement.h @@ -88,6 +88,9 @@ public: bool isConformedToInputMask(const String&); bool isConformedToInputMask(UChar, unsigned, bool isUserInput = true); +#if ENABLE(WCSS) + virtual InputElementData data() const { return m_data; } +#endif private: friend class WMLCardElement; diff --git a/WebCore/workers/AbstractWorker.idl b/WebCore/workers/AbstractWorker.idl index 4361dfc..f05ec17 100644 --- a/WebCore/workers/AbstractWorker.idl +++ b/WebCore/workers/AbstractWorker.idl @@ -38,12 +38,12 @@ module threads { attribute EventListener onerror; - [JSCCustom] void addEventListener(in DOMString type, - in EventListener listener, - in boolean useCapture); - [JSCCustom] void removeEventListener(in DOMString type, - in EventListener listener, - in boolean useCapture); + void addEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); + void removeEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); boolean dispatchEvent(in Event evt) raises(EventException); }; diff --git a/WebCore/workers/DefaultSharedWorkerRepository.cpp b/WebCore/workers/DefaultSharedWorkerRepository.cpp index 85ff768..88aea2d 100644 --- a/WebCore/workers/DefaultSharedWorkerRepository.cpp +++ b/WebCore/workers/DefaultSharedWorkerRepository.cpp @@ -274,7 +274,7 @@ SharedWorkerScriptLoader::SharedWorkerScriptLoader(PassRefPtr<SharedWorker> work void SharedWorkerScriptLoader::load(const KURL& url) { // Mark this object as active for the duration of the load. - m_scriptLoader = new WorkerScriptLoader(); + m_scriptLoader = new WorkerScriptLoader(ResourceRequestBase::TargetIsSharedWorker); m_scriptLoader->loadAsynchronously(m_worker->scriptExecutionContext(), url, DenyCrossOriginRequests, this); // Stay alive (and keep the SharedWorker and JS wrapper alive) until the load finishes. diff --git a/WebCore/workers/Worker.cpp b/WebCore/workers/Worker.cpp index 642502a..53ca9ae 100644 --- a/WebCore/workers/Worker.cpp +++ b/WebCore/workers/Worker.cpp @@ -58,7 +58,7 @@ Worker::Worker(const String& url, ScriptExecutionContext* context, ExceptionCode if (ec) return; - m_scriptLoader = new WorkerScriptLoader(); + m_scriptLoader = new WorkerScriptLoader(ResourceRequestBase::TargetIsWorker); m_scriptLoader->loadAsynchronously(scriptExecutionContext(), scriptURL, DenyCrossOriginRequests, this); setPendingActivity(this); // The worker context does not exist while loading, so we must ensure that the worker object is not collected, as well as its event listeners. #if ENABLE(INSPECTOR) diff --git a/WebCore/workers/WorkerContext.cpp b/WebCore/workers/WorkerContext.cpp index c6ee606..30c6c9b 100644 --- a/WebCore/workers/WorkerContext.cpp +++ b/WebCore/workers/WorkerContext.cpp @@ -214,7 +214,7 @@ void WorkerContext::importScripts(const Vector<String>& urls, ExceptionCode& ec) Vector<KURL>::const_iterator end = completedURLs.end(); for (Vector<KURL>::const_iterator it = completedURLs.begin(); it != end; ++it) { - WorkerScriptLoader scriptLoader; + WorkerScriptLoader scriptLoader(ResourceRequestBase::TargetIsScript); scriptLoader.loadSynchronously(scriptExecutionContext(), *it, AllowCrossOriginRequests); // If the fetching attempt failed, throw a NETWORK_ERR exception and abort all these steps. @@ -288,6 +288,11 @@ bool WorkerContext::isContextThread() const return currentThread() == thread()->threadID(); } +bool WorkerContext::isJSExecutionTerminated() const +{ + return m_script->isExecutionForbidden(); +} + EventTargetData* WorkerContext::eventTargetData() { return &m_eventTargetData; diff --git a/WebCore/workers/WorkerContext.h b/WebCore/workers/WorkerContext.h index 7026e35..91300c3 100644 --- a/WebCore/workers/WorkerContext.h +++ b/WebCore/workers/WorkerContext.h @@ -111,6 +111,7 @@ namespace WebCore { virtual void databaseExceededQuota(const String&) { } #endif virtual bool isContextThread() const; + virtual bool isJSExecutionTerminated() const; // These methods are used for GC marking. See JSWorkerContext::markChildren(MarkStack&) in diff --git a/WebCore/workers/WorkerContext.idl b/WebCore/workers/WorkerContext.idl index abb8ea8..ccc2588 100644 --- a/WebCore/workers/WorkerContext.idl +++ b/WebCore/workers/WorkerContext.idl @@ -62,12 +62,12 @@ module threads { // EventTarget interface - [JSCCustom] void addEventListener(in DOMString type, - in EventListener listener, - in boolean useCapture); - [JSCCustom] void removeEventListener(in DOMString type, - in EventListener listener, - in boolean useCapture); + void addEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); + void removeEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); boolean dispatchEvent(in Event evt) raises(EventException); diff --git a/WebCore/workers/WorkerScriptLoader.cpp b/WebCore/workers/WorkerScriptLoader.cpp index fa7d3c4..78f3d48 100644 --- a/WebCore/workers/WorkerScriptLoader.cpp +++ b/WebCore/workers/WorkerScriptLoader.cpp @@ -43,10 +43,11 @@ namespace WebCore { -WorkerScriptLoader::WorkerScriptLoader() +WorkerScriptLoader::WorkerScriptLoader(ResourceRequestBase::TargetType targetType) : m_client(0) , m_failed(false) , m_identifier(0) + , m_targetType(targetType) { } @@ -90,7 +91,7 @@ PassOwnPtr<ResourceRequest> WorkerScriptLoader::createResourceRequest() { OwnPtr<ResourceRequest> request(new ResourceRequest(m_url)); request->setHTTPMethod("GET"); - + request->setTargetType(m_targetType); return request.release(); } diff --git a/WebCore/workers/WorkerScriptLoader.h b/WebCore/workers/WorkerScriptLoader.h index 47623f6..a1a9afc 100644 --- a/WebCore/workers/WorkerScriptLoader.h +++ b/WebCore/workers/WorkerScriptLoader.h @@ -31,6 +31,7 @@ #if ENABLE(WORKERS) #include "KURL.h" +#include "ResourceRequest.h" #include "ResourceResponse.h" #include "ScriptString.h" #include "TextResourceDecoder.h" @@ -44,7 +45,7 @@ namespace WebCore { class WorkerScriptLoader : public ThreadableLoaderClient { public: - WorkerScriptLoader(); + explicit WorkerScriptLoader(ResourceRequestBase::TargetType); void loadSynchronously(ScriptExecutionContext*, const KURL&, CrossOriginRequestPolicy); void loadAsynchronously(ScriptExecutionContext*, const KURL&, CrossOriginRequestPolicy, WorkerScriptLoaderClient*); @@ -75,6 +76,7 @@ namespace WebCore { KURL m_url; bool m_failed; unsigned long m_identifier; + ResourceRequestBase::TargetType m_targetType; }; } // namespace WebCore diff --git a/WebCore/workers/WorkerThread.cpp b/WebCore/workers/WorkerThread.cpp index 16c5b70..52466bf 100644 --- a/WebCore/workers/WorkerThread.cpp +++ b/WebCore/workers/WorkerThread.cpp @@ -36,6 +36,7 @@ #include "PlatformString.h" #include "ScriptSourceCode.h" #include "ScriptValue.h" +#include "ThreadGlobalData.h" #include <utility> #include <wtf/Noncopyable.h> @@ -141,7 +142,10 @@ void* WorkerThread::workerThread() // The below assignment will destroy the context, which will in turn notify messaging proxy. // We cannot let any objects survive past thread exit, because no other thread will run GC or otherwise destroy them. m_workerContext = 0; - + + // Clean up WebCore::ThreadGlobalData before WTF::WTFThreadData goes away! + threadGlobalData().destroy(); + // The thread object may be already destroyed from notification now, don't try to access "this". detachThread(threadID); diff --git a/WebCore/wscript b/WebCore/wscript index 752486c..85c9885 100644 --- a/WebCore/wscript +++ b/WebCore/wscript @@ -50,9 +50,20 @@ if build_port == "wx": webcore_dirs.append('plugins/mac') webcore_dirs.append('platform/wx/wxcode/mac/carbon') webcore_dirs.append('platform/mac') + webcore_dirs.append('platform/text/mac') webcore_sources['wx-mac'] = [ - 'platform/mac/WebCoreNSStringExtras.mm', 'platform/mac/PurgeableBufferMac.cpp', + 'platform/mac/WebCoreNSStringExtras.mm', + 'platform/mac/WebCoreSystemInterface.mm', + 'platform/graphics/cg/FloatSizeCG.cpp', + 'platform/graphics/mac/ComplexTextController.cpp', + 'platform/graphics/mac/ComplexTextControllerCoreText.cpp', + 'platform/graphics/mac/ComplexTextControllerATSUI.cpp', + 'platform/graphics/mac/GlyphPageTreeNodeMac.cpp', + 'platform/graphics/mac/SimpleFontDataATSUI.mm', + 'platform/graphics/mac/SimpleFontDataCoreText.cpp', + 'platform/graphics/wx/FontPlatformDataWxMac.mm', + 'platform/text/mac/ShapeArabic.c', 'platform/wx/wxcode/mac/carbon/fontprops.mm', 'plugins/wx/PluginDataWx.cpp', 'plugins/mac/PluginPackageMac.cpp', @@ -101,8 +112,12 @@ def configure(conf): def build(bld): import Options + + import TaskGen + if sys.platform.startswith('darwin'): TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cxx'] + TaskGen.task_gen.mappings['.m'] = TaskGen.task_gen.mappings['.cxx'] wk_includes = ['.', '..', 'DerivedSources', wk_root, @@ -124,6 +139,7 @@ def build(bld): if sys.platform.startswith('darwin'): features.append('cf') + bld.install_files(os.path.join(output_dir, 'WebCore'), 'platform/mac/WebCoreSystemInterface.h') else: exclude_patterns.append('*CF.cpp') @@ -201,11 +217,13 @@ def build(bld): if building_on_win32: excludes.append('SharedTimerWx.cpp') - excludes.append('GlyphMapWx.cpp') excludes.append('RenderThemeWin.cpp') excludes.append('KeyEventWin.cpp') + if building_on_win32 or sys.platform.startswith('darwin'): + excludes.append('GlyphMapWx.cpp') excludes.append('AuthenticationCF.cpp') excludes.append('LoaderRunLoopCF.cpp') + excludes.append('ResourceErrorCF.cpp') webcore.find_sources_in_dirs(full_dirs, excludes = excludes, exts=['.c', '.cpp']) diff --git a/WebCore/xml/XMLHttpRequest.cpp b/WebCore/xml/XMLHttpRequest.cpp index c95351f..5cde24d 100644 --- a/WebCore/xml/XMLHttpRequest.cpp +++ b/WebCore/xml/XMLHttpRequest.cpp @@ -496,6 +496,10 @@ void XMLHttpRequest::send(DOMFormData* body, ExceptionCode& ec) if (m_method != "GET" && m_method != "HEAD" && m_url.protocolInHTTPFamily()) { m_requestEntityBody = FormData::createMultiPart(*body, document()); + // We need to ask the client to provide the generated file names if needed. When FormData fills the element + // for the file, it could set a flag to use the generated file name, i.e. a package file on Mac. + m_requestEntityBody->generateFiles(document()); + String contentType = getRequestHeader("Content-Type"); if (contentType.isEmpty()) { contentType = "multipart/form-data; boundary="; @@ -525,7 +529,7 @@ void XMLHttpRequest::createRequest(ExceptionCode& ec) // We also remember whether upload events should be allowed for this request in case the upload listeners are // added after the request is started. - m_uploadEventsAllowed = !isSimpleCrossOriginAccessRequest(m_method, m_requestHeaders); + m_uploadEventsAllowed = m_sameOriginRequest || !isSimpleCrossOriginAccessRequest(m_method, m_requestHeaders); ResourceRequest request(m_url); request.setHTTPMethod(m_method); diff --git a/WebCore/xml/XMLHttpRequest.idl b/WebCore/xml/XMLHttpRequest.idl index 5a86fe5..0ca2205 100644 --- a/WebCore/xml/XMLHttpRequest.idl +++ b/WebCore/xml/XMLHttpRequest.idl @@ -91,12 +91,12 @@ module xml { [Custom] void overrideMimeType(in DOMString override); // EventTarget interface - [JSCCustom] void addEventListener(in DOMString type, - in EventListener listener, - in boolean useCapture); - [JSCCustom] void removeEventListener(in DOMString type, - in EventListener listener, - in boolean useCapture); + void addEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); + void removeEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); boolean dispatchEvent(in Event evt) raises(EventException); }; diff --git a/WebCore/xml/XMLHttpRequestUpload.idl b/WebCore/xml/XMLHttpRequestUpload.idl index a712a37..5a18567 100644 --- a/WebCore/xml/XMLHttpRequestUpload.idl +++ b/WebCore/xml/XMLHttpRequestUpload.idl @@ -42,12 +42,12 @@ module xml { attribute EventListener onprogress; // EventTarget interface - [JSCCustom] void addEventListener(in DOMString type, - in EventListener listener, - in boolean useCapture); - [JSCCustom] void removeEventListener(in DOMString type, - in EventListener listener, - in boolean useCapture); + void addEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); + void removeEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); boolean dispatchEvent(in Event evt) raises(EventException); }; diff --git a/WebCore/xml/XSLTProcessorLibxslt.cpp b/WebCore/xml/XSLTProcessorLibxslt.cpp index a0ed450..9c3fafd 100644 --- a/WebCore/xml/XSLTProcessorLibxslt.cpp +++ b/WebCore/xml/XSLTProcessorLibxslt.cpp @@ -315,7 +315,7 @@ bool XSLTProcessor::transformToString(Node* sourceNode, String& mimeType, String if (shouldFreeSourceDoc) xmlFreeDoc(sourceDoc); - if (success = saveResultToString(resultDoc, sheet, resultString)) { + if ((success = saveResultToString(resultDoc, sheet, resultString))) { mimeType = resultMIMEType(resultDoc, sheet); resultEncoding = (char*)resultDoc->encoding; } |