diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-01-11 10:03:25 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-01-11 10:03:25 +0100 |
commit | d11f84f5b5cdc0d92a08af01b13472fdd5f9acb9 (patch) | |
tree | b318cf594dc1da2fa48224005945c9157f35bb41 /Source/WebCore | |
parent | 6300a96eca9f152b379f1bcf3d9efdc5572d989a (diff) | |
download | qtwebkit-d11f84f5b5cdc0d92a08af01b13472fdd5f9acb9.tar.gz |
Imported WebKit commit 75bb2fc5882d2e1b3d5572c2961507996cbca5e3 (http://svn.webkit.org/repository/webkit/trunk@104681)
Diffstat (limited to 'Source/WebCore')
432 files changed, 14138 insertions, 3268 deletions
diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt index 1f65f1e3c..717a7d869 100644 --- a/Source/WebCore/CMakeLists.txt +++ b/Source/WebCore/CMakeLists.txt @@ -610,6 +610,7 @@ SET(WebCore_SOURCES dom/TransformSourceLibxslt.cpp dom/Traversal.cpp dom/TreeScope.cpp + dom/TreeScopeAdopter.cpp dom/TreeWalker.cpp dom/UIEvent.cpp dom/UIEventWithKeyState.cpp @@ -869,6 +870,7 @@ SET(WebCore_SOURCES inspector/ConsoleMessage.cpp inspector/ContentSearchUtils.cpp + inspector/DOMEditor.cpp inspector/DOMNodeHighlighter.cpp inspector/IdentifiersFactory.cpp inspector/InjectedScript.cpp @@ -989,12 +991,14 @@ SET(WebCore_SOURCES page/DOMSelection.cpp page/DOMTimer.cpp page/DOMWindow.cpp + page/DOMWindowProperty.cpp page/DragController.cpp page/EventHandler.cpp page/EventSource.cpp page/FocusController.cpp page/Frame.cpp page/FrameActionScheduler.cpp + page/FrameDestructionObserver.cpp page/FrameTree.cpp page/FrameView.cpp page/Geolocation.cpp @@ -1345,6 +1349,7 @@ SET(WebCore_SOURCES storage/AbstractDatabase.cpp storage/ChangeVersionWrapper.cpp + storage/DOMWindowSQLDatabase.cpp storage/Database.cpp storage/DatabaseAuthorizer.cpp storage/DatabaseSync.cpp @@ -1464,6 +1469,7 @@ ENDIF () IF (ENABLE_SQL_DATABASE) LIST(APPEND WebCore_IDL_FILES + storage/DOMWindowSQLDatabase.idl storage/Database.idl storage/DatabaseCallback.idl storage/DatabaseSync.idl @@ -2327,7 +2333,10 @@ ADD_SOURCE_WEBCORE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/css/CSSParser.cpp tokeniz # Replace ";" with "space" in order to recognize feature definition in css files. SET(FEATURE_DEFINES_WITH_SPACE_SEPARATOR "") FOREACH(_feature ${FEATURE_DEFINES}) - SET(FEATURE_DEFINES_WITH_SPACE_SEPARATOR "${FEATURE_DEFINES_WITH_SPACE_SEPARATOR} ${_feature}") + # filter out color input since we have our own solution + IF (NOT CMAKE_SYSTEM_NAME MATCHES "QNX" OR NOT _feature MATCHES "ENABLE_INPUT_COLOR") + SET(FEATURE_DEFINES_WITH_SPACE_SEPARATOR "${FEATURE_DEFINES_WITH_SPACE_SEPARATOR} ${_feature}") + ENDIF() ENDFOREACH() diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 5b5e4bc47..d8d28c26b 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,3408 @@ +2012-01-11 Dan Bernstein <mitz@apple.com> + + <rdar://problem/10674686> Implement the font-kerning CSS property + https://bugs.webkit.org/show_bug.cgi?id=76033 + + Reviewed by Darin Adler. + + Tests: fast/text/font-kerning-expected.html + fast/text/font-kerning.html + + * css/CSSComputedStyleDeclaration.cpp: + (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Added code to handle + font-kerning. + * css/CSSParser.cpp: + (WebCore::CSSParser::parseValue): Ditto. + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Added mapping from FontDescription::Kerning. + (WebCore::CSSPrimitiveValue::operator FontDescription::Kerning): Added mapping to + FontDescription::Kerning. + * css/CSSProperty.cpp: + (WebCore::CSSProperty::isInheritedProperty): Added font-kerning to the set of inherited + properties. + * css/CSSPropertyNames.in: Added -webkit-font-kerning. + * css/CSSStyleApplyProperty.cpp: + (WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty): Added a handler for font-kerning. + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::applyDeclaration): Updated for the number of properties that + affect the font. + * platform/graphics/Font.h: + (WebCore::Font::typesettingFeatures): Changed to enable kerning if font-kerning is set to + normal, disable it if font-kerning is set to none, and leave it to the default (determined + by the text-rendering property) if font-kerning is set to auto. + * platform/graphics/FontDescription.h: + (WebCore::FontDescription::FontDescription): Added a Kerning enum. + (WebCore::FontDescription::kerning): Added this getter. + (WebCore::FontDescription::setKerning): Added this setter. + (WebCore::FontDescription::operator==): Updated to compare the m_kerning member. + +2012-01-10 Ryosuke Niwa <rniwa@webkit.org> + + Build fix. Forgot to revert Node.h. + + * dom/Node.h: + +2012-01-10 Ryosuke Niwa <rniwa@webkit.org> + + Revert r104210. It turned out that this patch makes improving the node list caches harder. + + * dom/Attr.cpp: + (WebCore::Attr::setValue): + (WebCore::Attr::childrenChanged): + * dom/DynamicNodeList.cpp: + (WebCore::DynamicSubtreeNodeList::DynamicSubtreeNodeList): + (WebCore::DynamicSubtreeNodeList::length): + (WebCore::DynamicSubtreeNodeList::itemForwardsFromCurrent): + (WebCore::DynamicSubtreeNodeList::itemBackwardsFromCurrent): + (WebCore::DynamicSubtreeNodeList::item): + (WebCore::DynamicSubtreeNodeList::invalidateCache): + (WebCore::DynamicSubtreeNodeList::Caches::create): + (WebCore::DynamicSubtreeNodeList::Caches::reset): + * dom/DynamicNodeList.h: + * dom/Element.cpp: + (WebCore::Element::updateAfterAttributeChanged): + * dom/Node.cpp: + (WebCore::Node::invalidateNodeListsCacheAfterAttributeChanged): + (WebCore::Node::invalidateNodeListsCacheAfterChildrenChanged): + (WebCore::Node::notifyLocalNodeListsLabelChanged): + (WebCore::Node::itemTypeAttributeChanged): + (WebCore::NodeListsNodeData::invalidateCaches): + (WebCore::NodeListsNodeData::invalidateCachesThatDependOnAttributes): + * dom/NodeRareData.h: + * html/HTMLElement.cpp: + (WebCore::HTMLElement::parseMappedAttribute): + * html/HTMLLabelElement.cpp: + (WebCore::HTMLLabelElement::parseMappedAttribute): + * html/HTMLLabelElement.h: + +2012-01-10 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r104263 and r104381. + http://trac.webkit.org/changeset/104263 + http://trac.webkit.org/changeset/104381 + https://bugs.webkit.org/show_bug.cgi?id=76029 + + Preparation to rollout r104210 (Requested by rniwa on + #webkit). + + * dom/DynamicNodeList.cpp: + (WebCore::DynamicSubtreeNodeList::SubtreeCaches::setLengthCache): + (WebCore::DynamicSubtreeNodeList::SubtreeCaches::setItemCache): + (WebCore::DynamicSubtreeNodeList::length): + (WebCore::DynamicSubtreeNodeList::item): + * dom/DynamicNodeList.h: + (WebCore::DynamicSubtreeNodeList::SubtreeCaches::isLengthCacheValid): + (WebCore::DynamicSubtreeNodeList::SubtreeCaches::isItemCacheValid): + (WebCore::DynamicSubtreeNodeList::SubtreeCaches::domVersionIsConsistent): + +2012-01-10 David Kilzer <ddkilzer@apple.com> + + Add TestWebKitAPI tests for KURL + <http://webkit.org/b/75774> + + Reviewed by Adam Barth. + + * WebCore.exp.in: Export additional KURL methods used in + testing. + +2012-01-10 Jer Noble <jer.noble@apple.com> + + Crash in HTMLMediaElement::shouldDisableSleep() + https://bugs.webkit.org/show_bug.cgi?id=76025 + + Reviewed by Dan Bernstein. + + Check nullity of m_player before dereferencing. + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::shouldDisableSleep): + +2012-01-04 Kent Tamura <tkent@chromium.org> + + A radio button not in a document should not join a radio button group + https://bugs.webkit.org/show_bug.cgi?id=45719 + + Reviewed by Darin Adler. + + As per the standard and other browser behaviors, we should not add a + radio button not in a document to a radio button group. + + So, CheckedRadioButton member functions should be called in + insertedIntoDocument() and removedFromDocument(), and they should do + nothing if the specified radio button is not in a document. + + This change also fixes a bug that form owner change by 'form' attribute + didn't update radio button groups correctly. + + Test: fast/forms/radio/radio-group.html + + * dom/CheckedRadioButtons.cpp: + (WebCore::shouldMakeRadioGroup): A helper function to check <input> state. + (WebCore::CheckedRadioButtons::addButton): + - Change the argument type: HTMLFormControlElement* -> HTMLInputElement*. + - Use shouldMakeRadioGroup(). + (WebCore::CheckedRadioButtons::removeButton): ditto. + * dom/CheckedRadioButtons.h: + Change the argument types of addButton() and removeButton(): + HTMLFormControlElement* -> HTMLInputElement*. + * html/FormAssociatedElement.cpp: + Do not update m_form except in setForm() and formWillBeDestroyed(). + This helps us to call registerFormElement() and removeFromElement() + correctly, and call willChangeForm()/didChangeForm() hooks correctly. + (WebCore::FormAssociatedElement::FormAssociatedElement): + (WebCore::FormAssociatedElement::~FormAssociatedElement): + (WebCore::FormAssociatedElement::insertedIntoTree): + (WebCore::FormAssociatedElement::removedFromTree): + (WebCore::FormAssociatedElement::setForm): + (WebCore::FormAssociatedElement::willChangeForm): + This virtual function is called before the owner form is updated. + (WebCore::FormAssociatedElement::didChangeForm): + This virtual function is called after the owner form was updated. + (WebCore::FormAssociatedElement::formWillBeDestroyed): + - Renamaed from formDestroyed() + - Add calls to willChangeForm() and didChangeForm(). + (WebCore::FormAssociatedElement::resetFormOwner): Use setForm(). + (WebCore::FormAssociatedElement::formAttributeChanged): ditto. + * html/FormAssociatedElement.h: + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLFormControlElement::HTMLFormControlElement): Use setForm(). + (WebCore::HTMLFormControlElement::~HTMLFormControlElement): + removeFormElement() is not needed. ~FormAssociatedElement() treats it. + (WebCore::HTMLFormControlElement::parseMappedAttribute): + No need to handle CheckedRadioButtons here. It is handled by HTMLInputElement. + (WebCore::HTMLFormControlElement::insertedIntoTree): ditto. + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::~HTMLFormElement): + Rename formDestroyed() with willDestroyForm(). + (WebCore::HTMLFormElement::registerFormElement): + We don't need to handle radio button groups here. + (WebCore::HTMLFormElement::removeFormElement): ditto. + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::~HTMLInputElement): + Calls setForm(0) so that it calls correct virtual functions of + HTMLInputElement. + (WebCore::HTMLInputElement::updateCheckedRadioButtons): + Checking attached() was wrong. + (WebCore::HTMLInputElement::willChangeForm): + Remove this radio button from a radio button group for the old form. + (WebCore::HTMLInputElement::didChangeForm): + Add this radio button to a radio button group for the new form. + (WebCore::HTMLInputElement::insertedIntoDocument): + Add CheckedRadioButtons::addButton() call. + (WebCore::HTMLInputElement::removedFromDocument): + Add CheckedRadioButtons::removeButton() call. + (WebCore::HTMLInputElement::didMoveToNewDocument): + We don't need to handle CheckedRadioButton() here because + removedFromDocument() handles it. + * html/HTMLInputElement.h: + * html/HTMLObjectElement.cpp: + (WebCore::HTMLObjectElement::HTMLObjectElement): Use setForm(). + (WebCore::HTMLObjectElement::~HTMLObjectElement): + removeFormElement() is not needed. ~FormAssociatedElement() treats it. + +2012-01-10 Kentaro Hara <haraken@chromium.org> + + Remove redundant code from DOMWindowSQLDatabase.cpp + https://bugs.webkit.org/show_bug.cgi?id=76010 + + Reviewed by Adam Barth. + + This patch removes redundant code from DOMWindowSQLDatabase.cpp. + + - Remove window->frame() check, since window->frame() is always true when + window->isCurrentlyDisplayedInFrame() is true. + - window->frame()->document() can just be window->document() + + Tests: storage/open-database-creation-callback-isolated-world.html + storage/open-database-creation-callback.html + storage/open-database-empty-version.html + storage/open-database-over-quota.html + storage/open-database-set-empty-version.html + storage/open-database-while-transaction-in-progress.html + + * storage/DOMWindowSQLDatabase.cpp: + (WebCore::DOMWindowSQLDatabase::openDatabase): + +2012-01-10 Dale Curtis <dalecurtis@chromium.org> + + Repaint video controls when buffering during pause. + https://bugs.webkit.org/show_bug.cgi?id=73957 + + Pipes support for a new bufferingProgressed() method on MediaControls + elements. Allows controls to be repainted as data buffers when paused. + + Reviewed by Hajime Morita. + + Test: http/tests/media/video-buffering-repaints-controls.html + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::setNetworkState): + (WebCore::HTMLMediaElement::progressEventTimerFired): + * html/shadow/MediaControlRootElement.cpp: + (WebCore::MediaControlRootElement::bufferingProgressed): + * html/shadow/MediaControlRootElement.h: + * html/shadow/MediaControlRootElementChromium.cpp: + (WebCore::MediaControlRootElementChromium::bufferingProgressed): + * html/shadow/MediaControlRootElementChromium.h: + * html/shadow/MediaControls.h: + +2012-01-10 Daniel Cheng <dcheng@chromium.org> + + [chromium] Pasteboard::documentFragment should fall back to text if there's no HTML text + https://bugs.webkit.org/show_bug.cgi?id=75923 + + Reviewed by Tony Chang. + + Test: editing/pasteboard/pasting-empty-html-falls-back-to-text.html + + * platform/chromium/PasteboardChromium.cpp: + (WebCore::Pasteboard::documentFragment): + +2012-01-10 Kentaro Hara <haraken@chromium.org> + + Use the [Supplemental] IDL in SQLDatabase + https://bugs.webkit.org/show_bug.cgi?id=76004 + + Reviewed by Adam Barth. + + We've been working on WebKit modularization. By using the [Supplemental] IDL, + we can move SQLDatabase related code from WebCore/page/DOMWindow.{h,cpp,idl} + to WebCore/storage/DOMWindowSQLDatabase.{h,cpp,idl}. + + Tests: storage/open-database-creation-callback-isolated-world.html + storage/open-database-creation-callback.html + storage/open-database-empty-version.html + storage/open-database-over-quota.html + storage/open-database-set-empty-version.html + storage/open-database-while-transaction-in-progress.html + + * CMakeLists.txt: Added DOMWindowSQLDatabase.{idl,h,cpp} to the build script. + * DerivedSources.make: Ditto. + * DerivedSources.pri: Ditto. + * GNUmakefile.list.am: Ditto. + * Target.pri: Ditto. + * WebCore.gypi: Ditto. + * WebCore.vcproj/WebCore.vcproj: Ditto. + * WebCore.xcodeproj/project.pbxproj: Ditto. + + * page/DOMWindow.cpp: Removed SQLDatabase related code. + * page/DOMWindow.idl: Ditto. + * page/DOMWindow.h: Ditto. Moved isCurrentlyDisplayedInFrame() from private: to public: + so that DOMWindowSQLDatabase::openDatabase() can access it. + + * storage/DOMWindowSQLDatabase.cpp: Added. Moved openDatabase() from DOMWindow.cpp to here. + (WebCore::DOMWindowSQLDatabase::openDatabase): + * storage/DOMWindowSQLDatabase.h: Added. Moved openDatabase() from DOMWindow.h to here. + * storage/DOMWindowSQLDatabase.idl: Added. Using the [Supplemental] IDL, moved openDatabase() + and SQLException from DOMWindow.idl to here. + +2012-01-10 Chris Marrin <cmarrin@apple.com> + + CIFilter version of Sepia Tone filter doesn't match software + https://bugs.webkit.org/show_bug.cgi?id=75129 + + Reviewed by Simon Fraser. + + Changed sepia tone filter to use a CIColorMatrix filter with + values that match sw filter. + + * platform/graphics/ca/mac/PlatformCALayerMac.mm: + (interp): + (PlatformCALayer::setFilters): + +2012-01-10 Viatcheslav Ostapenko <ostapenko.viatcheslav@nokia.com> + + [Qt][WK2]REGRESSION(r102435): It made tst_QQuickWebView::show() crash + https://bugs.webkit.org/show_bug.cgi?id=74176 + + Reviewed by Noam Rosenthal. + + Replaces static global GL resource holder with holder shared between + TextureMapperGL instances created on the same GL context. Also adds + deallocation of GL resources when last TextureMapperGL instance on the + current GL context gets deleted. + + Tested by multipleWebViewWindows and multipleWebViews Qt WK2 API tests. + + * platform/graphics/opengl/TextureMapperGL.cpp: + (WebCore::TextureMapperGLData::SharedGLData::getCurrentGLContext): + (WebCore::TextureMapperGLData::SharedGLData::glContextDataMap): + (WebCore::TextureMapperGLData::SharedGLData::currentSharedGLData): + (WebCore::TextureMapperGLData::SharedGLData::ProgramInfo::ProgramInfo): + (WebCore::TextureMapperGLData::SharedGLData::createShaderProgram): + (WebCore::TextureMapperGLData::SharedGLData::deleteShaderProgram): + (WebCore::TextureMapperGLData::SharedGLData::SharedGLData): + (WebCore::TextureMapperGLData::SharedGLData::~SharedGLData): + (WebCore::TextureMapperGLData::sharedGLData): + (WebCore::TextureMapperGLData::TextureMapperGLData): + (WebCore::TextureMapperGLData::SharedGLData::initializeShaders): + (WebCore::TextureMapperGL::beginPainting): + (WebCore::TextureMapperGL::drawTexture): + (WebCore::BitmapTextureGL::bind): + (WebCore::TextureMapperGL::bindSurface): + (WebCore::TextureMapperGL::beginClip): + (WebCore::TextureMapperGL::endClip): + * platform/graphics/opengl/TextureMapperGL.h: + +2012-01-10 Simon Fraser <simon.fraser@apple.com> + + Disabled mock scrollbars should draw differently + https://bugs.webkit.org/show_bug.cgi?id=75995 + + Reviewed by James Robinson. + + When the scrollbar is disabled, paint the entire track of + mock scrollbars with a lighter gray, and hide the thumb. + + No tests, since mock scrollbars aren't enabled by default on Mac yet. + + * platform/mock/ScrollbarThemeMock.cpp: + (WebCore::ScrollbarThemeMock::paintTrackBackground): + (WebCore::ScrollbarThemeMock::paintThumb): + +2012-01-10 Tony Chang <tony@chromium.org> + + Need to handle absolutely positioned elements inside flexboxes + https://bugs.webkit.org/show_bug.cgi?id=70793 + + Reviewed by David Hyatt. + + Tests: css3/flexbox/insert-text-crash.html + css3/flexbox/position-absolute-child.html + + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::computePreferredMainAxisExtent): Skip the size of positioned elements. + (WebCore::RenderFlexibleBox::runFreeSpaceAllocationAlgorithm): Add placeholders for positioned elements. + (WebCore::RenderFlexibleBox::prepareChildForPositionedLayout): Positions the layer for the positioned child. + (WebCore::RenderFlexibleBox::layoutAndPlaceChildren): Handle positioned elements. + (WebCore::RenderFlexibleBox::layoutColumnReverse): Adjust the main axis offset of the layer for positioned elements. + * rendering/RenderFlexibleBox.h: + +2012-01-10 Nat Duca <nduca@chromium.org> + + [chromium] Reuse old timebase when activating CCDelayBasedTimeSource + https://bugs.webkit.org/show_bug.cgi?id=75938 + + Reviewed by James Robinson. + + * platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp: + (WebCore::CCDelayBasedTimeSource::CCDelayBasedTimeSource): + (WebCore::CCDelayBasedTimeSource::setActive): + (WebCore::CCDelayBasedTimeSource::onTimerFired): + (WebCore::CCDelayBasedTimeSource::postNextTickTask): + * platform/graphics/chromium/cc/CCDelayBasedTimeSource.h: + +2012-01-10 Kentaro Hara <haraken@chromium.org> + + Support the [Supplemental] IDL on methods + https://bugs.webkit.org/show_bug.cgi?id=75944 + + Reviewed by Adam Barth. + + The spec for the [Supplemental] IDL: + http://dev.w3.org/2006/webapi/WebIDL/#dfn-supplemental-interface + + Currently the [Supplemental] IDL is supported on attributes but not supported + on methods. This patch makes a change to support it. + + Specifically, assume the following IDL: + + interface [Supplemental=X] Y { + void func(); + } + + Then the code generator generates the following V8X.cpp. + + void funcCallback(Arguments& args) { + X* imp = V8X::toNative(args.Holder()); + Y::func(imp); + } + + Similar code is also generated for JS, ObjC, GObject and CPP bindings. + + Test: bindings/scripts/test/TestSupplemental.idl + + * bindings/scripts/CodeGeneratorCPP.pm: Modified as described above. + (GenerateImplementation): + * bindings/scripts/CodeGeneratorGObject.pm: Ditto. + (GenerateFunction): + * bindings/scripts/CodeGeneratorJS.pm: Ditto. + (GenerateParametersCheck): + * bindings/scripts/CodeGeneratorObjC.pm: Ditto. + (GenerateImplementation): + * bindings/scripts/CodeGeneratorV8.pm: Ditto. + (GenerateFunctionCallString): + * bindings/scripts/generate-bindings.pl: Ditto. + + * bindings/scripts/test/TestSupplemental.idl: Added test cases for [Supplemental] methods. + + * bindings/scripts/test/CPP/WebDOMTestInterface.cpp: Updated the test result. + (WebDOMTestInterface::supplementalMethod1): + (WebDOMTestInterface::supplementalMethod2): + * bindings/scripts/test/CPP/WebDOMTestInterface.h: Ditto. + * bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp: Ditto. + (webkit_dom_test_interface_supplemental_method1): + (webkit_dom_test_interface_supplemental_method2): + * bindings/scripts/test/GObject/WebKitDOMTestInterface.h: Ditto. + * bindings/scripts/test/JS/JSTestInterface.cpp: Ditto. + (WebCore::JSTestInterfacePrototype::getOwnPropertySlot): + (WebCore::JSTestInterfacePrototype::getOwnPropertyDescriptor): + (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod1): + (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2): + * bindings/scripts/test/JS/JSTestInterface.h: Ditto. + * bindings/scripts/test/ObjC/DOMTestInterface.h: Ditto. + * bindings/scripts/test/ObjC/DOMTestInterface.mm: Ditto. + (-[DOMTestInterface supplementalMethod1]): + (-[DOMTestInterface supplementalMethod2:objArg:]): + * bindings/scripts/test/V8/V8TestInterface.cpp: Ditto. + (WebCore::TestInterfaceInternal::supplementalMethod1Callback): + (WebCore::TestInterfaceInternal::supplementalMethod2Callback): + (WebCore::ConfigureV8TestInterfaceTemplate): + +2012-01-10 Kentaro Hara <haraken@chromium.org> + + [Refactoring] Rename attributes in TestSupplemental.idl to clarify + that they are supplemental attributes + https://bugs.webkit.org/show_bug.cgi?id=75942 + + Reviewed by Adam Barth. + + This patch just renames attributes in TestSupplemental.idl + to make it easy to find in {JS,V8,WebKitDOM,DOM,WebDOM}TestInterface.cpp + which attributes originate from TestSupplemental.idl. + + * bindings/scripts/test/TestSupplemental.idl: Just renamed three attributes. + + * bindings/scripts/test/CPP/WebDOMTestInterface.cpp: Updated the test result. + (WebDOMTestInterface::supplementalStr1): + (WebDOMTestInterface::supplementalStr2): + (WebDOMTestInterface::setSupplementalStr2): + * bindings/scripts/test/CPP/WebDOMTestInterface.h: Ditto. + * bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp: Ditto. + (webkit_dom_test_interface_get_supplemental_str1): + (webkit_dom_test_interface_get_supplemental_str2): + (webkit_dom_test_interface_set_supplemental_str2): + (webkit_dom_test_interface_set_property): + (webkit_dom_test_interface_get_property): + (webkit_dom_test_interface_class_init): + * bindings/scripts/test/GObject/WebKitDOMTestInterface.h: Ditto. + * bindings/scripts/test/JS/JSTestInterface.cpp: Ditto. + (WebCore::jsTestInterfaceSupplementalStr1): + (WebCore::jsTestInterfaceSupplementalStr2): + (WebCore::jsTestInterface): + (WebCore::setJSTestInterfaceSupplementalStr2): + (WebCore::setJSTestInterface): + * bindings/scripts/test/JS/JSTestInterface.h: Ditto. + * bindings/scripts/test/ObjC/DOMTestInterface.h: Ditto. + * bindings/scripts/test/ObjC/DOMTestInterface.mm: Ditto. + (-[DOMTestInterface supplementalStr1]): + (-[DOMTestInterface supplementalStr2]): + (-[DOMTestInterface setSupplementalStr2:]): + (-[DOMTestInterface ]): + (-[DOMTestInterface set:]): + * bindings/scripts/test/V8/V8TestInterface.cpp: Ditto. + (WebCore::TestInterfaceInternal::supplementalStr1AttrGetter): + (WebCore::TestInterfaceInternal::supplementalStr2AttrGetter): + (WebCore::TestInterfaceInternal::supplementalStr2AttrSetter): + +2012-01-10 John Bauman <jbauman@chromium.org> + + [chromium] Correctly recreate DrawingBuffer on lost device + https://bugs.webkit.org/show_bug.cgi?id=75912 + + Reviewed by Kenneth Russell. + + Create new drawing buffer on new context, not old lost context. Also, + make sure to bind new drawing buffer. + + No new tests. + + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::WebGLRenderingContext::maybeRestoreContext): + +2012-01-10 Stephen White <senorblanco@chromium.org> + + [Chromium] Partial revert of r104566, since it breaks the shared + library build on Windows. + https://bugs.webkit.org/show_bug.cgi?id=75994 + + Reviewed by Dmitry Titov. + + Covered by SVG feColorMatrix tests (see LayoutTests/ChangeLog). + + * WebCore.gypi: + * platform/graphics/filters/FEColorMatrix.h: + +2012-01-10 Simon Fraser <simon.fraser@apple.com> + + Clean up RenderLayerBacking code that looks for the body + https://bugs.webkit.org/show_bug.cgi?id=39502 + + Reviewed by Dave Hyatt. + + Consolidate code that propagates the <body> background to the + root, adding a utility method on RenderObject that is called + by RenderBox and RenderLayerBacking. + + Removed an unused method in RenderLayerBacking. + + The compositiong changes are not testable, since rendererBackgroundColor() + is only used by fullscreen at present. + + Tests: fast/backgrounds/root-background-propagation.html + fast/backgrounds/root-background-propagation2.html + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::paintRootBoxFillLayers): + * rendering/RenderLayerBacking.cpp: + (WebCore::RenderLayerBacking::rendererBackgroundColor): + * rendering/RenderLayerBacking.h: + * rendering/RenderObject.cpp: + (WebCore::RenderObject::rendererForRootBackground): + * rendering/RenderObject.h: + +2012-01-10 Dana Jansens <danakj@chromium.org> + + [chromium] Create iterators for the RenderSurface-Layer tree + https://bugs.webkit.org/show_bug.cgi?id=74203 + + Reviewed by James Robinson. + + New unit tests: CCLayerIteratorTest.cpp + + * WebCore.gypi: + * platform/graphics/chromium/RenderSurfaceChromium.h: + * platform/graphics/chromium/cc/CCLayerIterator.cpp: Added. + (WebCore::CCLayerIteratorActions::BackToFront::begin): + (WebCore::CCLayerIteratorActions::BackToFront::end): + (WebCore::CCLayerIteratorActions::BackToFront::next): + (WebCore::CCLayerIteratorActions::FrontToBack::begin): + (WebCore::CCLayerIteratorActions::FrontToBack::end): + (WebCore::CCLayerIteratorActions::FrontToBack::next): + (WebCore::CCLayerIteratorActions::FrontToBack::goToHighestInSubtree): + * platform/graphics/chromium/cc/CCLayerIterator.h: Added. + (WebCore::CCLayerIterator::CCLayerIterator): + (WebCore::CCLayerIterator::begin): + (WebCore::CCLayerIterator::end): + (WebCore::CCLayerIterator::operator++): + (WebCore::CCLayerIterator::operator==): + (WebCore::CCLayerIterator::operator!=): + (WebCore::CCLayerIterator::operator->): + (WebCore::CCLayerIterator::operator*): + (WebCore::CCLayerIterator::representsTargetRenderSurface): + (WebCore::CCLayerIterator::representsContributingRenderSurface): + (WebCore::CCLayerIterator::representsItself): + (WebCore::CCLayerIterator::targetRenderSurfaceLayer): + * platform/graphics/chromium/cc/CCLayerIteratorPosition.h: Added. + (WebCore::CCLayerIteratorPosition::CCLayerIteratorPosition): + (WebCore::CCLayerIteratorPosition::currentLayer): + (WebCore::CCLayerIteratorPosition::currentLayerRepresentsContributingRenderSurface): + (WebCore::CCLayerIteratorPosition::currentLayerRepresentsTargetRenderSurface): + (WebCore::CCLayerIteratorPosition::targetRenderSurfaceLayer): + (WebCore::CCLayerIteratorPosition::targetRenderSurface): + (WebCore::CCLayerIteratorPosition::targetRenderSurfaceChildren): + (WebCore::CCLayerIteratorPosition::operator==): + * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: + (WebCore::CCLayerTreeHost::paintLayerContents): + (WebCore::CCLayerTreeHost::updateCompositorResources): + * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp: + (WebCore::walkLayersAndCalculateVisibleLayerRects): + * platform/graphics/chromium/cc/CCRenderSurface.h: + +2012-01-10 Ojan Vafai <ojan@chromium.org> + + Rename flex-align to flex-item-align. + https://bugs.webkit.org/show_bug.cgi?id=75929 + + Reviewed by Darin Adler. + + The spec has changed and now flex-align will be set on + the flexbox itself. + + * css/CSSComputedStyleDeclaration.cpp: + (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): + * css/CSSParser.cpp: + (WebCore::CSSParser::parseValue): + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): + (WebCore::CSSPrimitiveValue::operator EFlexAlign): + * css/CSSProperty.cpp: + (WebCore::CSSProperty::isInheritedProperty): + * css/CSSPropertyNames.in: + * css/CSSStyleApplyProperty.cpp: + (WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty): + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::applyProperty): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::sizesToIntrinsicLogicalWidth): + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::layoutAndPlaceChildren): + (WebCore::RenderFlexibleBox::alignChildren): + * rendering/style/RenderStyle.h: + (WebCore::RenderStyleBitfields::flexItemAlign): + (WebCore::RenderStyleBitfields::setFlexItemAlign): + (WebCore::RenderStyleBitfields::initialFlexItemAlign): + * rendering/style/RenderStyleConstants.h: + * rendering/style/StyleFlexibleBoxData.cpp: + (WebCore::StyleFlexibleBoxData::StyleFlexibleBoxData): + (WebCore::StyleFlexibleBoxData::operator==): + * rendering/style/StyleFlexibleBoxData.h: + +2012-01-10 Eric Carlson <eric.carlson@apple.com> + + Replace TextTrackCue "getCueAsSource" method with "text" attribute + https://bugs.webkit.org/show_bug.cgi?id=75646 + + Reviewed by Darin Adler. + + Test: media/track/track-cue-mutable-text.html + + * html/HTMLMediaElement.h: getCueAsSource() -> text(). + + * html/TextTrackCue.cpp: + (WebCore::TextTrackCue::setText): New. Set cue text and clear the document fragment. + (WebCore::TextTrackCue::getCueAsHTML): Allocate the document fragment if it doesn't exist. + * html/TextTrackCue.h: + (WebCore::TextTrackCue::text): + * html/TextTrackCue.idl: getCueAsSource() -> text(). + + * html/shadow/MediaControlRootElement.cpp: + (WebCore::MediaControlRootElement::updateTextTrackDisplay): getCueAsSource() -> text(). + * html/shadow/MediaControlRootElementChromium.cpp: + (WebCore::MediaControlRootElementChromium::updateTextTrackDisplay): getCueAsSource() -> text(). + + * html/track/WebVTTParser.cpp: + (WebCore::WebVTTParser::collectCueText): processCueText is dead, long live createNewCue. + (WebCore::WebVTTParser::createDocumentFragmentFromCueText): New, split out of processCueText. + Create a document fragment from the String argument. + (WebCore::WebVTTParser::createNewCue): Split out of processCueText. + (WebCore::WebVTTParser::constructTreeFromToken): Add a comment pointing to the spec section + with the rules for DOM construction. + * html/track/WebVTTParser.h: + +2012-01-10 Jer Noble <jer.noble@apple.com> + + REGRESSION (r102024): Having the Bing homepage open prevents idle sleep + https://bugs.webkit.org/show_bug.cgi?id=75972 + + Reviewed by Oliver Hunt. + + No new tests; no testing infrastructure exists to test display sleep assertions. + + Only disable idle and display sleep when a video element is not paused, not looping, and + has both a video and audio track. + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::mediaPlayerRateChanged): Factor into updateDisableSleep() and + shouldDisplaySleep(). + (WebCore::HTMLMediaElement::setLoop): Ditto. + (WebCore::HTMLMediaElement::attributeChanged): Ditto. + (WebCore::HTMLMediaElement::updateDisableSleep): + (WebCore::HTMLMediaElement::shouldDisableSleep): + * html/HTMLMediaElement.h: + +2012-01-09 Matthew Delaney <mdelaney@apple.com> + + [Mac] Accelerate canvas layers with the same logic as accelerating the canvas itself + https://bugs.webkit.org/show_bug.cgi?id=75921 + + Reviewed by Simon Fraser. + + No new tests. Does not affect detectable behavior. + + * rendering/RenderLayerCompositor.cpp: Use canvas's shouldAccelerate to avoid asking + uninitialized canvas's if they're accelerated or not. + (WebCore::RenderLayerCompositor::updateBacking): + +2012-01-10 Daniel Sievers <sievers@chromium.org> + + [Chromium] Do not recreate texture updater for image layer if one exists. + https://bugs.webkit.org/show_bug.cgi?id=75589 + + Reviewed by James Robinson. + + Test: platform/chromium/compositing/img-layer-grow.html + + * platform/graphics/chromium/ImageLayerChromium.cpp: + (WebCore::ImageLayerChromium::createTextureUpdater): + +2012-01-10 Mike Reed <reed@google.com> + + [skia] not all convex paths are convex, so recompute convexity for the problematic ones + https://bugs.webkit.org/show_bug.cgi?id=75960 + + Reviewed by Stephen White. + + No new tests. + See related chrome issue + http://code.google.com/p/chromium/issues/detail?id=108605 + + * platform/graphics/skia/GraphicsContextSkia.cpp: + (WebCore::setPathFromConvexPoints): + +2012-01-10 Gavin Barraclough <barraclough@apple.com> + + Do not allow Array length to be set if it is non-configurable + https://bugs.webkit.org/show_bug.cgi?id=75935 + + Reviewed by Sam Weinig. + + * bindings/js/SerializedScriptValue.cpp: + (WebCore::CloneDeserializer::deserialize): + - remove unnecessary call to JSArray::setLength. + +2012-01-10 Adrienne Walker <enne@google.com> + + [chromium] Draw debug tile borders on composited layers + https://bugs.webkit.org/show_bug.cgi?id=75680 + + Reviewed by James Robinson. + + On tiled layers, draw debug borders on the tiles themselves. By + default, these are one pixel wide and transparent, so should be + unobtrusive but informative. They are triggered when the layer itself + would have a debug border via the existing flags. + + Also, fix the drawDebugBorderQuad function to handle arbitrarily + positioned quads, not just full layer quads. Also, fix alpha issue + with debug borders. + + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::drawDebugBorderQuad): + * platform/graphics/chromium/cc/CCDebugBorderDrawQuad.cpp: + (WebCore::CCDebugBorderDrawQuad::CCDebugBorderDrawQuad): + * platform/graphics/chromium/cc/CCLayerImpl.cpp: + (WebCore::CCLayerImpl::appendDebugBorderQuad): + (WebCore::CCLayerImpl::quadTransform): + (WebCore::CCLayerImpl::hasDebugBorders): + * platform/graphics/chromium/cc/CCLayerImpl.h: + * platform/graphics/chromium/cc/CCTiledLayerImpl.cpp: + (WebCore::CCTiledLayerImpl::appendQuads): + +2012-01-10 Joseph Pecoraro <pecoraro@apple.com> + + Web Inspector: Missing Implementation of Public InspectorDOMAgent Function + https://bugs.webkit.org/show_bug.cgi?id=75759 + + Follow-up: Remove the unused method. Keep the setter private. + + Reviewed by Pavel Feldman. + + * inspector/InspectorDOMAgent.cpp: + * inspector/InspectorDOMAgent.h: + +2012-01-10 Pavel Feldman <pfeldman@google.com> + + Not reviewed, follow up to r104586: fix assertion within the loop. + + * inspector/DOMEditor.cpp: + (WebCore::DOMEditor::patchChildren): + +2012-01-10 Brady Eidson <beidson@apple.com> + + <rdar://problem/9328684> and https://bugs.webkit.org/show_bug.cgi?id=62764 + Frequent crashes due to null frame below ApplicationCacheHost::scheduleLoadFallbackResourceFromApplicationCache + + Reviewed by Maciej Stachowiak. + + This is a non-reproducible high volume crash, so no test :(. + + * loader/DocumentLoader.cpp: + (WebCore::DocumentLoader::stopLoading): Don't re-run actual "stop loading" logic if the document loader is already + stopping loading. Also add an ASSERT that might catch cases where new loads may have been started while old loads + were being stopped. + (WebCore::DocumentLoader::detachFromFrame): Be conservative and stop loading when we detach a document loader from a frame. + +2012-01-10 Pavel Feldman <pfeldman@google.com> + + Not reviewed: fixing the Mac build. + + * inspector/DOMEditor.cpp: + (WebCore::DOMEditor::patchChildren): + +2012-01-09 Jer Noble <jer.noble@apple.com> + + Elements can appear over fullscreen video + https://bugs.webkit.org/show_bug.cgi?id=75913 + + Reviewed by Simon Fraser. + + No new tests; updated fullscreen/full-screen-zIndex.html to trigger error condition. + + RenderFullScreenPlaceholder inherits the pre-fullscreen element's style, causing a stacking + context to be created. Instead of making the placeholder the parent of the RenderFullScreen + object, make the two renderers siblings. Then the stacking context created by the placeholder + will not affect the z-ordering of the RenderFullScreen. + + * rendering/RenderFullScreen.cpp: + (RenderFullScreen::wrapRenderer): + (RenderFullScreen::unwrapRenderer): + (RenderFullScreen::createPlaceholder): + +2012-01-10 Pavel Feldman <pfeldman@google.com> + + Web Inspector: add "free flow DOM editing" experiment. + https://bugs.webkit.org/show_bug.cgi?id=75955 + + This change enables HTML editing from Resources panel experiment. + + Reviewed by Yury Semikhatsky. + + * CMakeLists.txt: + * English.lproj/localizedStrings.js: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * inspector/DOMEditor.cpp: Added. + (WebCore::DOMEditor::DOMEditor): + (WebCore::DOMEditor::~DOMEditor): + (WebCore::DOMEditor::patch): + (WebCore::DOMEditor::NodeDigest::NodeDigest): + (WebCore::DOMEditor::patchElement): + (WebCore::DOMEditor::patchNode): + (WebCore::DOMEditor::patchChildren): + (WebCore::addStringToSHA1): + (WebCore::DOMEditor::createNodeDigest): + * inspector/DOMEditor.h: Added. + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::setOuterHTML): + * inspector/front-end/DOMAgent.js: + (WebInspector.DOMAgent): + (WebInspector.DOMModelResourceBinding): + (WebInspector.DOMModelResourceBinding.prototype.setContent): + (WebInspector.DOMModelResourceBinding.prototype.canSetContent): + * inspector/front-end/Settings.js: + (WebInspector.ExperimentsSettings): + +2012-01-10 Stephen Chenney <schenney@chromium.org> + + [Chromium] Shift PathSkia to use Skia's new RawIter + https://bugs.webkit.org/show_bug.cgi?id=75703 + + Reviewed by Nikolas Zimmermann. + + No new tests required - covered by existing tests. + + * platform/graphics/Path.h: Added comments ont he return values from iteration. + * platform/graphics/skia/PathSkia.cpp: + (WebCore::Path::apply): Switched to SkPath::RawIter + +2012-01-10 Peter Beverloo <peter@chromium.org> + + [Chromium] Use SkFontHost::GetUnitsPerEm instead of advanced type + metrics for Android in FontPlatformData + https://bugs.webkit.org/show_bug.cgi?id=75702 + + Reviewed by Stephen White. + + Since Skia for Android doesn't implement advanced type metric routines, + use an alternative method to calculate the number of font units for an + em size. This will be exercized by existing layout tests, as it's being + used by the ComplexTextController. + + * platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp: + (WebCore::FontPlatformData::emSizeInFontUnits): + +2012-01-10 Vsevolod Vlasov <vsevik@chromium.org> + + Unreviewed, inspector style fix. + + Web Inspector: elements tree is shifted 12px to the right. + https://bugs.webkit.org/show_bug.cgi?id=75609 + + * inspector/front-end/elementsPanel.css: + (#elements-content): + +2012-01-10 Zoltan Herczeg <zherczeg@webkit.org> + + Fix style errors in CSSParser.cpp + https://bugs.webkit.org/show_bug.cgi?id=75854 + + Reviewed by Nikolas Zimmermann. + + Minor style fixes. + + * css/CSSParser.cpp: + (WebCore::CSSParser::parseValue): + (WebCore::CSSParser::parseShadow): + (WebCore::isBorderImageRepeatKeyword): + (WebCore::BorderImageSliceParseContext::commitBorderImageSlice): + (WebCore::BorderImageQuadParseContext::commitBorderImageQuad): + (WebCore::filterInfoForName): + +2012-01-10 Julien Chaffraix <jchaffraix@webkit.org> + + REGRESSION (r93614): Safari Reader doesn't repaint correctly when scrolling + https://bugs.webkit.org/show_bug.cgi?id=67100 + + Reviewed by Dan Bernstein. + + Tests: fast/layers/scroll-with-transform-composited-layer.html + fast/layers/scroll-with-transform-layer.html + + The regression came from a previous optimization that was wrongly kept after r93614. + + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::updateLayerPositionsAfterScroll): + Remove the early return for transformed layer. This change worked as we used + to call updateLayerPositions from scrollTo which would call updateLayerPosition on + all our descendants. After r93614, this is no longer the case and we explicitely need + to call updateLayerPosition on our descendants from updateLayerPositionsAfterScroll. + +2012-01-10 Stephen White <senorblanco@chromium.org> + + Fix Chrome/Mac build. + + Build fix; unreviewed. + + * platform/graphics/filters/skia/FEColorMatrixSkia.cpp: + (WebCore::luminanceToAlphaMatrix): + +2012-01-06 Stephen White <senorblanco@chromium.org> + + [Skia] Switch FEColorMatrix to use a skia-based implementation when + compiling with USE(SKIA). This change will also switch the software + implementation of FEGaussianBlur to the skia implementation (ie., + it removes the acceleration check). + https://bugs.webkit.org/show_bug.cgi?id=75582 + + Reviewed by Dirk Schulze. + + Covered by svg/W3C-SVG-1.1/filters-color-01-b.svg and friends (will + need a rebaseline). + + * WebCore.gypi: + Add FEColorMatrixSkia.cpp to the build. + * platform/graphics/filters/FEColorMatrix.h: + Add platformApplySkia(). + * platform/graphics/filters/FEGaussianBlur.cpp: + (WebCore::FEGaussianBlur::platformApplySoftware): + Remove skia-specific code from FEGaussianBlur::platformApplySoftware(). + * platform/graphics/filters/FEGaussianBlur.h: + Make platformApplySkia() virtual, and put it behind #if USE(SKIA). + * platform/graphics/filters/FilterEffect.cpp: + (WebCore::FilterEffect::apply): + Call out to platformApplySkia(), or fall back to + platformApplySoftware(). + * platform/graphics/filters/FilterEffect.h: + Add platformApplySkia(). + * platform/graphics/filters/skia/FEColorMatrixSkia.cpp: Added. + (WebCore::saturateMatrix): + (WebCore::hueRotateMatrix): + (WebCore::luminanceToAlphaMatrix): + (WebCore::FEColorMatrix::platformApplySkia): + Process color matrix effect, by calling out to generic matrix + version of SkColorMatrixFilter. + * platform/graphics/filters/skia/FEGaussianBlurSkia.cpp: + (WebCore::FEGaussianBlur::platformApplySkia): + Change the signature of FEGaussianBlur::platformApplySkia to be an + override of the new FilterEffect base class version. + +2012-01-10 Pavel Feldman <pfeldman@google.com> + + Web Inspector: fix DebuggerPresentationModel::uiSourceCodes - do not iterate + over same raw source code multiple times. + https://bugs.webkit.org/show_bug.cgi?id=75953 + + Reviewed by Yury Semikhatsky. + + * inspector/front-end/DebuggerPresentationModel.js: + (WebInspector.DebuggerPresentationModel): + (WebInspector.DebuggerPresentationModel.prototype._bindScriptToRawSourceCode): + (WebInspector.DebuggerPresentationModel.prototype.uiSourceCodes): + (WebInspector.DebuggerPresentationModel.prototype.setFormatSource): + (WebInspector.DebuggerPresentationModel.prototype._consoleCleared): + (WebInspector.DebuggerPresentationModel.prototype._debuggerReset): + +2012-01-10 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Qt] Enable CSS_FILTERS in Qt build + https://bugs.webkit.org/show_bug.cgi?id=75777 + + Enable CSS_FILTERS and unskip the tests. + + Reviewed by Kenneth Rohde Christiansen. + + Filter tests are now unskipped for Qt. + + * Target.pri: add missing files to build. + +2012-01-10 Pavel Feldman <pfeldman@google.com> + + Web Inspector: typo: NetworkAgent.canClearBrowserCache -> NetworkAgent.canClearBrowserCookies. + https://bugs.webkit.org/show_bug.cgi?id=75949 + + Reviewed by Andreas Kling. + + * inspector/front-end/NetworkPanel.js: + (WebInspector.NetworkLogView): + +2012-01-10 pfeldman@chomium.org <pavel.feldman@gmail.com> + + Web Inspector: restore front-end compilation + https://bugs.webkit.org/show_bug.cgi?id=75625 + + Reviewed by Yury Semikhatsky. + + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.SingleFileEditorContainer.prototype.replaceSourceFrames): + * inspector/front-end/TabbedPane.js: + * inspector/front-end/externs.js: + (WebInspector.isCompactMode): + * inspector/front-end/treeoutline.js: + +2012-01-10 Grzegorz Czajkowski <g.czajkowski@samsung.com> + + Add NULL checks to setting access obtained on frame and document. + https://bugs.webkit.org/show_bug.cgi?id=72002 + + Reviewed by Andreas Kling. + + Adds NULL checks to setting object where it's required. + Generally WebCore checks NULL which may be returned from setting object obtained + on frame or document but in some cases these are skipped. These checks are not + needed to setting's access on page object. + + * html/HTMLCanvasElement.cpp: + (WebCore::HTMLCanvasElement::shouldAccelerate): + * loader/DocumentLoader.cpp: + (WebCore::DocumentLoader::scheduleArchiveLoad): + * loader/SubframeLoader.cpp: + (WebCore::SubframeLoader::requestPlugin): + * loader/appcache/ApplicationCacheGroup.cpp: + (WebCore::ApplicationCacheGroup::selectCache): + (WebCore::ApplicationCacheGroup::selectCacheWithoutManifestURL): + * page/DragController.cpp: + (WebCore::DragController::draggableNode): + * page/EventHandler.cpp: + (WebCore::EventHandler::handleMouseReleaseEvent): + * page/FocusController.cpp: + (WebCore::FocusController::advanceFocusInDocumentOrder): + * rendering/RenderFrameSet.cpp: + (WebCore::RenderFrameSet::flattenFrameSet): + * rendering/RenderIFrame.cpp: + (WebCore::RenderIFrame::flattenFrame): + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::updateBacking): + * rendering/RenderText.cpp: + (WebCore::SecureTextTimer::restartWithNewText): + +2012-01-10 Andreas Kling <awesomekling@apple.com> + + Matched declaration cache should support mapped attribute declarations. + <http://webkit.org/b/75948> + + Reviewed by Antti Koivisto. + + Support caching of matches that include mapped attribute declarations. + To make this possible, let the cache hold references to the matched style declarations. + Otherwise, declarations are assumed to survive until ~CSSStyleSelector, which may not + be the case for CSSMappedAttributeDeclaration. + + To avoid hoarding of stale CSSMappedAttributeDeclarations in the cache, do a sweep for + every 100 additions and garbage collect any entries containing a declaration that is + only referenced by the cache. + + This increases cache hit rate by up to ~10% on the Alexa top sites. + + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::CSSStyleSelector): + (WebCore::CSSStyleSelector::sweepMatchedDeclarationCache): + (WebCore::CSSStyleSelector::matchAllRules): + (WebCore::CSSStyleSelector::applyDeclarations): + (WebCore::CSSStyleSelector::addToMatchedDeclarationCache): + * css/CSSStyleSelector.h: + +2012-01-10 Kenichi Ishibashi <bashi@chromium.org> + + Complex path should be used when UVS exists in text run + https://bugs.webkit.org/show_bug.cgi?id=75289 + + Uses complex path when a text run contains UVS. The range from U+180B to U+180D already uses complex path. + Removes unnecessary functions that were added by r102915. + + Reviewed by Dan Bernstein. + + No new tests. fast/text/unicode-variation-selector.html should take care of this change. + + * platform/graphics/Font.cpp: + (WebCore::Font::codePath): Use Complex path when the text run contains UVS. + * platform/graphics/SimpleFontData.h: Removed updateGlyphWithVariationSelector(). + * platform/graphics/SurrogatePairAwareTextIterator.cpp: Removed unnecessary static functions. + * platform/graphics/SurrogatePairAwareTextIterator.h: Removed hasTrailingVariationSelector(). + * platform/graphics/WidthIterator.cpp: + (WebCore::WidthIterator::advance): Removed UVS detection code. + * platform/graphics/chromium/SimpleFontDataChromiumWin.cpp: Removed updateGlyphWithVariationSelector(). + * platform/graphics/freetype/SimpleFontDataFreeType.cpp: Ditto. + * platform/graphics/harfbuzz/SimpleFontDataSkia.cpp: Ditto. + * platform/graphics/mac/SimpleFontDataMac.mm: Ditto. + * platform/graphics/pango/SimpleFontDataPango.cpp: Ditto. + * platform/graphics/qt/SimpleFontDataQt.cpp: Ditto. + * platform/graphics/win/SimpleFontDataWin.cpp: Ditto. + * platform/graphics/wince/SimpleFontDataWinCE.cpp: Ditto. + * platform/graphics/wx/SimpleFontDataWx.cpp: Ditto. + +2012-01-10 Kenichi Ishibashi <bashi@chromium.org> + + WebFonts are re-fetched from the server upon Document::styleSelectorChanged call. + https://bugs.webkit.org/show_bug.cgi?id=73419 + + Holds the CachedFont handle in CSSFontFaceSrcValue so that avoiding re-validation during style recalculation. + + Reviewed by Dan Bernstein. + + Test: http/tests/css/font-face-src-loading.html + + * css/CSSFontFaceSrcValue.cpp: + (WebCore::CSSFontFaceSrcValue::cachedFont): Added. + * css/CSSFontFaceSrcValue.h: + * css/CSSFontSelector.cpp: + (WebCore::CSSFontSelector::addFontFaceRule): Gets the CachedFont from CSSFontFaceSrcValue object. The object will request the resource if it doesn't exist. + +2012-01-10 pfeldman@chomium.org <pavel.feldman@gmail.com> + + Web Inspector: introduce experimental setting that makes source files always editable + https://bugs.webkit.org/show_bug.cgi?id=75626 + + Reviewed by Timothy Hatcher. + + * English.lproj/localizedStrings.js: + * inspector/front-end/JavaScriptSourceFrame.js: + (WebInspector.JavaScriptSourceFrame): + (WebInspector.JavaScriptSourceFrame.prototype.setReadOnly): + * inspector/front-end/NetworkPanel.js: + (WebInspector.NetworkLogView): + * inspector/front-end/ScriptsNavigator.js: + (WebInspector.NavigatorScriptTreeElement.prototype.onselect): + * inspector/front-end/Settings.js: + (WebInspector.ExperimentsSettings): + * inspector/front-end/SourceFrame.js: + (WebInspector.SourceFrame): + (WebInspector.SourceFrame.prototype.get statusBarItems): + (WebInspector.SourceFrame.prototype.setReadOnly): + * inspector/front-end/inspector.js: + (WebInspector.loaded): + +2012-01-09 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r104507. + http://trac.webkit.org/changeset/104507 + https://bugs.webkit.org/show_bug.cgi?id=75936 + + Broke webkit_unit_tests (Requested by dimich on #webkit). + + * WebCore.gypi: + * platform/graphics/chromium/RenderSurfaceChromium.h: + * platform/graphics/chromium/cc/CCLayerIterator.cpp: Removed. + * platform/graphics/chromium/cc/CCLayerIterator.h: Removed. + * platform/graphics/chromium/cc/CCLayerIteratorPosition.h: Removed. + * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: + (WebCore::CCLayerTreeHost::paintLayerContents): + (WebCore::CCLayerTreeHost::updateCompositorResources): + * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp: + (WebCore::walkLayersAndCalculateVisibleLayerRects): + * platform/graphics/chromium/cc/CCRenderSurface.h: + +2012-01-09 Rob Buis <rbuis@rim.com> + + Upstream change to disable input[color] css rules for BlackBerry port + https://bugs.webkit.org/show_bug.cgi?id=75719 + + Reviewed by Antonio Gomes. + + Do not enable default css color rules for input["color"] for BlackBerry port. + + * CMakeLists.txt: + +2012-01-09 Greg Billock <gbillock@google.com> + + Implement navigator.startActivity; add IntentRequest object for managing web intents callbacks. + Web content will invoke navigator.startActivity to launch a new Web + Intents call. Each such call will map to an IntentRequest broker + object which is used by client code to correlate any return data to + the (optional) callbacks supplied by web content calls. + https://bugs.webkit.org/show_bug.cgi?id=75756 + + Reviewed by Adam Barth. + + Test: webintents/web-intents-api.html + + * Modules/intents/Intent.cpp: Added. + (WebCore::Intent::identifier): + (WebCore::Intent::setIdentifier): + * Modules/intents/Intent.h: Added. + * Modules/intents/Intent.idl: Added. + * Modules/intents/IntentResultCallback.h: Added. + (WebCore::IntentResultCallback::~IntentResultCallback): + * Modules/intents/IntentResultCallback.idl: Added. + * Modules/intents/IntentsRequest.cpp: Added. + * Modules/intents/IntentsRequest.h: Added. + * WebCore.gyp/WebCore.gyp: + * WebCore.gypi: + * bindings/scripts/CodeGeneratorV8.pm: + (GetNativeTypeForCallbacks): + * loader/FrameLoaderClient.h: + (WebCore::FrameLoaderClient::dispatchIntent): + +2012-01-09 Dan Bernstein <mitz@apple.com> + + -[DOMRange renderedImageForcingBlackText:] fails with non-user-selectable text + https://bugs.webkit.org/show_bug.cgi?id=75920 + + Reviewed by Darin Adler. + + Test: added to TestWebKitAPI/Tests/mac/RenderedImageFromDOMRange.mm + + * page/mac/FrameMac.mm: + (WebCore::Frame::rangeImage): Removed the requirement that the start and end positions used + for setting the selection in the render tree be candidates. + +2012-01-06 Hajime Morrita <morrita@chromium.org> + + [Refactoring] Moving between TreeScopes should be done by its own class. + https://bugs.webkit.org/show_bug.cgi?id=75290 + + Reviewed by Ryosuke Niwa. + + This change extracted Node::setTreeScopeRecursively(), + setDocumentRecursively() and a part of setDocument() into a new + class called TreeScopeAdopter. By doing this, the idea of + moving a node from scope to scope, that was originally hidden + behind the forest of Node APIs, has become clearer. + + Note that this change is a preparation for Bug 59816. + + No new tests. No behavioral change. + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * dom/ContainerNode.cpp: Followed the renaming. + (WebCore::ContainerNode::takeAllChildrenFrom): + (WebCore::ContainerNode::insertBefore): + (WebCore::ContainerNode::replaceChild): + (WebCore::ContainerNode::removeBetween): + (WebCore::ContainerNode::removeChildren): + (WebCore::ContainerNode::appendChild): + (WebCore::ContainerNode::parserAddChild): + * dom/DOMAllInOne.cpp: + * dom/Document.cpp: Followed te renaming. + (WebCore::Document::setDocType): + (WebCore::Document::adoptNode): + * dom/Element.cpp: Followed te renaming. + (WebCore::Element::removeShadowRoot): + * dom/Node.cpp: + (WebCore::Node::setDocument): + (WebCore::Node::setTreeScope): + (WebCore::Node::didMoveToNewDocument): + * dom/Node.h: + * dom/TreeScope.h: + * dom/TreeScope.cpp: + (WebCore::TreeScope::adoptIfNeeded): moved from setTreeScopeRecursively() + * dom/TreeScopeAdopter.cpp: Added. + (WebCore::TreeScopeAdopter::TreeScopeAdopter): + (WebCore::TreeScopeAdopter::moveTreeToNewScope): + (WebCore::TreeScopeAdopter::moveTreeToNewDocument): + (WebCore::TreeScopeAdopter::ensureDidMoveToNewDocumentWasCalled): + (WebCore::TreeScopeAdopter::moveNodeToNewDocument): + * dom/TreeScopeAdopter.h: Added. + (WebCore::TreeScopeAdopter::ensureDidMoveToNewDocumentWasCalled): + (WebCore::TreeScopeAdopter::execute): + (WebCore::TreeScopeAdopter::needsScopeChange()): + (WebCore::TreeScopeAdopter::shadowRootFor): + +2012-01-09 Adam Barth <abarth@webkit.org> + + run-bindings-tests should exercise all the IDL attributes we use + https://bugs.webkit.org/show_bug.cgi?id=75900 + + Reviewed by Eric Seidel. + + I just grepped through the code generator script for IDL attributes and + wrote tests for them. + + * bindings/scripts/test/CPP/WebDOMTestActiveDOMObject.cpp: Added. + * bindings/scripts/test/CPP/WebDOMTestActiveDOMObject.h: Added. + * bindings/scripts/test/CPP/WebDOMTestEventTarget.cpp: Added. + * bindings/scripts/test/CPP/WebDOMTestEventTarget.h: Added. + * bindings/scripts/test/CPP/WebDOMTestObj.cpp: + * bindings/scripts/test/CPP/WebDOMTestObj.h: + * bindings/scripts/test/CPP/WebDOMTestOverridingNameGetter.cpp: Added. + * bindings/scripts/test/CPP/WebDOMTestOverridingNameGetter.h: Added. + * bindings/scripts/test/GObject/WebKitDOMTestActiveDOMObject.cpp: Added. + * bindings/scripts/test/GObject/WebKitDOMTestActiveDOMObject.h: Added. + * bindings/scripts/test/GObject/WebKitDOMTestActiveDOMObjectPrivate.h: Added. + * bindings/scripts/test/GObject/WebKitDOMTestEventTarget.cpp: Added. + * bindings/scripts/test/GObject/WebKitDOMTestEventTarget.h: Added. + * bindings/scripts/test/GObject/WebKitDOMTestEventTargetPrivate.h: Added. + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: + * bindings/scripts/test/GObject/WebKitDOMTestOverridingNameGetter.cpp: Added. + * bindings/scripts/test/GObject/WebKitDOMTestOverridingNameGetter.h: Added. + * bindings/scripts/test/GObject/WebKitDOMTestOverridingNameGetterPrivate.h: Added. + * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: Added. + * bindings/scripts/test/JS/JSTestActiveDOMObject.h: Added. + * bindings/scripts/test/JS/JSTestEventConstructor.cpp: + * bindings/scripts/test/JS/JSTestEventTarget.cpp: Added. + * bindings/scripts/test/JS/JSTestEventTarget.h: Added. + * bindings/scripts/test/JS/JSTestInterface.cpp: + * bindings/scripts/test/JS/JSTestInterface.h: + * bindings/scripts/test/JS/JSTestObj.cpp: + * bindings/scripts/test/JS/JSTestObj.h: + * bindings/scripts/test/JS/JSTestOverridingNameGetter.cpp: Added. + * bindings/scripts/test/JS/JSTestOverridingNameGetter.h: Added. + * bindings/scripts/test/ObjC/DOMTestActiveDOMObjectInternal.h: Added. + * bindings/scripts/test/ObjC/DOMTestEventTarget.h: Added. + * bindings/scripts/test/ObjC/DOMTestEventTarget.mm: Added. + * bindings/scripts/test/ObjC/DOMTestEventTargetInternal.h: Added. + * bindings/scripts/test/ObjC/DOMTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.mm: + * bindings/scripts/test/ObjC/DOMTestOverridingNameGetter.h: Added. + * bindings/scripts/test/ObjC/DOMTestOverridingNameGetter.mm: Added. + * bindings/scripts/test/ObjC/DOMTestOverridingNameGetterInternal.h: Added. + * bindings/scripts/test/TestDomainSecurity.idl: Added. + * bindings/scripts/test/TestEventConstructor.idl: + * bindings/scripts/test/TestEventTarget.idl: Added. + * bindings/scripts/test/TestInterface.idl: + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/TestOverridingNameGetter.idl: Added. + * bindings/scripts/test/V8/V8TestActiveDOMObject.cpp: Added. + * bindings/scripts/test/V8/V8TestActiveDOMObject.h: Added. + * bindings/scripts/test/V8/V8TestEventConstructor.cpp: + * bindings/scripts/test/V8/V8TestEventTarget.cpp: Added. + * bindings/scripts/test/V8/V8TestEventTarget.h: Added. + * bindings/scripts/test/V8/V8TestInterface.h: + * bindings/scripts/test/V8/V8TestObj.cpp: + * bindings/scripts/test/V8/V8TestOverridingNameGetter.cpp: Added. + * bindings/scripts/test/V8/V8TestOverridingNameGetter.h: Added. + +2012-01-09 Nat Duca <nduca@chromium.org> + + [chromium] Add documentation to updater classes + https://bugs.webkit.org/show_bug.cgi?id=75866 + + Reviewed by James Robinson. + + * platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h: + * platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h: + * platform/graphics/chromium/CanvasLayerTextureUpdater.h: + * platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h: + * platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.h: + +2012-01-09 Adam Barth <abarth@webkit.org> + + Remove unused variable from CodeGeneratorV8 + https://bugs.webkit.org/show_bug.cgi?id=75895 + + Reviewed by Eric Seidel. + + Unused variables aren't worth keeping around. + + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateHeader): + (GenerateImplementation): + +2012-01-09 Dana Jansens <danakj@chromium.org> + + [chromium] Create iterators for the RenderSurface-Layer tree + https://bugs.webkit.org/show_bug.cgi?id=74203 + + Reviewed by James Robinson. + + New unit tests: CCLayerIteratorTest.cpp + + * WebCore.gypi: + * platform/graphics/chromium/RenderSurfaceChromium.h: + * platform/graphics/chromium/cc/CCLayerIterator.cpp: Added. + (WebCore::CCLayerIteratorActions::BackToFront::begin): + (WebCore::CCLayerIteratorActions::BackToFront::end): + (WebCore::CCLayerIteratorActions::BackToFront::next): + (WebCore::CCLayerIteratorActions::FrontToBack::begin): + (WebCore::CCLayerIteratorActions::FrontToBack::end): + (WebCore::CCLayerIteratorActions::FrontToBack::next): + (WebCore::CCLayerIteratorActions::FrontToBack::goToHighestInSubtree): + * platform/graphics/chromium/cc/CCLayerIterator.h: Added. + (WebCore::CCLayerIterator::CCLayerIterator): + (WebCore::CCLayerIterator::begin): + (WebCore::CCLayerIterator::end): + (WebCore::CCLayerIterator::operator++): + (WebCore::CCLayerIterator::operator==): + (WebCore::CCLayerIterator::operator!=): + (WebCore::CCLayerIterator::operator->): + (WebCore::CCLayerIterator::operator*): + (WebCore::CCLayerIterator::representsTargetRenderSurface): + (WebCore::CCLayerIterator::representsContributingRenderSurface): + (WebCore::CCLayerIterator::representsItself): + (WebCore::CCLayerIterator::targetRenderSurfaceLayer): + * platform/graphics/chromium/cc/CCLayerIteratorPosition.h: Added. + (WebCore::CCLayerIteratorPosition::CCLayerIteratorPosition): + (WebCore::CCLayerIteratorPosition::currentLayer): + (WebCore::CCLayerIteratorPosition::currentLayerRepresentsContributingRenderSurface): + (WebCore::CCLayerIteratorPosition::currentLayerRepresentsTargetRenderSurface): + (WebCore::CCLayerIteratorPosition::targetRenderSurfaceLayer): + (WebCore::CCLayerIteratorPosition::targetRenderSurface): + (WebCore::CCLayerIteratorPosition::targetRenderSurfaceChildren): + (WebCore::CCLayerIteratorPosition::operator==): + * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: + (WebCore::CCLayerTreeHost::paintLayerContents): + (WebCore::CCLayerTreeHost::updateCompositorResources): + * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp: + (WebCore::walkLayersAndCalculateVisibleLayerRects): + * platform/graphics/chromium/cc/CCRenderSurface.h: + +2012-01-09 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Throw exception if IDBCursor.continue() called with lower key than current + https://bugs.webkit.org/show_bug.cgi?id=74213 + + Reviewed by Tony Chang. + + * storage/IDBCursorBackendImpl.cpp: + (WebCore::IDBCursorBackendImpl::continueFunction): + +2012-01-09 Justin Novosad <junov@chromium.org> + + [chromium win] Creating lots of temporary canvas contexts will crash. + https://bugs.webkit.org/show_bug.cgi?id=68420 + + When using the skia port, the allocation of 2d canvas backing stores + no longer needs to be done through a platform API (GDI/CG) because + canvases now use skia for drawing text. Removing the allocation through + GDI on windows prevents resource exhaustion due to unreferenced canvases + that are awaiting garbage collection. + + Reviewed by Stephen White. + + No new tests: Relying on existing canvas layout tests. + + * html/HTMLCanvasElement.cpp: + (WebCore::HTMLCanvasElement::createImageBuffer): + * platform/graphics/ImageBuffer.h: + * platform/graphics/skia/ImageBufferSkia.cpp: + (WebCore::createNonPlatformCanvas): + (WebCore::ImageBuffer::ImageBuffer): + +2012-01-09 Avi Drissman <avi@chromium.org> + + https://bugs.webkit.org/show_bug.cgi?id=75860 + [Chromium Mac] no background is drawn for input elements + + Reviewed by Dimitri Glazkov. + + Reverts r104240 for Chromium. Unfortunately the code that uses Cocoa + API misbehaves when built with the 10.5 SDK, so we use SPI. For now. + + * rendering/RenderThemeChromiumMac.h: + * rendering/RenderThemeChromiumMac.mm: + (WebCore::RenderThemeChromiumMac::paintTextField): + +2012-01-09 Pablo Flouret <pablof@motorola.com> + + Compilation error on build-webkit --debug --no-3d-canvas on mac. + https://bugs.webkit.org/show_bug.cgi?id=75878 + + Reviewed by Alexey Proskuryakov. + + * html/canvas/WebGLContextEvent.cpp: + +2012-01-09 Tom Sepez <tsepez@chromium.org> + + Treat code="" attribute in embed tags similarly to applet tags. + https://bugs.webkit.org/show_bug.cgi?id=75871 + + Reviewed by Daniel Bates. + + Tests: http/tests/security/xssAuditor/embed-tag-code-attribute-2.html + http/tests/security/xssAuditor/embed-tag-code-attribute.html + + * html/parser/XSSAuditor.cpp: + (WebCore::XSSAuditor::filterEmbedToken): + +2012-01-09 Justin Novosad <junov@chromium.org> + + [Chromium] remove all references to the legacy accelerated 2d Canvas + implementation + https://bugs.webkit.org/show_bug.cgi?id=75108 + + Purging an old settings flag that is no longer referenced + + Reviewed by Darin Fisher. + + * page/Settings.cpp: + (WebCore::Settings::Settings): + * page/Settings.h: + +2012-01-09 Eric Carlson <eric.carlson@apple.com> + + REGRESSION(r104327?): media/track/track-cues-cuechange.html and track-cues-enter-exit.html + intermittently time out, media/track/track-cues-seeking and fails + https://bugs.webkit.org/show_bug.cgi?id=75817 + + Unreviewed, fix a problem introduced in r104327. + + No new tests, covered by existing tests. + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::HTMLMediaElement): Initialize m_ignoreTrackDisplayUpdate. + +2012-01-09 Raymond Toy <rtoy@google.com> + + Add normalize attribute to ConvolverNode to disable normalization. + https://bugs.webkit.org/show_bug.cgi?id=75126 + + Reviewed by Kenneth Russell. + + Tests added in convolution-mono-mono.html. + + * platform/audio/Reverb.cpp: + (WebCore::Reverb::Reverb): Add extra arg to indicate whether + normalization is enabled or not, and do it. + * platform/audio/Reverb.h: Update declaration. + * webaudio/ConvolverNode.cpp: + (WebCore::ConvolverNode::ConvolverNode): Initialize attribute (to + true). + (WebCore::ConvolverNode::setBuffer): Call Reverb with + normalization argument. + * webaudio/ConvolverNode.h: + (WebCore::ConvolverNode::normalize): New method to return + normalization. + (WebCore::ConvolverNode::setNormalize): New method to set + normalization. + * webaudio/ConvolverNode.idl: Add normalize attribute. + * LayoutTests/webaudio/convolution-mono-mono.html: + * LayoutTests/webaudio/convolution-mono-mono-expected.txt: + * LayoutTests/webaudio/resources/convolution-testing.js: + Test for convolution. Tests only work when normalization is + disabled. + +2012-01-09 Judy Hao <judy.liqiong-hao@nokia.com> + + [GStreamer] webkitwebsrc: pad template is leaked + https://bugs.webkit.org/show_bug.cgi?id=74224 + + Reviewed by Philippe Normand. + + Use a GstPadTemplate smart pointer in webkit_web_src_init to + avoid a memory leak. + + Fixing memory leaks. So, no new test case is introduced. + + * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: + (webkit_web_src_init): + +2012-01-09 Xianzhu Wang <wangxianzhu@chromium.org> + + Avoid unnecessary TextureManager::reduceMemoryToLimit(). + https://bugs.webkit.org/show_bug.cgi?id=75632 + + Unnecessary TextureManager::reduceMemoryToLimit() will cause some tile + textures that are required soon to be unnecessarily removed/replaced, + and degrade performance, sometimes significantly. + + For example, CCLayerTreeHost::setViewport will be called during + scrolling. The original code would call TextureManager::reduceMemoryToLimit(), + causing some textures unnecessarily discarded and then recreated + repeatedly during scrolling. + + It's also unnecessary to call TextureManager::reduceMemoryToLimit() + from TextureManager::setPreferredMemoryLimitBytes() because the limit + is not a hard limit. The callers should call reduceMemoryToLimit() + explicitly if it wants it when setting the preferred memory limit. + + Reviewed by James Robinson. + + Tests: webkit_unit_tests --gtest_filter=TextureManagerTest.*:CCLayerTreeHostTestSetViewportSize.* + + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::finishDrawingFrame): Call reduceMemoryToLimit() explicitly + * platform/graphics/chromium/TextureManager.cpp: + (WebCore::TextureManager::setPreferredMemoryLimitBytes): Removed call to reduceMemoryToLimit(). + * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: + (WebCore::CCLayerTreeHost::finishCommitOnImplThread): + (WebCore::CCLayerTreeHost::setViewportSize): Changed name from setViewport(). Check change of viewportSize. + * platform/graphics/chromium/cc/CCLayerTreeHost.h: + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::CCLayerTreeHostImpl::setViewportSize): Changed name from setViewport() + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h: + +2012-01-09 Sami Kyostila <skyostil@chromium.org> + + [Chromium] JPEG RGB swizzling order should match platform pixel format + https://bugs.webkit.org/show_bug.cgi?id=75861 + + Choose between JCS_EXT_BGRX and JCS_EXT_RGBX channel swizzling + based on the configured Skia 32-bit pixel format. + + Reviewed by Kenneth Russell. + + * platform/image-decoders/jpeg/JPEGImageDecoder.cpp: + (rgbOutputColorSpace): + +2012-01-09 Alexis Menard <alexis.menard@openbossa.org> + + getComputedStyle for border-radius is not implemented. + https://bugs.webkit.org/show_bug.cgi?id=75630 + + Reviewed by Tony Chang. + + Implement getComputedStyle for border-radius shorthand property. + + Test: fast/css/getComputedStyle/getComputedStyle-border-radius-shorthand.html + + * css/CSSComputedStyleDeclaration.cpp: + (WebCore::getBorderRadiusCornerValues): + (WebCore::getBorderRadiusCornerValue): + (WebCore::getBorderRadiusShorthandValue): + (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): + +2012-01-09 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r104418. + http://trac.webkit.org/changeset/104418 + https://bugs.webkit.org/show_bug.cgi?id=75855 + + we still need to build against CG on Mac sometimes (Requested + by epoger on #webkit). + + * WebCore.gyp/WebCore.gyp: + +2012-01-09 Martin Robinson <mrobinson@igalia.com> + + [GTK] [AC] Simplify accelerated compositing build options + https://bugs.webkit.org/show_bug.cgi?id=75518 + + Reviewed by Gustavo Noronha Silva. + + * GNUmakefile.am: Automatically enable 3D rendering when AC is available. + * GNUmakefile.list.am: Clean up a comment. + +2012-01-09 Antti Koivisto <antti@apple.com> + + possible regression: r104060 maybe causing crashes + https://bugs.webkit.org/show_bug.cgi?id=75676 + + Reviewed by Andreas Kling. + + Based on the stacks, CSSStyleSelector may be getting deleted from under the + CSSStyleSelector::appendAuthorStylesheets call. Protect by temporarily detaching + from the document. Also add assertions to catch the case. + + No test, there is no known repro and the fix is speculative. + + * dom/Document.cpp: + (WebCore::Document::Document): + (WebCore::Document::setDocType): + (WebCore::Document::childrenChanged): + (WebCore::Document::clearStyleSelector): + (WebCore::Document::updateActiveStylesheets): + * dom/Document.h: + +2012-01-09 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + Use Vector<OwnPtr> for m_viewportDependentMediaQueryResults in CSSStyleSelector + https://bugs.webkit.org/show_bug.cgi?id=75723 + + Reviewed by Andreas Kling. + + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::~CSSStyleSelector): + (WebCore::CSSStyleSelector::addViewportDependentMediaQueryResult): + * css/CSSStyleSelector.h: + +2012-01-09 Alexis Menard <alexis.menard@openbossa.org> + + Extend CSSValueList to allow slash separated lists. + https://bugs.webkit.org/show_bug.cgi?id=75841 + + Reviewed by Andreas Kling. + + Multiple CSS properties are using slash to separate + various parts (e.g. border-radius) so having this + feature available in CSSValueList will make it easier + in the future to support these properties. + + No new tests : existing ones should cover the refactor. + + * css/CSSInitialValue.h: + (WebCore::CSSInitialValue::isImplicit): + (WebCore::CSSInitialValue::CSSInitialValue): + * css/CSSValue.cpp: + (WebCore::CSSValue::isImplicitInitialValue): + * css/CSSValue.h: + In order for CSSValue to not grow I moved m_isImplicitInitialValue + back to CSSInitialValue as this object is used only in CSSValuePool + and is allocated only twice. + (WebCore::CSSValue::CSSValue): + * css/CSSValueList.cpp: + (WebCore::CSSValueList::CSSValueList): + (WebCore::CSSValueList::copy): + Fix also usage of PassRefPtr. + (WebCore::CSSValueList::customCssText): + Refactor to use StringBuilder. + * css/CSSValueList.h: + (WebCore::CSSValueList::createCommaSeparated): + (WebCore::CSSValueList::createSpaceSeparated): + (WebCore::CSSValueList::createSlashSeparated): + * css/WebKitCSSFilterValue.cpp: + (WebCore::WebKitCSSFilterValue::WebKitCSSFilterValue): + * css/WebKitCSSTransformValue.cpp: + (WebCore::WebKitCSSTransformValue::WebKitCSSTransformValue): + +2012-01-09 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Texmap] Move surface management from TextureMapperNode to TextureMapper + https://bugs.webkit.org/show_bug.cgi?id=75779 + + Instead of a TextureMapperSurfaceManager class inside of TextureMapperNode.cpp, we now + maintain that surface pool inside of the TextureMapper class. This will later allow us to + allocate intermediate surface from within TextureMapperGL, a functionality we need for + filters. + + Also, surfaces are not automatically created with the viewport size, but rather with the + size passed as a parameter. The surface from the pool is the smallest texture that is + larger than the required size, or any texture if such texture is not yet allocated. + + Reviewed by Kenneth Rohde Christiansen. + + Tests in LayoutTests/compositing already cover this. + + * GNUmakefile.list.am: Added TextureMapper.cpp to the build. + * Target.pri: Added TextureMapper.cpp to the build. + * WebCore.gypi: Added TextureMapper.cpp to the build. + * platform/graphics/texmap/TextureMapper.cpp: Added. + * platform/graphics/texmap/TextureMapper.h: + * platform/graphics/texmap/TextureMapperNode.cpp: + (WebCore::TextureMapperNode::paint): + (WebCore::TextureMapperNode::paintReflection): + (WebCore::TextureMapperNode::paintRecursive): + * platform/graphics/texmap/TextureMapperNode.h: + (WebCore::TextureMapperNode::TextureMapperNode): + +2012-01-09 Mario Sanchez Prada <msanchez@igalia.com> + + [Gtk] Regression: text-inserted events lack text inserted and current line + https://bugs.webkit.org/show_bug.cgi?id=72830 + + Reviewed by Martin Robinson. + + Fix issue getting the exposed text for an accessibility object at, + before of after a given offset, after changing it at least once. + + * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: + (webkit_accessible_class_init): Don't initialize + gailTextUtilQuark, it won't be used anymore. + (getGailTextUtilForAtk): Don't cache the GailTextUtil as object + data, but create a new one each time this function is called. + (webkit_accessible_text_get_caret_offset): Simplified code by + using the new focusedObjectAndCaretOffsetUnignored function, + instead of the old objectAndOffsetUnignored function. + (focusedObjectAndCaretOffsetUnignored): Rewrite of the old + objectAndOffsetUnignored function so it now needs less + parameters than before and takes care of carefully selecting the + start and end visible positions to calculate the position of the + caret from the point of view of the accessibility object of + reference passed as the only input parameter now. Updated callers. + * accessibility/gtk/AccessibilityObjectWrapperAtk.h: + + * editing/gtk/FrameSelectionGtk.cpp: + (WebCore::FrameSelection::notifyAccessibilityForSelectionChange): + Simplified code by calling to focusedObjectAndCaretOffsetUnignored + function, instead of the old objectAndOffsetUnignored function. + +2012-01-09 Antti Koivisto <antti@apple.com> + + Subtree invalidation on stylesheet change + https://bugs.webkit.org/show_bug.cgi?id=75834 + + Reviewed by Andreas Kling. + + Currently if we add a stylesheet with scoped selectors and matching scope elements exist, + we recalculate the entire document style. It is sufficient to invalidate the subtrees + matching the scope only. + + This allows us to do less full style recalcs on many popular web sites (nytimes.com for example). + Subtree recalcs are typically much cheaper. + + Test: fast/css/id-or-class-before-stylesheet.html + + * dom/Document.cpp: + (WebCore::Document::testAddedStylesheetRequiresStyleRecalc): + (WebCore::Document::analyzeStylesheetChange): + (WebCore::Document::updateActiveStylesheets): + * dom/Document.h: + +2012-01-09 Carlos Garcia Campos <cgarcia@igalia.com> + + Unreviewed. Fix make distcheck issues. + + * GNUmakefile.list.am: Add missing header. + +2012-01-09 Kentaro Hara <haraken@chromium.org> + + [Refactoring] Use join(", ", @arguments) to build a method argument string + in CodeGeneratorJS.pm + https://bugs.webkit.org/show_bug.cgi?id=75830 + + Reviewed by Adam Barth. + + The code in CodeGeneratorJS.pm to build a method argument string is dirty + and error-prone. It is concatenating arguments one by one judging whether + ", " is necessary or not. This patch refactors the code so that it pushes + all arguments into @arguments and then builds a method string by + join(", ", @arguments). + + Test: bindings/scripts/test/* + + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateImplementation): + (GenerateParametersCheck): + (GenerateImplementationFunctionCall): + +2012-01-09 Andreas Kling <awesomekling@apple.com> + + CSSMutableStyleDeclaration: Remove propertiesEqual(). + <http://webkit.org/b/75829> + + Reviewed by Antti Koivisto. + + Remove propertiesEqual() since it was wrong (it only compared CSSValue pointers, + not the actual values.) + + Skip comparing the style declarations in NamedNodeMap::mappedMapsEquivalent() + and just compare pointers instead. This is possible because the declarations + all come from the mapped attribute/declaration table. + + * css/CSSMutableStyleDeclaration.h: + * dom/NamedNodeMap.cpp: + (WebCore::NamedNodeMap::mappedMapsEquivalent): + +2012-01-09 Adam Barth <abarth@webkit.org> + + insertAdjacentHTML doesn't play nice with DocumentFragment + https://bugs.webkit.org/show_bug.cgi?id=75826 + + Reviewed by Eric Seidel. + + Test: fast/dom/insertAdjacentHTML-DocumentFragment-crash.html + + Document nodes aren't the only non-Element ContainerNodes. + + * html/HTMLElement.cpp: + (WebCore::contextElementForInsertion): + +2012-01-09 Andreas Kling <awesomekling@apple.com> + + CSSStyleSelector: Any attribute with a decl() can be assumed to be mapped. + <http://webkit.org/b/75832> + + Reviewed by Antti Koivisto. + + Replace isMappedAttribute() check with an assertion. Only a mapped attribute + will have an associated style declaration. + + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::matchAllRules): + +2012-01-09 Kentaro Hara <haraken@chromium.org> + + [Refactoring] Use join(", ", @arguments) to build a method argument + string in CodeGeneratorV8.pm + https://bugs.webkit.org/show_bug.cgi?id=75828 + + Reviewed by Darin Adler. + + The code in CodeGeneratorV8.pm to build a method argument string is dirty + and error-prone. It is concatenating arguments one by one judging whether + ", " is necessary or not. This patch refactors the code so that it pushes + all arguments into @arguments and then builds a method string by + join(", ", @arguments). + + Test: bindings/scripts/test/* + + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateFunctionCallString): + +2012-01-08 Benjamin Poulain <benjamin@webkit.org> + + Build fix: ScrollAnimatorMac has missing initializer in systemUptime() + https://bugs.webkit.org/show_bug.cgi?id=75827 + + Reviewed by Darin Adler. + + Explicitly initialize the struct timeval to avoid compiler warnings. + + * platform/mac/ScrollAnimatorMac.mm: + (systemUptime): + +2012-01-08 ChangSeok Oh <shivamidow@gmail.com> + + Memory allocation mismatch by using adoptArrayPtr in GraphicsContext3DOpenGL.cpp + https://bugs.webkit.org/show_bug.cgi?id=75820 + + Reviewed by Darin Adler. + + Dbates submitted a patch to release fastMalloc allocation + in GraphicsContext3DOpenGL.cpp properly. + See http://trac.webkit.org/browser/trunk/Source/WebCore/ChangeLog?rev=104395 + But one thing similar to the above still remains mismatched. + + No new tests required. + + * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: + (WebCore::GraphicsContext3D::getShaderInfoLog): + +2012-01-08 Leo Yang <leo.yang@torchmobile.com.cn> + + [BlackBerry] Use the concrete FrameNetworkingContextBlackBerry to access Frame + https://bugs.webkit.org/show_bug.cgi?id=75611 + + Reviewed by Antonio Gomes. + + In platform/network/blackberry/ResourceHandleBlackBerry.cpp, we were using + NetworkingContext::wrappedFrame() to access the frame associated with the + networking context. NetworkingContext::wrappedFrame() was added as a virtual + function by the BlackBerry porting internally. It's unnecessary because + FrameNetworkingContextBlackBerry inherits from FrameNetworkingContext which + has a protected frame() member which is exported as public in + FrameNetworkingContextBlackBerry. We don't want to upstream wrappedFrame() + as a specific change of the BlackBerry porting in + platform/network/NetworkingContext.h, so use the concrete networking context + FrameNetworkingContextBlackBerry to access the associated frame. + + No functionalities changed, no new tests. + + * platform/network/blackberry/ResourceHandleBlackBerry.cpp: + (WebCore::ResourceHandle::start): + (WebCore::ResourceHandle::loadResourceSynchronously): + +2012-01-08 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r104421. + http://trac.webkit.org/changeset/104421 + https://bugs.webkit.org/show_bug.cgi?id=75816 + + Need to rebaseline some tests on Linux (Requested by noamr on + #webkit). + + * Target.pri: + +2012-01-08 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Qt] Enable CSS_FILTERS in Qt build + https://bugs.webkit.org/show_bug.cgi?id=75777 + + Enable CSS_FILTERS and unskip the tests. + + Reviewed by Kenneth Rohde Christiansen. + + Filter tests are now unskipped for Qt. + + * Target.pri: add missing files to build. + +2012-01-08 Adam Barth <abarth@webkit.org> + + [Chromium] Remove use_skia option from GYP + https://bugs.webkit.org/show_bug.cgi?id=75811 + + Reviewed by Ryosuke Niwa. + + The CG configuration of Chromium Mac is no longer supported. + + * WebCore.gyp/WebCore.gyp: + +2012-01-08 Benjamin Poulain <benjamin@webkit.org> + + Valid canonical URLs should have a lowercase hostname + https://bugs.webkit.org/show_bug.cgi?id=75771 + + Reviewed by Adam Barth. + + According to the RFC 3986 (and other browsers implementation), the hostname + of valid canonical URLs should be lowercase. + + This patch lowercase the hostname in KURL::parse() similarily to what we + do for the scheme. + + Tests: fast/url/host-lowercase-per-scheme.html + fast/url/safari-extension.html + + * platform/KURL.cpp: + (WebCore::isCanonicalHostnameLowercaseForScheme): + (WebCore::KURL::parse): + +2012-01-08 Adam Barth <abarth@webkit.org> + + Rename checkNodeSecurity and allowsAccessFromFrame to have sensible names + https://bugs.webkit.org/show_bug.cgi?id=75796 + + Reviewed by Sam Weinig. + + This patch contains only renames and FIXME comments. No behavior change. + + * bindings/js/JSDOMBinding.cpp: + (WebCore::allowAccessToNode): + (WebCore::allowAccessToFrame): + * bindings/js/JSDOMBinding.h: + * bindings/js/JSHTMLFrameElementCustom.cpp: + (WebCore::allowSettingJavascriptURL): + * bindings/js/JSHistoryCustom.cpp: + (WebCore::JSHistory::getOwnPropertySlotDelegate): + (WebCore::JSHistory::getOwnPropertyDescriptorDelegate): + (WebCore::JSHistory::putDelegate): + (WebCore::JSHistory::deleteProperty): + (WebCore::JSHistory::getOwnPropertyNames): + * bindings/js/JSLocationCustom.cpp: + (WebCore::JSLocation::getOwnPropertySlotDelegate): + (WebCore::JSLocation::getOwnPropertyDescriptorDelegate): + (WebCore::JSLocation::putDelegate): + (WebCore::JSLocation::deleteProperty): + (WebCore::JSLocation::getOwnPropertyNames): + (WebCore::JSLocation::toStringFunction): + * bindings/js/ScriptController.cpp: + (WebCore::ScriptController::canAccessFromCurrentOrigin): + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateGetOwnPropertyDescriptorBody): + (GenerateImplementation): + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateNormalAttrGetter): + (GenerateFunctionCallback): + +2012-01-08 Adam Barth <abarth@webkit.org> + + Remove deprecated toDynamicFrame and unused [CallWith=DynamicFrame] + https://bugs.webkit.org/show_bug.cgi?id=75795 + + Reviewed by Eric Seidel. + + We've succeeded in removing all the callers fo this function, including + all the uses of CallWith=DynamicFrame in IDL files. + + * bindings/js/JSDOMBinding.cpp: + * bindings/js/JSDOMBinding.h: + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateParametersCheck): + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateFunctionCallString): + * bindings/scripts/test/CPP/WebDOMTestObj.cpp: + * bindings/scripts/test/CPP/WebDOMTestObj.h: + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: + * bindings/scripts/test/JS/JSTestObj.cpp: + * bindings/scripts/test/JS/JSTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.mm: + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/V8/V8TestObj.cpp: + +2012-01-08 Adam Barth <abarth@webkit.org> + + NeedsUserGestureCheck IDL attribute is no longer used + https://bugs.webkit.org/show_bug.cgi?id=75794 + + Reviewed by Eric Seidel. + + This IDL attribute is no longer used because we use static state to + keep track of the user gesture state. We can delete the code that + supports it. + + * bindings/scripts/CodeGeneratorCPP.pm: + * bindings/scripts/CodeGeneratorGObject.pm: + * bindings/scripts/CodeGeneratorJS.pm: + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/scripts/test/TestObj.idl: + +2012-01-08 Adam Barth <abarth@webkit.org> + + Remove unused security functions from V8 bindings + https://bugs.webkit.org/show_bug.cgi?id=75797 + + Reviewed by Eric Seidel. + + This functions have no callers. They can be removed. + + * bindings/v8/ScriptController.cpp: + * bindings/v8/ScriptController.h: + * bindings/v8/specialization/V8BindingState.cpp: + * bindings/v8/specialization/V8BindingState.h: + +2012-01-08 Pratik Solanki <psolanki@apple.com> + + Assertion failure under SharedBuffer::append() when NETWORK_CFDATA_ARRAY_CALLBACK is enabled + https://bugs.webkit.org/show_bug.cgi?id=75656 + + Reviewed by Darin Adler. + + Update the implementation of SubresourceLoader::didReceiveDataArray() to conform to the + refactoring done as part of bug 71149 in r100311. + + * loader/SubresourceLoader.cpp: + (WebCore::SubresourceLoader::didReceiveData): + (WebCore::SubresourceLoader::errorLoadingResource): + * loader/SubresourceLoader.h: + * loader/cf/SubresourceLoaderCF.cpp: + (WebCore::SubresourceLoader::didReceiveDataArray): + +2012-01-08 Steve Block <steveblock@google.com> + + Remove V8-specific Java Bridge code + https://bugs.webkit.org/show_bug.cgi?id=75801 + + Reviewed by Darin Adler. + + Also remove superfluous JSC and V8 guards, as the code is now used only + with JSC. + + No new tests, removing dead code only. + + * WebCore.gypi: + * bridge/jni/JNIUtility.cpp: + (JSC::Bindings::javaTypeFromClassName): + (JSC::Bindings::signatureFromJavaType): + (JSC::Bindings::getJNIField): + (JSC::Bindings::callJNIMethod): + * bridge/jni/JavaType.h: + * bridge/jni/jsc/JavaMethodJSC.cpp: + (appendClassName): + (JavaMethod::signature): + * bridge/jni/v8/JNIUtilityPrivate.cpp: Removed. + * bridge/jni/v8/JNIUtilityPrivate.h: Removed. + * bridge/jni/v8/JavaClassV8.h: Removed. + * bridge/jni/v8/JavaFieldV8.h: Removed. + * bridge/jni/v8/JavaInstanceV8.h: Removed. + * bridge/jni/v8/JavaMethodV8.h: Removed. + * bridge/jni/v8/JavaNPObjectV8.cpp: Removed. + * bridge/jni/v8/JavaNPObjectV8.h: Removed. + * bridge/jni/v8/JavaValueV8.h: Removed. + * bridge/jsc/BridgeJSC.h: + +2012-01-08 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r104403. + http://trac.webkit.org/changeset/104403 + https://bugs.webkit.org/show_bug.cgi?id=75803 + + It broke all tests on Qt5 (Requested by Ossy_weekend on + #webkit). + + * Target.pri: + +2012-01-08 Antti Koivisto <antti@apple.com> + + Don't create style selector in Element::recalcStyleIfNeededAfterAttributeChanged if it doesn't exist + https://bugs.webkit.org/show_bug.cgi?id=75802 + + Rubber-stamped by Andreas Kling. + + Element::recalcStyleIfNeededAfterAttributeChanged shouldn't create style selector for attribute + check if it doesn't already exist. We are going to need a full style recalc anyway in that case + and the constructed style selector may get throw out again. + + * dom/Element.cpp: + (WebCore::Element::recalcStyleIfNeededAfterAttributeChanged): + +2012-01-08 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Qt] Enable CSS_FILTERS in Qt build + https://bugs.webkit.org/show_bug.cgi?id=75777 + + Enable CSS_FILTERS and unskip the tests. + + Reviewed by Kenneth Rohde Christiansen. + + Filter tests are now unskipped for Qt. + + * Target.pri: add missing files to build. + +2012-01-07 Antti Koivisto <antti@apple.com> + + REGRESSION (r104060): Layout Test fast/media/viewport-media-query.html is occasionally failing + https://bugs.webkit.org/show_bug.cgi?id=75633 + + Reviewed by Andreas Kling. + + If something triggers CSSStyleSelector construction very early, before documentElement is known, + it won't be able to resolve viewport-related media queries. In the included test case + the attribute on <html> element triggers the style selector creation. I can't repro + the fast/media/viewport-media-query.html failure but I suspect it is the same issue with + a different mechanism for early CSSStyleSelector construction. + + - Reset style selector on documentElement change. + - Remove the code for lazy documentElement initialization. It is not an useful optimization, + the children of Document rarely change. + + Test: fast/media/viewport-media-query-synchronous.html + + * WebCore.exp.in: + * dom/Document.cpp: + (WebCore::Document::childrenChanged): + * dom/Document.h: + (WebCore::Document::documentElement): + +2012-01-07 Andreas Kling <awesomekling@apple.com> + + Attempt to regenerate bindings on the Windows bot. + + * html/HTMLCollection.h: + +2012-01-07 Daniel Bates <dbates@webkit.org> + + Memory allocator mismatch; Use operator new[] with OwnArrayPtr instead of fastMalloc() + + Rubber-stamped by Adam Barth. + + Currently getProgramInfoLog() in GraphicsContext3DOpenGL.cpp assumes that operator new[] + and fastMalloc() are equivalent when it adopts a fastMalloc() allocated buffer. Notice, + OwnArrayPtr ultimately calls delete[] on destruction. When GLOBAL_FASTMALLOC_NEW is disabled, + it isn't true that operator new[], operator delete[] are equivalent to fastMalloc(), fastFree(), + respectively. Hence, there may be a mismatch between the allocation and deallocation + routines. Therefore, we should allocate the array to be adopted by OwnArrayPtr using + operator new[]. + + * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: + (WebCore::GraphicsContext3D::getProgramInfoLog): + +2012-01-07 Chris Marrin <cmarrin@apple.com> + + Fixed ANGLE build for GNU and QT broken in https://trac.webkit.org/changeset/104363 + + Unreviewed. + + * GNUmakefile.list.am: + * Target.pri: + +2012-01-07 Andreas Kling <awesomekling@apple.com> + + Unreviewed C++ bindings build fix after r104383. + + Use WTF::getPtr() to grab at impl pointer since they could be either RefPtr or raw. + + * bindings/scripts/CodeGeneratorCPP.pm: + (GenerateImplementation): + * bindings/scripts/test/CPP/WebDOMTestCallback.cpp: + (WebDOMTestCallback::impl): + * bindings/scripts/test/CPP/WebDOMTestEventConstructor.cpp: + (WebDOMTestEventConstructor::impl): + * bindings/scripts/test/CPP/WebDOMTestInterface.cpp: + (WebDOMTestInterface::impl): + * bindings/scripts/test/CPP/WebDOMTestMediaQueryListListener.cpp: + (WebDOMTestMediaQueryListListener::impl): + * bindings/scripts/test/CPP/WebDOMTestNamedConstructor.cpp: + (WebDOMTestNamedConstructor::impl): + * bindings/scripts/test/CPP/WebDOMTestObj.cpp: + (WebDOMTestObj::impl): + * bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.cpp: + (WebDOMTestSerializedScriptValueInterface::impl): + +2012-01-07 Andreas Kling <awesomekling@apple.com> + + Simplify HTMLCollection ownership model. + <http://webkit.org/b/75437> + + Reviewed by Sam Weinig. + + Remove HTMLCollection's inheritance from RefCounted and use OwnPtr to store it. + Added ref()/deref() methods that forward to the collection's base node, these + are only ever used by DOM wrappers. + + This is a behavior change, HTMLCollection wrappers now keep the base node alive. + + Test: fast/dom/htmlcollection-protects-base.html + + * html/HTMLCollection.h: + (WebCore::HTMLCollection::ref): + (WebCore::HTMLCollection::deref): + + Removed inheritance from RefCounted. Added ref/deref that forward the refs + to the collection's base Node. + + * dom/Element.cpp: + (WebCore::Element::~Element): + * dom/Document.h: + * dom/Document.cpp: + (WebCore::Document::~Document): + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::~HTMLFormElement): + * html/HTMLSelectElement.h: + * html/HTMLSelectElement.cpp: + + Remove HTMLCollection::detachFromNode() and call sites. + + * html/HTMLAllCollection.cpp: + (WebCore::HTMLAllCollection::namedItemWithIndex): + * html/HTMLCollection.cpp: + (WebCore::HTMLCollection::HTMLCollection): + (WebCore::HTMLCollection::invalidateCacheIfNeeded): + (WebCore::HTMLCollection::itemAfter): + (WebCore::HTMLCollection::calcLength): + (WebCore::HTMLCollection::length): + (WebCore::HTMLCollection::item): + (WebCore::HTMLCollection::nextItem): + (WebCore::HTMLCollection::namedItem): + (WebCore::HTMLCollection::updateNameCache): + (WebCore::HTMLCollection::hasNamedItem): + (WebCore::HTMLCollection::namedItems): + (WebCore::HTMLCollection::tags): + * html/HTMLFormCollection.cpp: + (WebCore::HTMLFormCollection::calcLength): + (WebCore::HTMLFormCollection::item): + (WebCore::HTMLFormCollection::getNamedItem): + (WebCore::HTMLFormCollection::namedItem): + (WebCore::HTMLFormCollection::updateNameCache): + * html/HTMLNameCollection.cpp: + (WebCore::HTMLNameCollection::itemAfter): + * html/HTMLOptionsCollection.cpp: + (WebCore::HTMLOptionsCollection::add): + (WebCore::HTMLOptionsCollection::remove): + (WebCore::HTMLOptionsCollection::selectedIndex): + (WebCore::HTMLOptionsCollection::setSelectedIndex): + (WebCore::HTMLOptionsCollection::setLength): + * html/HTMLPropertiesCollection.cpp: + (WebCore::HTMLPropertiesCollection::length): + (WebCore::HTMLPropertiesCollection::item): + (WebCore::HTMLPropertiesCollection::names): + + Removed base node null-checks and assertions. Added one assertion to + the HTMLCollection constructor (that m_base is non-null.) + + * dom/Document.h: + * dom/Document.cpp: + (WebCore::Document::openSearchDescriptionURL): + (WebCore::Document::cachedCollection): + (WebCore::Document::images): + (WebCore::Document::applets): + (WebCore::Document::embeds): + (WebCore::Document::plugins): + (WebCore::Document::objects): + (WebCore::Document::scripts): + (WebCore::Document::links): + (WebCore::Document::forms): + (WebCore::Document::anchors): + (WebCore::Document::all): + (WebCore::Document::windowNamedItems): + (WebCore::Document::documentNamedItems): + * bindings/js/JSDOMWindowCustom.cpp: + (WebCore::namedItemGetter): + * bindings/js/JSHTMLDocumentCustom.cpp: + (WebCore::JSHTMLDocument::nameGetter): + (WebCore::JSHTMLDocument::all): + * bindings/v8/custom/V8DOMWindowCustom.cpp: + (WebCore::V8DOMWindow::namedPropertyGetter): + * bindings/v8/custom/V8HTMLDocumentCustom.cpp: + (WebCore::V8HTMLDocument::GetNamedProperty): + * dom/ElementRareData.h: + (WebCore::ElementRareData::ensureCachedHTMLCollection): + * dom/NodeRareData.h: + (WebCore::NodeRareData::properties): + * html/HTMLAllCollection.h: + * html/HTMLAllCollection.cpp: + (WebCore::HTMLAllCollection::create): + * html/HTMLCollection.h: + * html/HTMLCollection.cpp: + (WebCore::HTMLCollection::create): + (WebCore::HTMLCollection::HTMLCollection): + * html/HTMLDataListElement.cpp: + (WebCore::HTMLDataListElement::options): + * html/HTMLDataListElement.h: + * html/HTMLElement.cpp: + (WebCore::HTMLElement::children): + * html/HTMLElement.h: + * html/HTMLSelectElement.h: + (WebCore::HTMLSelectElement::options): + * html/HTMLFormCollection.h: + * html/HTMLFormElement.h: + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::elements): + * html/HTMLNameCollection.h: + (WebCore::HTMLNameCollection::create): + * html/HTMLFormCollection.cpp: + (WebCore::HTMLFormCollection::create): + * html/HTMLMapElement.cpp: + (WebCore::HTMLMapElement::imageElement): + (WebCore::HTMLMapElement::areas): + * html/HTMLMapElement.h: + * html/HTMLPropertiesCollection.h: + * html/HTMLTableElement.cpp: + (WebCore::HTMLTableElement::rows): + (WebCore::HTMLTableElement::tBodies): + * html/HTMLTableElement.h: + * html/HTMLTableRowElement.cpp: + (WebCore::HTMLTableRowElement::insertCell): + (WebCore::HTMLTableRowElement::deleteCell): + (WebCore::HTMLTableRowElement::cells): + * html/HTMLTableRowElement.h: + * html/HTMLTableRowsCollection.cpp: + (WebCore::HTMLTableRowsCollection::create): + (WebCore::HTMLTableRowsCollection::itemAfter): + * html/HTMLTableRowsCollection.h: + * html/HTMLTableSectionElement.h: + * html/HTMLTableSectionElement.cpp: + (WebCore::HTMLTableSectionElement::insertRow): + (WebCore::HTMLTableSectionElement::deleteRow): + (WebCore::HTMLTableSectionElement::rows): + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::selectedOption): + * html/HTMLOptionsCollection.h: + * html/HTMLOptionsCollection.cpp: + (WebCore::HTMLOptionsCollection::create): + * html/HTMLPropertiesCollection.cpp: + (WebCore::HTMLPropertiesCollection::create): + * Source/WebCore/accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::getDocumentLinks): + + Store cached HTMLCollections in OwnPtrs. Methods that used to return + PassRefPtr<HTMLCollection> now simply return HTMLCollection*. + Updated call sites as appropriate. + +2012-01-07 Adam Barth <abarth@webkit.org> + + Attempt to fix Qt build. + + * page/Geolocation.cpp: + (WebCore::Geolocation::Geolocation): + +2012-01-06 Ryosuke Niwa <rniwa@webkit.org> + + REGRESSION(r104210): Crash inside DynamicSubtreeNodeList::length + https://bugs.webkit.org/show_bug.cgi?id=75731 + + Reviewed by Andreas Kling. + + The crash was caused by DynamicSubtreeNodeList::SubtreeCaches::domVersionIsConsistent + using m_cachedItem as a way to access the document. Changed SubtreeCaches to use + DynamicSubtreeNodeList's m_node instead. + + Test: fast/dom/node-list-length-after-removing-node.html + + * dom/DynamicNodeList.cpp: + (WebCore::DynamicSubtreeNodeList::SubtreeCaches::setLengthCache): + (WebCore::DynamicSubtreeNodeList::SubtreeCaches::setItemCache): + (WebCore::DynamicSubtreeNodeList::length): + (WebCore::DynamicSubtreeNodeList::item): + * dom/DynamicNodeList.h: + (WebCore::DynamicSubtreeNodeList::SubtreeCaches::isLengthCacheValid): + (WebCore::DynamicSubtreeNodeList::SubtreeCaches::isItemCacheValid): + (WebCore::DynamicSubtreeNodeList::SubtreeCaches::cachedItem): + (WebCore::DynamicSubtreeNodeList::SubtreeCaches::domVersionIsConsistent): + +2012-01-07 Adam Barth <abarth@webkit.org> + + Disconnecting DOMWindow properties is fragile and overly complicated + https://bugs.webkit.org/show_bug.cgi?id=75699 + + Reviewed by Alexey Proskuryakov. + + Previously, we had to carefully check every object tree hanging off of + DOMWindow to make sure that every property correctly disconnected + itself and all its subobjects from the Frame when the DOMWindow + disconnected from the Frame. + + This patch introduces DOMWindowProperty, which is a base class that + handles this work automagically, ensuring that we won't have any + dangling Frame pointers and removing a bunch of boilerplate code. + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * css/StyleMedia.cpp: + (WebCore::StyleMedia::StyleMedia): + * css/StyleMedia.h: + (WebCore::StyleMedia::create): + * loader/appcache/DOMApplicationCache.cpp: + (WebCore::DOMApplicationCache::DOMApplicationCache): + (WebCore::DOMApplicationCache::disconnectFrame): + * loader/appcache/DOMApplicationCache.h: + * page/BarInfo.cpp: + (WebCore::BarInfo::BarInfo): + * page/BarInfo.h: + * page/Console.cpp: + (WebCore::Console::Console): + (WebCore::Console::memory): + * page/Console.h: + * page/DOMSelection.cpp: + (WebCore::DOMSelection::DOMSelection): + * page/DOMSelection.h: + * page/DOMWindow.cpp: + (WebCore::DOMWindow::registerProperty): + (WebCore::DOMWindow::unregisterProperty): + (WebCore::DOMWindow::clear): + * page/DOMWindow.h: + * page/Geolocation.cpp: + (WebCore::Geolocation::Geolocation): + (WebCore::Geolocation::disconnectFrame): + * page/Geolocation.h: + * page/History.cpp: + (WebCore::History::History): + * page/History.h: + * page/Location.cpp: + (WebCore::Location::Location): + * page/Location.h: + * page/Navigator.cpp: + (WebCore::Navigator::Navigator): + (WebCore::Navigator::~Navigator): + * page/Navigator.h: + * page/Performance.cpp: + (WebCore::Performance::Performance): + (WebCore::Performance::memory): + * page/Performance.h: + * page/PerformanceNavigation.cpp: + (WebCore::PerformanceNavigation::PerformanceNavigation): + * page/PerformanceNavigation.h: + * page/PerformanceTiming.cpp: + (WebCore::PerformanceTiming::PerformanceTiming): + * page/PerformanceTiming.h: + * page/Screen.cpp: + (WebCore::Screen::Screen): + * page/Screen.h: + * plugins/DOMMimeTypeArray.cpp: + (WebCore::DOMMimeTypeArray::DOMMimeTypeArray): + * plugins/DOMMimeTypeArray.h: + * plugins/DOMPluginArray.cpp: + (WebCore::DOMPluginArray::DOMPluginArray): + * plugins/DOMPluginArray.h: + * storage/Storage.cpp: + (WebCore::Storage::Storage): + * storage/Storage.h: + +2012-01-06 Mark Rowe <mrowe@apple.com> + + REGRESSION (r83075): Save as PDF does not generate any links for webkit.org and others + <http://webkit.org/b/75768> <rdar://problem/10659258> + + Use RenderObject::hasOutline when determining whether to always create line boxes so that + we take in to consideration whether we'll be creating PDF link rects. + + Reviewed by Dan Bernstein. + + * rendering/RenderInline.cpp: + (WebCore::RenderInline::styleDidChange): + +2012-01-06 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r104373 and r104374. + http://trac.webkit.org/changeset/104373 + http://trac.webkit.org/changeset/104374 + https://bugs.webkit.org/show_bug.cgi?id=75769 + + Too many assertion failures. (Requested by kling on #webkit). + + * bindings/js/JSDOMWindowCustom.cpp: + (WebCore::namedItemGetter): + * bindings/js/JSHTMLDocumentCustom.cpp: + (WebCore::JSHTMLDocument::nameGetter): + (WebCore::JSHTMLDocument::all): + * bindings/v8/custom/V8DOMWindowCustom.cpp: + (WebCore::V8DOMWindow::namedPropertyGetter): + * bindings/v8/custom/V8HTMLDocumentCustom.cpp: + (WebCore::V8HTMLDocument::GetNamedProperty): + * dom/Document.cpp: + (WebCore::Document::~Document): + (WebCore::Document::openSearchDescriptionURL): + (WebCore::Document::cachedCollection): + (WebCore::Document::images): + (WebCore::Document::applets): + (WebCore::Document::embeds): + (WebCore::Document::plugins): + (WebCore::Document::objects): + (WebCore::Document::scripts): + (WebCore::Document::links): + (WebCore::Document::forms): + (WebCore::Document::anchors): + (WebCore::Document::all): + (WebCore::Document::windowNamedItems): + (WebCore::Document::documentNamedItems): + * dom/Document.h: + * dom/Element.cpp: + (WebCore::Element::~Element): + * dom/ElementRareData.h: + (WebCore::ElementRareData::cachedHTMLCollection): + (WebCore::ElementRareData::ensureCachedHTMLCollection): + * dom/NodeRareData.h: + (WebCore::NodeRareData::properties): + * html/HTMLAllCollection.cpp: + (WebCore::HTMLAllCollection::create): + (WebCore::HTMLAllCollection::namedItemWithIndex): + * html/HTMLAllCollection.h: + * html/HTMLCollection.cpp: + (WebCore::HTMLCollection::HTMLCollection): + (WebCore::HTMLCollection::create): + (WebCore::HTMLCollection::detachFromNode): + (WebCore::HTMLCollection::invalidateCacheIfNeeded): + (WebCore::HTMLCollection::itemAfter): + (WebCore::HTMLCollection::calcLength): + (WebCore::HTMLCollection::length): + (WebCore::HTMLCollection::item): + (WebCore::HTMLCollection::nextItem): + (WebCore::HTMLCollection::namedItem): + (WebCore::HTMLCollection::updateNameCache): + (WebCore::HTMLCollection::hasNamedItem): + (WebCore::HTMLCollection::namedItems): + (WebCore::HTMLCollection::tags): + * html/HTMLCollection.h: + * html/HTMLDataListElement.cpp: + (WebCore::HTMLDataListElement::options): + * html/HTMLDataListElement.h: + * html/HTMLElement.cpp: + (WebCore::HTMLElement::children): + * html/HTMLElement.h: + * html/HTMLFormCollection.cpp: + (WebCore::HTMLFormCollection::create): + (WebCore::HTMLFormCollection::calcLength): + (WebCore::HTMLFormCollection::item): + (WebCore::HTMLFormCollection::getNamedItem): + (WebCore::HTMLFormCollection::namedItem): + (WebCore::HTMLFormCollection::updateNameCache): + * html/HTMLFormCollection.h: + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::~HTMLFormElement): + (WebCore::HTMLFormElement::elements): + * html/HTMLFormElement.h: + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::selectedOption): + * html/HTMLMapElement.cpp: + (WebCore::HTMLMapElement::imageElement): + (WebCore::HTMLMapElement::areas): + * html/HTMLMapElement.h: + * html/HTMLNameCollection.cpp: + (WebCore::HTMLNameCollection::itemAfter): + * html/HTMLNameCollection.h: + (WebCore::HTMLNameCollection::create): + * html/HTMLOptionsCollection.cpp: + (WebCore::HTMLOptionsCollection::create): + (WebCore::HTMLOptionsCollection::add): + (WebCore::HTMLOptionsCollection::remove): + (WebCore::HTMLOptionsCollection::selectedIndex): + (WebCore::HTMLOptionsCollection::setSelectedIndex): + (WebCore::HTMLOptionsCollection::setLength): + * html/HTMLOptionsCollection.h: + * html/HTMLPropertiesCollection.cpp: + (WebCore::HTMLPropertiesCollection::create): + (WebCore::HTMLPropertiesCollection::length): + (WebCore::HTMLPropertiesCollection::item): + (WebCore::HTMLPropertiesCollection::names): + * html/HTMLPropertiesCollection.h: + * html/HTMLSelectElement.cpp: + (WebCore::HTMLSelectElement::~HTMLSelectElement): + (WebCore::HTMLSelectElement::options): + * html/HTMLSelectElement.h: + * html/HTMLTableElement.cpp: + (WebCore::HTMLTableElement::~HTMLTableElement): + +2012-01-06 Andreas Kling <awesomekling@apple.com> + + Unreviewed build fix after r104373. + + * html/HTMLTableElement.cpp: + (WebCore::HTMLTableElement::~HTMLTableElement): + +2012-01-06 Andreas Kling <awesomekling@apple.com> + + Simplify HTMLCollection ownership model. + <http://webkit.org/b/75437> + + Reviewed by Sam Weinig. + + Remove HTMLCollection's inheritance from RefCounted and use OwnPtr to store it. + Added ref()/deref() methods that forward to the collection's base node, these + are only ever used by DOM wrappers. + + This is a behavior change, HTMLCollection wrappers now keep the base node alive. + + Test: fast/dom/htmlcollection-protects-base.html + + * html/HTMLCollection.h: + (WebCore::HTMLCollection::ref): + (WebCore::HTMLCollection::deref): + + Removed inheritance from RefCounted. Added ref/deref that forward the refs + to the collection's base Node. + + * dom/Element.cpp: + (WebCore::Element::~Element): + * dom/Document.h: + * dom/Document.cpp: + (WebCore::Document::~Document): + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::~HTMLFormElement): + * html/HTMLSelectElement.h: + * html/HTMLSelectElement.cpp: + + Remove HTMLCollection::detachFromNode() and call sites. + + * html/HTMLAllCollection.cpp: + (WebCore::HTMLAllCollection::namedItemWithIndex): + * html/HTMLCollection.cpp: + (WebCore::HTMLCollection::HTMLCollection): + (WebCore::HTMLCollection::invalidateCacheIfNeeded): + (WebCore::HTMLCollection::itemAfter): + (WebCore::HTMLCollection::calcLength): + (WebCore::HTMLCollection::length): + (WebCore::HTMLCollection::item): + (WebCore::HTMLCollection::nextItem): + (WebCore::HTMLCollection::namedItem): + (WebCore::HTMLCollection::updateNameCache): + (WebCore::HTMLCollection::hasNamedItem): + (WebCore::HTMLCollection::namedItems): + (WebCore::HTMLCollection::tags): + * html/HTMLFormCollection.cpp: + (WebCore::HTMLFormCollection::calcLength): + (WebCore::HTMLFormCollection::item): + (WebCore::HTMLFormCollection::getNamedItem): + (WebCore::HTMLFormCollection::namedItem): + (WebCore::HTMLFormCollection::updateNameCache): + * html/HTMLNameCollection.cpp: + (WebCore::HTMLNameCollection::itemAfter): + * html/HTMLOptionsCollection.cpp: + (WebCore::HTMLOptionsCollection::add): + (WebCore::HTMLOptionsCollection::remove): + (WebCore::HTMLOptionsCollection::selectedIndex): + (WebCore::HTMLOptionsCollection::setSelectedIndex): + (WebCore::HTMLOptionsCollection::setLength): + * html/HTMLPropertiesCollection.cpp: + (WebCore::HTMLPropertiesCollection::length): + (WebCore::HTMLPropertiesCollection::item): + (WebCore::HTMLPropertiesCollection::names): + + Removed base node null-checks and assertions. Added one assertion to + the HTMLCollection constructor (that m_base is non-null.) + + * dom/Document.h: + * dom/Document.cpp: + (WebCore::Document::openSearchDescriptionURL): + (WebCore::Document::cachedCollection): + (WebCore::Document::images): + (WebCore::Document::applets): + (WebCore::Document::embeds): + (WebCore::Document::plugins): + (WebCore::Document::objects): + (WebCore::Document::scripts): + (WebCore::Document::links): + (WebCore::Document::forms): + (WebCore::Document::anchors): + (WebCore::Document::all): + (WebCore::Document::windowNamedItems): + (WebCore::Document::documentNamedItems): + * bindings/js/JSDOMWindowCustom.cpp: + (WebCore::namedItemGetter): + * bindings/js/JSHTMLDocumentCustom.cpp: + (WebCore::JSHTMLDocument::nameGetter): + (WebCore::JSHTMLDocument::all): + * bindings/v8/custom/V8DOMWindowCustom.cpp: + (WebCore::V8DOMWindow::namedPropertyGetter): + * bindings/v8/custom/V8HTMLDocumentCustom.cpp: + (WebCore::V8HTMLDocument::GetNamedProperty): + * dom/ElementRareData.h: + (WebCore::ElementRareData::ensureCachedHTMLCollection): + * dom/NodeRareData.h: + (WebCore::NodeRareData::properties): + * html/HTMLAllCollection.h: + * html/HTMLAllCollection.cpp: + (WebCore::HTMLAllCollection::create): + * html/HTMLCollection.h: + * html/HTMLCollection.cpp: + (WebCore::HTMLCollection::create): + (WebCore::HTMLCollection::HTMLCollection): + * html/HTMLDataListElement.cpp: + (WebCore::HTMLDataListElement::options): + * html/HTMLDataListElement.h: + * html/HTMLElement.cpp: + (WebCore::HTMLElement::children): + * html/HTMLElement.h: + * html/HTMLSelectElement.h: + (WebCore::HTMLSelectElement::options): + * html/HTMLFormCollection.h: + * html/HTMLFormElement.h: + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::elements): + * html/HTMLNameCollection.h: + (WebCore::HTMLNameCollection::create): + * html/HTMLFormCollection.cpp: + (WebCore::HTMLFormCollection::create): + * html/HTMLMapElement.cpp: + (WebCore::HTMLMapElement::imageElement): + (WebCore::HTMLMapElement::areas): + * html/HTMLMapElement.h: + * html/HTMLPropertiesCollection.h: + * html/HTMLTableElement.cpp: + (WebCore::HTMLTableElement::rows): + (WebCore::HTMLTableElement::tBodies): + * html/HTMLTableElement.h: + * html/HTMLTableRowElement.cpp: + (WebCore::HTMLTableRowElement::insertCell): + (WebCore::HTMLTableRowElement::deleteCell): + (WebCore::HTMLTableRowElement::cells): + * html/HTMLTableRowElement.h: + * html/HTMLTableRowsCollection.cpp: + (WebCore::HTMLTableRowsCollection::create): + (WebCore::HTMLTableRowsCollection::itemAfter): + * html/HTMLTableRowsCollection.h: + * html/HTMLTableSectionElement.h: + * html/HTMLTableSectionElement.cpp: + (WebCore::HTMLTableSectionElement::insertRow): + (WebCore::HTMLTableSectionElement::deleteRow): + (WebCore::HTMLTableSectionElement::rows): + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::selectedOption): + * html/HTMLOptionsCollection.h: + * html/HTMLOptionsCollection.cpp: + (WebCore::HTMLOptionsCollection::create): + * html/HTMLPropertiesCollection.cpp: + (WebCore::HTMLPropertiesCollection::create): + + Store cached HTMLCollections in OwnPtrs. Methods that used to return + PassRefPtr<HTMLCollection> now simply return HTMLCollection*. + Updated call sites as appropriate. + +2012-01-06 Adam Barth <abarth@webkit.org> + + DOMWindow should be a FrameDestructionObserver + https://bugs.webkit.org/show_bug.cgi?id=75697 + + Reviewed by Alexey Proskuryakov. + + DOMWindow plays exactly the role of a FrameDestructionObserver, just + with special-case code. It should just use the general-case code. + + * page/DOMWindow.cpp: + (WebCore::DOMWindow::DOMWindow): + (WebCore::DOMWindow::~DOMWindow): + (WebCore::DOMWindow::frameDestroyed): + * page/DOMWindow.h: + * page/Frame.cpp: + (WebCore::Frame::~Frame): + (WebCore::Frame::clearDOMWindow): + (WebCore::Frame::setDOMWindow): + * page/Frame.h: + +2012-01-06 Joseph Pecoraro <pecoraro@apple.com> + + Web Inspector: Missing Implementation of Public InspectorDOMAgent Function + https://bugs.webkit.org/show_bug.cgi?id=75759 + + Implement missing accessor and make setter public. + + Reviewed by Timothy Hatcher. + + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::searchingForNodeInPage): + * inspector/InspectorDOMAgent.h: + +2012-01-06 W. James MacLean <wjmaclean@chromium.org> + + [Chromium] Cull occluded tiles in tiled layers + https://bugs.webkit.org/show_bug.cgi?id=70533 + + Reviewed by James Robinson. + + Unit test provided, must pass all existing GPU layout tests. + + * WebCore.gypi: + * platform/graphics/chromium/cc/CCLayerImpl.cpp: + (WebCore::CCLayerImpl::appendQuads): + (WebCore::CCLayerImpl::quadTransform): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::CCLayerTreeHostImpl::calculateRenderPasses): + (WebCore::CCLayerTreeHostImpl::optimizeRenderPasses): + (WebCore::CCLayerTreeHostImpl::drawLayers): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h: + * platform/graphics/chromium/cc/CCQuadCuller.cpp: Added. + (std::swap): + (WebCore::regionContainsRect): + (WebCore::CCQuadCuller::cullOccludedQuads): + * platform/graphics/chromium/cc/CCQuadCuller.h: Added. + (WebCore::CCQuadCuller::CCQuadCuller): + * platform/graphics/chromium/cc/CCRenderPass.cpp: + (WebCore::CCRenderPass::optimizeQuads): + * platform/graphics/chromium/cc/CCRenderPass.h: + +2012-01-06 Anders Carlsson <andersca@apple.com> + + Move more rubberbanding code into ScrollAnimatorMac::smoothScrollWithEvent + https://bugs.webkit.org/show_bug.cgi?id=75750 + + Reviewed by Sam Weinig. + + * platform/mac/ScrollAnimatorMac.h: + * platform/mac/ScrollAnimatorMac.mm: + (WebCore::ScrollAnimatorMac::handleWheelEvent): + Move rubberbanding related code into smoothScrollWithEvent. + + (WebCore::ScrollAnimatorMac::smoothScrollWithEvent): + Move code here from handleWheelEvent and made the function return a boolean. + + (WebCore::ScrollAnimatorMac::snapRubberBand): + Call the client. + + (WebCore::ScrollAnimatorMac::snapRubberBandTimerFired): + Ditto. + +2012-01-06 Greg Billock <gbillock@google.com> + + WebCore implementation of the Intent object + See http://dvcs.w3.org/hg/web-intents/raw-file/tip/spec/Overview.html + for draft spec. + + https://bugs.webkit.org/show_bug.cgi?id=73051 + + Reviewed by Adam Barth. + + Test: web-intents/web-intents-api.html + + * WebCore.gypi: + * page/DOMWindow.idl: + * Modules/intents/Intent.cpp: Added. + (WebCore::Intent::Intent): + (WebCore::Intent::action): + (WebCore::Intent::setAction): + (WebCore::Intent::type): + (WebCore::Intent::setType): + (WebCore::Intent::data): + (WebCore::Intent::setData): + (WebCore::Intent::create): + * Modules/intents/Intent.h: Added. + * Modules/intents/Intent.idl: Added. + +2012-01-06 Tim Horton <timothy_horton@apple.com> + + [cg] userSpaceOnUse SVG Patterns have the wrong origin + https://bugs.webkit.org/show_bug.cgi?id=75741 + <rdar://problem/9383222> + + Reviewed by Simon Fraser. + + The transformation from pattern space to user space should use the userToBase CTM, + not the current CTM. + + Test: svg/custom/pattern-userSpaceOnUse-userToBaseTransform.xhtml + + * platform/graphics/cg/GraphicsContextCG.cpp: + (WebCore::GraphicsContext::applyStrokePattern): + (WebCore::GraphicsContext::applyFillPattern): + (WebCore::GraphicsContext::getCTM): + * platform/graphics/cg/TransformationMatrixCG.cpp: + (WebCore::AffineTransform::AffineTransform): Add a AffineTransform(CGAffineTransform) constructor + * platform/graphics/transforms/AffineTransform.h: + +2012-01-05 Simon Fraser <simon.fraser@apple.com> + + Avoid falling into tiled layers more often when the device scale factor is > 1 + <rdar://problem/10588725> + + Reviewed by John Sullivan. + + Stop taking the device scale factor into account when deciding to make + tiled layers. + + Test: compositing/tiled-layers-hidpi.html + + * platform/graphics/ca/GraphicsLayerCA.cpp: + (WebCore::GraphicsLayerCA::requiresTiledLayer): + +2012-01-06 Ryosuke Niwa <rniwa@webkit.org> + + Touch a bunch of files in an attempt to fix Mac release builds. + + * accessibility/AXObjectCache.cpp: + (WebCore::AXObjectCache::get): + * accessibility/AccessibilityAllInOne.cpp: + * editing/visible_units.cpp: + (WebCore::previousBoundary): + +2012-01-06 No'am Rosenthal <noam.rosenthal@nokia.com> + + Enable a compositing trigger for filters + https://bugs.webkit.org/show_bug.cgi?id=75658 + + This will enable forcing the compositing code path when filters exist for a RenderObject. + + Reviewed by Simon Fraser. + + No new functionality so no new tests. + + * page/ChromeClient.h: + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::requiresCompositingLayer): + (WebCore::RenderLayerCompositor::requiresCompositingForFilters): + * rendering/RenderLayerCompositor.h: + +2012-01-06 Anders Carlsson <andersca@apple.com> + + Add and use ScrollElasticityControllerClient::absoluteScrollPosition + https://bugs.webkit.org/show_bug.cgi?id=75744 + + Reviewed by Dan Bernstein. + + * platform/mac/ScrollAnimatorMac.h: + * platform/mac/ScrollAnimatorMac.mm: + (WebCore::ScrollAnimatorMac::absoluteScrollPosition): + (WebCore::ScrollAnimatorMac::snapRubberBandTimerFired): + * platform/mac/ScrollElasticityController.h: + +2012-01-06 Adam Barth <abarth@webkit.org> + + Move FrameDestructionObserver to its own file + https://bugs.webkit.org/show_bug.cgi?id=75693 + + Reviewed by Eric Seidel. + + We should have one class per file, on general principles. Also, this + make it possible to use this class in DOMWindow without introducing a + circular include dependency. + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * page/Frame.cpp: + * page/Frame.h: + * page/FrameDestructionObserver.cpp: Added. + (WebCore::FrameDestructionObserver::FrameDestructionObserver): + (WebCore::FrameDestructionObserver::~FrameDestructionObserver): + (WebCore::FrameDestructionObserver::frameDestroyed): + * page/FrameDestructionObserver.h: Added. + (WebCore::FrameDestructionObserver::frame): + * plugins/DOMMimeType.h: + * plugins/DOMPlugin.h: + +2012-01-06 Anders Carlsson <andersca@apple.com> + + Fix Snow Leopard build. + + * platform/mac/ScrollAnimatorMac.mm: + (WebCore::ScrollAnimatorMac::immediateScrollBy): + Move the function definition inside #if ENABLE(RUBBER_BANDING). + +2012-01-04 Jon Lee <jonlee@apple.com> + + Clicking on the cancel button on readonly and disabled search fields darkens as if the search field was editable + https://bugs.webkit.org/show_bug.cgi?id=69886 + <rdar://problem/10070187> + + Reviewed by Adele Peterson. + + Tests: ManualTests/search-cancel-button.html + + * rendering/RenderThemeMac.mm: + (WebCore::RenderThemeMac::paintSearchFieldCancelButton): If the input is readonly and/or disabled, force the cell to + render without highlight. + +2012-01-06 Simon Fraser <simon.fraser@apple.com> + + Mitigate scrollbar differences when running pixel tests + https://bugs.webkit.org/show_bug.cgi?id=67217 + + Reviewed by Dan Bernstein. + + Export WebCore::Settings::mockScrollbarsEnabled() for DRT. + + * WebCore.exp.in: + +2012-01-06 Tom Sepez <tsepez@chromium.org> + + Pass Content-Security-Policy directives to worker threads. + https://bugs.webkit.org/show_bug.cgi?id=73242 + + Reviewed by David Levin. + + Tests: http/tests/security/contentSecurityPolicy/shared-worker-connect-src-allowed.html + http/tests/security/contentSecurityPolicy/shared-worker-connect-src-blocked.html + http/tests/security/contentSecurityPolicy/worker-connect-src-allowed.html + http/tests/security/contentSecurityPolicy/worker-connect-src-blocked.html + + * page/ContentSecurityPolicy.h: + (WebCore::ContentSecurityPolicy::policy): + (WebCore::ContentSecurityPolicy::headerType): + * workers/DedicatedWorkerContext.cpp: + (WebCore::DedicatedWorkerContext::DedicatedWorkerContext): + * workers/DedicatedWorkerContext.h: + (WebCore::DedicatedWorkerContext::create): + * workers/DedicatedWorkerThread.cpp: + (WebCore::DedicatedWorkerThread::create): + (WebCore::DedicatedWorkerThread::DedicatedWorkerThread): + (WebCore::DedicatedWorkerThread::createWorkerContext): + * workers/DedicatedWorkerThread.h: + * workers/DefaultSharedWorkerRepository.cpp: + (WebCore::SharedWorkerScriptLoader::notifyFinished): + (WebCore::DefaultSharedWorkerRepository::workerScriptLoaded): + * workers/DefaultSharedWorkerRepository.h: + * workers/SharedWorkerContext.cpp: + (WebCore::SharedWorkerContext::SharedWorkerContext): + * workers/SharedWorkerContext.h: + (WebCore::SharedWorkerContext::create): + * workers/SharedWorkerThread.cpp: + (WebCore::SharedWorkerThread::create): + (WebCore::SharedWorkerThread::SharedWorkerThread): + (WebCore::SharedWorkerThread::createWorkerContext): + * workers/SharedWorkerThread.h: + * workers/WorkerContext.cpp: + (WebCore::WorkerContext::WorkerContext): + * workers/WorkerContext.h: + * workers/WorkerMessagingProxy.cpp: + (WebCore::WorkerMessagingProxy::startWorkerContext): + * workers/WorkerThread.cpp: + (WebCore::WorkerThreadStartupData::create): + (WebCore::WorkerThreadStartupData::WorkerThreadStartupData): + (WebCore::WorkerThread::WorkerThread): + (WebCore::WorkerThread::workerThread): + * workers/WorkerThread.h: + +2012-01-06 Mihnea Ovidenie <mihnea@adobe.com> + + [CSSRegions]Crash while collecting svg elements in render flow thread. + https://bugs.webkit.org/show_bug.cgi?id=73735 + + Reviewed by David Hyatt. + + Tests: fast/regions/svg-doc-fragment-not-collected-expected.html + fast/regions/svg-doc-fragment-not-collected.html + fast/regions/svg-element-not-collected-expected.html + fast/regions/svg-element-not-collected.html + fast/regions/svg-root-element-collected.html + + By allowing only svg root elements to be collected in a render flow thread, + the svg render tree is properly constructed, thus prevented a possible further crash. + + * dom/NodeRenderingContext.cpp: + (WebCore::NodeRenderingContext::moveToFlowThreadIfNeeded): + +2012-01-06 Eric Carlson <eric.carlson@apple.com> + + Make TextTrackCue more mutable + https://bugs.webkit.org/show_bug.cgi?id=72555 + + Reviewed by Anders Carlsson. + + Test: media/track/track-cue-mutable.html + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::updateActiveTextTrackCues): Do nothing if the "ignore cue updates" + flag is set + (WebCore::HTMLMediaElement::textTrackAddCues): Block cue updates until all of the new cues have + been added, then call updateActiveTextTrackCues so update the display if necessary. + (WebCore::HTMLMediaElement::textTrackRemoveCues): Block cue updates until all of the new cues have + been removed, then call updateActiveTextTrackCues so update the display if necessary. + (WebCore::HTMLMediaElement::textTrackAddCue): Call updateActiveTextTrackCues so update the display if necessary. + (WebCore::HTMLMediaElement::textTrackRemoveCue): Ditto. + * html/HTMLMediaElement.h: + (WebCore::HTMLMediaElement::ignoreTrackDisplayUpdateRequests): + (WebCore::HTMLMediaElement::beginIgnoringTrackDisplayUpdateRequests): + (WebCore::HTMLMediaElement::endIgnoringTrackDisplayUpdateRequests): + + * html/TextTrack.cpp: + (WebCore::TextTrack::cueWillChange): New, remove the cue from the media element because its + position in the interval tree is based on start and end times. + (WebCore::TextTrack::cueDidChange): Add the cue to the media element. + * html/TextTrack.h: + + * html/TextTrackCue.cpp: + (WebCore::startKeyword): New, use a static String for the constant. + (WebCore::middleKeyword): Ditto. + (WebCore::endKeyword): Ditto. + (WebCore::horizontalKeyword): Ditto. + (WebCore::verticalKeyword): Ditto. + (WebCore::verticallrKeyword): Ditto. + (WebCore::TextTrackCue::cueWillChange): New, tell the track the cue is about to change. + (WebCore::TextTrackCue::cueDidChange): New, tell the track the cue has changed. + (WebCore::TextTrackCue::setId): New, attribute is mutable. + (WebCore::TextTrackCue::setStartTime): Ditto. + (WebCore::TextTrackCue::setEndTime): Ditto. + (WebCore::TextTrackCue::setPauseOnExit): Ditto. + (WebCore::TextTrackCue::direction): Ditto. + (WebCore::TextTrackCue::setDirection): Ditto. + (WebCore::TextTrackCue::setSnapToLines): Ditto. + (WebCore::TextTrackCue::setLinePosition): Ditto. + (WebCore::TextTrackCue::setTextPosition): Ditto. + (WebCore::TextTrackCue::setSize): Ditto. + (WebCore::TextTrackCue::alignment): Ditto. + (WebCore::TextTrackCue::setAlignment): Ditto. + (WebCore::TextTrackCue::parseSettings): Use the static strings. + * html/TextTrackCue.h: + (WebCore::TextTrackCue::id): + (WebCore::TextTrackCue::startTime): + (WebCore::TextTrackCue::endTime): + (WebCore::TextTrackCue::pauseOnExit): + * html/TextTrackCue.idl: + +2012-01-06 Oliver Hunt <oliver@apple.com> + + DFG no longer optimises CanvasPixelArray + https://bugs.webkit.org/show_bug.cgi?id=75729 + + Reviewed by Gavin Barraclough. + + Remove the custom ClassInfo for CanvasPixelArray as that is + defeating ByteArray optimisation, and is no longer needed + anyway as it was only there to change the visible name. + + * bindings/js/JSImageDataCustom.cpp: + (WebCore::toJS): + +2012-01-06 Ken Buchanan <kenrb@chromium.org> + + ASSERT failure due to combine-text with preceding spaces + https://bugs.webkit.org/show_bug.cgi?id=65147 + + Reviewed by David Hyatt. + + A couple of ASSERTs were failing due to a parsing problem when + advancing an inline iterator to the next linebreak in a + RenderCombineText. skipLeadingWhitespace advances the iterator + over leading whitespace but when searching for the line break + nextLineBreak would call RenderCombineText::combineText(), + collapsing the text so that the iterator is pointing past the + end of it. + + This patch causes combineText() to be called during + skipLeadingWhiteSpace before iteration over the RenderCombineText + begins. + + * rendering/RenderBlockLineLayout.cpp: + (WebCore::RenderBlock::LineBreaker::nextLineBreak): + (WebCore::RenderBlock::LineBreaker::skipLeadingWhitespace): + +2012-01-06 Anders Carlsson <andersca@apple.com> + + Make ScrollAnimatorMac::snapRubberBandTimerFired use m_scrollElasticityController in more places + https://bugs.webkit.org/show_bug.cgi?id=75726 + + Reviewed by Sam Weinig. + + * platform/mac/ScrollAnimatorMac.h: + * platform/mac/ScrollAnimatorMac.mm: + (WebCore::ScrollAnimatorMac::canScrollHorizontally): + (WebCore::ScrollAnimatorMac::canScrollVertically): + (WebCore::ScrollAnimatorMac::snapRubberBandTimerFired): + * platform/mac/ScrollElasticityController.h: + +2012-01-06 Pratik Solanki <psolanki@apple.com> + + WebKit1 fails to compile with USE(CFNETWORK) and HAVE(NETWORK_CFDATA_ARRAY_CALLBACK) + https://bugs.webkit.org/show_bug.cgi?id=75675 + + Reviewed by Oliver Hunt. + + * platform/network/cf/ResourceHandleCFNet.cpp: + (WebCore::willCacheResponse): + +2012-01-06 Abhishek Arya <inferno@chromium.org> + + Crash with range selection across different documents. + https://bugs.webkit.org/show_bug.cgi?id=74285 + + Reviewed by Ryosuke Niwa. + + Test: fast/dom/Range/range-selection-across-documents-crash.html + + * page/DOMSelection.cpp: + (WebCore::DOMSelection::addRange): + +2012-01-06 Sam Weinig <sam@webkit.org> + + Remove unused OwnFastMallocPtr class. + https://bugs.webkit.org/show_bug.cgi?id=75722 + + Reviewed by Geoffrey Garen. + + * ForwardingHeaders/wtf/OwnFastMallocPtr.h: Removed. + * bindings/js/JSWebGLRenderingContextCustom.cpp: + +2012-01-06 Tony Chang <tony@chromium.org> + + Need to relayout when stretching the height of a flex item + https://bugs.webkit.org/show_bug.cgi?id=75661 + + Reviewed by Ojan Vafai. + + Test: css3/flexbox/flex-align-stretch.html + + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::computePreferredMainAxisExtent): Always clear the override size since + it may be set when aligning. + (WebCore::RenderFlexibleBox::alignChildren): Only relayout if the height changed. + +2012-01-06 Anders Carlsson <andersca@apple.com> + + Add ScrollElasticityControllerClient::immediateScrollBy + https://bugs.webkit.org/show_bug.cgi?id=75720 + + Reviewed by Andreas Kling. + + Add a new ScrollElasticityControllerClient::immediateScrollBy client member function. + Also, make ScrollAnimatorMac::smoothScrollWithEvent calls go through the ScrollElasticityController + in preparation for moving that function to ScrollElasticityController. + + * platform/mac/ScrollAnimatorMac.h: + * platform/mac/ScrollAnimatorMac.mm: + (WebCore::ScrollAnimatorMac::smoothScrollWithEvent): + * platform/mac/ScrollElasticityController.h: + +2012-01-06 Wei James <james.wei@intel.com> + + Use VectorMath lib when possible to optimize the processing in WebAudio AudioBus + https://bugs.webkit.org/show_bug.cgi?id=75334 + + Reviewed by Kenneth Russell. + + * platform/audio/AudioBus.cpp: + (WebCore::AudioBus::processWithGainFromMonoStereo): + +2012-01-06 Jer Noble <jer.noble@apple.com> + + Fullscreen video controller can't be dragged the first time I enter fullscreen + https://bugs.webkit.org/show_bug.cgi?id=75709 + + Reviewed by Eric Carlson. + + No new tests; updated video-controls-drag.html. + + When the media controls are created, check to see if we are full screen, and pass + that information to the newly created controls. + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::createMediaControls): + +2012-01-05 Jer Noble <jer.noble@apple.com> + + Media Element: scrubbing in full-screen mode breaks playback. + https://bugs.webkit.org/show_bug.cgi?id=75650 + + Reviewed by John Sullivan. + + Test: fullscreen/video-controls-timeline.html + + Only begin scrubbing if the panel itself is the mousedown event target. + + * html/shadow/MediaControlElements.cpp: + (WebCore::MediaControlPanelElement::defaultEventHandler): + +2012-01-05 Jer Noble <jer.noble@apple.com> + + REGRESSION (r90797): Full screen video HUD cannot be dragged horizontally + https://bugs.webkit.org/show_bug.cgi?id=75200 + + Reviewed by Eric Carlson. + + Test: fullscreen/video-controls-drag.html + + The !important rules in fullscreenQuickTime.css are overriding the styles added by the + drag operation in MediaControlElements.cpp. Give the panel a "dragged" class in setPosition + (clearing it in resetPosition) that allows the !important rules to apply only when the + panel is not dragged. + + * css/fullscreenQuickTime.css: + (video:-webkit-full-screen::-webkit-media-controls-panel): + (video:-webkit-full-screen::-webkit-media-controls-panel:not(.dragged)): + * html/shadow/MediaControlElements.cpp: + (WebCore::MediaControlPanelElement::setPosition): + (WebCore::MediaControlPanelElement::resetPosition): + 2012-01-05 Antti Koivisto <antti@apple.com> REGRESSION (r104060): fast/forms/textarea-metrics.html is failing diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make index 85cb0bfbf..f75a8906b 100644 --- a/Source/WebCore/DerivedSources.make +++ b/Source/WebCore/DerivedSources.make @@ -336,6 +336,7 @@ BINDING_IDLS = \ $(WebCore)/plugins/DOMMimeTypeArray.idl \ $(WebCore)/plugins/DOMPlugin.idl \ $(WebCore)/plugins/DOMPluginArray.idl \ + $(WebCore)/storage/DOMWindowSQLDatabase.idl \ $(WebCore)/storage/Database.idl \ $(WebCore)/storage/DatabaseCallback.idl \ $(WebCore)/storage/DatabaseSync.idl \ diff --git a/Source/WebCore/DerivedSources.pri b/Source/WebCore/DerivedSources.pri index b69b744ad..0335b3878 100644 --- a/Source/WebCore/DerivedSources.pri +++ b/Source/WebCore/DerivedSources.pri @@ -365,6 +365,7 @@ IDL_BINDINGS += \ plugins/DOMMimeType.idl \ plugins/DOMPluginArray.idl \ plugins/DOMMimeTypeArray.idl \ + storage/DOMWindowSQLDatabase.idl \ storage/Database.idl \ storage/DatabaseCallback.idl \ storage/DatabaseSync.idl \ diff --git a/Source/WebCore/English.lproj/localizedStrings.js b/Source/WebCore/English.lproj/localizedStrings.js Binary files differindex 2f8cb79bd..693b4732b 100644 --- a/Source/WebCore/English.lproj/localizedStrings.js +++ b/Source/WebCore/English.lproj/localizedStrings.js diff --git a/Source/WebCore/ForwardingHeaders/wtf/OwnFastMallocPtr.h b/Source/WebCore/ForwardingHeaders/wtf/OwnFastMallocPtr.h deleted file mode 100644 index 036d80138..000000000 --- a/Source/WebCore/ForwardingHeaders/wtf/OwnFastMallocPtr.h +++ /dev/null @@ -1 +0,0 @@ -#include <JavaScriptCore/OwnFastMallocPtr.h> diff --git a/Source/WebCore/GNUmakefile.am b/Source/WebCore/GNUmakefile.am index ebb8cdf47..0943e707a 100644 --- a/Source/WebCore/GNUmakefile.am +++ b/Source/WebCore/GNUmakefile.am @@ -545,16 +545,13 @@ webcore_cppflags += -DENABLE_WEBGL=1 endif # END ENABLE_WEBGL # --- -# 3D rendering (CSS3 3D transforms) support -# --- -if ENABLE_3D_RENDERING -FEATURE_DEFINES += ENABLE_3D_RENDERING=1 -webcore_cppflags += -DENABLE_3D_RENDERING=1 -endif # END ENABLE_3D_RENDERING - -# --- -# Compile with accelerated compositing support +# Accelerated compositing support # --- +if USE_ACCELERATED_COMPOSITING +FEATURE_DEFINES += \ + ENABLE_3D_RENDERING=1 \ + ACCELERATED_COMPOSITING=1 +endif # END USE_ACCELERATED_COMPOSITING if USE_TEXTURE_MAPPER_CAIRO webcore_cppflags += \ diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am index 7c4a96a9f..2b10011ce 100644 --- a/Source/WebCore/GNUmakefile.list.am +++ b/Source/WebCore/GNUmakefile.list.am @@ -1674,6 +1674,8 @@ webcore_sources += \ Source/WebCore/dom/TreeDepthLimit.h \ Source/WebCore/dom/TreeScope.cpp \ Source/WebCore/dom/TreeScope.h \ + Source/WebCore/dom/TreeScopeAdopter.cpp \ + Source/WebCore/dom/TreeScopeAdopter.h \ Source/WebCore/dom/TreeWalker.cpp \ Source/WebCore/dom/TreeWalker.h \ Source/WebCore/dom/UIEvent.cpp \ @@ -2325,6 +2327,8 @@ webcore_sources += \ Source/WebCore/inspector/ConsoleMessage.h \ Source/WebCore/inspector/ContentSearchUtils.cpp \ Source/WebCore/inspector/ContentSearchUtils.h \ + Source/WebCore/inspector/DOMEditor.cpp \ + Source/WebCore/inspector/DOMEditor.h \ Source/WebCore/inspector/DOMNodeHighlighter.cpp \ Source/WebCore/inspector/DOMNodeHighlighter.h \ Source/WebCore/inspector/DOMWrapperVisitor.h \ @@ -2646,6 +2650,8 @@ webcore_sources += \ Source/WebCore/page/DOMTimer.h \ Source/WebCore/page/DOMWindow.cpp \ Source/WebCore/page/DOMWindow.h \ + Source/WebCore/page/DOMWindowProperty.cpp \ + Source/WebCore/page/DOMWindowProperty.h \ Source/WebCore/page/DragActions.h \ Source/WebCore/page/DragClient.h \ Source/WebCore/page/DragController.cpp \ @@ -2664,6 +2670,8 @@ webcore_sources += \ Source/WebCore/page/Frame.h \ Source/WebCore/page/FrameActionScheduler.cpp \ Source/WebCore/page/FrameActionScheduler.h \ + Source/WebCore/page/FrameDestructionObserver.cpp \ + Source/WebCore/page/FrameDestructionObserver.h \ Source/WebCore/page/FrameTree.cpp \ Source/WebCore/page/FrameTree.h \ Source/WebCore/page/FrameView.cpp \ @@ -2954,6 +2962,7 @@ webcore_sources += \ Source/WebCore/platform/graphics/GraphicsContext.h \ Source/WebCore/platform/graphics/GraphicsLayer.h \ Source/WebCore/platform/graphics/GraphicsLayer.cpp \ + Source/WebCore/platform/graphics/GraphicsLayerClient.h \ Source/WebCore/platform/graphics/GraphicsTypes.cpp \ Source/WebCore/platform/graphics/GraphicsTypes.h \ Source/WebCore/platform/graphics/GraphicsTypes3D.h \ @@ -3745,6 +3754,8 @@ webcore_sources += \ Source/WebCore/storage/AbstractDatabase.h \ Source/WebCore/storage/ChangeVersionWrapper.cpp \ Source/WebCore/storage/ChangeVersionWrapper.h \ + Source/WebCore/storage/DOMWindowSQLDatabase.cpp \ + Source/WebCore/storage/DOMWindowSQLDatabase.h \ Source/WebCore/storage/DatabaseAuthorizer.cpp \ Source/WebCore/storage/DatabaseAuthorizer.h \ Source/WebCore/storage/DatabaseCallback.h \ @@ -4591,6 +4602,7 @@ webcore_built_sources += \ DerivedSources/WebCore/JSSQLTransactionSyncCallback.h dom_binding_idls += \ + $(WebCore)/storage/DOMWindowSQLDatabase.idl \ $(WebCore)/storage/Database.idl \ $(WebCore)/storage/DatabaseCallback.idl \ $(WebCore)/storage/DatabaseSync.idl \ @@ -5451,12 +5463,16 @@ webcore_built_sources += \ webcore_sources += \ Source/ThirdParty/ANGLE/include/GLSLANG/ShaderLang.h \ Source/ThirdParty/ANGLE/src/compiler/BaseTypes.h \ + Source/ThirdParty/ANGLE/src/compiler/BuiltInFunctionEmulator.cpp \ + Source/ThirdParty/ANGLE/src/compiler/BuiltInFunctionEmulator.h \ Source/ThirdParty/ANGLE/src/compiler/CodeGenGLSL.cpp \ Source/ThirdParty/ANGLE/src/compiler/Common.h \ Source/ThirdParty/ANGLE/src/compiler/Compiler.cpp \ Source/ThirdParty/ANGLE/src/compiler/ConstantUnion.h \ Source/ThirdParty/ANGLE/src/compiler/debug.cpp \ Source/ThirdParty/ANGLE/src/compiler/debug.h \ + Source/ThirdParty/ANGLE/src/compiler/DetectRecursion.cpp \ + Source/ThirdParty/ANGLE/src/compiler/DetectRecursion.h \ Source/ThirdParty/ANGLE/src/compiler/ExtensionBehavior.h \ Source/ThirdParty/ANGLE/src/compiler/ForLoopUnroll.cpp \ Source/ThirdParty/ANGLE/src/compiler/ForLoopUnroll.h \ @@ -5498,6 +5514,7 @@ webcore_sources += \ Source/ThirdParty/ANGLE/src/compiler/preprocessor/cpp.c \ Source/ThirdParty/ANGLE/src/compiler/preprocessor/cpp.h \ Source/ThirdParty/ANGLE/src/compiler/preprocessor/cppstruct.c \ + Source/ThirdParty/ANGLE/src/compiler/preprocessor/length_limits.h \ Source/ThirdParty/ANGLE/src/compiler/preprocessor/memory.c \ Source/ThirdParty/ANGLE/src/compiler/preprocessor/memory.h \ Source/ThirdParty/ANGLE/src/compiler/preprocessor/parser.h \ @@ -5631,7 +5648,7 @@ webcore_sources += \ endif # END ENABLE_REQUEST_ANIMATION_FRAME # --- -# Compile with accelerated compositing support +# Accelerated compositing support # --- if USE_ACCELERATED_COMPOSITING if USE_CLUTTER @@ -5646,6 +5663,7 @@ if USE_TEXTURE_MAPPER_CAIRO webcore_sources += \ Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp \ Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h \ + Source/WebCore/platform/graphics/texmap/TextureMapper.cpp \ Source/WebCore/platform/graphics/texmap/TextureMapper.h \ Source/WebCore/platform/graphics/texmap/TextureMapperNode.cpp \ Source/WebCore/platform/graphics/texmap/TextureMapperNode.h \ @@ -5661,6 +5679,7 @@ webcore_sources += \ Source/WebCore/platform/graphics/opengl/TextureMapperGL.h \ Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp \ Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h \ + Source/WebCore/platform/graphics/texmap/TextureMapper.cpp \ Source/WebCore/platform/graphics/texmap/TextureMapper.h \ Source/WebCore/platform/graphics/texmap/TextureMapperNode.cpp \ Source/WebCore/platform/graphics/texmap/TextureMapperNode.h \ diff --git a/Source/WebCore/Modules/intents/Intent.cpp b/Source/WebCore/Modules/intents/Intent.cpp new file mode 100644 index 000000000..60a3248b0 --- /dev/null +++ b/Source/WebCore/Modules/intents/Intent.cpp @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2011 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 Google, Inc. ("Google") 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 GOOGLE 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 "Intent.h" + +#if ENABLE(WEB_INTENTS) + +#include "ExceptionCode.h" +#include "SerializedScriptValue.h" + +namespace WebCore { + +PassRefPtr<Intent> Intent::create(const String& action, const String& type, PassRefPtr<SerializedScriptValue> data, ExceptionCode& ec) +{ + if (action.isEmpty()) { + ec = SYNTAX_ERR; + return 0; + } + if (type.isEmpty()) { + ec = SYNTAX_ERR; + return 0; + } + + return adoptRef(new Intent(action, type, data)); +} + +Intent::Intent(const String& action, const String& type, PassRefPtr<SerializedScriptValue> data) + : m_action(action) + , m_type(type) +{ + if (data) + m_data = SerializedScriptValue::createFromWire(data->toWireString()); + else + m_data = SerializedScriptValue::nullValue(); +} + +const String& Intent::action() const +{ + return m_action; +} + +const String& Intent::type() const +{ + return m_type; +} + +SerializedScriptValue* Intent::data() const +{ + return m_data.get(); +} + +} // namespace WebCore + +#endif // ENABLE(WEB_INTENTS) diff --git a/Source/WebCore/Modules/intents/Intent.h b/Source/WebCore/Modules/intents/Intent.h new file mode 100644 index 000000000..96bebd6e5 --- /dev/null +++ b/Source/WebCore/Modules/intents/Intent.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2011 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 Google, Inc. ("Google") 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 GOOGLE 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 Intent_h +#define Intent_h + +#if ENABLE(WEB_INTENTS) + +#include <wtf/Forward.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> +#include <wtf/text/WTFString.h> + +namespace WebCore { + +class SerializedScriptValue; + +typedef int ExceptionCode; + +class Intent : public RefCounted<Intent> { +public: + static PassRefPtr<Intent> create(const String& action, const String& type, PassRefPtr<SerializedScriptValue> data, ExceptionCode&); + + const String& action() const; + const String& type() const; + SerializedScriptValue* data() const; + + int identifier() const; + void setIdentifier(int); + +private: + Intent(const String& action, const String& type, PassRefPtr<SerializedScriptValue> data); + + String m_action; + String m_type; + RefPtr<SerializedScriptValue> m_data; +}; + +} // namespace WebCore + +#endif + +#endif // Intent_h diff --git a/Source/WebCore/Modules/intents/Intent.idl b/Source/WebCore/Modules/intents/Intent.idl new file mode 100644 index 000000000..33657f4c8 --- /dev/null +++ b/Source/WebCore/Modules/intents/Intent.idl @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2011 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 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 window { + interface [ + Conditional=WEB_INTENTS, + Constructor(in DOMString action, in DOMString type, in [Optional=CallWithNullValue] SerializedScriptValue data), + ConstructorRaisesException + ] Intent { + readonly attribute DOMString action; + readonly attribute DOMString type; + readonly attribute SerializedScriptValue data; + }; +} diff --git a/Source/WebCore/Modules/intents/IntentRequest.cpp b/Source/WebCore/Modules/intents/IntentRequest.cpp new file mode 100644 index 000000000..eeca4af29 --- /dev/null +++ b/Source/WebCore/Modules/intents/IntentRequest.cpp @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2012 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 Google, Inc. ("Google") 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 GOOGLE 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 "IntentRequest.h" + +#if ENABLE(WEB_INTENTS) + +#include "ScriptExecutionContext.h" +#include "SerializedScriptValue.h" + +namespace WebCore { + +PassRefPtr<IntentRequest> IntentRequest::create(ScriptExecutionContext* context, + PassRefPtr<Intent> intent, + PassRefPtr<IntentResultCallback> successCallback, + PassRefPtr<IntentResultCallback> errorCallback) +{ + return adoptRef(new IntentRequest(context, intent, successCallback, errorCallback)); +} + +IntentRequest::IntentRequest(ScriptExecutionContext* context, + PassRefPtr<Intent> intent, + PassRefPtr<IntentResultCallback> successCallback, + PassRefPtr<IntentResultCallback> errorCallback) + : ActiveDOMObject(context, this) + , m_intent(intent) + , m_successCallback(successCallback) + , m_errorCallback(errorCallback) +{ + setPendingActivity(this); +} + +void IntentRequest::contextDestroyed() +{ + ContextDestructionObserver::contextDestroyed(); + m_successCallback.clear(); + m_errorCallback.clear(); +} + +void IntentRequest::stop() +{ + m_successCallback.clear(); + m_errorCallback.clear(); +} + +void IntentRequest::postResult(SerializedScriptValue* data) +{ + // Callback could lead to deletion of this. + RefPtr<IntentRequest> protector(this); + + if (!m_successCallback) + return; + + m_successCallback->handleEvent(data); + + m_successCallback.clear(); + m_errorCallback.clear(); + unsetPendingActivity(this); +} + +void IntentRequest::postFailure(SerializedScriptValue* data) +{ + // Callback could lead to deletion of this. + RefPtr<IntentRequest> protector(this); + + if (!m_errorCallback) + return; + + m_errorCallback->handleEvent(data); + + m_successCallback.clear(); + m_errorCallback.clear(); + unsetPendingActivity(this); +} + +} // namespace WebCore + +#endif // ENABLE(WEB_INTENTS) diff --git a/Source/WebCore/Modules/intents/IntentRequest.h b/Source/WebCore/Modules/intents/IntentRequest.h new file mode 100644 index 000000000..7a809a98e --- /dev/null +++ b/Source/WebCore/Modules/intents/IntentRequest.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2012 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 Google, Inc. ("Google") 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 GOOGLE 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 IntentRequest_h +#define IntentRequest_h + +#if ENABLE(WEB_INTENTS) + +#include "ActiveDOMObject.h" +#include "Intent.h" +#include "IntentResultCallback.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + +class ScriptExecutionContext; + +class IntentRequest : public RefCounted<IntentRequest>, public ActiveDOMObject { +public: + static PassRefPtr<IntentRequest> create(ScriptExecutionContext*, PassRefPtr<Intent>, PassRefPtr<IntentResultCallback> successCallback, PassRefPtr<IntentResultCallback> errorCallback); + + Intent* intent() { return m_intent.get(); } + + void postResult(SerializedScriptValue*); + void postFailure(SerializedScriptValue*); + + virtual void contextDestroyed() OVERRIDE; + + virtual void stop() OVERRIDE; + +private: + IntentRequest(ScriptExecutionContext*, PassRefPtr<Intent>, PassRefPtr<IntentResultCallback> successCallback, PassRefPtr<IntentResultCallback> errorCallback); + + RefPtr<Intent> m_intent; + RefPtr<IntentResultCallback> m_successCallback; + RefPtr<IntentResultCallback> m_errorCallback; +}; + +} // namespace WebCore + +#endif + +#endif // IntentRequest_h diff --git a/Source/WebCore/Modules/intents/IntentResultCallback.h b/Source/WebCore/Modules/intents/IntentResultCallback.h new file mode 100644 index 000000000..e4cdeb049 --- /dev/null +++ b/Source/WebCore/Modules/intents/IntentResultCallback.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2011 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 Google, Inc. ("Google") 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 GOOGLE 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 IntentResultCallback_h +#define IntentResultCallback_h + +#if ENABLE(WEB_INTENTS) + +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + +class SerializedScriptValue; + +class IntentResultCallback : public RefCounted<IntentResultCallback> { +public: + virtual ~IntentResultCallback() { } + virtual bool handleEvent(SerializedScriptValue* result) = 0; +}; + +} + +#endif + +#endif // IntentResultCallback_h diff --git a/Source/WebCore/Modules/intents/IntentResultCallback.idl b/Source/WebCore/Modules/intents/IntentResultCallback.idl new file mode 100644 index 000000000..feb4a3cc6 --- /dev/null +++ b/Source/WebCore/Modules/intents/IntentResultCallback.idl @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2011 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 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 window { + interface [ + Conditional=WEB_INTENTS, + Callback=FunctionOnly + ] IntentResultCallback { + boolean handleEvent(in SerializedScriptValue result); + }; +} diff --git a/Source/WebCore/Modules/intents/NavigatorIntents.cpp b/Source/WebCore/Modules/intents/NavigatorIntents.cpp new file mode 100644 index 000000000..b5636fd78 --- /dev/null +++ b/Source/WebCore/Modules/intents/NavigatorIntents.cpp @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2011, 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 INC. 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 INC. 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 "NavigatorIntents.h" + +#if ENABLE(WEB_INTENTS) + +#include "Document.h" +#include "ExceptionCode.h" +#include "Frame.h" +#include "FrameLoader.h" +#include "FrameLoaderClient.h" +#include "Intent.h" +#include "IntentRequest.h" +#include "IntentResultCallback.h" +#include "Navigator.h" +#include "ScriptController.h" + +namespace WebCore { + +NavigatorIntents::NavigatorIntents() +{ +} + +NavigatorIntents::~NavigatorIntents() +{ +} + +void NavigatorIntents::startActivity(Navigator* navigator, + PassRefPtr<Intent> intent, + PassRefPtr<IntentResultCallback> successCallback, + PassRefPtr<IntentResultCallback> errorCallback, + ExceptionCode& ec) +{ + if (!navigator->frame() || !intent) { + ec = INVALID_STATE_ERR; + return; + } + + if (intent->action().isEmpty() || intent->type().isEmpty()) { + ec = VALIDATION_ERR; + return; + } + + if (!ScriptController::processingUserGesture()) { + ec = INVALID_ACCESS_ERR; + return; + } + + RefPtr<IntentRequest> request = IntentRequest::create(navigator->frame()->document(), + intent, successCallback, errorCallback); + navigator->frame()->loader()->client()->dispatchIntent(request); +} + +} // namespace WebCore + +#endif // ENABLE(WEB_INTENTS) diff --git a/Source/WebCore/Modules/intents/NavigatorIntents.h b/Source/WebCore/Modules/intents/NavigatorIntents.h new file mode 100644 index 000000000..af227c260 --- /dev/null +++ b/Source/WebCore/Modules/intents/NavigatorIntents.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2011, 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 INC. 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 INC. 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 NavigatorIntents_h +#define NavigatorIntents_h + +#if ENABLE(WEB_INTENTS) + +#include <wtf/PassRefPtr.h> + +namespace WebCore { + +class Intent; +class IntentResultCallback; +class Navigator; + +typedef int ExceptionCode; + +class NavigatorIntents { +public: + static void startActivity(Navigator*, PassRefPtr<Intent>, PassRefPtr<IntentResultCallback> successCallback, PassRefPtr<IntentResultCallback> errorCallback, ExceptionCode&); + +private: + NavigatorIntents(); + ~NavigatorIntents(); +}; + +} // namespace WebCore + +#endif // ENABLE(WEB_INTENTS) + +#endif // NavigatorIntents_h diff --git a/Source/WebCore/Modules/intents/NavigatorIntents.idl b/Source/WebCore/Modules/intents/NavigatorIntents.idl new file mode 100644 index 000000000..755f58e1a --- /dev/null +++ b/Source/WebCore/Modules/intents/NavigatorIntents.idl @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +module window { + + interface [ + Conditional=WEB_INTENTS, + Supplemental=Navigator + ] NavigatorIntents { + void startActivity(in Intent intent, + in [Callback=FunctionOnly, Optional] IntentResultCallback successCallback, + in [Callback=FunctionOnly, Optional] IntentResultCallback failureCallback) + raises(DOMException); + }; + +} diff --git a/Source/WebCore/Target.pri b/Source/WebCore/Target.pri index 68b9fe0ce..5db851ad4 100644 --- a/Source/WebCore/Target.pri +++ b/Source/WebCore/Target.pri @@ -574,6 +574,7 @@ SOURCES += \ dom/TouchList.cpp \ dom/Traversal.cpp \ dom/TreeScope.cpp \ + dom/TreeScopeAdopter.cpp \ dom/TreeWalker.cpp \ dom/UIEvent.cpp \ dom/UIEventWithKeyState.cpp \ @@ -848,6 +849,7 @@ SOURCES += \ html/shadow/TextControlInnerElements.cpp \ inspector/ConsoleMessage.cpp \ inspector/ContentSearchUtils.cpp \ + inspector/DOMEditor.cpp \ inspector/DOMNodeHighlighter.cpp \ inspector/IdentifiersFactory.cpp \ inspector/InjectedScript.cpp \ @@ -967,12 +969,14 @@ SOURCES += \ page/DOMSelection.cpp \ page/DOMTimer.cpp \ page/DOMWindow.cpp \ + page/DOMWindowProperty.cpp \ page/DragController.cpp \ page/EventHandler.cpp \ page/EventSource.cpp \ page/FocusController.cpp \ page/Frame.cpp \ page/FrameActionScheduler.cpp \ + page/FrameDestructionObserver.cpp \ page/FrameTree.cpp \ page/FrameView.cpp \ page/Geolocation.cpp \ @@ -1168,6 +1172,7 @@ SOURCES += \ rendering/BidiRun.cpp \ rendering/CounterNode.cpp \ rendering/EllipsisBox.cpp \ + rendering/FilterEffectRenderer.cpp \ rendering/FixedTableLayout.cpp \ rendering/HitTestingTransformState.cpp \ rendering/HitTestResult.cpp \ @@ -1274,6 +1279,7 @@ SOURCES += \ rendering/style/StyleTransformData.cpp \ rendering/style/StyleVisualData.cpp \ storage/AbstractDatabase.cpp \ + storage/DOMWindowSQLDatabase.cpp \ storage/Database.cpp \ storage/DatabaseAuthorizer.cpp \ storage/DatabaseSync.cpp \ @@ -1671,6 +1677,7 @@ HEADERS += \ dom/Traversal.h \ dom/TreeDepthLimit.h \ dom/TreeScope.h \ + dom/TreeScopeAdopter.h \ dom/TreeWalker.h \ dom/UIEvent.h \ dom/UIEventWithKeyState.h \ @@ -1902,6 +1909,7 @@ HEADERS += \ html/track/WebVTTTokenizer.h \ inspector/ConsoleMessage.h \ inspector/ContentSearchUtils.h \ + inspector/DOMEditor.h \ inspector/DOMNodeHighlighter.h \ inspector/DOMWrapperVisitor.h \ inspector/IdentifiersFactory.h \ @@ -2282,6 +2290,7 @@ HEADERS += \ rendering/break_lines.h \ rendering/CounterNode.h \ rendering/EllipsisBox.h \ + rendering/FilterEffectRenderer.h \ rendering/FixedTableLayout.h \ rendering/HitTestingTransformState.h \ rendering/HitTestResult.h \ @@ -2465,6 +2474,7 @@ HEADERS += \ rendering/svg/SVGTextRunRenderingContext.h \ storage/AbstractDatabase.h \ storage/ChangeVersionWrapper.h \ + storage/DOMWindowSQLDatabase.h \ storage/DatabaseAuthorizer.h \ storage/Database.h \ storage/DatabaseCallback.h \ @@ -3733,9 +3743,11 @@ contains(DEFINES, ENABLE_WEBGL=1) { ANGLE_HEADERS += \ $$ANGLE_DIR/src/compiler/BaseTypes.h \ + $$ANGLE_DIR/src/compiler/BuiltInFunctionEmulator.h \ $$ANGLE_DIR/src/compiler/Common.h \ $$ANGLE_DIR/src/compiler/ConstantUnion.h \ $$ANGLE_DIR/src/compiler/debug.h \ + $$ANGLE_DIR/src/compiler/DetectRecursion.h \ $$ANGLE_DIR/src/compiler/ExtensionBehavior.h \ $$ANGLE_DIR/src/compiler/ForLoopUnroll.h \ $$ANGLE_DIR/src/compiler/glslang.h \ @@ -3753,6 +3765,7 @@ contains(DEFINES, ENABLE_WEBGL=1) { $$ANGLE_DIR/src/compiler/preprocessor/atom.h \ $$ANGLE_DIR/src/compiler/preprocessor/compile.h \ $$ANGLE_DIR/src/compiler/preprocessor/cpp.h \ + $$ANGLE_DIR/src/compiler/preprocessor/length_limits.h \ $$ANGLE_DIR/src/compiler/preprocessor/memory.h \ $$ANGLE_DIR/src/compiler/preprocessor/parser.h \ $$ANGLE_DIR/src/compiler/preprocessor/preprocess.h \ @@ -3784,9 +3797,11 @@ contains(DEFINES, ENABLE_WEBGL=1) { HEADERS += $$ANGLE_HEADERS ANGLE_SOURCES += \ + $$ANGLE_DIR/src/compiler/BuiltInFunctionEmulator.cpp \ $$ANGLE_DIR/src/compiler/CodeGenGLSL.cpp \ $$ANGLE_DIR/src/compiler/Compiler.cpp \ $$ANGLE_DIR/src/compiler/debug.cpp \ + $$ANGLE_DIR/src/compiler/DetectRecursion.cpp \ $$ANGLE_DIR/src/compiler/ForLoopUnroll.cpp \ $$ANGLE_DIR/src/compiler/glslang_lex.cpp \ $$ANGLE_DIR/src/compiler/glslang_tab.cpp \ @@ -3898,6 +3913,7 @@ contains(CONFIG, texmap) { SOURCES += \ platform/graphics/qt/TextureMapperQt.cpp \ + platform/graphics/texmap/TextureMapper.cpp \ platform/graphics/texmap/TextureMapperNode.cpp \ platform/graphics/texmap/GraphicsLayerTextureMapper.cpp diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in index a2a056415..0989a2558 100644 --- a/Source/WebCore/WebCore.exp.in +++ b/Source/WebCore/WebCore.exp.in @@ -943,6 +943,7 @@ __ZN7WebCore8Settings19setShowDebugBordersEb __ZN7WebCore8Settings20setCursiveFontFamilyERKN3WTF12AtomicStringE11UScriptCode __ZN7WebCore8Settings20setFantasyFontFamilyERKN3WTF12AtomicStringE11UScriptCode __ZN7WebCore8Settings20setXSSAuditorEnabledEb +__ZN7WebCore8Settings21mockScrollbarsEnabledEv __ZN7WebCore8Settings21setShowRepaintCounterEb __ZN7WebCore8Settings21setStandardFontFamilyERKN3WTF12AtomicStringE11UScriptCode __ZN7WebCore8Settings21setWebSecurityEnabledEb @@ -1324,8 +1325,14 @@ __ZNK7WebCore4KURL11isLocalFileEv __ZNK7WebCore4KURL12baseAsStringEv __ZNK7WebCore4KURL14fileSystemPathEv __ZNK7WebCore4KURL17lastPathComponentEv +__ZNK7WebCore4KURL18fragmentIdentifierEv +__ZNK7WebCore4KURL21hasFragmentIdentifierEv __ZNK7WebCore4KURL4hostEv +__ZNK7WebCore4KURL4passEv __ZNK7WebCore4KURL4pathEv +__ZNK7WebCore4KURL4portEv +__ZNK7WebCore4KURL4userEv +__ZNK7WebCore4KURL5queryEv __ZNK7WebCore4KURL8protocolEv __ZNK7WebCore4KURLcvP5NSURLEv __ZNK7WebCore4Node14isDescendantOfEPKS0_ @@ -1406,7 +1413,6 @@ __ZNK7WebCore8Document13axObjectCacheEv __ZNK7WebCore8Document13nodesFromRectEiijjjjb __ZNK7WebCore8Document14getElementByIdERKN3WTF12AtomicStringE __ZNK7WebCore8Document16dashboardRegionsEv -__ZNK7WebCore8Document20cacheDocumentElementEv __ZNK7WebCore8Document31displayStringModifiedByEncodingERKN3WTF6StringE __ZNK7WebCore8Document4bodyEv __ZNK7WebCore8Document4pageEv diff --git a/Source/WebCore/WebCore.gyp/WebCore.gyp b/Source/WebCore/WebCore.gyp/WebCore.gyp index a24b448f4..5d2b95c78 100644 --- a/Source/WebCore/WebCore.gyp/WebCore.gyp +++ b/Source/WebCore/WebCore.gyp/WebCore.gyp @@ -51,6 +51,7 @@ '../', '../..', '../Modules/gamepad', + '../Modules/intents', '../accessibility', '../accessibility/chromium', '../bindings', diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi index f355868d5..dea8224bf 100644 --- a/Source/WebCore/WebCore.gypi +++ b/Source/WebCore/WebCore.gypi @@ -1149,6 +1149,9 @@ 'Modules/gamepad/Gamepad.idl', 'Modules/gamepad/GamepadList.idl', 'Modules/gamepad/NavigatorGamepad.idl', + 'Modules/intents/Intent.idl', + 'Modules/intents/IntentResultCallback.idl', + 'Modules/intents/NavigatorIntents.idl', 'css/CSSCharsetRule.idl', 'css/CSSFontFaceRule.idl', 'css/CSSImportRule.idl', @@ -1449,6 +1452,7 @@ 'plugins/DOMMimeTypeArray.idl', 'plugins/DOMPlugin.idl', 'plugins/DOMPluginArray.idl', + 'storage/DOMWindowSQLDatabase.idl', 'storage/Database.idl', 'storage/DatabaseCallback.idl', 'storage/DatabaseSync.idl', @@ -1695,6 +1699,13 @@ 'Modules/gamepad/GamepadList.h', 'Modules/gamepad/NavigatorGamepad.cpp', 'Modules/gamepad/NavigatorGamepad.h', + 'Modules/intents/Intent.cpp', + 'Modules/intents/Intent.h', + 'Modules/intents/IntentRequest.cpp', + 'Modules/intents/IntentRequest.h', + 'Modules/intents/IntentResultCallback.h', + 'Modules/intents/NavigatorIntents.cpp', + 'Modules/intents/NavigatorIntents.h', 'accessibility/AXObjectCache.cpp', 'accessibility/AccessibilityARIAGrid.cpp', 'accessibility/AccessibilityARIAGrid.h', @@ -2323,15 +2334,6 @@ 'bridge/jni/jsc/JavaRuntimeObject.cpp', 'bridge/jni/jsc/JavaRuntimeObject.h', 'bridge/jni/jsc/JavaStringJSC.h', - 'bridge/jni/v8/JNIUtilityPrivate.cpp', - 'bridge/jni/v8/JNIUtilityPrivate.h', - 'bridge/jni/v8/JavaClassV8.h', - 'bridge/jni/v8/JavaFieldV8.h', - 'bridge/jni/v8/JavaInstanceV8.h', - 'bridge/jni/v8/JavaMethodV8.h', - 'bridge/jni/v8/JavaNPObjectV8.cpp', - 'bridge/jni/v8/JavaNPObjectV8.h', - 'bridge/jni/v8/JavaValueV8.h', 'bridge/jsc/BridgeJSC.cpp', 'bridge/npruntime.cpp', 'bridge/npruntime_priv.h', @@ -2729,6 +2731,8 @@ 'inspector/ConsoleMessage.h', 'inspector/ContentSearchUtils.cpp', 'inspector/ContentSearchUtils.h', + 'inspector/DOMEditor.cpp', + 'inspector/DOMEditor.h', 'inspector/DOMNodeHighlighter.cpp', 'inspector/DOMNodeHighlighter.h', 'inspector/DOMWrapperVisitor.h', @@ -2988,6 +2992,8 @@ 'page/DOMTimer.cpp', 'page/DOMTimer.h', 'page/DOMWindow.cpp', + 'page/DOMWindowProperty.cpp', + 'page/DOMWindowProperty.h', 'page/DragController.cpp', 'page/EventHandler.cpp', 'page/EventSource.cpp', @@ -2996,6 +3002,8 @@ 'page/Frame.cpp', 'page/FrameActionScheduler.cpp', 'page/FrameActionScheduler.h', + 'page/FrameDestructionObserver.cpp', + 'page/FrameDestructionObserver.h', 'page/FrameTree.cpp', 'page/FrameView.cpp', 'page/Geolocation.cpp', @@ -3614,6 +3622,9 @@ 'platform/graphics/chromium/cc/CCInputHandler.h', 'platform/graphics/chromium/cc/CCLayerImpl.cpp', 'platform/graphics/chromium/cc/CCLayerImpl.h', + 'platform/graphics/chromium/cc/CCLayerIterator.cpp', + 'platform/graphics/chromium/cc/CCLayerIterator.h', + 'platform/graphics/chromium/cc/CCLayerIteratorPosition.h', 'platform/graphics/chromium/cc/CCLayerQuad.cpp', 'platform/graphics/chromium/cc/CCLayerQuad.h', 'platform/graphics/chromium/cc/CCLayerSorter.cpp', @@ -3632,6 +3643,8 @@ 'platform/graphics/chromium/cc/CCPluginLayerImpl.h', 'platform/graphics/chromium/cc/CCProxy.cpp', 'platform/graphics/chromium/cc/CCProxy.h', + 'platform/graphics/chromium/cc/CCQuadCuller.cpp', + 'platform/graphics/chromium/cc/CCQuadCuller.h', 'platform/graphics/chromium/cc/CCRenderPass.cpp', 'platform/graphics/chromium/cc/CCRenderPass.h', 'platform/graphics/chromium/cc/CCRenderSurface.cpp', @@ -3922,6 +3935,7 @@ 'platform/graphics/skia/TransformationMatrixSkia.cpp', 'platform/graphics/texmap/GraphicsLayerTextureMapper.cpp', 'platform/graphics/texmap/GraphicsLayerTextureMapper.h', + 'platform/graphics/texmap/TextureMapper.cpp', 'platform/graphics/texmap/TextureMapper.h', 'platform/graphics/texmap/TextureMapperNode.cpp', 'platform/graphics/texmap/TextureMapperNode.h', @@ -4904,6 +4918,8 @@ 'storage/AbstractDatabase.cpp', 'storage/ChangeVersionWrapper.cpp', 'storage/ChangeVersionWrapper.h', + 'storage/DOMWindowSQLDatabase.cpp', + 'storage/DOMWindowSQLDatabase.h', 'storage/Database.cpp', 'storage/DatabaseAuthorizer.cpp', 'storage/DatabaseAuthorizer.h', @@ -5466,6 +5482,8 @@ 'dom/TreeDepthLimit.h', 'dom/TreeScope.cpp', 'dom/TreeScope.h', + 'dom/TreeScopeAdopter.cpp', + 'dom/TreeScopeAdopter.h', 'dom/TreeWalker.cpp', 'dom/TreeWalker.h', 'dom/UIEvent.cpp', diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj index 105611536..63f135129 100755 --- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj @@ -25186,6 +25186,14 @@ > </File> <File + RelativePath="..\page\DOMWindowProperty.cpp" + > + </File> + <File + RelativePath="..\page\DOMWindowProperty.h" + > + </File> + <File RelativePath="..\page\DragActions.h" > </File> @@ -25252,14 +25260,22 @@ <File RelativePath="..\page\Frame.h" > - <File - RelativePath="..\page\FrameActionScheduler.cpp" - > - </File> - <File - RelativePath="..\page\FrameActionScheduler.h" - > - </File> + </File> + <File + RelativePath="..\page\FrameActionScheduler.cpp" + > + </File> + <File + RelativePath="..\page\FrameActionScheduler.h" + > + </File> + <File + RelativePath="..\page\FrameDestructionObserver.cpp" + > + </File> + <File + RelativePath="..\page\FrameDestructionObserver.h" + > </File> <File RelativePath="..\page\FrameTree.cpp" @@ -51774,6 +51790,62 @@ > </File> <File + RelativePath="..\dom\TreeScopeAdopter.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Production|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\dom\TreeScopeAdopter.h" + > + </File> + <File RelativePath="..\dom\TreeWalker.cpp" > <FileConfiguration @@ -70454,6 +70526,14 @@ > </File> <File + RelativePath="..\storage\DOMWindowSQLDatabase.cpp" + > + </File> + <File + RelativePath="..\storage\DOMWindowSQLDatabase.h" + > + </File> + <File RelativePath="..\storage\Database.cpp" > </File> @@ -71058,6 +71138,14 @@ > </File> <File + RelativePath="..\inspector\DOMEditor.cpp" + > + </File> + <File + RelativePath="..\inspector\DOMEditor.h" + > + </File> + <File RelativePath="..\inspector\DOMNodeHighlighter.cpp" > </File> diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj index e19bbc7e6..db99f1149 100644 --- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj @@ -1852,6 +1852,8 @@ 7AA51B6F1483B61600AD2752 /* InspectorBaseAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AA51B6D1483B61600AD2752 /* InspectorBaseAgent.cpp */; }; 7AA51DD5148506A900AD2752 /* InspectorMemoryAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AA51DD3148506A900AD2752 /* InspectorMemoryAgent.cpp */; }; 7AA51DD6148506A900AD2752 /* InspectorMemoryAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AA51DD4148506A900AD2752 /* InspectorMemoryAgent.h */; }; + 7AABA25914BC613300AA9A11 /* DOMEditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AABA25714BC613300AA9A11 /* DOMEditor.cpp */; }; + 7AABA25A14BC613300AA9A11 /* DOMEditor.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AABA25814BC613300AA9A11 /* DOMEditor.h */; }; 7AB0B1C01211A62200A76940 /* InspectorDatabaseAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AB0B1BE1211A62200A76940 /* InspectorDatabaseAgent.cpp */; }; 7AB0B1C11211A62200A76940 /* InspectorDatabaseAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AB0B1BF1211A62200A76940 /* InspectorDatabaseAgent.h */; }; 7ADE722610CBBB9B006B3B3A /* ContextMenuProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ADE722510CBBB9B006B3B3A /* ContextMenuProvider.h */; }; @@ -3269,6 +3271,8 @@ 973DC640145A9409002842C2 /* ExceptionCodeDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = 973DC63E145A9409002842C2 /* ExceptionCodeDescription.h */; settings = {ATTRIBUTES = (Private, ); }; }; 973E325610883B7C005BC493 /* ResourceLoadNotifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 973E325410883B7C005BC493 /* ResourceLoadNotifier.cpp */; }; 973E325710883B7C005BC493 /* ResourceLoadNotifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 973E325510883B7C005BC493 /* ResourceLoadNotifier.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 974A862214B7ADBB003FDC76 /* FrameDestructionObserver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 974A862014B7ADBB003FDC76 /* FrameDestructionObserver.cpp */; }; + 974A862314B7ADBB003FDC76 /* FrameDestructionObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 974A862114B7ADBB003FDC76 /* FrameDestructionObserver.h */; settings = {ATTRIBUTES = (Private, ); }; }; 974D2DA4146A535D00D51F8B /* SecurityPolicy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 974D2DA2146A535D00D51F8B /* SecurityPolicy.cpp */; }; 974D2DA5146A535D00D51F8B /* SecurityPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 974D2DA3146A535D00D51F8B /* SecurityPolicy.h */; settings = {ATTRIBUTES = (Private, ); }; }; 9752D38D1413104B003305BD /* JSHTMLSpanElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9752D38B1413104B003305BD /* JSHTMLSpanElement.cpp */; }; @@ -3367,6 +3371,8 @@ 97C078501165D5BE003A32EF /* SuffixTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 97C0784F1165D5BE003A32EF /* SuffixTree.h */; }; 97C471DB12F925BD0086354B /* ContentSecurityPolicy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97C471D912F925BC0086354B /* ContentSecurityPolicy.cpp */; }; 97C471DC12F925BD0086354B /* ContentSecurityPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 97C471DA12F925BD0086354B /* ContentSecurityPolicy.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 97D2AD0314B823A60093DF32 /* DOMWindowProperty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97D2AD0114B823A60093DF32 /* DOMWindowProperty.cpp */; }; + 97D2AD0414B823A60093DF32 /* DOMWindowProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 97D2AD0214B823A60093DF32 /* DOMWindowProperty.h */; settings = {ATTRIBUTES = (Private, ); }; }; 97DCE20110807C750057D394 /* HistoryController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97DCE1FF10807C750057D394 /* HistoryController.cpp */; }; 97DCE20210807C750057D394 /* HistoryController.h in Headers */ = {isa = PBXBuildFile; fileRef = 97DCE20010807C750057D394 /* HistoryController.h */; settings = {ATTRIBUTES = (Private, ); }; }; 97E4028F13A696ED00913D67 /* IconController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97E4028D13A696ED00913D67 /* IconController.cpp */; }; @@ -3507,6 +3513,8 @@ A77979290D6B9E64003851B9 /* JSImageData.h in Headers */ = {isa = PBXBuildFile; fileRef = A77979250D6B9E64003851B9 /* JSImageData.h */; }; A77B41A012E675A90054343D /* TextEventInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = A77B419F12E675A90054343D /* TextEventInputType.h */; settings = {ATTRIBUTES = (Private, ); }; }; A77D0012133B0AEB00D6658C /* TextChecking.h in Headers */ = {isa = PBXBuildFile; fileRef = A77D0011133B0AEB00D6658C /* TextChecking.h */; settings = {ATTRIBUTES = (Private, ); }; }; + A77E1FEF14AACB6E005B7CB6 /* TreeScopeAdopter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A77E1FED14AACB6E005B7CB6 /* TreeScopeAdopter.cpp */; }; + A77E1FF014AACB6E005B7CB6 /* TreeScopeAdopter.h in Headers */ = {isa = PBXBuildFile; fileRef = A77E1FEE14AACB6E005B7CB6 /* TreeScopeAdopter.h */; }; A781C6A713828B5D0012A62A /* DocumentMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A781C6A613828B5D0012A62A /* DocumentMarker.cpp */; }; A784941B0B5FE507001E237A /* Clipboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A784941A0B5FE507001E237A /* Clipboard.cpp */; }; A78E526F1346BD1700AD9C31 /* MeterShadowElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A78E526D1346BD1700AD9C31 /* MeterShadowElement.cpp */; }; @@ -4040,6 +4048,8 @@ A8EA800C0A19516E00A8EF5F /* StyleSheet.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA80040A19516E00A8EF5F /* StyleSheet.h */; settings = {ATTRIBUTES = (Private, ); }; }; A8EA800D0A19516E00A8EF5F /* StyleSheet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8EA80050A19516E00A8EF5F /* StyleSheet.cpp */; }; A8EA800E0A19516E00A8EF5F /* MediaList.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA80060A19516E00A8EF5F /* MediaList.h */; settings = {ATTRIBUTES = (Private, ); }; }; + A8F457A014BC1A88000CEA59 /* DOMWindowSQLDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8F4579D14BC13EC000CEA59 /* DOMWindowSQLDatabase.cpp */; }; + A8F457A114BC1A94000CEA59 /* DOMWindowSQLDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = A8F4579E14BC13EC000CEA59 /* DOMWindowSQLDatabase.h */; }; A8F46A840CB20A9D003A9670 /* DOMSVGClipPathElement.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 8503612C0ACE007B001F3D9E /* DOMSVGClipPathElement.h */; }; A8F46A880CB20A9D003A9670 /* DOMSVGGradientElement.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 85C9A2EC0AD7E90300FBFF1E /* DOMSVGGradientElement.h */; }; A8F46A890CB20A9D003A9670 /* DOMSVGAnimateColorElement.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 850361280ACE007B001F3D9E /* DOMSVGAnimateColorElement.h */; }; @@ -9156,6 +9166,8 @@ 7AA51B6D1483B61600AD2752 /* InspectorBaseAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorBaseAgent.cpp; sourceTree = "<group>"; }; 7AA51DD3148506A900AD2752 /* InspectorMemoryAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorMemoryAgent.cpp; sourceTree = "<group>"; }; 7AA51DD4148506A900AD2752 /* InspectorMemoryAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorMemoryAgent.h; sourceTree = "<group>"; }; + 7AABA25714BC613300AA9A11 /* DOMEditor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMEditor.cpp; sourceTree = "<group>"; }; + 7AABA25814BC613300AA9A11 /* DOMEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMEditor.h; sourceTree = "<group>"; }; 7AB0B1BE1211A62200A76940 /* InspectorDatabaseAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorDatabaseAgent.cpp; sourceTree = "<group>"; }; 7AB0B1BF1211A62200A76940 /* InspectorDatabaseAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorDatabaseAgent.h; sourceTree = "<group>"; }; 7ADE722510CBBB9B006B3B3A /* ContextMenuProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContextMenuProvider.h; sourceTree = "<group>"; }; @@ -10525,6 +10537,8 @@ 973DC63E145A9409002842C2 /* ExceptionCodeDescription.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExceptionCodeDescription.h; sourceTree = "<group>"; }; 973E325410883B7C005BC493 /* ResourceLoadNotifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoadNotifier.cpp; sourceTree = "<group>"; }; 973E325510883B7C005BC493 /* ResourceLoadNotifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadNotifier.h; sourceTree = "<group>"; }; + 974A862014B7ADBB003FDC76 /* FrameDestructionObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrameDestructionObserver.cpp; sourceTree = "<group>"; }; + 974A862114B7ADBB003FDC76 /* FrameDestructionObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FrameDestructionObserver.h; sourceTree = "<group>"; }; 974D2DA2146A535D00D51F8B /* SecurityPolicy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SecurityPolicy.cpp; sourceTree = "<group>"; }; 974D2DA3146A535D00D51F8B /* SecurityPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecurityPolicy.h; sourceTree = "<group>"; }; 9752D38B1413104B003305BD /* JSHTMLSpanElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLSpanElement.cpp; sourceTree = "<group>"; }; @@ -10625,6 +10639,8 @@ 97C1F552122855CB00EDE616 /* HTMLToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTMLToken.h; path = parser/HTMLToken.h; sourceTree = "<group>"; }; 97C471D912F925BC0086354B /* ContentSecurityPolicy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentSecurityPolicy.cpp; sourceTree = "<group>"; }; 97C471DA12F925BD0086354B /* ContentSecurityPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentSecurityPolicy.h; sourceTree = "<group>"; }; + 97D2AD0114B823A60093DF32 /* DOMWindowProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowProperty.cpp; sourceTree = "<group>"; }; + 97D2AD0214B823A60093DF32 /* DOMWindowProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWindowProperty.h; sourceTree = "<group>"; }; 97DCE1FF10807C750057D394 /* HistoryController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HistoryController.cpp; sourceTree = "<group>"; }; 97DCE20010807C750057D394 /* HistoryController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HistoryController.h; sourceTree = "<group>"; }; 97E4028D13A696ED00913D67 /* IconController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IconController.cpp; sourceTree = "<group>"; }; @@ -10778,6 +10794,8 @@ A77979250D6B9E64003851B9 /* JSImageData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSImageData.h; sourceTree = "<group>"; }; A77B419F12E675A90054343D /* TextEventInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextEventInputType.h; sourceTree = "<group>"; }; A77D0011133B0AEB00D6658C /* TextChecking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextChecking.h; sourceTree = "<group>"; }; + A77E1FED14AACB6E005B7CB6 /* TreeScopeAdopter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TreeScopeAdopter.cpp; sourceTree = "<group>"; }; + A77E1FEE14AACB6E005B7CB6 /* TreeScopeAdopter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TreeScopeAdopter.h; sourceTree = "<group>"; }; A781C6A613828B5D0012A62A /* DocumentMarker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentMarker.cpp; sourceTree = "<group>"; }; A784941A0B5FE507001E237A /* Clipboard.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Clipboard.cpp; sourceTree = "<group>"; }; A78E526D1346BD1700AD9C31 /* MeterShadowElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MeterShadowElement.cpp; sourceTree = "<group>"; }; @@ -11305,6 +11323,9 @@ A8EA80050A19516E00A8EF5F /* StyleSheet.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = StyleSheet.cpp; sourceTree = "<group>"; }; A8EA80060A19516E00A8EF5F /* MediaList.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MediaList.h; sourceTree = "<group>"; }; A8F4578F14B2B004000CEA59 /* resolve-supplemental.pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; name = "resolve-supplemental.pl"; path = "scripts/resolve-supplemental.pl"; sourceTree = "<group>"; }; + A8F4579D14BC13EC000CEA59 /* DOMWindowSQLDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowSQLDatabase.cpp; sourceTree = "<group>"; }; + A8F4579E14BC13EC000CEA59 /* DOMWindowSQLDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWindowSQLDatabase.h; sourceTree = "<group>"; }; + A8F4579F14BC13EC000CEA59 /* DOMWindowSQLDatabase.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMWindowSQLDatabase.idl; sourceTree = "<group>"; }; A8FA6E5B0E4CFDED00D5CF49 /* Pattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pattern.h; sourceTree = "<group>"; }; A8FA6E5C0E4CFDED00D5CF49 /* Pattern.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Pattern.cpp; sourceTree = "<group>"; }; A9C6E4E10D745E05006442E9 /* DOMMimeType.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DOMMimeType.cpp; sourceTree = "<group>"; }; @@ -14376,6 +14397,9 @@ 1AE82EC90CAAE177002237AE /* storage */ = { isa = PBXGroup; children = ( + A8F4579D14BC13EC000CEA59 /* DOMWindowSQLDatabase.cpp */, + A8F4579E14BC13EC000CEA59 /* DOMWindowSQLDatabase.h */, + A8F4579F14BC13EC000CEA59 /* DOMWindowSQLDatabase.idl */, B5B5DC67119BB3D5002A8790 /* AbstractDatabase.cpp */, B5B5DC68119BB3D5002A8790 /* AbstractDatabase.h */, 514185ED0CD65F0400763C99 /* ChangeVersionWrapper.cpp */, @@ -14561,6 +14585,8 @@ 41F0618C0F5F069800A07EAC /* ConsoleMessage.h */, 59102FB914327D3B003C9D04 /* ContentSearchUtils.cpp */, 59102FBA14327D3B003C9D04 /* ContentSearchUtils.h */, + 7AABA25714BC613300AA9A11 /* DOMEditor.cpp */, + 7AABA25814BC613300AA9A11 /* DOMEditor.h */, 4F1442261339FD6200E0D6F8 /* DOMNodeHighlighter.cpp */, 4F1442271339FD6200E0D6F8 /* DOMNodeHighlighter.h */, F35AE5AB14925F5B004D5776 /* DOMWrapperVisitor.h */, @@ -15649,6 +15675,8 @@ 1403B99609EB13AF00797C7F /* DOMWindow.cpp */, 1403B99509EB13AF00797C7F /* DOMWindow.h */, 1403B90C09EB124500797C7F /* DOMWindow.idl */, + 97D2AD0114B823A60093DF32 /* DOMWindowProperty.cpp */, + 97D2AD0214B823A60093DF32 /* DOMWindowProperty.h */, A718760D0B2A120100A16ECE /* DragActions.h */, A7CA59620B27C1F200FA021D /* DragClient.h */, A7CA595C0B27BD9E00FA021D /* DragController.cpp */, @@ -15668,6 +15696,8 @@ 65BF022A0974816300C43196 /* Frame.h */, A7B070D0130A409C00A3763C /* FrameActionScheduler.cpp */, A7B070D1130A409C00A3763C /* FrameActionScheduler.h */, + 974A862014B7ADBB003FDC76 /* FrameDestructionObserver.cpp */, + 974A862114B7ADBB003FDC76 /* FrameDestructionObserver.h */, 65A21482097A3F5300B9050A /* FrameTree.cpp */, 65A21483097A3F5300B9050A /* FrameTree.h */, 65CBFEF70974F607001DAC25 /* FrameView.cpp */, @@ -21450,6 +21480,8 @@ 37FD4297118368460093C029 /* TreeDepthLimit.h */, 14D64B5A134A5B6B00E58FDA /* TreeScope.cpp */, 14D64B5B134A5B6B00E58FDA /* TreeScope.h */, + A77E1FED14AACB6E005B7CB6 /* TreeScopeAdopter.cpp */, + A77E1FEE14AACB6E005B7CB6 /* TreeScopeAdopter.h */, 854FE72E0A2297BE0058D7AD /* TreeWalker.cpp */, 854FE72F0A2297BE0058D7AD /* TreeWalker.h */, 1A750D3C0A90DE35000FF215 /* TreeWalker.idl */, @@ -24702,6 +24734,7 @@ 854FE7370A2297BE0058D7AD /* Traversal.h in Headers */, 37FD4298118368460093C029 /* TreeDepthLimit.h in Headers */, 14D64B5D134A5B6B00E58FDA /* TreeScope.h in Headers */, + A77E1FF014AACB6E005B7CB6 /* TreeScopeAdopter.h in Headers */, 1419D2C50CEA6F6100FF507A /* TreeShared.h in Headers */, 854FE7390A2297BE0058D7AD /* TreeWalker.h in Headers */, 37C28A6810F659CC008C7813 /* TypesettingFeatures.h in Headers */, @@ -24876,6 +24909,10 @@ E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */, 977E2E0F12F0FC9C00C13379 /* XSSAuditor.h in Headers */, FD537353137B651800008DCE /* ZeroPole.h in Headers */, + 974A862314B7ADBB003FDC76 /* FrameDestructionObserver.h in Headers */, + 97D2AD0414B823A60093DF32 /* DOMWindowProperty.h in Headers */, + 7AABA25A14BC613300AA9A11 /* DOMEditor.h in Headers */, + A8F457A114BC1A94000CEA59 /* DOMWindowSQLDatabase.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -27634,6 +27671,7 @@ 49E911D10EF86D47009D0CAF /* TranslateTransformOperation.cpp in Sources */, 854FE7360A2297BE0058D7AD /* Traversal.cpp in Sources */, 14D64B5C134A5B6B00E58FDA /* TreeScope.cpp in Sources */, + A77E1FEF14AACB6E005B7CB6 /* TreeScopeAdopter.cpp in Sources */, 854FE7380A2297BE0058D7AD /* TreeWalker.cpp in Sources */, 93309E19099E64920056E581 /* TypingCommand.cpp in Sources */, 85031B4D0A44EFC700F992E0 /* UIEvent.cpp in Sources */, @@ -27779,6 +27817,10 @@ E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */, 977E2E0E12F0FC9C00C13379 /* XSSAuditor.cpp in Sources */, FD537352137B651800008DCE /* ZeroPole.cpp in Sources */, + 974A862214B7ADBB003FDC76 /* FrameDestructionObserver.cpp in Sources */, + 97D2AD0314B823A60093DF32 /* DOMWindowProperty.cpp in Sources */, + 7AABA25914BC613300AA9A11 /* DOMEditor.cpp in Sources */, + A8F457A014BC1A88000CEA59 /* DOMWindowSQLDatabase.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Source/WebCore/accessibility/AXObjectCache.cpp b/Source/WebCore/accessibility/AXObjectCache.cpp index c0b2bab55..02d5bfb23 100644 --- a/Source/WebCore/accessibility/AXObjectCache.cpp +++ b/Source/WebCore/accessibility/AXObjectCache.cpp @@ -178,7 +178,7 @@ AccessibilityObject* AXObjectCache::get(RenderObject* renderer) ASSERT(!HashTraits<AXID>::isDeletedValue(axID)); if (!axID) return 0; - + return m_objects.get(axID).get(); } diff --git a/Source/WebCore/accessibility/AccessibilityAllInOne.cpp b/Source/WebCore/accessibility/AccessibilityAllInOne.cpp index dd7f7776d..b329ad016 100644 --- a/Source/WebCore/accessibility/AccessibilityAllInOne.cpp +++ b/Source/WebCore/accessibility/AccessibilityAllInOne.cpp @@ -44,3 +44,4 @@ #include "AccessibilityTableColumn.cpp" #include "AccessibilityTableHeaderContainer.cpp" #include "AccessibilityTableRow.cpp" + diff --git a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp index 730c11c3a..942f200e2 100644 --- a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp +++ b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp @@ -2400,7 +2400,7 @@ AccessibilityObject* AccessibilityRenderObject::accessibilityParentForImageMap(H void AccessibilityRenderObject::getDocumentLinks(AccessibilityChildrenVector& result) { Document* document = m_renderer->document(); - RefPtr<HTMLCollection> coll = document->links(); + HTMLCollection* coll = document->links(); Node* curr = coll->firstItem(); while (curr) { RenderObject* obj = curr->renderer(); diff --git a/Source/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp b/Source/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp index d6e0082c0..eadacaf3b 100644 --- a/Source/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp +++ b/Source/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp @@ -76,7 +76,6 @@ using namespace WebCore; -static GQuark gailTextUtilQuark = 0; static GQuark hyperlinkObjectQuark = 0; static AccessibilityObject* fallbackObject() @@ -846,7 +845,6 @@ static void webkit_accessible_class_init(AtkObjectClass* klass) klass->get_attributes = webkit_accessible_get_attributes; klass->ref_relation_set = webkit_accessible_ref_relation_set; - gailTextUtilQuark = g_quark_from_static_string("webkit-accessible-gail-text-util"); hyperlinkObjectQuark = g_quark_from_static_string("webkit-accessible-hyperlink-object"); } @@ -1293,13 +1291,8 @@ static gchar* webkit_accessible_text_get_text(AtkText* text, gint startOffset, g static GailTextUtil* getGailTextUtilForAtk(AtkText* textObject) { - gpointer data = g_object_get_qdata(G_OBJECT(textObject), gailTextUtilQuark); - if (data) - return static_cast<GailTextUtil*>(data); - GailTextUtil* gailTextUtil = gail_text_util_new(); gail_text_util_text_setup(gailTextUtil, webkit_accessible_text_get_text(textObject, 0, -1)); - g_object_set_qdata_full(G_OBJECT(textObject), gailTextUtilQuark, gailTextUtil, g_object_unref); return gailTextUtil; } @@ -1352,20 +1345,8 @@ static gint webkit_accessible_text_get_caret_offset(AtkText* text) if (!coreObject->isAccessibilityRenderObject()) return 0; - Document* document = coreObject->document(); - if (!document) - return 0; - - Node* focusedNode = coreObject->selection().end().deprecatedNode(); - if (!focusedNode) - return 0; - - RenderObject* focusedRenderer = focusedNode->renderer(); - AccessibilityObject* focusedObject = document->axObjectCache()->getOrCreate(focusedRenderer); - int offset; - // Don't ignore links if the offset is being requested for a link. - if (!objectAndOffsetUnignored(focusedObject, offset, !coreObject->isLink())) + if (!objectFocusedAndCaretOffsetUnignored(coreObject, offset)) return 0; RenderObject* renderer = coreObject->renderer(); @@ -2733,40 +2714,67 @@ AtkObject* webkit_accessible_get_focused_element(WebKitAccessible* accessible) return focusedObj->wrapper(); } -AccessibilityObject* objectAndOffsetUnignored(AccessibilityObject* coreObject, int& offset, bool ignoreLinks) +AccessibilityObject* objectFocusedAndCaretOffsetUnignored(AccessibilityObject* referenceObject, int& offset) { // Indication that something bogus has transpired. offset = -1; - AccessibilityObject* realObject = coreObject; - if (realObject->accessibilityIsIgnored()) - realObject = realObject->parentObjectUnignored(); - if (!realObject) + Document* document = referenceObject->document(); + if (!document) + return 0; + + Node* focusedNode = referenceObject->selection().end().containerNode(); + if (!focusedNode) return 0; - if (ignoreLinks && realObject->isLink()) - realObject = realObject->parentObjectUnignored(); - if (!realObject) + RenderObject* focusedRenderer = focusedNode->renderer(); + if (!focusedRenderer) return 0; - Node* node = realObject->node(); - if (node) { - VisiblePosition startPosition = VisiblePosition(positionBeforeNode(node), DOWNSTREAM); - VisiblePosition endPosition = realObject->selection().visibleEnd(); + AccessibilityObject* focusedObject = document->axObjectCache()->getOrCreate(focusedRenderer); + if (!focusedObject) + return 0; - if (startPosition == endPosition) - offset = 0; - else if (!isStartOfLine(endPosition)) { - RefPtr<Range> range = makeRange(startPosition, endPosition.previous()); - offset = TextIterator::rangeLength(range.get(), true) + 1; - } else { - RefPtr<Range> range = makeRange(startPosition, endPosition); - offset = TextIterator::rangeLength(range.get(), true); - } + // Look for the actual (not ignoring accessibility) selected object. + if (focusedObject->accessibilityIsIgnored()) + focusedObject = focusedObject->parentObjectUnignored(); + if (!focusedObject) + return 0; + + // Don't ignore links if the offset is being requested for a link. + if (!referenceObject->isLink() && focusedObject->isLink()) + focusedObject = focusedObject->parentObjectUnignored(); + if (!focusedObject) + return 0; + Node* startNode = 0; + if (focusedObject != referenceObject || focusedObject->isTextControl()) { + // We need to use the first child's node of the reference + // object as the start point to calculate the caret offset + // because we want it to be relative to the object of + // reference, not just to the focused object (which could have + // previous siblings which should be taken into account too). + AccessibilityObject* axFirstChild = referenceObject->firstChild(); + if (axFirstChild) + startNode = axFirstChild->node(); + } + if (!startNode) + startNode = focusedObject->node(); + + VisiblePosition startPosition = VisiblePosition(firstPositionInNode(startNode), DOWNSTREAM); + VisiblePosition endPosition = focusedObject->selection().visibleEnd(); + + if (startPosition == endPosition) + offset = 0; + else if (!isStartOfLine(endPosition)) { + RefPtr<Range> range = makeRange(startPosition, endPosition.previous()); + offset = TextIterator::rangeLength(range.get(), true) + 1; + } else { + RefPtr<Range> range = makeRange(startPosition, endPosition); + offset = TextIterator::rangeLength(range.get(), true); } - return realObject; + return focusedObject; } #endif // HAVE(ACCESSIBILITY) diff --git a/Source/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.h b/Source/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.h index e8cec08f3..c56f32fa9 100644 --- a/Source/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.h +++ b/Source/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.h @@ -60,7 +60,7 @@ void webkit_accessible_detach (WebKitAccessible* accessible); AtkObject* webkit_accessible_get_focused_element(WebKitAccessible* accessible); -WebCore::AccessibilityObject* objectAndOffsetUnignored(WebCore::AccessibilityObject* coreObject, int& offset, bool ignoreLinks); +WebCore::AccessibilityObject* objectFocusedAndCaretOffsetUnignored(WebCore::AccessibilityObject*, int& offset); G_END_DECLS diff --git a/Source/WebCore/bindings/generic/BindingSecurity.h b/Source/WebCore/bindings/generic/BindingSecurity.h index a1c464ba1..57862e13a 100644 --- a/Source/WebCore/bindings/generic/BindingSecurity.h +++ b/Source/WebCore/bindings/generic/BindingSecurity.h @@ -55,7 +55,7 @@ public: // Check if it is safe to access the given node from the // current security context. - static bool checkNodeSecurity(State<Binding>*, Node* target); + static bool allowAccessToNode(State<Binding>*, Node* target); static bool allowPopUp(State<Binding>*); static bool allowSettingFrameSrcToJavascriptUrl(State<Binding>*, HTMLFrameElementBase*, const String& value); @@ -101,7 +101,7 @@ bool BindingSecurity<Binding>::canAccessFrame(State<Binding>* state, } template <class Binding> -bool BindingSecurity<Binding>::checkNodeSecurity(State<Binding>* state, Node* node) +bool BindingSecurity<Binding>::allowAccessToNode(State<Binding>* state, Node* node) { if (!node) return false; @@ -131,7 +131,7 @@ bool BindingSecurity<Binding>::allowSettingFrameSrcToJavascriptUrl(State<Binding { if (protocolIsJavaScript(stripLeadingAndTrailingHTMLSpaces(value))) { Node* contentDoc = frame->contentDocument(); - if (contentDoc && !checkNodeSecurity(state, contentDoc)) + if (contentDoc && !allowAccessToNode(state, contentDoc)) return false; } return true; diff --git a/Source/WebCore/bindings/js/JSDOMBinding.cpp b/Source/WebCore/bindings/js/JSDOMBinding.cpp index 2f49994ce..de78d47e1 100644 --- a/Source/WebCore/bindings/js/JSDOMBinding.cpp +++ b/Source/WebCore/bindings/js/JSDOMBinding.cpp @@ -216,12 +216,12 @@ DOMWindow* firstDOMWindow(ExecState* exec) return asJSDOMWindow(exec->dynamicGlobalObject())->impl(); } -bool checkNodeSecurity(ExecState* exec, Node* node) +bool allowAccessToNode(ExecState* exec, Node* node) { - return node && allowsAccessFromFrame(exec, node->document()->frame()); + return node && allowAccessToFrame(exec, node->document()->frame()); } -bool allowsAccessFromFrame(ExecState* exec, Frame* frame) +bool allowAccessToFrame(ExecState* exec, Frame* frame) { if (!frame) return false; @@ -229,7 +229,7 @@ bool allowsAccessFromFrame(ExecState* exec, Frame* frame) return window && window->allowsAccessFrom(exec); } -bool allowsAccessFromFrame(ExecState* exec, Frame* frame, String& message) +bool allowAccessToFrame(ExecState* exec, Frame* frame, String& message) { if (!frame) return false; @@ -244,12 +244,6 @@ void printErrorMessageForFrame(Frame* frame, const String& message) frame->domWindow()->printErrorMessage(message); } -// FIXME: We should remove or at least deprecate this function. Callers can use firstDOMWindow directly. -Frame* toDynamicFrame(ExecState* exec) -{ - return firstDOMWindow(exec)->frame(); -} - JSValue objectToStringFunctionGetter(ExecState* exec, JSValue, const Identifier& propertyName) { return JSFunction::create(exec, exec->lexicalGlobalObject(), 0, propertyName, objectProtoFuncToString); diff --git a/Source/WebCore/bindings/js/JSDOMBinding.h b/Source/WebCore/bindings/js/JSDOMBinding.h index d81847c79..a66c84752 100644 --- a/Source/WebCore/bindings/js/JSDOMBinding.h +++ b/Source/WebCore/bindings/js/JSDOMBinding.h @@ -280,22 +280,21 @@ enum ParameterMissingPolicy { // Validates that the passed object is a sequence type per section 4.1.13 of the WebIDL spec. JSC::JSObject* toJSSequence(JSC::ExecState*, JSC::JSValue, unsigned&); - bool checkNodeSecurity(JSC::ExecState*, Node*); - - // Helpers for Window, History, and Location classes to implement cross-domain policy. - // Besides the cross-domain check, they need non-caching versions of staticFunctionGetter for - // because we do not want current property values involved at all. - // FIXME: These functions should be named frameAllowsAccessFrom, because the access is *to* the frame. - bool allowsAccessFromFrame(JSC::ExecState*, Frame*); - bool allowsAccessFromFrame(JSC::ExecState*, Frame*, String& message); + // FIXME: Implement allowAccessToContext(JSC::ExecState*, ScriptExecutionContext*); + bool allowAccessToNode(JSC::ExecState*, Node*); + bool allowAccessToFrame(JSC::ExecState*, Frame*); + bool allowAccessToFrame(JSC::ExecState*, Frame*, String& message); + // FIXME: Implement allowAccessToDOMWindow(JSC::ExecState*, DOMWindow*); + + // FIXME: Remove these functions in favor of activeContext and + // firstContext, which return ScriptExecutionContext*. We prefer to use + // ScriptExecutionContext* as the context object in the bindings. DOMWindow* activeDOMWindow(JSC::ExecState*); DOMWindow* firstDOMWindow(JSC::ExecState*); void printErrorMessageForFrame(Frame*, const String& message); JSC::JSValue objectToStringFunctionGetter(JSC::ExecState*, JSC::JSValue, const JSC::Identifier& propertyName); - Frame* toDynamicFrame(JSC::ExecState*); - inline JSC::JSValue jsString(JSC::ExecState* exec, const String& s) { StringImpl* stringImpl = s.impl(); diff --git a/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp b/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp index c685c78fa..a23d8b225 100644 --- a/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp +++ b/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp @@ -115,10 +115,10 @@ static JSValue namedItemGetter(ExecState* exec, JSValue slotBase, const Identifi ASSERT(document); ASSERT(document->isHTMLDocument()); - RefPtr<HTMLCollection> collection = document->windowNamedItems(identifierToAtomicString(propertyName)); + HTMLCollection* collection = document->windowNamedItems(identifierToAtomicString(propertyName)); if (collection->length() == 1) return toJS(exec, thisObj, collection->firstItem()); - return toJS(exec, thisObj, collection.get()); + return toJS(exec, thisObj, collection); } bool JSDOMWindow::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) diff --git a/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp b/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp index c00a55192..fd518459a 100644 --- a/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp +++ b/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp @@ -61,7 +61,7 @@ JSValue JSHTMLDocument::nameGetter(ExecState* exec, JSValue slotBase, const Iden JSHTMLDocument* thisObj = static_cast<JSHTMLDocument*>(asObject(slotBase)); HTMLDocument* document = static_cast<HTMLDocument*>(thisObj->impl()); - RefPtr<HTMLCollection> collection = document->documentNamedItems(identifierToAtomicString(propertyName)); + HTMLCollection* collection = document->documentNamedItems(identifierToAtomicString(propertyName)); unsigned length = collection->length(); if (!length) @@ -77,7 +77,7 @@ JSValue JSHTMLDocument::nameGetter(ExecState* exec, JSValue slotBase, const Iden return toJS(exec, thisObj->globalObject(), node); } - return toJS(exec, thisObj->globalObject(), collection.get()); + return toJS(exec, thisObj->globalObject(), collection); } // Custom attributes @@ -89,7 +89,7 @@ JSValue JSHTMLDocument::all(ExecState* exec) const if (v) return v; - return toJS(exec, globalObject(), static_cast<HTMLDocument*>(impl())->all().get()); + return toJS(exec, globalObject(), static_cast<HTMLDocument*>(impl())->all()); } void JSHTMLDocument::setAll(ExecState* exec, JSValue value) diff --git a/Source/WebCore/bindings/js/JSHTMLFrameElementCustom.cpp b/Source/WebCore/bindings/js/JSHTMLFrameElementCustom.cpp index 599416704..c6cc2488b 100644 --- a/Source/WebCore/bindings/js/JSHTMLFrameElementCustom.cpp +++ b/Source/WebCore/bindings/js/JSHTMLFrameElementCustom.cpp @@ -45,7 +45,7 @@ static inline bool allowSettingJavascriptURL(ExecState* exec, HTMLFrameElement* { if (protocolIsJavaScript(stripLeadingAndTrailingHTMLSpaces(value))) { Document* contentDocument = imp->contentDocument(); - if (contentDocument && !checkNodeSecurity(exec, contentDocument)) + if (contentDocument && !allowAccessToNode(exec, contentDocument)) return false; } return true; diff --git a/Source/WebCore/bindings/js/JSHistoryCustom.cpp b/Source/WebCore/bindings/js/JSHistoryCustom.cpp index 7e5438e4a..72ea5424c 100644 --- a/Source/WebCore/bindings/js/JSHistoryCustom.cpp +++ b/Source/WebCore/bindings/js/JSHistoryCustom.cpp @@ -61,7 +61,7 @@ bool JSHistory::getOwnPropertySlotDelegate(ExecState* exec, const Identifier& pr // Our custom code is only needed to implement the Window cross-domain scheme, so if access is // allowed, return false so the normal lookup will take place. String message; - if (allowsAccessFromFrame(exec, impl()->frame(), message)) + if (allowAccessToFrame(exec, impl()->frame(), message)) return false; // Check for the few functions that we allow, even when called cross-domain. @@ -101,7 +101,7 @@ bool JSHistory::getOwnPropertyDescriptorDelegate(ExecState* exec, const Identifi } // Throw out all cross domain access - if (!allowsAccessFromFrame(exec, impl()->frame())) + if (!allowAccessToFrame(exec, impl()->frame())) return true; // Check for the few functions that we allow, even when called cross-domain. @@ -141,7 +141,7 @@ bool JSHistory::getOwnPropertyDescriptorDelegate(ExecState* exec, const Identifi bool JSHistory::putDelegate(ExecState* exec, const Identifier&, JSValue, PutPropertySlot&) { // Only allow putting by frames in the same origin. - if (!allowsAccessFromFrame(exec, impl()->frame())) + if (!allowAccessToFrame(exec, impl()->frame())) return true; return false; } @@ -150,7 +150,7 @@ bool JSHistory::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& { JSHistory* thisObject = jsCast<JSHistory*>(cell); // Only allow deleting by frames in the same origin. - if (!allowsAccessFromFrame(exec, thisObject->impl()->frame())) + if (!allowAccessToFrame(exec, thisObject->impl()->frame())) return false; return Base::deleteProperty(thisObject, exec, propertyName); } @@ -159,7 +159,7 @@ void JSHistory::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyN { JSHistory* thisObject = jsCast<JSHistory*>(object); // Only allow the history object to enumerated by frames in the same origin. - if (!allowsAccessFromFrame(exec, thisObject->impl()->frame())) + if (!allowAccessToFrame(exec, thisObject->impl()->frame())) return; Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode); } diff --git a/Source/WebCore/bindings/js/JSImageDataCustom.cpp b/Source/WebCore/bindings/js/JSImageDataCustom.cpp index 0f89e9059..d2ca476c7 100644 --- a/Source/WebCore/bindings/js/JSImageDataCustom.cpp +++ b/Source/WebCore/bindings/js/JSImageDataCustom.cpp @@ -47,10 +47,9 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, ImageData* imageD wrapper = CREATE_DOM_WRAPPER(exec, globalObject, ImageData, imageData); Identifier dataName(exec, "data"); - static const ClassInfo cpaClassInfo = { "CanvasPixelArray", &JSByteArray::s_info, 0, 0, CREATE_METHOD_TABLE(JSByteArray) }; - Structure* cpaStructure = getCachedDOMStructure(globalObject, &cpaClassInfo); + Structure* cpaStructure = getCachedDOMStructure(globalObject, &JSByteArray::s_info); if (!cpaStructure) - cpaStructure = cacheDOMStructure(globalObject, JSByteArray::createStructure(exec->globalData(), globalObject, jsNull(), &cpaClassInfo), &cpaClassInfo); + cpaStructure = cacheDOMStructure(globalObject, JSByteArray::createStructure(exec->globalData(), globalObject, jsNull(), &JSByteArray::s_info), &JSByteArray::s_info); wrapper->putDirect(exec->globalData(), dataName, JSByteArray::create(exec, cpaStructure, imageData->data()->data()), DontDelete | ReadOnly); exec->heap()->reportExtraMemoryCost(imageData->data()->length()); diff --git a/Source/WebCore/bindings/js/JSLocationCustom.cpp b/Source/WebCore/bindings/js/JSLocationCustom.cpp index 095eabc43..22032c7da 100644 --- a/Source/WebCore/bindings/js/JSLocationCustom.cpp +++ b/Source/WebCore/bindings/js/JSLocationCustom.cpp @@ -59,7 +59,7 @@ bool JSLocation::getOwnPropertySlotDelegate(ExecState* exec, const Identifier& p // Our custom code is only needed to implement the Window cross-domain scheme, so if access is // allowed, return false so the normal lookup will take place. String message; - if (allowsAccessFromFrame(exec, frame, message)) + if (allowAccessToFrame(exec, frame, message)) return false; // Check for the few functions that we allow, even when called cross-domain. @@ -95,7 +95,7 @@ bool JSLocation::getOwnPropertyDescriptorDelegate(ExecState* exec, const Identif } // throw out all cross domain access - if (!allowsAccessFromFrame(exec, frame)) + if (!allowAccessToFrame(exec, frame)) return true; // Check for the few functions that we allow, even when called cross-domain. @@ -134,7 +134,7 @@ bool JSLocation::putDelegate(ExecState* exec, const Identifier& propertyName, JS if (propertyName == exec->propertyNames().toString || propertyName == exec->propertyNames().valueOf) return true; - bool sameDomainAccess = allowsAccessFromFrame(exec, frame); + bool sameDomainAccess = allowAccessToFrame(exec, frame); const HashEntry* entry = JSLocation::s_info.propHashTable(exec)->entry(exec, propertyName); if (!entry) { @@ -156,7 +156,7 @@ bool JSLocation::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& { JSLocation* thisObject = jsCast<JSLocation*>(cell); // Only allow deleting by frames in the same origin. - if (!allowsAccessFromFrame(exec, thisObject->impl()->frame())) + if (!allowAccessToFrame(exec, thisObject->impl()->frame())) return false; return Base::deleteProperty(thisObject, exec, propertyName); } @@ -165,7 +165,7 @@ void JSLocation::getOwnPropertyNames(JSObject* object, ExecState* exec, Property { JSLocation* thisObject = jsCast<JSLocation*>(object); // Only allow the location object to enumerated by frames in the same origin. - if (!allowsAccessFromFrame(exec, thisObject->impl()->frame())) + if (!allowAccessToFrame(exec, thisObject->impl()->frame())) return; Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode); } @@ -270,7 +270,7 @@ JSValue JSLocation::assign(ExecState* exec) JSValue JSLocation::toStringFunction(ExecState* exec) { Frame* frame = impl()->frame(); - if (!frame || !allowsAccessFromFrame(exec, frame)) + if (!frame || !allowAccessToFrame(exec, frame)) return jsUndefined(); return jsString(exec, impl()->toString()); diff --git a/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp b/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp index 5c7cbffc2..69010aec0 100644 --- a/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp +++ b/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp @@ -71,7 +71,6 @@ #include <wtf/FastMalloc.h> #include <wtf/Float32Array.h> #include <wtf/Int32Array.h> -#include <wtf/OwnFastMallocPtr.h> #if ENABLE(VIDEO) #include "HTMLVideoElement.h" diff --git a/Source/WebCore/bindings/js/ScriptController.cpp b/Source/WebCore/bindings/js/ScriptController.cpp index 0f1c1c7dc..9562f492a 100644 --- a/Source/WebCore/bindings/js/ScriptController.cpp +++ b/Source/WebCore/bindings/js/ScriptController.cpp @@ -248,7 +248,7 @@ bool ScriptController::canAccessFromCurrentOrigin(Frame *frame) { ExecState* exec = JSMainThreadExecState::currentState(); if (exec) - return allowsAccessFromFrame(exec, frame); + return allowAccessToFrame(exec, frame); // If the current state is 0 we're in a call path where the DOM security // check doesn't apply (eg. parser). return true; diff --git a/Source/WebCore/bindings/js/SerializedScriptValue.cpp b/Source/WebCore/bindings/js/SerializedScriptValue.cpp index a56a8dc9f..3ac6ecf58 100644 --- a/Source/WebCore/bindings/js/SerializedScriptValue.cpp +++ b/Source/WebCore/bindings/js/SerializedScriptValue.cpp @@ -1261,8 +1261,7 @@ DeserializationResult CloneDeserializer::deserialize() fail(); goto error; } - JSArray* outArray = constructEmptyArray(m_exec, m_globalObject); - outArray->setLength(length); + JSArray* outArray = constructEmptyArray(m_exec, m_globalObject, length); m_gcBuffer.append(outArray); outputArrayStack.append(outArray); // fallthrough diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm b/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm index 22a3e6a6a..d3145929f 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm @@ -201,7 +201,6 @@ sub ShouldSkipTypeInImplementation return 1 if $typeInfo->signature->extendedAttributes->{"CustomArgumentHandling"} or $typeInfo->signature->extendedAttributes->{"CustomGetter"} - or $typeInfo->signature->extendedAttributes->{"NeedsUserGestureCheck"} or $typeInfo->signature->extendedAttributes->{"CPPCustom"}; # FIXME: We don't generate bindings for SVG related interfaces yet @@ -669,7 +668,7 @@ sub GenerateImplementation push(@implContent, "$implClassNameWithNamespace* ${className}::impl() const\n"); push(@implContent, "{\n"); - push(@implContent, " return m_impl ? m_impl->impl.get() : 0;\n"); + push(@implContent, " return m_impl ? WTF::getPtr(m_impl->impl) : 0;\n"); push(@implContent, "}\n\n"); # Destructor @@ -849,7 +848,16 @@ sub GenerateImplementation my @functionContent = (); push(@parameterNames, "ec") if $raisesExceptions; - my $content = "impl()->" . $codeGenerator->WK_lcfirst($functionName) . "(" . join(", ", @parameterNames) . ")"; + + my $content; + if ($function->signature->extendedAttributes->{"ImplementedBy"}) { + my $implementedBy = $function->signature->extendedAttributes->{"ImplementedBy"}; + $implIncludes{"${implementedBy}.h"} = 1; + unshift(@parameterNames, "impl()"); + $content = "${implementedBy}::" . $codeGenerator->WK_lcfirst($functionName) . "(" . join(", ", @parameterNames) . ")"; + } else { + $content = "impl()->" . $codeGenerator->WK_lcfirst($functionName) . "(" . join(", ", @parameterNames) . ")"; + } if ($returnType eq "void") { # Special case 'void' return type. diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm b/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm index c2ccfb3ee..702e8e6c8 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm @@ -769,14 +769,6 @@ sub GenerateFunction { push(@callImplParams, $paramName); } - # Not quite sure what to do with this yet, but we need to take into - # account the difference in parameters between the IDL file and the - # actual implementation. - if ($function->signature->extendedAttributes->{"NeedsUserGestureCheck"}) { - $functionSig .= ", gboolean isUserGesture"; - push(@callImplParams, "false"); - } - if ($returnType ne "void" && $returnValueIsGDOMType && $functionSigType ne "DOMObject") { if ($functionSigType ne "EventTarget") { $implIncludes{"webkit/WebKitDOM${functionSigType}Private.h"} = 1; @@ -945,7 +937,15 @@ EOF } $getterContentHead = "${assign}convertToUTF8String(${functionName}(" . join(", ", @arguments) . "));\n"; } else { - $getterContentHead = "${assign}convertToUTF8String(item->${functionSigName}(" . join(", ", @callImplParams) . "));\n"; + my @arguments = @callImplParams; + if ($function->signature->extendedAttributes->{"ImplementedBy"}) { + my $implementedBy = $function->signature->extendedAttributes->{"ImplementedBy"}; + $implIncludes{"${implementedBy}.h"} = 1; + unshift(@arguments, "item"); + $getterContentHead = "${assign}convertToUTF8String(${implementedBy}::${functionSigName}(" . join(", ", @arguments) . "));\n"; + } else { + $getterContentHead = "${assign}convertToUTF8String(item->${functionSigName}(" . join(", ", @arguments) . "));\n"; + } } push(@cBody, " ${getterContentHead}"); } else { @@ -976,7 +976,15 @@ EOF $contentHead = "${assign}${assignPre}${functionName}(" . join(", ", @arguments) . "${assignPost});\n"; } } else { - $contentHead = "${assign}${assignPre}item->${functionSigName}(" . join(", ", @callImplParams) . "${assignPost});\n"; + my @arguments = @callImplParams; + if ($function->signature->extendedAttributes->{"ImplementedBy"}) { + my $implementedBy = $function->signature->extendedAttributes->{"ImplementedBy"}; + $implIncludes{"${implementedBy}.h"} = 1; + unshift(@arguments, "item"); + $contentHead = "${assign}${assignPre}${implementedBy}::${functionSigName}(" . join(", ", @arguments) . "${assignPost});\n"; + } else { + $contentHead = "${assign}${assignPre}item->${functionSigName}(" . join(", ", @arguments) . "${assignPost});\n"; + } } push(@cBody, " ${contentHead}"); diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm index c63deecec..10106ecbe 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -522,7 +522,7 @@ sub GenerateGetOwnPropertyDescriptorBody if ($interfaceName eq "DOMWindow") { push(@implContent, " if (!thisObject->allowsAccessFrom(exec))\n"); } else { - push(@implContent, " if (!allowsAccessFromFrame(exec, thisObject->impl()->frame()))\n"); + push(@implContent, " if (!allowAccessToFrame(exec, thisObject->impl()->frame()))\n"); } push(@implContent, " return false;\n"); } @@ -1752,15 +1752,15 @@ sub GenerateImplementation } else { push(@implContent, " return castedThis->$implGetterFunctionName(exec);\n"); } - } elsif ($attribute->signature->extendedAttributes->{"CheckNodeSecurity"}) { + } elsif ($attribute->signature->extendedAttributes->{"allowAccessToNode"}) { $implIncludes{"JSDOMBinding.h"} = 1; push(@implContent, " $implClassName* impl = static_cast<$implClassName*>(castedThis->impl());\n"); - push(@implContent, " return checkNodeSecurity(exec, impl->$implGetterFunctionName()) ? " . NativeToJSValue($attribute->signature, 0, $implClassName, "impl->$implGetterFunctionName()", "castedThis") . " : jsUndefined();\n"); + push(@implContent, " return allowAccessToNode(exec, impl->$implGetterFunctionName()) ? " . NativeToJSValue($attribute->signature, 0, $implClassName, "impl->$implGetterFunctionName()", "castedThis") . " : jsUndefined();\n"); } elsif ($attribute->signature->extendedAttributes->{"CheckFrameSecurity"}) { $implIncludes{"Document.h"} = 1; $implIncludes{"JSDOMBinding.h"} = 1; push(@implContent, " $implClassName* impl = static_cast<$implClassName*>(castedThis->impl());\n"); - push(@implContent, " return checkNodeSecurity(exec, impl->contentDocument()) ? " . NativeToJSValue($attribute->signature, 0, $implClassName, "impl->$implGetterFunctionName()", "castedThis") . " : jsUndefined();\n"); + push(@implContent, " return allowAccessToNode(exec, impl->contentDocument()) ? " . NativeToJSValue($attribute->signature, 0, $implClassName, "impl->$implGetterFunctionName()", "castedThis") . " : jsUndefined();\n"); } elsif ($type eq "EventListener") { $implIncludes{"EventListener.h"} = 1; push(@implContent, " UNUSED_PARAM(exec);\n"); @@ -1928,7 +1928,7 @@ sub GenerateImplementation if ($interfaceName eq "DOMWindow") { push(@implContent, " if (!static_cast<$className*>(thisObject)->allowsAccessFrom(exec))\n"); } else { - push(@implContent, " if (!allowsAccessFromFrame(exec, static_cast<$className*>(thisObject)->impl()->frame()))\n"); + push(@implContent, " if (!allowAccessToFrame(exec, static_cast<$className*>(thisObject)->impl()->frame()))\n"); } push(@implContent, " return;\n"); } @@ -2056,7 +2056,7 @@ sub GenerateImplementation if ($interfaceName eq "DOMWindow") { push(@implContent, " if (!static_cast<$className*>(thisObject)->allowsAccessFrom(exec))\n"); } else { - push(@implContent, " if (!allowsAccessFromFrame(exec, static_cast<$className*>(thisObject)->impl()->frame()))\n"); + push(@implContent, " if (!allowAccessToFrame(exec, static_cast<$className*>(thisObject)->impl()->frame()))\n"); } push(@implContent, " return;\n"); } @@ -2170,7 +2170,7 @@ sub GenerateImplementation } if ($function->signature->extendedAttributes->{"SVGCheckSecurityDocument"} and !$function->isStatic) { - push(@implContent, " if (!checkNodeSecurity(exec, impl->getSVGDocument(" . (@{$function->raisesExceptions} ? "ec" : "") .")))\n"); + push(@implContent, " if (!allowAccessToNode(exec, impl->getSVGDocument(" . (@{$function->raisesExceptions} ? "ec" : "") .")))\n"); push(@implContent, " return JSValue::encode(jsUndefined());\n"); $implIncludes{"JSDOMBinding.h"} = 1; } @@ -2181,8 +2181,8 @@ sub GenerateImplementation push(@implContent, GenerateEventListenerCall($className, "remove")); } else { my $numParameters = @{$function->parameters}; - my ($functionString, $paramIndex) = GenerateParametersCheck(\@implContent, $function, $dataNode, $numParameters, $implClassName, $functionImplementationName, $svgPropertyType, $svgPropertyOrListPropertyType, $svgListPropertyType); - GenerateImplementationFunctionCall($function, $functionString, $paramIndex, " ", $svgPropertyType, $implClassName); + my ($functionString, $dummy) = GenerateParametersCheck(\@implContent, $function, $dataNode, $numParameters, $implClassName, $functionImplementationName, $svgPropertyType, $svgPropertyOrListPropertyType, $svgListPropertyType); + GenerateImplementationFunctionCall($function, $functionString, " ", $svgPropertyType, $implClassName); } } @@ -2419,19 +2419,23 @@ sub GenerateParametersCheck my $svgPropertyOrListPropertyType = shift; my $svgListPropertyType = shift; - my $paramIndex = 0; my $argsIndex = 0; my $hasOptionalArguments = 0; - my $functionBase = ""; + my @arguments; + my $functionName; if ($function->isStatic) { - $functionBase = "${implClassName}::"; + $functionName = "${implClassName}::${functionImplementationName}"; + } elsif ($function->signature->extendedAttributes->{"ImplementedBy"}) { + my $implementedBy = $function->signature->extendedAttributes->{"ImplementedBy"}; + AddToImplIncludes("${implementedBy}.h"); + unshift(@arguments, "impl"); + $functionName = "${implementedBy}::${functionImplementationName}"; } elsif ($svgPropertyOrListPropertyType and !$svgListPropertyType) { - $functionBase = "podImpl."; + $functionName = "podImpl.${functionImplementationName}"; } else { - $functionBase = "impl->"; + $functionName = "impl->${functionImplementationName}"; } - my $functionString = "$functionBase$functionImplementationName("; if ($function->signature->extendedAttributes->{"CustomArgumentHandling"} and !$function->isStatic) { push(@$outputArray, " RefPtr<ScriptArguments> scriptArguments(createScriptArguments(exec, $numParameters));\n"); @@ -2444,12 +2448,7 @@ sub GenerateParametersCheck my $callWith = $function->signature->extendedAttributes->{"CallWith"}; if ($callWith and !$function->signature->extendedAttributes->{"Constructor"}) { my $callWithArg = "COMPILE_ASSERT(false)"; - if ($callWith eq "DynamicFrame") { - push(@$outputArray, " Frame* dynamicFrame = toDynamicFrame(exec);\n"); - push(@$outputArray, " if (!dynamicFrame)\n"); - push(@$outputArray, " return JSValue::encode(jsUndefined());\n"); - $callWithArg = "dynamicFrame"; - } elsif ($callWith eq "ScriptState") { + if ($callWith eq "ScriptState") { $callWithArg = "exec"; } elsif ($callWith eq "ScriptExecutionContext") { push(@$outputArray, " ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();\n"); @@ -2457,9 +2456,7 @@ sub GenerateParametersCheck push(@$outputArray, " return JSValue::encode(jsUndefined());\n"); $callWithArg = "scriptContext"; } - $functionString .= ", " if $paramIndex; - $functionString .= $callWithArg; - $paramIndex++; + push @arguments, $callWithArg; } $implIncludes{"ExceptionCode.h"} = 1; @@ -2478,7 +2475,16 @@ sub GenerateParametersCheck $hasOptionalArguments = 1; } push(@$outputArray, " if (argsCount <= $argsIndex) {\n"); - GenerateImplementationFunctionCall($function, $functionString, $paramIndex, " " x 2, $svgPropertyType, $implClassName); + + my @optionalCallbackArguments = @arguments; + if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) { + push @optionalCallbackArguments, "scriptArguments, callStack"; + } + if (@{$function->raisesExceptions}) { + push @optionalCallbackArguments, "ec"; + } + my $functionString = "$functionName(" . join(", ", @optionalCallbackArguments) . ")"; + GenerateImplementationFunctionCall($function, $functionString, " " x 2, $svgPropertyType, $implClassName); push(@$outputArray, " }\n\n"); } @@ -2559,27 +2565,23 @@ sub GenerateParametersCheck } } - $functionString .= ", " if $paramIndex; - if ($argType eq "NodeFilter") { - $functionString .= "$name.get()"; + push @arguments, "$name.get()"; } elsif ($codeGenerator->IsSVGTypeNeedingTearOff($argType) and not $implClassName =~ /List$/) { - $functionString .= "$name->propertyReference()"; + push @arguments, "$name->propertyReference()"; } else { - $functionString .= $name; + push @arguments, $name; } $argsIndex++; - $paramIndex++; } - if ($function->signature->extendedAttributes->{"NeedsUserGestureCheck"}) { - $functionString .= ", " if $paramIndex; - $functionString .= "ScriptController::processingUserGesture()"; - $paramIndex++; - $implIncludes{"ScriptController.h"} = 1; + if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) { + push @arguments, "scriptArguments, callStack"; } - - return ($functionString, $paramIndex); + if (@{$function->raisesExceptions}) { + push @arguments, "ec"; + } + return ("$functionName(" . join(", ", @arguments) . ")", scalar @arguments); } sub GenerateCallbackHeader @@ -2744,23 +2746,10 @@ sub GenerateImplementationFunctionCall() { my $function = shift; my $functionString = shift; - my $paramIndex = shift; my $indent = shift; my $svgPropertyType = shift; my $implClassName = shift; - if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) { - $functionString .= ", " if $paramIndex; - $paramIndex += 2; - $functionString .= "scriptArguments, callStack"; - } - - if (@{$function->raisesExceptions}) { - $functionString .= ", " if $paramIndex; - $functionString .= "ec"; - } - $functionString .= ")"; - if ($function->signature->type eq "void") { push(@implContent, $indent . "$functionString;\n"); push(@implContent, $indent . "setDOMException(exec, ec);\n") if @{$function->raisesExceptions}; diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm b/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm index 34ab887cf..93739daa9 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm @@ -1607,9 +1607,13 @@ sub GenerateImplementation splice(@parameterNames, $currentParameter, 1, "${paramName}Core->propertyReference()"); } - my $content = $codeGenerator->WK_lcfirst($functionName) . "(" . join(", ", @parameterNames) . ")"; - - if ($svgPropertyType) { + my $content; + if ($function->signature->extendedAttributes->{"ImplementedBy"}) { + my $implementedBy = $function->signature->extendedAttributes->{"ImplementedBy"}; + $implIncludes{"${implementedBy}.h"} = 1; + unshift(@parameterNames, $caller); + $content = "${implementedBy}::" . $codeGenerator->WK_lcfirst($functionName) . "(" . join(", ", @parameterNames) . ")"; + } elsif ($svgPropertyType) { $implIncludes{"ExceptionCode.h"} = 1; push(@functionContent, " if (IMPL->role() == WebCore::AnimValRole) {\n"); push(@functionContent, " WebCore::raiseOnDOMError(WebCore::NO_MODIFICATION_ALLOWED_ERR);\n"); @@ -1620,9 +1624,9 @@ sub GenerateImplementation } push(@functionContent, " }\n"); push(@functionContent, " $svgPropertyType& podImpl = IMPL->propertyReference();\n"); - $content = "podImpl.$content"; + $content = "podImpl." . $codeGenerator->WK_lcfirst($functionName) . "(" . join(", ", @parameterNames) . ")"; } else { - $content = $caller . "->$content"; + $content = "$caller->" . $codeGenerator->WK_lcfirst($functionName) . "(" . join(", ", @parameterNames) . ")"; } if ($returnType eq "void") { diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm index a5667add2..c016cf9a0 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -291,8 +291,6 @@ sub GenerateHeader } } - my $hasLegacyParent = $dataNode->extendedAttributes->{"LegacyParent"}; - # - Add default header template push(@headerContent, GenerateHeaderContentHeader($dataNode)); @@ -883,10 +881,10 @@ END } # Generate security checks if necessary - if ($attribute->signature->extendedAttributes->{"CheckNodeSecurity"}) { - push(@implContentDecls, " if (!V8BindingSecurity::checkNodeSecurity(V8BindingState::Only(), imp->$attrName()))\n return v8::Handle<v8::Value>();\n\n"); + if ($attribute->signature->extendedAttributes->{"allowAccessToNode"}) { + push(@implContentDecls, " if (!V8BindingSecurity::allowAccessToNode(V8BindingState::Only(), imp->$attrName()))\n return v8::Handle<v8::Value>();\n\n"); } elsif ($attribute->signature->extendedAttributes->{"CheckFrameSecurity"}) { - push(@implContentDecls, " if (!V8BindingSecurity::checkNodeSecurity(V8BindingState::Only(), imp->contentDocument()))\n return v8::Handle<v8::Value>();\n\n"); + push(@implContentDecls, " if (!V8BindingSecurity::allowAccessToNode(V8BindingState::Only(), imp->contentDocument()))\n return v8::Handle<v8::Value>();\n\n"); } my $useExceptions = 1 if @{$attribute->getterExceptions}; @@ -1434,7 +1432,7 @@ END } if ($function->signature->extendedAttributes->{"SVGCheckSecurityDocument"}) { push(@implContentDecls, <<END); - if (!V8BindingSecurity::checkNodeSecurity(V8BindingState::Only(), imp->getSVGDocument(ec))) + if (!V8BindingSecurity::allowAccessToNode(V8BindingState::Only(), imp->getSVGDocument(ec))) return v8::Handle<v8::Value>(); END } @@ -2211,7 +2209,6 @@ sub GenerateImplementation my $visibleInterfaceName = GetVisibleInterfaceName($interfaceName); my $className = "V8$interfaceName"; my $implClassName = $interfaceName; - my $hasLegacyParent = $dataNode->extendedAttributes->{"LegacyParent"}; # - Add default header template push(@implFixedHeader, GenerateImplementationContentHeader($dataNode)); @@ -3185,23 +3182,26 @@ sub GenerateFunctionCallString() $name = $function->signature->extendedAttributes->{"ImplementationFunction"}; } - my $functionString = "imp->${name}("; - if ($function->isStatic) { - $functionString = "${implClassName}::${name}("; - } - my $index = 0; my $hasScriptState = 0; + my @arguments; + my $functionName; + if ($function->isStatic) { + $functionName = "${implClassName}::${name}"; + } elsif ($function->signature->extendedAttributes->{"ImplementedBy"}) { + my $implementedBy = $function->signature->extendedAttributes->{"ImplementedBy"}; + AddToImplIncludes("${implementedBy}.h"); + unshift(@arguments, "imp"); + $functionName = "${implementedBy}::${name}"; + } else { + $functionName = "imp->${name}"; + } + 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") { + if ($callWith eq "ScriptState") { $result .= $indent . "EmptyScriptState state;\n"; $callWithArg = "&state"; $hasScriptState = 1; @@ -3211,8 +3211,7 @@ sub GenerateFunctionCallString() $result .= $indent . " return v8::Undefined();\n"; $callWithArg = "scriptContext"; } - $functionString .= ", " if $index; - $functionString .= $callWithArg; + push @arguments, $callWithArg; $index++; $numberOfParameters++ } @@ -3221,45 +3220,34 @@ sub GenerateFunctionCallString() if ($index eq $numberOfParameters) { last; } - $functionString .= ", " if $index; my $paramName = $parameter->name; my $paramType = $parameter->type; if ($parameter->type eq "NodeFilter" || $parameter->type eq "XPathNSResolver") { - $functionString .= "$paramName.get()"; + push @arguments, "$paramName.get()"; } elsif ($codeGenerator->IsSVGTypeNeedingTearOff($parameter->type) and not $implClassName =~ /List$/) { - $functionString .= "$paramName->propertyReference()"; + push @arguments, "$paramName->propertyReference()"; $result .= $indent . "if (!$paramName) {\n"; $result .= $indent . " V8Proxy::setDOMException(WebCore::TYPE_MISMATCH_ERR);\n"; $result .= $indent . " return v8::Handle<v8::Value>();\n"; $result .= $indent . "}\n"; } elsif ($parameter->type eq "SVGMatrix" and $implClassName eq "SVGTransformList") { - $functionString .= "$paramName.get()"; + push @arguments, "$paramName.get()"; } else { - $functionString .= $paramName; + push @arguments, $paramName; } $index++; } if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) { - $functionString .= ", " if $index; - $functionString .= "scriptArguments, callStack"; - $index += 2; - } - - if ($function->signature->extendedAttributes->{"NeedsUserGestureCheck"}) { - $functionString .= ", " if $index; - $functionString .= "ScriptController::processingUserGesture()"; - $index++; - AddToImplIncludes("ScriptController.h"); + push @arguments, "scriptArguments, callStack"; } if (@{$function->raisesExceptions}) { - $functionString .= ", " if $index; - $functionString .= "ec"; - $index++; + push @arguments, "ec"; } - $functionString .= ")"; + + my $functionString = "$functionName(" . join(", ", @arguments) . ")"; my $return = "result"; my $returnIsRef = IsRefPtrType($returnType); @@ -3429,6 +3417,7 @@ sub GetNativeTypeForCallbacks { my $type = shift; return "const String&" if $type eq "DOMString"; + return "SerializedScriptValue*" if $type eq "SerializedScriptValue"; # Callbacks use raw pointers, so pass isParameter = 1 return GetNativeType($type, 1); diff --git a/Source/WebCore/bindings/scripts/generate-bindings.pl b/Source/WebCore/bindings/scripts/generate-bindings.pl index 4a8a95584..cb51f2c6d 100755 --- a/Source/WebCore/bindings/scripts/generate-bindings.pl +++ b/Source/WebCore/bindings/scripts/generate-bindings.pl @@ -159,6 +159,18 @@ foreach my $idlFile (@supplementedIdlFiles) { } push(@{$targetDataNode->attributes}, $attribute); } + + foreach my $function (@{$dataNode->functions}) { + # Record that this attribute is implemented by $interfaceName. + $function->signature->extendedAttributes->{"ImplementedBy"} = $interfaceName; + + # Add interface-wide extended attributes to each attribute. + foreach my $extendedAttributeName (keys %{$dataNode->extendedAttributes}) { + next if ($extendedAttributeName eq "Supplemental"); + $function->signature->extendedAttributes->{$extendedAttributeName} = $dataNode->extendedAttributes->{$extendedAttributeName}; + } + push(@{$targetDataNode->functions}, $function); + } } } } diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestActiveDOMObject.cpp b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestActiveDOMObject.cpp new file mode 100644 index 000000000..6d7956501 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestActiveDOMObject.cpp @@ -0,0 +1,111 @@ +/* + * 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 "WebDOMTestActiveDOMObject.h" + +#include "KURL.h" +#include "Node.h" +#include "TestActiveDOMObject.h" +#include "WebDOMNode.h" +#include "WebDOMString.h" +#include "WebExceptionHandler.h" +#include "wtf/text/AtomicString.h" +#include <wtf/GetPtr.h> +#include <wtf/RefPtr.h> + +struct WebDOMTestActiveDOMObject::WebDOMTestActiveDOMObjectPrivate { + WebDOMTestActiveDOMObjectPrivate(WebCore::TestActiveDOMObject* object = 0) + : impl(object) + { + } + + RefPtr<WebCore::TestActiveDOMObject> impl; +}; + +WebDOMTestActiveDOMObject::WebDOMTestActiveDOMObject() + : WebDOMObject() + , m_impl(0) +{ +} + +WebDOMTestActiveDOMObject::WebDOMTestActiveDOMObject(WebCore::TestActiveDOMObject* impl) + : WebDOMObject() + , m_impl(new WebDOMTestActiveDOMObjectPrivate(impl)) +{ +} + +WebDOMTestActiveDOMObject::WebDOMTestActiveDOMObject(const WebDOMTestActiveDOMObject& copy) + : WebDOMObject() +{ + m_impl = copy.impl() ? new WebDOMTestActiveDOMObjectPrivate(copy.impl()) : 0; +} + +WebDOMTestActiveDOMObject& WebDOMTestActiveDOMObject::operator=(const WebDOMTestActiveDOMObject& copy) +{ + delete m_impl; + m_impl = copy.impl() ? new WebDOMTestActiveDOMObjectPrivate(copy.impl()) : 0; + return *this; +} + +WebCore::TestActiveDOMObject* WebDOMTestActiveDOMObject::impl() const +{ + return m_impl ? WTF::getPtr(m_impl->impl) : 0; +} + +WebDOMTestActiveDOMObject::~WebDOMTestActiveDOMObject() +{ + delete m_impl; + m_impl = 0; +} + +int WebDOMTestActiveDOMObject::excitingAttr() const +{ + if (!impl()) + return 0; + + return impl()->excitingAttr(); +} + +void WebDOMTestActiveDOMObject::excitingFunction(const WebDOMNode& nextChild) +{ + if (!impl()) + return; + + impl()->excitingFunction(toWebCore(nextChild)); +} + +void WebDOMTestActiveDOMObject::postMessage(const WebDOMString& message) +{ + if (!impl()) + return; + + impl()->postMessage(message); +} + +WebCore::TestActiveDOMObject* toWebCore(const WebDOMTestActiveDOMObject& wrapper) +{ + return wrapper.impl(); +} + +WebDOMTestActiveDOMObject toWebKit(WebCore::TestActiveDOMObject* value) +{ + return WebDOMTestActiveDOMObject(value); +} diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestActiveDOMObject.h b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestActiveDOMObject.h new file mode 100644 index 000000000..66d14df09 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestActiveDOMObject.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) Research In Motion Limited 2010. 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> + * 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 WebDOMTestActiveDOMObject_h +#define WebDOMTestActiveDOMObject_h + +#include <WebDOMObject.h> +#include <WebDOMString.h> + +namespace WebCore { +class TestActiveDOMObject; +}; + +class WebDOMNode; + +class WebDOMTestActiveDOMObject : public WebDOMObject { +public: + WebDOMTestActiveDOMObject(); + explicit WebDOMTestActiveDOMObject(WebCore::TestActiveDOMObject*); + WebDOMTestActiveDOMObject(const WebDOMTestActiveDOMObject&); + WebDOMTestActiveDOMObject& operator=(const WebDOMTestActiveDOMObject&); + virtual ~WebDOMTestActiveDOMObject(); + + int excitingAttr() const; + + void excitingFunction(const WebDOMNode& nextChild); + void postMessage(const WebDOMString& message); + + WebCore::TestActiveDOMObject* impl() const; + +protected: + struct WebDOMTestActiveDOMObjectPrivate; + WebDOMTestActiveDOMObjectPrivate* m_impl; +}; + +WebCore::TestActiveDOMObject* toWebCore(const WebDOMTestActiveDOMObject&); +WebDOMTestActiveDOMObject toWebKit(WebCore::TestActiveDOMObject*); + +#endif diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp index 483b2575a..a082c4ad3 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp @@ -76,7 +76,7 @@ WebDOMTestCallback& WebDOMTestCallback::operator=(const WebDOMTestCallback& copy WebCore::TestCallback* WebDOMTestCallback::impl() const { - return m_impl ? m_impl->impl.get() : 0; + return m_impl ? WTF::getPtr(m_impl->impl) : 0; } WebDOMTestCallback::~WebDOMTestCallback() diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestEventConstructor.cpp b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestEventConstructor.cpp index 7a0b04e38..51aca880c 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestEventConstructor.cpp +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestEventConstructor.cpp @@ -65,7 +65,7 @@ WebDOMTestEventConstructor& WebDOMTestEventConstructor::operator=(const WebDOMTe WebCore::TestEventConstructor* WebDOMTestEventConstructor::impl() const { - return m_impl ? m_impl->impl.get() : 0; + return m_impl ? WTF::getPtr(m_impl->impl) : 0; } WebDOMTestEventConstructor::~WebDOMTestEventConstructor() diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestEventTarget.cpp b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestEventTarget.cpp new file mode 100644 index 000000000..beccea107 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestEventTarget.cpp @@ -0,0 +1,95 @@ +/* + * 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 "WebDOMTestEventTarget.h" + +#include "Event.h" +#include "KURL.h" +#include "Node.h" +#include "TestEventTarget.h" +#include "WebDOMEvent.h" +#include "WebDOMNode.h" +#include "WebDOMString.h" +#include "WebExceptionHandler.h" +#include "WebNativeEventListener.h" +#include "wtf/text/AtomicString.h" +#include <wtf/GetPtr.h> +#include <wtf/RefPtr.h> + +WebDOMTestEventTarget::WebDOMTestEventTarget() + : WebDOMEventTarget() +{ +} + +WebDOMTestEventTarget::WebDOMTestEventTarget(WebCore::TestEventTarget* impl) + : WebDOMEventTarget(impl) +{ +} + +WebCore::TestEventTarget* WebDOMTestEventTarget::impl() const +{ + return static_cast<WebCore::TestEventTarget*>(WebDOMEventTarget::impl()); +} + +WebDOMNode WebDOMTestEventTarget::item(unsigned index) +{ + if (!impl()) + return WebDOMNode(); + + return toWebKit(WTF::getPtr(impl()->item(index))); +} + +void WebDOMTestEventTarget::addEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture) +{ + if (!impl()) + return; + + impl()->addEventListener(type, toWebCore(listener), useCapture); +} + +void WebDOMTestEventTarget::removeEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture) +{ + if (!impl()) + return; + + impl()->removeEventListener(type, toWebCore(listener), useCapture); +} + +bool WebDOMTestEventTarget::dispatchEvent(const WebDOMEvent& evt) +{ + if (!impl()) + return false; + + WebCore::ExceptionCode ec = 0; + bool result = impl()->dispatchEvent(toWebCore(evt), ec); + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); + return result; +} + +WebCore::TestEventTarget* toWebCore(const WebDOMTestEventTarget& wrapper) +{ + return wrapper.impl(); +} + +WebDOMTestEventTarget toWebKit(WebCore::TestEventTarget* value) +{ + return WebDOMTestEventTarget(value); +} diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestEventTarget.h b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestEventTarget.h new file mode 100644 index 000000000..37a52dddd --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestEventTarget.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) Research In Motion Limited 2010. 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> + * 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 WebDOMTestEventTarget_h +#define WebDOMTestEventTarget_h + +#include <WebDOMEventTarget.h> +#include <WebDOMString.h> + +namespace WebCore { +class TestEventTarget; +}; + +class WebDOMEvent; +class WebDOMEventListener; +class WebDOMNode; + +class WebDOMTestEventTarget : public WebDOMEventTarget { +public: + WebDOMTestEventTarget(); + explicit WebDOMTestEventTarget(WebCore::TestEventTarget*); + virtual ~WebDOMTestEventTarget() { } + + WebDOMNode item(unsigned index); + void addEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture); + void removeEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture); + bool dispatchEvent(const WebDOMEvent& evt); + + WebCore::TestEventTarget* impl() const; +}; + +WebCore::TestEventTarget* toWebCore(const WebDOMTestEventTarget&); +WebDOMTestEventTarget toWebKit(WebCore::TestEventTarget*); + +#endif diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp index f114f9048..7d08ba1fd 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp @@ -26,8 +26,10 @@ #include "KURL.h" #include "TestInterface.h" +#include "TestObj.h" #include "TestSupplemental.h" #include "WebDOMString.h" +#include "WebDOMTestObj.h" #include "WebExceptionHandler.h" #include "wtf/text/AtomicString.h" #include <wtf/GetPtr.h> @@ -69,7 +71,7 @@ WebDOMTestInterface& WebDOMTestInterface::operator=(const WebDOMTestInterface& c WebCore::TestInterface* WebDOMTestInterface::impl() const { - return m_impl ? m_impl->impl.get() : 0; + return m_impl ? WTF::getPtr(m_impl->impl) : 0; } WebDOMTestInterface::~WebDOMTestInterface() @@ -79,33 +81,60 @@ WebDOMTestInterface::~WebDOMTestInterface() } #if ENABLE(Condition11) || ENABLE(Condition12) -WebDOMString WebDOMTestInterface::str1() const +WebDOMString WebDOMTestInterface::supplementalStr1() const { if (!impl()) return WebDOMString(); - return static_cast<const WTF::String&>(TestSupplemental::str1(impl())); + return static_cast<const WTF::String&>(TestSupplemental::supplementalStr1(impl())); } #endif #if ENABLE(Condition11) || ENABLE(Condition12) -WebDOMString WebDOMTestInterface::str2() const +WebDOMString WebDOMTestInterface::supplementalStr2() const { if (!impl()) return WebDOMString(); - return static_cast<const WTF::String&>(TestSupplemental::str2(impl())); + return static_cast<const WTF::String&>(TestSupplemental::supplementalStr2(impl())); } -void WebDOMTestInterface::setStr2(const WebDOMString& newStr2) +void WebDOMTestInterface::setSupplementalStr2(const WebDOMString& newSupplementalStr2) { if (!impl()) return; - TestSupplemental::setStr2(impl(), newStr2); + TestSupplemental::setSupplementalStr2(impl(), newSupplementalStr2); } #endif + +#if ENABLE(Condition11) || ENABLE(Condition12) +void WebDOMTestInterface::supplementalMethod1() +{ + if (!impl()) + return; + + TestSupplemental::supplementalMethod1(impl()); +} + +#endif + + +#if ENABLE(Condition11) || ENABLE(Condition12) +WebDOMTestObj WebDOMTestInterface::supplementalMethod2(const WebDOMString& strArg, const WebDOMTestObj& objArg) +{ + if (!impl()) + return WebDOMTestObj(); + + WebCore::ExceptionCode ec = 0; + WebDOMTestObj result = toWebKit(WTF::getPtr(TestSupplemental::supplementalMethod2(impl(), strArg, toWebCore(objArg), ec))); + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); + return result; +} + +#endif + WebCore::TestInterface* toWebCore(const WebDOMTestInterface& wrapper) { return wrapper.impl(); diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h index 5aa03c795..3d48186e2 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h @@ -32,6 +32,7 @@ namespace WebCore { class TestInterface; }; +class WebDOMTestObj; class WebDOMTestInterface : public WebDOMObject { public: @@ -42,13 +43,16 @@ public: virtual ~WebDOMTestInterface(); #if ENABLE(Condition11) || ENABLE(Condition12) - WebDOMString str1() const; + WebDOMString supplementalStr1() const; #endif #if ENABLE(Condition11) || ENABLE(Condition12) - WebDOMString str2() const; - void setStr2(const WebDOMString&); + WebDOMString supplementalStr2() const; + void setSupplementalStr2(const WebDOMString&); #endif + void supplementalMethod1(); + WebDOMTestObj supplementalMethod2(const WebDOMString& strArg, const WebDOMTestObj& objArg); + WebCore::TestInterface* impl() const; protected: diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestMediaQueryListListener.cpp b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestMediaQueryListListener.cpp index 7543fc4ab..392911d6e 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestMediaQueryListListener.cpp +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestMediaQueryListListener.cpp @@ -64,7 +64,7 @@ WebDOMTestMediaQueryListListener& WebDOMTestMediaQueryListListener::operator=(co WebCore::TestMediaQueryListListener* WebDOMTestMediaQueryListListener::impl() const { - return m_impl ? m_impl->impl.get() : 0; + return m_impl ? WTF::getPtr(m_impl->impl) : 0; } WebDOMTestMediaQueryListListener::~WebDOMTestMediaQueryListListener() diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestNamedConstructor.cpp b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestNamedConstructor.cpp index f0c3777bf..e0c365b51 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestNamedConstructor.cpp +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestNamedConstructor.cpp @@ -62,7 +62,7 @@ WebDOMTestNamedConstructor& WebDOMTestNamedConstructor::operator=(const WebDOMTe WebCore::TestNamedConstructor* WebDOMTestNamedConstructor::impl() const { - return m_impl ? m_impl->impl.get() : 0; + return m_impl ? WTF::getPtr(m_impl->impl) : 0; } WebDOMTestNamedConstructor::~WebDOMTestNamedConstructor() diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp index 5ce103067..9dac2da8a 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp @@ -21,17 +21,33 @@ #include "config.h" #include "WebDOMTestObj.h" +#include "Document.h" #include "HTMLNames.h" #include "IDBKey.h" #include "KURL.h" #include "OptionsObject.h" +#include "SVGPoint.h" #include "SerializedScriptValue.h" #include "TestObj.h" +#include "WebDOMDocument.h" #include "WebDOMIDBKey.h" #include "WebDOMOptionsObject.h" +#include "WebDOMSVGPoint.h" #include "WebDOMString.h" +#include "WebDOMa.h" +#include "WebDOMb.h" +#include "WebDOMbool.h" +#include "WebDOMc.h" +#include "WebDOMd.h" +#include "WebDOMe.h" #include "WebExceptionHandler.h" #include "WebNativeEventListener.h" +#include "a.h" +#include "b.h" +#include "bool.h" +#include "c.h" +#include "d.h" +#include "e.h" #include "wtf/text/AtomicString.h" #include <wtf/GetPtr.h> #include <wtf/RefPtr.h> @@ -72,7 +88,7 @@ WebDOMTestObj& WebDOMTestObj::operator=(const WebDOMTestObj& copy) WebCore::TestObj* WebDOMTestObj::impl() const { - return m_impl ? m_impl->impl.get() : 0; + return m_impl ? WTF::getPtr(m_impl->impl) : 0; } WebDOMTestObj::~WebDOMTestObj() @@ -619,6 +635,62 @@ void WebDOMTestObj::setConditionalAttr6(const WebDOMTestObjectCConstructor& newC } #endif +WebDOMDocument WebDOMTestObj::contentDocument() const +{ + if (!impl()) + return WebDOMDocument(); + + return toWebKit(WTF::getPtr(impl()->contentDocument())); +} + +WebDOMSVGPoint WebDOMTestObj::mutablePoint() const +{ + if (!impl()) + return WebDOMSVGPoint(); + + return toWebKit(WTF::getPtr(impl()->mutablePoint())); +} + +void WebDOMTestObj::setMutablePoint(const WebDOMSVGPoint& newMutablePoint) +{ + if (!impl()) + return; + + impl()->setMutablePoint(toWebCore(newMutablePoint)); +} + +WebDOMSVGPoint WebDOMTestObj::immutablePoint() const +{ + if (!impl()) + return WebDOMSVGPoint(); + + return toWebKit(WTF::getPtr(impl()->immutablePoint())); +} + +void WebDOMTestObj::setImmutablePoint(const WebDOMSVGPoint& newImmutablePoint) +{ + if (!impl()) + return; + + impl()->setImmutablePoint(toWebCore(newImmutablePoint)); +} + +float WebDOMTestObj::strictFloat() const +{ + if (!impl()) + return 0; + + return impl()->strictFloat(); +} + +void WebDOMTestObj::setStrictFloat(float newStrictFloat) +{ + if (!impl()) + return; + + impl()->setStrictFloat(newStrictFloat); +} + int WebDOMTestObj::description() const { if (!impl()) @@ -760,30 +832,6 @@ void WebDOMTestObj::removeEventListener(const WebDOMString& type, const WebDOMEv impl()->removeEventListener(type, toWebCore(listener), useCapture); } -void WebDOMTestObj::withDynamicFrame() -{ - if (!impl()) - return; - - impl()->withDynamicFrame(); -} - -void WebDOMTestObj::withDynamicFrameAndArg(int intArg) -{ - if (!impl()) - return; - - impl()->withDynamicFrameAndArg(intArg); -} - -void WebDOMTestObj::withDynamicFrameAndOptionalArg(int intArg, int optionalArg) -{ - if (!impl()) - return; - - impl()->withDynamicFrameAndOptionalArg(intArg, optionalArg); -} - void WebDOMTestObj::withScriptStateVoid() { if (!impl()) @@ -929,6 +977,81 @@ void WebDOMTestObj::overloadedMethod1(const WebDOMString& type) #endif +void WebDOMTestObj::convert1(const WebDOMa& ) +{ + if (!impl()) + return; + + impl()->convert1(toWebCore()); +} + +void WebDOMTestObj::convert2(const WebDOMb& ) +{ + if (!impl()) + return; + + impl()->convert2(toWebCore()); +} + +void WebDOMTestObj::convert3(const WebDOMc& ) +{ + if (!impl()) + return; + + impl()->convert3(toWebCore()); +} + +void WebDOMTestObj::convert4(const WebDOMd& ) +{ + if (!impl()) + return; + + impl()->convert4(toWebCore()); +} + +void WebDOMTestObj::convert5(const WebDOMe& ) +{ + if (!impl()) + return; + + impl()->convert5(toWebCore()); +} + +WebDOMSVGPoint WebDOMTestObj::mutablePointFunction() +{ + if (!impl()) + return WebDOMSVGPoint(); + + return toWebKit(WTF::getPtr(impl()->mutablePointFunction())); +} + +WebDOMSVGPoint WebDOMTestObj::immutablePointFunction() +{ + if (!impl()) + return WebDOMSVGPoint(); + + return toWebKit(WTF::getPtr(impl()->immutablePointFunction())); +} + +void WebDOMTestObj::orange() +{ + if (!impl()) + return; + + impl()->orange(); +} + +WebDOMbool WebDOMTestObj::strictFunction(const WebDOMString& str, float a, int b) +{ + if (!impl()) + return WebDOMbool(); + + WebCore::ExceptionCode ec = 0; + WebDOMbool result = toWebKit(WTF::getPtr(impl()->strictFunction(str, a, b, ec))); + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); + return result; +} + WebCore::TestObj* toWebCore(const WebDOMTestObj& wrapper) { return wrapper.impl(); diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h index b1a9278b2..e9b03bc3a 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h @@ -30,14 +30,22 @@ namespace WebCore { class TestObj; }; +class WebDOMDocument; class WebDOMEventListener; class WebDOMIDBKey; class WebDOMOptionsObject; +class WebDOMSVGPoint; class WebDOMString; class WebDOMTestObj; class WebDOMTestObjectAConstructor; class WebDOMTestObjectBConstructor; class WebDOMTestObjectCConstructor; +class WebDOMa; +class WebDOMb; +class WebDOMbool; +class WebDOMc; +class WebDOMd; +class WebDOMe; class WebDOMTestObj : public WebDOMObject { public: @@ -143,6 +151,13 @@ public: WebDOMTestObjectCConstructor conditionalAttr6() const; void setConditionalAttr6(const WebDOMTestObjectCConstructor&); #endif + WebDOMDocument contentDocument() const; + WebDOMSVGPoint mutablePoint() const; + void setMutablePoint(const WebDOMSVGPoint&); + WebDOMSVGPoint immutablePoint() const; + void setImmutablePoint(const WebDOMSVGPoint&); + float strictFloat() const; + void setStrictFloat(float); int description() const; int id() const; void setId(int); @@ -163,11 +178,6 @@ public: void customMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg); void addEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture); void removeEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture); - void withDynamicFrame(); - void withDynamicFrameAndArg(int intArg); - void withDynamicFrameAndOptionalArg(int intArg, int optionalArg); - void withDynamicFrameAndUserGesture(int intArg); - void withDynamicFrameAndUserGestureASAD(int intArg, int optionalArg); void withScriptStateVoid(); WebDOMTestObj withScriptStateObj(); void withScriptStateVoidException(); @@ -183,6 +193,15 @@ public: int classMethodWithOptional(int arg); void overloadedMethod1(int arg); void overloadedMethod1(const WebDOMString& type); + void convert1(const WebDOMa& ); + void convert2(const WebDOMb& ); + void convert3(const WebDOMc& ); + void convert4(const WebDOMd& ); + void convert5(const WebDOMe& ); + WebDOMSVGPoint mutablePointFunction(); + WebDOMSVGPoint immutablePointFunction(); + void orange(); + WebDOMbool strictFunction(const WebDOMString& str, float a, int b); WebCore::TestObj* impl() const; diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestOverridingNameGetter.cpp b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestOverridingNameGetter.cpp new file mode 100644 index 000000000..4410331c7 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestOverridingNameGetter.cpp @@ -0,0 +1,93 @@ +/* + * 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 "WebDOMTestOverridingNameGetter.h" + +#include "KURL.h" +#include "TestOverridingNameGetter.h" +#include "WebDOMString.h" +#include "WebExceptionHandler.h" +#include "wtf/text/AtomicString.h" +#include <wtf/GetPtr.h> +#include <wtf/RefPtr.h> + +struct WebDOMTestOverridingNameGetter::WebDOMTestOverridingNameGetterPrivate { + WebDOMTestOverridingNameGetterPrivate(WebCore::TestOverridingNameGetter* object = 0) + : impl(object) + { + } + + RefPtr<WebCore::TestOverridingNameGetter> impl; +}; + +WebDOMTestOverridingNameGetter::WebDOMTestOverridingNameGetter() + : WebDOMObject() + , m_impl(0) +{ +} + +WebDOMTestOverridingNameGetter::WebDOMTestOverridingNameGetter(WebCore::TestOverridingNameGetter* impl) + : WebDOMObject() + , m_impl(new WebDOMTestOverridingNameGetterPrivate(impl)) +{ +} + +WebDOMTestOverridingNameGetter::WebDOMTestOverridingNameGetter(const WebDOMTestOverridingNameGetter& copy) + : WebDOMObject() +{ + m_impl = copy.impl() ? new WebDOMTestOverridingNameGetterPrivate(copy.impl()) : 0; +} + +WebDOMTestOverridingNameGetter& WebDOMTestOverridingNameGetter::operator=(const WebDOMTestOverridingNameGetter& copy) +{ + delete m_impl; + m_impl = copy.impl() ? new WebDOMTestOverridingNameGetterPrivate(copy.impl()) : 0; + return *this; +} + +WebCore::TestOverridingNameGetter* WebDOMTestOverridingNameGetter::impl() const +{ + return m_impl ? WTF::getPtr(m_impl->impl) : 0; +} + +WebDOMTestOverridingNameGetter::~WebDOMTestOverridingNameGetter() +{ + delete m_impl; + m_impl = 0; +} + +void WebDOMTestOverridingNameGetter::anotherFunction(const WebDOMString& str) +{ + if (!impl()) + return; + + impl()->anotherFunction(str); +} + +WebCore::TestOverridingNameGetter* toWebCore(const WebDOMTestOverridingNameGetter& wrapper) +{ + return wrapper.impl(); +} + +WebDOMTestOverridingNameGetter toWebKit(WebCore::TestOverridingNameGetter* value) +{ + return WebDOMTestOverridingNameGetter(value); +} diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestOverridingNameGetter.h b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestOverridingNameGetter.h new file mode 100644 index 000000000..a6c681ef7 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestOverridingNameGetter.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) Research In Motion Limited 2010. 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> + * 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 WebDOMTestOverridingNameGetter_h +#define WebDOMTestOverridingNameGetter_h + +#include <WebDOMObject.h> +#include <WebDOMString.h> + +namespace WebCore { +class TestOverridingNameGetter; +}; + + +class WebDOMTestOverridingNameGetter : public WebDOMObject { +public: + WebDOMTestOverridingNameGetter(); + explicit WebDOMTestOverridingNameGetter(WebCore::TestOverridingNameGetter*); + WebDOMTestOverridingNameGetter(const WebDOMTestOverridingNameGetter&); + WebDOMTestOverridingNameGetter& operator=(const WebDOMTestOverridingNameGetter&); + virtual ~WebDOMTestOverridingNameGetter(); + + void anotherFunction(const WebDOMString& str); + + WebCore::TestOverridingNameGetter* impl() const; + +protected: + struct WebDOMTestOverridingNameGetterPrivate; + WebDOMTestOverridingNameGetterPrivate* m_impl; +}; + +WebCore::TestOverridingNameGetter* toWebCore(const WebDOMTestOverridingNameGetter&); +WebDOMTestOverridingNameGetter toWebKit(WebCore::TestOverridingNameGetter*); + +#endif diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.cpp b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.cpp index e16af2d97..edae8ad3c 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.cpp @@ -66,7 +66,7 @@ WebDOMTestSerializedScriptValueInterface& WebDOMTestSerializedScriptValueInterfa WebCore::TestSerializedScriptValueInterface* WebDOMTestSerializedScriptValueInterface::impl() const { - return m_impl ? m_impl->impl.get() : 0; + return m_impl ? WTF::getPtr(m_impl->impl) : 0; } WebDOMTestSerializedScriptValueInterface::~WebDOMTestSerializedScriptValueInterface() diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestActiveDOMObject.cpp b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestActiveDOMObject.cpp new file mode 100644 index 000000000..c93a92cd9 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestActiveDOMObject.cpp @@ -0,0 +1,203 @@ +/* + 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 "DOMObjectCache.h" +#include "ExceptionCode.h" +#include "JSMainThreadExecState.h" +#include "TestActiveDOMObject.h" +#include "WebKitDOMBinding.h" +#include "gobject/ConvertToUTF8String.h" +#include "webkit/WebKitDOMNode.h" +#include "webkit/WebKitDOMNodePrivate.h" +#include "webkit/WebKitDOMTestActiveDOMObject.h" +#include "webkit/WebKitDOMTestActiveDOMObjectPrivate.h" +#include "webkitdefines.h" +#include "webkitglobalsprivate.h" +#include "webkitmarshal.h" + +namespace WebKit { + +WebKitDOMTestActiveDOMObject* kit(WebCore::TestActiveDOMObject* obj) +{ + g_return_val_if_fail(obj, 0); + + if (gpointer ret = DOMObjectCache::get(obj)) + return static_cast<WebKitDOMTestActiveDOMObject*>(ret); + + return static_cast<WebKitDOMTestActiveDOMObject*>(DOMObjectCache::put(obj, WebKit::wrapTestActiveDOMObject(obj))); +} + +} // namespace WebKit // + +void +webkit_dom_test_active_dom_object_exciting_function(WebKitDOMTestActiveDOMObject* self, WebKitDOMNode* next_child) +{ + g_return_if_fail(self); + WebCore::JSMainThreadNullState state; + WebCore::TestActiveDOMObject * item = WebKit::core(self); + g_return_if_fail(next_child); + WebCore::Node * converted_next_child = NULL; + if (next_child != NULL) { + converted_next_child = WebKit::core(next_child); + g_return_if_fail(converted_next_child); + } + item->excitingFunction(converted_next_child); +} + +void +webkit_dom_test_active_dom_object_post_message(WebKitDOMTestActiveDOMObject* self, const gchar* message) +{ + g_return_if_fail(self); + WebCore::JSMainThreadNullState state; + WebCore::TestActiveDOMObject * item = WebKit::core(self); + g_return_if_fail(message); + WTF::String converted_message = WTF::String::fromUTF8(message); + item->postMessage(converted_message); +} + +glong +webkit_dom_test_active_dom_object_get_exciting_attr(WebKitDOMTestActiveDOMObject* self) +{ + g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; + WebCore::TestActiveDOMObject * item = WebKit::core(self); + glong res = item->excitingAttr(); + return res; +} + + +G_DEFINE_TYPE(WebKitDOMTestActiveDOMObject, webkit_dom_test_active_dom_object, WEBKIT_TYPE_DOM_OBJECT) + +namespace WebKit { + +WebCore::TestActiveDOMObject* core(WebKitDOMTestActiveDOMObject* request) +{ + g_return_val_if_fail(request, 0); + + WebCore::TestActiveDOMObject* coreObject = static_cast<WebCore::TestActiveDOMObject*>(WEBKIT_DOM_OBJECT(request)->coreObject); + g_return_val_if_fail(coreObject, 0); + + return coreObject; +} + +} // namespace WebKit +enum { + PROP_0, + PROP_EXCITING_ATTR, +}; + + +static void webkit_dom_test_active_dom_object_finalize(GObject* object) +{ + WebKitDOMObject* dom_object = WEBKIT_DOM_OBJECT(object); + + if (dom_object->coreObject) { + WebCore::TestActiveDOMObject* coreObject = static_cast<WebCore::TestActiveDOMObject *>(dom_object->coreObject); + + WebKit::DOMObjectCache::forget(coreObject); + coreObject->deref(); + + dom_object->coreObject = NULL; + } + + G_OBJECT_CLASS(webkit_dom_test_active_dom_object_parent_class)->finalize(object); +} + +static void webkit_dom_test_active_dom_object_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec) +{ + WebCore::JSMainThreadNullState state; + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } +} + + +static void webkit_dom_test_active_dom_object_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) +{ + WebCore::JSMainThreadNullState state; + WebKitDOMTestActiveDOMObject* self = WEBKIT_DOM_TEST_ACTIVE_DOM_OBJECT(object); + WebCore::TestActiveDOMObject* coreSelf = WebKit::core(self); + switch (prop_id) { + case PROP_EXCITING_ATTR: + { + g_value_set_long(value, coreSelf->excitingAttr()); + break; + } + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } +} + + +static void webkit_dom_test_active_dom_object_constructed(GObject* object) +{ + + if (G_OBJECT_CLASS(webkit_dom_test_active_dom_object_parent_class)->constructed) + G_OBJECT_CLASS(webkit_dom_test_active_dom_object_parent_class)->constructed(object); +} + +static void webkit_dom_test_active_dom_object_class_init(WebKitDOMTestActiveDOMObjectClass* requestClass) +{ + GObjectClass *gobjectClass = G_OBJECT_CLASS(requestClass); + gobjectClass->finalize = webkit_dom_test_active_dom_object_finalize; + gobjectClass->set_property = webkit_dom_test_active_dom_object_set_property; + gobjectClass->get_property = webkit_dom_test_active_dom_object_get_property; + gobjectClass->constructed = webkit_dom_test_active_dom_object_constructed; + + g_object_class_install_property(gobjectClass, + PROP_EXCITING_ATTR, + g_param_spec_long("exciting-attr", /* name */ + "test_active_dom_object_exciting-attr", /* short description */ + "read-only glong TestActiveDOMObject.exciting-attr", /* longer - could do with some extra doc stuff here */ + G_MINLONG, /* min */ +G_MAXLONG, /* max */ +0, /* default */ + WEBKIT_PARAM_READABLE)); + + +} + +static void webkit_dom_test_active_dom_object_init(WebKitDOMTestActiveDOMObject* request) +{ +} + +namespace WebKit { +WebKitDOMTestActiveDOMObject* wrapTestActiveDOMObject(WebCore::TestActiveDOMObject* coreObject) +{ + g_return_val_if_fail(coreObject, 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(); + + return WEBKIT_DOM_TEST_ACTIVE_DOM_OBJECT(g_object_new(WEBKIT_TYPE_DOM_TEST_ACTIVE_DOM_OBJECT, + "core-object", coreObject, NULL)); +} +} // namespace WebKit diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestActiveDOMObject.h b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestActiveDOMObject.h new file mode 100644 index 000000000..f3cfdb3a9 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestActiveDOMObject.h @@ -0,0 +1,83 @@ +/* + 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 WebKitDOMTestActiveDOMObject_h +#define WebKitDOMTestActiveDOMObject_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_ACTIVE_DOM_OBJECT (webkit_dom_test_active_dom_object_get_type()) +#define WEBKIT_DOM_TEST_ACTIVE_DOM_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_DOM_TEST_ACTIVE_DOM_OBJECT, WebKitDOMTestActiveDOMObject)) +#define WEBKIT_DOM_TEST_ACTIVE_DOM_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_DOM_TEST_ACTIVE_DOM_OBJECT, WebKitDOMTestActiveDOMObjectClass) +#define WEBKIT_DOM_IS_TEST_ACTIVE_DOM_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_DOM_TEST_ACTIVE_DOM_OBJECT)) +#define WEBKIT_DOM_IS_TEST_ACTIVE_DOM_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_DOM_TEST_ACTIVE_DOM_OBJECT)) +#define WEBKIT_DOM_TEST_ACTIVE_DOM_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_DOM_TEST_ACTIVE_DOM_OBJECT, WebKitDOMTestActiveDOMObjectClass)) + +struct _WebKitDOMTestActiveDOMObject { + WebKitDOMObject parent_instance; +}; + +struct _WebKitDOMTestActiveDOMObjectClass { + WebKitDOMObjectClass parent_class; +}; + +WEBKIT_API GType +webkit_dom_test_active_dom_object_get_type (void); + +/** + * webkit_dom_test_active_dom_object_exciting_function: + * @self: A #WebKitDOMTestActiveDOMObject + * @next_child: A #WebKitDOMNode + * + * Returns: + * +**/ +WEBKIT_API void +webkit_dom_test_active_dom_object_exciting_function(WebKitDOMTestActiveDOMObject* self, WebKitDOMNode* next_child); + +/** + * webkit_dom_test_active_dom_object_post_message: + * @self: A #WebKitDOMTestActiveDOMObject + * @message: A #gchar + * + * Returns: + * +**/ +WEBKIT_API void +webkit_dom_test_active_dom_object_post_message(WebKitDOMTestActiveDOMObject* self, const gchar* message); + +/** + * webkit_dom_test_active_dom_object_get_exciting_attr: + * @self: A #WebKitDOMTestActiveDOMObject + * + * Returns: + * +**/ +WEBKIT_API glong +webkit_dom_test_active_dom_object_get_exciting_attr(WebKitDOMTestActiveDOMObject* self); + +G_END_DECLS + +#endif /* WebKitDOMTestActiveDOMObject_h */ diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestActiveDOMObjectPrivate.h b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestActiveDOMObjectPrivate.h new file mode 100644 index 000000000..f28c7f9d1 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestActiveDOMObjectPrivate.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_ACTIVE_DOM_OBJECT_PRIVATE_H +#define WEB_KIT_DOM_TEST_ACTIVE_DOM_OBJECT_PRIVATE_H + +#include <glib-object.h> +#include <webkit/WebKitDOMObject.h> +#include "TestActiveDOMObject.h" +namespace WebKit { + WebKitDOMTestActiveDOMObject * + wrapTestActiveDOMObject(WebCore::TestActiveDOMObject *coreObject); + + WebCore::TestActiveDOMObject * + core(WebKitDOMTestActiveDOMObject *request); + + WebKitDOMTestActiveDOMObject* + kit(WebCore::TestActiveDOMObject* node); + +} // namespace WebKit + +#endif /* WEB_KIT_DOM_TEST_ACTIVE_DOM_OBJECT_PRIVATE_H */ diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestEventTarget.cpp b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestEventTarget.cpp new file mode 100644 index 000000000..c6ad86e43 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestEventTarget.cpp @@ -0,0 +1,220 @@ +/* + 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 "DOMObjectCache.h" +#include "ExceptionCode.h" +#include "GObjectEventListener.h" +#include "JSMainThreadExecState.h" +#include "Node.h" +#include "TestEventTarget.h" +#include "WebKitDOMBinding.h" +#include "WebKitDOMEventPrivate.h" +#include "WebKitDOMEventTarget.h" +#include "gobject/ConvertToUTF8String.h" +#include "webkit/WebKitDOMEvent.h" +#include "webkit/WebKitDOMEventPrivate.h" +#include "webkit/WebKitDOMNode.h" +#include "webkit/WebKitDOMNodePrivate.h" +#include "webkit/WebKitDOMTestEventTarget.h" +#include "webkit/WebKitDOMTestEventTargetPrivate.h" +#include "webkitdefines.h" +#include "webkitglobalsprivate.h" +#include "webkitmarshal.h" + +namespace WebKit { + +WebKitDOMTestEventTarget* kit(WebCore::TestEventTarget* obj) +{ + g_return_val_if_fail(obj, 0); + + if (gpointer ret = DOMObjectCache::get(obj)) + return static_cast<WebKitDOMTestEventTarget*>(ret); + + return static_cast<WebKitDOMTestEventTarget*>(DOMObjectCache::put(obj, WebKit::wrapTestEventTarget(obj))); +} + +} // namespace WebKit // + +static void webkit_dom_test_event_target_dispatch_event(WebKitDOMEventTarget* target, WebKitDOMEvent* event, GError** error) +{ + WebCore::Event* coreEvent = WebKit::core(event); + WebCore::TestEventTarget* coreTarget = static_cast<WebCore::TestEventTarget*>(WEBKIT_DOM_OBJECT(target)->coreObject); + + WebCore::ExceptionCode ec = 0; + coreTarget->dispatchEvent(coreEvent, ec); + if (ec) { + WebCore::ExceptionCodeDescription description(ec); + g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), description.code, description.name); + } +} + +static gboolean webkit_dom_test_event_target_add_event_listener(WebKitDOMEventTarget* target, const char* eventName, GCallback handler, gboolean bubble, gpointer userData) +{ + WebCore::TestEventTarget* coreTarget = static_cast<WebCore::TestEventTarget*>(WEBKIT_DOM_OBJECT(target)->coreObject); + return WebCore::GObjectEventListener::addEventListener(G_OBJECT(target), coreTarget, eventName, handler, bubble, userData); +} + +static gboolean webkit_dom_test_event_target_remove_event_listener(WebKitDOMEventTarget* target, const char* eventName, GCallback handler, gboolean bubble) +{ + WebCore::TestEventTarget* coreTarget = static_cast<WebCore::TestEventTarget*>(WEBKIT_DOM_OBJECT(target)->coreObject); + return WebCore::GObjectEventListener::removeEventListener(G_OBJECT(target), coreTarget, eventName, handler, bubble); +} + +static void webkit_dom_event_target_init(WebKitDOMEventTargetIface* iface) +{ + iface->dispatch_event = webkit_dom_test_event_target_dispatch_event; + iface->add_event_listener = webkit_dom_test_event_target_add_event_listener; + iface->remove_event_listener = webkit_dom_test_event_target_remove_event_listener; +} + +WebKitDOMNode* +webkit_dom_test_event_target_item(WebKitDOMTestEventTarget* self, gulong index) +{ + g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; + WebCore::TestEventTarget * item = WebKit::core(self); + PassRefPtr<WebCore::Node> g_res = WTF::getPtr(item->item(index)); + WebKitDOMNode* res = WebKit::kit(g_res.get()); + return res; +} + +gboolean +webkit_dom_test_event_target_dispatch_event(WebKitDOMTestEventTarget* self, WebKitDOMEvent* evt, GError **error) +{ + g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; + WebCore::TestEventTarget * item = WebKit::core(self); + g_return_val_if_fail(evt, 0); + WebCore::Event * converted_evt = NULL; + if (evt != NULL) { + converted_evt = WebKit::core(evt); + g_return_val_if_fail(converted_evt, 0); + } + WebCore::ExceptionCode ec = 0; + gboolean res = item->dispatchEvent(converted_evt, ec); + if (ec) { + WebCore::ExceptionCodeDescription ecdesc(ec); + g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); + } + return res; +} + + +G_DEFINE_TYPE_WITH_CODE(WebKitDOMTestEventTarget, webkit_dom_test_event_target, WEBKIT_TYPE_DOM_OBJECT, G_IMPLEMENT_INTERFACE(WEBKIT_TYPE_DOM_EVENT_TARGET, webkit_dom_event_target_init)) + +namespace WebKit { + +WebCore::TestEventTarget* core(WebKitDOMTestEventTarget* request) +{ + g_return_val_if_fail(request, 0); + + WebCore::TestEventTarget* coreObject = static_cast<WebCore::TestEventTarget*>(WEBKIT_DOM_OBJECT(request)->coreObject); + g_return_val_if_fail(coreObject, 0); + + return coreObject; +} + +} // namespace WebKit +enum { + PROP_0, +}; + + +static void webkit_dom_test_event_target_finalize(GObject* object) +{ + WebKitDOMObject* dom_object = WEBKIT_DOM_OBJECT(object); + + if (dom_object->coreObject) { + WebCore::TestEventTarget* coreObject = static_cast<WebCore::TestEventTarget *>(dom_object->coreObject); + + WebKit::DOMObjectCache::forget(coreObject); + coreObject->deref(); + + dom_object->coreObject = NULL; + } + + G_OBJECT_CLASS(webkit_dom_test_event_target_parent_class)->finalize(object); +} + +static void webkit_dom_test_event_target_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec) +{ + WebCore::JSMainThreadNullState state; + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } +} + + +static void webkit_dom_test_event_target_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) +{ + WebCore::JSMainThreadNullState state; + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } +} + + +static void webkit_dom_test_event_target_constructed(GObject* object) +{ + + if (G_OBJECT_CLASS(webkit_dom_test_event_target_parent_class)->constructed) + G_OBJECT_CLASS(webkit_dom_test_event_target_parent_class)->constructed(object); +} + +static void webkit_dom_test_event_target_class_init(WebKitDOMTestEventTargetClass* requestClass) +{ + GObjectClass *gobjectClass = G_OBJECT_CLASS(requestClass); + gobjectClass->finalize = webkit_dom_test_event_target_finalize; + gobjectClass->set_property = webkit_dom_test_event_target_set_property; + gobjectClass->get_property = webkit_dom_test_event_target_get_property; + gobjectClass->constructed = webkit_dom_test_event_target_constructed; + + + +} + +static void webkit_dom_test_event_target_init(WebKitDOMTestEventTarget* request) +{ +} + +namespace WebKit { +WebKitDOMTestEventTarget* wrapTestEventTarget(WebCore::TestEventTarget* coreObject) +{ + g_return_val_if_fail(coreObject, 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(); + + return WEBKIT_DOM_TEST_EVENT_TARGET(g_object_new(WEBKIT_TYPE_DOM_TEST_EVENT_TARGET, + "core-object", coreObject, NULL)); +} +} // namespace WebKit diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestEventTarget.h b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestEventTarget.h new file mode 100644 index 000000000..c10635b57 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestEventTarget.h @@ -0,0 +1,74 @@ +/* + 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 WebKitDOMTestEventTarget_h +#define WebKitDOMTestEventTarget_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_EVENT_TARGET (webkit_dom_test_event_target_get_type()) +#define WEBKIT_DOM_TEST_EVENT_TARGET(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_DOM_TEST_EVENT_TARGET, WebKitDOMTestEventTarget)) +#define WEBKIT_DOM_TEST_EVENT_TARGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_DOM_TEST_EVENT_TARGET, WebKitDOMTestEventTargetClass) +#define WEBKIT_DOM_IS_TEST_EVENT_TARGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_DOM_TEST_EVENT_TARGET)) +#define WEBKIT_DOM_IS_TEST_EVENT_TARGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_DOM_TEST_EVENT_TARGET)) +#define WEBKIT_DOM_TEST_EVENT_TARGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_DOM_TEST_EVENT_TARGET, WebKitDOMTestEventTargetClass)) + +struct _WebKitDOMTestEventTarget { + WebKitDOMObject parent_instance; +}; + +struct _WebKitDOMTestEventTargetClass { + WebKitDOMObjectClass parent_class; +}; + +WEBKIT_API GType +webkit_dom_test_event_target_get_type (void); + +/** + * webkit_dom_test_event_target_item: + * @self: A #WebKitDOMTestEventTarget + * @index: A #gulong + * + * Returns: (transfer none): + * +**/ +WEBKIT_API WebKitDOMNode* +webkit_dom_test_event_target_item(WebKitDOMTestEventTarget* self, gulong index); + +/** + * webkit_dom_test_event_target_dispatch_event: + * @self: A #WebKitDOMTestEventTarget + * @evt: A #WebKitDOMEvent + * @error: #GError + * + * Returns: + * +**/ +WEBKIT_API gboolean +webkit_dom_test_event_target_dispatch_event(WebKitDOMTestEventTarget* self, WebKitDOMEvent* evt, GError **error); + +G_END_DECLS + +#endif /* WebKitDOMTestEventTarget_h */ diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestEventTargetPrivate.h b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestEventTargetPrivate.h new file mode 100644 index 000000000..e5616e3df --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestEventTargetPrivate.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_EVENT_TARGET_PRIVATE_H +#define WEB_KIT_DOM_TEST_EVENT_TARGET_PRIVATE_H + +#include <glib-object.h> +#include <webkit/WebKitDOMObject.h> +#include "TestEventTarget.h" +namespace WebKit { + WebKitDOMTestEventTarget * + wrapTestEventTarget(WebCore::TestEventTarget *coreObject); + + WebCore::TestEventTarget * + core(WebKitDOMTestEventTarget *request); + + WebKitDOMTestEventTarget* + kit(WebCore::TestEventTarget* node); + +} // namespace WebKit + +#endif /* WEB_KIT_DOM_TEST_EVENT_TARGET_PRIVATE_H */ diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp index 5f8fafed3..26ab91bc8 100644 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp @@ -29,11 +29,14 @@ #include "ExceptionCode.h" #include "JSMainThreadExecState.h" #include "TestInterface.h" +#include "TestObj.h" #include "TestSupplemental.h" #include "WebKitDOMBinding.h" #include "gobject/ConvertToUTF8String.h" #include "webkit/WebKitDOMTestInterface.h" #include "webkit/WebKitDOMTestInterfacePrivate.h" +#include "webkit/WebKitDOMTestObj.h" +#include "webkit/WebKitDOMTestObjPrivate.h" #include "webkitdefines.h" #include "webkitglobalsprivate.h" #include "webkitmarshal.h" @@ -52,14 +55,53 @@ WebKitDOMTestInterface* kit(WebCore::TestInterface* obj) } // namespace WebKit // +void +webkit_dom_test_interface_supplemental_method1(WebKitDOMTestInterface* self) +{ +#if ENABLE(Condition11) || ENABLE(Condition12) + g_return_if_fail(self); + WebCore::JSMainThreadNullState state; + WebCore::TestInterface * item = WebKit::core(self); + TestSupplemental::supplementalMethod1(item); +#endif /* ENABLE(Condition11) || ENABLE(Condition12) */ +} + +WebKitDOMTestObj* +webkit_dom_test_interface_supplemental_method2(WebKitDOMTestInterface* self, const gchar* str_arg, WebKitDOMTestObj* obj_arg, GError **error) +{ +#if ENABLE(Condition11) || ENABLE(Condition12) + g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; + WebCore::TestInterface * item = WebKit::core(self); + g_return_val_if_fail(str_arg, 0); + g_return_val_if_fail(obj_arg, 0); + WTF::String converted_str_arg = WTF::String::fromUTF8(str_arg); + WebCore::TestObj * converted_obj_arg = NULL; + if (obj_arg != NULL) { + converted_obj_arg = WebKit::core(obj_arg); + g_return_val_if_fail(converted_obj_arg, 0); + } + WebCore::ExceptionCode ec = 0; + PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(TestSupplemental::supplementalMethod2(item, converted_str_arg, converted_obj_arg, ec)); + if (ec) { + WebCore::ExceptionCodeDescription ecdesc(ec); + g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); + } + WebKitDOMTestObj* res = WebKit::kit(g_res.get()); + return res; +#else + return NULL; +#endif /* ENABLE(Condition11) || ENABLE(Condition12) */ +} + gchar* -webkit_dom_test_interface_get_str1(WebKitDOMTestInterface* self) +webkit_dom_test_interface_get_supplemental_str1(WebKitDOMTestInterface* self) { #if ENABLE(Condition11) || ENABLE(Condition12) g_return_val_if_fail(self, 0); WebCore::JSMainThreadNullState state; WebCore::TestInterface * item = WebKit::core(self); - gchar* res = convertToUTF8String(TestSupplemental::str1(item)); + gchar* res = convertToUTF8String(TestSupplemental::supplementalStr1(item)); return res; #else return NULL; @@ -67,13 +109,13 @@ webkit_dom_test_interface_get_str1(WebKitDOMTestInterface* self) } gchar* -webkit_dom_test_interface_get_str2(WebKitDOMTestInterface* self) +webkit_dom_test_interface_get_supplemental_str2(WebKitDOMTestInterface* self) { #if ENABLE(Condition11) || ENABLE(Condition12) g_return_val_if_fail(self, 0); WebCore::JSMainThreadNullState state; WebCore::TestInterface * item = WebKit::core(self); - gchar* res = convertToUTF8String(TestSupplemental::str2(item)); + gchar* res = convertToUTF8String(TestSupplemental::supplementalStr2(item)); return res; #else return NULL; @@ -81,7 +123,7 @@ webkit_dom_test_interface_get_str2(WebKitDOMTestInterface* self) } void -webkit_dom_test_interface_set_str2(WebKitDOMTestInterface* self, const gchar* value) +webkit_dom_test_interface_set_supplemental_str2(WebKitDOMTestInterface* self, const gchar* value) { #if ENABLE(Condition11) || ENABLE(Condition12) g_return_if_fail(self); @@ -89,7 +131,7 @@ webkit_dom_test_interface_set_str2(WebKitDOMTestInterface* self, const gchar* va WebCore::TestInterface * item = WebKit::core(self); g_return_if_fail(value); WTF::String converted_value = WTF::String::fromUTF8(value); - TestSupplemental::setStr2(item, converted_value); + TestSupplemental::setSupplementalStr2(item, converted_value); #endif /* ENABLE(Condition11) || ENABLE(Condition12) */ } @@ -112,10 +154,10 @@ WebCore::TestInterface* core(WebKitDOMTestInterface* request) enum { PROP_0, #if ENABLE(Condition11) || ENABLE(Condition12) - PROP_STR1, + PROP_SUPPLEMENTAL_STR1, #endif /* ENABLE(Condition11) || ENABLE(Condition12) */ #if ENABLE(Condition11) || ENABLE(Condition12) - PROP_STR2, + PROP_SUPPLEMENTAL_STR2, #endif /* ENABLE(Condition11) || ENABLE(Condition12) */ }; @@ -143,9 +185,9 @@ static void webkit_dom_test_interface_set_property(GObject* object, guint prop_i WebCore::TestInterface* coreSelf = WebKit::core(self); switch (prop_id) { #if ENABLE(Condition11) || ENABLE(Condition12) - case PROP_STR2: + case PROP_SUPPLEMENTAL_STR2: { - TestSupplemental::setStr2(coreSelf, WTF::String::fromUTF8(g_value_get_string(value))); + TestSupplemental::setSupplementalStr2(coreSelf, WTF::String::fromUTF8(g_value_get_string(value))); break; } #endif /* ENABLE(Condition11) || ENABLE(Condition12) */ @@ -163,16 +205,16 @@ static void webkit_dom_test_interface_get_property(GObject* object, guint prop_i WebCore::TestInterface* coreSelf = WebKit::core(self); switch (prop_id) { #if ENABLE(Condition11) || ENABLE(Condition12) - case PROP_STR1: + case PROP_SUPPLEMENTAL_STR1: { - g_value_take_string(value, convertToUTF8String(TestSupplemental::str1(coreSelf))); + g_value_take_string(value, convertToUTF8String(TestSupplemental::supplementalStr1(coreSelf))); break; } #endif /* ENABLE(Condition11) || ENABLE(Condition12) */ #if ENABLE(Condition11) || ENABLE(Condition12) - case PROP_STR2: + case PROP_SUPPLEMENTAL_STR2: { - g_value_take_string(value, convertToUTF8String(TestSupplemental::str2(coreSelf))); + g_value_take_string(value, convertToUTF8String(TestSupplemental::supplementalStr2(coreSelf))); break; } #endif /* ENABLE(Condition11) || ENABLE(Condition12) */ @@ -200,19 +242,19 @@ static void webkit_dom_test_interface_class_init(WebKitDOMTestInterfaceClass* re #if ENABLE(Condition11) || ENABLE(Condition12) g_object_class_install_property(gobjectClass, - PROP_STR1, - g_param_spec_string("str1", /* name */ - "test_interface_str1", /* short description */ - "read-only gchar* TestInterface.str1", /* longer - could do with some extra doc stuff here */ + PROP_SUPPLEMENTAL_STR1, + g_param_spec_string("supplemental-str1", /* name */ + "test_interface_supplemental-str1", /* short description */ + "read-only gchar* TestInterface.supplemental-str1", /* longer - could do with some extra doc stuff here */ "", /* default */ WEBKIT_PARAM_READABLE)); #endif /* ENABLE(Condition11) || ENABLE(Condition12) */ #if ENABLE(Condition11) || ENABLE(Condition12) g_object_class_install_property(gobjectClass, - PROP_STR2, - g_param_spec_string("str2", /* name */ - "test_interface_str2", /* short description */ - "read-write gchar* TestInterface.str2", /* longer - could do with some extra doc stuff here */ + PROP_SUPPLEMENTAL_STR2, + g_param_spec_string("supplemental-str2", /* name */ + "test_interface_supplemental-str2", /* short description */ + "read-write gchar* TestInterface.supplemental-str2", /* longer - could do with some extra doc stuff here */ "", /* default */ WEBKIT_PARAM_READWRITE)); #endif /* ENABLE(Condition11) || ENABLE(Condition12) */ diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.h b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.h index 7c365058b..ea1a7b150 100644 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.h +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.h @@ -47,27 +47,50 @@ WEBKIT_API GType webkit_dom_test_interface_get_type (void); /** - * webkit_dom_test_interface_get_str1: + * webkit_dom_test_interface_supplemental_method1: + * @self: A #WebKitDOMTestInterface + * + * Returns: + * +**/ +WEBKIT_API void +webkit_dom_test_interface_supplemental_method1(WebKitDOMTestInterface* self); + +/** + * webkit_dom_test_interface_supplemental_method2: + * @self: A #WebKitDOMTestInterface + * @str_arg: A #gchar + * @obj_arg: A #WebKitDOMTestObj + * @error: #GError + * + * Returns: (transfer none): + * +**/ +WEBKIT_API WebKitDOMTestObj* +webkit_dom_test_interface_supplemental_method2(WebKitDOMTestInterface* self, const gchar* str_arg, WebKitDOMTestObj* obj_arg, GError **error); + +/** + * webkit_dom_test_interface_get_supplemental_str1: * @self: A #WebKitDOMTestInterface * * Returns: * **/ WEBKIT_API gchar* -webkit_dom_test_interface_get_str1(WebKitDOMTestInterface* self); +webkit_dom_test_interface_get_supplemental_str1(WebKitDOMTestInterface* self); /** - * webkit_dom_test_interface_get_str2: + * webkit_dom_test_interface_get_supplemental_str2: * @self: A #WebKitDOMTestInterface * * Returns: * **/ WEBKIT_API gchar* -webkit_dom_test_interface_get_str2(WebKitDOMTestInterface* self); +webkit_dom_test_interface_get_supplemental_str2(WebKitDOMTestInterface* self); /** - * webkit_dom_test_interface_set_str2: + * webkit_dom_test_interface_set_supplemental_str2: * @self: A #WebKitDOMTestInterface * @value: A #gchar * @@ -75,7 +98,7 @@ webkit_dom_test_interface_get_str2(WebKitDOMTestInterface* self); * **/ WEBKIT_API void -webkit_dom_test_interface_set_str2(WebKitDOMTestInterface* self, const gchar* value); +webkit_dom_test_interface_set_supplemental_str2(WebKitDOMTestInterface* self, const gchar* value); G_END_DECLS diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp index c92625580..70147cb81 100644 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp @@ -24,20 +24,39 @@ #include <wtf/GetPtr.h> #include <wtf/RefPtr.h> #include "DOMObjectCache.h" +#include "Document.h" #include "ExceptionCode.h" #include "HTMLNames.h" #include "JSMainThreadExecState.h" +#include "SVGPoint.h" #include "TestObj.h" #include "WebKitDOMBinding.h" +#include "bool.h" #include "gobject/ConvertToUTF8String.h" +#include "webkit/WebKitDOMDocument.h" +#include "webkit/WebKitDOMDocumentPrivate.h" #include "webkit/WebKitDOMIDBKey.h" #include "webkit/WebKitDOMIDBKeyPrivate.h" #include "webkit/WebKitDOMOptionsObject.h" #include "webkit/WebKitDOMOptionsObjectPrivate.h" +#include "webkit/WebKitDOMSVGPoint.h" +#include "webkit/WebKitDOMSVGPointPrivate.h" #include "webkit/WebKitDOMSerializedScriptValue.h" #include "webkit/WebKitDOMSerializedScriptValuePrivate.h" #include "webkit/WebKitDOMTestObj.h" #include "webkit/WebKitDOMTestObjPrivate.h" +#include "webkit/WebKitDOMa.h" +#include "webkit/WebKitDOMaPrivate.h" +#include "webkit/WebKitDOMb.h" +#include "webkit/WebKitDOMbPrivate.h" +#include "webkit/WebKitDOMbool.h" +#include "webkit/WebKitDOMboolPrivate.h" +#include "webkit/WebKitDOMc.h" +#include "webkit/WebKitDOMcPrivate.h" +#include "webkit/WebKitDOMd.h" +#include "webkit/WebKitDOMdPrivate.h" +#include "webkit/WebKitDOMe.h" +#include "webkit/WebKitDOMePrivate.h" #include "webkitdefines.h" #include "webkitglobalsprivate.h" #include "webkitmarshal.h" @@ -230,51 +249,6 @@ webkit_dom_test_obj_method_with_exception(WebKitDOMTestObj* self, GError **error } void -webkit_dom_test_obj_with_dynamic_frame(WebKitDOMTestObj* self) -{ - g_return_if_fail(self); - WebCore::JSMainThreadNullState state; - 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::JSMainThreadNullState state; - 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::JSMainThreadNullState state; - 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, gboolean isUserGesture) -{ - g_return_if_fail(self); - WebCore::JSMainThreadNullState state; - WebCore::TestObj * item = WebKit::core(self); - item->withDynamicFrameAndUserGesture(int_arg, false); -} - -void -webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad(WebKitDOMTestObj* self, glong int_arg, glong optional_arg, gboolean isUserGesture) -{ - g_return_if_fail(self); - WebCore::JSMainThreadNullState state; - WebCore::TestObj * item = WebKit::core(self); - item->withDynamicFrameAndUserGestureASAD(int_arg, optional_arg, false); -} - -void webkit_dom_test_obj_with_script_state_void(WebKitDOMTestObj* self) { g_return_if_fail(self); @@ -439,6 +413,130 @@ webkit_dom_test_obj_overloaded_method1(WebKitDOMTestObj* self, const gchar* type #endif /* ENABLE(Condition1) */ } +void +webkit_dom_test_obj_convert1(WebKitDOMTestObj* self, WebKitDOMa* ) +{ + g_return_if_fail(self); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + g_return_if_fail(); + WebCore::a * converted_ = NULL; + if ( != NULL) { + converted_ = WebKit::core(); + g_return_if_fail(converted_); + } + item->convert1(converted_); +} + +void +webkit_dom_test_obj_convert2(WebKitDOMTestObj* self, WebKitDOMb* ) +{ + g_return_if_fail(self); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + g_return_if_fail(); + WebCore::b * converted_ = NULL; + if ( != NULL) { + converted_ = WebKit::core(); + g_return_if_fail(converted_); + } + item->convert2(converted_); +} + +void +webkit_dom_test_obj_convert3(WebKitDOMTestObj* self, WebKitDOMc* ) +{ + g_return_if_fail(self); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + g_return_if_fail(); + WebCore::c * converted_ = NULL; + if ( != NULL) { + converted_ = WebKit::core(); + g_return_if_fail(converted_); + } + item->convert3(converted_); +} + +void +webkit_dom_test_obj_convert4(WebKitDOMTestObj* self, WebKitDOMd* ) +{ + g_return_if_fail(self); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + g_return_if_fail(); + WebCore::d * converted_ = NULL; + if ( != NULL) { + converted_ = WebKit::core(); + g_return_if_fail(converted_); + } + item->convert4(converted_); +} + +void +webkit_dom_test_obj_convert5(WebKitDOMTestObj* self, WebKitDOMe* ) +{ + g_return_if_fail(self); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + g_return_if_fail(); + WebCore::e * converted_ = NULL; + if ( != NULL) { + converted_ = WebKit::core(); + g_return_if_fail(converted_); + } + item->convert5(converted_); +} + +WebKitDOMSVGPoint* +webkit_dom_test_obj_mutable_point_function(WebKitDOMTestObj* self) +{ + g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + PassRefPtr<WebCore::SVGPoint> g_res = WTF::getPtr(item->mutablePointFunction()); + WebKitDOMSVGPoint* res = WebKit::kit(g_res.get()); + return res; +} + +WebKitDOMSVGPoint* +webkit_dom_test_obj_immutable_point_function(WebKitDOMTestObj* self) +{ + g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + PassRefPtr<WebCore::SVGPoint> g_res = WTF::getPtr(item->immutablePointFunction()); + WebKitDOMSVGPoint* res = WebKit::kit(g_res.get()); + return res; +} + +void +webkit_dom_test_obj_orange(WebKitDOMTestObj* self) +{ + g_return_if_fail(self); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + item->orange(); +} + +WebKitDOMbool* +webkit_dom_test_obj_strict_function(WebKitDOMTestObj* self, const gchar* str, gfloat a, gint b, GError **error) +{ + g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + g_return_val_if_fail(str, 0); + WTF::String converted_str = WTF::String::fromUTF8(str); + WebCore::ExceptionCode ec = 0; + PassRefPtr<WebCore::bool> g_res = WTF::getPtr(item->strictFunction(converted_str, a, b, ec)); + if (ec) { + WebCore::ExceptionCodeDescription ecdesc(ec); + g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); + } + WebKitDOMbool* res = WebKit::kit(g_res.get()); + return res; +} + glong webkit_dom_test_obj_get_read_only_int_attr(WebKitDOMTestObj* self) { @@ -1069,6 +1167,88 @@ webkit_dom_test_obj_set_conditional_attr3(WebKitDOMTestObj* self, glong value) #endif /* ENABLE(Condition1) || ENABLE(Condition2) */ } +WebKitDOMDocument* +webkit_dom_test_obj_get_content_document(WebKitDOMTestObj* self) +{ + g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + PassRefPtr<WebCore::Document> g_res = WTF::getPtr(item->contentDocument()); + WebKitDOMDocument* res = WebKit::kit(g_res.get()); + return res; +} + +WebKitDOMSVGPoint* +webkit_dom_test_obj_get_mutable_point(WebKitDOMTestObj* self) +{ + g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + PassRefPtr<WebCore::SVGPoint> g_res = WTF::getPtr(item->mutablePoint()); + WebKitDOMSVGPoint* res = WebKit::kit(g_res.get()); + return res; +} + +void +webkit_dom_test_obj_set_mutable_point(WebKitDOMTestObj* self, WebKitDOMSVGPoint* value) +{ + g_return_if_fail(self); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + g_return_if_fail(value); + WebCore::SVGPoint * converted_value = NULL; + if (value != NULL) { + converted_value = WebKit::core(value); + g_return_if_fail(converted_value); + } + item->setMutablePoint(converted_value); +} + +WebKitDOMSVGPoint* +webkit_dom_test_obj_get_immutable_point(WebKitDOMTestObj* self) +{ + g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + PassRefPtr<WebCore::SVGPoint> g_res = WTF::getPtr(item->immutablePoint()); + WebKitDOMSVGPoint* res = WebKit::kit(g_res.get()); + return res; +} + +void +webkit_dom_test_obj_set_immutable_point(WebKitDOMTestObj* self, WebKitDOMSVGPoint* value) +{ + g_return_if_fail(self); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + g_return_if_fail(value); + WebCore::SVGPoint * converted_value = NULL; + if (value != NULL) { + converted_value = WebKit::core(value); + g_return_if_fail(converted_value); + } + item->setImmutablePoint(converted_value); +} + +gfloat +webkit_dom_test_obj_get_strict_float(WebKitDOMTestObj* self) +{ + g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + gfloat res = item->strictFloat(); + return res; +} + +void +webkit_dom_test_obj_set_strict_float(WebKitDOMTestObj* self, gfloat value) +{ + g_return_if_fail(self); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + item->setStrictFloat(value); +} + glong webkit_dom_test_obj_get_description(WebKitDOMTestObj* self) { @@ -1164,6 +1344,10 @@ enum { #if ENABLE(Condition1) || ENABLE(Condition2) PROP_CONDITIONAL_ATTR3, #endif /* ENABLE(Condition1) || ENABLE(Condition2) */ + PROP_CONTENT_DOCUMENT, + PROP_MUTABLE_POINT, + PROP_IMMUTABLE_POINT, + PROP_STRICT_FLOAT, PROP_DESCRIPTION, PROP_ID, PROP_HASH, @@ -1317,6 +1501,11 @@ static void webkit_dom_test_obj_set_property(GObject* object, guint prop_id, con break; } #endif /* ENABLE(Condition1) || ENABLE(Condition2) */ + case PROP_STRICT_FLOAT: + { + coreSelf->setStrictFloat((g_value_get_float(value))); + break; + } case PROP_ID: { coreSelf->setId((g_value_get_long(value))); @@ -1501,6 +1690,29 @@ static void webkit_dom_test_obj_get_property(GObject* object, guint prop_id, GVa break; } #endif /* ENABLE(Condition1) || ENABLE(Condition2) */ + case PROP_CONTENT_DOCUMENT: + { + RefPtr<WebCore::Document> ptr = coreSelf->contentDocument(); + g_value_set_object(value, WebKit::kit(ptr.get())); + break; + } + case PROP_MUTABLE_POINT: + { + RefPtr<WebCore::SVGPoint> ptr = coreSelf->mutablePoint(); + g_value_set_object(value, WebKit::kit(ptr.get())); + break; + } + case PROP_IMMUTABLE_POINT: + { + RefPtr<WebCore::SVGPoint> ptr = coreSelf->immutablePoint(); + g_value_set_object(value, WebKit::kit(ptr.get())); + break; + } + case PROP_STRICT_FLOAT: + { + g_value_set_float(value, coreSelf->strictFloat()); + break; + } case PROP_DESCRIPTION: { g_value_set_long(value, coreSelf->description()); @@ -1790,6 +2002,36 @@ G_MAXLONG, /* max */ WEBKIT_PARAM_READWRITE)); #endif /* ENABLE(Condition1) || ENABLE(Condition2) */ g_object_class_install_property(gobjectClass, + PROP_CONTENT_DOCUMENT, + g_param_spec_object("content-document", /* name */ + "test_obj_content-document", /* short description */ + "read-only WebKitDOMDocument* TestObj.content-document", /* longer - could do with some extra doc stuff here */ + WEBKIT_TYPE_DOM_DOCUMENT, /* gobject type */ + WEBKIT_PARAM_READABLE)); + g_object_class_install_property(gobjectClass, + PROP_MUTABLE_POINT, + g_param_spec_object("mutable-point", /* name */ + "test_obj_mutable-point", /* short description */ + "read-write WebKitDOMSVGPoint* TestObj.mutable-point", /* longer - could do with some extra doc stuff here */ + WEBKIT_TYPE_DOM_SVG_POINT, /* gobject type */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, + PROP_IMMUTABLE_POINT, + g_param_spec_object("immutable-point", /* name */ + "test_obj_immutable-point", /* short description */ + "read-write WebKitDOMSVGPoint* TestObj.immutable-point", /* longer - could do with some extra doc stuff here */ + WEBKIT_TYPE_DOM_SVG_POINT, /* gobject type */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, + PROP_STRICT_FLOAT, + g_param_spec_float("strict-float", /* name */ + "test_obj_strict-float", /* short description */ + "read-write gfloat TestObj.strict-float", /* longer - could do with some extra doc stuff here */ + -G_MAXFLOAT, /* min */ +G_MAXFLOAT, /* max */ +0.0, /* default */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, PROP_DESCRIPTION, g_param_spec_long("description", /* name */ "test_obj_description", /* short description */ diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h index c7696df5a..a60b97eea 100644 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h @@ -174,62 +174,6 @@ WEBKIT_API void webkit_dom_test_obj_method_with_exception(WebKitDOMTestObj* self, GError **error); /** - * webkit_dom_test_obj_with_dynamic_frame: - * @self: A #WebKitDOMTestObj - * - * Returns: - * -**/ -WEBKIT_API void -webkit_dom_test_obj_with_dynamic_frame(WebKitDOMTestObj* self); - -/** - * webkit_dom_test_obj_with_dynamic_frame_and_arg: - * @self: A #WebKitDOMTestObj - * @int_arg: A #glong - * - * Returns: - * -**/ -WEBKIT_API void -webkit_dom_test_obj_with_dynamic_frame_and_arg(WebKitDOMTestObj* self, glong int_arg); - -/** - * webkit_dom_test_obj_with_dynamic_frame_and_optional_arg: - * @self: A #WebKitDOMTestObj - * @int_arg: A #glong - * @optional_arg: A #glong - * - * Returns: - * -**/ -WEBKIT_API void -webkit_dom_test_obj_with_dynamic_frame_and_optional_arg(WebKitDOMTestObj* self, glong int_arg, glong optional_arg); - -/** - * webkit_dom_test_obj_with_dynamic_frame_and_user_gesture: - * @self: A #WebKitDOMTestObj - * @int_arg: A #glong - * - * Returns: - * -**/ -WEBKIT_API void -webkit_dom_test_obj_with_dynamic_frame_and_user_gesture(WebKitDOMTestObj* self, glong int_arg, gboolean isUserGesture); - -/** - * webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad: - * @self: A #WebKitDOMTestObj - * @int_arg: A #glong - * @optional_arg: A #glong - * - * Returns: - * -**/ -WEBKIT_API void -webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad(WebKitDOMTestObj* self, glong int_arg, glong optional_arg, gboolean isUserGesture); - -/** * webkit_dom_test_obj_with_script_state_void: * @self: A #WebKitDOMTestObj * @@ -391,6 +335,105 @@ WEBKIT_API void webkit_dom_test_obj_overloaded_method1(WebKitDOMTestObj* self, const gchar* type); /** + * webkit_dom_test_obj_convert1: + * @self: A #WebKitDOMTestObj + * @: A #WebKitDOMa + * + * Returns: + * +**/ +WEBKIT_API void +webkit_dom_test_obj_convert1(WebKitDOMTestObj* self, WebKitDOMa* ); + +/** + * webkit_dom_test_obj_convert2: + * @self: A #WebKitDOMTestObj + * @: A #WebKitDOMb + * + * Returns: + * +**/ +WEBKIT_API void +webkit_dom_test_obj_convert2(WebKitDOMTestObj* self, WebKitDOMb* ); + +/** + * webkit_dom_test_obj_convert3: + * @self: A #WebKitDOMTestObj + * @: A #WebKitDOMc + * + * Returns: + * +**/ +WEBKIT_API void +webkit_dom_test_obj_convert3(WebKitDOMTestObj* self, WebKitDOMc* ); + +/** + * webkit_dom_test_obj_convert4: + * @self: A #WebKitDOMTestObj + * @: A #WebKitDOMd + * + * Returns: + * +**/ +WEBKIT_API void +webkit_dom_test_obj_convert4(WebKitDOMTestObj* self, WebKitDOMd* ); + +/** + * webkit_dom_test_obj_convert5: + * @self: A #WebKitDOMTestObj + * @: A #WebKitDOMe + * + * Returns: + * +**/ +WEBKIT_API void +webkit_dom_test_obj_convert5(WebKitDOMTestObj* self, WebKitDOMe* ); + +/** + * webkit_dom_test_obj_mutable_point_function: + * @self: A #WebKitDOMTestObj + * + * Returns: (transfer none): + * +**/ +WEBKIT_API WebKitDOMSVGPoint* +webkit_dom_test_obj_mutable_point_function(WebKitDOMTestObj* self); + +/** + * webkit_dom_test_obj_immutable_point_function: + * @self: A #WebKitDOMTestObj + * + * Returns: (transfer none): + * +**/ +WEBKIT_API WebKitDOMSVGPoint* +webkit_dom_test_obj_immutable_point_function(WebKitDOMTestObj* self); + +/** + * webkit_dom_test_obj_orange: + * @self: A #WebKitDOMTestObj + * + * Returns: + * +**/ +WEBKIT_API void +webkit_dom_test_obj_orange(WebKitDOMTestObj* self); + +/** + * webkit_dom_test_obj_strict_function: + * @self: A #WebKitDOMTestObj + * @str: A #gchar + * @a: A #gfloat + * @b: A #gint + * @error: #GError + * + * Returns: (transfer none): + * +**/ +WEBKIT_API WebKitDOMbool* +webkit_dom_test_obj_strict_function(WebKitDOMTestObj* self, const gchar* str, gfloat a, gint b, GError **error); + +/** * webkit_dom_test_obj_get_read_only_int_attr: * @self: A #WebKitDOMTestObj * @@ -1004,6 +1047,79 @@ WEBKIT_API void webkit_dom_test_obj_set_conditional_attr3(WebKitDOMTestObj* self, glong value); /** + * webkit_dom_test_obj_get_content_document: + * @self: A #WebKitDOMTestObj + * + * Returns: (transfer none): + * +**/ +WEBKIT_API WebKitDOMDocument* +webkit_dom_test_obj_get_content_document(WebKitDOMTestObj* self); + +/** + * webkit_dom_test_obj_get_mutable_point: + * @self: A #WebKitDOMTestObj + * + * Returns: (transfer none): + * +**/ +WEBKIT_API WebKitDOMSVGPoint* +webkit_dom_test_obj_get_mutable_point(WebKitDOMTestObj* self); + +/** + * webkit_dom_test_obj_set_mutable_point: + * @self: A #WebKitDOMTestObj + * @value: A #WebKitDOMSVGPoint + * + * Returns: (transfer none): + * +**/ +WEBKIT_API void +webkit_dom_test_obj_set_mutable_point(WebKitDOMTestObj* self, WebKitDOMSVGPoint* value); + +/** + * webkit_dom_test_obj_get_immutable_point: + * @self: A #WebKitDOMTestObj + * + * Returns: (transfer none): + * +**/ +WEBKIT_API WebKitDOMSVGPoint* +webkit_dom_test_obj_get_immutable_point(WebKitDOMTestObj* self); + +/** + * webkit_dom_test_obj_set_immutable_point: + * @self: A #WebKitDOMTestObj + * @value: A #WebKitDOMSVGPoint + * + * Returns: (transfer none): + * +**/ +WEBKIT_API void +webkit_dom_test_obj_set_immutable_point(WebKitDOMTestObj* self, WebKitDOMSVGPoint* value); + +/** + * webkit_dom_test_obj_get_strict_float: + * @self: A #WebKitDOMTestObj + * + * Returns: + * +**/ +WEBKIT_API gfloat +webkit_dom_test_obj_get_strict_float(WebKitDOMTestObj* self); + +/** + * webkit_dom_test_obj_set_strict_float: + * @self: A #WebKitDOMTestObj + * @value: A #gfloat + * + * Returns: + * +**/ +WEBKIT_API void +webkit_dom_test_obj_set_strict_float(WebKitDOMTestObj* self, gfloat value); + +/** * webkit_dom_test_obj_get_description: * @self: A #WebKitDOMTestObj * diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestOverridingNameGetter.cpp b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestOverridingNameGetter.cpp new file mode 100644 index 000000000..2f76ae1bb --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestOverridingNameGetter.cpp @@ -0,0 +1,159 @@ +/* + 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 "DOMObjectCache.h" +#include "ExceptionCode.h" +#include "JSMainThreadExecState.h" +#include "TestOverridingNameGetter.h" +#include "WebKitDOMBinding.h" +#include "gobject/ConvertToUTF8String.h" +#include "webkit/WebKitDOMTestOverridingNameGetter.h" +#include "webkit/WebKitDOMTestOverridingNameGetterPrivate.h" +#include "webkitdefines.h" +#include "webkitglobalsprivate.h" +#include "webkitmarshal.h" + +namespace WebKit { + +WebKitDOMTestOverridingNameGetter* kit(WebCore::TestOverridingNameGetter* obj) +{ + g_return_val_if_fail(obj, 0); + + if (gpointer ret = DOMObjectCache::get(obj)) + return static_cast<WebKitDOMTestOverridingNameGetter*>(ret); + + return static_cast<WebKitDOMTestOverridingNameGetter*>(DOMObjectCache::put(obj, WebKit::wrapTestOverridingNameGetter(obj))); +} + +} // namespace WebKit // + +void +webkit_dom_test_overriding_name_getter_another_function(WebKitDOMTestOverridingNameGetter* self, const gchar* str) +{ + g_return_if_fail(self); + WebCore::JSMainThreadNullState state; + WebCore::TestOverridingNameGetter * item = WebKit::core(self); + g_return_if_fail(str); + WTF::String converted_str = WTF::String::fromUTF8(str); + item->anotherFunction(converted_str); +} + + +G_DEFINE_TYPE(WebKitDOMTestOverridingNameGetter, webkit_dom_test_overriding_name_getter, WEBKIT_TYPE_DOM_OBJECT) + +namespace WebKit { + +WebCore::TestOverridingNameGetter* core(WebKitDOMTestOverridingNameGetter* request) +{ + g_return_val_if_fail(request, 0); + + WebCore::TestOverridingNameGetter* coreObject = static_cast<WebCore::TestOverridingNameGetter*>(WEBKIT_DOM_OBJECT(request)->coreObject); + g_return_val_if_fail(coreObject, 0); + + return coreObject; +} + +} // namespace WebKit +enum { + PROP_0, +}; + + +static void webkit_dom_test_overriding_name_getter_finalize(GObject* object) +{ + WebKitDOMObject* dom_object = WEBKIT_DOM_OBJECT(object); + + if (dom_object->coreObject) { + WebCore::TestOverridingNameGetter* coreObject = static_cast<WebCore::TestOverridingNameGetter *>(dom_object->coreObject); + + WebKit::DOMObjectCache::forget(coreObject); + coreObject->deref(); + + dom_object->coreObject = NULL; + } + + G_OBJECT_CLASS(webkit_dom_test_overriding_name_getter_parent_class)->finalize(object); +} + +static void webkit_dom_test_overriding_name_getter_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec) +{ + WebCore::JSMainThreadNullState state; + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } +} + + +static void webkit_dom_test_overriding_name_getter_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) +{ + WebCore::JSMainThreadNullState state; + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } +} + + +static void webkit_dom_test_overriding_name_getter_constructed(GObject* object) +{ + + if (G_OBJECT_CLASS(webkit_dom_test_overriding_name_getter_parent_class)->constructed) + G_OBJECT_CLASS(webkit_dom_test_overriding_name_getter_parent_class)->constructed(object); +} + +static void webkit_dom_test_overriding_name_getter_class_init(WebKitDOMTestOverridingNameGetterClass* requestClass) +{ + GObjectClass *gobjectClass = G_OBJECT_CLASS(requestClass); + gobjectClass->finalize = webkit_dom_test_overriding_name_getter_finalize; + gobjectClass->set_property = webkit_dom_test_overriding_name_getter_set_property; + gobjectClass->get_property = webkit_dom_test_overriding_name_getter_get_property; + gobjectClass->constructed = webkit_dom_test_overriding_name_getter_constructed; + + + +} + +static void webkit_dom_test_overriding_name_getter_init(WebKitDOMTestOverridingNameGetter* request) +{ +} + +namespace WebKit { +WebKitDOMTestOverridingNameGetter* wrapTestOverridingNameGetter(WebCore::TestOverridingNameGetter* coreObject) +{ + g_return_val_if_fail(coreObject, 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(); + + return WEBKIT_DOM_TEST_OVERRIDING_NAME_GETTER(g_object_new(WEBKIT_TYPE_DOM_TEST_OVERRIDING_NAME_GETTER, + "core-object", coreObject, NULL)); +} +} // namespace WebKit diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestOverridingNameGetter.h b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestOverridingNameGetter.h new file mode 100644 index 000000000..743432a5d --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestOverridingNameGetter.h @@ -0,0 +1,62 @@ +/* + 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 WebKitDOMTestOverridingNameGetter_h +#define WebKitDOMTestOverridingNameGetter_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_OVERRIDING_NAME_GETTER (webkit_dom_test_overriding_name_getter_get_type()) +#define WEBKIT_DOM_TEST_OVERRIDING_NAME_GETTER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_DOM_TEST_OVERRIDING_NAME_GETTER, WebKitDOMTestOverridingNameGetter)) +#define WEBKIT_DOM_TEST_OVERRIDING_NAME_GETTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_DOM_TEST_OVERRIDING_NAME_GETTER, WebKitDOMTestOverridingNameGetterClass) +#define WEBKIT_DOM_IS_TEST_OVERRIDING_NAME_GETTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_DOM_TEST_OVERRIDING_NAME_GETTER)) +#define WEBKIT_DOM_IS_TEST_OVERRIDING_NAME_GETTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_DOM_TEST_OVERRIDING_NAME_GETTER)) +#define WEBKIT_DOM_TEST_OVERRIDING_NAME_GETTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_DOM_TEST_OVERRIDING_NAME_GETTER, WebKitDOMTestOverridingNameGetterClass)) + +struct _WebKitDOMTestOverridingNameGetter { + WebKitDOMObject parent_instance; +}; + +struct _WebKitDOMTestOverridingNameGetterClass { + WebKitDOMObjectClass parent_class; +}; + +WEBKIT_API GType +webkit_dom_test_overriding_name_getter_get_type (void); + +/** + * webkit_dom_test_overriding_name_getter_another_function: + * @self: A #WebKitDOMTestOverridingNameGetter + * @str: A #gchar + * + * Returns: + * +**/ +WEBKIT_API void +webkit_dom_test_overriding_name_getter_another_function(WebKitDOMTestOverridingNameGetter* self, const gchar* str); + +G_END_DECLS + +#endif /* WebKitDOMTestOverridingNameGetter_h */ diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestOverridingNameGetterPrivate.h b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestOverridingNameGetterPrivate.h new file mode 100644 index 000000000..174e3c670 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestOverridingNameGetterPrivate.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_OVERRIDING_NAME_GETTER_PRIVATE_H +#define WEB_KIT_DOM_TEST_OVERRIDING_NAME_GETTER_PRIVATE_H + +#include <glib-object.h> +#include <webkit/WebKitDOMObject.h> +#include "TestOverridingNameGetter.h" +namespace WebKit { + WebKitDOMTestOverridingNameGetter * + wrapTestOverridingNameGetter(WebCore::TestOverridingNameGetter *coreObject); + + WebCore::TestOverridingNameGetter * + core(WebKitDOMTestOverridingNameGetter *request); + + WebKitDOMTestOverridingNameGetter* + kit(WebCore::TestOverridingNameGetter* node); + +} // namespace WebKit + +#endif /* WEB_KIT_DOM_TEST_OVERRIDING_NAME_GETTER_PRIVATE_H */ diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp new file mode 100644 index 000000000..d7bfd9f0f --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp @@ -0,0 +1,247 @@ +/* + 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 "JSTestActiveDOMObject.h" + +#include "ExceptionCode.h" +#include "JSDOMBinding.h" +#include "JSNode.h" +#include "TestActiveDOMObject.h" +#include <runtime/Error.h> +#include <wtf/GetPtr.h> + +using namespace JSC; + +namespace WebCore { + +ASSERT_CLASS_FITS_IN_CELL(JSTestActiveDOMObject); +ASSERT_HAS_TRIVIAL_DESTRUCTOR(JSTestActiveDOMObject); + +/* Hash table */ + +static const HashTableValue JSTestActiveDOMObjectTableValues[] = +{ + { "excitingAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestActiveDOMObjectExcitingAttr), (intptr_t)0, NoIntrinsic }, + { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestActiveDOMObjectConstructor), (intptr_t)0, NoIntrinsic }, + { 0, 0, 0, 0, NoIntrinsic } +}; + +static const HashTable JSTestActiveDOMObjectTable = { 4, 3, JSTestActiveDOMObjectTableValues, 0 }; +/* Hash table for constructor */ + +static const HashTableValue JSTestActiveDOMObjectConstructorTableValues[] = +{ + { 0, 0, 0, 0, NoIntrinsic } +}; + +static const HashTable JSTestActiveDOMObjectConstructorTable = { 1, 0, JSTestActiveDOMObjectConstructorTableValues, 0 }; +ASSERT_HAS_TRIVIAL_DESTRUCTOR(JSTestActiveDOMObjectConstructor); + +const ClassInfo JSTestActiveDOMObjectConstructor::s_info = { "TestActiveDOMObjectConstructor", &Base::s_info, &JSTestActiveDOMObjectConstructorTable, 0, CREATE_METHOD_TABLE(JSTestActiveDOMObjectConstructor) }; + +JSTestActiveDOMObjectConstructor::JSTestActiveDOMObjectConstructor(Structure* structure, JSDOMGlobalObject* globalObject) + : DOMConstructorObject(structure, globalObject) +{ +} + +void JSTestActiveDOMObjectConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject) +{ + Base::finishCreation(exec->globalData()); + ASSERT(inherits(&s_info)); + putDirect(exec->globalData(), exec->propertyNames().prototype, JSTestActiveDOMObjectPrototype::self(exec, globalObject), DontDelete | ReadOnly); +} + +bool JSTestActiveDOMObjectConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot<JSTestActiveDOMObjectConstructor, JSDOMWrapper>(exec, &JSTestActiveDOMObjectConstructorTable, static_cast<JSTestActiveDOMObjectConstructor*>(cell), propertyName, slot); +} + +bool JSTestActiveDOMObjectConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor<JSTestActiveDOMObjectConstructor, JSDOMWrapper>(exec, &JSTestActiveDOMObjectConstructorTable, static_cast<JSTestActiveDOMObjectConstructor*>(object), propertyName, descriptor); +} + +/* Hash table for prototype */ + +static const HashTableValue JSTestActiveDOMObjectPrototypeTableValues[] = +{ + { "excitingFunction", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestActiveDOMObjectPrototypeFunctionExcitingFunction), (intptr_t)1, NoIntrinsic }, + { "postMessage", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestActiveDOMObjectPrototypeFunctionPostMessage), (intptr_t)1, NoIntrinsic }, + { 0, 0, 0, 0, NoIntrinsic } +}; + +static const HashTable JSTestActiveDOMObjectPrototypeTable = { 4, 3, JSTestActiveDOMObjectPrototypeTableValues, 0 }; +const ClassInfo JSTestActiveDOMObjectPrototype::s_info = { "TestActiveDOMObjectPrototype", &Base::s_info, &JSTestActiveDOMObjectPrototypeTable, 0, CREATE_METHOD_TABLE(JSTestActiveDOMObjectPrototype) }; + +JSObject* JSTestActiveDOMObjectPrototype::self(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMPrototype<JSTestActiveDOMObject>(exec, globalObject); +} + +bool JSTestActiveDOMObjectPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + JSTestActiveDOMObjectPrototype* thisObject = jsCast<JSTestActiveDOMObjectPrototype*>(cell); + return getStaticFunctionSlot<JSObject>(exec, &JSTestActiveDOMObjectPrototypeTable, thisObject, propertyName, slot); +} + +bool JSTestActiveDOMObjectPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + JSTestActiveDOMObjectPrototype* thisObject = jsCast<JSTestActiveDOMObjectPrototype*>(object); + return getStaticFunctionDescriptor<JSObject>(exec, &JSTestActiveDOMObjectPrototypeTable, thisObject, propertyName, descriptor); +} + +const ClassInfo JSTestActiveDOMObject::s_info = { "TestActiveDOMObject", &Base::s_info, &JSTestActiveDOMObjectTable, 0 , CREATE_METHOD_TABLE(JSTestActiveDOMObject) }; + +JSTestActiveDOMObject::JSTestActiveDOMObject(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestActiveDOMObject> impl) + : JSDOMWrapper(structure, globalObject) + , m_impl(impl.leakRef()) +{ +} + +void JSTestActiveDOMObject::finishCreation(JSGlobalData& globalData) +{ + Base::finishCreation(globalData); + ASSERT(inherits(&s_info)); +} + +JSObject* JSTestActiveDOMObject::createPrototype(ExecState* exec, JSGlobalObject* globalObject) +{ + return JSTestActiveDOMObjectPrototype::create(exec->globalData(), globalObject, JSTestActiveDOMObjectPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype())); +} + +void JSTestActiveDOMObject::destroy(JSC::JSCell* cell) +{ + JSTestActiveDOMObject* thisObject = jsCast<JSTestActiveDOMObject*>(cell); + thisObject->releaseImplIfNotNull(); +} + +bool JSTestActiveDOMObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + JSTestActiveDOMObject* thisObject = jsCast<JSTestActiveDOMObject*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); + return getStaticValueSlot<JSTestActiveDOMObject, Base>(exec, &JSTestActiveDOMObjectTable, thisObject, propertyName, slot); +} + +bool JSTestActiveDOMObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + JSTestActiveDOMObject* thisObject = jsCast<JSTestActiveDOMObject*>(object); + ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); + if (!allowAccessToFrame(exec, thisObject->impl()->frame())) + return false; + return getStaticValueDescriptor<JSTestActiveDOMObject, Base>(exec, &JSTestActiveDOMObjectTable, thisObject, propertyName, descriptor); +} + +JSValue jsTestActiveDOMObjectExcitingAttr(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestActiveDOMObject* castedThis = static_cast<JSTestActiveDOMObject*>(asObject(slotBase)); + if (!castedThis->allowsAccessFrom(exec)) + return jsUndefined(); + UNUSED_PARAM(exec); + TestActiveDOMObject* impl = static_cast<TestActiveDOMObject*>(castedThis->impl()); + JSValue result = jsNumber(impl->excitingAttr()); + return result; +} + + +JSValue jsTestActiveDOMObjectConstructor(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestActiveDOMObject* domObject = static_cast<JSTestActiveDOMObject*>(asObject(slotBase)); + if (!domObject->allowsAccessFrom(exec)) + return jsUndefined(); + return JSTestActiveDOMObject::getConstructor(exec, domObject->globalObject()); +} + +JSValue JSTestActiveDOMObject::getConstructor(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMConstructor<JSTestActiveDOMObjectConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); +} + +EncodedJSValue JSC_HOST_CALL jsTestActiveDOMObjectPrototypeFunctionExcitingFunction(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestActiveDOMObject::s_info)) + return throwVMTypeError(exec); + JSTestActiveDOMObject* castedThis = static_cast<JSTestActiveDOMObject*>(asObject(thisValue)); + ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestActiveDOMObject::s_info); + if (!castedThis->allowsAccessFrom(exec)) + return JSValue::encode(jsUndefined()); + TestActiveDOMObject* impl = static_cast<TestActiveDOMObject*>(castedThis->impl()); + if (exec->argumentCount() < 1) + return throwVMError(exec, createTypeError(exec, "Not enough arguments")); + Node* nextChild(toNode(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined))); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + impl->excitingFunction(nextChild); + return JSValue::encode(jsUndefined()); +} + +EncodedJSValue JSC_HOST_CALL jsTestActiveDOMObjectPrototypeFunctionPostMessage(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestActiveDOMObject::s_info)) + return throwVMTypeError(exec); + JSTestActiveDOMObject* castedThis = static_cast<JSTestActiveDOMObject*>(asObject(thisValue)); + ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestActiveDOMObject::s_info); + TestActiveDOMObject* impl = static_cast<TestActiveDOMObject*>(castedThis->impl()); + if (exec->argumentCount() < 1) + return throwVMError(exec, createTypeError(exec, "Not enough arguments")); + const String& message(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec))); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + impl->postMessage(message); + return JSValue::encode(jsUndefined()); +} + +static inline bool isObservable(JSTestActiveDOMObject* jsTestActiveDOMObject) +{ + if (jsTestActiveDOMObject->hasCustomProperties()) + return true; + return false; +} + +bool JSTestActiveDOMObjectOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor) +{ + JSTestActiveDOMObject* jsTestActiveDOMObject = static_cast<JSTestActiveDOMObject*>(handle.get().asCell()); + if (!isObservable(jsTestActiveDOMObject)) + return false; + UNUSED_PARAM(visitor); + return false; +} + +void JSTestActiveDOMObjectOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) +{ + JSTestActiveDOMObject* jsTestActiveDOMObject = static_cast<JSTestActiveDOMObject*>(handle.get().asCell()); + DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); + uncacheWrapper(world, jsTestActiveDOMObject->impl(), jsTestActiveDOMObject); + jsTestActiveDOMObject->releaseImpl(); +} + +JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestActiveDOMObject* impl) +{ + return wrap<JSTestActiveDOMObject>(exec, globalObject, impl); +} + +TestActiveDOMObject* toTestActiveDOMObject(JSC::JSValue value) +{ + return value.inherits(&JSTestActiveDOMObject::s_info) ? static_cast<JSTestActiveDOMObject*>(asObject(value))->impl() : 0; +} + +} diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.h b/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.h new file mode 100644 index 000000000..bcd224dd2 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.h @@ -0,0 +1,147 @@ +/* + 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 JSTestActiveDOMObject_h +#define JSTestActiveDOMObject_h + +#include "JSDOMBinding.h" +#include "TestActiveDOMObject.h" +#include <runtime/JSGlobalObject.h> +#include <runtime/JSObject.h> +#include <runtime/ObjectPrototype.h> + +namespace WebCore { + +class JSTestActiveDOMObject : public JSDOMWrapper { +public: + typedef JSDOMWrapper Base; + static JSTestActiveDOMObject* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestActiveDOMObject> impl) + { + JSTestActiveDOMObject* ptr = new (NotNull, JSC::allocateCell<JSTestActiveDOMObject>(globalObject->globalData().heap)) JSTestActiveDOMObject(structure, globalObject, impl); + ptr->finishCreation(globalObject->globalData()); + return ptr; + } + + static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); + static bool getOwnPropertySlot(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); + static bool getOwnPropertyDescriptor(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); + static void destroy(JSC::JSCell*); + static const JSC::ClassInfo s_info; + + static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(globalData, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), &s_info); + } + + static JSC::JSValue getConstructor(JSC::ExecState*, JSC::JSGlobalObject*); + TestActiveDOMObject* impl() const { return m_impl; } + void releaseImpl() { m_impl->deref(); m_impl = 0; } + + void releaseImplIfNotNull() { if (m_impl) { m_impl->deref(); m_impl = 0; } } + +private: + TestActiveDOMObject* m_impl; +protected: + JSTestActiveDOMObject(JSC::Structure*, JSDOMGlobalObject*, PassRefPtr<TestActiveDOMObject>); + void finishCreation(JSC::JSGlobalData&); + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; +}; + +class JSTestActiveDOMObjectOwner : public JSC::WeakHandleOwner { + virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&); + virtual void finalize(JSC::Handle<JSC::Unknown>, void* context); +}; + +inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld*, TestActiveDOMObject*) +{ + DEFINE_STATIC_LOCAL(JSTestActiveDOMObjectOwner, jsTestActiveDOMObjectOwner, ()); + return &jsTestActiveDOMObjectOwner; +} + +inline void* wrapperContext(DOMWrapperWorld* world, TestActiveDOMObject*) +{ + return world; +} + +JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestActiveDOMObject*); +TestActiveDOMObject* toTestActiveDOMObject(JSC::JSValue); + +class JSTestActiveDOMObjectPrototype : public JSC::JSNonFinalObject { +public: + typedef JSC::JSNonFinalObject Base; + static JSC::JSObject* self(JSC::ExecState*, JSC::JSGlobalObject*); + static JSTestActiveDOMObjectPrototype* create(JSC::JSGlobalData& globalData, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSTestActiveDOMObjectPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestActiveDOMObjectPrototype>(globalData.heap)) JSTestActiveDOMObjectPrototype(globalData, globalObject, structure); + ptr->finishCreation(globalData); + return ptr; + } + + static const JSC::ClassInfo s_info; + static bool getOwnPropertySlot(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); + static bool getOwnPropertyDescriptor(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); + static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(globalData, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), &s_info); + } + +private: + JSTestActiveDOMObjectPrototype(JSC::JSGlobalData& globalData, JSC::JSGlobalObject*, JSC::Structure* structure) : JSC::JSNonFinalObject(globalData, structure) { } +protected: + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; +}; + +class JSTestActiveDOMObjectConstructor : public DOMConstructorObject { +private: + JSTestActiveDOMObjectConstructor(JSC::Structure*, JSDOMGlobalObject*); + void finishCreation(JSC::ExecState*, JSDOMGlobalObject*); + +public: + typedef DOMConstructorObject Base; + static JSTestActiveDOMObjectConstructor* create(JSC::ExecState* exec, JSC::Structure* structure, JSDOMGlobalObject* globalObject) + { + JSTestActiveDOMObjectConstructor* ptr = new (NotNull, JSC::allocateCell<JSTestActiveDOMObjectConstructor>(*exec->heap())) JSTestActiveDOMObjectConstructor(structure, globalObject); + ptr->finishCreation(exec, globalObject); + return ptr; + } + + static bool getOwnPropertySlot(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); + static bool getOwnPropertyDescriptor(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); + static const JSC::ClassInfo s_info; + static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(globalData, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), &s_info); + } +protected: + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; +}; + +// Functions + +JSC::EncodedJSValue JSC_HOST_CALL jsTestActiveDOMObjectPrototypeFunctionExcitingFunction(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestActiveDOMObjectPrototypeFunctionPostMessage(JSC::ExecState*); +// Attributes + +JSC::JSValue jsTestActiveDOMObjectExcitingAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +JSC::JSValue jsTestActiveDOMObjectConstructor(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); + +} // namespace WebCore + +#endif diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp index 2f9e3508b..feb3e1f41 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp @@ -113,6 +113,8 @@ EncodedJSValue JSC_HOST_CALL JSTestEventConstructorConstructor::constructJSTestE bool fillTestEventConstructorInit(TestEventConstructorInit& eventInit, JSDictionary& dictionary) { + if (!dictionary.tryGetProperty("attr2", eventInit.attr2)) + return false; return true; } diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp new file mode 100644 index 000000000..e453a2532 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp @@ -0,0 +1,354 @@ +/* + 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 "JSTestEventTarget.h" + +#include "Event.h" +#include "ExceptionCode.h" +#include "JSDOMBinding.h" +#include "JSEvent.h" +#include "JSEventListener.h" +#include "JSNode.h" +#include "Node.h" +#include "TestEventTarget.h" +#include "wtf/text/AtomicString.h" +#include <runtime/Error.h> +#include <runtime/PropertyNameArray.h> +#include <wtf/GetPtr.h> + +using namespace JSC; + +namespace WebCore { + +ASSERT_CLASS_FITS_IN_CELL(JSTestEventTarget); +ASSERT_HAS_TRIVIAL_DESTRUCTOR(JSTestEventTarget); + +/* Hash table */ + +static const HashTableValue JSTestEventTargetTableValues[] = +{ + { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestEventTargetConstructor), (intptr_t)0, NoIntrinsic }, + { 0, 0, 0, 0, NoIntrinsic } +}; + +static const HashTable JSTestEventTargetTable = { 2, 1, JSTestEventTargetTableValues, 0 }; +/* Hash table for constructor */ + +static const HashTableValue JSTestEventTargetConstructorTableValues[] = +{ + { 0, 0, 0, 0, NoIntrinsic } +}; + +static const HashTable JSTestEventTargetConstructorTable = { 1, 0, JSTestEventTargetConstructorTableValues, 0 }; +ASSERT_HAS_TRIVIAL_DESTRUCTOR(JSTestEventTargetConstructor); + +const ClassInfo JSTestEventTargetConstructor::s_info = { "TestEventTargetConstructor", &Base::s_info, &JSTestEventTargetConstructorTable, 0, CREATE_METHOD_TABLE(JSTestEventTargetConstructor) }; + +JSTestEventTargetConstructor::JSTestEventTargetConstructor(Structure* structure, JSDOMGlobalObject* globalObject) + : DOMConstructorObject(structure, globalObject) +{ +} + +void JSTestEventTargetConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject) +{ + Base::finishCreation(exec->globalData()); + ASSERT(inherits(&s_info)); + putDirect(exec->globalData(), exec->propertyNames().prototype, JSTestEventTargetPrototype::self(exec, globalObject), DontDelete | ReadOnly); +} + +bool JSTestEventTargetConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot<JSTestEventTargetConstructor, JSDOMWrapper>(exec, &JSTestEventTargetConstructorTable, static_cast<JSTestEventTargetConstructor*>(cell), propertyName, slot); +} + +bool JSTestEventTargetConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor<JSTestEventTargetConstructor, JSDOMWrapper>(exec, &JSTestEventTargetConstructorTable, static_cast<JSTestEventTargetConstructor*>(object), propertyName, descriptor); +} + +/* Hash table for prototype */ + +static const HashTableValue JSTestEventTargetPrototypeTableValues[] = +{ + { "item", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestEventTargetPrototypeFunctionItem), (intptr_t)1, NoIntrinsic }, + { "addEventListener", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestEventTargetPrototypeFunctionAddEventListener), (intptr_t)3, NoIntrinsic }, + { "removeEventListener", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestEventTargetPrototypeFunctionRemoveEventListener), (intptr_t)3, NoIntrinsic }, + { "dispatchEvent", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestEventTargetPrototypeFunctionDispatchEvent), (intptr_t)1, NoIntrinsic }, + { 0, 0, 0, 0, NoIntrinsic } +}; + +static const HashTable JSTestEventTargetPrototypeTable = { 8, 7, JSTestEventTargetPrototypeTableValues, 0 }; +const ClassInfo JSTestEventTargetPrototype::s_info = { "TestEventTargetPrototype", &Base::s_info, &JSTestEventTargetPrototypeTable, 0, CREATE_METHOD_TABLE(JSTestEventTargetPrototype) }; + +JSObject* JSTestEventTargetPrototype::self(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMPrototype<JSTestEventTarget>(exec, globalObject); +} + +bool JSTestEventTargetPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + JSTestEventTargetPrototype* thisObject = jsCast<JSTestEventTargetPrototype*>(cell); + return getStaticFunctionSlot<JSObject>(exec, &JSTestEventTargetPrototypeTable, thisObject, propertyName, slot); +} + +bool JSTestEventTargetPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + JSTestEventTargetPrototype* thisObject = jsCast<JSTestEventTargetPrototype*>(object); + return getStaticFunctionDescriptor<JSObject>(exec, &JSTestEventTargetPrototypeTable, thisObject, propertyName, descriptor); +} + +const ClassInfo JSTestEventTarget::s_info = { "TestEventTarget", &Base::s_info, &JSTestEventTargetTable, 0 , CREATE_METHOD_TABLE(JSTestEventTarget) }; + +JSTestEventTarget::JSTestEventTarget(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestEventTarget> impl) + : JSDOMWrapper(structure, globalObject) + , m_impl(impl.leakRef()) +{ +} + +void JSTestEventTarget::finishCreation(JSGlobalData& globalData) +{ + Base::finishCreation(globalData); + ASSERT(inherits(&s_info)); +} + +JSObject* JSTestEventTarget::createPrototype(ExecState* exec, JSGlobalObject* globalObject) +{ + return JSTestEventTargetPrototype::create(exec->globalData(), globalObject, JSTestEventTargetPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype())); +} + +void JSTestEventTarget::destroy(JSC::JSCell* cell) +{ + JSTestEventTarget* thisObject = jsCast<JSTestEventTarget*>(cell); + thisObject->releaseImplIfNotNull(); +} + +bool JSTestEventTarget::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + JSTestEventTarget* thisObject = jsCast<JSTestEventTarget*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); + const HashEntry* entry = JSTestEventTargetTable.entry(exec, propertyName); + if (entry) { + slot.setCustom(thisObject, entry->propertyGetter()); + return true; + } + bool ok; + unsigned index = propertyName.toUInt32(ok); + if (ok && index < static_cast<TestEventTarget*>(thisObject->impl())->length()) { + slot.setCustomIndex(thisObject, index, indexGetter); + return true; + } + if (canGetItemsForName(exec, static_cast<TestEventTarget*>(thisObject->impl()), propertyName)) { + slot.setCustom(thisObject, thisObject->nameGetter); + return true; + } + return getStaticValueSlot<JSTestEventTarget, Base>(exec, &JSTestEventTargetTable, thisObject, propertyName, slot); +} + +bool JSTestEventTarget::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + JSTestEventTarget* thisObject = jsCast<JSTestEventTarget*>(object); + ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); + const HashEntry* entry = JSTestEventTargetTable.entry(exec, propertyName); + if (entry) { + PropertySlot slot; + slot.setCustom(thisObject, entry->propertyGetter()); + descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes()); + return true; + } + bool ok; + unsigned index = propertyName.toUInt32(ok); + if (ok && index < static_cast<TestEventTarget*>(thisObject->impl())->length()) { + PropertySlot slot; + slot.setCustomIndex(thisObject, index, indexGetter); + descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly); + return true; + } + if (canGetItemsForName(exec, static_cast<TestEventTarget*>(thisObject->impl()), propertyName)) { + PropertySlot slot; + slot.setCustom(thisObject, nameGetter); + descriptor.setDescriptor(slot.getValue(exec, propertyName), ReadOnly | DontDelete | DontEnum); + return true; + } + return getStaticValueDescriptor<JSTestEventTarget, Base>(exec, &JSTestEventTargetTable, thisObject, propertyName, descriptor); +} + +bool JSTestEventTarget::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, PropertySlot& slot) +{ + JSTestEventTarget* thisObject = jsCast<JSTestEventTarget*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); + if (propertyName < static_cast<TestEventTarget*>(thisObject->impl())->length()) { + slot.setCustomIndex(thisObject, propertyName, thisObject->indexGetter); + return true; + } + return thisObject->methodTable()->getOwnPropertySlot(thisObject, exec, Identifier::from(exec, propertyName), slot); +} + +JSValue jsTestEventTargetConstructor(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestEventTarget* domObject = static_cast<JSTestEventTarget*>(asObject(slotBase)); + return JSTestEventTarget::getConstructor(exec, domObject->globalObject()); +} + +void JSTestEventTarget::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) +{ + JSTestEventTarget* thisObject = jsCast<JSTestEventTarget*>(object); + ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); + for (unsigned i = 0; i < static_cast<TestEventTarget*>(thisObject->impl())->length(); ++i) + propertyNames.add(Identifier::from(exec, i)); + Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode); +} + +JSValue JSTestEventTarget::getConstructor(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMConstructor<JSTestEventTargetConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); +} + +EncodedJSValue JSC_HOST_CALL jsTestEventTargetPrototypeFunctionItem(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestEventTarget::s_info)) + return throwVMTypeError(exec); + JSTestEventTarget* castedThis = static_cast<JSTestEventTarget*>(asObject(thisValue)); + ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestEventTarget::s_info); + TestEventTarget* impl = static_cast<TestEventTarget*>(castedThis->impl()); + if (exec->argumentCount() < 1) + return throwVMError(exec, createTypeError(exec, "Not enough arguments")); + int index(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toUInt32(exec)); + if (index < 0) { + setDOMException(exec, INDEX_SIZE_ERR); + return JSValue::encode(jsUndefined()); + } + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + + JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->item(index))); + return JSValue::encode(result); +} + +EncodedJSValue JSC_HOST_CALL jsTestEventTargetPrototypeFunctionAddEventListener(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestEventTarget::s_info)) + return throwVMTypeError(exec); + JSTestEventTarget* castedThis = static_cast<JSTestEventTarget*>(asObject(thisValue)); + ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestEventTarget::s_info); + TestEventTarget* impl = static_cast<TestEventTarget*>(castedThis->impl()); + if (exec->argumentCount() < 2) + return throwVMError(exec, createTypeError(exec, "Not enough arguments")); + JSValue listener = exec->argument(1); + if (!listener.isObject()) + return JSValue::encode(jsUndefined()); + impl->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean(exec)); + return JSValue::encode(jsUndefined()); +} + +EncodedJSValue JSC_HOST_CALL jsTestEventTargetPrototypeFunctionRemoveEventListener(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestEventTarget::s_info)) + return throwVMTypeError(exec); + JSTestEventTarget* castedThis = static_cast<JSTestEventTarget*>(asObject(thisValue)); + ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestEventTarget::s_info); + TestEventTarget* impl = static_cast<TestEventTarget*>(castedThis->impl()); + if (exec->argumentCount() < 2) + return throwVMError(exec, createTypeError(exec, "Not enough arguments")); + JSValue listener = exec->argument(1); + if (!listener.isObject()) + return JSValue::encode(jsUndefined()); + impl->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec)); + return JSValue::encode(jsUndefined()); +} + +EncodedJSValue JSC_HOST_CALL jsTestEventTargetPrototypeFunctionDispatchEvent(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestEventTarget::s_info)) + return throwVMTypeError(exec); + JSTestEventTarget* castedThis = static_cast<JSTestEventTarget*>(asObject(thisValue)); + ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestEventTarget::s_info); + TestEventTarget* impl = static_cast<TestEventTarget*>(castedThis->impl()); + if (exec->argumentCount() < 1) + return throwVMError(exec, createTypeError(exec, "Not enough arguments")); + ExceptionCode ec = 0; + Event* evt(toEvent(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined))); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + + JSC::JSValue result = jsBoolean(impl->dispatchEvent(evt, ec)); + setDOMException(exec, ec); + return JSValue::encode(result); +} + +void JSTestEventTarget::visitChildren(JSCell* cell, SlotVisitor& visitor) +{ + JSTestEventTarget* thisObject = jsCast<JSTestEventTarget*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); + COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag); + ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren()); + Base::visitChildren(thisObject, visitor); + thisObject->impl()->visitJSEventListeners(visitor); +} + + +JSValue JSTestEventTarget::indexGetter(ExecState* exec, JSValue slotBase, unsigned index) +{ + JSTestEventTarget* thisObj = static_cast<JSTestEventTarget*>(asObject(slotBase)); + ASSERT_GC_OBJECT_INHERITS(thisObj, &s_info); + return toJS(exec, thisObj->globalObject(), static_cast<TestEventTarget*>(thisObj->impl())->item(index)); +} + +static inline bool isObservable(JSTestEventTarget* jsTestEventTarget) +{ + if (jsTestEventTarget->hasCustomProperties()) + return true; + if (jsTestEventTarget->impl()->hasEventListeners()) + return true; + return false; +} + +bool JSTestEventTargetOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor) +{ + JSTestEventTarget* jsTestEventTarget = static_cast<JSTestEventTarget*>(handle.get().asCell()); + if (!isObservable(jsTestEventTarget)) + return false; + UNUSED_PARAM(visitor); + return false; +} + +void JSTestEventTargetOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) +{ + JSTestEventTarget* jsTestEventTarget = static_cast<JSTestEventTarget*>(handle.get().asCell()); + DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); + uncacheWrapper(world, jsTestEventTarget->impl(), jsTestEventTarget); + jsTestEventTarget->releaseImpl(); +} + +JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestEventTarget* impl) +{ + return wrap<JSTestEventTarget>(exec, globalObject, impl); +} + +TestEventTarget* toTestEventTarget(JSC::JSValue value) +{ + return value.inherits(&JSTestEventTarget::s_info) ? static_cast<JSTestEventTarget*>(asObject(value))->impl() : 0; +} + +} diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.h b/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.h new file mode 100644 index 000000000..6fd4a3447 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.h @@ -0,0 +1,156 @@ +/* + 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 JSTestEventTarget_h +#define JSTestEventTarget_h + +#include "JSDOMBinding.h" +#include "TestEventTarget.h" +#include <runtime/JSGlobalObject.h> +#include <runtime/JSObject.h> +#include <runtime/ObjectPrototype.h> + +namespace WebCore { + +class JSTestEventTarget : public JSDOMWrapper { +public: + typedef JSDOMWrapper Base; + static JSTestEventTarget* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestEventTarget> impl) + { + JSTestEventTarget* ptr = new (NotNull, JSC::allocateCell<JSTestEventTarget>(globalObject->globalData().heap)) JSTestEventTarget(structure, globalObject, impl); + ptr->finishCreation(globalObject->globalData()); + return ptr; + } + + static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); + static bool getOwnPropertySlot(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); + static bool getOwnPropertyDescriptor(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); + static bool getOwnPropertySlotByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&); + static void destroy(JSC::JSCell*); + static const JSC::ClassInfo s_info; + + static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(globalData, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), &s_info); + } + + static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode mode = JSC::ExcludeDontEnumProperties); + static JSC::JSValue getConstructor(JSC::ExecState*, JSC::JSGlobalObject*); + static void visitChildren(JSCell*, JSC::SlotVisitor&); + + TestEventTarget* impl() const { return m_impl; } + void releaseImpl() { m_impl->deref(); m_impl = 0; } + + void releaseImplIfNotNull() { if (m_impl) { m_impl->deref(); m_impl = 0; } } + +private: + TestEventTarget* m_impl; +protected: + JSTestEventTarget(JSC::Structure*, JSDOMGlobalObject*, PassRefPtr<TestEventTarget>); + void finishCreation(JSC::JSGlobalData&); + static const unsigned StructureFlags = JSC::OverridesGetPropertyNames | JSC::OverridesGetOwnPropertySlot | JSC::OverridesVisitChildren | JSC::MasqueradesAsUndefined | Base::StructureFlags; + static JSC::JSValue indexGetter(JSC::ExecState*, JSC::JSValue, unsigned); +private: + static bool canGetItemsForName(JSC::ExecState*, TestEventTarget*, const JSC::Identifier&); + static JSC::JSValue nameGetter(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +}; + +class JSTestEventTargetOwner : public JSC::WeakHandleOwner { + virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&); + virtual void finalize(JSC::Handle<JSC::Unknown>, void* context); +}; + +inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld*, TestEventTarget*) +{ + DEFINE_STATIC_LOCAL(JSTestEventTargetOwner, jsTestEventTargetOwner, ()); + return &jsTestEventTargetOwner; +} + +inline void* wrapperContext(DOMWrapperWorld* world, TestEventTarget*) +{ + return world; +} + +JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestEventTarget*); +TestEventTarget* toTestEventTarget(JSC::JSValue); + +class JSTestEventTargetPrototype : public JSC::JSNonFinalObject { +public: + typedef JSC::JSNonFinalObject Base; + static JSC::JSObject* self(JSC::ExecState*, JSC::JSGlobalObject*); + static JSTestEventTargetPrototype* create(JSC::JSGlobalData& globalData, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSTestEventTargetPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestEventTargetPrototype>(globalData.heap)) JSTestEventTargetPrototype(globalData, globalObject, structure); + ptr->finishCreation(globalData); + return ptr; + } + + static const JSC::ClassInfo s_info; + static bool getOwnPropertySlot(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); + static bool getOwnPropertyDescriptor(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); + static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(globalData, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), &s_info); + } + +private: + JSTestEventTargetPrototype(JSC::JSGlobalData& globalData, JSC::JSGlobalObject*, JSC::Structure* structure) : JSC::JSNonFinalObject(globalData, structure) { } +protected: + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::OverridesVisitChildren | Base::StructureFlags; +}; + +class JSTestEventTargetConstructor : public DOMConstructorObject { +private: + JSTestEventTargetConstructor(JSC::Structure*, JSDOMGlobalObject*); + void finishCreation(JSC::ExecState*, JSDOMGlobalObject*); + +public: + typedef DOMConstructorObject Base; + static JSTestEventTargetConstructor* create(JSC::ExecState* exec, JSC::Structure* structure, JSDOMGlobalObject* globalObject) + { + JSTestEventTargetConstructor* ptr = new (NotNull, JSC::allocateCell<JSTestEventTargetConstructor>(*exec->heap())) JSTestEventTargetConstructor(structure, globalObject); + ptr->finishCreation(exec, globalObject); + return ptr; + } + + static bool getOwnPropertySlot(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); + static bool getOwnPropertyDescriptor(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); + static const JSC::ClassInfo s_info; + static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(globalData, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), &s_info); + } +protected: + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; +}; + +// Functions + +JSC::EncodedJSValue JSC_HOST_CALL jsTestEventTargetPrototypeFunctionItem(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestEventTargetPrototypeFunctionAddEventListener(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestEventTargetPrototypeFunctionRemoveEventListener(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestEventTargetPrototypeFunctionDispatchEvent(JSC::ExecState*); +// Attributes + +JSC::JSValue jsTestEventTargetConstructor(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); + +} // namespace WebCore + +#endif diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp index b226e59d6..fa54a33e9 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp @@ -26,7 +26,10 @@ #include "ExceptionCode.h" #include "JSDOMBinding.h" +#include "JSTestInterfaceCustom.h" +#include "JSTestObj.h" #include "TestInterface.h" +#include "TestObj.h" #include "TestSupplemental.h" #include <runtime/Error.h> #include <wtf/GetPtr.h> @@ -48,19 +51,19 @@ ASSERT_HAS_TRIVIAL_DESTRUCTOR(JSTestInterface); static const HashTableValue JSTestInterfaceTableValues[] = { #if ENABLE(Condition11) || ENABLE(Condition12) - { "str1", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceStr1), (intptr_t)0, NoIntrinsic }, + { "supplementalStr1", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceSupplementalStr1), (intptr_t)0, NoIntrinsic }, #endif #if ENABLE(Condition11) || ENABLE(Condition12) - { "str2", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceStr2), (intptr_t)setJSTestInterfaceStr2, NoIntrinsic }, + { "supplementalStr2", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceSupplementalStr2), (intptr_t)setJSTestInterfaceSupplementalStr2, NoIntrinsic }, #endif #if ENABLE(Condition11) || ENABLE(Condition12) - { "str3", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceStr3), (intptr_t)setJSTestInterfaceStr3, NoIntrinsic }, + { "supplementalStr3", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceSupplementalStr3), (intptr_t)setJSTestInterfaceSupplementalStr3, NoIntrinsic }, #endif { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceConstructor), (intptr_t)0, NoIntrinsic }, { 0, 0, 0, 0, NoIntrinsic } }; -static const HashTable JSTestInterfaceTable = { 8, 7, JSTestInterfaceTableValues, 0 }; +static const HashTable JSTestInterfaceTable = { 9, 7, JSTestInterfaceTableValues, 0 }; /* Hash table for constructor */ static const HashTableValue JSTestInterfaceConstructorTableValues[] = @@ -128,10 +131,16 @@ ConstructType JSTestInterfaceConstructor::getConstructData(JSCell*, ConstructDat static const HashTableValue JSTestInterfacePrototypeTableValues[] = { +#if ENABLE(Condition11) || ENABLE(Condition12) + { "supplementalMethod1", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestInterfacePrototypeFunctionSupplementalMethod1), (intptr_t)0, NoIntrinsic }, +#endif +#if ENABLE(Condition11) || ENABLE(Condition12) + { "supplementalMethod2", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestInterfacePrototypeFunctionSupplementalMethod2), (intptr_t)2, NoIntrinsic }, +#endif { 0, 0, 0, 0, NoIntrinsic } }; -static const HashTable JSTestInterfacePrototypeTable = { 1, 0, JSTestInterfacePrototypeTableValues, 0 }; +static const HashTable JSTestInterfacePrototypeTable = { 5, 3, JSTestInterfacePrototypeTableValues, 0 }; const ClassInfo JSTestInterfacePrototype::s_info = { "TestInterfacePrototype", &Base::s_info, &JSTestInterfacePrototypeTable, 0, CREATE_METHOD_TABLE(JSTestInterfacePrototype) }; JSObject* JSTestInterfacePrototype::self(ExecState* exec, JSGlobalObject* globalObject) @@ -139,6 +148,18 @@ JSObject* JSTestInterfacePrototype::self(ExecState* exec, JSGlobalObject* global return getDOMPrototype<JSTestInterface>(exec, globalObject); } +bool JSTestInterfacePrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + JSTestInterfacePrototype* thisObject = jsCast<JSTestInterfacePrototype*>(cell); + return getStaticFunctionSlot<JSObject>(exec, &JSTestInterfacePrototypeTable, thisObject, propertyName, slot); +} + +bool JSTestInterfacePrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + JSTestInterfacePrototype* thisObject = jsCast<JSTestInterfacePrototype*>(object); + return getStaticFunctionDescriptor<JSObject>(exec, &JSTestInterfacePrototypeTable, thisObject, propertyName, descriptor); +} + const ClassInfo JSTestInterface::s_info = { "TestInterface", &Base::s_info, &JSTestInterfaceTable, 0 , CREATE_METHOD_TABLE(JSTestInterface) }; JSTestInterface::JSTestInterface(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestInterface> impl) @@ -179,35 +200,35 @@ bool JSTestInterface::getOwnPropertyDescriptor(JSObject* object, ExecState* exec } #if ENABLE(Condition11) || ENABLE(Condition12) -JSValue jsTestInterfaceStr1(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue jsTestInterfaceSupplementalStr1(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestInterface* castedThis = static_cast<JSTestInterface*>(asObject(slotBase)); UNUSED_PARAM(exec); TestInterface* impl = static_cast<TestInterface*>(castedThis->impl()); - JSValue result = jsString(exec, TestSupplemental::str1(impl)); + JSValue result = jsString(exec, TestSupplemental::supplementalStr1(impl)); return result; } #endif #if ENABLE(Condition11) || ENABLE(Condition12) -JSValue jsTestInterfaceStr2(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue jsTestInterfaceSupplementalStr2(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestInterface* castedThis = static_cast<JSTestInterface*>(asObject(slotBase)); UNUSED_PARAM(exec); TestInterface* impl = static_cast<TestInterface*>(castedThis->impl()); - JSValue result = jsString(exec, TestSupplemental::str2(impl)); + JSValue result = jsString(exec, TestSupplemental::supplementalStr2(impl)); return result; } #endif #if ENABLE(Condition11) || ENABLE(Condition12) -JSValue jsTestInterfaceStr3(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue jsTestInterfaceSupplementalStr3(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestInterface* castedThis = static_cast<JSTestInterface*>(asObject(slotBase)); TestInterface* impl = static_cast<TestInterface*>(castedThis->impl()); - return castedThis->str3(impl, exec); + return castedThis->supplementalStr3(impl, exec); } #endif @@ -222,25 +243,27 @@ void JSTestInterface::put(JSCell* cell, ExecState* exec, const Identifier& prope { JSTestInterface* thisObject = jsCast<JSTestInterface*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); + if (thisObject->putDelegate(exec, propertyName, value, slot)) + return; lookupPut<JSTestInterface, Base>(exec, propertyName, value, &JSTestInterfaceTable, thisObject, slot); } #if ENABLE(Condition11) || ENABLE(Condition12) -void setJSTestInterfaceStr2(ExecState* exec, JSObject* thisObject, JSValue value) +void setJSTestInterfaceSupplementalStr2(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestInterface* castedThis = static_cast<JSTestInterface*>(thisObject); TestInterface* impl = static_cast<TestInterface*>(castedThis->impl()); - TestSupplemental::setStr2(impl, ustringToString(value.isEmpty() ? UString() : value.toString(exec))); + TestSupplemental::setSupplementalStr2(impl, ustringToString(value.isEmpty() ? UString() : value.toString(exec))); } #endif #if ENABLE(Condition11) || ENABLE(Condition12) -void setJSTestInterfaceStr3(ExecState* exec, JSObject* thisObject, JSValue value) +void setJSTestInterfaceSupplementalStr3(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestInterface* castedThis = static_cast<JSTestInterface*>(thisObject); TestInterface* impl = static_cast<TestInterface*>(castedThis->impl()); - castedThis->setStr3(impl, exec, value); + castedThis->setSupplementalStr3(impl, exec, value); } #endif @@ -250,6 +273,50 @@ JSValue JSTestInterface::getConstructor(ExecState* exec, JSGlobalObject* globalO return getDOMConstructor<JSTestInterfaceConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); } +#if ENABLE(Condition11) || ENABLE(Condition12) +EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod1(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestInterface::s_info)) + return throwVMTypeError(exec); + JSTestInterface* castedThis = static_cast<JSTestInterface*>(asObject(thisValue)); + ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestInterface::s_info); + TestInterface* impl = static_cast<TestInterface*>(castedThis->impl()); + TestSupplemental::supplementalMethod1(impl); + return JSValue::encode(jsUndefined()); +} + +#endif + +#if ENABLE(Condition11) || ENABLE(Condition12) +EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod2(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestInterface::s_info)) + return throwVMTypeError(exec); + JSTestInterface* castedThis = static_cast<JSTestInterface*>(asObject(thisValue)); + ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestInterface::s_info); + TestInterface* impl = static_cast<TestInterface*>(castedThis->impl()); + if (exec->argumentCount() < 2) + return throwVMError(exec, createTypeError(exec, "Not enough arguments")); + ExceptionCode ec = 0; + ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext(); + if (!scriptContext) + return JSValue::encode(jsUndefined()); + const String& strArg(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec))); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + TestObj* objArg(toTestObj(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined))); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + + JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(TestSupplemental::supplementalMethod2(impl, scriptContext, strArg, objArg, ec))); + setDOMException(exec, ec); + return JSValue::encode(result); +} + +#endif + static inline bool isObservable(JSTestInterface* jsTestInterface) { if (jsTestInterface->hasCustomProperties()) diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h index dc38ad7ef..ec94eed36 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h @@ -45,6 +45,7 @@ public: static bool getOwnPropertySlot(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); static bool getOwnPropertyDescriptor(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); static void put(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&); + bool putDelegate(JSC::ExecState*, const JSC::Identifier&, JSC::JSValue, JSC::PutPropertySlot&); static void destroy(JSC::JSCell*); static const JSC::ClassInfo s_info; @@ -56,7 +57,7 @@ public: static JSC::JSValue getConstructor(JSC::ExecState*, JSC::JSGlobalObject*); // Custom attributes - JSC::JSValue str3(TestInterface*, JSC::ExecState*) const; + JSC::JSValue supplementalStr3(TestInterface*, JSC::ExecState*) const; TestInterface* impl() const { return m_impl; } void releaseImpl() { m_impl->deref(); m_impl = 0; } @@ -101,6 +102,8 @@ public: } static const JSC::ClassInfo s_info; + static bool getOwnPropertySlot(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); + static bool getOwnPropertyDescriptor(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) { return JSC::Structure::create(globalData, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), &s_info); @@ -109,7 +112,7 @@ public: private: JSTestInterfacePrototype(JSC::JSGlobalData& globalData, JSC::JSGlobalObject*, JSC::Structure* structure) : JSC::JSNonFinalObject(globalData, structure) { } protected: - static const unsigned StructureFlags = Base::StructureFlags; + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; }; class JSTestInterfaceConstructor : public DOMConstructorObject { @@ -139,13 +142,17 @@ protected: static JSC::ConstructType getConstructData(JSC::JSCell*, JSC::ConstructData&); }; +// Functions + +JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod1(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod2(JSC::ExecState*); // Attributes -JSC::JSValue jsTestInterfaceStr1(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); -JSC::JSValue jsTestInterfaceStr2(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); -void setJSTestInterfaceStr2(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); -JSC::JSValue jsTestInterfaceStr3(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); -void setJSTestInterfaceStr3(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestInterfaceSupplementalStr1(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +JSC::JSValue jsTestInterfaceSupplementalStr2(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestInterfaceSupplementalStr2(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestInterfaceSupplementalStr3(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestInterfaceSupplementalStr3(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestInterfaceConstructor(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); } // namespace WebCore diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp index 2e5c1b263..e91a11403 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp @@ -21,24 +21,37 @@ #include "config.h" #include "JSTestObj.h" +#include "Document.h" #include "ExceptionCode.h" #include "HTMLNames.h" #include "IDBBindingUtilities.h" #include "IDBKey.h" #include "JSDOMBinding.h" #include "JSDOMStringList.h" +#include "JSDocument.h" #include "JSEventListener.h" #include "JSOptionsObject.h" +#include "JSSVGDocument.h" +#include "JSSVGPoint.h" #include "JSTestCallback.h" #include "JSTestObj.h" +#include "JSa.h" +#include "JSb.h" +#include "JSbool.h" +#include "JSc.h" +#include "JSd.h" +#include "JSe.h" +#include "JSint.h" #include "JSlog.h" #include "KURL.h" +#include "SVGDocument.h" +#include "SVGStaticPropertyTearOff.h" #include "ScriptArguments.h" #include "ScriptCallStack.h" #include "ScriptCallStackFactory.h" -#include "ScriptController.h" #include "SerializedScriptValue.h" #include "TestObj.h" +#include "bool.h" #include <runtime/Error.h> #include <runtime/JSString.h> #include <wtf/GetPtr.h> @@ -115,6 +128,10 @@ static const HashTableValue JSTestObjTableValues[] = #endif { "cachedAttribute1", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCachedAttribute1), (intptr_t)0, NoIntrinsic }, { "cachedAttribute2", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCachedAttribute2), (intptr_t)0, NoIntrinsic }, + { "contentDocument", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjContentDocument), (intptr_t)0, NoIntrinsic }, + { "mutablePoint", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjMutablePoint), (intptr_t)setJSTestObjMutablePoint, NoIntrinsic }, + { "immutablePoint", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjImmutablePoint), (intptr_t)setJSTestObjImmutablePoint, NoIntrinsic }, + { "strictFloat", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjStrictFloat), (intptr_t)setJSTestObjStrictFloat, NoIntrinsic }, { "description", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjDescription), (intptr_t)0, NoIntrinsic }, { "id", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjId), (intptr_t)setJSTestObjId, NoIntrinsic }, { "hash", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjHash), (intptr_t)0, NoIntrinsic }, @@ -122,7 +139,7 @@ static const HashTableValue JSTestObjTableValues[] = { 0, 0, 0, 0, NoIntrinsic } }; -static const HashTable JSTestObjTable = { 135, 127, JSTestObjTableValues, 0 }; +static const HashTable JSTestObjTable = { 136, 127, JSTestObjTableValues, 0 }; /* Hash table for constructor */ static const HashTableValue JSTestObjConstructorTableValues[] = @@ -242,11 +259,6 @@ static const HashTableValue JSTestObjPrototypeTableValues[] = { "customArgsAndException", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionCustomArgsAndException), (intptr_t)1, NoIntrinsic }, { "addEventListener", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionAddEventListener), (intptr_t)3, NoIntrinsic }, { "removeEventListener", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionRemoveEventListener), (intptr_t)3, NoIntrinsic }, - { "withDynamicFrame", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrame), (intptr_t)0, NoIntrinsic }, - { "withDynamicFrameAndArg", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrameAndArg), (intptr_t)1, NoIntrinsic }, - { "withDynamicFrameAndOptionalArg", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg), (intptr_t)2, NoIntrinsic }, - { "withDynamicFrameAndUserGesture", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture), (intptr_t)1, NoIntrinsic }, - { "withDynamicFrameAndUserGestureASAD", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD), (intptr_t)2, NoIntrinsic }, { "withScriptStateVoid", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateVoid), (intptr_t)0, NoIntrinsic }, { "withScriptStateObj", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateObj), (intptr_t)0, NoIntrinsic }, { "withScriptStateVoidException", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateVoidException), (intptr_t)0, NoIntrinsic }, @@ -268,10 +280,20 @@ static const HashTableValue JSTestObjPrototypeTableValues[] = { "conditionalMethod3", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionConditionalMethod3), (intptr_t)0, NoIntrinsic }, #endif { "overloadedMethod", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionOverloadedMethod), (intptr_t)2, NoIntrinsic }, + { "getSVGDocument", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionGetSVGDocument), (intptr_t)0, NoIntrinsic }, + { "convert1", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionConvert1), (intptr_t)1, NoIntrinsic }, + { "convert2", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionConvert2), (intptr_t)1, NoIntrinsic }, + { "convert3", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionConvert3), (intptr_t)1, NoIntrinsic }, + { "convert4", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionConvert4), (intptr_t)1, NoIntrinsic }, + { "convert5", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionConvert5), (intptr_t)1, NoIntrinsic }, + { "mutablePointFunction", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMutablePointFunction), (intptr_t)0, NoIntrinsic }, + { "immutablePointFunction", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionImmutablePointFunction), (intptr_t)0, NoIntrinsic }, + { "orange", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionOrange), (intptr_t)0, NoIntrinsic }, + { "strictFunction", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionStrictFunction), (intptr_t)3, NoIntrinsic }, { 0, 0, 0, 0, NoIntrinsic } }; -static const HashTable JSTestObjPrototypeTable = { 137, 127, JSTestObjPrototypeTableValues, 0 }; +static const HashTable JSTestObjPrototypeTable = { 138, 127, JSTestObjPrototypeTableValues, 0 }; const ClassInfo JSTestObjPrototype::s_info = { "TestObjPrototype", &Base::s_info, &JSTestObjPrototypeTable, 0, CREATE_METHOD_TABLE(JSTestObjPrototype) }; JSObject* JSTestObjPrototype::self(ExecState* exec, JSGlobalObject* globalObject) @@ -708,6 +730,44 @@ JSValue jsTestObjCachedAttribute2(ExecState* exec, JSValue slotBase, const Ident } +JSValue jsTestObjContentDocument(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + return allowAccessToNode(exec, impl->contentDocument()) ? toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->contentDocument())) : jsUndefined(); +} + + +JSValue jsTestObjMutablePoint(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGStaticPropertyTearOff<TestObj, FloatPoint>::create(impl, impl->mutablePoint(), &TestObj::updateMutablePoint))); + return result; +} + + +JSValue jsTestObjImmutablePoint(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<FloatPoint>::create(impl->immutablePoint()))); + return result; +} + + +JSValue jsTestObjStrictFloat(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsNumber(impl->strictFloat()); + return result; +} + + JSValue jsTestObjDescription(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); @@ -1014,6 +1074,30 @@ void setJSTestObjConditionalAttr6Constructor(ExecState* exec, JSObject* thisObje #endif +void setJSTestObjMutablePoint(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + impl->setMutablePoint(toSVGPoint(value)); +} + + +void setJSTestObjImmutablePoint(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + impl->setImmutablePoint(toSVGPoint(value)); +} + + +void setJSTestObjStrictFloat(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + impl->setStrictFloat(value.toFloat(exec)); +} + + void setJSTestObjId(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); @@ -1309,121 +1393,6 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionRemoveEventListener(ExecS return JSValue::encode(jsUndefined()); } -EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(ExecState* exec) -{ - JSValue thisValue = exec->hostThisValue(); - if (!thisValue.inherits(&JSTestObj::s_info)) - return throwVMTypeError(exec); - JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); - ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); - TestObj* impl = static_cast<TestObj*>(castedThis->impl()); - Frame* dynamicFrame = toDynamicFrame(exec); - if (!dynamicFrame) - return JSValue::encode(jsUndefined()); - impl->withDynamicFrame(dynamicFrame); - return JSValue::encode(jsUndefined()); -} - -EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(ExecState* exec) -{ - JSValue thisValue = exec->hostThisValue(); - if (!thisValue.inherits(&JSTestObj::s_info)) - return throwVMTypeError(exec); - JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); - ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); - TestObj* impl = static_cast<TestObj*>(castedThis->impl()); - if (exec->argumentCount() < 1) - return throwVMError(exec, createTypeError(exec, "Not enough arguments")); - Frame* dynamicFrame = toDynamicFrame(exec); - if (!dynamicFrame) - return JSValue::encode(jsUndefined()); - int intArg(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toInt32(exec)); - if (exec->hadException()) - return JSValue::encode(jsUndefined()); - impl->withDynamicFrameAndArg(dynamicFrame, intArg); - return JSValue::encode(jsUndefined()); -} - -EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(ExecState* exec) -{ - JSValue thisValue = exec->hostThisValue(); - if (!thisValue.inherits(&JSTestObj::s_info)) - return throwVMTypeError(exec); - JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); - ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); - TestObj* impl = static_cast<TestObj*>(castedThis->impl()); - if (exec->argumentCount() < 1) - return throwVMError(exec, createTypeError(exec, "Not enough arguments")); - Frame* dynamicFrame = toDynamicFrame(exec); - if (!dynamicFrame) - return JSValue::encode(jsUndefined()); - int intArg(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toInt32(exec)); - if (exec->hadException()) - return JSValue::encode(jsUndefined()); - - size_t argsCount = exec->argumentCount(); - if (argsCount <= 1) { - impl->withDynamicFrameAndOptionalArg(dynamicFrame, intArg); - return JSValue::encode(jsUndefined()); - } - - int optionalArg(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toInt32(exec)); - if (exec->hadException()) - return JSValue::encode(jsUndefined()); - impl->withDynamicFrameAndOptionalArg(dynamicFrame, intArg, optionalArg); - return JSValue::encode(jsUndefined()); -} - -EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(ExecState* exec) -{ - JSValue thisValue = exec->hostThisValue(); - if (!thisValue.inherits(&JSTestObj::s_info)) - return throwVMTypeError(exec); - JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); - ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); - TestObj* impl = static_cast<TestObj*>(castedThis->impl()); - if (exec->argumentCount() < 1) - return throwVMError(exec, createTypeError(exec, "Not enough arguments")); - Frame* dynamicFrame = toDynamicFrame(exec); - if (!dynamicFrame) - return JSValue::encode(jsUndefined()); - int intArg(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toInt32(exec)); - if (exec->hadException()) - return JSValue::encode(jsUndefined()); - impl->withDynamicFrameAndUserGesture(dynamicFrame, intArg, ScriptController::processingUserGesture()); - return JSValue::encode(jsUndefined()); -} - -EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(ExecState* exec) -{ - JSValue thisValue = exec->hostThisValue(); - if (!thisValue.inherits(&JSTestObj::s_info)) - return throwVMTypeError(exec); - JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); - ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); - TestObj* impl = static_cast<TestObj*>(castedThis->impl()); - if (exec->argumentCount() < 1) - return throwVMError(exec, createTypeError(exec, "Not enough arguments")); - Frame* dynamicFrame = toDynamicFrame(exec); - if (!dynamicFrame) - return JSValue::encode(jsUndefined()); - int intArg(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toInt32(exec)); - if (exec->hadException()) - return JSValue::encode(jsUndefined()); - - size_t argsCount = exec->argumentCount(); - if (argsCount <= 1) { - impl->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg); - return JSValue::encode(jsUndefined()); - } - - int optionalArg(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toInt32(exec)); - if (exec->hadException()) - return JSValue::encode(jsUndefined()); - impl->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg, optionalArg, ScriptController::processingUserGesture()); - return JSValue::encode(jsUndefined()); -} - EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); @@ -1907,6 +1876,174 @@ EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionOverloadedMethod1(ExecS #endif +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionGetSVGDocument(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwVMTypeError(exec); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + ExceptionCode ec = 0; + if (!allowAccessToNode(exec, impl->getSVGDocument(ec))) + return JSValue::encode(jsUndefined()); + + JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->getSVGDocument(ec))); + setDOMException(exec, ec); + return JSValue::encode(result); +} + +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConvert1(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwVMTypeError(exec); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + if (exec->argumentCount() < 1) + return throwVMError(exec, createTypeError(exec, "Not enough arguments")); + a* (toa(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined))); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + impl->convert1(); + return JSValue::encode(jsUndefined()); +} + +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConvert2(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwVMTypeError(exec); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + if (exec->argumentCount() < 1) + return throwVMError(exec, createTypeError(exec, "Not enough arguments")); + b* (tob(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined))); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + impl->convert2(); + return JSValue::encode(jsUndefined()); +} + +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConvert3(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwVMTypeError(exec); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + if (exec->argumentCount() < 1) + return throwVMError(exec, createTypeError(exec, "Not enough arguments")); + c* (toc(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined))); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + impl->convert3(); + return JSValue::encode(jsUndefined()); +} + +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConvert4(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwVMTypeError(exec); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + if (exec->argumentCount() < 1) + return throwVMError(exec, createTypeError(exec, "Not enough arguments")); + d* (tod(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined))); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + impl->convert4(); + return JSValue::encode(jsUndefined()); +} + +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConvert5(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwVMTypeError(exec); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + if (exec->argumentCount() < 1) + return throwVMError(exec, createTypeError(exec, "Not enough arguments")); + e* (toe(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined))); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + impl->convert5(); + return JSValue::encode(jsUndefined()); +} + +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMutablePointFunction(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwVMTypeError(exec); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + + JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<FloatPoint>::create(impl->mutablePointFunction()))); + return JSValue::encode(result); +} + +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionImmutablePointFunction(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwVMTypeError(exec); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + + JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<FloatPoint>::create(impl->immutablePointFunction()))); + return JSValue::encode(result); +} + +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOrange(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwVMTypeError(exec); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + impl->banana(); + return JSValue::encode(jsUndefined()); +} + +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionStrictFunction(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwVMTypeError(exec); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + if (exec->argumentCount() < 3) + return throwVMError(exec, createTypeError(exec, "Not enough arguments")); + ExceptionCode ec = 0; + const String& str(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec))); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + float a(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toFloat(exec)); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + if (exec->argumentCount() > 2 && !exec->argument(2).isUndefinedOrNull() && !exec->argument(2).inherits(&JSint::s_info)) + return throwVMTypeError(exec); + int* b(toint(MAYBE_MISSING_PARAMETER(exec, 2, MissingIsUndefined))); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + + JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->strictFunction(str, a, b, ec))); + setDOMException(exec, ec); + return JSValue::encode(result); +} + void JSTestObj::visitChildren(JSCell* cell, SlotVisitor& visitor) { JSTestObj* thisObject = jsCast<JSTestObj*>(cell); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h index fa73139c8..ae4041de6 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h @@ -166,11 +166,6 @@ JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionRemoveEventListener(JSC::ExecState*); -JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(JSC::ExecState*); -JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(JSC::ExecState*); -JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(JSC::ExecState*); -JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(JSC::ExecState*); -JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoidException(JSC::ExecState*); @@ -189,6 +184,16 @@ JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(JSC JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionClassMethod(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionClassMethodWithOptional(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionOverloadedMethod1(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionGetSVGDocument(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConvert1(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConvert2(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConvert3(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConvert4(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConvert5(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMutablePointFunction(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionImmutablePointFunction(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOrange(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionStrictFunction(JSC::ExecState*); // Attributes JSC::JSValue jsTestObjReadOnlyIntAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); @@ -259,6 +264,13 @@ JSC::JSValue jsTestObjConditionalAttr6Constructor(JSC::ExecState*, JSC::JSValue, void setJSTestObjConditionalAttr6Constructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjCachedAttribute1(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); JSC::JSValue jsTestObjCachedAttribute2(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +JSC::JSValue jsTestObjContentDocument(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +JSC::JSValue jsTestObjMutablePoint(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjMutablePoint(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjImmutablePoint(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjImmutablePoint(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjStrictFloat(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjStrictFloat(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjDescription(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); JSC::JSValue jsTestObjId(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); void setJSTestObjId(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestOverridingNameGetter.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestOverridingNameGetter.cpp new file mode 100644 index 000000000..1d87ea91c --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestOverridingNameGetter.cpp @@ -0,0 +1,220 @@ +/* + 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 "JSTestOverridingNameGetter.h" + +#include "ExceptionCode.h" +#include "JSDOMBinding.h" +#include "TestOverridingNameGetter.h" +#include "wtf/text/AtomicString.h" +#include <runtime/Error.h> +#include <wtf/GetPtr.h> + +using namespace JSC; + +namespace WebCore { + +ASSERT_CLASS_FITS_IN_CELL(JSTestOverridingNameGetter); +ASSERT_HAS_TRIVIAL_DESTRUCTOR(JSTestOverridingNameGetter); + +/* Hash table */ + +static const HashTableValue JSTestOverridingNameGetterTableValues[] = +{ + { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestOverridingNameGetterConstructor), (intptr_t)0, NoIntrinsic }, + { 0, 0, 0, 0, NoIntrinsic } +}; + +static const HashTable JSTestOverridingNameGetterTable = { 2, 1, JSTestOverridingNameGetterTableValues, 0 }; +/* Hash table for constructor */ + +static const HashTableValue JSTestOverridingNameGetterConstructorTableValues[] = +{ + { 0, 0, 0, 0, NoIntrinsic } +}; + +static const HashTable JSTestOverridingNameGetterConstructorTable = { 1, 0, JSTestOverridingNameGetterConstructorTableValues, 0 }; +ASSERT_HAS_TRIVIAL_DESTRUCTOR(JSTestOverridingNameGetterConstructor); + +const ClassInfo JSTestOverridingNameGetterConstructor::s_info = { "TestOverridingNameGetterConstructor", &Base::s_info, &JSTestOverridingNameGetterConstructorTable, 0, CREATE_METHOD_TABLE(JSTestOverridingNameGetterConstructor) }; + +JSTestOverridingNameGetterConstructor::JSTestOverridingNameGetterConstructor(Structure* structure, JSDOMGlobalObject* globalObject) + : DOMConstructorObject(structure, globalObject) +{ +} + +void JSTestOverridingNameGetterConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject) +{ + Base::finishCreation(exec->globalData()); + ASSERT(inherits(&s_info)); + putDirect(exec->globalData(), exec->propertyNames().prototype, JSTestOverridingNameGetterPrototype::self(exec, globalObject), DontDelete | ReadOnly); +} + +bool JSTestOverridingNameGetterConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot<JSTestOverridingNameGetterConstructor, JSDOMWrapper>(exec, &JSTestOverridingNameGetterConstructorTable, static_cast<JSTestOverridingNameGetterConstructor*>(cell), propertyName, slot); +} + +bool JSTestOverridingNameGetterConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor<JSTestOverridingNameGetterConstructor, JSDOMWrapper>(exec, &JSTestOverridingNameGetterConstructorTable, static_cast<JSTestOverridingNameGetterConstructor*>(object), propertyName, descriptor); +} + +/* Hash table for prototype */ + +static const HashTableValue JSTestOverridingNameGetterPrototypeTableValues[] = +{ + { "anotherFunction", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestOverridingNameGetterPrototypeFunctionAnotherFunction), (intptr_t)1, NoIntrinsic }, + { 0, 0, 0, 0, NoIntrinsic } +}; + +static const HashTable JSTestOverridingNameGetterPrototypeTable = { 2, 1, JSTestOverridingNameGetterPrototypeTableValues, 0 }; +const ClassInfo JSTestOverridingNameGetterPrototype::s_info = { "TestOverridingNameGetterPrototype", &Base::s_info, &JSTestOverridingNameGetterPrototypeTable, 0, CREATE_METHOD_TABLE(JSTestOverridingNameGetterPrototype) }; + +JSObject* JSTestOverridingNameGetterPrototype::self(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMPrototype<JSTestOverridingNameGetter>(exec, globalObject); +} + +bool JSTestOverridingNameGetterPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + JSTestOverridingNameGetterPrototype* thisObject = jsCast<JSTestOverridingNameGetterPrototype*>(cell); + return getStaticFunctionSlot<JSObject>(exec, &JSTestOverridingNameGetterPrototypeTable, thisObject, propertyName, slot); +} + +bool JSTestOverridingNameGetterPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + JSTestOverridingNameGetterPrototype* thisObject = jsCast<JSTestOverridingNameGetterPrototype*>(object); + return getStaticFunctionDescriptor<JSObject>(exec, &JSTestOverridingNameGetterPrototypeTable, thisObject, propertyName, descriptor); +} + +const ClassInfo JSTestOverridingNameGetter::s_info = { "TestOverridingNameGetter", &Base::s_info, &JSTestOverridingNameGetterTable, 0 , CREATE_METHOD_TABLE(JSTestOverridingNameGetter) }; + +JSTestOverridingNameGetter::JSTestOverridingNameGetter(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestOverridingNameGetter> impl) + : JSDOMWrapper(structure, globalObject) + , m_impl(impl.leakRef()) +{ +} + +void JSTestOverridingNameGetter::finishCreation(JSGlobalData& globalData) +{ + Base::finishCreation(globalData); + ASSERT(inherits(&s_info)); +} + +JSObject* JSTestOverridingNameGetter::createPrototype(ExecState* exec, JSGlobalObject* globalObject) +{ + return JSTestOverridingNameGetterPrototype::create(exec->globalData(), globalObject, JSTestOverridingNameGetterPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype())); +} + +void JSTestOverridingNameGetter::destroy(JSC::JSCell* cell) +{ + JSTestOverridingNameGetter* thisObject = jsCast<JSTestOverridingNameGetter*>(cell); + thisObject->releaseImplIfNotNull(); +} + +bool JSTestOverridingNameGetter::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + JSTestOverridingNameGetter* thisObject = jsCast<JSTestOverridingNameGetter*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); + if (canGetItemsForName(exec, static_cast<TestOverridingNameGetter*>(thisObject->impl()), propertyName)) { + slot.setCustom(thisObject, thisObject->nameGetter); + return true; + } + return getStaticValueSlot<JSTestOverridingNameGetter, Base>(exec, &JSTestOverridingNameGetterTable, thisObject, propertyName, slot); +} + +bool JSTestOverridingNameGetter::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + JSTestOverridingNameGetter* thisObject = jsCast<JSTestOverridingNameGetter*>(object); + ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); + if (canGetItemsForName(exec, static_cast<TestOverridingNameGetter*>(thisObject->impl()), propertyName)) { + PropertySlot slot; + slot.setCustom(thisObject, nameGetter); + descriptor.setDescriptor(slot.getValue(exec, propertyName), ReadOnly | DontDelete | DontEnum); + return true; + } + return getStaticValueDescriptor<JSTestOverridingNameGetter, Base>(exec, &JSTestOverridingNameGetterTable, thisObject, propertyName, descriptor); +} + +JSValue jsTestOverridingNameGetterConstructor(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestOverridingNameGetter* domObject = static_cast<JSTestOverridingNameGetter*>(asObject(slotBase)); + return JSTestOverridingNameGetter::getConstructor(exec, domObject->globalObject()); +} + +JSValue JSTestOverridingNameGetter::getConstructor(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMConstructor<JSTestOverridingNameGetterConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); +} + +EncodedJSValue JSC_HOST_CALL jsTestOverridingNameGetterPrototypeFunctionAnotherFunction(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestOverridingNameGetter::s_info)) + return throwVMTypeError(exec); + JSTestOverridingNameGetter* castedThis = static_cast<JSTestOverridingNameGetter*>(asObject(thisValue)); + ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestOverridingNameGetter::s_info); + TestOverridingNameGetter* impl = static_cast<TestOverridingNameGetter*>(castedThis->impl()); + if (exec->argumentCount() < 1) + return throwVMError(exec, createTypeError(exec, "Not enough arguments")); + const String& str(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec))); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + impl->anotherFunction(str); + return JSValue::encode(jsUndefined()); +} + +static inline bool isObservable(JSTestOverridingNameGetter* jsTestOverridingNameGetter) +{ + if (jsTestOverridingNameGetter->hasCustomProperties()) + return true; + return false; +} + +bool JSTestOverridingNameGetterOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor) +{ + JSTestOverridingNameGetter* jsTestOverridingNameGetter = static_cast<JSTestOverridingNameGetter*>(handle.get().asCell()); + if (!isObservable(jsTestOverridingNameGetter)) + return false; + UNUSED_PARAM(visitor); + return false; +} + +void JSTestOverridingNameGetterOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) +{ + JSTestOverridingNameGetter* jsTestOverridingNameGetter = static_cast<JSTestOverridingNameGetter*>(handle.get().asCell()); + DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); + uncacheWrapper(world, jsTestOverridingNameGetter->impl(), jsTestOverridingNameGetter); + jsTestOverridingNameGetter->releaseImpl(); +} + +JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestOverridingNameGetter* impl) +{ + return wrap<JSTestOverridingNameGetter>(exec, globalObject, impl); +} + +TestOverridingNameGetter* toTestOverridingNameGetter(JSC::JSValue value) +{ + return value.inherits(&JSTestOverridingNameGetter::s_info) ? static_cast<JSTestOverridingNameGetter*>(asObject(value))->impl() : 0; +} + +} diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestOverridingNameGetter.h b/Source/WebCore/bindings/scripts/test/JS/JSTestOverridingNameGetter.h new file mode 100644 index 000000000..220bfd33c --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestOverridingNameGetter.h @@ -0,0 +1,148 @@ +/* + 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 JSTestOverridingNameGetter_h +#define JSTestOverridingNameGetter_h + +#include "JSDOMBinding.h" +#include "TestOverridingNameGetter.h" +#include <runtime/JSGlobalObject.h> +#include <runtime/JSObject.h> +#include <runtime/ObjectPrototype.h> + +namespace WebCore { + +class JSTestOverridingNameGetter : public JSDOMWrapper { +public: + typedef JSDOMWrapper Base; + static JSTestOverridingNameGetter* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestOverridingNameGetter> impl) + { + JSTestOverridingNameGetter* ptr = new (NotNull, JSC::allocateCell<JSTestOverridingNameGetter>(globalObject->globalData().heap)) JSTestOverridingNameGetter(structure, globalObject, impl); + ptr->finishCreation(globalObject->globalData()); + return ptr; + } + + static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); + static bool getOwnPropertySlot(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); + static bool getOwnPropertyDescriptor(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); + static void destroy(JSC::JSCell*); + static const JSC::ClassInfo s_info; + + static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(globalData, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), &s_info); + } + + static JSC::JSValue getConstructor(JSC::ExecState*, JSC::JSGlobalObject*); + TestOverridingNameGetter* impl() const { return m_impl; } + void releaseImpl() { m_impl->deref(); m_impl = 0; } + + void releaseImplIfNotNull() { if (m_impl) { m_impl->deref(); m_impl = 0; } } + +private: + TestOverridingNameGetter* m_impl; +protected: + JSTestOverridingNameGetter(JSC::Structure*, JSDOMGlobalObject*, PassRefPtr<TestOverridingNameGetter>); + void finishCreation(JSC::JSGlobalData&); + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; +private: + static bool canGetItemsForName(JSC::ExecState*, TestOverridingNameGetter*, const JSC::Identifier&); + static JSC::JSValue nameGetter(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +}; + +class JSTestOverridingNameGetterOwner : public JSC::WeakHandleOwner { + virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&); + virtual void finalize(JSC::Handle<JSC::Unknown>, void* context); +}; + +inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld*, TestOverridingNameGetter*) +{ + DEFINE_STATIC_LOCAL(JSTestOverridingNameGetterOwner, jsTestOverridingNameGetterOwner, ()); + return &jsTestOverridingNameGetterOwner; +} + +inline void* wrapperContext(DOMWrapperWorld* world, TestOverridingNameGetter*) +{ + return world; +} + +JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestOverridingNameGetter*); +TestOverridingNameGetter* toTestOverridingNameGetter(JSC::JSValue); + +class JSTestOverridingNameGetterPrototype : public JSC::JSNonFinalObject { +public: + typedef JSC::JSNonFinalObject Base; + static JSC::JSObject* self(JSC::ExecState*, JSC::JSGlobalObject*); + static JSTestOverridingNameGetterPrototype* create(JSC::JSGlobalData& globalData, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSTestOverridingNameGetterPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestOverridingNameGetterPrototype>(globalData.heap)) JSTestOverridingNameGetterPrototype(globalData, globalObject, structure); + ptr->finishCreation(globalData); + return ptr; + } + + static const JSC::ClassInfo s_info; + static bool getOwnPropertySlot(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); + static bool getOwnPropertyDescriptor(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); + static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(globalData, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), &s_info); + } + +private: + JSTestOverridingNameGetterPrototype(JSC::JSGlobalData& globalData, JSC::JSGlobalObject*, JSC::Structure* structure) : JSC::JSNonFinalObject(globalData, structure) { } +protected: + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; +}; + +class JSTestOverridingNameGetterConstructor : public DOMConstructorObject { +private: + JSTestOverridingNameGetterConstructor(JSC::Structure*, JSDOMGlobalObject*); + void finishCreation(JSC::ExecState*, JSDOMGlobalObject*); + +public: + typedef DOMConstructorObject Base; + static JSTestOverridingNameGetterConstructor* create(JSC::ExecState* exec, JSC::Structure* structure, JSDOMGlobalObject* globalObject) + { + JSTestOverridingNameGetterConstructor* ptr = new (NotNull, JSC::allocateCell<JSTestOverridingNameGetterConstructor>(*exec->heap())) JSTestOverridingNameGetterConstructor(structure, globalObject); + ptr->finishCreation(exec, globalObject); + return ptr; + } + + static bool getOwnPropertySlot(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); + static bool getOwnPropertyDescriptor(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); + static const JSC::ClassInfo s_info; + static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(globalData, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), &s_info); + } +protected: + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; +}; + +// Functions + +JSC::EncodedJSValue JSC_HOST_CALL jsTestOverridingNameGetterPrototypeFunctionAnotherFunction(JSC::ExecState*); +// Attributes + +JSC::JSValue jsTestOverridingNameGetterConstructor(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); + +} // namespace WebCore + +#endif diff --git a/Source/WebCore/bridge/jni/v8/JavaMethodV8.h b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestActiveDOMObject.h index f07116092..8f63275df 100644 --- a/Source/WebCore/bridge/jni/v8/JavaMethodV8.h +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestActiveDOMObject.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2003, 2004, 2005, 2007, 2009, 2010 Apple Inc. All rights reserved. - * Copyright 2010, The Android Open Source Project + * 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 @@ -21,37 +21,20 @@ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (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. */ -#ifndef JavaMethodV8_h -#define JavaMethodV8_h +#import <WebCore/DOMObject.h> -#if ENABLE(JAVA_BRIDGE) +#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_LATEST -#include "Bridge.h" -#include "JavaType.h" +@class DOMNode; +@class NSString; -#include <wtf/text/WTFString.h> +@interface DOMTestActiveDOMObject : DOMObject +- (int)excitingAttr; +- (void)excitingFunction:(DOMNode *)nextChild; +- (void)postMessage:(NSString *)message; +@end -namespace JSC { - -namespace Bindings { - -typedef const char* RuntimeType; - -class JavaMethod : public Method { -public: - virtual ~JavaMethod() { } - - virtual String name() const = 0; - virtual String parameterAt(int) const = 0; -}; - -} // namespace Bindings - -} // namespace JSC - -#endif // ENABLE(JAVA_BRIDGE) - -#endif // JavaMethodV8_h +#endif diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestActiveDOMObject.mm b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestActiveDOMObject.mm new file mode 100644 index 000000000..53d667bfc --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestActiveDOMObject.mm @@ -0,0 +1,107 @@ +/* + * 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 "DOMTestActiveDOMObject.h" + +#import "DOMBlobInternal.h" +#import "DOMCSSRuleInternal.h" +#import "DOMCSSValueInternal.h" +#import "DOMEventInternal.h" +#import "DOMNodeInternal.h" +#import "DOMStyleSheetInternal.h" +#import "DOMTestActiveDOMObjectInternal.h" +#import "ExceptionHandlers.h" +#import "JSMainThreadExecState.h" +#import "KURL.h" +#import "Node.h" +#import "TestActiveDOMObject.h" +#import "ThreadCheck.h" +#import "WebCoreObjCExtras.h" +#import "WebScriptObjectPrivate.h" +#import <wtf/GetPtr.h> + +#define IMPL reinterpret_cast<WebCore::TestActiveDOMObject*>(_internal) + +@implementation DOMTestActiveDOMObject + +- (void)dealloc +{ + if (WebCoreObjCScheduleDeallocateOnMainThread([DOMTestActiveDOMObject class], self)) + return; + + if (_internal) + IMPL->deref(); + [super dealloc]; +} + +- (void)finalize +{ + if (_internal) + IMPL->deref(); + [super finalize]; +} + +- (int)excitingAttr +{ + WebCore::JSMainThreadNullState state; + return IMPL->excitingAttr(); +} + +- (void)excitingFunction:(DOMNode *)nextChild +{ + WebCore::JSMainThreadNullState state; + IMPL->excitingFunction(core(nextChild)); +} + +- (void)postMessage:(NSString *)message +{ + WebCore::JSMainThreadNullState state; + IMPL->postMessage(message); +} + +@end + +WebCore::TestActiveDOMObject* core(DOMTestActiveDOMObject *wrapper) +{ + return wrapper ? reinterpret_cast<WebCore::TestActiveDOMObject*>(wrapper->_internal) : 0; +} + +DOMTestActiveDOMObject *kit(WebCore::TestActiveDOMObject* value) +{ + { DOM_ASSERT_MAIN_THREAD(); WebCoreThreadViolationCheckRoundOne(); }; + if (!value) + return nil; + if (DOMTestActiveDOMObject *wrapper = getDOMWrapper(value)) + return [[wrapper retain] autorelease]; + DOMTestActiveDOMObject *wrapper = [[DOMTestActiveDOMObject alloc] _init]; + wrapper->_internal = reinterpret_cast<DOMObjectInternal*>(value); + value->ref(); + addDOMWrapper(wrapper, value); + return [wrapper autorelease]; +} diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestActiveDOMObjectInternal.h b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestActiveDOMObjectInternal.h new file mode 100644 index 000000000..6d21e38c6 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestActiveDOMObjectInternal.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/DOMTestActiveDOMObject.h> + +#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_LATEST + +namespace WebCore { + class TestActiveDOMObject; +} + +WebCore::TestActiveDOMObject* core(DOMTestActiveDOMObject *); +DOMTestActiveDOMObject *kit(WebCore::TestActiveDOMObject*); + +#endif diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestEventTarget.h b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestEventTarget.h new file mode 100644 index 000000000..5208095d1 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestEventTarget.h @@ -0,0 +1,43 @@ +/* + * 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 DOMEvent; +@class DOMNode; +@class NSString; +@protocol DOMEventListener; + +@interface DOMTestEventTarget : DOMObject +- (DOMNode *)item:(unsigned)index; +- (void)addEventListener:(NSString *)type listener:(id <DOMEventListener>)listener useCapture:(BOOL)useCapture; +- (void)removeEventListener:(NSString *)type listener:(id <DOMEventListener>)listener useCapture:(BOOL)useCapture; +- (BOOL)dispatchEvent:(DOMEvent *)evt; +@end + +#endif diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestEventTarget.mm b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestEventTarget.mm new file mode 100644 index 000000000..94b05a9b7 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestEventTarget.mm @@ -0,0 +1,121 @@ +/* + * 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 "DOMTestEventTarget.h" + +#import "DOMBlobInternal.h" +#import "DOMCSSRuleInternal.h" +#import "DOMCSSValueInternal.h" +#import "DOMEventInternal.h" +#import "DOMNodeInternal.h" +#import "DOMStyleSheetInternal.h" +#import "DOMTestEventTargetInternal.h" +#import "Event.h" +#import "EventListener.h" +#import "ExceptionHandlers.h" +#import "JSMainThreadExecState.h" +#import "KURL.h" +#import "Node.h" +#import "ObjCEventListener.h" +#import "TestEventTarget.h" +#import "ThreadCheck.h" +#import "WebCoreObjCExtras.h" +#import "WebScriptObjectPrivate.h" +#import <wtf/GetPtr.h> + +#define IMPL reinterpret_cast<WebCore::TestEventTarget*>(_internal) + +@implementation DOMTestEventTarget + +- (void)dealloc +{ + if (WebCoreObjCScheduleDeallocateOnMainThread([DOMTestEventTarget class], self)) + return; + + if (_internal) + IMPL->deref(); + [super dealloc]; +} + +- (void)finalize +{ + if (_internal) + IMPL->deref(); + [super finalize]; +} + +- (DOMNode *)item:(unsigned)index +{ + WebCore::JSMainThreadNullState state; + return kit(WTF::getPtr(IMPL->item(index))); +} + +- (void)addEventListener:(NSString *)type listener:(id <DOMEventListener>)listener useCapture:(BOOL)useCapture +{ + WebCore::JSMainThreadNullState state; + 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 +{ + WebCore::JSMainThreadNullState state; + RefPtr<WebCore::EventListener> nativeEventListener = WebCore::ObjCEventListener::wrap(listener); + IMPL->removeEventListener(type, WTF::getPtr(nativeEventListener), useCapture); +} + +- (BOOL)dispatchEvent:(DOMEvent *)evt +{ + WebCore::JSMainThreadNullState state; + WebCore::ExceptionCode ec = 0; + BOOL result = IMPL->dispatchEvent(core(evt), ec); + WebCore::raiseOnDOMError(ec); + return result; +} + +@end + +WebCore::TestEventTarget* core(DOMTestEventTarget *wrapper) +{ + return wrapper ? reinterpret_cast<WebCore::TestEventTarget*>(wrapper->_internal) : 0; +} + +DOMTestEventTarget *kit(WebCore::TestEventTarget* value) +{ + { DOM_ASSERT_MAIN_THREAD(); WebCoreThreadViolationCheckRoundOne(); }; + if (!value) + return nil; + if (DOMTestEventTarget *wrapper = getDOMWrapper(value)) + return [[wrapper retain] autorelease]; + DOMTestEventTarget *wrapper = [[DOMTestEventTarget alloc] _init]; + wrapper->_internal = reinterpret_cast<DOMObjectInternal*>(value); + value->ref(); + addDOMWrapper(wrapper, value); + return [wrapper autorelease]; +} diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestEventTargetInternal.h b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestEventTargetInternal.h new file mode 100644 index 000000000..d4f658d89 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestEventTargetInternal.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/DOMTestEventTarget.h> + +#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_LATEST + +namespace WebCore { + class TestEventTarget; +} + +WebCore::TestEventTarget* core(DOMTestEventTarget *); +DOMTestEventTarget *kit(WebCore::TestEventTarget*); + +#endif diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.h b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.h index 234259b45..4457de6fb 100644 --- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.h +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.h @@ -28,20 +28,23 @@ #if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_LATEST +@class DOMTestObj; @class NSString; @interface DOMTestInterface : DOMObject #if ENABLE(Condition11) || ENABLE(Condition12) -- (NSString *)str1; +- (NSString *)supplementalStr1; #endif #if ENABLE(Condition11) || ENABLE(Condition12) -- (NSString *)str2; -- (void)setStr2:(NSString *)newStr2; +- (NSString *)supplementalStr2; +- (void)setSupplementalStr2:(NSString *)newSupplementalStr2; #endif #if ENABLE(Condition11) || ENABLE(Condition12) -- (NSString *)str3; -- (void)setStr3:(NSString *)newStr3; +- (NSString *)supplementalStr3; +- (void)setSupplementalStr3:(NSString *)newSupplementalStr3; #endif +- (void)supplementalMethod1; +- (DOMTestObj *)supplementalMethod2:(NSString *)strArg objArg:(DOMTestObj *)objArg; @end #endif diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm index f469cf10a..0e02b9563 100644 --- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm @@ -39,10 +39,12 @@ #import "DOMNodeInternal.h" #import "DOMStyleSheetInternal.h" #import "DOMTestInterfaceInternal.h" +#import "DOMTestObjInternal.h" #import "ExceptionHandlers.h" #import "JSMainThreadExecState.h" #import "KURL.h" #import "TestInterface.h" +#import "TestObj.h" #import "TestSupplemental.h" #import "ThreadCheck.h" #import "WebCoreObjCExtras.h" @@ -71,41 +73,64 @@ } #if ENABLE(Condition11) || ENABLE(Condition12) -- (NSString *)str1 +- (NSString *)supplementalStr1 { WebCore::JSMainThreadNullState state; - return TestSupplemental::str1(IMPL); + return TestSupplemental::supplementalStr1(IMPL); } #endif #if ENABLE(Condition11) || ENABLE(Condition12) -- (NSString *)str2 +- (NSString *)supplementalStr2 { WebCore::JSMainThreadNullState state; - return TestSupplemental::str2(IMPL); + return TestSupplemental::supplementalStr2(IMPL); } -- (void)setStr2:(NSString *)newStr2 +- (void)setSupplementalStr2:(NSString *)newSupplementalStr2 { WebCore::JSMainThreadNullState state; - TestSupplemental::setStr2(IMPL, newStr2); + TestSupplemental::setSupplementalStr2(IMPL, newSupplementalStr2); } #endif #if ENABLE(Condition11) || ENABLE(Condition12) -- (NSString *)str3 +- (NSString *)supplementalStr3 { WebCore::JSMainThreadNullState state; - return TestSupplemental::str3(IMPL); + return TestSupplemental::supplementalStr3(IMPL); } -- (void)setStr3:(NSString *)newStr3 +- (void)setSupplementalStr3:(NSString *)newSupplementalStr3 { WebCore::JSMainThreadNullState state; - TestSupplemental::setStr3(IMPL, newStr3); + TestSupplemental::setSupplementalStr3(IMPL, newSupplementalStr3); } #endif + +#if ENABLE(Condition11) || ENABLE(Condition12) +- (void)supplementalMethod1 +{ + WebCore::JSMainThreadNullState state; + TestSupplemental::supplementalMethod1(IMPL); +} + +#endif + + +#if ENABLE(Condition11) || ENABLE(Condition12) +- (DOMTestObj *)supplementalMethod2:(NSString *)strArg objArg:(DOMTestObj *)objArg +{ + WebCore::JSMainThreadNullState state; + WebCore::ExceptionCode ec = 0; + DOMTestObj *result = kit(WTF::getPtr(TestSupplemental::supplementalMethod2(IMPL, strArg, core(objArg), ec))); + WebCore::raiseOnDOMError(ec); + return result; +} + +#endif + @end WebCore::TestInterface* core(DOMTestInterface *wrapper) diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h index 62ce33237..282995ae8 100644 --- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h @@ -28,12 +28,21 @@ #if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_LATEST +@class DOMDocument; @class DOMIDBKey; @class DOMOptionsObject; +@class DOMSVGDocument; +@class DOMSVGPoint; @class DOMTestObj; @class DOMTestObjectAConstructor; @class DOMTestObjectBConstructor; @class DOMTestObjectCConstructor; +@class DOMa; +@class DOMb; +@class DOMbool; +@class DOMc; +@class DOMd; +@class DOMe; @class DOMlog; @class NSString; @protocol DOMEventListener; @@ -135,6 +144,13 @@ enum { - (DOMTestObjectCConstructor *)conditionalAttr6; - (void)setConditionalAttr6:(DOMTestObjectCConstructor *)newConditionalAttr6; #endif +- (DOMDocument *)contentDocument; +- (DOMSVGPoint *)mutablePoint; +- (void)setMutablePoint:(DOMSVGPoint *)newMutablePoint; +- (DOMSVGPoint *)immutablePoint; +- (void)setImmutablePoint:(DOMSVGPoint *)newImmutablePoint; +- (float)strictFloat; +- (void)setStrictFloat:(float)newStrictFloat; - (int)descriptionName; - (int)idName; - (void)setIdName:(int)newIdName; @@ -155,11 +171,6 @@ enum { - (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; @@ -175,6 +186,16 @@ enum { - (int)classMethodWithOptional:(int)arg; - (void)overloadedMethod1:(int)arg; - (void)overloadedMethod1:(NSString *)type; +- (DOMSVGDocument *)getSVGDocument; +- (void)convert1:(DOMa *); +- (void)convert2:(DOMb *); +- (void)convert3:(DOMc *); +- (void)convert4:(DOMd *); +- (void)convert5:(DOMe *); +- (DOMSVGPoint *)mutablePointFunction; +- (DOMSVGPoint *)immutablePointFunction; +- (void)orange; +- (DOMbool *)strictFunction:(NSString *)str a:(float)a b:(int)b; @end #endif diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm index b2dca6325..08f1f1e7a 100644 --- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm @@ -32,16 +32,26 @@ #import "DOMBlobInternal.h" #import "DOMCSSRuleInternal.h" #import "DOMCSSValueInternal.h" +#import "DOMDocumentInternal.h" #import "DOMEventInternal.h" #import "DOMIDBKeyInternal.h" #import "DOMNodeInternal.h" #import "DOMOptionsObjectInternal.h" +#import "DOMSVGDocumentInternal.h" +#import "DOMSVGPointInternal.h" #import "DOMStyleSheetInternal.h" #import "DOMTestObjInternal.h" #import "DOMTestObjectAConstructorInternal.h" #import "DOMTestObjectBConstructorInternal.h" #import "DOMTestObjectCConstructorInternal.h" +#import "DOMaInternal.h" +#import "DOMbInternal.h" +#import "DOMboolInternal.h" +#import "DOMcInternal.h" +#import "DOMdInternal.h" +#import "DOMeInternal.h" #import "DOMlogInternal.h" +#import "Document.h" #import "EventListener.h" #import "ExceptionHandlers.h" #import "HTMLNames.h" @@ -50,6 +60,8 @@ #import "KURL.h" #import "ObjCEventListener.h" #import "OptionsObject.h" +#import "SVGDocument.h" +#import "SVGStaticPropertyTearOff.h" #import "SerializedScriptValue.h" #import "TestObj.h" #import "TestObjectAConstructor.h" @@ -58,6 +70,12 @@ #import "ThreadCheck.h" #import "WebCoreObjCExtras.h" #import "WebScriptObjectPrivate.h" +#import "a.h" +#import "b.h" +#import "bool.h" +#import "c.h" +#import "d.h" +#import "e.h" #import "log.h" #import <wtf/GetPtr.h> @@ -514,6 +532,52 @@ } #endif +- (DOMDocument *)contentDocument +{ + WebCore::JSMainThreadNullState state; + return kit(WTF::getPtr(IMPL->contentDocument())); +} + +- (DOMSVGPoint *)mutablePoint +{ + WebCore::JSMainThreadNullState state; + return kit(WTF::getPtr(WebCore::SVGStaticPropertyTearOff<WebCore::TestObj, WebCore::FloatPoint>::create(IMPL, IMPL->mutablePoint(), &WebCore::TestObj::updateMutablePoint))); +} + +- (void)setMutablePoint:(DOMSVGPoint *)newMutablePoint +{ + WebCore::JSMainThreadNullState state; + ASSERT(newMutablePoint); + + IMPL->setMutablePoint(core(newMutablePoint)); +} + +- (DOMSVGPoint *)immutablePoint +{ + WebCore::JSMainThreadNullState state; + return kit(WTF::getPtr(WebCore::SVGPropertyTearOff<WebCore::FloatPoint>::create(IMPL->immutablePoint()))); +} + +- (void)setImmutablePoint:(DOMSVGPoint *)newImmutablePoint +{ + WebCore::JSMainThreadNullState state; + ASSERT(newImmutablePoint); + + IMPL->setImmutablePoint(core(newImmutablePoint)); +} + +- (float)strictFloat +{ + WebCore::JSMainThreadNullState state; + return IMPL->strictFloat(); +} + +- (void)setStrictFloat:(float)newStrictFloat +{ + WebCore::JSMainThreadNullState state; + IMPL->setStrictFloat(newStrictFloat); +} + - (int)descriptionName { WebCore::JSMainThreadNullState state; @@ -643,36 +707,6 @@ IMPL->removeEventListener(type, WTF::getPtr(nativeEventListener), useCapture); } -- (void)withDynamicFrame -{ - WebCore::JSMainThreadNullState state; - IMPL->withDynamicFrame(); -} - -- (void)withDynamicFrameAndArg:(int)intArg -{ - WebCore::JSMainThreadNullState state; - IMPL->withDynamicFrameAndArg(intArg); -} - -- (void)withDynamicFrameAndOptionalArg:(int)intArg optionalArg:(int)optionalArg -{ - WebCore::JSMainThreadNullState state; - IMPL->withDynamicFrameAndOptionalArg(intArg, optionalArg); -} - -- (void)withDynamicFrameAndUserGesture:(int)intArg -{ - WebCore::JSMainThreadNullState state; - IMPL->withDynamicFrameAndUserGesture(intArg); -} - -- (void)withDynamicFrameAndUserGestureASAD:(int)intArg optionalArg:(int)optionalArg -{ - WebCore::JSMainThreadNullState state; - IMPL->withDynamicFrameAndUserGestureASAD(intArg, optionalArg); -} - - (void)withScriptStateVoid { WebCore::JSMainThreadNullState state; @@ -788,6 +822,72 @@ #endif +- (DOMSVGDocument *)getSVGDocument +{ + WebCore::JSMainThreadNullState state; + WebCore::ExceptionCode ec = 0; + DOMSVGDocument *result = kit(WTF::getPtr(IMPL->getSVGDocument(ec))); + WebCore::raiseOnDOMError(ec); + return result; +} + +- (void)convert1:(DOMa *) +{ + WebCore::JSMainThreadNullState state; + IMPL->convert1(core()); +} + +- (void)convert2:(DOMb *) +{ + WebCore::JSMainThreadNullState state; + IMPL->convert2(core()); +} + +- (void)convert3:(DOMc *) +{ + WebCore::JSMainThreadNullState state; + IMPL->convert3(core()); +} + +- (void)convert4:(DOMd *) +{ + WebCore::JSMainThreadNullState state; + IMPL->convert4(core()); +} + +- (void)convert5:(DOMe *) +{ + WebCore::JSMainThreadNullState state; + IMPL->convert5(core()); +} + +- (DOMSVGPoint *)mutablePointFunction +{ + WebCore::JSMainThreadNullState state; + return kit(WTF::getPtr(WebCore::SVGPropertyTearOff<WebCore::FloatPoint>::create(IMPL->mutablePointFunction()))); +} + +- (DOMSVGPoint *)immutablePointFunction +{ + WebCore::JSMainThreadNullState state; + return kit(WTF::getPtr(WebCore::SVGPropertyTearOff<WebCore::FloatPoint>::create(IMPL->immutablePointFunction()))); +} + +- (void)orange +{ + WebCore::JSMainThreadNullState state; + IMPL->orange(); +} + +- (DOMbool *)strictFunction:(NSString *)str a:(float)a b:(int)b +{ + WebCore::JSMainThreadNullState state; + WebCore::ExceptionCode ec = 0; + DOMbool *result = kit(WTF::getPtr(IMPL->strictFunction(str, a, b, ec))); + WebCore::raiseOnDOMError(ec); + return result; +} + @end WebCore::TestObj* core(DOMTestObj *wrapper) diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestOverridingNameGetter.h b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestOverridingNameGetter.h new file mode 100644 index 000000000..3d7b44793 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestOverridingNameGetter.h @@ -0,0 +1,37 @@ +/* + * 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 NSString; + +@interface DOMTestOverridingNameGetter : DOMObject +- (void)anotherFunction:(NSString *)str; +@end + +#endif diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestOverridingNameGetter.mm b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestOverridingNameGetter.mm new file mode 100644 index 000000000..3a80097bf --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestOverridingNameGetter.mm @@ -0,0 +1,94 @@ +/* + * 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 "DOMTestOverridingNameGetter.h" + +#import "DOMBlobInternal.h" +#import "DOMCSSRuleInternal.h" +#import "DOMCSSValueInternal.h" +#import "DOMEventInternal.h" +#import "DOMNodeInternal.h" +#import "DOMStyleSheetInternal.h" +#import "DOMTestOverridingNameGetterInternal.h" +#import "ExceptionHandlers.h" +#import "JSMainThreadExecState.h" +#import "KURL.h" +#import "TestOverridingNameGetter.h" +#import "ThreadCheck.h" +#import "WebCoreObjCExtras.h" +#import "WebScriptObjectPrivate.h" +#import <wtf/GetPtr.h> + +#define IMPL reinterpret_cast<WebCore::TestOverridingNameGetter*>(_internal) + +@implementation DOMTestOverridingNameGetter + +- (void)dealloc +{ + if (WebCoreObjCScheduleDeallocateOnMainThread([DOMTestOverridingNameGetter class], self)) + return; + + if (_internal) + IMPL->deref(); + [super dealloc]; +} + +- (void)finalize +{ + if (_internal) + IMPL->deref(); + [super finalize]; +} + +- (void)anotherFunction:(NSString *)str +{ + WebCore::JSMainThreadNullState state; + IMPL->anotherFunction(str); +} + +@end + +WebCore::TestOverridingNameGetter* core(DOMTestOverridingNameGetter *wrapper) +{ + return wrapper ? reinterpret_cast<WebCore::TestOverridingNameGetter*>(wrapper->_internal) : 0; +} + +DOMTestOverridingNameGetter *kit(WebCore::TestOverridingNameGetter* value) +{ + { DOM_ASSERT_MAIN_THREAD(); WebCoreThreadViolationCheckRoundOne(); }; + if (!value) + return nil; + if (DOMTestOverridingNameGetter *wrapper = getDOMWrapper(value)) + return [[wrapper retain] autorelease]; + DOMTestOverridingNameGetter *wrapper = [[DOMTestOverridingNameGetter alloc] _init]; + wrapper->_internal = reinterpret_cast<DOMObjectInternal*>(value); + value->ref(); + addDOMWrapper(wrapper, value); + return [wrapper autorelease]; +} diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestOverridingNameGetterInternal.h b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestOverridingNameGetterInternal.h new file mode 100644 index 000000000..573cf6f11 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestOverridingNameGetterInternal.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/DOMTestOverridingNameGetter.h> + +#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_LATEST + +namespace WebCore { + class TestOverridingNameGetter; +} + +WebCore::TestOverridingNameGetter* core(DOMTestOverridingNameGetter *); +DOMTestOverridingNameGetter *kit(WebCore::TestOverridingNameGetter*); + +#endif diff --git a/Source/WebCore/bindings/scripts/test/TestDomainSecurity.idl b/Source/WebCore/bindings/scripts/test/TestDomainSecurity.idl new file mode 100644 index 000000000..09d60bd52 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/TestDomainSecurity.idl @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2011 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. + */ + +module test { + interface [ + CheckDomainSecurity + ] TestActiveDOMObject { + readonly attribute long excitingAttr; + void excitingFunction(in Node nextChild); + [DoNotCheckDomainSecurity] void postMessage(in DOMString message); + }; +} diff --git a/Source/WebCore/bindings/scripts/test/TestEventConstructor.idl b/Source/WebCore/bindings/scripts/test/TestEventConstructor.idl index c057ca7b5..7783826e3 100644 --- a/Source/WebCore/bindings/scripts/test/TestEventConstructor.idl +++ b/Source/WebCore/bindings/scripts/test/TestEventConstructor.idl @@ -34,6 +34,6 @@ module test { ] TestEventConstructor { // Attributes readonly attribute DOMString attr1; - readonly attribute [InitializedAtConstructor] DOMString attr2; + readonly attribute [InitializedByConstructor] DOMString attr2; }; } diff --git a/Source/WebCore/bindings/scripts/test/TestEventTarget.idl b/Source/WebCore/bindings/scripts/test/TestEventTarget.idl new file mode 100644 index 000000000..beedb5730 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/TestEventTarget.idl @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2011 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. + */ + +module events { + + interface [ + EventTarget, + HasIndexGetter, + HasNameGetter, + MasqueradesAsUndefined + ] TestEventTarget { + + Node item(in [IsIndex] unsigned long index); + + void addEventListener(in DOMString type, + in EventListener listener, + in [Optional] boolean useCapture); + void removeEventListener(in DOMString type, + in EventListener listener, + in [Optional] boolean useCapture); + boolean dispatchEvent(in Event evt) + raises(EventException); + }; + +} diff --git a/Source/WebCore/bindings/scripts/test/TestInterface.idl b/Source/WebCore/bindings/scripts/test/TestInterface.idl index 2b054a823..eb4943ceb 100644 --- a/Source/WebCore/bindings/scripts/test/TestInterface.idl +++ b/Source/WebCore/bindings/scripts/test/TestInterface.idl @@ -31,6 +31,7 @@ module test { interface [ ActiveDOMObject, + DelegatingPutFunction, Conditional=Condition1|Condition2, CallWith=ScriptExecutionContext, Constructor(in DOMString str1, in [Optional=CallWithDefaultValue] DOMString str2), diff --git a/Source/WebCore/bindings/scripts/test/TestObj.idl b/Source/WebCore/bindings/scripts/test/TestObj.idl index 655dfe10d..ed338c6b2 100644 --- a/Source/WebCore/bindings/scripts/test/TestObj.idl +++ b/Source/WebCore/bindings/scripts/test/TestObj.idl @@ -101,11 +101,6 @@ module test { in [Optional] 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() @@ -184,6 +179,27 @@ module test { attribute double[] doubleArray; #endif + readonly attribute [CheckFrameSecurity] Document contentDocument; + [SVGCheckSecurityDocument] SVGDocument getSVGDocument() + raises(DOMException); + + void convert1(in [ConvertNullStringTo=Null] a); + void convert2(in [ConvertNullStringTo=Undefined] b); + void convert3(in [ConvertNullStringTo=False] c); + void convert4(in [ConvertNullToNullString] d); + void convert5(in [ConvertUndefinedOrNullToNullString] e); + + attribute SVGPoint mutablePoint; + attribute [Immutable] SVGPoint immutablePoint; + SVGPoint mutablePointFunction(); + [Immutable] SVGPoint immutablePointFunction(); + + [ImplementationFunction=banana] void orange(); + + attribute [StrictTypeChecking] float strictFloat; + [StrictTypeChecking] bool strictFunction(in DOMString str, in float a, in int b) + raises(DOMException); + // ObjectiveC reserved words. readonly attribute long description; attribute long id; diff --git a/Source/WebCore/bindings/scripts/test/TestOverridingNameGetter.idl b/Source/WebCore/bindings/scripts/test/TestOverridingNameGetter.idl new file mode 100644 index 000000000..a56ea5f2e --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/TestOverridingNameGetter.idl @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2011 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. + */ + +module events { + + interface [ + HasOverridingNameGetter + ] TestOverridingNameGetter { + void anotherFunction(in DOMString str); + }; + +} diff --git a/Source/WebCore/bindings/scripts/test/TestSupplemental.idl b/Source/WebCore/bindings/scripts/test/TestSupplemental.idl index 466fdd51a..7ddca1748 100644 --- a/Source/WebCore/bindings/scripts/test/TestSupplemental.idl +++ b/Source/WebCore/bindings/scripts/test/TestSupplemental.idl @@ -33,8 +33,11 @@ module test { Conditional=Condition11|Condition12, Supplemental=TestInterface ] TestSupplemental { - readonly attribute DOMString str1; - attribute DOMString str2; - attribute [CustomGetter, CustomSetter] DOMString str3; + readonly attribute DOMString supplementalStr1; + attribute DOMString supplementalStr2; + attribute [CustomGetter, CustomSetter] DOMString supplementalStr3; + + void supplementalMethod1(); + [CallWith=ScriptExecutionContext] TestObj supplementalMethod2(in DOMString strArg, in TestObj objArg) raises(DOMException); }; } diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp new file mode 100644 index 000000000..66582879b --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp @@ -0,0 +1,199 @@ +/* + 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 "V8TestActiveDOMObject.h" + +#include "ExceptionCode.h" +#include "RuntimeEnabledFeatures.h" +#include "V8Binding.h" +#include "V8BindingMacros.h" +#include "V8BindingState.h" +#include "V8DOMWrapper.h" +#include "V8IsolatedContext.h" +#include "V8Node.h" +#include "V8Proxy.h" +#include <wtf/UnusedParam.h> + +namespace WebCore { + +WrapperTypeInfo V8TestActiveDOMObject::info = { V8TestActiveDOMObject::GetTemplate, V8TestActiveDOMObject::derefObject, 0, 0 }; + +namespace TestActiveDOMObjectInternal { + +template <typename T> void V8_USE(T) { } + +static v8::Handle<v8::Value> excitingAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestActiveDOMObject.excitingAttr._get"); + TestActiveDOMObject* imp = V8TestActiveDOMObject::toNative(info.Holder()); + return v8::Integer::New(imp->excitingAttr()); +} + +static v8::Handle<v8::Value> excitingFunctionCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestActiveDOMObject.excitingFunction"); + if (args.Length() < 1) + return throwError("Not enough arguments", V8Proxy::TypeError); + TestActiveDOMObject* imp = V8TestActiveDOMObject::toNative(args.Holder()); + if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true)) + return v8::Handle<v8::Value>(); + EXCEPTION_BLOCK(Node*, nextChild, V8Node::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined))) : 0); + imp->excitingFunction(nextChild); + return v8::Handle<v8::Value>(); +} + +static v8::Handle<v8::Value> postMessageCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestActiveDOMObject.postMessage"); + if (args.Length() < 1) + return throwError("Not enough arguments", V8Proxy::TypeError); + TestActiveDOMObject* imp = V8TestActiveDOMObject::toNative(args.Holder()); + STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, message, MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)); + imp->postMessage(message); + return v8::Handle<v8::Value>(); +} + +static v8::Handle<v8::Value> postMessageAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestActiveDOMObject.postMessage._get"); + static v8::Persistent<v8::FunctionTemplate> privateTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(TestActiveDOMObjectInternal::postMessageCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8TestActiveDOMObject::GetRawTemplate()))); + v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8TestActiveDOMObject::GetTemplate(), info.This()); + if (holder.IsEmpty()) { + // can only reach here by 'object.__proto__.func', and it should passed + // domain security check already + return privateTemplate->GetFunction(); + } + TestActiveDOMObject* imp = V8TestActiveDOMObject::toNative(holder); + if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), false)) { + static v8::Persistent<v8::FunctionTemplate> sharedTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(TestActiveDOMObjectInternal::postMessageCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8TestActiveDOMObject::GetRawTemplate()))); + return sharedTemplate->GetFunction(); + } + return privateTemplate->GetFunction(); +} + +} // namespace TestActiveDOMObjectInternal + +static const BatchedAttribute TestActiveDOMObjectAttrs[] = { + // Attribute 'excitingAttr' (Type: 'readonly attribute' ExtAttr: '') + {"excitingAttr", TestActiveDOMObjectInternal::excitingAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, +}; + +static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestActiveDOMObjectTemplate(v8::Persistent<v8::FunctionTemplate> desc) +{ + desc->ReadOnlyPrototype(); + + v8::Local<v8::Signature> defaultSignature; + defaultSignature = configureTemplate(desc, "TestActiveDOMObject", v8::Persistent<v8::FunctionTemplate>(), V8TestActiveDOMObject::internalFieldCount, + TestActiveDOMObjectAttrs, WTF_ARRAY_LENGTH(TestActiveDOMObjectAttrs), + 0, 0); + UNUSED_PARAM(defaultSignature); // In some cases, it will not be used. + v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); + v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); + UNUSED_PARAM(instance); // In some cases, it will not be used. + UNUSED_PARAM(proto); // In some cases, it will not be used. + instance->SetAccessCheckCallbacks(V8TestActiveDOMObject::namedSecurityCheck, V8TestActiveDOMObject::indexedSecurityCheck, v8::External::Wrap(&V8TestActiveDOMObject::info)); + + // Custom Signature 'excitingFunction' + const int excitingFunctionArgc = 1; + v8::Handle<v8::FunctionTemplate> excitingFunctionArgv[excitingFunctionArgc] = { V8Node::GetRawTemplate() }; + v8::Handle<v8::Signature> excitingFunctionSignature = v8::Signature::New(desc, excitingFunctionArgc, excitingFunctionArgv); + proto->Set(v8::String::New("excitingFunction"), v8::FunctionTemplate::New(TestActiveDOMObjectInternal::excitingFunctionCallback, v8::Handle<v8::Value>(), excitingFunctionSignature)); + + // Function 'postMessage' (ExtAttr: 'DoNotCheckDomainSecurity') + proto->SetAccessor(v8::String::New("postMessage"), TestActiveDOMObjectInternal::postMessageAttrGetter, 0, v8::Handle<v8::Value>(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly)); + + // Custom toString template + desc->Set(getToStringName(), getToStringTemplate()); + return desc; +} + +v8::Persistent<v8::FunctionTemplate> V8TestActiveDOMObject::GetRawTemplate() +{ + V8BindingPerIsolateData* data = V8BindingPerIsolateData::current(); + V8BindingPerIsolateData::TemplateMap::iterator result = data->rawTemplateMap().find(&info); + if (result != data->rawTemplateMap().end()) + return result->second; + + v8::HandleScope handleScope; + v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate(); + data->rawTemplateMap().add(&info, templ); + return templ; +} + +v8::Persistent<v8::FunctionTemplate> V8TestActiveDOMObject::GetTemplate() +{ + V8BindingPerIsolateData* data = V8BindingPerIsolateData::current(); + V8BindingPerIsolateData::TemplateMap::iterator result = data->templateMap().find(&info); + if (result != data->templateMap().end()) + return result->second; + + v8::HandleScope handleScope; + v8::Persistent<v8::FunctionTemplate> templ = + ConfigureV8TestActiveDOMObjectTemplate(GetRawTemplate()); + data->templateMap().add(&info, templ); + return templ; +} + +bool V8TestActiveDOMObject::HasInstance(v8::Handle<v8::Value> value) +{ + return GetRawTemplate()->HasInstance(value); +} + + +v8::Handle<v8::Object> V8TestActiveDOMObject::wrapSlow(TestActiveDOMObject* impl) +{ + v8::Handle<v8::Object> wrapper; + V8Proxy* proxy = 0; + if (impl->frame()) { + proxy = V8Proxy::retrieve(impl->frame()); + if (proxy) + proxy->windowShell()->initContextIfNeeded(); + } + + v8::Handle<v8::Context> context; + if (proxy) + context = proxy->context(); + + // Enter the node's context and create the wrapper in that context. + if (!context.IsEmpty()) + context->Enter(); + wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl); + // Exit the node's context if it was entered. + if (!context.IsEmpty()) + context->Exit(); + if (wrapper.IsEmpty()) + return wrapper; + + impl->ref(); + v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper); + + if (!hasDependentLifetime) + wrapperHandle.MarkIndependent(); + getDOMObjectMap().set(impl, wrapperHandle); + return wrapper; +} + +void V8TestActiveDOMObject::derefObject(void* object) +{ + static_cast<TestActiveDOMObject*>(object)->deref(); +} + +} // namespace WebCore diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.h b/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.h new file mode 100644 index 000000000..e163b3dd6 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef V8TestActiveDOMObject_h +#define V8TestActiveDOMObject_h + +#include "TestActiveDOMObject.h" +#include "V8DOMWrapper.h" +#include "WrapperTypeInfo.h" +#include <v8.h> +#include <wtf/HashMap.h> +#include <wtf/text/StringHash.h> + +namespace WebCore { + +class V8TestActiveDOMObject { +public: + static const bool hasDependentLifetime = false; + static bool HasInstance(v8::Handle<v8::Value>); + static v8::Persistent<v8::FunctionTemplate> GetRawTemplate(); + static v8::Persistent<v8::FunctionTemplate> GetTemplate(); + static TestActiveDOMObject* toNative(v8::Handle<v8::Object> object) + { + return reinterpret_cast<TestActiveDOMObject*>(object->GetPointerFromInternalField(v8DOMWrapperObjectIndex)); + } + inline static v8::Handle<v8::Object> wrap(TestActiveDOMObject*); + static void derefObject(void*); + static WrapperTypeInfo info; + static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0; + static bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType, v8::Local<v8::Value> data); + static bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::AccessType, v8::Local<v8::Value> data); + static v8::Handle<v8::Object> existingWrapper(TestActiveDOMObject*); + +private: + static v8::Handle<v8::Object> wrapSlow(TestActiveDOMObject*); +}; + +ALWAYS_INLINE v8::Handle<v8::Object> V8TestActiveDOMObject::existingWrapper(TestActiveDOMObject* impl) +{ + return getDOMObjectMap().get(impl); +} + +v8::Handle<v8::Object> V8TestActiveDOMObject::wrap(TestActiveDOMObject* impl) +{ + v8::Handle<v8::Object> wrapper = existingWrapper(impl); + if (!wrapper.IsEmpty()) + return wrapper; + return V8TestActiveDOMObject::wrapSlow(impl); +} + +inline v8::Handle<v8::Value> toV8(TestActiveDOMObject* impl) +{ + if (!impl) + return v8::Null(); + return V8TestActiveDOMObject::wrap(impl); +} +inline v8::Handle<v8::Value> toV8(PassRefPtr< TestActiveDOMObject > impl) +{ + return toV8(impl.get()); +} + +} + +#endif // V8TestActiveDOMObject_h diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp index 14e2b0d71..dd33aa056 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp @@ -58,7 +58,7 @@ static v8::Handle<v8::Value> attr2AttrGetter(v8::Local<v8::String> name, const v static const BatchedAttribute TestEventConstructorAttrs[] = { // Attribute 'attr1' (Type: 'readonly attribute' ExtAttr: '') {"attr1", TestEventConstructorInternal::attr1AttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, - // Attribute 'attr2' (Type: 'readonly attribute' ExtAttr: 'InitializedAtConstructor') + // Attribute 'attr2' (Type: 'readonly attribute' ExtAttr: 'InitializedByConstructor') {"attr2", TestEventConstructorInternal::attr2AttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, }; @@ -91,6 +91,7 @@ v8::Handle<v8::Value> V8TestEventConstructor::constructorCallback(const v8::Argu bool fillTestEventConstructorInit(TestEventConstructorInit& eventInit, const OptionsObject& options) { + options.get("attr2", eventInit.attr2); return true; } diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp new file mode 100644 index 000000000..00e0f34ec --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp @@ -0,0 +1,198 @@ +/* + 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 "V8TestEventTarget.h" + +#include "ExceptionCode.h" +#include "RuntimeEnabledFeatures.h" +#include "V8Binding.h" +#include "V8BindingMacros.h" +#include "V8BindingState.h" +#include "V8Collection.h" +#include "V8DOMWrapper.h" +#include "V8Event.h" +#include "V8IsolatedContext.h" +#include "V8Node.h" +#include "V8Proxy.h" +#include <wtf/UnusedParam.h> + +namespace WebCore { + +WrapperTypeInfo V8TestEventTarget::info = { V8TestEventTarget::GetTemplate, V8TestEventTarget::derefObject, 0, 0 }; + +namespace TestEventTargetInternal { + +template <typename T> void V8_USE(T) { } + +static v8::Handle<v8::Value> itemCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestEventTarget.item"); + if (args.Length() < 1) + return throwError("Not enough arguments", V8Proxy::TypeError); + TestEventTarget* imp = V8TestEventTarget::toNative(args.Holder()); + ExceptionCode ec = 0; + { + EXCEPTION_BLOCK(int, index, toUInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined))); + if (UNLIKELY(index < 0)) { + ec = INDEX_SIZE_ERR; + goto fail; + } + return toV8(imp->item(index)); + } + fail: + V8Proxy::setDOMException(ec); + return v8::Handle<v8::Value>(); +} + +static v8::Handle<v8::Value> addEventListenerCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestEventTarget.addEventListener()"); + RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(args[1], false, ListenerFindOrCreate); + if (listener) { + V8TestEventTarget::toNative(args.Holder())->addEventListener(v8ValueToAtomicWebCoreString(args[0]), listener, args[2]->BooleanValue()); + createHiddenDependency(args.Holder(), args[1], V8TestEventTarget::eventListenerCacheIndex); + } + return v8::Undefined(); +} + +static v8::Handle<v8::Value> removeEventListenerCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestEventTarget.removeEventListener()"); + RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(args[1], false, ListenerFindOnly); + if (listener) { + V8TestEventTarget::toNative(args.Holder())->removeEventListener(v8ValueToAtomicWebCoreString(args[0]), listener.get(), args[2]->BooleanValue()); + removeHiddenDependency(args.Holder(), args[1], V8TestEventTarget::eventListenerCacheIndex); + } + return v8::Undefined(); +} + +static v8::Handle<v8::Value> dispatchEventCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestEventTarget.dispatchEvent"); + if (args.Length() < 1) + return throwError("Not enough arguments", V8Proxy::TypeError); + TestEventTarget* imp = V8TestEventTarget::toNative(args.Holder()); + ExceptionCode ec = 0; + { + EXCEPTION_BLOCK(Event*, evt, V8Event::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)) ? V8Event::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined))) : 0); + bool result = imp->dispatchEvent(evt, ec); + if (UNLIKELY(ec)) + goto fail; + return v8Boolean(result); + } + fail: + V8Proxy::setDOMException(ec); + return v8::Handle<v8::Value>(); +} + +} // namespace TestEventTargetInternal + +static const BatchedCallback TestEventTargetCallbacks[] = { + {"item", TestEventTargetInternal::itemCallback}, + {"addEventListener", TestEventTargetInternal::addEventListenerCallback}, + {"removeEventListener", TestEventTargetInternal::removeEventListenerCallback}, +}; + +static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestEventTargetTemplate(v8::Persistent<v8::FunctionTemplate> desc) +{ + desc->ReadOnlyPrototype(); + + v8::Local<v8::Signature> defaultSignature; + defaultSignature = configureTemplate(desc, "TestEventTarget", v8::Persistent<v8::FunctionTemplate>(), V8TestEventTarget::internalFieldCount, + 0, 0, + TestEventTargetCallbacks, WTF_ARRAY_LENGTH(TestEventTargetCallbacks)); + UNUSED_PARAM(defaultSignature); // In some cases, it will not be used. + v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); + v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); + UNUSED_PARAM(instance); // In some cases, it will not be used. + UNUSED_PARAM(proto); // In some cases, it will not be used. + + setCollectionIndexedGetter<TestEventTarget, Node>(desc); + desc->InstanceTemplate()->SetNamedPropertyHandler(V8TestEventTarget::namedPropertyGetter, 0, 0, 0, 0); + desc->InstanceTemplate()->MarkAsUndetectable(); + + // Custom Signature 'dispatchEvent' + const int dispatchEventArgc = 1; + v8::Handle<v8::FunctionTemplate> dispatchEventArgv[dispatchEventArgc] = { V8Event::GetRawTemplate() }; + v8::Handle<v8::Signature> dispatchEventSignature = v8::Signature::New(desc, dispatchEventArgc, dispatchEventArgv); + proto->Set(v8::String::New("dispatchEvent"), v8::FunctionTemplate::New(TestEventTargetInternal::dispatchEventCallback, v8::Handle<v8::Value>(), dispatchEventSignature)); + + // Custom toString template + desc->Set(getToStringName(), getToStringTemplate()); + return desc; +} + +v8::Persistent<v8::FunctionTemplate> V8TestEventTarget::GetRawTemplate() +{ + V8BindingPerIsolateData* data = V8BindingPerIsolateData::current(); + V8BindingPerIsolateData::TemplateMap::iterator result = data->rawTemplateMap().find(&info); + if (result != data->rawTemplateMap().end()) + return result->second; + + v8::HandleScope handleScope; + v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate(); + data->rawTemplateMap().add(&info, templ); + return templ; +} + +v8::Persistent<v8::FunctionTemplate> V8TestEventTarget::GetTemplate() +{ + V8BindingPerIsolateData* data = V8BindingPerIsolateData::current(); + V8BindingPerIsolateData::TemplateMap::iterator result = data->templateMap().find(&info); + if (result != data->templateMap().end()) + return result->second; + + v8::HandleScope handleScope; + v8::Persistent<v8::FunctionTemplate> templ = + ConfigureV8TestEventTargetTemplate(GetRawTemplate()); + data->templateMap().add(&info, templ); + return templ; +} + +bool V8TestEventTarget::HasInstance(v8::Handle<v8::Value> value) +{ + return GetRawTemplate()->HasInstance(value); +} + + +v8::Handle<v8::Object> V8TestEventTarget::wrapSlow(TestEventTarget* impl) +{ + v8::Handle<v8::Object> wrapper; + V8Proxy* proxy = 0; + wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl); + if (wrapper.IsEmpty()) + return wrapper; + + impl->ref(); + v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper); + + if (!hasDependentLifetime) + wrapperHandle.MarkIndependent(); + getDOMObjectMap().set(impl, wrapperHandle); + return wrapper; +} + +void V8TestEventTarget::derefObject(void* object) +{ + static_cast<TestEventTarget*>(object)->deref(); +} + +} // namespace WebCore diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.h b/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.h new file mode 100644 index 000000000..073412f80 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.h @@ -0,0 +1,82 @@ +/* + 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 V8TestEventTarget_h +#define V8TestEventTarget_h + +#include "TestEventTarget.h" +#include "V8DOMWrapper.h" +#include "WrapperTypeInfo.h" +#include <v8.h> +#include <wtf/HashMap.h> +#include <wtf/text/StringHash.h> + +namespace WebCore { + +class V8TestEventTarget { +public: + static const bool hasDependentLifetime = false; + static bool HasInstance(v8::Handle<v8::Value>); + static v8::Persistent<v8::FunctionTemplate> GetRawTemplate(); + static v8::Persistent<v8::FunctionTemplate> GetTemplate(); + static TestEventTarget* toNative(v8::Handle<v8::Object> object) + { + return reinterpret_cast<TestEventTarget*>(object->GetPointerFromInternalField(v8DOMWrapperObjectIndex)); + } + inline static v8::Handle<v8::Object> wrap(TestEventTarget*); + static void derefObject(void*); + static WrapperTypeInfo info; + static v8::Handle<v8::Value> indexedPropertyGetter(uint32_t, const v8::AccessorInfo&); + static v8::Handle<v8::Value> namedPropertyGetter(v8::Local<v8::String>, const v8::AccessorInfo&); + static const int eventListenerCacheIndex = v8DefaultWrapperInternalFieldCount + 0; + static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 1; + static v8::Handle<v8::Object> existingWrapper(TestEventTarget*); + +private: + static v8::Handle<v8::Object> wrapSlow(TestEventTarget*); +}; + +ALWAYS_INLINE v8::Handle<v8::Object> V8TestEventTarget::existingWrapper(TestEventTarget* impl) +{ + return getDOMObjectMap().get(impl); +} + +v8::Handle<v8::Object> V8TestEventTarget::wrap(TestEventTarget* impl) +{ + v8::Handle<v8::Object> wrapper = existingWrapper(impl); + if (!wrapper.IsEmpty()) + return wrapper; + return V8TestEventTarget::wrapSlow(impl); +} + +inline v8::Handle<v8::Value> toV8(TestEventTarget* impl) +{ + if (!impl) + return v8::Null(); + return V8TestEventTarget::wrap(impl); +} +inline v8::Handle<v8::Value> toV8(PassRefPtr< TestEventTarget > impl) +{ + return toV8(impl.get()); +} + +} + +#endif // V8TestEventTarget_h diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp index 5358b5ecb..ec1f4e046 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp @@ -32,7 +32,11 @@ #include "V8DOMWrapper.h" #include "V8IsolatedContext.h" #include "V8Proxy.h" +#include "V8TestObj.h" #include "V8TestSupplemental.h" +#include <wtf/GetPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> #include <wtf/UnusedParam.h> namespace WebCore { @@ -45,56 +49,101 @@ template <typename T> void V8_USE(T) { } #if ENABLE(Condition11) || ENABLE(Condition12) -static v8::Handle<v8::Value> str1AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +static v8::Handle<v8::Value> supplementalStr1AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { - INC_STATS("DOM.TestInterface.str1._get"); + INC_STATS("DOM.TestInterface.supplementalStr1._get"); TestInterface* imp = V8TestInterface::toNative(info.Holder()); - return v8String(TestSupplemental::str1(imp)); + return v8String(TestSupplemental::supplementalStr1(imp)); } #endif // ENABLE(Condition11) || ENABLE(Condition12) #if ENABLE(Condition11) || ENABLE(Condition12) -static v8::Handle<v8::Value> str2AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +static v8::Handle<v8::Value> supplementalStr2AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { - INC_STATS("DOM.TestInterface.str2._get"); + INC_STATS("DOM.TestInterface.supplementalStr2._get"); TestInterface* imp = V8TestInterface::toNative(info.Holder()); - return v8String(TestSupplemental::str2(imp)); + return v8String(TestSupplemental::supplementalStr2(imp)); } #endif // ENABLE(Condition11) || ENABLE(Condition12) #if ENABLE(Condition11) || ENABLE(Condition12) -static void str2AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +static void supplementalStr2AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { - INC_STATS("DOM.TestInterface.str2._set"); + INC_STATS("DOM.TestInterface.supplementalStr2._set"); TestInterface* imp = V8TestInterface::toNative(info.Holder()); STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<>, v, value); - TestSupplemental::setStr2(imp, v); + TestSupplemental::setSupplementalStr2(imp, v); return; } #endif // ENABLE(Condition11) || ENABLE(Condition12) +#if ENABLE(Condition11) || ENABLE(Condition12) + +static v8::Handle<v8::Value> supplementalMethod1Callback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestInterface.supplementalMethod1"); + TestInterface* imp = V8TestInterface::toNative(args.Holder()); + TestSupplemental::supplementalMethod1(imp); + return v8::Handle<v8::Value>(); +} + +#endif // ENABLE(Condition11) || ENABLE(Condition12) + +#if ENABLE(Condition11) || ENABLE(Condition12) + +static v8::Handle<v8::Value> supplementalMethod2Callback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestInterface.supplementalMethod2"); + if (args.Length() < 2) + return throwError("Not enough arguments", V8Proxy::TypeError); + TestInterface* imp = V8TestInterface::toNative(args.Holder()); + ExceptionCode ec = 0; + { + STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)); + EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined)) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined))) : 0); + ScriptExecutionContext* scriptContext = getScriptExecutionContext(); + if (!scriptContext) + return v8::Undefined(); + RefPtr<TestObj> result = TestSupplemental::supplementalMethod2(imp, scriptContext, strArg, objArg, ec); + if (UNLIKELY(ec)) + goto fail; + return toV8(result.release()); + } + fail: + V8Proxy::setDOMException(ec); + return v8::Handle<v8::Value>(); +} + +#endif // ENABLE(Condition11) || ENABLE(Condition12) + } // namespace TestInterfaceInternal static const BatchedAttribute TestInterfaceAttrs[] = { #if ENABLE(Condition11) || ENABLE(Condition12) - // Attribute 'str1' (Type: 'readonly attribute' ExtAttr: 'Conditional ImplementedBy') - {"str1", TestInterfaceInternal::str1AttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'supplementalStr1' (Type: 'readonly attribute' ExtAttr: 'Conditional ImplementedBy') + {"supplementalStr1", TestInterfaceInternal::supplementalStr1AttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, #endif // ENABLE(Condition11) || ENABLE(Condition12) #if ENABLE(Condition11) || ENABLE(Condition12) - // Attribute 'str2' (Type: 'attribute' ExtAttr: 'Conditional ImplementedBy') - {"str2", TestInterfaceInternal::str2AttrGetter, TestInterfaceInternal::str2AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'supplementalStr2' (Type: 'attribute' ExtAttr: 'Conditional ImplementedBy') + {"supplementalStr2", TestInterfaceInternal::supplementalStr2AttrGetter, TestInterfaceInternal::supplementalStr2AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, #endif // ENABLE(Condition11) || ENABLE(Condition12) #if ENABLE(Condition11) || ENABLE(Condition12) - // Attribute 'str3' (Type: 'attribute' ExtAttr: 'CustomSetter CustomGetter Conditional ImplementedBy') - {"str3", V8TestSupplemental::str3AccessorGetter, V8TestSupplemental::str3AccessorSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'supplementalStr3' (Type: 'attribute' ExtAttr: 'CustomSetter CustomGetter Conditional ImplementedBy') + {"supplementalStr3", V8TestSupplemental::supplementalStr3AccessorGetter, V8TestSupplemental::supplementalStr3AccessorSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, #endif // ENABLE(Condition11) || ENABLE(Condition12) }; +static const BatchedCallback TestInterfaceCallbacks[] = { +#if ENABLE(Condition11) || ENABLE(Condition12) + {"supplementalMethod1", TestInterfaceInternal::supplementalMethod1Callback}, +#endif +}; + v8::Handle<v8::Value> V8TestInterface::constructorCallback(const v8::Arguments& args) { INC_STATS("DOM.TestInterface.Constructor"); @@ -135,11 +184,23 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestInterfaceTemplate(v8: v8::Local<v8::Signature> defaultSignature; defaultSignature = configureTemplate(desc, "TestInterface", v8::Persistent<v8::FunctionTemplate>(), V8TestInterface::internalFieldCount, TestInterfaceAttrs, WTF_ARRAY_LENGTH(TestInterfaceAttrs), - 0, 0); + TestInterfaceCallbacks, WTF_ARRAY_LENGTH(TestInterfaceCallbacks)); UNUSED_PARAM(defaultSignature); // In some cases, it will not be used. desc->SetCallHandler(V8TestInterface::constructorCallback); + v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); + v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); + UNUSED_PARAM(instance); // In some cases, it will not be used. + UNUSED_PARAM(proto); // In some cases, it will not be used. + // Custom Signature 'supplementalMethod2' + const int supplementalMethod2Argc = 2; + v8::Handle<v8::FunctionTemplate> supplementalMethod2Argv[supplementalMethod2Argc] = { v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() }; + v8::Handle<v8::Signature> supplementalMethod2Signature = v8::Signature::New(desc, supplementalMethod2Argc, supplementalMethod2Argv); +#if ENABLE(Condition11) || ENABLE(Condition12) + proto->Set(v8::String::New("supplementalMethod2"), v8::FunctionTemplate::New(TestInterfaceInternal::supplementalMethod2Callback, v8::Handle<v8::Value>(), supplementalMethod2Signature)); +#endif // ENABLE(Condition11) || ENABLE(Condition12) + // Custom toString template desc->Set(getToStringName(), getToStringTemplate()); return desc; diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.h b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.h index a048c8341..7216c0278 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.h +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.h @@ -47,6 +47,7 @@ public: static WrapperTypeInfo info; static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>); static v8::Handle<v8::Value> constructorCallback(const v8::Arguments&); + static v8::Handle<v8::Value> namedPropertySetter(v8::Local<v8::String>, v8::Local<v8::Value>, const v8::AccessorInfo&); static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0; static v8::Handle<v8::Object> existingWrapper(TestInterface*); diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp index cb3cd6cb2..17c0a03ad 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp @@ -27,19 +27,29 @@ #include "IDBKey.h" #include "OptionsObject.h" #include "RuntimeEnabledFeatures.h" +#include "SVGPropertyTearOff.h" +#include "SVGStaticPropertyTearOff.h" #include "ScriptArguments.h" #include "ScriptCallStack.h" #include "ScriptCallStackFactory.h" -#include "ScriptController.h" #include "SerializedScriptValue.h" #include "V8Binding.h" #include "V8BindingMacros.h" #include "V8BindingState.h" #include "V8DOMWrapper.h" +#include "V8Document.h" #include "V8IsolatedContext.h" #include "V8Proxy.h" +#include "V8SVGDocument.h" +#include "V8SVGPoint.h" #include "V8TestCallback.h" +#include "V8a.h" #include "V8any.h" +#include "V8b.h" +#include "V8bool.h" +#include "V8c.h" +#include "V8d.h" +#include "V8e.h" #include "V8int.h" #include "V8log.h" #include <wtf/GetPtr.h> @@ -675,6 +685,64 @@ static void doubleArrayAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Valu return; } +static v8::Handle<v8::Value> contentDocumentAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.contentDocument._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + if (!V8BindingSecurity::allowAccessToNode(V8BindingState::Only(), imp->contentDocument())) + return v8::Handle<v8::Value>(); + + return toV8(imp->contentDocument()); +} + +static v8::Handle<v8::Value> mutablePointAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.mutablePoint._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return toV8(WTF::getPtr(SVGStaticPropertyTearOff<TestObj, FloatPoint>::create(imp, imp->mutablePoint(), &TestObj::updateMutablePoint))); +} + +static void mutablePointAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.mutablePoint._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + RefPtr<SVGPropertyTearOff<FloatPoint> > v = V8SVGPoint::HasInstance(value) ? V8SVGPoint::toNative(v8::Handle<v8::Object>::Cast(value)) : 0; + imp->setMutablePoint(WTF::getPtr(v)); + return; +} + +static v8::Handle<v8::Value> immutablePointAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.immutablePoint._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return toV8(WTF::getPtr(SVGPropertyTearOff<FloatPoint>::create(imp->immutablePoint()))); +} + +static void immutablePointAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.immutablePoint._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + RefPtr<SVGPropertyTearOff<FloatPoint> > v = V8SVGPoint::HasInstance(value) ? V8SVGPoint::toNative(v8::Handle<v8::Object>::Cast(value)) : 0; + imp->setImmutablePoint(WTF::getPtr(v)); + return; +} + +static v8::Handle<v8::Value> strictFloatAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.strictFloat._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8::Number::New(imp->strictFloat()); +} + +static void strictFloatAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.strictFloat._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + float v = static_cast<float>(value->NumberValue()); + imp->setStrictFloat(v); + return; +} + static v8::Handle<v8::Value> descriptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.TestObj.description._get"); @@ -894,89 +962,6 @@ static v8::Handle<v8::Value> removeEventListenerCallback(const v8::Arguments& ar 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"); - if (args.Length() < 1) - return throwError("Not enough arguments", V8Proxy::TypeError); - TestObj* imp = V8TestObj::toNative(args.Holder()); - EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined))); - 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"); - if (args.Length() < 1) - return throwError("Not enough arguments", V8Proxy::TypeError); - TestObj* imp = V8TestObj::toNative(args.Holder()); - EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined))); - if (args.Length() <= 1) { - Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext(); - if (!enteredFrame) - return v8::Undefined(); - imp->withDynamicFrameAndOptionalArg(enteredFrame, intArg); - return v8::Handle<v8::Value>(); - } - EXCEPTION_BLOCK(int, optionalArg, toInt32(MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined))); - 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"); - if (args.Length() < 1) - return throwError("Not enough arguments", V8Proxy::TypeError); - TestObj* imp = V8TestObj::toNative(args.Holder()); - EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined))); - Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext(); - if (!enteredFrame) - return v8::Undefined(); - imp->withDynamicFrameAndUserGesture(enteredFrame, intArg, ScriptController::processingUserGesture()); - return v8::Handle<v8::Value>(); -} - -static v8::Handle<v8::Value> withDynamicFrameAndUserGestureASADCallback(const v8::Arguments& args) -{ - INC_STATS("DOM.TestObj.withDynamicFrameAndUserGestureASAD"); - if (args.Length() < 1) - return throwError("Not enough arguments", V8Proxy::TypeError); - TestObj* imp = V8TestObj::toNative(args.Holder()); - EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined))); - if (args.Length() <= 1) { - Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext(); - if (!enteredFrame) - return v8::Undefined(); - imp->withDynamicFrameAndUserGestureASAD(enteredFrame, intArg, ScriptController::processingUserGesture()); - return v8::Handle<v8::Value>(); - } - EXCEPTION_BLOCK(int, optionalArg, toInt32(MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined))); - Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext(); - if (!enteredFrame) - return v8::Undefined(); - imp->withDynamicFrameAndUserGestureASAD(enteredFrame, intArg, optionalArg, ScriptController::processingUserGesture()); - return v8::Handle<v8::Value>(); -} - static v8::Handle<v8::Value> withScriptStateVoidCallback(const v8::Arguments& args) { INC_STATS("DOM.TestObj.withScriptStateVoid"); @@ -1362,6 +1347,122 @@ static v8::Handle<v8::Value> enabledAtRuntimeMethod2Callback(const v8::Arguments return v8::Handle<v8::Value>(); } +static v8::Handle<v8::Value> getSVGDocumentCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.getSVGDocument"); + TestObj* imp = V8TestObj::toNative(args.Holder()); + ExceptionCode ec = 0; + { + if (!V8BindingSecurity::allowAccessToNode(V8BindingState::Only(), imp->getSVGDocument(ec))) + return v8::Handle<v8::Value>(); + RefPtr<SVGDocument> result = imp->getSVGDocument(ec); + if (UNLIKELY(ec)) + goto fail; + return toV8(result.release()); + } + fail: + V8Proxy::setDOMException(ec); + return v8::Handle<v8::Value>(); +} + +static v8::Handle<v8::Value> convert1Callback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.convert1"); + if (args.Length() < 1) + return throwError("Not enough arguments", V8Proxy::TypeError); + TestObj* imp = V8TestObj::toNative(args.Holder()); + EXCEPTION_BLOCK(a*, , V8a::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)) ? V8a::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined))) : 0); + imp->convert1(); + return v8::Handle<v8::Value>(); +} + +static v8::Handle<v8::Value> convert2Callback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.convert2"); + if (args.Length() < 1) + return throwError("Not enough arguments", V8Proxy::TypeError); + TestObj* imp = V8TestObj::toNative(args.Holder()); + EXCEPTION_BLOCK(b*, , V8b::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)) ? V8b::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined))) : 0); + imp->convert2(); + return v8::Handle<v8::Value>(); +} + +static v8::Handle<v8::Value> convert3Callback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.convert3"); + if (args.Length() < 1) + return throwError("Not enough arguments", V8Proxy::TypeError); + TestObj* imp = V8TestObj::toNative(args.Holder()); + EXCEPTION_BLOCK(c*, , V8c::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)) ? V8c::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined))) : 0); + imp->convert3(); + return v8::Handle<v8::Value>(); +} + +static v8::Handle<v8::Value> convert4Callback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.convert4"); + if (args.Length() < 1) + return throwError("Not enough arguments", V8Proxy::TypeError); + TestObj* imp = V8TestObj::toNative(args.Holder()); + EXCEPTION_BLOCK(d*, , V8d::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)) ? V8d::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined))) : 0); + imp->convert4(); + return v8::Handle<v8::Value>(); +} + +static v8::Handle<v8::Value> convert5Callback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.convert5"); + if (args.Length() < 1) + return throwError("Not enough arguments", V8Proxy::TypeError); + TestObj* imp = V8TestObj::toNative(args.Holder()); + EXCEPTION_BLOCK(e*, , V8e::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)) ? V8e::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined))) : 0); + imp->convert5(); + return v8::Handle<v8::Value>(); +} + +static v8::Handle<v8::Value> mutablePointFunctionCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.mutablePointFunction"); + TestObj* imp = V8TestObj::toNative(args.Holder()); + return toV8(WTF::getPtr(SVGPropertyTearOff<FloatPoint>::create(imp->mutablePointFunction()))); +} + +static v8::Handle<v8::Value> immutablePointFunctionCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.immutablePointFunction"); + TestObj* imp = V8TestObj::toNative(args.Holder()); + return toV8(WTF::getPtr(SVGPropertyTearOff<FloatPoint>::create(imp->immutablePointFunction()))); +} + +static v8::Handle<v8::Value> orangeCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.orange"); + TestObj* imp = V8TestObj::toNative(args.Holder()); + imp->banana(); + return v8::Handle<v8::Value>(); +} + +static v8::Handle<v8::Value> strictFunctionCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.strictFunction"); + if (args.Length() < 3) + return throwError("Not enough arguments", V8Proxy::TypeError); + TestObj* imp = V8TestObj::toNative(args.Holder()); + ExceptionCode ec = 0; + { + STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str, MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)); + EXCEPTION_BLOCK(float, a, static_cast<float>(MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined)->NumberValue())); + EXCEPTION_BLOCK(int, b, V8int::HasInstance(MAYBE_MISSING_PARAMETER(args, 2, MissingIsUndefined)) ? V8int::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 2, MissingIsUndefined))) : 0); + RefPtr<bool> result = imp->strictFunction(str, a, b, ec); + if (UNLIKELY(ec)) + goto fail; + return toV8(result.release()); + } + fail: + V8Proxy::setDOMException(ec); + return v8::Handle<v8::Value>(); +} + } // namespace TestObjInternal static const BatchedAttribute TestObjAttrs[] = { @@ -1455,6 +1556,14 @@ static const BatchedAttribute TestObjAttrs[] = { {"floatArray", TestObjInternal::floatArrayAttrGetter, TestObjInternal::floatArrayAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'doubleArray' (Type: 'attribute' ExtAttr: '') {"doubleArray", TestObjInternal::doubleArrayAttrGetter, TestObjInternal::doubleArrayAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'contentDocument' (Type: 'readonly attribute' ExtAttr: 'CheckFrameSecurity') + {"contentDocument", TestObjInternal::contentDocumentAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'mutablePoint' (Type: 'attribute' ExtAttr: '') + {"mutablePoint", TestObjInternal::mutablePointAttrGetter, TestObjInternal::mutablePointAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'immutablePoint' (Type: 'attribute' ExtAttr: 'Immutable') + {"immutablePoint", TestObjInternal::immutablePointAttrGetter, TestObjInternal::immutablePointAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'strictFloat' (Type: 'attribute' ExtAttr: 'StrictTypeChecking') + {"strictFloat", TestObjInternal::strictFloatAttrGetter, TestObjInternal::strictFloatAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'description' (Type: 'readonly attribute' ExtAttr: '') {"description", TestObjInternal::descriptionAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'id' (Type: 'attribute' ExtAttr: '') @@ -1475,11 +1584,6 @@ static const BatchedCallback TestObjCallbacks[] = { {"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}, @@ -1501,6 +1605,11 @@ static const BatchedCallback TestObjCallbacks[] = { {"conditionalMethod3", TestObjInternal::conditionalMethod3Callback}, #endif {"overloadedMethod", TestObjInternal::overloadedMethodCallback}, + {"getSVGDocument", TestObjInternal::getSVGDocumentCallback}, + {"mutablePointFunction", TestObjInternal::mutablePointFunctionCallback}, + {"immutablePointFunction", TestObjInternal::immutablePointFunctionCallback}, + {"orange", TestObjInternal::orangeCallback}, + {"strictFunction", TestObjInternal::strictFunctionCallback}, }; static const BatchedConstant TestObjConsts[] = { @@ -1623,6 +1732,36 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persi proto->Set(v8::String::New("enabledAtRuntimeMethod1"), v8::FunctionTemplate::New(TestObjInternal::enabledAtRuntimeMethod1Callback, v8::Handle<v8::Value>(), defaultSignature)); if (RuntimeEnabledFeatures::featureNameEnabled()) proto->Set(v8::String::New("enabledAtRuntimeMethod2"), v8::FunctionTemplate::New(TestObjInternal::enabledAtRuntimeMethod2Callback, v8::Handle<v8::Value>(), defaultSignature)); + + // Custom Signature 'convert1' + const int convert1Argc = 1; + v8::Handle<v8::FunctionTemplate> convert1Argv[convert1Argc] = { V8a::GetRawTemplate() }; + v8::Handle<v8::Signature> convert1Signature = v8::Signature::New(desc, convert1Argc, convert1Argv); + proto->Set(v8::String::New("convert1"), v8::FunctionTemplate::New(TestObjInternal::convert1Callback, v8::Handle<v8::Value>(), convert1Signature)); + + // Custom Signature 'convert2' + const int convert2Argc = 1; + v8::Handle<v8::FunctionTemplate> convert2Argv[convert2Argc] = { V8b::GetRawTemplate() }; + v8::Handle<v8::Signature> convert2Signature = v8::Signature::New(desc, convert2Argc, convert2Argv); + proto->Set(v8::String::New("convert2"), v8::FunctionTemplate::New(TestObjInternal::convert2Callback, v8::Handle<v8::Value>(), convert2Signature)); + + // Custom Signature 'convert3' + const int convert3Argc = 1; + v8::Handle<v8::FunctionTemplate> convert3Argv[convert3Argc] = { V8c::GetRawTemplate() }; + v8::Handle<v8::Signature> convert3Signature = v8::Signature::New(desc, convert3Argc, convert3Argv); + proto->Set(v8::String::New("convert3"), v8::FunctionTemplate::New(TestObjInternal::convert3Callback, v8::Handle<v8::Value>(), convert3Signature)); + + // Custom Signature 'convert4' + const int convert4Argc = 1; + v8::Handle<v8::FunctionTemplate> convert4Argv[convert4Argc] = { V8d::GetRawTemplate() }; + v8::Handle<v8::Signature> convert4Signature = v8::Signature::New(desc, convert4Argc, convert4Argv); + proto->Set(v8::String::New("convert4"), v8::FunctionTemplate::New(TestObjInternal::convert4Callback, v8::Handle<v8::Value>(), convert4Signature)); + + // Custom Signature 'convert5' + const int convert5Argc = 1; + v8::Handle<v8::FunctionTemplate> convert5Argv[convert5Argc] = { V8e::GetRawTemplate() }; + v8::Handle<v8::Signature> convert5Signature = v8::Signature::New(desc, convert5Argc, convert5Argv); + proto->Set(v8::String::New("convert5"), v8::FunctionTemplate::New(TestObjInternal::convert5Callback, v8::Handle<v8::Value>(), convert5Signature)); batchConfigureConstants(desc, proto, TestObjConsts, WTF_ARRAY_LENGTH(TestObjConsts)); // Custom toString template diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestOverridingNameGetter.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestOverridingNameGetter.cpp new file mode 100644 index 000000000..1ca6a4de9 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestOverridingNameGetter.cpp @@ -0,0 +1,135 @@ +/* + 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 "V8TestOverridingNameGetter.h" + +#include "ExceptionCode.h" +#include "RuntimeEnabledFeatures.h" +#include "V8Binding.h" +#include "V8BindingMacros.h" +#include "V8BindingState.h" +#include "V8DOMWrapper.h" +#include "V8IsolatedContext.h" +#include "V8Proxy.h" +#include <wtf/UnusedParam.h> + +namespace WebCore { + +WrapperTypeInfo V8TestOverridingNameGetter::info = { V8TestOverridingNameGetter::GetTemplate, V8TestOverridingNameGetter::derefObject, 0, 0 }; + +namespace TestOverridingNameGetterInternal { + +template <typename T> void V8_USE(T) { } + +static v8::Handle<v8::Value> anotherFunctionCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestOverridingNameGetter.anotherFunction"); + if (args.Length() < 1) + return throwError("Not enough arguments", V8Proxy::TypeError); + TestOverridingNameGetter* imp = V8TestOverridingNameGetter::toNative(args.Holder()); + STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str, MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)); + imp->anotherFunction(str); + return v8::Handle<v8::Value>(); +} + +} // namespace TestOverridingNameGetterInternal + +static const BatchedCallback TestOverridingNameGetterCallbacks[] = { + {"anotherFunction", TestOverridingNameGetterInternal::anotherFunctionCallback}, +}; + +static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestOverridingNameGetterTemplate(v8::Persistent<v8::FunctionTemplate> desc) +{ + desc->ReadOnlyPrototype(); + + v8::Local<v8::Signature> defaultSignature; + defaultSignature = configureTemplate(desc, "TestOverridingNameGetter", v8::Persistent<v8::FunctionTemplate>(), V8TestOverridingNameGetter::internalFieldCount, + 0, 0, + TestOverridingNameGetterCallbacks, WTF_ARRAY_LENGTH(TestOverridingNameGetterCallbacks)); + UNUSED_PARAM(defaultSignature); // In some cases, it will not be used. + v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); + v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); + UNUSED_PARAM(instance); // In some cases, it will not be used. + UNUSED_PARAM(proto); // In some cases, it will not be used. + + desc->InstanceTemplate()->SetNamedPropertyHandler(V8TestOverridingNameGetter::namedPropertyGetter, 0, 0, 0, 0); + + // Custom toString template + desc->Set(getToStringName(), getToStringTemplate()); + return desc; +} + +v8::Persistent<v8::FunctionTemplate> V8TestOverridingNameGetter::GetRawTemplate() +{ + V8BindingPerIsolateData* data = V8BindingPerIsolateData::current(); + V8BindingPerIsolateData::TemplateMap::iterator result = data->rawTemplateMap().find(&info); + if (result != data->rawTemplateMap().end()) + return result->second; + + v8::HandleScope handleScope; + v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate(); + data->rawTemplateMap().add(&info, templ); + return templ; +} + +v8::Persistent<v8::FunctionTemplate> V8TestOverridingNameGetter::GetTemplate() +{ + V8BindingPerIsolateData* data = V8BindingPerIsolateData::current(); + V8BindingPerIsolateData::TemplateMap::iterator result = data->templateMap().find(&info); + if (result != data->templateMap().end()) + return result->second; + + v8::HandleScope handleScope; + v8::Persistent<v8::FunctionTemplate> templ = + ConfigureV8TestOverridingNameGetterTemplate(GetRawTemplate()); + data->templateMap().add(&info, templ); + return templ; +} + +bool V8TestOverridingNameGetter::HasInstance(v8::Handle<v8::Value> value) +{ + return GetRawTemplate()->HasInstance(value); +} + + +v8::Handle<v8::Object> V8TestOverridingNameGetter::wrapSlow(TestOverridingNameGetter* impl) +{ + v8::Handle<v8::Object> wrapper; + V8Proxy* proxy = 0; + wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl); + if (wrapper.IsEmpty()) + return wrapper; + + impl->ref(); + v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper); + + if (!hasDependentLifetime) + wrapperHandle.MarkIndependent(); + getDOMObjectMap().set(impl, wrapperHandle); + return wrapper; +} + +void V8TestOverridingNameGetter::derefObject(void* object) +{ + static_cast<TestOverridingNameGetter*>(object)->deref(); +} + +} // namespace WebCore diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestOverridingNameGetter.h b/Source/WebCore/bindings/scripts/test/V8/V8TestOverridingNameGetter.h new file mode 100644 index 000000000..8c1b8e021 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestOverridingNameGetter.h @@ -0,0 +1,80 @@ +/* + 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 V8TestOverridingNameGetter_h +#define V8TestOverridingNameGetter_h + +#include "TestOverridingNameGetter.h" +#include "V8DOMWrapper.h" +#include "WrapperTypeInfo.h" +#include <v8.h> +#include <wtf/HashMap.h> +#include <wtf/text/StringHash.h> + +namespace WebCore { + +class V8TestOverridingNameGetter { +public: + static const bool hasDependentLifetime = false; + static bool HasInstance(v8::Handle<v8::Value>); + static v8::Persistent<v8::FunctionTemplate> GetRawTemplate(); + static v8::Persistent<v8::FunctionTemplate> GetTemplate(); + static TestOverridingNameGetter* toNative(v8::Handle<v8::Object> object) + { + return reinterpret_cast<TestOverridingNameGetter*>(object->GetPointerFromInternalField(v8DOMWrapperObjectIndex)); + } + inline static v8::Handle<v8::Object> wrap(TestOverridingNameGetter*); + static void derefObject(void*); + static WrapperTypeInfo info; + static v8::Handle<v8::Value> namedPropertyGetter(v8::Local<v8::String>, const v8::AccessorInfo&); + static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0; + static v8::Handle<v8::Object> existingWrapper(TestOverridingNameGetter*); + +private: + static v8::Handle<v8::Object> wrapSlow(TestOverridingNameGetter*); +}; + +ALWAYS_INLINE v8::Handle<v8::Object> V8TestOverridingNameGetter::existingWrapper(TestOverridingNameGetter* impl) +{ + return getDOMObjectMap().get(impl); +} + +v8::Handle<v8::Object> V8TestOverridingNameGetter::wrap(TestOverridingNameGetter* impl) +{ + v8::Handle<v8::Object> wrapper = existingWrapper(impl); + if (!wrapper.IsEmpty()) + return wrapper; + return V8TestOverridingNameGetter::wrapSlow(impl); +} + +inline v8::Handle<v8::Value> toV8(TestOverridingNameGetter* impl) +{ + if (!impl) + return v8::Null(); + return V8TestOverridingNameGetter::wrap(impl); +} +inline v8::Handle<v8::Value> toV8(PassRefPtr< TestOverridingNameGetter > impl) +{ + return toV8(impl.get()); +} + +} + +#endif // V8TestOverridingNameGetter_h diff --git a/Source/WebCore/bindings/v8/ScriptController.cpp b/Source/WebCore/bindings/v8/ScriptController.cpp index da6bf7a89..cb37809a7 100644 --- a/Source/WebCore/bindings/v8/ScriptController.cpp +++ b/Source/WebCore/bindings/v8/ScriptController.cpp @@ -102,11 +102,6 @@ bool ScriptController::canAccessFromCurrentOrigin(Frame *frame) return !v8::Context::InContext() || V8BindingSecurity::canAccessFrame(V8BindingState::Only(), frame, true); } -bool ScriptController::isSafeScript(Frame* target) -{ - return V8BindingSecurity::canAccessFrame(V8BindingState::Only(), target, true); -} - ScriptController::ScriptController(Frame* frame) : m_frame(frame) , m_sourceURL(0) diff --git a/Source/WebCore/bindings/v8/ScriptController.h b/Source/WebCore/bindings/v8/ScriptController.h index 3b25b15db..24c188587 100644 --- a/Source/WebCore/bindings/v8/ScriptController.h +++ b/Source/WebCore/bindings/v8/ScriptController.h @@ -147,9 +147,6 @@ public: // V8Proxy::retrieveFrameForEnteredContext() for more information. static Frame* retrieveFrameForCurrentContext(); - // Check whether it is safe to access a frame in another domain. - static bool isSafeScript(Frame*); - // Pass command-line flags to the JS engine. static void setFlags(const char* string, int length); diff --git a/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp b/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp index 5bdff1445..b74b26446 100644 --- a/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp @@ -512,11 +512,11 @@ v8::Handle<v8::Value> V8DOMWindow::namedPropertyGetter(v8::Local<v8::String> nam if (doc && doc->isHTMLDocument()) { if (static_cast<HTMLDocument*>(doc)->hasNamedItem(propName.impl()) || doc->hasElementWithId(propName.impl())) { - RefPtr<HTMLCollection> items = doc->windowNamedItems(propName); + HTMLCollection* items = doc->windowNamedItems(propName); if (items->length() >= 1) { if (items->length() == 1) return toV8(items->firstItem()); - return toV8(items.release()); + return toV8(items); } } } diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp index aef37c78b..41ae07171 100644 --- a/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp @@ -79,7 +79,7 @@ v8::Handle<v8::Value> V8HTMLDocument::GetNamedProperty(HTMLDocument* htmlDocumen if (!htmlDocument->hasNamedItem(key.impl()) && !htmlDocument->hasExtraNamedItem(key.impl())) return v8::Handle<v8::Value>(); - RefPtr<HTMLCollection> items = htmlDocument->documentNamedItems(key); + HTMLCollection* items = htmlDocument->documentNamedItems(key); if (!items->length()) return v8::Handle<v8::Value>(); @@ -92,7 +92,7 @@ v8::Handle<v8::Value> V8HTMLDocument::GetNamedProperty(HTMLDocument* htmlDocumen return toV8(node); } - return toV8(items.release()); + return toV8(items); } // HTMLDocument ---------------------------------------------------------------- diff --git a/Source/WebCore/bindings/v8/specialization/V8BindingState.cpp b/Source/WebCore/bindings/v8/specialization/V8BindingState.cpp index 9a91476f9..6152f492c 100644 --- a/Source/WebCore/bindings/v8/specialization/V8BindingState.cpp +++ b/Source/WebCore/bindings/v8/specialization/V8BindingState.cpp @@ -84,9 +84,4 @@ void State<V8Binding>::immediatelyReportUnsafeAccessTo(Frame* target) V8Proxy::reportUnsafeAccessTo(target); } -bool State<V8Binding>::allowsAccessFromFrame(Frame* frame) -{ - return ScriptController::isSafeScript(frame); -} - } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/specialization/V8BindingState.h b/Source/WebCore/bindings/v8/specialization/V8BindingState.h index ce00d61f9..3cda15f49 100644 --- a/Source/WebCore/bindings/v8/specialization/V8BindingState.h +++ b/Source/WebCore/bindings/v8/specialization/V8BindingState.h @@ -55,9 +55,6 @@ public: Frame* activeFrame(); Frame* firstFrame(); - // FIXME: This should be shared in BindingSecurity - bool allowsAccessFromFrame(Frame*); - private: explicit State() {} ~State(); diff --git a/Source/WebCore/bridge/jni/JNIUtility.cpp b/Source/WebCore/bridge/jni/JNIUtility.cpp index d3c6c857c..69d57810e 100644 --- a/Source/WebCore/bridge/jni/JNIUtility.cpp +++ b/Source/WebCore/bridge/jni/JNIUtility.cpp @@ -187,10 +187,6 @@ JavaType javaTypeFromClassName(const char* name) type = JavaTypeVoid; else if ('[' == name[0]) type = JavaTypeArray; -#if USE(V8) - else if (!strcmp("java.lang.String", name)) - type = JavaTypeString; -#endif else type = JavaTypeObject; @@ -207,9 +203,6 @@ const char* signatureFromJavaType(JavaType type) return "["; case JavaTypeObject: -#if USE(V8) - case JavaTypeString: -#endif return "L"; case JavaTypeBoolean: @@ -300,9 +293,6 @@ jvalue getJNIField(jobject obj, JavaType type, const char* name, const char* sig switch (type) { case JavaTypeArray: case JavaTypeObject: -#if USE(V8) - case JavaTypeString: -#endif result.l = env->functions->GetObjectField(env, obj, field); break; case JavaTypeBoolean: @@ -356,9 +346,6 @@ jvalue callJNIMethod(jobject object, JavaType returnType, const char* name, cons callJNIMethodIDA<void>(object, methodId, args); break; case JavaTypeObject: -#if USE(V8) - case JavaTypeString: -#endif result.l = callJNIMethodIDA<jobject>(object, methodId, args); break; case JavaTypeBoolean: diff --git a/Source/WebCore/bridge/jni/JavaType.h b/Source/WebCore/bridge/jni/JavaType.h index 17053fb12..e80ffec11 100644 --- a/Source/WebCore/bridge/jni/JavaType.h +++ b/Source/WebCore/bridge/jni/JavaType.h @@ -53,20 +53,6 @@ enum JavaType { JavaTypeFloat, JavaTypeDouble, JavaTypeArray, -#if USE(V8) - // JavaTypeString is distinct from JavaTypeObject because strings receive - // special handling when we convert to and from JavaScript. When calling - // Java methods, we must create Java String objects for string arguments. - // However, at conversion time we cannot assume that the mechanism used to - // interact with Java is JNI. Instead we use a special JavaTypeString. - // Implementations of JavaInstance which use JNI will create a Java String - // object when converting the JavaValue to a jvalue. - // - // Note that this type is independent of the JavaScript engine, but is - // currently used only with V8. - // See https://bugs.webkit.org/show_bug.cgi?id=57023. - JavaTypeString, -#endif }; } // namespace Bindings diff --git a/Source/WebCore/bridge/jni/jsc/JavaMethodJSC.cpp b/Source/WebCore/bridge/jni/jsc/JavaMethodJSC.cpp index 3cb388903..5e18ea8ba 100644 --- a/Source/WebCore/bridge/jni/jsc/JavaMethodJSC.cpp +++ b/Source/WebCore/bridge/jni/jsc/JavaMethodJSC.cpp @@ -92,9 +92,7 @@ JavaMethod::~JavaMethod() // we get '.' between components from the reflection API. static void appendClassName(StringBuilder& builder, const char* className) { -#if USE(JSC) ASSERT(JSLock::lockCount() > 0); -#endif char* c = fastStrDup(className); @@ -113,9 +111,7 @@ static void appendClassName(StringBuilder& builder, const char* className) const char* JavaMethod::signature() const { if (!m_signature) { -#if USE(JSC) JSLock lock(SilenceAssertionsOnly); -#endif StringBuilder signatureBuilder; signatureBuilder.append('('); @@ -126,11 +122,7 @@ const char* JavaMethod::signature() const appendClassName(signatureBuilder, javaClassName.data()); else { signatureBuilder.append(signatureFromJavaType(type)); - if (type == JavaTypeObject -#if USE(V8) - || type == JavaTypeString -#endif - ) { + if (type == JavaTypeObject) { appendClassName(signatureBuilder, javaClassName.data()); signatureBuilder.append(';'); } @@ -143,11 +135,7 @@ const char* JavaMethod::signature() const appendClassName(signatureBuilder, returnType); else { signatureBuilder.append(signatureFromJavaType(m_returnType)); - if (m_returnType == JavaTypeObject -#if USE(V8) - || m_returnType == JavaTypeString -#endif - ) { + if (m_returnType == JavaTypeObject) { appendClassName(signatureBuilder, returnType); signatureBuilder.append(';'); } diff --git a/Source/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp b/Source/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp deleted file mode 100644 index 88e41742b..000000000 --- a/Source/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright 2010, The Android Open Source Project - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY - * EXPRESS OR 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 "JNIUtilityPrivate.h" - -#if ENABLE(JAVA_BRIDGE) - -#include "JavaInstanceV8.h" -#include "JavaNPObjectV8.h" -#include "JavaValueV8.h" -#include <wtf/text/CString.h> - -namespace JSC { - -namespace Bindings { - -JavaValue convertNPVariantToJavaValue(NPVariant value, const String& javaClass) -{ - CString javaClassName = javaClass.utf8(); - JavaType javaType = javaTypeFromClassName(javaClassName.data()); - JavaValue result; - result.m_type = javaType; - NPVariantType type = value.type; - - switch (javaType) { - case JavaTypeArray: - case JavaTypeObject: - { - // See if we have a Java instance. - if (type == NPVariantType_Object) { - NPObject* objectImp = NPVARIANT_TO_OBJECT(value); - result.m_objectValue = ExtractJavaInstance(objectImp); - } - } - break; - - case JavaTypeString: - { -#ifdef CONVERT_NULL_TO_EMPTY_STRING - if (type == NPVariantType_Null) { - result.m_type = JavaTypeString; - result.m_stringValue = String::fromUTF8(""); - } else -#else - if (type == NPVariantType_String) -#endif - { - NPString src = NPVARIANT_TO_STRING(value); - result.m_type = JavaTypeString; - result.m_stringValue = String::fromUTF8(src.UTF8Characters); - } - } - break; - - case JavaTypeBoolean: - { - if (type == NPVariantType_Bool) - result.m_booleanValue = NPVARIANT_TO_BOOLEAN(value); - } - break; - - case JavaTypeByte: - { - if (type == NPVariantType_Int32) - result.m_byteValue = static_cast<signed char>(NPVARIANT_TO_INT32(value)); - else if (type == NPVariantType_Double) - result.m_byteValue = static_cast<signed char>(NPVARIANT_TO_DOUBLE(value)); - } - break; - - case JavaTypeChar: - { - if (type == NPVariantType_Int32) - result.m_charValue = static_cast<unsigned short>(NPVARIANT_TO_INT32(value)); - } - break; - - case JavaTypeShort: - { - if (type == NPVariantType_Int32) - result.m_shortValue = static_cast<short>(NPVARIANT_TO_INT32(value)); - else if (type == NPVariantType_Double) - result.m_shortValue = static_cast<short>(NPVARIANT_TO_DOUBLE(value)); - } - break; - - case JavaTypeInt: - { - if (type == NPVariantType_Int32) - result.m_intValue = static_cast<int>(NPVARIANT_TO_INT32(value)); - else if (type == NPVariantType_Double) - result.m_intValue = static_cast<int>(NPVARIANT_TO_DOUBLE(value)); - } - break; - - case JavaTypeLong: - { - if (type == NPVariantType_Int32) - result.m_longValue = static_cast<long long>(NPVARIANT_TO_INT32(value)); - else if (type == NPVariantType_Double) - result.m_longValue = static_cast<long long>(NPVARIANT_TO_DOUBLE(value)); - } - break; - - case JavaTypeFloat: - { - if (type == NPVariantType_Int32) - result.m_floatValue = static_cast<float>(NPVARIANT_TO_INT32(value)); - else if (type == NPVariantType_Double) - result.m_floatValue = static_cast<float>(NPVARIANT_TO_DOUBLE(value)); - } - break; - - case JavaTypeDouble: - { - if (type == NPVariantType_Int32) - result.m_doubleValue = static_cast<double>(NPVARIANT_TO_INT32(value)); - else if (type == NPVariantType_Double) - result.m_doubleValue = static_cast<double>(NPVARIANT_TO_DOUBLE(value)); - } - break; - default: - break; - } - return result; -} - - -void convertJavaValueToNPVariant(JavaValue value, NPVariant* result) -{ - switch (value.m_type) { - case JavaTypeVoid: - { - VOID_TO_NPVARIANT(*result); - } - break; - - case JavaTypeObject: - { - // If the JavaValue is a String object, it should have type JavaTypeString. - if (value.m_objectValue) - OBJECT_TO_NPVARIANT(JavaInstanceToNPObject(value.m_objectValue.get()), *result); - else - VOID_TO_NPVARIANT(*result); - } - break; - - case JavaTypeString: - { - const char* utf8String = strdup(value.m_stringValue.utf8().data()); - // The copied string is freed in NPN_ReleaseVariantValue (see npruntime.cpp) - STRINGZ_TO_NPVARIANT(utf8String, *result); - } - break; - - case JavaTypeBoolean: - { - BOOLEAN_TO_NPVARIANT(value.m_booleanValue, *result); - } - break; - - case JavaTypeByte: - { - INT32_TO_NPVARIANT(value.m_byteValue, *result); - } - break; - - case JavaTypeChar: - { - INT32_TO_NPVARIANT(value.m_charValue, *result); - } - break; - - case JavaTypeShort: - { - INT32_TO_NPVARIANT(value.m_shortValue, *result); - } - break; - - case JavaTypeInt: - { - INT32_TO_NPVARIANT(value.m_intValue, *result); - } - break; - - // TODO: Check if cast to double is needed. - case JavaTypeLong: - { - DOUBLE_TO_NPVARIANT(value.m_longValue, *result); - } - break; - - case JavaTypeFloat: - { - DOUBLE_TO_NPVARIANT(value.m_floatValue, *result); - } - break; - - case JavaTypeDouble: - { - DOUBLE_TO_NPVARIANT(value.m_doubleValue, *result); - } - break; - - case JavaTypeInvalid: - default: - { - VOID_TO_NPVARIANT(*result); - } - break; - } -} - -} // namespace Bindings - -} // namespace JSC - -#endif // ENABLE(JAVA_BRIDGE) diff --git a/Source/WebCore/bridge/jni/v8/JavaInstanceV8.h b/Source/WebCore/bridge/jni/v8/JavaInstanceV8.h deleted file mode 100644 index 20d027428..000000000 --- a/Source/WebCore/bridge/jni/v8/JavaInstanceV8.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2003, 2008, 2010 Apple Inc. All rights reserved. - * Copyright 2010, The Android Open Source Project - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY - * EXPRESS OR 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 JavaInstanceV8_h -#define JavaInstanceV8_h - -#if ENABLE(JAVA_BRIDGE) - -#include "JavaValueV8.h" -#include <wtf/RefCounted.h> - -using namespace WTF; - -namespace JSC { - -namespace Bindings { - -class JavaClass; -class JavaField; -class JavaMethod; - -class JavaInstance : public RefCounted<JavaInstance> { -public: - virtual ~JavaInstance() {} - - virtual JavaClass* getClass() const = 0; - // args must be an array of length greater than or equal to the number of - // arguments expected by the method. - virtual JavaValue invokeMethod(const JavaMethod&, JavaValue* args) = 0; - virtual JavaValue getField(const JavaField&) = 0; -}; - -} // namespace Bindings - -} // namespace JSC - -#endif // ENABLE(JAVA_BRIDGE) - -#endif // JavaInstanceV8_h diff --git a/Source/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp b/Source/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp deleted file mode 100644 index 988df2d86..000000000 --- a/Source/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright 2010, The Android Open Source Project - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY - * EXPRESS OR 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 "JavaNPObjectV8.h" - -#if ENABLE(JAVA_BRIDGE) - -#include "JNIUtilityPrivate.h" -#include "JavaClassV8.h" -#include "JavaFieldV8.h" -#include "JavaInstanceV8.h" -#include "JavaMethodV8.h" -#include "JavaValueV8.h" -#include "npruntime_impl.h" - -namespace JSC { - -namespace Bindings { - -static NPObject* AllocJavaNPObject(NPP, NPClass*) -{ - JavaNPObject* obj = static_cast<JavaNPObject*>(malloc(sizeof(JavaNPObject))); - if (!obj) - return 0; - memset(obj, 0, sizeof(JavaNPObject)); - return reinterpret_cast<NPObject*>(obj); -} - -static void FreeJavaNPObject(NPObject* npobj) -{ - JavaNPObject* obj = reinterpret_cast<JavaNPObject*>(npobj); - obj->m_instance = 0; // free does not call the destructor - free(obj); -} - -static NPClass JavaNPObjectClass = { - NP_CLASS_STRUCT_VERSION, - AllocJavaNPObject, // allocate, - FreeJavaNPObject, // free, - 0, // invalidate - JavaNPObjectHasMethod, - JavaNPObjectInvoke, - 0, // invokeDefault, - JavaNPObjectHasProperty, - JavaNPObjectGetProperty, - 0, // setProperty - 0, // removeProperty - 0, // enumerate - 0 // construct -}; - -NPObject* JavaInstanceToNPObject(JavaInstance* instance) -{ - JavaNPObject* object = reinterpret_cast<JavaNPObject*>(_NPN_CreateObject(0, &JavaNPObjectClass)); - object->m_instance = instance; - return reinterpret_cast<NPObject*>(object); -} - -// Returns null if obj is not a wrapper of JavaInstance -JavaInstance* ExtractJavaInstance(NPObject* obj) -{ - if (obj->_class == &JavaNPObjectClass) - return reinterpret_cast<JavaNPObject*>(obj)->m_instance.get(); - return 0; -} - -bool JavaNPObjectHasMethod(NPObject* obj, NPIdentifier identifier) -{ - JavaInstance* instance = ExtractJavaInstance(obj); - if (!instance) - return false; - NPUTF8* name = _NPN_UTF8FromIdentifier(identifier); - if (!name) - return false; - - bool result = (instance->getClass()->methodsNamed(name).size() > 0); - - // TODO: use NPN_MemFree - free(name); - - return result; -} - -bool JavaNPObjectInvoke(NPObject* obj, NPIdentifier identifier, const NPVariant* args, uint32_t argCount, NPVariant* result) -{ - JavaInstance* instance = ExtractJavaInstance(obj); - if (!instance) - return false; - NPUTF8* name = _NPN_UTF8FromIdentifier(identifier); - if (!name) - return false; - - MethodList methodList = instance->getClass()->methodsNamed(name); - // TODO: use NPN_MemFree - free(name); - - // Try to find a good match for the overloaded method. The - // fundamental problem is that JavaScript doesn't have the - // notion of method overloading and Java does. We could - // get a bit more sophisticated and attempt to do some - // type checking as well as checking the number of parameters. - size_t numMethods = methodList.size(); - JavaMethod* aMethod; - JavaMethod* jMethod = 0; - for (size_t methodIndex = 0; methodIndex < numMethods; methodIndex++) { - aMethod = methodList[methodIndex]; - if (aMethod->numParameters() == static_cast<int>(argCount)) { - jMethod = aMethod; - break; - } - } - if (!jMethod) - return false; - - JavaValue* jArgs = new JavaValue[argCount]; - for (unsigned int i = 0; i < argCount; i++) - jArgs[i] = convertNPVariantToJavaValue(args[i], jMethod->parameterAt(i)); - - JavaValue jResult = instance->invokeMethod(*jMethod, jArgs); - delete[] jArgs; - - VOID_TO_NPVARIANT(*result); - convertJavaValueToNPVariant(jResult, result); - return true; -} - -bool JavaNPObjectHasProperty(NPObject* obj, NPIdentifier identifier) -{ - JavaInstance* instance = ExtractJavaInstance(obj); - if (!instance) - return false; - NPUTF8* name = _NPN_UTF8FromIdentifier(identifier); - if (!name) - return false; - bool result = instance->getClass()->fieldNamed(name); - free(name); - return result; -} - -bool JavaNPObjectGetProperty(NPObject* obj, NPIdentifier identifier, NPVariant* result) -{ - VOID_TO_NPVARIANT(*result); - JavaInstance* instance = ExtractJavaInstance(obj); - if (!instance) - return false; - NPUTF8* name = _NPN_UTF8FromIdentifier(identifier); - if (!name) - return false; - - JavaField* field = instance->getClass()->fieldNamed(name); - free(name); // TODO: use NPN_MemFree - if (!field) - return false; - - JavaValue value = instance->getField(*field); - - convertJavaValueToNPVariant(value, result); - - return true; -} - -} // namespace Bindings - -} // namespace JSC - -#endif // ENABLE(JAVA_BRIDGE) diff --git a/Source/WebCore/bridge/jni/v8/JavaNPObjectV8.h b/Source/WebCore/bridge/jni/v8/JavaNPObjectV8.h deleted file mode 100644 index ff3bb5fc0..000000000 --- a/Source/WebCore/bridge/jni/v8/JavaNPObjectV8.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2010, The Android Open Source Project - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY - * EXPRESS OR 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 JavaNPObjectV8_h -#define JavaNPObjectV8_h - -#if ENABLE(JAVA_BRIDGE) - -#include "npruntime.h" -#include <wtf/RefPtr.h> - - -namespace JSC { - -namespace Bindings { - -class JavaInstance; - -struct JavaNPObject { - NPObject m_object; - RefPtr<JavaInstance> m_instance; -}; - -NPObject* JavaInstanceToNPObject(JavaInstance*); -JavaInstance* ExtractJavaInstance(NPObject*); - -bool JavaNPObjectHasMethod(NPObject*, NPIdentifier name); -bool JavaNPObjectInvoke(NPObject*, NPIdentifier methodName, const NPVariant* args, uint32_t argCount, NPVariant* result); -bool JavaNPObjectHasProperty(NPObject*, NPIdentifier name); -bool JavaNPObjectGetProperty(NPObject*, NPIdentifier name, NPVariant* result); - -} // namespace Bindings - -} // namespace JSC - -#endif // ENABLE(JAVA_BRIDGE) - -#endif // JavaNPObjectV8_h diff --git a/Source/WebCore/bridge/jni/v8/JavaValueV8.h b/Source/WebCore/bridge/jni/v8/JavaValueV8.h deleted file mode 100644 index 3e1c623c1..000000000 --- a/Source/WebCore/bridge/jni/v8/JavaValueV8.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2011, The Android Open Source Project - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, 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 ``AS IS'' AND ANY - * EXPRESS OR 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 JavaValueV8_h -#define JavaValueV8_h - -#if ENABLE(JAVA_BRIDGE) - -#include "JavaType.h" - -#include <wtf/text/WTFString.h> - -namespace JSC { - -namespace Bindings { - -class JavaInstance; - -// A variant used to represent a Java value, almost identical to the JNI -// jvalue type. It exists because the logic to convert between JavaScript -// objects (as JavaNPObject or JSValue) and Java objects should not depend upon -// JNI, to allow ports to provide a JavaInstance object etc which does not use -// JNI. This means that the 'object' field of this variant uses JavaInstance, -// not jobject. -// -// Note that this class is independent of the JavaScript engine, but is -// currently used only with V8. -// See https://bugs.webkit.org/show_bug.cgi?id=57023. -struct JavaValue { - JavaValue() : m_type(JavaTypeInvalid) {} - - JavaType m_type; - // We don't use a union because we want to be able to ref-count some of the - // values. This requires types with non-trivial constructors. - RefPtr<JavaInstance> m_objectValue; - bool m_booleanValue; - signed char m_byteValue; - unsigned short m_charValue; - short m_shortValue; - int m_intValue; - long long m_longValue; - float m_floatValue; - double m_doubleValue; - String m_stringValue; -}; - -} // namespace Bindings - -} // namespace JSC - -#endif // ENABLE(JAVA_BRIDGE) - -#endif // JavaValueV8_h diff --git a/Source/WebCore/bridge/jsc/BridgeJSC.h b/Source/WebCore/bridge/jsc/BridgeJSC.h index 95a3973d1..a9f2baed0 100644 --- a/Source/WebCore/bridge/jsc/BridgeJSC.h +++ b/Source/WebCore/bridge/jsc/BridgeJSC.h @@ -27,8 +27,6 @@ #ifndef BridgeJSC_h #define BridgeJSC_h -#if USE(JSC) - #include "Bridge.h" #include <runtime/JSString.h> #include <wtf/HashMap.h> @@ -151,6 +149,4 @@ typedef HashMap<RefPtr<StringImpl>, Field*> FieldMap; } // namespace JSC -#endif // USE(JSC) - #endif diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp index 3e0dc8c21..112abbe83 100644 --- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp +++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp @@ -217,10 +217,11 @@ static const int computedProperties[] = { #endif CSSPropertyWebkitFlexOrder, CSSPropertyWebkitFlexPack, - CSSPropertyWebkitFlexAlign, + CSSPropertyWebkitFlexItemAlign, CSSPropertyWebkitFlexDirection, CSSPropertyWebkitFlexFlow, CSSPropertyWebkitFlexWrap, + CSSPropertyWebkitFontKerning, CSSPropertyWebkitFontSmoothing, #if ENABLE(CSS_GRID_LAYOUT) CSSPropertyWebkitGridColumns, @@ -576,14 +577,9 @@ PassRefPtr<CSSPrimitiveValue> CSSComputedStyleDeclaration::currentColorOrValidCo return cssValuePool->createColorValue(color.rgb()); } -static PassRefPtr<CSSValue> getBorderRadiusCornerValue(LengthSize radius, const RenderStyle* style, CSSValuePool* cssValuePool) +static PassRefPtr<CSSValueList> getBorderRadiusCornerValues(LengthSize radius, const RenderStyle* style, CSSValuePool* cssValuePool) { RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); - if (radius.width() == radius.height()) { - if (radius.width().type() == Percent) - return cssValuePool->createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE); - return zoomAdjustedPixelValue(radius.width().value(), style, cssValuePool); - } if (radius.width().type() == Percent) list->append(cssValuePool->createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE)); else @@ -595,6 +591,58 @@ static PassRefPtr<CSSValue> getBorderRadiusCornerValue(LengthSize radius, const return list.release(); } +static PassRefPtr<CSSValue> getBorderRadiusCornerValue(LengthSize radius, const RenderStyle* style, CSSValuePool* cssValuePool) +{ + if (radius.width() == radius.height()) { + if (radius.width().type() == Percent) + return cssValuePool->createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE); + return zoomAdjustedPixelValue(radius.width().value(), style, cssValuePool); + } + return getBorderRadiusCornerValues(radius, style, cssValuePool); +} + +static PassRefPtr<CSSValueList> getBorderRadiusShorthandValue(const RenderStyle* style, CSSValuePool* cssValuePool) +{ + RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); + bool showHorizontalBottomLeft = style->borderTopRightRadius().width() != style->borderBottomLeftRadius().width(); + bool showHorizontalBottomRight = style->borderBottomRightRadius().width() != style->borderTopLeftRadius().width(); + bool showHorizontalTopRight = style->borderTopRightRadius().width() != style->borderTopLeftRadius().width(); + + bool showVerticalBottomLeft = style->borderTopRightRadius().height() != style->borderBottomLeftRadius().height(); + bool showVerticalBottomRight = (style->borderBottomRightRadius().height() != style->borderTopLeftRadius().height()) || showVerticalBottomLeft; + bool showVerticalTopRight = (style->borderTopRightRadius().height() != style->borderTopLeftRadius().height()) || showVerticalBottomRight; + bool showVerticalTopLeft = (style->borderTopLeftRadius().width() != style->borderTopLeftRadius().height()); + + RefPtr<CSSValueList> topLeftRadius = getBorderRadiusCornerValues(style->borderTopLeftRadius(), style, cssValuePool); + RefPtr<CSSValueList> topRightRadius = getBorderRadiusCornerValues(style->borderTopRightRadius(), style, cssValuePool); + RefPtr<CSSValueList> bottomRightRadius = getBorderRadiusCornerValues(style->borderBottomRightRadius(), style, cssValuePool); + RefPtr<CSSValueList> bottomLeftRadius = getBorderRadiusCornerValues(style->borderBottomLeftRadius(), style, cssValuePool); + + RefPtr<CSSValueList> horizontalRadii = CSSValueList::createSpaceSeparated(); + horizontalRadii->append(topLeftRadius->item(0)); + if (showHorizontalTopRight) + horizontalRadii->append(topRightRadius->item(0)); + if (showHorizontalBottomRight) + horizontalRadii->append(bottomRightRadius->item(0)); + if (showHorizontalBottomLeft) + horizontalRadii->append(bottomLeftRadius->item(0)); + + list->append(horizontalRadii); + + if (showVerticalTopLeft) { + RefPtr<CSSValueList> verticalRadii = CSSValueList::createSpaceSeparated(); + verticalRadii->append(topLeftRadius->item(1)); + if (showVerticalTopRight) + verticalRadii->append(topRightRadius->item(1)); + if (showVerticalBottomRight) + verticalRadii->append(bottomRightRadius->item(1)); + if (showVerticalBottomLeft) + verticalRadii->append(bottomLeftRadius->item(1)); + list->append(verticalRadii); + } + return list.release(); +} + static LayoutRect sizingBox(RenderObject* renderer) { if (!renderer->isBox()) @@ -1473,8 +1521,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper return cssValuePool->createValue(style->flexOrder(), CSSPrimitiveValue::CSS_NUMBER); case CSSPropertyWebkitFlexPack: return cssValuePool->createValue(style->flexPack()); - case CSSPropertyWebkitFlexAlign: - return cssValuePool->createValue(style->flexAlign()); + case CSSPropertyWebkitFlexItemAlign: + return cssValuePool->createValue(style->flexItemAlign()); case CSSPropertyWebkitFlexDirection: return cssValuePool->createValue(style->flexDirection()); case CSSPropertyWebkitFlexWrap: @@ -1819,6 +1867,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper return cssValuePool->createValue(style->matchNearestMailBlockquoteColor()); case CSSPropertyResize: return cssValuePool->createValue(style->resize()); + case CSSPropertyWebkitFontKerning: + return cssValuePool->createValue(style->fontDescription().kerning()); case CSSPropertyWebkitFontSmoothing: return cssValuePool->createValue(style->fontDescription().fontSmoothing()); case CSSPropertyZIndex: @@ -2135,7 +2185,6 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper case CSSPropertyWebkitFilter: return valueForFilter(style.get()); #endif - /* Shorthand properties, currently not supported see bug 13658*/ case CSSPropertyBackground: { const int properties[5] = { CSSPropertyBackgroundColor, CSSPropertyBackgroundImage, CSSPropertyBackgroundRepeat, CSSPropertyBackgroundAttachment, @@ -2170,7 +2219,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper case CSSPropertyBorderImage: return valueForNinePieceImage(style->borderImage(), cssValuePool); case CSSPropertyBorderRadius: - break; + return getBorderRadiusShorthandValue(style.get(), cssValuePool); case CSSPropertyBorderRight: { const int properties[3] = { CSSPropertyBorderRightWidth, CSSPropertyBorderRightStyle, CSSPropertyBorderRightColor }; diff --git a/Source/WebCore/css/CSSFontFaceSrcValue.cpp b/Source/WebCore/css/CSSFontFaceSrcValue.cpp index 57300ef71..3cdece883 100644 --- a/Source/WebCore/css/CSSFontFaceSrcValue.cpp +++ b/Source/WebCore/css/CSSFontFaceSrcValue.cpp @@ -26,6 +26,9 @@ #include "config.h" #include "CSSFontFaceSrcValue.h" #include "CSSStyleSheet.h" +#include "CachedFont.h" +#include "CachedResourceLoader.h" +#include "Document.h" #include "FontCustomPlatformData.h" #include "Node.h" @@ -76,5 +79,14 @@ void CSSFontFaceSrcValue::addSubresourceStyleURLs(ListHashSet<KURL>& urls, const addSubresourceURL(urls, styleSheet->completeURL(m_resource)); } +CachedFont* CSSFontFaceSrcValue::cachedFont(Document* document) +{ + if (!m_cachedFont) { + ResourceRequest request(document->completeURL(m_resource)); + m_cachedFont = document->cachedResourceLoader()->requestFont(request); + } + return m_cachedFont.get(); +} + } diff --git a/Source/WebCore/css/CSSFontFaceSrcValue.h b/Source/WebCore/css/CSSFontFaceSrcValue.h index 121f4d4e1..a5f54de47 100644 --- a/Source/WebCore/css/CSSFontFaceSrcValue.h +++ b/Source/WebCore/css/CSSFontFaceSrcValue.h @@ -27,11 +27,14 @@ #define CSSFontFaceSrcValue_h #include "CSSValue.h" +#include "CachedResourceHandle.h" #include "PlatformString.h" #include <wtf/PassRefPtr.h> namespace WebCore { +class CachedFont; +class Document; class SVGFontFaceElement; class CSSFontFaceSrcValue : public CSSValue { @@ -64,6 +67,8 @@ public: void addSubresourceStyleURLs(ListHashSet<KURL>&, const CSSStyleSheet*); + CachedFont* cachedFont(Document*); + private: CSSFontFaceSrcValue(const String& resource, bool local) : CSSValue(FontFaceSrcClass) @@ -79,6 +84,8 @@ private: String m_format; bool m_isLocal; + CachedResourceHandle<CachedFont> m_cachedFont; + #if ENABLE(SVG_FONTS) SVGFontFaceElement* m_svgFontFaceElement; #endif diff --git a/Source/WebCore/css/CSSFontSelector.cpp b/Source/WebCore/css/CSSFontSelector.cpp index ed715038a..4c90ae3d7 100644 --- a/Source/WebCore/css/CSSFontSelector.cpp +++ b/Source/WebCore/css/CSSFontSelector.cpp @@ -243,8 +243,7 @@ void CSSFontSelector::addFontFaceRule(const CSSFontFaceRule* fontFaceRule) Settings* settings = m_document ? m_document->frame() ? m_document->frame()->settings() : 0 : 0; bool allowDownloading = foundSVGFont || (settings && settings->downloadableBinaryFontsEnabled()); if (allowDownloading && item->isSupportedFormat() && m_document) { - ResourceRequest request(m_document->completeURL(item->resource())); - CachedFont* cachedFont = m_document->cachedResourceLoader()->requestFont(request); + CachedFont* cachedFont = item->cachedFont(m_document); if (cachedFont) { source = adoptPtr(new CSSFontFaceSource(item->resource(), cachedFont)); #if ENABLE(SVG_FONTS) diff --git a/Source/WebCore/css/CSSInitialValue.h b/Source/WebCore/css/CSSInitialValue.h index f5888903b..dd86d8424 100644 --- a/Source/WebCore/css/CSSInitialValue.h +++ b/Source/WebCore/css/CSSInitialValue.h @@ -39,12 +39,16 @@ public: String customCssText() const; + bool isImplicit() const { return m_isImplicit; } + private: CSSInitialValue(bool implicit) : CSSValue(InitialClass) + , m_isImplicit(implicit) { - m_isImplicitInitialValue = implicit; } + + bool m_isImplicit; }; } // namespace WebCore diff --git a/Source/WebCore/css/CSSMutableStyleDeclaration.h b/Source/WebCore/css/CSSMutableStyleDeclaration.h index 54e08edb4..f483fbe5c 100644 --- a/Source/WebCore/css/CSSMutableStyleDeclaration.h +++ b/Source/WebCore/css/CSSMutableStyleDeclaration.h @@ -127,8 +127,6 @@ public: void addSubresourceStyleURLs(ListHashSet<KURL>&); - bool propertiesEqual(const CSSMutableStyleDeclaration* o) const { return m_properties == o->m_properties; } - protected: CSSMutableStyleDeclaration(CSSRule* parentRule); CSSMutableStyleDeclaration(); diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp index 7940b2774..2f5cab605 100644 --- a/Source/WebCore/css/CSSParser.cpp +++ b/Source/WebCore/css/CSSParser.cpp @@ -906,28 +906,28 @@ bool CSSParser::parseValue(int propId, bool important) break; case CSSPropertyPosition: // static | relative | absolute | fixed | inherit - if (id == CSSValueStatic || - id == CSSValueRelative || - id == CSSValueAbsolute || - id == CSSValueFixed) + if (id == CSSValueStatic + || id == CSSValueRelative + || id == CSSValueAbsolute + || id == CSSValueFixed) validPrimitive = true; break; - case CSSPropertyPageBreakAfter: // auto | always | avoid | left | right | inherit + case CSSPropertyPageBreakAfter: // auto | always | avoid | left | right | inherit case CSSPropertyPageBreakBefore: case CSSPropertyWebkitColumnBreakAfter: case CSSPropertyWebkitColumnBreakBefore: case CSSPropertyWebkitRegionBreakAfter: case CSSPropertyWebkitRegionBreakBefore: - if (id == CSSValueAuto || - id == CSSValueAlways || - id == CSSValueAvoid || - id == CSSValueLeft || - id == CSSValueRight) + if (id == CSSValueAuto + || id == CSSValueAlways + || id == CSSValueAvoid + || id == CSSValueLeft + || id == CSSValueRight) validPrimitive = true; break; - case CSSPropertyPageBreakInside: // avoid | auto | inherit + case CSSPropertyPageBreakInside: // avoid | auto | inherit case CSSPropertyWebkitColumnBreakInside: case CSSPropertyWebkitRegionBreakInside: if (id == CSSValueAuto || id == CSSValueAvoid) @@ -935,8 +935,8 @@ bool CSSParser::parseValue(int propId, bool important) break; case CSSPropertyEmptyCells: // show | hide | inherit - if (id == CSSValueShow || - id == CSSValueHide) + if (id == CSSValueShow + || id == CSSValueHide) validPrimitive = true; break; @@ -945,11 +945,11 @@ bool CSSParser::parseValue(int propId, bool important) return parseContent(propId, important); case CSSPropertyWhiteSpace: // normal | pre | nowrap | inherit - if (id == CSSValueNormal || - id == CSSValuePre || - id == CSSValuePreWrap || - id == CSSValuePreLine || - id == CSSValueNowrap) + if (id == CSSValueNormal + || id == CSSValuePre + || id == CSSValuePreWrap + || id == CSSValuePreLine + || id == CSSValueNowrap) validPrimitive = true; break; @@ -1036,8 +1036,8 @@ bool CSSParser::parseValue(int propId, bool important) break; case CSSPropertyClear: // none | left | right | both | inherit - if (id == CSSValueNone || id == CSSValueLeft || - id == CSSValueRight|| id == CSSValueBoth) + if (id == CSSValueNone || id == CSSValueLeft + || id == CSSValueRight|| id == CSSValueBoth) validPrimitive = true; break; @@ -1045,7 +1045,7 @@ bool CSSParser::parseValue(int propId, bool important) // left | right | center | justify | webkit_left | webkit_right | webkit_center | webkit_match_parent | // start | end | <string> | inherit if ((id >= CSSValueWebkitAuto && id <= CSSValueWebkitMatchParent) || id == CSSValueStart || id == CSSValueEnd - || value->unit == CSSPrimitiveValue::CSS_STRING) + || value->unit == CSSPrimitiveValue::CSS_STRING) validPrimitive = true; break; @@ -1408,7 +1408,7 @@ bool CSSParser::parseValue(int propId, bool important) return parseCounter(propId, 1, important); validPrimitive = true; break; - case CSSPropertyCounterReset: // [ <identifier> <integer>? ]+ | none | inherit + case CSSPropertyCounterReset: // [ <identifier> <integer>? ]+ | none | inherit if (id != CSSValueNone) return parseCounter(propId, 0, important); validPrimitive = true; @@ -1637,8 +1637,8 @@ bool CSSParser::parseValue(int propId, bool important) case CSSPropertyWebkitFlexPack: validPrimitive = id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter || id == CSSValueJustify; break; - case CSSPropertyWebkitFlexAlign: - validPrimitive = id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter || id == CSSValueBaseline || id == CSSValueStretch; + case CSSPropertyWebkitFlexItemAlign: + validPrimitive = id == CSSValueAuto || id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter || id == CSSValueBaseline || id == CSSValueStretch; break; case CSSPropertyWebkitFlexDirection: validPrimitive = id == CSSValueRow || id == CSSValueRowReverse || id == CSSValueColumn || id == CSSValueColumnReverse; @@ -2009,7 +2009,7 @@ bool CSSParser::parseValue(int propId, bool important) case CSSPropertyWebkitTapHighlightColor: if ((id >= CSSValueAqua && id <= CSSValueWindowtext) || id == CSSValueMenu || (id >= CSSValueWebkitFocusRingColor && id < CSSValueWebkitText && !m_strict)) { - validPrimitive = true; + validPrimitive = true; } else { parsedValue = parseColor(); if (parsedValue) @@ -2228,6 +2228,11 @@ bool CSSParser::parseValue(int propId, bool important) return parseFontFeatureSettings(important); break; + case CSSPropertyWebkitFontKerning: + if (id == CSSValueAuto || id == CSSValueNormal || id == CSSValueNone) + validPrimitive = true; + break; + case CSSPropertyWebkitWrapShapeInside: case CSSPropertyWebkitWrapShapeOutside: if (id == CSSValueAuto) @@ -5170,7 +5175,7 @@ PassRefPtr<CSSValueList> CSSParser::parseShadow(CSSParserValueList* valueList, i if (!parsedColor || !context.allowColor) return 0; // This value is not a color or length and is invalid or - // it is a color, but a color isn't allowed at this point. + // it is a color, but a color isn't allowed at this point. context.commitColor(parsedColor.release()); } @@ -5458,7 +5463,7 @@ bool CSSParser::parseBorderImage(int propId, RefPtr<CSSValue>& result) static bool isBorderImageRepeatKeyword(int id) { - return id == CSSValueStretch || id == CSSValueRepeat || id == CSSValueSpace || id == CSSValueRound; + return id == CSSValueStretch || id == CSSValueRepeat || id == CSSValueSpace || id == CSSValueRound; } bool CSSParser::parseBorderImageRepeat(RefPtr<CSSValue>& result) @@ -5543,7 +5548,7 @@ public: m_left = m_cssValuePool->createValue(m_right->getDoubleValue(), (CSSPrimitiveValue::UnitTypes)m_right->primitiveType()); } if (!m_left) - m_left = m_cssValuePool->createValue(m_right->getDoubleValue(), (CSSPrimitiveValue::UnitTypes)m_right->primitiveType()); + m_left = m_cssValuePool->createValue(m_right->getDoubleValue(), (CSSPrimitiveValue::UnitTypes)m_right->primitiveType()); // Now build a rect value to hold all four of our primitive values. RefPtr<Quad> quad = Quad::create(); @@ -5659,7 +5664,7 @@ public: m_left = m_cssValuePool->createValue(m_right->getDoubleValue(), (CSSPrimitiveValue::UnitTypes)m_right->primitiveType()); } if (!m_left) - m_left = m_cssValuePool->createValue(m_right->getDoubleValue(), (CSSPrimitiveValue::UnitTypes)m_right->primitiveType()); + m_left = m_cssValuePool->createValue(m_right->getDoubleValue(), (CSSPrimitiveValue::UnitTypes)m_right->primitiveType()); // Now build a quad value to hold all four of our primitive values. RefPtr<Quad> quad = Quad::create(); @@ -6619,7 +6624,7 @@ static void filterInfoForName(const CSSParserString& name, WebKitCSSFilterValue: else if (equalIgnoringCase(name, "sepia(")) filterType = WebKitCSSFilterValue::SepiaFilterOperation; else if (equalIgnoringCase(name, "saturate(")) - filterType = WebKitCSSFilterValue::SaturateFilterOperation; + filterType = WebKitCSSFilterValue::SaturateFilterOperation; else if (equalIgnoringCase(name, "hue-rotate(")) filterType = WebKitCSSFilterValue::HueRotateFilterOperation; else if (equalIgnoringCase(name, "invert(")) diff --git a/Source/WebCore/css/CSSPrimitiveValueMappings.h b/Source/WebCore/css/CSSPrimitiveValueMappings.h index f8444ca6a..6d85beeb3 100644 --- a/Source/WebCore/css/CSSPrimitiveValueMappings.h +++ b/Source/WebCore/css/CSSPrimitiveValueMappings.h @@ -1158,6 +1158,9 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFlexAlign e) { m_primitiveUnitType = CSS_IDENT; switch (e) { + case AlignAuto: + m_value.ident = CSSValueAuto; + break; case AlignStart: m_value.ident = CSSValueStart; break; @@ -1179,6 +1182,8 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFlexAlign e) template<> inline CSSPrimitiveValue::operator EFlexAlign() const { switch (m_value.ident) { + case CSSValueAuto: + return AlignAuto; case CSSValueStart: return AlignStart; case CSSValueEnd: @@ -2821,6 +2826,41 @@ template<> inline CSSPrimitiveValue::operator EPointerEvents() const } } +template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontDescription::Kerning kerning) + : CSSValue(PrimitiveClass) +{ + m_primitiveUnitType = CSS_IDENT; + switch (kerning) { + case FontDescription::AutoKerning: + m_value.ident = CSSValueAuto; + return; + case FontDescription::NormalKerning: + m_value.ident = CSSValueNormal; + return; + case FontDescription::NoneKerning: + m_value.ident = CSSValueNone; + return; + } + + ASSERT_NOT_REACHED(); + m_value.ident = CSSValueAuto; +} + +template<> inline CSSPrimitiveValue::operator FontDescription::Kerning() const +{ + switch (m_value.ident) { + case CSSValueAuto: + return FontDescription::AutoKerning; + case CSSValueNormal: + return FontDescription::NormalKerning; + case CSSValueNone: + return FontDescription::NoneKerning; + } + + ASSERT_NOT_REACHED(); + return FontDescription::AutoKerning; +} + template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontSmoothingMode smoothing) : CSSValue(PrimitiveClass) { diff --git a/Source/WebCore/css/CSSProperty.cpp b/Source/WebCore/css/CSSProperty.cpp index 3bbf03227..b3d056c56 100644 --- a/Source/WebCore/css/CSSProperty.cpp +++ b/Source/WebCore/css/CSSProperty.cpp @@ -318,6 +318,7 @@ bool CSSProperty::isInheritedProperty(unsigned propertyID) case CSSPropertyWebkitBoxDirection: case CSSPropertyWebkitColorCorrection: case CSSPropertyWebkitFontFeatureSettings: + case CSSPropertyWebkitFontKerning: case CSSPropertyWebkitFontSmoothing: case CSSPropertyWebkitLocale: case CSSPropertyWebkitHighlight: @@ -558,7 +559,7 @@ bool CSSProperty::isInheritedProperty(unsigned propertyID) #endif case CSSPropertyWebkitFlexOrder: case CSSPropertyWebkitFlexPack: - case CSSPropertyWebkitFlexAlign: + case CSSPropertyWebkitFlexItemAlign: case CSSPropertyWebkitFlexDirection: case CSSPropertyWebkitFlexFlow: case CSSPropertyWebkitFlexWrap: diff --git a/Source/WebCore/css/CSSPropertyNames.in b/Source/WebCore/css/CSSPropertyNames.in index c0299da60..e69875bb8 100644 --- a/Source/WebCore/css/CSSPropertyNames.in +++ b/Source/WebCore/css/CSSPropertyNames.in @@ -21,6 +21,7 @@ font-variant font-weight text-rendering -webkit-font-feature-settings +-webkit-font-kerning -webkit-font-smoothing -webkit-locale -webkit-text-orientation @@ -253,9 +254,9 @@ z-index #if defined(ENABLE_CSS_FILTERS) && ENABLE_CSS_FILTERS -webkit-filter #endif --webkit-flex-align -webkit-flex-direction -webkit-flex-flow +-webkit-flex-item-align -webkit-flex-order -webkit-flex-pack -webkit-flex-wrap diff --git a/Source/WebCore/css/CSSStyleApplyProperty.cpp b/Source/WebCore/css/CSSStyleApplyProperty.cpp index 389f25c4a..0b4a63336 100644 --- a/Source/WebCore/css/CSSStyleApplyProperty.cpp +++ b/Source/WebCore/css/CSSStyleApplyProperty.cpp @@ -1672,7 +1672,7 @@ CSSStyleApplyProperty::CSSStyleApplyProperty() setPropertyHandler(CSSPropertyWebkitFlexOrder, ApplyPropertyDefault<int, &RenderStyle::flexOrder, int, &RenderStyle::setFlexOrder, int, &RenderStyle::initialFlexOrder>::createHandler()); setPropertyHandler(CSSPropertyWebkitFlexPack, ApplyPropertyDefault<EFlexPack, &RenderStyle::flexPack, EFlexPack, &RenderStyle::setFlexPack, EFlexPack, &RenderStyle::initialFlexPack>::createHandler()); - setPropertyHandler(CSSPropertyWebkitFlexAlign, ApplyPropertyDefault<EFlexAlign, &RenderStyle::flexAlign, EFlexAlign, &RenderStyle::setFlexAlign, EFlexAlign, &RenderStyle::initialFlexAlign>::createHandler()); + setPropertyHandler(CSSPropertyWebkitFlexItemAlign, ApplyPropertyDefault<EFlexAlign, &RenderStyle::flexItemAlign, EFlexAlign, &RenderStyle::setFlexItemAlign, EFlexAlign, &RenderStyle::initialFlexItemAlign>::createHandler()); setPropertyHandler(CSSPropertyWebkitFlexDirection, ApplyPropertyDefault<EFlexDirection, &RenderStyle::flexDirection, EFlexDirection, &RenderStyle::setFlexDirection, EFlexDirection, &RenderStyle::initialFlexDirection>::createHandler()); setPropertyHandler(CSSPropertyWebkitFlexWrap, ApplyPropertyDefault<EFlexWrap, &RenderStyle::flexWrap, EFlexWrap, &RenderStyle::setFlexWrap, EFlexWrap, &RenderStyle::initialFlexWrap>::createHandler()); setPropertyHandler(CSSPropertyWebkitFlexFlow, ApplyPropertyExpanding<SuppressValue, CSSPropertyWebkitFlexDirection, CSSPropertyWebkitFlexWrap>::createHandler()); @@ -1681,6 +1681,7 @@ CSSStyleApplyProperty::CSSStyleApplyProperty() setPropertyHandler(CSSPropertyFontStyle, ApplyPropertyFont<FontItalic, &FontDescription::italic, &FontDescription::setItalic, FontItalicOff>::createHandler()); setPropertyHandler(CSSPropertyFontVariant, ApplyPropertyFont<FontSmallCaps, &FontDescription::smallCaps, &FontDescription::setSmallCaps, FontSmallCapsOff>::createHandler()); setPropertyHandler(CSSPropertyTextRendering, ApplyPropertyFont<TextRenderingMode, &FontDescription::textRenderingMode, &FontDescription::setTextRenderingMode, AutoTextRendering>::createHandler()); + setPropertyHandler(CSSPropertyWebkitFontKerning, ApplyPropertyFont<FontDescription::Kerning, &FontDescription::kerning, &FontDescription::setKerning, FontDescription::AutoKerning>::createHandler()); setPropertyHandler(CSSPropertyWebkitFontSmoothing, ApplyPropertyFont<FontSmoothingMode, &FontDescription::fontSmoothing, &FontDescription::setFontSmoothing, AutoSmoothing>::createHandler()); setPropertyHandler(CSSPropertyWebkitTextOrientation, ApplyPropertyFont<TextOrientation, &FontDescription::textOrientation, &FontDescription::setTextOrientation, TextOrientationVerticalRight>::createHandler()); setPropertyHandler(CSSPropertyFontWeight, ApplyPropertyFontWeight::createHandler()); diff --git a/Source/WebCore/css/CSSStyleSelector.cpp b/Source/WebCore/css/CSSStyleSelector.cpp index b0282c120..97f19cfba 100644 --- a/Source/WebCore/css/CSSStyleSelector.cpp +++ b/Source/WebCore/css/CSSStyleSelector.cpp @@ -330,6 +330,7 @@ CSSStyleSelector::CSSStyleSelector(Document* document, StyleSheetList* styleShee bool strictParsing, bool matchAuthorAndUserStyles) : m_hasUAAppearance(false) , m_backgroundData(BackgroundFillLayer) + , m_matchedDeclarationCacheAdditionsSinceLastSweep(0) , m_checker(document, strictParsing) , m_parentStyle(0) , m_rootElementStyle(0) @@ -479,7 +480,27 @@ void CSSStyleSelector::addKeyframeStyle(PassRefPtr<WebKitCSSKeyframesRule> rule) CSSStyleSelector::~CSSStyleSelector() { m_fontSelector->clearDocument(); - deleteAllValues(m_viewportDependentMediaQueryResults); +} + +void CSSStyleSelector::sweepMatchedDeclarationCache() +{ + // Look for cache entries containing a style declaration with a single ref and remove them. + // This may happen when an element attribute mutation causes it to swap out its Attribute::decl() + // for another CSSMappedAttributeDeclaration, potentially leaving this cache with the last ref. + Vector<unsigned, 16> toRemove; + MatchedStyleDeclarationCache::iterator it = m_matchedStyleDeclarationCache.begin(); + MatchedStyleDeclarationCache::iterator end = m_matchedStyleDeclarationCache.end(); + for (; it != end; ++it) { + Vector<MatchedStyleDeclaration>& matchedStyleDeclarations = it->second.matchedStyleDeclarations; + for (size_t i = 0; i < matchedStyleDeclarations.size(); ++i) { + if (matchedStyleDeclarations[i].styleDeclaration->hasOneRef()) { + toRemove.append(it->first); + break; + } + } + } + for (size_t i = 0; i < toRemove.size(); ++i) + m_matchedStyleDeclarationCache.remove(toRemove[i]); } CSSStyleSelector::Features::Features() @@ -627,12 +648,6 @@ static void ensureDefaultStyleSheetsForElement(Element* element) #endif } -CSSStyleSelector::MatchedStyleDeclaration::MatchedStyleDeclaration() -{ - // Make sure all memory is zero initializes as we calculate hash over the bytes of this object. - memset(this, 0, sizeof(*this)); -} - void CSSStyleSelector::addMatchedDeclaration(CSSMutableStyleDeclaration* styleDeclaration, unsigned linkMatchType) { m_matchedDecls.grow(m_matchedDecls.size() + 1); @@ -815,12 +830,12 @@ void CSSStyleSelector::matchAllRules(MatchResult& result) const NamedNodeMap* map = m_styledElement->attributeMap(); for (unsigned i = 0; i < map->length(); ++i) { Attribute* attr = map->attributeItem(i); - if (attr->isMappedAttribute() && attr->decl()) { + if (attr->decl()) { + ASSERT(attr->isMappedAttribute()); result.lastAuthorRule = m_matchedDecls.size(); if (result.firstAuthorRule == -1) result.firstAuthorRule = result.lastAuthorRule; addMatchedDeclaration(attr->decl()); - result.isCacheable = false; } } } @@ -2212,7 +2227,7 @@ void CSSStyleSelector::applyDeclaration(CSSMutableStyleDeclaration* styleDeclara int property = current.id(); if (applyFirst) { COMPILE_ASSERT(firstCSSProperty == CSSPropertyColor, CSS_color_is_first_property); - COMPILE_ASSERT(CSSPropertyZoom == CSSPropertyColor + 16, CSS_zoom_is_end_of_first_prop_range); + COMPILE_ASSERT(CSSPropertyZoom == CSSPropertyColor + 17, 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) @@ -2239,7 +2254,7 @@ void CSSStyleSelector::applyDeclarations(bool isImportant, int startIndex, int e if (m_style->insideLink() != NotInsideLink) { for (int i = startIndex; i <= endIndex; ++i) { - CSSMutableStyleDeclaration* styleDeclaration = m_matchedDecls[i].styleDeclaration; + CSSMutableStyleDeclaration* styleDeclaration = m_matchedDecls[i].styleDeclaration.get(); unsigned linkMatchType = m_matchedDecls[i].linkMatchType; // FIXME: It would be nicer to pass these as arguments but that requires changes in many places. m_applyPropertyToRegularStyle = linkMatchType & SelectorChecker::MatchLink; @@ -2252,7 +2267,7 @@ void CSSStyleSelector::applyDeclarations(bool isImportant, int startIndex, int e return; } for (int i = startIndex; i <= endIndex; ++i) - applyDeclaration<applyFirst>(m_matchedDecls[i].styleDeclaration, isImportant, inheritedOnly); + applyDeclaration<applyFirst>(m_matchedDecls[i].styleDeclaration.get(), isImportant, inheritedOnly); } unsigned CSSStyleSelector::computeDeclarationHash(MatchedStyleDeclaration* declarations, unsigned size) @@ -2310,6 +2325,12 @@ const CSSStyleSelector::MatchedStyleDeclarationCacheItem* CSSStyleSelector::find void CSSStyleSelector::addToMatchedDeclarationCache(const RenderStyle* style, const RenderStyle* parentStyle, unsigned hash, const MatchResult& matchResult) { + static unsigned matchedDeclarationCacheAdditionsBetweenSweeps = 100; + if (++m_matchedDeclarationCacheAdditionsSinceLastSweep >= matchedDeclarationCacheAdditionsBetweenSweeps) { + sweepMatchedDeclarationCache(); + m_matchedDeclarationCacheAdditionsSinceLastSweep = 0; + } + ASSERT(hash); MatchedStyleDeclarationCacheItem cacheItem; cacheItem.matchedStyleDeclarations.append(m_matchedDecls); @@ -3698,7 +3719,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) case CSSPropertyWordSpacing: case CSSPropertyWebkitFlexOrder: case CSSPropertyWebkitFlexPack: - case CSSPropertyWebkitFlexAlign: + case CSSPropertyWebkitFlexItemAlign: case CSSPropertyWebkitFlexDirection: case CSSPropertyWebkitFlexFlow: case CSSPropertyWebkitFlexWrap: @@ -4703,7 +4724,7 @@ bool CSSStyleSelector::hasSelectorForAttribute(const AtomicString &attrname) con void CSSStyleSelector::addViewportDependentMediaQueryResult(const MediaQueryExp* expr, bool result) { - m_viewportDependentMediaQueryResults.append(new MediaQueryResult(*expr, result)); + m_viewportDependentMediaQueryResults.append(adoptPtr(new MediaQueryResult(*expr, result))); } bool CSSStyleSelector::affectedByViewportChange() const diff --git a/Source/WebCore/css/CSSStyleSelector.h b/Source/WebCore/css/CSSStyleSelector.h index 872b634f5..856193f99 100644 --- a/Source/WebCore/css/CSSStyleSelector.h +++ b/Source/WebCore/css/CSSStyleSelector.h @@ -346,9 +346,14 @@ private: void loadPendingImages(); struct MatchedStyleDeclaration { - MatchedStyleDeclaration(); - CSSMutableStyleDeclaration* styleDeclaration; - unsigned linkMatchType; + MatchedStyleDeclaration() : possiblyPaddedMember(0) { } + + RefPtr<CSSMutableStyleDeclaration> styleDeclaration; + union { + unsigned linkMatchType; + // Used to make sure all memory is zero-initialized since we compute the hash over the bytes of this object. + void* possiblyPaddedMember; + }; }; static unsigned computeDeclarationHash(MatchedStyleDeclaration*, unsigned size); struct MatchedStyleDeclarationCacheItem { @@ -360,11 +365,16 @@ private: const MatchedStyleDeclarationCacheItem* findFromMatchedDeclarationCache(unsigned hash, const MatchResult&); void addToMatchedDeclarationCache(const RenderStyle*, const RenderStyle* parentStyle, unsigned hash, const MatchResult&); + // Every N additions to the matched declaration cache trigger a sweep where entries holding + // the last reference to a style declaration are garbage collected. + void sweepMatchedDeclarationCache(); + // We collect the set of decls that match in |m_matchedDecls|. We then walk the // set of matched decls four times, once for those properties that others depend on (like font-size), // and then a second time for all the remaining properties. We then do the same two passes // for any !important rules. Vector<MatchedStyleDeclaration, 64> m_matchedDecls; + unsigned m_matchedDeclarationCacheAdditionsSinceLastSweep; typedef HashMap<unsigned, MatchedStyleDeclarationCacheItem> MatchedStyleDeclarationCache; MatchedStyleDeclarationCache m_matchedStyleDeclarationCache; @@ -397,7 +407,7 @@ private: bool m_sameOriginOnly; RefPtr<CSSFontSelector> m_fontSelector; - Vector<MediaQueryResult*> m_viewportDependentMediaQueryResults; + Vector<OwnPtr<MediaQueryResult> > m_viewportDependentMediaQueryResults; bool m_applyPropertyToRegularStyle; bool m_applyPropertyToVisitedLinkStyle; diff --git a/Source/WebCore/css/CSSValue.cpp b/Source/WebCore/css/CSSValue.cpp index 0e83c0818..711e4c5ed 100644 --- a/Source/WebCore/css/CSSValue.cpp +++ b/Source/WebCore/css/CSSValue.cpp @@ -65,6 +65,11 @@ class SameSizeAsCSSValue : public RefCounted<SameSizeAsCSSValue> { COMPILE_ASSERT(sizeof(CSSValue) == sizeof(SameSizeAsCSSValue), CSS_value_should_stay_small); +bool CSSValue::isImplicitInitialValue() const +{ + return m_classType == InitialClass && static_cast<const CSSInitialValue*>(this)->isImplicit(); +} + CSSValue::Type CSSValue::cssValueType() const { if (isInheritedValue()) diff --git a/Source/WebCore/css/CSSValue.h b/Source/WebCore/css/CSSValue.h index ce95369ab..fd5e6f520 100644 --- a/Source/WebCore/css/CSSValue.h +++ b/Source/WebCore/css/CSSValue.h @@ -68,7 +68,7 @@ public: bool isFontValue() const { return m_classType == FontClass; } bool isImageGeneratorValue() const { return m_classType >= CanvasClass && m_classType <= RadialGradientClass; } bool isImageValue() const { return m_classType == ImageClass || m_classType == CursorImageClass; } - bool isImplicitInitialValue() const { return m_classType == InitialClass && m_isImplicitInitialValue; } + bool isImplicitInitialValue() const; bool isInheritedValue() const { return m_classType == InheritedClass; } bool isInitialValue() const { return m_classType == InitialClass; } bool isReflectValue() const { return m_classType == ReflectClass; } @@ -145,14 +145,20 @@ protected: // Do not append non-list class types here. }; + static const size_t ValueListSeparatorBits = 2; + enum ValueListSeparator { + SpaceSeparator, + CommaSeparator, + SlashSeparator + }; + ClassType classType() const { return static_cast<ClassType>(m_classType); } explicit CSSValue(ClassType classType) : m_primitiveUnitType(0) , m_hasCachedCSSText(false) , m_isQuirkValue(false) - , m_isImplicitInitialValue(false) - , m_isSpaceSeparatedValueList(false) + , m_valueListSeparator(SpaceSeparator) , m_classType(classType) { } @@ -174,11 +180,7 @@ protected: mutable bool m_hasCachedCSSText : 1; bool m_isQuirkValue : 1; - // CSSInitialValue bits: - bool m_isImplicitInitialValue : 1; - - // CSSValueList bits: - bool m_isSpaceSeparatedValueList : 1; + unsigned char m_valueListSeparator : ValueListSeparatorBits; private: unsigned char m_classType : ClassTypeBits; // ClassType diff --git a/Source/WebCore/css/CSSValueList.cpp b/Source/WebCore/css/CSSValueList.cpp index 661e183a7..07aa789b0 100644 --- a/Source/WebCore/css/CSSValueList.cpp +++ b/Source/WebCore/css/CSSValueList.cpp @@ -24,25 +24,26 @@ #include "CSSParserValues.h" #include "PlatformString.h" #include <wtf/PassOwnPtr.h> +#include <wtf/text/StringBuilder.h> namespace WebCore { -CSSValueList::CSSValueList(ClassType classType, bool isSpaceSeparated) +CSSValueList::CSSValueList(ClassType classType, ValueListSeparator listSeparator) : CSSValue(classType) { - m_isSpaceSeparatedValueList = isSpaceSeparated; + m_valueListSeparator = listSeparator; } -CSSValueList::CSSValueList(bool isSpaceSeparated) +CSSValueList::CSSValueList(ValueListSeparator listSeparator) : CSSValue(ValueListClass) { - m_isSpaceSeparatedValueList = isSpaceSeparated; + m_valueListSeparator = listSeparator; } CSSValueList::CSSValueList(CSSParserValueList* list) : CSSValue(ValueListClass) { - m_isSpaceSeparatedValueList = true; + m_valueListSeparator = SpaceSeparator; if (list) { size_t size = list->size(); for (unsigned i = 0; i < size; ++i) @@ -88,28 +89,51 @@ bool CSSValueList::hasValue(CSSValue* val) const PassRefPtr<CSSValueList> CSSValueList::copy() { - PassRefPtr<CSSValueList> newList = isSpaceSeparated() ? createSpaceSeparated() : createCommaSeparated(); + RefPtr<CSSValueList> newList; + switch (m_valueListSeparator) { + case SpaceSeparator: + newList = createSpaceSeparated(); + break; + case CommaSeparator: + newList = createCommaSeparated(); + break; + case SlashSeparator: + newList = createSlashSeparated(); + break; + default: + ASSERT_NOT_REACHED(); + } for (size_t index = 0; index < m_values.size(); index++) newList->append(m_values[index]); - return newList; + return newList.release(); } String CSSValueList::customCssText() const { - String result = ""; + StringBuilder result; + String separator; + switch (m_valueListSeparator) { + case SpaceSeparator: + separator = " "; + break; + case CommaSeparator: + separator = ", "; + break; + case SlashSeparator: + separator = " / "; + break; + default: + ASSERT_NOT_REACHED(); + } unsigned size = m_values.size(); for (unsigned i = 0; i < size; i++) { - if (!result.isEmpty()) { - if (isSpaceSeparated()) - result += " "; - else - result += ", "; - } - result += m_values[i]->cssText(); + if (!result.isEmpty()) + result.append(separator); + result.append(m_values[i]->cssText()); } - return result; + return result.toString(); } void CSSValueList::addSubresourceStyleURLs(ListHashSet<KURL>& urls, const CSSStyleSheet* styleSheet) diff --git a/Source/WebCore/css/CSSValueList.h b/Source/WebCore/css/CSSValueList.h index c62262a9e..16d195b0d 100644 --- a/Source/WebCore/css/CSSValueList.h +++ b/Source/WebCore/css/CSSValueList.h @@ -33,11 +33,15 @@ class CSSValueList : public CSSValue { public: static PassRefPtr<CSSValueList> createCommaSeparated() { - return adoptRef(new CSSValueList(false)); + return adoptRef(new CSSValueList(CommaSeparator)); } static PassRefPtr<CSSValueList> createSpaceSeparated() { - return adoptRef(new CSSValueList(true)); + return adoptRef(new CSSValueList(SpaceSeparator)); + } + static PassRefPtr<CSSValueList> createSlashSeparated() + { + return adoptRef(new CSSValueList(SlashSeparator)); } static PassRefPtr<CSSValueList> createFromParserValueList(CSSParserValueList* list) { @@ -59,14 +63,12 @@ public: void addSubresourceStyleURLs(ListHashSet<KURL>&, const CSSStyleSheet*); protected: - CSSValueList(ClassType, bool isSpaceSeparated); + CSSValueList(ClassType, ValueListSeparator); private: - explicit CSSValueList(bool isSpaceSeparated); + explicit CSSValueList(ValueListSeparator); explicit CSSValueList(CSSParserValueList*); - bool isSpaceSeparated() const { return m_isSpaceSeparatedValueList; } - Vector<RefPtr<CSSValue> > m_values; }; diff --git a/Source/WebCore/css/StyleMedia.cpp b/Source/WebCore/css/StyleMedia.cpp index 90b574017..5db8a6f98 100644 --- a/Source/WebCore/css/StyleMedia.cpp +++ b/Source/WebCore/css/StyleMedia.cpp @@ -36,7 +36,7 @@ namespace WebCore { StyleMedia::StyleMedia(Frame* frame) - : m_frame(frame) + : DOMWindowProperty(frame) { } diff --git a/Source/WebCore/css/StyleMedia.h b/Source/WebCore/css/StyleMedia.h index 760524271..032929e08 100644 --- a/Source/WebCore/css/StyleMedia.h +++ b/Source/WebCore/css/StyleMedia.h @@ -27,6 +27,7 @@ #ifndef StyleMedia_h #define StyleMedia_h +#include "DOMWindowProperty.h" #include "PlatformString.h" #include <wtf/RefCounted.h> @@ -34,24 +35,15 @@ namespace WebCore { class Frame; -class StyleMedia : public RefCounted<StyleMedia> { +class StyleMedia : public RefCounted<StyleMedia>, public DOMWindowProperty { public: - static PassRefPtr<StyleMedia> create(Frame* frame) - { - return adoptRef(new StyleMedia(frame)); - } - - Frame* frame() { return m_frame; } - void disconnectFrame() { m_frame = 0; } + static PassRefPtr<StyleMedia> create(Frame* frame) { return adoptRef(new StyleMedia(frame));} String type() const; - bool matchMedium(const String&) const; private: - StyleMedia(Frame*); - - Frame* m_frame; + explicit StyleMedia(Frame*); }; } // namespace diff --git a/Source/WebCore/css/WebKitCSSFilterValue.cpp b/Source/WebCore/css/WebKitCSSFilterValue.cpp index b8e39933a..93ae41097 100644 --- a/Source/WebCore/css/WebKitCSSFilterValue.cpp +++ b/Source/WebCore/css/WebKitCSSFilterValue.cpp @@ -35,7 +35,7 @@ namespace WebCore { WebKitCSSFilterValue::WebKitCSSFilterValue(FilterOperationType operationType) - : CSSValueList(WebKitCSSFilterClass, typeUsesSpaceSeparator(operationType)) + : CSSValueList(WebKitCSSFilterClass, typeUsesSpaceSeparator(operationType) ? SpaceSeparator : CommaSeparator) , m_type(operationType) { } diff --git a/Source/WebCore/css/WebKitCSSTransformValue.cpp b/Source/WebCore/css/WebKitCSSTransformValue.cpp index 6a391ac85..3e2f9e60d 100644 --- a/Source/WebCore/css/WebKitCSSTransformValue.cpp +++ b/Source/WebCore/css/WebKitCSSTransformValue.cpp @@ -33,7 +33,7 @@ namespace WebCore { WebKitCSSTransformValue::WebKitCSSTransformValue(TransformOperationType op) - : CSSValueList(WebKitCSSTransformClass, false) + : CSSValueList(WebKitCSSTransformClass, CommaSeparator) , m_type(op) { } diff --git a/Source/WebCore/css/fullscreenQuickTime.css b/Source/WebCore/css/fullscreenQuickTime.css index a5559768d..ea1ebd6ec 100644 --- a/Source/WebCore/css/fullscreenQuickTime.css +++ b/Source/WebCore/css/fullscreenQuickTime.css @@ -29,9 +29,6 @@ video:-webkit-full-screen::-webkit-media-controls-panel { -webkit-box-pack: end !important; -webkit-appearance: none !important; - bottom: 50px !important; - left: 50% !important; - margin-left: -220px !important; padding: 12px 0 0 10px !important; width: 430px !important; height: 48px !important; @@ -58,6 +55,12 @@ video:-webkit-full-screen::-webkit-media-controls-panel { -webkit-transition: opacity 0.3s linear !important; } +video:-webkit-full-screen::-webkit-media-controls-panel:not(.dragged) { + bottom: 50px !important; + left: 50% !important; + margin-left: -220px !important; +} + video:-webkit-animating-full-screen-transition::-webkit-media-controls-panel { opacity: 0 ! important; -webkit-transition: opacity 0 ! important; diff --git a/Source/WebCore/dom/Attr.cpp b/Source/WebCore/dom/Attr.cpp index cf2111ff2..6930fa1dc 100644 --- a/Source/WebCore/dom/Attr.cpp +++ b/Source/WebCore/dom/Attr.cpp @@ -129,7 +129,7 @@ void Attr::setValue(const AtomicString& value) createTextChild(); m_ignoreChildrenChanged--; - invalidateNodeListsCacheAfterAttributeChanged(); + invalidateNodeListsCacheAfterAttributeChanged(m_attribute->name()); } void Attr::setValue(const AtomicString& value, ExceptionCode&) @@ -174,7 +174,7 @@ void Attr::childrenChanged(bool changedByParser, Node* beforeChange, Node* after Node::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); - invalidateNodeListsCacheAfterAttributeChanged(); + invalidateNodeListsCacheAfterAttributeChanged(m_attribute->name()); // FIXME: We should include entity references in the value diff --git a/Source/WebCore/dom/CheckedRadioButtons.cpp b/Source/WebCore/dom/CheckedRadioButtons.cpp index 38e5efbbc..9ab89120f 100644 --- a/Source/WebCore/dom/CheckedRadioButtons.cpp +++ b/Source/WebCore/dom/CheckedRadioButtons.cpp @@ -25,34 +25,32 @@ namespace WebCore { -void CheckedRadioButtons::addButton(HTMLFormControlElement* element) +static inline bool shouldMakeRadioGroup(HTMLInputElement* element) { - // We only want to add radio buttons. - if (!element->isRadioButton()) - return; + return element->isRadioButton() && !element->name().isEmpty() && element->inDocument(); +} - // Without a name, there is no group. - if (element->name().isEmpty()) +void CheckedRadioButtons::addButton(HTMLInputElement* element) +{ + if (!shouldMakeRadioGroup(element)) return; - HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(element); - // We only track checked buttons. - if (!inputElement->checked()) + if (!element->checked()) return; if (!m_nameToCheckedRadioButtonMap) m_nameToCheckedRadioButtonMap = adoptPtr(new NameToInputMap); - pair<NameToInputMap::iterator, bool> result = m_nameToCheckedRadioButtonMap->add(element->name().impl(), inputElement); + pair<NameToInputMap::iterator, bool> result = m_nameToCheckedRadioButtonMap->add(element->name().impl(), element); if (result.second) return; HTMLInputElement* oldCheckedButton = result.first->second; - if (oldCheckedButton == inputElement) + if (oldCheckedButton == element) return; - result.first->second = inputElement; + result.first->second = element; oldCheckedButton->setChecked(false); } @@ -66,7 +64,7 @@ HTMLInputElement* CheckedRadioButtons::checkedButtonForGroup(const AtomicString& return m_nameToCheckedRadioButtonMap->get(name.impl()); } -void CheckedRadioButtons::removeButton(HTMLFormControlElement* element) +void CheckedRadioButtons::removeButton(HTMLInputElement* element) { if (element->name().isEmpty() || !m_nameToCheckedRadioButtonMap) return; @@ -77,9 +75,7 @@ void CheckedRadioButtons::removeButton(HTMLFormControlElement* element) if (it == m_nameToCheckedRadioButtonMap->end() || it->second != element) return; - HTMLInputElement* inputElement = element->toInputElement(); - ASSERT_UNUSED(inputElement, inputElement); - ASSERT(inputElement->shouldAppearChecked()); + ASSERT(element->shouldAppearChecked()); ASSERT(element->isRadioButton()); m_nameToCheckedRadioButtonMap->remove(it); diff --git a/Source/WebCore/dom/CheckedRadioButtons.h b/Source/WebCore/dom/CheckedRadioButtons.h index 0fa457acb..925b50678 100644 --- a/Source/WebCore/dom/CheckedRadioButtons.h +++ b/Source/WebCore/dom/CheckedRadioButtons.h @@ -27,13 +27,12 @@ namespace WebCore { -class HTMLFormControlElement; class HTMLInputElement; class CheckedRadioButtons { public: - void addButton(HTMLFormControlElement*); - void removeButton(HTMLFormControlElement*); + void addButton(HTMLInputElement*); + void removeButton(HTMLInputElement*); HTMLInputElement* checkedButtonForGroup(const AtomicString& groupName) const; private: diff --git a/Source/WebCore/dom/ContainerNode.cpp b/Source/WebCore/dom/ContainerNode.cpp index 49caa8e21..d5cd09b9f 100644 --- a/Source/WebCore/dom/ContainerNode.cpp +++ b/Source/WebCore/dom/ContainerNode.cpp @@ -99,7 +99,7 @@ void ContainerNode::takeAllChildrenFrom(ContainerNode* oldParent) // FIXME: Together with adoptNode above, the tree scope might get updated recursively twice // (if the document changed or oldParent was in a shadow tree, AND *this is in a shadow tree). // Can we do better? - child->setTreeScopeRecursively(treeScope()); + treeScope()->adoptIfNeeded(child.get()); if (attached() && !child->attached()) child->attach(); } @@ -175,7 +175,7 @@ bool ContainerNode::insertBefore(PassRefPtr<Node> newChild, Node* refChild, Exce InspectorInstrumentation::willInsertDOMNode(document(), child, this); #endif - child->setTreeScopeRecursively(treeScope()); + treeScope()->adoptIfNeeded(child); insertBeforeCommon(next.get(), child); @@ -329,7 +329,7 @@ bool ContainerNode::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, Exce InspectorInstrumentation::willInsertDOMNode(document(), child.get(), this); #endif - child->setTreeScopeRecursively(treeScope()); + treeScope()->adoptIfNeeded(child.get()); // Add child after "prev". forbidEventDispatch(); @@ -509,7 +509,7 @@ void ContainerNode::removeBetween(Node* previousChild, Node* nextChild, Node* ol oldChild->setNextSibling(0); oldChild->setParent(0); - oldChild->setTreeScopeRecursively(document()); + document()->adoptIfNeeded(oldChild); allowEventDispatch(); } @@ -564,7 +564,7 @@ void ContainerNode::removeChildren() n->setPreviousSibling(0); n->setNextSibling(0); n->setParent(0); - n->setTreeScopeRecursively(document()); + document()->adoptIfNeeded(n.get()); m_firstChild = next; if (n == m_lastChild) @@ -649,7 +649,7 @@ bool ContainerNode::appendChild(PassRefPtr<Node> newChild, ExceptionCode& ec, bo InspectorInstrumentation::willInsertDOMNode(document(), child, this); #endif - child->setTreeScopeRecursively(treeScope()); + treeScope()->adoptIfNeeded(child); // Append child to the end of the list forbidEventDispatch(); @@ -697,7 +697,7 @@ void ContainerNode::parserAddChild(PassRefPtr<Node> newChild) Node* last = m_lastChild; // FIXME: This method should take a PassRefPtr. appendChildToContainer<Node, ContainerNode>(newChild.get(), this); - newChild->setTreeScopeRecursively(treeScope()); + treeScope()->adoptIfNeeded(newChild.get()); allowEventDispatch(); diff --git a/Source/WebCore/dom/DOMAllInOne.cpp b/Source/WebCore/dom/DOMAllInOne.cpp index d0bcecaa2..55094653f 100644 --- a/Source/WebCore/dom/DOMAllInOne.cpp +++ b/Source/WebCore/dom/DOMAllInOne.cpp @@ -129,6 +129,7 @@ #include "TransformSourceLibxslt.cpp" #include "Traversal.cpp" #include "TreeScope.cpp" +#include "TreeScopeAdopter.cpp" #include "TreeWalker.cpp" #include "UIEvent.cpp" #include "UIEventWithKeyState.cpp" diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp index 66fb4738e..d2a02c94f 100644 --- a/Source/WebCore/dom/Document.cpp +++ b/Source/WebCore/dom/Document.cpp @@ -498,6 +498,10 @@ Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML) static int docID = 0; m_docID = docID++; + +#ifndef NDEBUG + m_updatingStyleSelector = false; +#endif } static void histogramMutationEventUsage(const unsigned short& listenerTypes) @@ -567,14 +571,6 @@ Document::~Document() if (m_mediaQueryMatcher) m_mediaQueryMatcher->documentDestroyed(); - - for (unsigned i = 0; i < NumUnnamedDocumentCachedTypes; ++i) { - if (m_collections[i]) - m_collections[i]->detachFromNode(); - } - - if (m_allCollection) - m_allCollection->detachFromNode(); } void Document::removedLastRef() @@ -712,9 +708,9 @@ void Document::setDocType(PassRefPtr<DocumentType> docType) ASSERT(!m_docType || !docType); m_docType = docType; if (m_docType) - m_docType->setTreeScopeRecursively(this); + this->adoptIfNeeded(m_docType.get()); // Doctype affects the interpretation of the stylesheets. - m_styleSelector.clear(); + clearStyleSelector(); } DOMImplementation* Document::implementation() @@ -728,14 +724,12 @@ void Document::childrenChanged(bool changedByParser, Node* beforeChange, Node* a { TreeScope::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); - // Invalidate the document element we have cached in case it was replaced. - m_documentElement = 0; -} - -void Document::cacheDocumentElement() const -{ - ASSERT(!m_documentElement); - m_documentElement = firstElementChild(this); + Element* newDocumentElement = firstElementChild(this); + if (newDocumentElement == m_documentElement) + return; + m_documentElement = newDocumentElement; + // The root style used for media query matching depends on the document element. + clearStyleSelector(); } PassRefPtr<Element> Document::createElement(const AtomicString& name, ExceptionCode& ec) @@ -949,7 +943,7 @@ PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionCode& ec) source->parentNode()->removeChild(source.get(), ec); } - source->setTreeScopeRecursively(this); + this->adoptIfNeeded(source.get()); return source; } @@ -1808,6 +1802,12 @@ void Document::createStyleSelector() !inQuirksMode(), matchAuthorAndUserStyles)); combineCSSFeatureFlags(); } + +inline void Document::clearStyleSelector() +{ + ASSERT(!m_updatingStyleSelector); + m_styleSelector.clear(); +} void Document::attach() { @@ -3171,22 +3171,29 @@ bool Document::testAddedStylesheetRequiresStyleRecalc(CSSStyleSheet* stylesheet) return true; HashSet<AtomicStringImpl*>::iterator end = idScopes.end(); for (HashSet<AtomicStringImpl*>::iterator it = idScopes.begin(); it != end; ++it) { - if (hasElementWithId(*it)) + AtomicStringImpl* id = *it; + Element* idElement = getElementById(id); + if (!idElement) + continue; + if (containsMultipleElementsWithId(id)) return true; + idElement->setNeedsStyleRecalc(); } end = classScopes.end(); for (HashSet<AtomicStringImpl*>::iterator it = classScopes.begin(); it != end; ++it) { // FIXME: getElementsByClassName is not optimal for this. We should handle all classes in a single pass. - if (getElementsByClassName(*it)->length()) - return true; + RefPtr<NodeList> classElements = getElementsByClassName(*it); + unsigned elementCount = classElements->length(); + for (unsigned i = 0; i < elementCount; ++i) + classElements->item(i)->setNeedsStyleRecalc(); } return false; } -void Document::analyzeStylesheetChange(StyleSelectorUpdateFlag updateFlag, const Vector<RefPtr<StyleSheet> >& newStylesheets, bool& requiresStyleSelectorReset, bool& requiresStyleRecalc) +void Document::analyzeStylesheetChange(StyleSelectorUpdateFlag updateFlag, const Vector<RefPtr<StyleSheet> >& newStylesheets, bool& requiresStyleSelectorReset, bool& requiresFullStyleRecalc) { requiresStyleSelectorReset = true; - requiresStyleRecalc = true; + requiresFullStyleRecalc = true; // Stylesheets of <style> elements that @import stylesheets are active but loading. We need to trigger a full recalc when such loads are done. bool hasActiveLoadingStylesheet = false; @@ -3225,11 +3232,13 @@ void Document::analyzeStylesheetChange(StyleSelectorUpdateFlag updateFlag, const if (testAddedStylesheetRequiresStyleRecalc(static_cast<CSSStyleSheet*>(newStylesheets[i].get()))) return; } - requiresStyleRecalc = false; + requiresFullStyleRecalc = false; } bool Document::updateActiveStylesheets(StyleSelectorUpdateFlag updateFlag) { + ASSERT(!m_updatingStyleSelector); + if (m_inStyleRecalc) { // SVG <use> element may manage to invalidate style selector in the middle of a style recalc. // https://bugs.webkit.org/show_bug.cgi?id=54344 @@ -3245,13 +3254,22 @@ bool Document::updateActiveStylesheets(StyleSelectorUpdateFlag updateFlag) collectActiveStylesheets(newStylesheets); bool requiresStyleSelectorReset; - bool requiresStyleRecalc; - analyzeStylesheetChange(updateFlag, newStylesheets, requiresStyleSelectorReset, requiresStyleRecalc); + bool requiresFullStyleRecalc; + analyzeStylesheetChange(updateFlag, newStylesheets, requiresStyleSelectorReset, requiresFullStyleRecalc); if (requiresStyleSelectorReset) - m_styleSelector.clear(); + clearStyleSelector(); else { - m_styleSelector->appendAuthorStylesheets(m_styleSheets->length(), newStylesheets); +#ifndef NDEBUG + m_updatingStyleSelector = true; +#endif + // Detach the style selector temporarily so it can't get deleted during appendAuthorStylesheets + OwnPtr<CSSStyleSelector> detachedStyleSelector = m_styleSelector.release(); + detachedStyleSelector->appendAuthorStylesheets(m_styleSheets->length(), newStylesheets); + m_styleSelector = detachedStyleSelector.release(); +#ifndef NDEBUG + m_updatingStyleSelector = false; +#endif resetCSSFeatureFlags(); } m_styleSheets->swap(newStylesheets); @@ -3259,7 +3277,7 @@ bool Document::updateActiveStylesheets(StyleSelectorUpdateFlag updateFlag) m_didCalculateStyleSelector = true; m_hasDirtyStyleSelector = false; - return requiresStyleRecalc; + return requiresFullStyleRecalc; } void Document::setHoverNode(PassRefPtr<Node> newHoverNode) @@ -4176,7 +4194,7 @@ KURL Document::openSearchDescriptionURL() if (!head()) return KURL(); - RefPtr<HTMLCollection> children = head()->children(); + HTMLCollection* children = head()->children(); for (Node* child = children->firstItem(); child; child = children->nextItem()) { if (!child->hasTagName(linkTag)) continue; @@ -4301,81 +4319,81 @@ bool Document::hasSVGRootNode() const } #endif -const RefPtr<HTMLCollection>& Document::cachedCollection(CollectionType type) +HTMLCollection* Document::cachedCollection(CollectionType type) { ASSERT(static_cast<unsigned>(type) < NumUnnamedDocumentCachedTypes); if (!m_collections[type]) m_collections[type] = HTMLCollection::create(this, type); - return m_collections[type]; + return m_collections[type].get(); } -PassRefPtr<HTMLCollection> Document::images() +HTMLCollection* Document::images() { return cachedCollection(DocImages); } -PassRefPtr<HTMLCollection> Document::applets() +HTMLCollection* Document::applets() { return cachedCollection(DocApplets); } -PassRefPtr<HTMLCollection> Document::embeds() +HTMLCollection* Document::embeds() { return cachedCollection(DocEmbeds); } -PassRefPtr<HTMLCollection> Document::plugins() +HTMLCollection* Document::plugins() { // This is an alias for embeds() required for the JS DOM bindings. return cachedCollection(DocEmbeds); } -PassRefPtr<HTMLCollection> Document::objects() +HTMLCollection* Document::objects() { return cachedCollection(DocObjects); } -PassRefPtr<HTMLCollection> Document::scripts() +HTMLCollection* Document::scripts() { return cachedCollection(DocScripts); } -PassRefPtr<HTMLCollection> Document::links() +HTMLCollection* Document::links() { return cachedCollection(DocLinks); } -PassRefPtr<HTMLCollection> Document::forms() +HTMLCollection* Document::forms() { return cachedCollection(DocForms); } -PassRefPtr<HTMLCollection> Document::anchors() +HTMLCollection* Document::anchors() { return cachedCollection(DocAnchors); } -PassRefPtr<HTMLAllCollection> Document::all() +HTMLAllCollection* Document::all() { if (!m_allCollection) m_allCollection = HTMLAllCollection::create(this); - return m_allCollection; + return m_allCollection.get(); } -PassRefPtr<HTMLCollection> Document::windowNamedItems(const AtomicString& name) +HTMLCollection* Document::windowNamedItems(const AtomicString& name) { - RefPtr<HTMLNameCollection>& collection = m_windowNamedItemCollections.add(name.impl(), 0).first->second; + OwnPtr<HTMLNameCollection>& collection = m_windowNamedItemCollections.add(name.impl(), nullptr).first->second; if (!collection) collection = HTMLNameCollection::create(this, WindowNamedItems, name); - return collection; + return collection.get(); } -PassRefPtr<HTMLCollection> Document::documentNamedItems(const AtomicString& name) +HTMLCollection* Document::documentNamedItems(const AtomicString& name) { - RefPtr<HTMLNameCollection>& collection = m_documentNamedItemCollections.add(name.impl(), 0).first->second; + OwnPtr<HTMLNameCollection>& collection = m_documentNamedItemCollections.add(name.impl(), nullptr).first->second; if (!collection) collection = HTMLNameCollection::create(this, DocumentNamedItems, name); - return collection; + return collection.get(); } void Document::finishedParsing() diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h index 38610cb50..45092d3fb 100644 --- a/Source/WebCore/dom/Document.h +++ b/Source/WebCore/dom/Document.h @@ -331,8 +331,6 @@ public: Element* documentElement() const { - if (!m_documentElement) - cacheDocumentElement(); return m_documentElement.get(); } @@ -410,19 +408,19 @@ public: PassRefPtr<Node> adoptNode(PassRefPtr<Node> source, ExceptionCode&); - PassRefPtr<HTMLCollection> images(); - PassRefPtr<HTMLCollection> embeds(); - PassRefPtr<HTMLCollection> plugins(); // an alias for embeds() required for the JS DOM bindings. - PassRefPtr<HTMLCollection> applets(); - PassRefPtr<HTMLCollection> links(); - PassRefPtr<HTMLCollection> forms(); - PassRefPtr<HTMLCollection> anchors(); - PassRefPtr<HTMLCollection> objects(); - PassRefPtr<HTMLCollection> scripts(); - PassRefPtr<HTMLCollection> windowNamedItems(const AtomicString& name); - PassRefPtr<HTMLCollection> documentNamedItems(const AtomicString& name); + HTMLCollection* images(); + HTMLCollection* embeds(); + HTMLCollection* plugins(); // an alias for embeds() required for the JS DOM bindings. + HTMLCollection* applets(); + HTMLCollection* links(); + HTMLCollection* forms(); + HTMLCollection* anchors(); + HTMLCollection* objects(); + HTMLCollection* scripts(); + HTMLCollection* windowNamedItems(const AtomicString& name); + HTMLCollection* documentNamedItems(const AtomicString& name); - PassRefPtr<HTMLAllCollection> all(); + HTMLAllCollection* all(); // Other methods (not part of DOM) bool isHTMLDocument() const { return m_isHTML; } @@ -1155,18 +1153,17 @@ private: void updateFocusAppearanceTimerFired(Timer<Document>*); void updateBaseURL(); - void cacheDocumentElement() const; - void buildAccessKeyMap(TreeScope* root); void createStyleSelector(); + void clearStyleSelector(); void combineCSSFeatureFlags(); void resetCSSFeatureFlags(); bool updateActiveStylesheets(StyleSelectorUpdateFlag); void collectActiveStylesheets(Vector<RefPtr<StyleSheet> >&); bool testAddedStylesheetRequiresStyleRecalc(CSSStyleSheet*); - void analyzeStylesheetChange(StyleSelectorUpdateFlag, const Vector<RefPtr<StyleSheet> >& newStylesheets, bool& requiresStyleSelectorReset, bool& requiresStyleRecalc); + void analyzeStylesheetChange(StyleSelectorUpdateFlag, const Vector<RefPtr<StyleSheet> >& newStylesheets, bool& requiresStyleSelectorReset, bool& requiresFullStyleRecalc); void deleteCustomFonts(); @@ -1182,7 +1179,7 @@ private: PageVisibilityState visibilityState() const; #endif - const RefPtr<HTMLCollection>& cachedCollection(CollectionType); + HTMLCollection* cachedCollection(CollectionType); int m_guardRefCount; @@ -1255,7 +1252,7 @@ private: RefPtr<Node> m_focusedNode; RefPtr<Node> m_hoverNode; RefPtr<Node> m_activeNode; - mutable RefPtr<Element> m_documentElement; + RefPtr<Element> m_documentElement; uint64_t m_domTreeVersion; static uint64_t s_globalTreeVersion; @@ -1365,10 +1362,10 @@ private: CheckedRadioButtons m_checkedRadioButtons; - RefPtr<HTMLCollection> m_collections[NumUnnamedDocumentCachedTypes]; - RefPtr<HTMLAllCollection> m_allCollection; + OwnPtr<HTMLCollection> m_collections[NumUnnamedDocumentCachedTypes]; + OwnPtr<HTMLAllCollection> m_allCollection; - typedef HashMap<AtomicStringImpl*, RefPtr<HTMLNameCollection> > NamedCollectionMap; + typedef HashMap<AtomicStringImpl*, OwnPtr<HTMLNameCollection> > NamedCollectionMap; NamedCollectionMap m_documentNamedItemCollections; NamedCollectionMap m_windowNamedItemCollections; @@ -1449,6 +1446,10 @@ private: Timer<Document> m_pendingTasksTimer; Vector<OwnPtr<Task> > m_pendingTasks; + +#ifndef NDEBUG + bool m_updatingStyleSelector; +#endif }; // Put these methods here, because they require the Document definition, but we really want to inline them. diff --git a/Source/WebCore/dom/DynamicNodeList.cpp b/Source/WebCore/dom/DynamicNodeList.cpp index 10cfcce39..788ab6ef6 100644 --- a/Source/WebCore/dom/DynamicNodeList.cpp +++ b/Source/WebCore/dom/DynamicNodeList.cpp @@ -28,45 +28,9 @@ namespace WebCore { -DynamicSubtreeNodeList::SubtreeCaches::SubtreeCaches() - : m_cachedItem(0) - , m_isLengthCacheValid(false) - , m_isItemCacheValid(false) - , m_domTreeVersionAtTimeOfCaching(0) -{ -} - -void DynamicSubtreeNodeList::SubtreeCaches::setLengthCache(Node* node, unsigned length) -{ - if (m_isItemCacheValid && !domVersionIsConsistent()) { - m_cachedItem = node; - m_isItemCacheValid = false; - } else if (!m_isItemCacheValid) - m_cachedItem = node; // Used in domVersionIsConsistent. - m_cachedLength = length; - m_isLengthCacheValid = true; - m_domTreeVersionAtTimeOfCaching = node->document()->domTreeVersion(); -} - -void DynamicSubtreeNodeList::SubtreeCaches::setItemCache(Node* item, unsigned offset) -{ - if (m_isLengthCacheValid && !domVersionIsConsistent()) - m_isLengthCacheValid = false; - m_cachedItem = item; - m_cachedItemOffset = offset; - m_isItemCacheValid = true; - m_domTreeVersionAtTimeOfCaching = item->document()->domTreeVersion(); -} - -void DynamicSubtreeNodeList::SubtreeCaches::reset() -{ - m_cachedItem = 0; - m_isLengthCacheValid = false; - m_isItemCacheValid = false; -} - DynamicSubtreeNodeList::DynamicSubtreeNodeList(PassRefPtr<Node> node) : DynamicNodeList(node) + , m_caches(Caches::create()) { rootNode()->registerDynamicSubtreeNodeList(this); } @@ -78,15 +42,16 @@ DynamicSubtreeNodeList::~DynamicSubtreeNodeList() unsigned DynamicSubtreeNodeList::length() const { - if (m_caches.isLengthCacheValid()) - return m_caches.cachedLength(); + if (m_caches->isLengthCacheValid) + return m_caches->cachedLength; unsigned length = 0; for (Node* n = node()->firstChild(); n; n = n->traverseNextNode(rootNode())) length += n->isElementNode() && nodeMatches(static_cast<Element*>(n)); - m_caches.setLengthCache(node(), length); + m_caches->cachedLength = length; + m_caches->isLengthCacheValid = true; return length; } @@ -97,7 +62,9 @@ Node* DynamicSubtreeNodeList::itemForwardsFromCurrent(Node* start, unsigned offs for (Node* n = start; n; n = n->traverseNextNode(rootNode())) { if (n->isElementNode() && nodeMatches(static_cast<Element*>(n))) { if (!remainingOffset) { - m_caches.setItemCache(n, offset); + m_caches->lastItem = n; + m_caches->lastItemOffset = offset; + m_caches->isItemCacheValid = true; return n; } --remainingOffset; @@ -113,7 +80,9 @@ Node* DynamicSubtreeNodeList::itemBackwardsFromCurrent(Node* start, unsigned off for (Node* n = start; n; n = n->traversePreviousNode(rootNode())) { if (n->isElementNode() && nodeMatches(static_cast<Element*>(n))) { if (!remainingOffset) { - m_caches.setItemCache(n, offset); + m_caches->lastItem = n; + m_caches->lastItemOffset = offset; + m_caches->isItemCacheValid = true; return n; } ++remainingOffset; @@ -127,12 +96,12 @@ Node* DynamicSubtreeNodeList::item(unsigned offset) const { int remainingOffset = offset; Node* start = node()->firstChild(); - if (m_caches.isItemCacheValid()) { - if (offset == m_caches.cachedItemOffset()) - return m_caches.cachedItem(); - if (offset > m_caches.cachedItemOffset() || m_caches.cachedItemOffset() - offset < offset) { - start = m_caches.cachedItem(); - remainingOffset -= m_caches.cachedItemOffset(); + if (m_caches->isItemCacheValid) { + if (offset == m_caches->lastItemOffset) + return m_caches->lastItem; + else if (offset > m_caches->lastItemOffset || m_caches->lastItemOffset - offset < offset) { + start = m_caches->lastItem; + remainingOffset -= m_caches->lastItemOffset; } } @@ -170,7 +139,7 @@ bool DynamicSubtreeNodeList::isDynamicNodeList() const void DynamicSubtreeNodeList::invalidateCache() { - m_caches.reset(); + m_caches->reset(); } DynamicSubtreeNodeList::Caches::Caches() @@ -180,12 +149,12 @@ DynamicSubtreeNodeList::Caches::Caches() { } -PassRefPtr<DynamicNodeList::Caches> DynamicNodeList::Caches::create() +PassRefPtr<DynamicSubtreeNodeList::Caches> DynamicSubtreeNodeList::Caches::create() { return adoptRef(new Caches()); } -void DynamicNodeList::Caches::reset() +void DynamicSubtreeNodeList::Caches::reset() { lastItem = 0; isLengthCacheValid = false; diff --git a/Source/WebCore/dom/DynamicNodeList.h b/Source/WebCore/dom/DynamicNodeList.h index a90455006..606fc64bf 100644 --- a/Source/WebCore/dom/DynamicNodeList.h +++ b/Source/WebCore/dom/DynamicNodeList.h @@ -24,7 +24,6 @@ #ifndef DynamicNodeList_h #define DynamicNodeList_h -#include "Document.h" #include "NodeList.h" #include <wtf/RefCounted.h> #include <wtf/Forward.h> @@ -46,11 +45,9 @@ public: unsigned lastItemOffset; bool isLengthCacheValid : 1; bool isItemCacheValid : 1; - protected: Caches(); }; - DynamicNodeList(PassRefPtr<Node> node) : m_node(node) { } @@ -79,40 +76,9 @@ public: protected: DynamicSubtreeNodeList(PassRefPtr<Node> rootNode); + mutable RefPtr<Caches> m_caches; private: - - class SubtreeCaches { - public: - SubtreeCaches(); - - bool isLengthCacheValid() const { return m_isLengthCacheValid && domVersionIsConsistent(); } - bool isItemCacheValid() const { return m_isItemCacheValid && domVersionIsConsistent(); } - - unsigned cachedLength() const { return m_cachedLength; } - Node* cachedItem() const { return m_cachedItem; } - unsigned cachedItemOffset() const { return m_cachedItemOffset; } - - void setLengthCache(Node* nodeForDocumentVersion, unsigned length); - void setItemCache(Node*, unsigned offset); - void reset(); - - private: - Node* m_cachedItem; - unsigned m_cachedItemOffset; - unsigned m_cachedLength : 30; - unsigned m_isLengthCacheValid : 1; - unsigned m_isItemCacheValid : 1; - - bool domVersionIsConsistent() const - { - return m_cachedItem && m_cachedItem->document()->domTreeVersion() == m_domTreeVersionAtTimeOfCaching; - } - uint64_t m_domTreeVersionAtTimeOfCaching; - }; - - mutable SubtreeCaches m_caches; - virtual bool isDynamicNodeList() const; Node* itemForwardsFromCurrent(Node* start, unsigned offset, int remainingOffset) const; Node* itemBackwardsFromCurrent(Node* start, unsigned offset, int remainingOffset) const; diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp index 109311651..24486d7be 100644 --- a/Source/WebCore/dom/Element.cpp +++ b/Source/WebCore/dom/Element.cpp @@ -123,16 +123,6 @@ Element::~Element() removeShadowRoot(); if (m_attributeMap) m_attributeMap->detachFromElement(); - - if (hasRareData()) { - ElementRareData* elementRareData = rareData(); - if (elementRareData->hasCachedHTMLCollections()) { - for (unsigned type = 0; type < NumNodeCollectionTypes; ++type) { - if (HTMLCollection* collection = elementRareData->cachedHTMLCollection(static_cast<CollectionType>(FirstNodeCollectionType + type))) - collection->detachFromNode(); - } - } - } } inline ElementRareData* Element::rareData() const @@ -674,7 +664,7 @@ void Element::attributeChanged(Attribute* attr, bool) void Element::updateAfterAttributeChanged(Attribute* attr) { - invalidateNodeListsCacheAfterAttributeChanged(); + invalidateNodeListsCacheAfterAttributeChanged(attr->name()); if (!AXObjectCache::accessibilityEnabled()) return; @@ -708,9 +698,12 @@ void Element::recalcStyleIfNeededAfterAttributeChanged(Attribute* attr) { if (needsStyleRecalc()) return; - - if (document()->attached() && document()->styleSelector()->hasSelectorForAttribute(attr->name().localName())) - setNeedsStyleRecalc(); + if (!document()->attached()) + return; + CSSStyleSelector* styleSelector = document()->styleSelectorIfExists(); + if (styleSelector && !styleSelector->hasSelectorForAttribute(attr->name().localName())) + return; + setNeedsStyleRecalc(); } void Element::idAttributeChanged(Attribute* attr) @@ -1221,7 +1214,7 @@ void Element::removeShadowRoot() oldRoot->detach(); oldRoot->setShadowHost(0); - oldRoot->setTreeScopeRecursively(document()); + document()->adoptIfNeeded(oldRoot.get()); if (oldRoot->inDocument()) oldRoot->removedFromDocument(); else diff --git a/Source/WebCore/dom/ElementRareData.h b/Source/WebCore/dom/ElementRareData.h index c5cf6cdff..4036a3136 100644 --- a/Source/WebCore/dom/ElementRareData.h +++ b/Source/WebCore/dom/ElementRareData.h @@ -43,25 +43,19 @@ public: using NodeRareData::needsFocusAppearanceUpdateSoonAfterAttach; using NodeRareData::setNeedsFocusAppearanceUpdateSoonAfterAttach; - typedef FixedArray<RefPtr<HTMLCollection>, NumNodeCollectionTypes> CachedHTMLCollectionArray; + typedef FixedArray<OwnPtr<HTMLCollection>, NumNodeCollectionTypes> CachedHTMLCollectionArray; bool hasCachedHTMLCollections() const { return m_cachedCollections; } - HTMLCollection* cachedHTMLCollection(CollectionType type) const - { - ASSERT(m_cachedCollections); - return (*m_cachedCollections)[type - FirstNodeCollectionType].get(); - } - HTMLCollection* ensureCachedHTMLCollection(Element* element, CollectionType type) { if (!m_cachedCollections) m_cachedCollections = adoptPtr(new CachedHTMLCollectionArray); - RefPtr<HTMLCollection>& collection = (*m_cachedCollections)[type - FirstNodeCollectionType]; + OwnPtr<HTMLCollection>& collection = (*m_cachedCollections)[type - FirstNodeCollectionType]; if (!collection) collection = HTMLCollection::create(element, type); return collection.get(); diff --git a/Source/WebCore/dom/NamedNodeMap.cpp b/Source/WebCore/dom/NamedNodeMap.cpp index 07ff84ded..c4a87ef4c 100644 --- a/Source/WebCore/dom/NamedNodeMap.cpp +++ b/Source/WebCore/dom/NamedNodeMap.cpp @@ -344,9 +344,7 @@ bool NamedNodeMap::mappedMapsEquivalent(const NamedNodeMap* otherMap) const ASSERT(attr->isMappedAttribute()); Attribute* otherAttr = otherMap->getAttributeItem(attr->name()); - if (!otherAttr || !otherAttr->decl() || attr->value() != otherAttr->value()) - return false; - if (!attr->decl()->propertiesEqual(otherAttr->decl())) + if (!otherAttr || attr->decl() != otherAttr->decl() || attr->value() != otherAttr->value()) return false; } } diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp index 8d1655dad..a1c76246d 100644 --- a/Source/WebCore/dom/Node.cpp +++ b/Source/WebCore/dom/Node.cpp @@ -90,6 +90,7 @@ #include "TagNodeList.h" #include "Text.h" #include "TextEvent.h" +#include "TreeScopeAdopter.h" #include "UIEvent.h" #include "UIEventWithKeyState.h" #include "WebKitAnimationEvent.h" @@ -417,37 +418,30 @@ Node::~Node() doc->guardDeref(); } -#ifndef NDEBUG - -static bool didMoveToNewDocumentWasCalled; -static Document* oldDocumentDidMoveToNewDocumentWasCalledWith; - -#endif - void Node::setDocument(Document* document) { ASSERT(!inDocument() || m_document == document); if (inDocument() || m_document == document) return; - document->guardRef(); - - if (m_document) { - m_document->moveNodeIteratorsToNewDocument(this, document); - m_document->guardDeref(); - } - - Document* oldDocument = m_document; m_document = document; +} -#ifndef NDEBUG - didMoveToNewDocumentWasCalled = false; - oldDocumentDidMoveToNewDocumentWasCalledWith = oldDocument; -#endif +NodeRareData* Node::setTreeScope(TreeScope* scope) +{ + if (!scope) { + if (hasRareData()) { + NodeRareData* data = rareData(); + data->setTreeScope(0); + return data; + } - didMoveToNewDocument(oldDocument); + return 0; + } - ASSERT(didMoveToNewDocumentWasCalled); + NodeRareData* data = ensureRareData(); + data->setTreeScope(scope); + return data; } TreeScope* Node::treeScope() const @@ -459,54 +453,6 @@ TreeScope* Node::treeScope() const return scope ? scope : m_document; } -void Node::setTreeScopeRecursively(TreeScope* newTreeScope) -{ - ASSERT(this); - ASSERT(!isDocumentNode()); - ASSERT(newTreeScope); - ASSERT(!m_deletionHasBegun); - - TreeScope* currentTreeScope = treeScope(); - if (currentTreeScope == newTreeScope) - return; - - Document* currentDocument = document(); - Document* newDocument = newTreeScope->document(); - // If an element is moved from a document and then eventually back again the collection cache for - // that element may contain stale data as changes made to it will have updated the DOMTreeVersion - // of the document it was moved to. By increasing the DOMTreeVersion of the donating document here - // we ensure that the collection cache will be invalidated as needed when the element is moved back. - if (currentDocument && currentDocument != newDocument) - currentDocument->incDOMTreeVersion(); - - for (Node* node = this; node; node = node->traverseNextNode(this)) { - if (newTreeScope == newDocument) { - if (node->hasRareData()) - node->rareData()->setTreeScope(0); - // Setting the new document tree scope will be handled implicitly - // by setDocument() below. - } else - node->ensureRareData()->setTreeScope(newTreeScope); - - if (node->hasRareData() && node->rareData()->nodeLists()) { - node->rareData()->nodeLists()->invalidateCaches(); - if (currentTreeScope) - currentTreeScope->removeNodeListCache(); - newTreeScope->addNodeListCache(); - } - - node->setDocument(newDocument); - - if (!node->isElementNode()) - continue; - if (ShadowRoot* shadowRoot = toElement(node)->shadowRoot()) { - shadowRoot->setParentTreeScope(newTreeScope); - if (currentDocument != newDocument) - shadowRoot->setDocumentRecursively(newDocument); - } - } -} - NodeRareData* Node::rareData() const { ASSERT(hasRareData()); @@ -871,19 +817,6 @@ inline static ShadowRoot* shadowRoot(Node* node) return node->isElementNode() ? toElement(node)->shadowRoot() : 0; } -void Node::setDocumentRecursively(Document* newDocument) -{ - ASSERT(document() != newDocument); - - for (Node* node = this; node; node = node->traverseNextNode(this)) { - node->setDocument(newDocument); - if (!node->isElementNode()) - continue; - if (ShadowRoot* shadow = shadowRoot(node)) - shadow->setDocumentRecursively(newDocument); - } -} - inline void Node::setStyleChange(StyleChangeType changeType) { m_nodeFlags = (m_nodeFlags & ~StyleChangeMask) | changeType; @@ -1022,19 +955,73 @@ void Node::unregisterDynamicSubtreeNodeList(DynamicSubtreeNodeList* list) removeNodeListCacheIfPossible(this, data); } -void Node::invalidateNodeListsCacheAfterAttributeChanged() +void Node::invalidateNodeListsCacheAfterAttributeChanged(const QualifiedName& attrName) { if (hasRareData() && isAttributeNode()) { NodeRareData* data = rareData(); ASSERT(!data->nodeLists()); data->clearChildNodeListCache(); } + + // This list should be sync'ed with NodeListsNodeData. + if (attrName != classAttr +#if ENABLE(MICRODATA) + && attrName != itemscopeAttr + && attrName != itempropAttr +#endif + && attrName != nameAttr) + return; + + if (!treeScope()->hasNodeListCaches()) + return; + + for (Node* node = this; node; node = node->parentNode()) { + ASSERT(this == node || !node->isAttributeNode()); + if (!node->hasRareData()) + continue; + NodeRareData* data = node->rareData(); + if (!data->nodeLists()) + continue; + + data->nodeLists()->invalidateCachesThatDependOnAttributes(); + removeNodeListCacheIfPossible(node, data); + } } void Node::invalidateNodeListsCacheAfterChildrenChanged() { if (hasRareData()) rareData()->clearChildNodeListCache(); + + if (!treeScope()->hasNodeListCaches()) + return; + for (Node* node = this; node; node = node->parentNode()) { + if (!node->hasRareData()) + continue; + NodeRareData* data = node->rareData(); + if (!data->nodeLists()) + continue; + + data->nodeLists()->invalidateCaches(); + + NodeListsNodeData::NodeListSet::iterator end = data->nodeLists()->m_listsWithCaches.end(); + for (NodeListsNodeData::NodeListSet::iterator it = data->nodeLists()->m_listsWithCaches.begin(); it != end; ++it) + (*it)->invalidateCache(); + + removeNodeListCacheIfPossible(node, data); + } +} + +void Node::notifyLocalNodeListsLabelChanged() +{ + if (!hasRareData()) + return; + NodeRareData* data = rareData(); + if (!data->nodeLists()) + return; + + if (data->nodeLists()->m_labelsNodeListCache) + data->nodeLists()->m_labelsNodeListCache->invalidateCache(); } void Node::removeCachedClassNodeList(ClassNodeList* list, const String& className) @@ -2217,6 +2204,23 @@ FloatPoint Node::convertFromPage(const FloatPoint& p) const return p; } +#if ENABLE(MICRODATA) +void Node::itemTypeAttributeChanged() +{ + Node * rootNode = document(); + + if (!rootNode->hasRareData()) + return; + + NodeRareData* data = rootNode->rareData(); + + if (!data->nodeLists()) + return; + + data->nodeLists()->invalidateMicrodataItemListCaches(); +} +#endif + #ifndef NDEBUG static void appendAttributeDesc(const Node* node, String& string, const QualifiedName& name, const char* attrDesc) @@ -2345,7 +2349,11 @@ void NodeListsNodeData::invalidateCaches() TagNodeListCacheNS::const_iterator tagCacheNSEnd = m_tagNodeListCacheNS.end(); for (TagNodeListCacheNS::const_iterator it = m_tagNodeListCacheNS.begin(); it != tagCacheNSEnd; ++it) it->second->invalidateCache(); + invalidateCachesThatDependOnAttributes(); +} +void NodeListsNodeData::invalidateCachesThatDependOnAttributes() +{ ClassNodeListCache::iterator classCacheEnd = m_classNodeListCache.end(); for (ClassNodeListCache::iterator it = m_classNodeListCache.begin(); it != classCacheEnd; ++it) it->second->invalidateCache(); @@ -2359,7 +2367,6 @@ void NodeListsNodeData::invalidateCaches() #if ENABLE(MICRODATA) invalidateMicrodataItemListCaches(); #endif - } #if ENABLE(MICRODATA) @@ -2435,12 +2442,7 @@ void Node::removedFromDocument() void Node::didMoveToNewDocument(Document* oldDocument) { - ASSERT(!didMoveToNewDocumentWasCalled); - ASSERT_UNUSED(oldDocument, oldDocument == oldDocumentDidMoveToNewDocumentWasCalledWith); - -#ifndef NDEBUG - didMoveToNewDocumentWasCalled = true; -#endif + TreeScopeAdopter::ensureDidMoveToNewDocumentWasCalled(oldDocument); // FIXME: Event listener types for this node should be set on the new owner document here. diff --git a/Source/WebCore/dom/Node.h b/Source/WebCore/dom/Node.h index 5733fff5d..9d6068b6e 100644 --- a/Source/WebCore/dom/Node.h +++ b/Source/WebCore/dom/Node.h @@ -105,6 +105,7 @@ enum StyleChangeType { class Node : public EventTarget, public ScriptWrappable, public TreeShared<ContainerNode> { friend class Document; friend class TreeScope; + friend class TreeScopeAdopter; public: enum NodeType { @@ -407,9 +408,6 @@ public: TreeScope* treeScope() const; - // Used by the basic DOM methods (e.g., appendChild()). - void setTreeScopeRecursively(TreeScope*); - // Returns true if this node is associated with a document and is in its associated document's // node tree, false otherwise. bool inDocument() const @@ -545,8 +543,9 @@ public: void registerDynamicSubtreeNodeList(DynamicSubtreeNodeList*); void unregisterDynamicSubtreeNodeList(DynamicSubtreeNodeList*); - void invalidateNodeListsCacheAfterAttributeChanged(); + void invalidateNodeListsCacheAfterAttributeChanged(const QualifiedName&); void invalidateNodeListsCacheAfterChildrenChanged(); + void notifyLocalNodeListsLabelChanged(); void removeCachedClassNodeList(ClassNodeList*, const String&); void removeCachedNameNodeList(NameNodeList*, const String&); @@ -614,6 +613,8 @@ public: virtual EventTargetData* ensureEventTargetData(); #if ENABLE(MICRODATA) + void itemTypeAttributeChanged(); + DOMSettableTokenList* itemProp(); DOMSettableTokenList* itemRef(); DOMSettableTokenList* itemType(); @@ -719,9 +720,9 @@ protected: void clearHasCustomStyleForRenderer() { clearFlag(HasCustomStyleForRendererFlag); } private: - // Do not use this method to change the document of a node until after the node has been - // removed from its previous document. - void setDocumentRecursively(Document*); + // These API should be only used for a tree scope migration. + // setTreeScope() returns NodeRareData to save extra nodeRareData() invocations on the caller site. + NodeRareData* setTreeScope(TreeScope*); void setDocument(Document*); enum EditableLevel { Editable, RichlyEditable }; diff --git a/Source/WebCore/dom/NodeRareData.h b/Source/WebCore/dom/NodeRareData.h index 2249e526b..362135c99 100644 --- a/Source/WebCore/dom/NodeRareData.h +++ b/Source/WebCore/dom/NodeRareData.h @@ -78,6 +78,7 @@ public: } void invalidateCaches(); + void invalidateCachesThatDependOnAttributes(); #if ENABLE(MICRODATA) void invalidateMicrodataItemListCaches(); @@ -221,7 +222,7 @@ public: HTMLPropertiesCollection* properties(Node* node) { if (!m_properties) - m_properties = HTMLPropertiesCollection::create(node); + m_properties = adoptPtr(HTMLPropertiesCollection::create(node)); return m_properties.get(); } @@ -256,7 +257,7 @@ private: mutable RefPtr<DOMSettableTokenList> m_itemProp; mutable RefPtr<DOMSettableTokenList> m_itemRef; mutable RefPtr<DOMSettableTokenList> m_itemType; - mutable RefPtr<HTMLPropertiesCollection> m_properties; + mutable OwnPtr<HTMLPropertiesCollection> m_properties; #endif }; diff --git a/Source/WebCore/dom/NodeRenderingContext.cpp b/Source/WebCore/dom/NodeRenderingContext.cpp index 96529fb86..ef85f7d23 100644 --- a/Source/WebCore/dom/NodeRenderingContext.cpp +++ b/Source/WebCore/dom/NodeRenderingContext.cpp @@ -36,6 +36,10 @@ #include "ShadowInclusionSelector.h" #include "ShadowRoot.h" +#if ENABLE(SVG) +#include "SVGNames.h" +#endif + namespace WebCore { NodeRenderingContext::NodeRenderingContext(Node* node) @@ -277,6 +281,13 @@ void NodeRenderingContext::moveToFlowThreadIfNeeded() if (!m_node->isElementNode() || !m_style || m_style->flowThread().isEmpty()) return; +#if ENABLE(SVG) + // Allow only svg root elements to be directly collected by a render flow thread. + if (m_node->isSVGElement() + && (!(m_node->hasTagName(SVGNames::svgTag) && m_node->parentNode() && !m_node->parentNode()->isSVGElement()))) + return; +#endif + m_flowThread = m_style->flowThread(); ASSERT(m_node->document()->renderView()); m_parentFlowRenderer = m_node->document()->renderView()->ensureRenderFlowThreadWithName(m_flowThread); diff --git a/Source/WebCore/dom/TreeScope.cpp b/Source/WebCore/dom/TreeScope.cpp index 35bad51ce..91f3c295b 100644 --- a/Source/WebCore/dom/TreeScope.cpp +++ b/Source/WebCore/dom/TreeScope.cpp @@ -31,6 +31,7 @@ #include "HTMLMapElement.h" #include "HTMLNames.h" #include "NodeRareData.h" +#include "TreeScopeAdopter.h" namespace WebCore { @@ -137,5 +138,16 @@ bool TreeScope::applyAuthorSheets() const return true; } +void TreeScope::adoptIfNeeded(Node* node) +{ + ASSERT(this); + ASSERT(node); + ASSERT(!node->isDocumentNode()); + ASSERT(!node->m_deletionHasBegun); + TreeScopeAdopter adopter(node, this); + if (adopter.needsScopeChange()) + adopter.execute(); +} + } // namespace WebCore diff --git a/Source/WebCore/dom/TreeScope.h b/Source/WebCore/dom/TreeScope.h index cbe3ee07a..fd6c3cb8d 100644 --- a/Source/WebCore/dom/TreeScope.h +++ b/Source/WebCore/dom/TreeScope.h @@ -64,6 +64,9 @@ public: virtual bool applyAuthorSheets() const; + // Used by the basic DOM mutation methods (e.g., appendChild()). + void adoptIfNeeded(Node*); + protected: TreeScope(Document*, ConstructionType = CreateContainer); virtual ~TreeScope(); diff --git a/Source/WebCore/dom/TreeScopeAdopter.cpp b/Source/WebCore/dom/TreeScopeAdopter.cpp new file mode 100644 index 000000000..ab117923e --- /dev/null +++ b/Source/WebCore/dom/TreeScopeAdopter.cpp @@ -0,0 +1,115 @@ +/* + * Copyright (C) 1999 Lars Knoll (knoll@kde.org) + * (C) 1999 Antti Koivisto (koivisto@kde.org) + * (C) 2001 Dirk Mueller (mueller@kde.org) + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ +#include "config.h" +#include "TreeScopeAdopter.h" + +#include "Document.h" +#include "NodeRareData.h" +#include "ShadowRoot.h" + +namespace WebCore { + +static inline ShadowRoot* shadowRootFor(Node* node) +{ + return node->isElementNode() ? toElement(node)->shadowRoot() : 0; +} + +void TreeScopeAdopter::moveTreeToNewScope(Node* root) const +{ + ASSERT(needsScopeChange()); + + // If an element is moved from a document and then eventually back again the collection cache for + // that element may contain stale data as changes made to it will have updated the DOMTreeVersion + // of the document it was moved to. By increasing the DOMTreeVersion of the donating document here + // we ensure that the collection cache will be invalidated as needed when the element is moved back. + Document* oldDocument = m_oldScope ? m_oldScope->document() : 0; + Document* newDocument = m_newScope->document(); + bool willMoveToNewDocument = oldDocument != newDocument; + if (oldDocument && willMoveToNewDocument) + oldDocument->incDOMTreeVersion(); + + for (Node* node = root; node; node = node->traverseNextNode(root)) { + NodeRareData* rareData = node->setTreeScope(newDocument == m_newScope ? 0 : m_newScope); + if (rareData && rareData->nodeLists()) { + rareData->nodeLists()->invalidateCaches(); + if (m_oldScope) + m_oldScope->removeNodeListCache(); + m_newScope->addNodeListCache(); + } + + if (willMoveToNewDocument) + moveNodeToNewDocument(node, oldDocument, newDocument); + + if (ShadowRoot* shadow = shadowRootFor(node)) { + shadow->setParentTreeScope(m_newScope); + if (willMoveToNewDocument) + moveTreeToNewDocument(shadow, oldDocument, newDocument); + } + } +} + +void TreeScopeAdopter::moveTreeToNewDocument(Node* root, Document* oldDocument, Document* newDocument) const +{ + for (Node* node = root; node; node = node->traverseNextNode(root)) { + moveNodeToNewDocument(node, oldDocument, newDocument); + if (ShadowRoot* shadow = shadowRootFor(node)) + moveTreeToNewDocument(shadow, oldDocument, newDocument); + } +} + +#ifndef NDEBUG +static bool didMoveToNewDocumentWasCalled = false; +static Document* oldDocumentDidMoveToNewDocumentWasCalledWith = 0; + +void TreeScopeAdopter::ensureDidMoveToNewDocumentWasCalled(Document* oldDocument) +{ + ASSERT(!didMoveToNewDocumentWasCalled); + ASSERT_UNUSED(oldDocument, oldDocument == oldDocumentDidMoveToNewDocumentWasCalledWith); + didMoveToNewDocumentWasCalled = true; +} +#endif + +inline void TreeScopeAdopter::moveNodeToNewDocument(Node* node, Document* oldDocument, Document* newDocument) const +{ + ASSERT(!node->inDocument() || oldDocument != newDocument); + + newDocument->guardRef(); + if (oldDocument) { + oldDocument->moveNodeIteratorsToNewDocument(node, newDocument); + oldDocument->guardDeref(); + } + + node->setDocument(newDocument); + +#ifndef NDEBUG + didMoveToNewDocumentWasCalled = false; + oldDocumentDidMoveToNewDocumentWasCalledWith = oldDocument; +#endif + + node->didMoveToNewDocument(oldDocument); + ASSERT(didMoveToNewDocumentWasCalled); +} + +} diff --git a/Source/WebCore/dom/TreeScopeAdopter.h b/Source/WebCore/dom/TreeScopeAdopter.h new file mode 100644 index 000000000..d2bd4d4f0 --- /dev/null +++ b/Source/WebCore/dom/TreeScopeAdopter.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 1999 Lars Knoll (knoll@kde.org) + * (C) 1999 Antti Koivisto (koivisto@kde.org) + * (C) 2001 Dirk Mueller (mueller@kde.org) + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ +#ifndef TreeScopeAdopter_h +#define TreeScopeAdopter_h + +#include "Element.h" + +namespace WebCore { + +class TreeScopeAdopter { +public: + explicit TreeScopeAdopter(Node* toAdopt, TreeScope* newScope); + + void execute() const { moveTreeToNewScope(m_toAdopt); } + bool needsScopeChange() const { return m_oldScope != m_newScope; } + +#ifdef NDEBUG + static void ensureDidMoveToNewDocumentWasCalled(Document*) { } +#else + static void ensureDidMoveToNewDocumentWasCalled(Document*); +#endif + +private: + void moveTreeToNewScope(Node*) const; + void moveTreeToNewDocument(Node*, Document* oldDocument, Document* newDocument) const; + void moveNodeToNewDocument(Node*, Document* oldDocument, Document* newDocument) const; + + Node* m_toAdopt; + TreeScope* m_newScope; + TreeScope* m_oldScope; +}; + +inline TreeScopeAdopter::TreeScopeAdopter(Node* toAdopt, TreeScope* newScope) + : m_toAdopt(toAdopt) + , m_newScope(newScope) + , m_oldScope(toAdopt->treeScope()) +{ + ASSERT(newScope); +} + +} + +#endif diff --git a/Source/WebCore/editing/gtk/FrameSelectionGtk.cpp b/Source/WebCore/editing/gtk/FrameSelectionGtk.cpp index a327e0699..a63787023 100644 --- a/Source/WebCore/editing/gtk/FrameSelectionGtk.cpp +++ b/Source/WebCore/editing/gtk/FrameSelectionGtk.cpp @@ -80,20 +80,17 @@ void FrameSelection::notifyAccessibilityForSelectionChange() if (!AXObjectCache::accessibilityEnabled()) return; - // Reset lastFocuseNode and return for no valid selections. + // Return for no valid selections. if (!m_selection.start().isNotNull() || !m_selection.end().isNotNull()) return; - RenderObject* focusedNode = m_selection.end().deprecatedNode()->renderer(); - AccessibilityObject* accessibilityObject = m_frame->document()->axObjectCache()->getOrCreate(focusedNode); - - // Need to check this as getOrCreate could return 0, + // Look for the accessibility object for the Frame. + AccessibilityObject* accessibilityObject = m_frame->document()->axObjectCache()->rootObjectForFrame(m_frame); if (!accessibilityObject) return; int offset; - // Always report the events w.r.t. the non-linked unignored parent. (i.e. ignoreLinks == true). - RefPtr<AccessibilityObject> object = objectAndOffsetUnignored(accessibilityObject, offset, true); + RefPtr<AccessibilityObject> object = objectFocusedAndCaretOffsetUnignored(accessibilityObject, offset); if (!object) return; diff --git a/Source/WebCore/editing/visible_units.cpp b/Source/WebCore/editing/visible_units.cpp index 338127801..509fa1d19 100644 --- a/Source/WebCore/editing/visible_units.cpp +++ b/Source/WebCore/editing/visible_units.cpp @@ -88,7 +88,7 @@ static VisiblePosition previousBoundary(const VisiblePosition& c, BoundarySearch searchRange->setStart(start.deprecatedNode(), start.deprecatedEditingOffset(), ec); searchRange->setEnd(end.deprecatedNode(), end.deprecatedEditingOffset(), ec); - + ASSERT(!ec); if (ec) return VisiblePosition(); diff --git a/Source/WebCore/html/FormAssociatedElement.cpp b/Source/WebCore/html/FormAssociatedElement.cpp index feb1d0d7a..d2f3f4abc 100644 --- a/Source/WebCore/html/FormAssociatedElement.cpp +++ b/Source/WebCore/html/FormAssociatedElement.cpp @@ -35,13 +35,14 @@ namespace WebCore { using namespace HTMLNames; -FormAssociatedElement::FormAssociatedElement(HTMLFormElement* form) - : m_form(form) +FormAssociatedElement::FormAssociatedElement() + : m_form(0) { } FormAssociatedElement::~FormAssociatedElement() { + setForm(0); } ValidityState* FormAssociatedElement::validity() @@ -76,19 +77,13 @@ void FormAssociatedElement::removedFromDocument() void FormAssociatedElement::insertedIntoTree() { HTMLElement* element = toHTMLElement(this); - if (element->fastHasAttribute(formAttr)) { - // Resets the form owner at first to make sure the element don't - // associate any form elements when there is no element which has - // the given ID. - if (m_form) { - m_form->removeFormElement(this); - m_form = 0; - } - Element* formElement = element->treeScope()->getElementById(element->fastGetAttribute(formAttr)); - if (formElement && formElement->hasTagName(formTag)) { - m_form = static_cast<HTMLFormElement*>(formElement); - m_form->registerFormElement(this); - } + const AtomicString& formId = element->fastGetAttribute(formAttr); + if (!formId.isNull()) { + HTMLFormElement* newForm = 0; + Element* newFormCandidate = element->treeScope()->getElementById(formId); + if (newFormCandidate && newFormCandidate->hasTagName(formTag)) + newForm = static_cast<HTMLFormElement*>(newFormCandidate); + setForm(newForm); return; } if (!m_form) { @@ -96,9 +91,7 @@ void FormAssociatedElement::insertedIntoTree() // JavaScript and inserted inside a form. In the case of the parser // setting a form, we will already have a non-null value for m_form, // and so we don't need to do anything. - m_form = element->findFormAncestor(); - if (m_form) - m_form->registerFormElement(this); + setForm(element->findFormAncestor()); } } @@ -117,15 +110,38 @@ void FormAssociatedElement::removedFromTree() // If the form and element are both in the same tree, preserve the connection to the form. // Otherwise, null out our form and remove ourselves from the form's list of elements. if (m_form && findRoot(element) != findRoot(m_form)) - removeFromForm(); + setForm(0); } -void FormAssociatedElement::removeFromForm() +void FormAssociatedElement::setForm(HTMLFormElement* newForm) { + if (m_form == newForm) + return; + willChangeForm(); + if (m_form) + m_form->removeFormElement(this); + m_form = newForm; + if (m_form) + m_form->registerFormElement(this); + didChangeForm(); +} + +void FormAssociatedElement::willChangeForm() +{ +} + +void FormAssociatedElement::didChangeForm() +{ +} + +void FormAssociatedElement::formWillBeDestroyed() +{ + ASSERT(m_form); if (!m_form) return; - m_form->removeFormElement(this); + willChangeForm(); m_form = 0; + didChangeForm(); } void FormAssociatedElement::resetFormOwner() @@ -135,9 +151,8 @@ void FormAssociatedElement::resetFormOwner() if (m_form) { if (formId.isNull()) return; - m_form->removeFormElement(this); } - m_form = 0; + HTMLFormElement* newForm = 0; if (!formId.isNull() && element->inDocument()) { // The HTML5 spec says that the element should be associated with // the first element in the document to have an ID that equal to @@ -145,11 +160,10 @@ void FormAssociatedElement::resetFormOwner() // treeScope()->getElementById() over the given element. Element* firstElement = element->treeScope()->getElementById(formId); if (firstElement && firstElement->hasTagName(formTag)) - m_form = static_cast<HTMLFormElement*>(firstElement); + newForm = static_cast<HTMLFormElement*>(firstElement); } else - m_form = element->findFormAncestor(); - if (m_form) - m_form->registerFormElement(this); + newForm = element->findFormAncestor(); + setForm(newForm); } void FormAssociatedElement::formAttributeChanged() @@ -157,11 +171,7 @@ void FormAssociatedElement::formAttributeChanged() HTMLElement* element = toHTMLElement(this); if (!element->fastHasAttribute(formAttr)) { // The form attribute removed. We need to reset form owner here. - if (m_form) - m_form->removeFormElement(this); - m_form = element->findFormAncestor(); - if (m_form) - form()->registerFormElement(this); + setForm(element->findFormAncestor()); element->document()->unregisterFormElementWithFormAttribute(this); } else resetFormOwner(); diff --git a/Source/WebCore/html/FormAssociatedElement.h b/Source/WebCore/html/FormAssociatedElement.h index 1a8e1657e..b336f373c 100644 --- a/Source/WebCore/html/FormAssociatedElement.h +++ b/Source/WebCore/html/FormAssociatedElement.h @@ -53,12 +53,12 @@ public: // Return true for a successful control (see HTML4-17.13.2). virtual bool appendFormData(FormDataList&, bool) { return false; } - virtual void formDestroyed() { m_form = 0; } + void formWillBeDestroyed(); void resetFormOwner(); protected: - FormAssociatedElement(HTMLFormElement*); + FormAssociatedElement(); void insertedIntoTree(); void removedFromTree(); @@ -66,10 +66,15 @@ protected: void removedFromDocument(); void didMoveToNewDocument(Document* oldDocument); - void setForm(HTMLFormElement* form) { m_form = form; } - void removeFromForm(); + void setForm(HTMLFormElement*); void formAttributeChanged(); + // If you add an override of willChangeForm() or didChangeForm() to a class + // derived from this one, you will need to add a call to setForm(0) to the + // destructor of that class. + virtual void willChangeForm(); + virtual void didChangeForm(); + private: virtual const AtomicString& formControlName() const = 0; diff --git a/Source/WebCore/html/HTMLAllCollection.cpp b/Source/WebCore/html/HTMLAllCollection.cpp index 3dc07a388..ea7ae9763 100644 --- a/Source/WebCore/html/HTMLAllCollection.cpp +++ b/Source/WebCore/html/HTMLAllCollection.cpp @@ -30,9 +30,9 @@ namespace WebCore { -PassRefPtr<HTMLAllCollection> HTMLAllCollection::create(Document* document) +PassOwnPtr<HTMLAllCollection> HTMLAllCollection::create(Document* document) { - return adoptRef(new HTMLAllCollection(document)); + return adoptPtr(new HTMLAllCollection(document)); } HTMLAllCollection::HTMLAllCollection(Document* document) @@ -46,9 +46,6 @@ HTMLAllCollection::~HTMLAllCollection() Node* HTMLAllCollection::namedItemWithIndex(const AtomicString& name, unsigned index) const { - if (!base()) - return 0; - invalidateCacheIfNeeded(); updateNameCache(); diff --git a/Source/WebCore/html/HTMLAllCollection.h b/Source/WebCore/html/HTMLAllCollection.h index ae97a53ac..d636bbd01 100644 --- a/Source/WebCore/html/HTMLAllCollection.h +++ b/Source/WebCore/html/HTMLAllCollection.h @@ -32,7 +32,7 @@ namespace WebCore { class HTMLAllCollection : public HTMLCollection { public: - static PassRefPtr<HTMLAllCollection> create(Document*); + static PassOwnPtr<HTMLAllCollection> create(Document*); virtual ~HTMLAllCollection(); Node* namedItemWithIndex(const AtomicString& name, unsigned index) const; diff --git a/Source/WebCore/html/HTMLCanvasElement.cpp b/Source/WebCore/html/HTMLCanvasElement.cpp index ca993e31c..681fb93ca 100644 --- a/Source/WebCore/html/HTMLCanvasElement.cpp +++ b/Source/WebCore/html/HTMLCanvasElement.cpp @@ -423,13 +423,13 @@ bool HTMLCanvasElement::shouldAccelerate(const IntSize& size) const { #if USE(IOSURFACE_CANVAS_BACKING_STORE) UNUSED_PARAM(size); - return document()->settings()->canvasUsesAcceleratedDrawing(); + return document()->settings() && document()->settings()->canvasUsesAcceleratedDrawing(); #elif ENABLE(ACCELERATED_2D_CANVAS) if (m_context && !m_context->is2d()) return false; Settings* settings = document()->settings(); - if (!settings->accelerated2dCanvasEnabled()) + if (!settings || !settings->accelerated2dCanvasEnabled()) return false; // Do not use acceleration for small canvas. @@ -465,7 +465,12 @@ void HTMLCanvasElement::createImageBuffer() const if (!bufferSize.width() || !bufferSize.height()) return; - RenderingMode renderingMode = shouldAccelerate(bufferSize) ? Accelerated : Unaccelerated; + RenderingMode renderingMode = shouldAccelerate(bufferSize) ? Accelerated : +#if USE(SKIA) + UnacceleratedNonPlatformBuffer; +#else + Unaccelerated; +#endif m_imageBuffer = ImageBuffer::create(bufferSize, ColorSpaceDeviceRGB, renderingMode); if (!m_imageBuffer) return; diff --git a/Source/WebCore/html/HTMLCollection.cpp b/Source/WebCore/html/HTMLCollection.cpp index 0803fe9cc..e6f2eac0a 100644 --- a/Source/WebCore/html/HTMLCollection.cpp +++ b/Source/WebCore/html/HTMLCollection.cpp @@ -41,6 +41,7 @@ HTMLCollection::HTMLCollection(Node* base, CollectionType type) , m_type(type) , m_base(base) { + ASSERT(m_base); m_cache.clear(); } @@ -76,24 +77,17 @@ bool HTMLCollection::shouldIncludeChildren(CollectionType type) return false; } -PassRefPtr<HTMLCollection> HTMLCollection::create(Node* base, CollectionType type) +PassOwnPtr<HTMLCollection> HTMLCollection::create(Node* base, CollectionType type) { - return adoptRef(new HTMLCollection(base, type)); + return adoptPtr(new HTMLCollection(base, type)); } HTMLCollection::~HTMLCollection() { } -void HTMLCollection::detachFromNode() -{ - m_base = 0; -} - void HTMLCollection::invalidateCacheIfNeeded() const { - ASSERT(m_base); - uint64_t docversion = static_cast<HTMLDocument*>(m_base->document())->domTreeVersion(); if (m_cache.version == docversion) @@ -161,8 +155,6 @@ static Node* nextNodeOrSibling(Node* base, Node* node, bool includeChildren) Element* HTMLCollection::itemAfter(Element* previous) const { - ASSERT(m_base); - Node* current; if (!previous) current = m_base->firstChild(); @@ -182,8 +174,6 @@ Element* HTMLCollection::itemAfter(Element* previous) const unsigned HTMLCollection::calcLength() const { - ASSERT(m_base); - unsigned len = 0; for (Element* current = itemAfter(0); current; current = itemAfter(current)) ++len; @@ -194,9 +184,6 @@ unsigned HTMLCollection::calcLength() const // calculation every time if anything has changed unsigned HTMLCollection::length() const { - if (!m_base) - return 0; - invalidateCacheIfNeeded(); if (!m_cache.hasLength) { m_cache.length = calcLength(); @@ -207,9 +194,6 @@ unsigned HTMLCollection::length() const Node* HTMLCollection::item(unsigned index) const { - if (!m_base) - return 0; - invalidateCacheIfNeeded(); if (m_cache.current && m_cache.position == index) return m_cache.current; @@ -236,7 +220,6 @@ Node* HTMLCollection::firstItem() const Node* HTMLCollection::nextItem() const { - ASSERT(m_base); invalidateCacheIfNeeded(); // Look for the 'second' item. The first one is currentItem, already given back. @@ -276,9 +259,6 @@ bool HTMLCollection::checkForNameMatch(Element* element, bool checkName, const A Node* HTMLCollection::namedItem(const AtomicString& name) const { - if (!m_base) - return 0; - // http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/nameditem.asp // This method first searches for an object with a matching id // attribute. If a match is not found, the method then searches for an @@ -306,8 +286,6 @@ Node* HTMLCollection::namedItem(const AtomicString& name) const void HTMLCollection::updateNameCache() const { - ASSERT(m_base); - if (m_cache.hasNameCache) return; @@ -328,9 +306,6 @@ void HTMLCollection::updateNameCache() const bool HTMLCollection::hasNamedItem(const AtomicString& name) const { - if (!m_base) - return false; - if (name.isEmpty()) return false; @@ -352,9 +327,6 @@ bool HTMLCollection::hasNamedItem(const AtomicString& name) const void HTMLCollection::namedItems(const AtomicString& name, Vector<RefPtr<Node> >& result) const { - if (!m_base) - return; - ASSERT(result.isEmpty()); if (name.isEmpty()) return; @@ -374,9 +346,6 @@ void HTMLCollection::namedItems(const AtomicString& name, Vector<RefPtr<Node> >& PassRefPtr<NodeList> HTMLCollection::tags(const String& name) { - if (!m_base) - return 0; - return m_base->getElementsByTagName(name); } diff --git a/Source/WebCore/html/HTMLCollection.h b/Source/WebCore/html/HTMLCollection.h index 76bc24102..fa3ff1ead 100644 --- a/Source/WebCore/html/HTMLCollection.h +++ b/Source/WebCore/html/HTMLCollection.h @@ -23,26 +23,29 @@ #ifndef HTMLCollection_h #define HTMLCollection_h +#include "Node.h" #include "CollectionType.h" -#include <wtf/RefCounted.h> #include <wtf/Forward.h> #include <wtf/HashMap.h> +#include <wtf/PassOwnPtr.h> #include <wtf/Vector.h> namespace WebCore { class Document; class Element; -class Node; class NodeList; -class HTMLCollection : public RefCounted<HTMLCollection> { +class HTMLCollection { public: - static PassRefPtr<HTMLCollection> create(Node* base, CollectionType); + static PassOwnPtr<HTMLCollection> create(Node* base, CollectionType); virtual ~HTMLCollection(); + void ref() { m_base->ref(); } + void deref() { m_base->deref(); } + unsigned length() const; - + virtual Node* item(unsigned index) const; virtual Node* nextItem() const; @@ -58,8 +61,6 @@ public: Node* base() const { return m_base; } CollectionType type() const { return static_cast<CollectionType>(m_type); } - void detachFromNode(); - protected: HTMLCollection(Node* base, CollectionType); diff --git a/Source/WebCore/html/HTMLDataListElement.cpp b/Source/WebCore/html/HTMLDataListElement.cpp index 964d3422a..f6cc7da33 100644 --- a/Source/WebCore/html/HTMLDataListElement.cpp +++ b/Source/WebCore/html/HTMLDataListElement.cpp @@ -47,7 +47,7 @@ PassRefPtr<HTMLDataListElement> HTMLDataListElement::create(const QualifiedName& return adoptRef(new HTMLDataListElement(tagName, document)); } -PassRefPtr<HTMLCollection> HTMLDataListElement::options() +HTMLCollection* HTMLDataListElement::options() { return ensureCachedHTMLCollection(DataListOptions); } diff --git a/Source/WebCore/html/HTMLDataListElement.h b/Source/WebCore/html/HTMLDataListElement.h index 97e608f5a..64bfc89dd 100644 --- a/Source/WebCore/html/HTMLDataListElement.h +++ b/Source/WebCore/html/HTMLDataListElement.h @@ -43,7 +43,7 @@ class HTMLDataListElement : public HTMLElement { public: static PassRefPtr<HTMLDataListElement> create(const QualifiedName&, Document*); - PassRefPtr<HTMLCollection> options(); + HTMLCollection* options(); private: HTMLDataListElement(const QualifiedName&, Document*); diff --git a/Source/WebCore/html/HTMLElement.cpp b/Source/WebCore/html/HTMLElement.cpp index 573d581d4..a78f4d057 100644 --- a/Source/WebCore/html/HTMLElement.cpp +++ b/Source/WebCore/html/HTMLElement.cpp @@ -237,6 +237,7 @@ void HTMLElement::parseMappedAttribute(Attribute* attr) setItemRef(attr->value()); } else if (attr->name() == itemtypeAttr) { setItemType(attr->value()); + itemTypeAttributeChanged(); #endif } // standard events @@ -642,7 +643,7 @@ static Element* contextElementForInsertion(const String& where, Element* element { if (equalIgnoringCase(where, "beforeBegin") || equalIgnoringCase(where, "afterEnd")) { ContainerNode* parent = element->parentNode(); - if (parent && parent->isDocumentNode()) { + if (parent && !parent->isElementNode()) { ec = NO_MODIFICATION_ALLOWED_ERR; return 0; } @@ -824,7 +825,7 @@ void HTMLElement::setTabIndex(int value) setAttribute(tabindexAttr, String::number(value)); } -PassRefPtr<HTMLCollection> HTMLElement::children() +HTMLCollection* HTMLElement::children() { return ensureCachedHTMLCollection(NodeChildren); } diff --git a/Source/WebCore/html/HTMLElement.h b/Source/WebCore/html/HTMLElement.h index b98b2ddc4..a86b2b917 100644 --- a/Source/WebCore/html/HTMLElement.h +++ b/Source/WebCore/html/HTMLElement.h @@ -39,8 +39,8 @@ class HTMLElement : public StyledElement { public: static PassRefPtr<HTMLElement> create(const QualifiedName& tagName, Document*); - PassRefPtr<HTMLCollection> children(); - + HTMLCollection* children(); + virtual String title() const; virtual short tabIndex() const; diff --git a/Source/WebCore/html/HTMLFormCollection.cpp b/Source/WebCore/html/HTMLFormCollection.cpp index 6b19d446e..d25653fe8 100644 --- a/Source/WebCore/html/HTMLFormCollection.cpp +++ b/Source/WebCore/html/HTMLFormCollection.cpp @@ -40,9 +40,9 @@ HTMLFormCollection::HTMLFormCollection(HTMLFormElement* form) { } -PassRefPtr<HTMLFormCollection> HTMLFormCollection::create(HTMLFormElement* form) +PassOwnPtr<HTMLFormCollection> HTMLFormCollection::create(HTMLFormElement* form) { - return adoptRef(new HTMLFormCollection(form)); + return adoptPtr(new HTMLFormCollection(form)); } HTMLFormCollection::~HTMLFormCollection() @@ -51,15 +51,11 @@ HTMLFormCollection::~HTMLFormCollection() unsigned HTMLFormCollection::calcLength() const { - ASSERT(base()); return static_cast<HTMLFormElement*>(base())->length(); } Node* HTMLFormCollection::item(unsigned index) const { - if (!base()) - return 0; - invalidateCacheIfNeeded(); if (m_cache.current && m_cache.position == index) @@ -96,9 +92,6 @@ Node* HTMLFormCollection::item(unsigned index) const Element* HTMLFormCollection::getNamedItem(const QualifiedName& attrName, const AtomicString& name) const { - if (!base()) - return 0; - m_cache.position = 0; return getNamedFormItem(attrName, name, 0); } @@ -143,9 +136,6 @@ Node* HTMLFormCollection::nextItem() const Node* HTMLFormCollection::namedItem(const AtomicString& name) const { - if (!base()) - return 0; - // http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/nameditem.asp // This method first searches for an object with a matching id // attribute. If a match is not found, the method then searches for an @@ -161,9 +151,6 @@ Node* HTMLFormCollection::namedItem(const AtomicString& name) const void HTMLFormCollection::updateNameCache() const { - if (!base()) - return; - if (m_cache.hasNameCache) return; diff --git a/Source/WebCore/html/HTMLFormCollection.h b/Source/WebCore/html/HTMLFormCollection.h index 7d2963820..60c6d2b48 100644 --- a/Source/WebCore/html/HTMLFormCollection.h +++ b/Source/WebCore/html/HTMLFormCollection.h @@ -35,7 +35,7 @@ class QualifiedName; class HTMLFormCollection : public HTMLCollection { public: - static PassRefPtr<HTMLFormCollection> create(HTMLFormElement*); + static PassOwnPtr<HTMLFormCollection> create(HTMLFormElement*); virtual ~HTMLFormCollection(); diff --git a/Source/WebCore/html/HTMLFormControlElement.cpp b/Source/WebCore/html/HTMLFormControlElement.cpp index 71a44844b..b13b25676 100644 --- a/Source/WebCore/html/HTMLFormControlElement.cpp +++ b/Source/WebCore/html/HTMLFormControlElement.cpp @@ -50,7 +50,6 @@ using namespace std; HTMLFormControlElement::HTMLFormControlElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form) : HTMLElement(tagName, document) - , FormAssociatedElement(form) , m_disabled(false) , m_readOnly(false) , m_required(false) @@ -61,18 +60,12 @@ HTMLFormControlElement::HTMLFormControlElement(const QualifiedName& tagName, Doc , m_wasChangedSinceLastFormControlChangeEvent(false) , m_hasAutofocused(false) { - if (!this->form()) - setForm(findFormAncestor()); - if (this->form()) - this->form()->registerFormElement(this); - + setForm(form ? form : findFormAncestor()); setHasCustomWillOrDidRecalcStyle(); } HTMLFormControlElement::~HTMLFormControlElement() { - if (form()) - form()->removeFormElement(this); } void HTMLFormControlElement::detach() @@ -108,11 +101,9 @@ bool HTMLFormControlElement::formNoValidate() const void HTMLFormControlElement::parseMappedAttribute(Attribute* attr) { - if (attr->name() == formAttr) { + if (attr->name() == formAttr) formAttributeChanged(); - if (!form()) - document()->checkedRadioButtons().addButton(this); - } else if (attr->name() == disabledAttr) { + else if (attr->name() == disabledAttr) { bool oldDisabled = m_disabled; m_disabled = !attr->isNull(); if (oldDisabled != m_disabled) { @@ -205,9 +196,6 @@ void HTMLFormControlElement::didMoveToNewDocument(Document* oldDocument) void HTMLFormControlElement::insertedIntoTree(bool deep) { FormAssociatedElement::insertedIntoTree(); - if (!form()) - document()->checkedRadioButtons().addButton(this); - HTMLElement::insertedIntoTree(deep); } diff --git a/Source/WebCore/html/HTMLFormElement.cpp b/Source/WebCore/html/HTMLFormElement.cpp index dab47efff..92b684a4e 100644 --- a/Source/WebCore/html/HTMLFormElement.cpp +++ b/Source/WebCore/html/HTMLFormElement.cpp @@ -91,14 +91,11 @@ PassRefPtr<HTMLFormElement> HTMLFormElement::create(const QualifiedName& tagName HTMLFormElement::~HTMLFormElement() { - if (m_elementsCollection) - m_elementsCollection->detachFromNode(); - if (!shouldAutocomplete()) document()->unregisterForPageCacheSuspensionCallbacks(this); for (unsigned i = 0; i < m_associatedElements.size(); ++i) - m_associatedElements[i]->formDestroyed(); + m_associatedElements[i]->formWillBeDestroyed(); for (unsigned i = 0; i < m_imageElements.size(); ++i) m_imageElements[i]->m_form = 0; } @@ -459,18 +456,11 @@ unsigned HTMLFormElement::formElementIndex(FormAssociatedElement* associatedElem void HTMLFormElement::registerFormElement(FormAssociatedElement* e) { - if (e->isFormControlElement()) { - HTMLFormControlElement* element = static_cast<HTMLFormControlElement*>(e); - document()->checkedRadioButtons().removeButton(element); - m_checkedRadioButtons.addButton(element); - } m_associatedElements.insert(formElementIndex(e), e); } void HTMLFormElement::removeFormElement(FormAssociatedElement* e) { - if (e->isFormControlElement()) - m_checkedRadioButtons.removeButton(static_cast<HTMLFormControlElement*>(e)); unsigned index; for (index = 0; index < m_associatedElements.size(); ++index) { if (m_associatedElements[index] == e) @@ -501,11 +491,11 @@ void HTMLFormElement::removeImgElement(HTMLImageElement* e) removeFromVector(m_imageElements, e); } -PassRefPtr<HTMLCollection> HTMLFormElement::elements() +HTMLCollection* HTMLFormElement::elements() { if (!m_elementsCollection) m_elementsCollection = HTMLFormCollection::create(this); - return m_elementsCollection; + return m_elementsCollection.get(); } String HTMLFormElement::name() const diff --git a/Source/WebCore/html/HTMLFormElement.h b/Source/WebCore/html/HTMLFormElement.h index 2dd8af1ff..08c114119 100644 --- a/Source/WebCore/html/HTMLFormElement.h +++ b/Source/WebCore/html/HTMLFormElement.h @@ -47,7 +47,7 @@ public: static PassRefPtr<HTMLFormElement> create(const QualifiedName&, Document*); virtual ~HTMLFormElement(); - PassRefPtr<HTMLCollection> elements(); + HTMLCollection* elements(); void getNamedElements(const AtomicString&, Vector<RefPtr<Node> >&); unsigned length() const; @@ -149,7 +149,7 @@ private: FormSubmission::Attributes m_attributes; OwnPtr<AliasMap> m_elementAliases; - RefPtr<HTMLFormCollection> m_elementsCollection; + OwnPtr<HTMLFormCollection> m_elementsCollection; CheckedRadioButtons m_checkedRadioButtons; diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp index 46d1049bd..3bb9af093 100644 --- a/Source/WebCore/html/HTMLInputElement.cpp +++ b/Source/WebCore/html/HTMLInputElement.cpp @@ -116,11 +116,9 @@ HTMLInputElement::~HTMLInputElement() if (needsSuspensionCallback()) document()->unregisterForPageCacheSuspensionCallbacks(this); - document()->checkedRadioButtons().removeButton(this); - - // Need to remove this from the form while it is still an HTMLInputElement, - // so can't wait for the base class's destructor to do it. - removeFromForm(); + // Need to remove form association while this is still an HTMLInputElement + // so that virtual functions are called correctly. + setForm(0); } const AtomicString& HTMLInputElement::formControlName() const @@ -179,8 +177,7 @@ bool HTMLInputElement::shouldAutocomplete() const void HTMLInputElement::updateCheckedRadioButtons() { - if (attached() && checked()) - checkedRadioButtons().addButton(this); + checkedRadioButtons().addButton(this); if (form()) { const Vector<FormAssociatedElement*>& controls = form()->associatedElements(); @@ -1502,6 +1499,32 @@ void HTMLInputElement::documentDidResumeFromPageCache() reset(); } +void HTMLInputElement::willChangeForm() +{ + checkedRadioButtons().removeButton(this); + HTMLTextFormControlElement::willChangeForm(); +} + +void HTMLInputElement::didChangeForm() +{ + HTMLTextFormControlElement::didChangeForm(); + checkedRadioButtons().addButton(this); +} + +void HTMLInputElement::insertedIntoDocument() +{ + HTMLTextFormControlElement::insertedIntoDocument(); + ASSERT(inDocument()); + checkedRadioButtons().addButton(this); +} + +void HTMLInputElement::removedFromDocument() +{ + ASSERT(inDocument()); + checkedRadioButtons().removeButton(this); + HTMLTextFormControlElement::removedFromDocument(); +} + void HTMLInputElement::didMoveToNewDocument(Document* oldDocument) { m_inputType->willMoveToNewOwnerDocument(); @@ -1576,7 +1599,7 @@ HTMLOptionElement* HTMLInputElement::selectedOption() const HTMLDataListElement* sourceElement = dataList(); if (!sourceElement) return 0; - RefPtr<HTMLCollection> options = sourceElement->options(); + HTMLCollection* options = sourceElement->options(); if (!options) return 0; unsigned length = options->length(); diff --git a/Source/WebCore/html/HTMLInputElement.h b/Source/WebCore/html/HTMLInputElement.h index 054436dd4..d21244d39 100644 --- a/Source/WebCore/html/HTMLInputElement.h +++ b/Source/WebCore/html/HTMLInputElement.h @@ -249,6 +249,10 @@ private: enum AutoCompleteSetting { Uninitialized, On, Off }; enum AnyStepHandling { RejectAny, AnyIsDefaultStep }; + virtual void willChangeForm() OVERRIDE; + virtual void didChangeForm() OVERRIDE; + virtual void insertedIntoDocument() OVERRIDE; + virtual void removedFromDocument() OVERRIDE; virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE; virtual bool isKeyboardFocusable(KeyboardEvent*) const; diff --git a/Source/WebCore/html/HTMLLabelElement.cpp b/Source/WebCore/html/HTMLLabelElement.cpp index 6cbd21900..318fe88da 100644 --- a/Source/WebCore/html/HTMLLabelElement.cpp +++ b/Source/WebCore/html/HTMLLabelElement.cpp @@ -154,4 +154,15 @@ void HTMLLabelElement::accessKeyAction(bool sendMouseEvents) HTMLElement::accessKeyAction(sendMouseEvents); } +void HTMLLabelElement::parseMappedAttribute(Attribute* attribute) +{ + if (attribute->name() == forAttr) { + // htmlFor attribute change affects other nodes than this. + // Clear the caches to ensure that the labels caches are cleared. + if (document()) + document()->notifyLocalNodeListsLabelChanged(); + } else + HTMLElement::parseMappedAttribute(attribute); +} + } // namespace diff --git a/Source/WebCore/html/HTMLLabelElement.h b/Source/WebCore/html/HTMLLabelElement.h index 32a55e449..2f8497839 100644 --- a/Source/WebCore/html/HTMLLabelElement.h +++ b/Source/WebCore/html/HTMLLabelElement.h @@ -50,6 +50,8 @@ private: virtual void defaultEventHandler(Event*); void focus(bool restorePreviousSelection = true); + + virtual void parseMappedAttribute(Attribute*); }; } //namespace diff --git a/Source/WebCore/html/HTMLMapElement.cpp b/Source/WebCore/html/HTMLMapElement.cpp index 098295b73..bf4a3b333 100644 --- a/Source/WebCore/html/HTMLMapElement.cpp +++ b/Source/WebCore/html/HTMLMapElement.cpp @@ -82,7 +82,7 @@ bool HTMLMapElement::mapMouseEvent(LayoutPoint location, const LayoutSize& size, HTMLImageElement* HTMLMapElement::imageElement() { - RefPtr<HTMLCollection> coll = document()->images(); + HTMLCollection* coll = document()->images(); for (Node* curr = coll->firstItem(); curr; curr = coll->nextItem()) { if (!curr->hasTagName(imgTag)) continue; @@ -126,7 +126,7 @@ void HTMLMapElement::parseMappedAttribute(Attribute* attribute) HTMLElement::parseMappedAttribute(attribute); } -PassRefPtr<HTMLCollection> HTMLMapElement::areas() +HTMLCollection* HTMLMapElement::areas() { return ensureCachedHTMLCollection(MapAreas); } diff --git a/Source/WebCore/html/HTMLMapElement.h b/Source/WebCore/html/HTMLMapElement.h index 300676695..925895cab 100644 --- a/Source/WebCore/html/HTMLMapElement.h +++ b/Source/WebCore/html/HTMLMapElement.h @@ -41,7 +41,7 @@ public: bool mapMouseEvent(LayoutPoint location, const LayoutSize&, HitTestResult&); HTMLImageElement* imageElement(); - PassRefPtr<HTMLCollection> areas(); + HTMLCollection* areas(); private: HTMLMapElement(const QualifiedName&, Document*); diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp index 0b693b2b9..4f06af6ea 100644 --- a/Source/WebCore/html/HTMLMediaElement.cpp +++ b/Source/WebCore/html/HTMLMediaElement.cpp @@ -236,6 +236,7 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* docum , m_tracksAreReady(true) , m_haveVisibleTextTrack(false) , m_textTracks(0) + , m_ignoreTrackDisplayUpdate(0) #endif #if ENABLE(WEB_AUDIO) , m_audioSourceNode(0) @@ -325,6 +326,10 @@ void HTMLMediaElement::attributeChanged(Attribute* attr, bool preserveDecls) scheduleLoad(MediaResource); } else if (attrName == controlsAttr) configureMediaControls(); +#if PLATFORM(MAC) + else if (attrName == loopAttr) + updateDisableSleep(); +#endif } void HTMLMediaElement::parseMappedAttribute(Attribute* attr) @@ -948,6 +953,9 @@ void HTMLMediaElement::loadResource(const KURL& initialURL, ContentType& content #if ENABLE(VIDEO_TRACK) void HTMLMediaElement::updateActiveTextTrackCues(float movieTime) { + if (ignoreTrackDisplayUpdateRequests()) + return; + CueList previouslyActiveCues = m_currentlyActiveCues; bool activeSetChanged = false; @@ -1030,24 +1038,32 @@ void HTMLMediaElement::textTrackKindChanged(TextTrack*) void HTMLMediaElement::textTrackAddCues(TextTrack*, const TextTrackCueList* cues) { + beginIgnoringTrackDisplayUpdateRequests(); for (size_t i = 0; i < cues->length(); ++i) textTrackAddCue(cues->item(i)->track(), cues->item(i)); + endIgnoringTrackDisplayUpdateRequests(); + updateActiveTextTrackCues(currentTime()); } void HTMLMediaElement::textTrackRemoveCues(TextTrack*, const TextTrackCueList* cues) { + beginIgnoringTrackDisplayUpdateRequests(); for (size_t i = 0; i < cues->length(); ++i) textTrackRemoveCue(cues->item(i)->track(), cues->item(i)); + endIgnoringTrackDisplayUpdateRequests(); + updateActiveTextTrackCues(currentTime()); } void HTMLMediaElement::textTrackAddCue(TextTrack*, PassRefPtr<TextTrackCue> cue) { m_cueTree.add(m_cueTree.createInterval(cue->startTime(), cue->endTime(), cue.get())); + updateActiveTextTrackCues(currentTime()); } void HTMLMediaElement::textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue> cue) { m_cueTree.remove(m_cueTree.createInterval(cue->startTime(), cue->endTime(), cue.get())); + updateActiveTextTrackCues(currentTime()); } #endif @@ -1258,6 +1274,9 @@ void HTMLMediaElement::setNetworkState(MediaPlayer::NetworkState state) if (state == MediaPlayer::Idle) { if (m_networkState > NETWORK_IDLE) { m_progressEventTimer.stop(); + if (hasMediaControls() && m_player->bytesLoaded() != m_previousProgress) + mediaControls()->bufferingProgressed(); + scheduleEvent(eventNames().suspendEvent); setShouldDelayLoadEvent(false); } @@ -1273,6 +1292,8 @@ void HTMLMediaElement::setNetworkState(MediaPlayer::NetworkState state) if (state == MediaPlayer::Loaded) { if (m_networkState != NETWORK_IDLE) { m_progressEventTimer.stop(); + if (hasMediaControls() && m_player->bytesLoaded() != m_previousProgress) + mediaControls()->bufferingProgressed(); // Schedule one last progress event so we guarantee that at least one is fired // for files that load very quickly. @@ -1436,6 +1457,8 @@ void HTMLMediaElement::progressEventTimerFired(Timer<HTMLMediaElement>*) m_sentStalledEvent = false; if (renderer()) renderer()->updateFromElement(); + if (hasMediaControls()) + mediaControls()->bufferingProgressed(); } } @@ -1994,6 +2017,9 @@ void HTMLMediaElement::setLoop(bool b) { LOG(Media, "HTMLMediaElement::setLoop(%s)", boolString(b)); setBooleanAttribute(loopAttr, b); +#if PLATFORM(MAC) + updateDisableSleep(); +#endif } bool HTMLMediaElement::controls() const @@ -2725,10 +2751,7 @@ void HTMLMediaElement::mediaPlayerRateChanged(MediaPlayer*) invalidateCachedTime(); #if PLATFORM(MAC) - if (m_player->paused() && m_sleepDisabler) - m_sleepDisabler = nullptr; - else if (!m_player->paused() && !m_sleepDisabler) - m_sleepDisabler = DisplaySleepDisabler::create("com.apple.WebCore: HTMLMediaElement playback"); + updateDisableSleep(); #endif endProcessingMediaPlayerCallback(); @@ -3484,6 +3507,8 @@ bool HTMLMediaElement::createMediaControls() controls->setMediaController(m_mediaController ? m_mediaController.get() : static_cast<MediaControllerInterface*>(this)); controls->reset(); + if (isFullscreen()) + controls->enteredFullscreen(); ensureShadowRoot()->appendChild(controls, ec); return true; @@ -3722,6 +3747,21 @@ void HTMLMediaElement::applyMediaFragmentURI() } } +#if PLATFORM(MAC) +void HTMLMediaElement::updateDisableSleep() +{ + if (!shouldDisableSleep() && m_sleepDisabler) + m_sleepDisabler = nullptr; + else if (shouldDisableSleep() && !m_sleepDisabler) + m_sleepDisabler = DisplaySleepDisabler::create("com.apple.WebCore: HTMLMediaElement playback"); +} + +bool HTMLMediaElement::shouldDisableSleep() const +{ + return m_player && !m_player->paused() && hasVideo() && hasAudio() && !loop(); +} +#endif + } #endif diff --git a/Source/WebCore/html/HTMLMediaElement.h b/Source/WebCore/html/HTMLMediaElement.h index 2623a65f0..198b9b210 100644 --- a/Source/WebCore/html/HTMLMediaElement.h +++ b/Source/WebCore/html/HTMLMediaElement.h @@ -400,6 +400,10 @@ private: bool userIsInterestedInThisLanguage(const String&) const; bool userIsInterestedInThisTrack(HTMLTrackElement*) const; HTMLTrackElement* showingTrackWithSameKind(HTMLTrackElement*) const; + + bool ignoreTrackDisplayUpdateRequests() const { return m_ignoreTrackDisplayUpdate > 0; } + void beginIgnoringTrackDisplayUpdateRequests() { ++m_ignoreTrackDisplayUpdate; } + void endIgnoringTrackDisplayUpdateRequests() { ASSERT(m_ignoreTrackDisplayUpdate); --m_ignoreTrackDisplayUpdate; } #endif // These "internal" functions do not check user gesture restrictions. @@ -457,6 +461,11 @@ private: bool isLiveStream() const { return movieLoadType() == MediaPlayer::LiveStream; } bool isAutoplaying() const { return m_autoplaying; } +#if PLATFORM(MAC) + void updateDisableSleep(); + bool shouldDisableSleep() const; +#endif + Timer<HTMLMediaElement> m_loadTimer; Timer<HTMLMediaElement> m_asyncEventTimer; Timer<HTMLMediaElement> m_progressEventTimer; @@ -566,6 +575,7 @@ private: Vector<RefPtr<TextTrack> > m_textTracksWhenResourceSelectionBegan; CueIntervalTree m_cueTree; CueList m_currentlyActiveCues; + int m_ignoreTrackDisplayUpdate; #endif #if ENABLE(WEB_AUDIO) @@ -599,7 +609,7 @@ template <> struct ValueToString<TextTrackCue*> { static String string(TextTrackCue* const& cue) { - return String::format("%p id=%s interval=%f-->%f cue=%s)", cue, cue->id().utf8().data(), cue->startTime(), cue->endTime(), cue->getCueAsSource().utf8().data()); + return String::format("%p id=%s interval=%f-->%f cue=%s)", cue, cue->id().utf8().data(), cue->startTime(), cue->endTime(), cue->text().utf8().data()); } }; #endif diff --git a/Source/WebCore/html/HTMLNameCollection.cpp b/Source/WebCore/html/HTMLNameCollection.cpp index ad73d3201..aaf5b4d02 100644 --- a/Source/WebCore/html/HTMLNameCollection.cpp +++ b/Source/WebCore/html/HTMLNameCollection.cpp @@ -40,9 +40,6 @@ HTMLNameCollection::HTMLNameCollection(Document* document, CollectionType type, Element* HTMLNameCollection::itemAfter(Element* previous) const { - if (!base()) - return 0; - ASSERT(previous != base()); Node* current; diff --git a/Source/WebCore/html/HTMLNameCollection.h b/Source/WebCore/html/HTMLNameCollection.h index c4087cbd4..f844657f3 100644 --- a/Source/WebCore/html/HTMLNameCollection.h +++ b/Source/WebCore/html/HTMLNameCollection.h @@ -33,9 +33,9 @@ class Document; class HTMLNameCollection : public HTMLCollection { public: - static PassRefPtr<HTMLNameCollection> create(Document* document, CollectionType type, const AtomicString& name) + static PassOwnPtr<HTMLNameCollection> create(Document* document, CollectionType type, const AtomicString& name) { - return adoptRef(new HTMLNameCollection(document, type, name)); + return adoptPtr(new HTMLNameCollection(document, type, name)); } private: diff --git a/Source/WebCore/html/HTMLObjectElement.cpp b/Source/WebCore/html/HTMLObjectElement.cpp index e9bc36c24..3f9f77fb2 100644 --- a/Source/WebCore/html/HTMLObjectElement.cpp +++ b/Source/WebCore/html/HTMLObjectElement.cpp @@ -55,21 +55,15 @@ using namespace HTMLNames; inline HTMLObjectElement::HTMLObjectElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form, bool createdByParser) : HTMLPlugInImageElement(tagName, document, createdByParser, ShouldNotPreferPlugInsForImages) - , FormAssociatedElement(form) , m_docNamedItem(true) , m_useFallbackContent(false) { ASSERT(hasTagName(objectTag)); - if (!this->form()) - setForm(findFormAncestor()); - if (this->form()) - this->form()->registerFormElement(this); + setForm(form ? form : findFormAncestor()); } inline HTMLObjectElement::~HTMLObjectElement() { - if (form()) - form()->removeFormElement(this); } PassRefPtr<HTMLObjectElement> HTMLObjectElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form, bool createdByParser) diff --git a/Source/WebCore/html/HTMLOptionsCollection.cpp b/Source/WebCore/html/HTMLOptionsCollection.cpp index 3abb35300..ca8a1b07d 100644 --- a/Source/WebCore/html/HTMLOptionsCollection.cpp +++ b/Source/WebCore/html/HTMLOptionsCollection.cpp @@ -32,9 +32,9 @@ HTMLOptionsCollection::HTMLOptionsCollection(HTMLSelectElement* select) { } -PassRefPtr<HTMLOptionsCollection> HTMLOptionsCollection::create(HTMLSelectElement* select) +PassOwnPtr<HTMLOptionsCollection> HTMLOptionsCollection::create(HTMLSelectElement* select) { - return adoptRef(new HTMLOptionsCollection(select)); + return adoptPtr(new HTMLOptionsCollection(select)); } void HTMLOptionsCollection::add(PassRefPtr<HTMLOptionElement> element, ExceptionCode &ec) @@ -59,9 +59,6 @@ void HTMLOptionsCollection::add(PassRefPtr<HTMLOptionElement> element, int index ec = 0; HTMLSelectElement* select = toHTMLSelectElement(base()); - if (!select) - return; - if (index == -1 || unsigned(index) >= length()) select->add(newOption, 0, ec); else @@ -72,29 +69,21 @@ void HTMLOptionsCollection::add(PassRefPtr<HTMLOptionElement> element, int index void HTMLOptionsCollection::remove(int index) { - if (!base()) - return; toHTMLSelectElement(base())->remove(index); } int HTMLOptionsCollection::selectedIndex() const { - if (!base()) - return -1; return toHTMLSelectElement(base())->selectedIndex(); } void HTMLOptionsCollection::setSelectedIndex(int index) { - if (!base()) - return; toHTMLSelectElement(base())->setSelectedIndex(index); } void HTMLOptionsCollection::setLength(unsigned length, ExceptionCode& ec) { - if (!base()) - return; toHTMLSelectElement(base())->setLength(length, ec); } diff --git a/Source/WebCore/html/HTMLOptionsCollection.h b/Source/WebCore/html/HTMLOptionsCollection.h index 333334b5d..bc9bdfa70 100644 --- a/Source/WebCore/html/HTMLOptionsCollection.h +++ b/Source/WebCore/html/HTMLOptionsCollection.h @@ -35,7 +35,7 @@ typedef int ExceptionCode; class HTMLOptionsCollection : public HTMLCollection { public: - static PassRefPtr<HTMLOptionsCollection> create(HTMLSelectElement*); + static PassOwnPtr<HTMLOptionsCollection> create(HTMLSelectElement*); void add(PassRefPtr<HTMLOptionElement>, ExceptionCode&); void add(PassRefPtr<HTMLOptionElement>, int index, ExceptionCode&); diff --git a/Source/WebCore/html/HTMLPropertiesCollection.cpp b/Source/WebCore/html/HTMLPropertiesCollection.cpp index 439bae68c..86fcecfae 100644 --- a/Source/WebCore/html/HTMLPropertiesCollection.cpp +++ b/Source/WebCore/html/HTMLPropertiesCollection.cpp @@ -49,9 +49,9 @@ static inline bool compareTreeOrder(Node* node1, Node* node2) return (node2->compareDocumentPosition(node1) & (Node::DOCUMENT_POSITION_PRECEDING | Node::DOCUMENT_POSITION_DISCONNECTED)) == Node::DOCUMENT_POSITION_PRECEDING; } -PassRefPtr<HTMLPropertiesCollection> HTMLPropertiesCollection::create(PassRefPtr<Node> itemNode) +PassOwnPtr<HTMLPropertiesCollection> HTMLPropertiesCollection::create(PassRefPtr<Node> itemNode) { - return adoptRef(new HTMLPropertiesCollection(itemNode)); + return adoptPtr(new HTMLPropertiesCollection(itemNode)); } HTMLPropertiesCollection::HTMLPropertiesCollection(PassRefPtr<Node> itemNode) @@ -123,9 +123,6 @@ void HTMLPropertiesCollection::findPropetiesOfAnItem(Node* root) const unsigned HTMLPropertiesCollection::length() const { - if (!base()) - return 0; - if (!base()->isHTMLElement() || !toHTMLElement(base())->fastHasAttribute(itemscopeAttr)) return 0; @@ -136,9 +133,6 @@ unsigned HTMLPropertiesCollection::length() const Node* HTMLPropertiesCollection::item(unsigned index) const { - if (!base()) - return 0; - if (!base()->isHTMLElement() || !toHTMLElement(base())->fastHasAttribute(itemscopeAttr)) return 0; @@ -157,9 +151,6 @@ PassRefPtr<DOMStringList> HTMLPropertiesCollection::names() const m_properties.clear(); m_propertyNames->clear(); - if (!base()) - return 0; - if (!base()->isHTMLElement() || !toHTMLElement(base())->fastHasAttribute(itemscopeAttr)) return m_propertyNames; diff --git a/Source/WebCore/html/HTMLPropertiesCollection.h b/Source/WebCore/html/HTMLPropertiesCollection.h index ca822f160..e7524f983 100644 --- a/Source/WebCore/html/HTMLPropertiesCollection.h +++ b/Source/WebCore/html/HTMLPropertiesCollection.h @@ -41,7 +41,7 @@ class DOMStringList; class HTMLPropertiesCollection : public HTMLCollection { public: - static PassRefPtr<HTMLPropertiesCollection> create(PassRefPtr<Node>); + static PassOwnPtr<HTMLPropertiesCollection> create(PassRefPtr<Node>); virtual ~HTMLPropertiesCollection(); unsigned length() const OVERRIDE; diff --git a/Source/WebCore/html/HTMLSelectElement.cpp b/Source/WebCore/html/HTMLSelectElement.cpp index 95421f30b..bfebf8e64 100644 --- a/Source/WebCore/html/HTMLSelectElement.cpp +++ b/Source/WebCore/html/HTMLSelectElement.cpp @@ -92,12 +92,6 @@ HTMLSelectElement::HTMLSelectElement(const QualifiedName& tagName, Document* doc ASSERT(hasTagName(selectTag)); } -HTMLSelectElement::~HTMLSelectElement() -{ - if (m_optionsCollection) - m_optionsCollection->detachFromNode(); -} - PassRefPtr<HTMLSelectElement> HTMLSelectElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form) { ASSERT(tagName.matches(selectTag)); @@ -331,11 +325,11 @@ RenderObject* HTMLSelectElement::createRenderer(RenderArena* arena, RenderStyle* return new (arena) RenderListBox(this); } -PassRefPtr<HTMLOptionsCollection> HTMLSelectElement::options() +HTMLOptionsCollection* HTMLSelectElement::options() { if (!m_optionsCollection) m_optionsCollection = HTMLOptionsCollection::create(this); - return m_optionsCollection; + return m_optionsCollection.get(); } void HTMLSelectElement::updateListItemSelectedStates() diff --git a/Source/WebCore/html/HTMLSelectElement.h b/Source/WebCore/html/HTMLSelectElement.h index 5363cc781..cd0ebb4e4 100644 --- a/Source/WebCore/html/HTMLSelectElement.h +++ b/Source/WebCore/html/HTMLSelectElement.h @@ -28,6 +28,7 @@ #include "Event.h" #include "HTMLFormControlElementWithState.h" +#include "HTMLOptionsCollection.h" #include <wtf/Vector.h> namespace WebCore { @@ -39,8 +40,6 @@ class HTMLSelectElement : public HTMLFormControlElementWithState { public: static PassRefPtr<HTMLSelectElement> create(const QualifiedName&, Document*, HTMLFormElement*); - virtual ~HTMLSelectElement(); - int selectedIndex() const; void setSelectedIndex(int); @@ -63,7 +62,7 @@ public: String value() const; void setValue(const String&); - PassRefPtr<HTMLOptionsCollection> options(); + HTMLOptionsCollection* options(); void optionElementChildrenChanged(); @@ -175,7 +174,7 @@ private: virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); - RefPtr<HTMLOptionsCollection> m_optionsCollection; + OwnPtr<HTMLOptionsCollection> m_optionsCollection; // m_listItems contains HTMLOptionElement, HTMLOptGroupElement, and HTMLHRElement objects. mutable Vector<HTMLElement*> m_listItems; diff --git a/Source/WebCore/html/HTMLTableElement.cpp b/Source/WebCore/html/HTMLTableElement.cpp index b6a4a5a6d..342cff2b3 100644 --- a/Source/WebCore/html/HTMLTableElement.cpp +++ b/Source/WebCore/html/HTMLTableElement.cpp @@ -54,12 +54,6 @@ HTMLTableElement::HTMLTableElement(const QualifiedName& tagName, Document* docum ASSERT(hasTagName(tableTag)); } -HTMLTableElement::~HTMLTableElement() -{ - if (m_rowsCollection) - m_rowsCollection->detachFromNode(); -} - PassRefPtr<HTMLTableElement> HTMLTableElement::create(Document* document) { return adoptRef(new HTMLTableElement(tableTag, document)); @@ -624,14 +618,14 @@ bool HTMLTableElement::isURLAttribute(Attribute *attr) const return attr->name() == backgroundAttr || HTMLElement::isURLAttribute(attr); } -PassRefPtr<HTMLCollection> HTMLTableElement::rows() +HTMLCollection* HTMLTableElement::rows() { if (!m_rowsCollection) m_rowsCollection = HTMLTableRowsCollection::create(this); - return m_rowsCollection; + return m_rowsCollection.get(); } -PassRefPtr<HTMLCollection> HTMLTableElement::tBodies() +HTMLCollection* HTMLTableElement::tBodies() { return ensureCachedHTMLCollection(TableTBodies); } diff --git a/Source/WebCore/html/HTMLTableElement.h b/Source/WebCore/html/HTMLTableElement.h index 63e26056a..deed9518d 100644 --- a/Source/WebCore/html/HTMLTableElement.h +++ b/Source/WebCore/html/HTMLTableElement.h @@ -40,8 +40,6 @@ public: static PassRefPtr<HTMLTableElement> create(Document*); static PassRefPtr<HTMLTableElement> create(const QualifiedName&, Document*); - virtual ~HTMLTableElement(); - HTMLTableCaptionElement* caption() const; void setCaption(PassRefPtr<HTMLTableCaptionElement>, ExceptionCode&); @@ -60,8 +58,8 @@ public: PassRefPtr<HTMLElement> insertRow(int index, ExceptionCode&); void deleteRow(int index, ExceptionCode&); - PassRefPtr<HTMLCollection> rows(); - PassRefPtr<HTMLCollection> tBodies(); + HTMLCollection* rows(); + HTMLCollection* tBodies(); String rules() const; String summary() const; @@ -103,7 +101,7 @@ private: unsigned short m_padding; RefPtr<CSSMappedAttributeDeclaration> m_paddingDecl; - RefPtr<HTMLTableRowsCollection> m_rowsCollection; + OwnPtr<HTMLTableRowsCollection> m_rowsCollection; }; } //namespace diff --git a/Source/WebCore/html/HTMLTableRowElement.cpp b/Source/WebCore/html/HTMLTableRowElement.cpp index 5ec3bce2b..cc5f90767 100644 --- a/Source/WebCore/html/HTMLTableRowElement.cpp +++ b/Source/WebCore/html/HTMLTableRowElement.cpp @@ -120,7 +120,7 @@ int HTMLTableRowElement::sectionRowIndex() const PassRefPtr<HTMLElement> HTMLTableRowElement::insertCell(int index, ExceptionCode& ec) { - RefPtr<HTMLCollection> children = cells(); + HTMLCollection* children = cells(); int numCells = children ? children->length() : 0; if (index < -1 || index > numCells) { ec = INDEX_SIZE_ERR; @@ -143,7 +143,7 @@ PassRefPtr<HTMLElement> HTMLTableRowElement::insertCell(int index, ExceptionCode void HTMLTableRowElement::deleteCell(int index, ExceptionCode& ec) { - RefPtr<HTMLCollection> children = cells(); + HTMLCollection* children = cells(); int numCells = children ? children->length() : 0; if (index == -1) index = numCells-1; @@ -154,7 +154,7 @@ void HTMLTableRowElement::deleteCell(int index, ExceptionCode& ec) ec = INDEX_SIZE_ERR; } -PassRefPtr<HTMLCollection> HTMLTableRowElement::cells() +HTMLCollection* HTMLTableRowElement::cells() { return ensureCachedHTMLCollection(TRCells); } diff --git a/Source/WebCore/html/HTMLTableRowElement.h b/Source/WebCore/html/HTMLTableRowElement.h index c433677ac..cce97c31b 100644 --- a/Source/WebCore/html/HTMLTableRowElement.h +++ b/Source/WebCore/html/HTMLTableRowElement.h @@ -44,7 +44,7 @@ public: PassRefPtr<HTMLElement> insertCell(int index, ExceptionCode&); void deleteCell(int index, ExceptionCode&); - PassRefPtr<HTMLCollection> cells(); + HTMLCollection* cells(); void setCells(HTMLCollection *, ExceptionCode&); private: diff --git a/Source/WebCore/html/HTMLTableRowsCollection.cpp b/Source/WebCore/html/HTMLTableRowsCollection.cpp index 6a8567ca6..df8998ddf 100644 --- a/Source/WebCore/html/HTMLTableRowsCollection.cpp +++ b/Source/WebCore/html/HTMLTableRowsCollection.cpp @@ -156,14 +156,13 @@ HTMLTableRowsCollection::HTMLTableRowsCollection(HTMLTableElement* table) { } -PassRefPtr<HTMLTableRowsCollection> HTMLTableRowsCollection::create(HTMLTableElement* table) +PassOwnPtr<HTMLTableRowsCollection> HTMLTableRowsCollection::create(HTMLTableElement* table) { - return adoptRef(new HTMLTableRowsCollection(table)); + return adoptPtr(new HTMLTableRowsCollection(table)); } Element* HTMLTableRowsCollection::itemAfter(Element* previous) const { - ASSERT(base()); ASSERT(!previous || previous->hasLocalName(trTag)); return rowAfter(static_cast<HTMLTableElement*>(base()), static_cast<HTMLTableRowElement*>(previous)); } diff --git a/Source/WebCore/html/HTMLTableRowsCollection.h b/Source/WebCore/html/HTMLTableRowsCollection.h index 66002d08c..11fb8d199 100644 --- a/Source/WebCore/html/HTMLTableRowsCollection.h +++ b/Source/WebCore/html/HTMLTableRowsCollection.h @@ -38,7 +38,7 @@ class HTMLTableRowElement; class HTMLTableRowsCollection : public HTMLCollection { public: - static PassRefPtr<HTMLTableRowsCollection> create(HTMLTableElement*); + static PassOwnPtr<HTMLTableRowsCollection> create(HTMLTableElement*); static HTMLTableRowElement* rowAfter(HTMLTableElement*, HTMLTableRowElement*); static HTMLTableRowElement* lastRow(HTMLTableElement*); diff --git a/Source/WebCore/html/HTMLTableSectionElement.cpp b/Source/WebCore/html/HTMLTableSectionElement.cpp index 73a8367af..3297ad624 100644 --- a/Source/WebCore/html/HTMLTableSectionElement.cpp +++ b/Source/WebCore/html/HTMLTableSectionElement.cpp @@ -63,7 +63,7 @@ void HTMLTableSectionElement::additionalAttributeStyleDecls(Vector<CSSMutableSty PassRefPtr<HTMLElement> HTMLTableSectionElement::insertRow(int index, ExceptionCode& ec) { RefPtr<HTMLTableRowElement> row; - RefPtr<HTMLCollection> children = rows(); + HTMLCollection* children = rows(); int numRows = children ? (int)children->length() : 0; if (index < -1 || index > numRows) ec = INDEX_SIZE_ERR; // per the DOM @@ -85,7 +85,7 @@ PassRefPtr<HTMLElement> HTMLTableSectionElement::insertRow(int index, ExceptionC void HTMLTableSectionElement::deleteRow(int index, ExceptionCode& ec) { - RefPtr<HTMLCollection> children = rows(); + HTMLCollection* children = rows(); int numRows = children ? (int)children->length() : 0; if (index == -1) index = numRows - 1; @@ -149,7 +149,7 @@ void HTMLTableSectionElement::setVAlign(const String &value) setAttribute(valignAttr, value); } -PassRefPtr<HTMLCollection> HTMLTableSectionElement::rows() +HTMLCollection* HTMLTableSectionElement::rows() { return ensureCachedHTMLCollection(TSectionRows); } diff --git a/Source/WebCore/html/HTMLTableSectionElement.h b/Source/WebCore/html/HTMLTableSectionElement.h index a84cbde6d..295904c4a 100644 --- a/Source/WebCore/html/HTMLTableSectionElement.h +++ b/Source/WebCore/html/HTMLTableSectionElement.h @@ -51,7 +51,7 @@ public: String vAlign() const; void setVAlign(const String&); - PassRefPtr<HTMLCollection> rows(); + HTMLCollection* rows(); private: HTMLTableSectionElement(const QualifiedName& tagName, Document*); diff --git a/Source/WebCore/html/TextTrack.cpp b/Source/WebCore/html/TextTrack.cpp index 164fe3355..bdfbaa205 100644 --- a/Source/WebCore/html/TextTrack.cpp +++ b/Source/WebCore/html/TextTrack.cpp @@ -251,6 +251,25 @@ void TextTrack::fireCueChangeEvent() ExceptionCode ec = 0; dispatchEvent(Event::create(eventNames().cuechangeEvent, false, false), ec); } + +void TextTrack::cueWillChange(TextTrackCue* cue) +{ + if (!m_client) + return; + + // The cue may need to be repositioned in the media element's interval tree, may need to + // be re-rendered, etc, so remove it before the modification... + m_client->textTrackRemoveCue(this, cue); +} + +void TextTrack::cueDidChange(TextTrackCue* cue) +{ + if (!m_client) + return; + + // ... and add it back again. + m_client->textTrackAddCue(this, cue); +} } // namespace WebCore diff --git a/Source/WebCore/html/TextTrack.h b/Source/WebCore/html/TextTrack.h index 9d69d5976..f6ecec848 100644 --- a/Source/WebCore/html/TextTrack.h +++ b/Source/WebCore/html/TextTrack.h @@ -98,6 +98,9 @@ public: void addCue(PassRefPtr<TextTrackCue>, ExceptionCode&); void removeCue(TextTrackCue*, ExceptionCode&); + + void cueWillChange(TextTrackCue*); + void cueDidChange(TextTrackCue*); virtual void fireCueChangeEvent(); DEFINE_ATTRIBUTE_EVENT_LISTENER(cuechange); diff --git a/Source/WebCore/html/TextTrackCue.cpp b/Source/WebCore/html/TextTrackCue.cpp index 55519e5bd..e1c01266e 100644 --- a/Source/WebCore/html/TextTrackCue.cpp +++ b/Source/WebCore/html/TextTrackCue.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -42,6 +43,41 @@ namespace WebCore { +static const AtomicString& startKeyword() +{ + DEFINE_STATIC_LOCAL(const AtomicString, start, ("start")); + return start; +} + +static const AtomicString& middleKeyword() +{ + DEFINE_STATIC_LOCAL(const AtomicString, middle, ("middle")); + return middle; +} + +static const AtomicString& endKeyword() +{ + DEFINE_STATIC_LOCAL(const AtomicString, end, ("end")); + return end; +} + +static const AtomicString& horizontalKeyword() +{ + DEFINE_STATIC_LOCAL(const AtomicString, horizontal, ("horizontal")); + return horizontal; +} + +static const AtomicString& verticalKeyword() +{ + DEFINE_STATIC_LOCAL(const AtomicString, vertical, ("vertical")); + return vertical; +} +static const AtomicString& verticallrKeyword() +{ + DEFINE_STATIC_LOCAL(const AtomicString, verticallr, ("vertical-lr")); + return verticallr; +} + TextTrackCue::TextTrackCue(ScriptExecutionContext* context, const String& id, double start, double end, const String& content, const String& settings, bool pauseOnExit) : m_id(id) , m_startTime(start) @@ -64,6 +100,18 @@ TextTrackCue::~TextTrackCue() { } +void TextTrackCue::cueWillChange() +{ + if (m_track) + m_track->cueWillChange(this); +} + +void TextTrackCue::cueDidChange() +{ + if (m_track) + m_track->cueDidChange(this); +} + TextTrack* TextTrackCue::track() const { return m_track.get(); @@ -74,61 +122,213 @@ void TextTrackCue::setTrack(PassRefPtr<TextTrack>track) m_track = track; } -String TextTrackCue::id() const +void TextTrackCue::setId(const String& id) { - return m_id; + if (m_id == id) + return; + + cueWillChange(); + m_id = id; + cueDidChange(); } -double TextTrackCue::startTime() const +void TextTrackCue::setStartTime(double value) { - return m_startTime; + if (m_startTime == value) + return; + + cueWillChange(); + m_startTime = value; + cueDidChange(); } - -double TextTrackCue::endTime() const + +void TextTrackCue::setEndTime(double value) { - return m_endTime; + if (m_endTime == value) + return; + + cueWillChange(); + m_endTime = value; + cueDidChange(); } - -bool TextTrackCue::pauseOnExit() const + +void TextTrackCue::setPauseOnExit(bool value) { - return m_pauseOnExit; + if (m_pauseOnExit == value) + return; + + cueWillChange(); + m_pauseOnExit = value; + cueDidChange(); } -String TextTrackCue::direction() const +const String& TextTrackCue::direction() const { switch (m_writingDirection) { case Horizontal: - return "horizontal"; + return horizontalKeyword(); case VerticalGrowingLeft: - return "vertical"; + return verticalKeyword(); case VerticalGrowingRight: - return "vertical-lr"; + return verticallrKeyword(); default: - return ""; + ASSERT_NOT_REACHED(); + return emptyString(); + } +} + +void TextTrackCue::setDirection(const String& value, ExceptionCode& ec) +{ + // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-direction + // On setting, the text track cue writing direction must be set to the value given + // in the first cell of the row in the table above whose second cell is a + // case-sensitive match for the new value, if any. If none of the values match, then + // the user agent must instead throw a SyntaxError exception. + + Direction direction = m_writingDirection; + if (value == horizontalKeyword()) + direction = Horizontal; + else if (value == verticalKeyword()) + direction = VerticalGrowingLeft; + else if (value == verticallrKeyword()) + direction = VerticalGrowingRight; + else + ec = SYNTAX_ERR; + + if (direction == m_writingDirection) + return; + + cueWillChange(); + m_writingDirection = direction; + cueDidChange(); +} + +void TextTrackCue::setSnapToLines(bool value) +{ + if (m_snapToLines == value) + return; + + cueWillChange(); + m_snapToLines = value; + cueDidChange(); +} + +void TextTrackCue::setLinePosition(int position, ExceptionCode& ec) +{ + // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-lineposition + // On setting, if the text track cue snap-to-lines flag is not set, and the new + // value is negative or greater than 100, then throw an IndexSizeError exception. + if (!m_snapToLines && (position < 0 || position > 100)) { + ec = INDEX_SIZE_ERR; + return; } + + // Otherwise, set the text track cue line position to the new value. + if (m_linePosition == position) + return; + + cueWillChange(); + m_linePosition = position; + cueDidChange(); } -String TextTrackCue::alignment() const +void TextTrackCue::setTextPosition(int position, ExceptionCode& ec) +{ + // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-lineposition + // On setting, if the new value is negative or greater than 100, then throw an IndexSizeError exception. + // Otherwise, set the text track cue text position to the new value. + if (position < 0 || position > 100) { + ec = INDEX_SIZE_ERR; + return; + } + + // Otherwise, set the text track cue line position to the new value. + if (m_textPosition == position) + return; + + cueWillChange(); + m_textPosition = position; + cueDidChange(); +} + +void TextTrackCue::setSize(int size, ExceptionCode& ec) +{ + // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-size + // On setting, if the new value is negative or greater than 100, then throw an IndexSizeError + // exception. Otherwise, set the text track cue size to the new value. + if (size < 0 || size > 100) { + ec = INDEX_SIZE_ERR; + return; + } + + // Otherwise, set the text track cue line position to the new value. + if (m_cueSize == size) + return; + + cueWillChange(); + m_cueSize = size; + cueDidChange(); +} + +const String& TextTrackCue::alignment() const { switch (m_cueAlignment) { - case Start: - return "start"; + case Start: + return startKeyword(); case Middle: - return "middle"; + return middleKeyword(); case End: - return "end"; + return endKeyword(); default: - return ""; + ASSERT_NOT_REACHED(); + return emptyString(); } } -String TextTrackCue::getCueAsSource() +void TextTrackCue::setAlignment(const String& value, ExceptionCode& ec) +{ + // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-alignment + // On setting, the text track cue alignment must be set to the value given in the + // first cell of the row in the table above whose second cell is a case-sensitive + // match for the new value, if any. If none of the values match, then the user + // agent must instead throw a SyntaxError exception. + + Alignment alignment = m_cueAlignment; + if (value == startKeyword()) + alignment = Start; + else if (value == middleKeyword()) + alignment = Middle; + else if (value == endKeyword()) + alignment = End; + else + ec = SYNTAX_ERR; + + if (alignment == m_cueAlignment) + return; + + cueWillChange(); + m_cueAlignment = alignment; + cueDidChange(); +} + +void TextTrackCue::setText(const String& text) { - return m_content; + if (m_content == text) + return; + + cueWillChange(); + // Clear the document fragment but don't bother to create it again just yet as we can do that + // when it is requested. + m_documentFragment = 0; + m_content = text; + cueDidChange(); } PassRefPtr<DocumentFragment> TextTrackCue::getCueAsHTML() { + if (!m_documentFragment) + m_documentFragment = WebVTTParser::create(0, m_scriptExecutionContext)->createDocumentFragmentFromCueText(m_content); + return m_documentFragment; } @@ -187,9 +387,9 @@ void TextTrackCue::parseSettings(const String& input) { // 1-3 - Collect the next word and set the writing direction accordingly. String writingDirection = WebVTTParser::collectWord(input, &position); - if (writingDirection == "vertical") + if (writingDirection == verticalKeyword()) m_writingDirection = VerticalGrowingLeft; - else if (writingDirection == "vertical-lr") + else if (writingDirection == verticallrKeyword()) m_writingDirection = VerticalGrowingRight; } break; @@ -297,11 +497,11 @@ void TextTrackCue::parseSettings(const String& input) { // 1-4 - Collect the next word and set the cue alignment accordingly. String cueAlignment = WebVTTParser::collectWord(input, &position); - if (cueAlignment == "start") + if (cueAlignment == startKeyword()) m_cueAlignment = Start; - else if (cueAlignment == "middle") + else if (cueAlignment == middleKeyword()) m_cueAlignment = Middle; - else if (cueAlignment == "end") + else if (cueAlignment == endKeyword()) m_cueAlignment = End; } break; diff --git a/Source/WebCore/html/TextTrackCue.h b/Source/WebCore/html/TextTrackCue.h index 9480afa0a..16faf63ca 100644 --- a/Source/WebCore/html/TextTrackCue.h +++ b/Source/WebCore/html/TextTrackCue.h @@ -59,19 +59,39 @@ public: TextTrack* track() const; void setTrack(PassRefPtr<TextTrack>); - String id() const; - double startTime() const; - double endTime() const; - bool pauseOnExit() const; - - String direction() const; + const String& id() const { return m_id; } + void setId(const String&); + + double startTime() const { return m_startTime; } + void setStartTime(double); + + double endTime() const { return m_endTime; } + void setEndTime(double); + + bool pauseOnExit() const { return m_pauseOnExit; } + void setPauseOnExit(bool); + + const String& direction() const; + void setDirection(const String&, ExceptionCode&); + bool snapToLines() const { return m_snapToLines; } + void setSnapToLines(bool); + int linePosition() const { return m_linePosition; } + void setLinePosition(int, ExceptionCode&); + int textPosition() const { return m_textPosition; } + void setTextPosition(int, ExceptionCode&); + int size() const { return m_cueSize; } - String alignment() const; + void setSize(int, ExceptionCode&); + + const String& alignment() const; + void setAlignment(const String&, ExceptionCode&); + + const String& text() const { return m_content; } + void setText(const String&); - String getCueAsSource(); PassRefPtr<DocumentFragment> getCueAsHTML(); void setCueHTML(PassRefPtr<DocumentFragment>); @@ -96,6 +116,8 @@ private: TextTrackCue(ScriptExecutionContext*, const String& id, double start, double end, const String& content, const String& settings, bool pauseOnExit); void parseSettings(const String&); + void cueWillChange(); + void cueDidChange(); virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } diff --git a/Source/WebCore/html/TextTrackCue.idl b/Source/WebCore/html/TextTrackCue.idl index 8f43aba2b..913a9bd44 100644 --- a/Source/WebCore/html/TextTrackCue.idl +++ b/Source/WebCore/html/TextTrackCue.idl @@ -36,20 +36,25 @@ module html { CustomIsReachable ] TextTrackCue { readonly attribute TextTrack track; - readonly attribute DOMString id; - readonly attribute double startTime; - readonly attribute double endTime; - readonly attribute boolean pauseOnExit; + attribute DOMString id; + attribute double startTime; + attribute double endTime; + attribute boolean pauseOnExit; - readonly attribute DOMString direction; - readonly attribute boolean snapToLines; - readonly attribute long linePosition; - readonly attribute long textPosition; - readonly attribute long size; - readonly attribute DOMString alignment; + attribute DOMString direction + setter raises (DOMException); + attribute boolean snapToLines; + attribute long linePosition + setter raises (DOMException); + attribute long textPosition + setter raises (DOMException); + attribute long size + setter raises (DOMException); + attribute DOMString alignment + setter raises (DOMException); - DOMString getCueAsSource(); + attribute DOMString text; DocumentFragment getCueAsHTML(); attribute EventListener onenter; diff --git a/Source/WebCore/html/canvas/WebGLContextEvent.cpp b/Source/WebCore/html/canvas/WebGLContextEvent.cpp index 3351a4b08..ad2dd717d 100644 --- a/Source/WebCore/html/canvas/WebGLContextEvent.cpp +++ b/Source/WebCore/html/canvas/WebGLContextEvent.cpp @@ -28,6 +28,8 @@ #include "EventNames.h" +#if ENABLE(WEBGL) + namespace WebCore { WebGLContextEventInit::WebGLContextEventInit() @@ -60,3 +62,5 @@ const AtomicString& WebGLContextEvent::interfaceName() const } } // namespace WebCore + +#endif // ENABLE(WEBGL) diff --git a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp b/Source/WebCore/html/canvas/WebGLRenderingContext.cpp index a7b9cf648..d17741fb3 100644 --- a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp +++ b/Source/WebCore/html/canvas/WebGLRenderingContext.cpp @@ -5037,7 +5037,8 @@ void WebGLRenderingContext::maybeRestoreContext(Timer<WebGLRenderingContext>*) // Construct a new drawing buffer with the new GraphicsContext3D. if (m_drawingBuffer) { m_drawingBuffer->discardResources(); - m_drawingBuffer = DrawingBuffer::create(m_context.get(), m_drawingBuffer->size(), !m_attributes.preserveDrawingBuffer); + m_drawingBuffer = DrawingBuffer::create(context.get(), m_drawingBuffer->size(), !m_attributes.preserveDrawingBuffer); + m_drawingBuffer->bind(); } m_context = context; diff --git a/Source/WebCore/html/parser/XSSAuditor.cpp b/Source/WebCore/html/parser/XSSAuditor.cpp index c48e73e8c..138a67118 100644 --- a/Source/WebCore/html/parser/XSSAuditor.cpp +++ b/Source/WebCore/html/parser/XSSAuditor.cpp @@ -411,6 +411,7 @@ bool XSSAuditor::filterEmbedToken(HTMLToken& token) bool didBlockScript = false; + didBlockScript |= eraseAttributeIfInjected(token, codeAttr, String(), SrcLikeAttribute); didBlockScript |= eraseAttributeIfInjected(token, srcAttr, blankURL().string(), SrcLikeAttribute); didBlockScript |= eraseAttributeIfInjected(token, typeAttr); diff --git a/Source/WebCore/html/shadow/MediaControlElements.cpp b/Source/WebCore/html/shadow/MediaControlElements.cpp index e4faae203..d88b87f03 100644 --- a/Source/WebCore/html/shadow/MediaControlElements.cpp +++ b/Source/WebCore/html/shadow/MediaControlElements.cpp @@ -34,6 +34,7 @@ #include "CSSStyleSelector.h" #include "CSSValueKeywords.h" +#include "DOMTokenList.h" #include "EventNames.h" #include "FloatConversion.h" #include "Frame.h" @@ -185,6 +186,9 @@ void MediaControlPanelElement::setPosition(const LayoutPoint& position) style->setProperty(CSSPropertyTop, top, CSSPrimitiveValue::CSS_PX); style->setProperty(CSSPropertyMarginLeft, 0.0, CSSPrimitiveValue::CSS_PX); style->setProperty(CSSPropertyMarginTop, 0.0, CSSPrimitiveValue::CSS_PX); + + ExceptionCode ignored; + classList()->add("dragged", ignored); } void MediaControlPanelElement::resetPosition() @@ -195,6 +199,9 @@ void MediaControlPanelElement::resetPosition() style->removeProperty(CSSPropertyTop); style->removeProperty(CSSPropertyMarginLeft); style->removeProperty(CSSPropertyMarginTop); + + ExceptionCode ignored; + classList()->remove("dragged", ignored); } void MediaControlPanelElement::makeOpaque() @@ -229,12 +236,12 @@ void MediaControlPanelElement::defaultEventHandler(Event* event) if (event->isMouseEvent()) { LayoutPoint location = static_cast<MouseEvent*>(event)->absoluteLocation(); - if (event->type() == eventNames().mousedownEvent) { + if (event->type() == eventNames().mousedownEvent && event->target() == this) { startDrag(location); event->setDefaultHandled(); - } else if (event->type() == eventNames().mousemoveEvent) + } else if (event->type() == eventNames().mousemoveEvent && m_isBeingDragged) continueDrag(location); - else if (event->type() == eventNames().mouseupEvent) { + else if (event->type() == eventNames().mouseupEvent && m_isBeingDragged) { continueDrag(location); endDrag(); event->setDefaultHandled(); diff --git a/Source/WebCore/html/shadow/MediaControlRootElement.cpp b/Source/WebCore/html/shadow/MediaControlRootElement.cpp index 47f88bc82..a358bd0b7 100644 --- a/Source/WebCore/html/shadow/MediaControlRootElement.cpp +++ b/Source/WebCore/html/shadow/MediaControlRootElement.cpp @@ -642,7 +642,7 @@ void MediaControlRootElement::updateTextTrackDisplay() if (!cue->track() || cue->track()->mode() != TextTrack::SHOWING) continue; - String cueText = cue->getCueAsSource(); + String cueText = cue->text(); if (!cueText.isEmpty()) { if (!nothingToDisplay) m_textTrackDisplay->appendChild(document()->createElement(HTMLNames::brTag, false), ASSERT_NO_EXCEPTION); @@ -664,6 +664,14 @@ const AtomicString& MediaControlRootElement::shadowPseudoId() const return id; } +void MediaControlRootElement::bufferingProgressed() +{ + // We only need to update buffering progress when paused, during normal + // playback playbackProgressed() will take care of it. + if (m_mediaController->paused()) + m_timeline->setPosition(m_mediaController->currentTime()); +} + } #endif diff --git a/Source/WebCore/html/shadow/MediaControlRootElement.h b/Source/WebCore/html/shadow/MediaControlRootElement.h index 7010d02d4..106750968 100644 --- a/Source/WebCore/html/shadow/MediaControlRootElement.h +++ b/Source/WebCore/html/shadow/MediaControlRootElement.h @@ -112,6 +112,8 @@ public: virtual bool shouldHideControls(); + void bufferingProgressed(); + private: MediaControlRootElement(Document*); diff --git a/Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp b/Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp index dea66fbfe..e69d818d3 100644 --- a/Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp +++ b/Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp @@ -376,7 +376,7 @@ void MediaControlRootElementChromium::updateTextTrackDisplay() if (!cue->track() || cue->track()->mode() != TextTrack::SHOWING) continue; - String cueText = cue->getCueAsSource(); + String cueText = cue->text(); if (!cueText.isEmpty()) { if (!nothingToDisplay) m_textTrackDisplay->appendChild(document()->createElement(HTMLNames::brTag, false), ASSERT_NO_EXCEPTION); @@ -398,6 +398,14 @@ const AtomicString& MediaControlRootElementChromium::shadowPseudoId() const return id; } +void MediaControlRootElementChromium::bufferingProgressed() +{ + // We only need to update buffering progress when paused, during normal + // playback playbackProgressed() will take care of it. + if (m_mediaController->paused()) + m_timeline->setPosition(m_mediaController->currentTime()); +} + } #endif diff --git a/Source/WebCore/html/shadow/MediaControlRootElementChromium.h b/Source/WebCore/html/shadow/MediaControlRootElementChromium.h index d895c3bc3..366186b65 100644 --- a/Source/WebCore/html/shadow/MediaControlRootElementChromium.h +++ b/Source/WebCore/html/shadow/MediaControlRootElementChromium.h @@ -99,6 +99,8 @@ public: void updateTextTrackDisplay(); #endif + void bufferingProgressed(); + virtual bool shouldHideControls(); private: diff --git a/Source/WebCore/html/shadow/MediaControls.h b/Source/WebCore/html/shadow/MediaControls.h index a61e34e11..28908a9a1 100644 --- a/Source/WebCore/html/shadow/MediaControls.h +++ b/Source/WebCore/html/shadow/MediaControls.h @@ -78,6 +78,8 @@ class MediaControls : public HTMLDivElement { virtual void updateTextTrackDisplay() = 0; #endif + virtual void bufferingProgressed() = 0; + protected: MediaControls(Document*); diff --git a/Source/WebCore/html/track/WebVTTParser.cpp b/Source/WebCore/html/track/WebVTTParser.cpp index 9d619527c..114978f82 100644 --- a/Source/WebCore/html/track/WebVTTParser.cpp +++ b/Source/WebCore/html/track/WebVTTParser.cpp @@ -222,7 +222,7 @@ WebVTTParser::ParseState WebVTTParser::collectTimingsAndSettings(const String& l WebVTTParser::ParseState WebVTTParser::collectCueText(const String& line, unsigned length, unsigned position) { if (line.isEmpty()) { - processCueText(); + createNewCue(); return Id; } if (!m_currentContent.isEmpty()) @@ -230,7 +230,7 @@ WebVTTParser::ParseState WebVTTParser::collectCueText(const String& line, unsign m_currentContent.append(line); if (position >= length) - processCueText(); + createNewCue(); return CueText; } @@ -242,30 +242,42 @@ WebVTTParser::ParseState WebVTTParser::ignoreBadCue(const String& line) return Id; } -void WebVTTParser::processCueText() +PassRefPtr<DocumentFragment> WebVTTParser::createDocumentFragmentFromCueText(const String& text) { - // 51 - Cue text processing based on + // Cue text processing based on // 4.8.10.13.4 WebVTT cue text parsing rules and // 4.8.10.13.5 WebVTT cue text DOM construction rules. - if (m_currentContent.length() <= 0) - return; + + if (!text.length()) + return 0; ASSERT(m_scriptExecutionContext->isDocument()); Document* document = static_cast<Document*>(m_scriptExecutionContext); - - m_attachmentRoot = DocumentFragment::create(document); - m_currentNode = m_attachmentRoot; + + RefPtr<DocumentFragment> fragment = DocumentFragment::create(document); + m_currentNode = fragment; m_tokenizer->reset(); m_token.clear(); - - SegmentedString content(m_currentContent.toString()); + + SegmentedString content(text); while (m_tokenizer->nextToken(content, m_token)) constructTreeFromToken(document); + return fragment.release(); +} + +void WebVTTParser::createNewCue() +{ + if (!m_currentContent.length()) + return; + + RefPtr<DocumentFragment> attachmentRoot = createDocumentFragmentFromCueText(m_currentContent.toString()); + RefPtr<TextTrackCue> cue = TextTrackCue::create(m_scriptExecutionContext, m_currentId, m_currentStartTime, m_currentEndTime, m_currentContent.toString(), m_currentSettings, false); - cue->setCueHTML(m_attachmentRoot); + cue->setCueHTML(attachmentRoot); m_cuelist.append(cue); - m_client->newCuesParsed(); + if (m_client) + m_client->newCuesParsed(); } void WebVTTParser::resetCueValues() @@ -342,6 +354,8 @@ void WebVTTParser::constructTreeFromToken(Document* document) AtomicString tokenTagName(m_token.name().data(), m_token.name().size()); QualifiedName tagName(nullAtom, tokenTagName, xhtmlNamespaceURI); + // http://dev.w3.org/html5/webvtt/#webvtt-cue-text-dom-construction-rules + switch (m_token.type()) { case WebVTTTokenTypes::Character: { String content(m_token.characters().data(), m_token.characters().size()); diff --git a/Source/WebCore/html/track/WebVTTParser.h b/Source/WebCore/html/track/WebVTTParser.h index 244ee8f32..4e1dc0453 100644 --- a/Source/WebCore/html/track/WebVTTParser.h +++ b/Source/WebCore/html/track/WebVTTParser.h @@ -84,10 +84,12 @@ public: static String collectWord(const String&, unsigned*); // Input data to the parser to parse. - virtual void parseBytes(const char* data, unsigned length); + void parseBytes(const char* data, unsigned length); // Transfers ownership of last parsed cues to caller. - virtual void getNewCues(Vector<RefPtr<TextTrackCue> >&); + void getNewCues(Vector<RefPtr<TextTrackCue> >&); + + PassRefPtr<DocumentFragment> createDocumentFragmentFromCueText(const String&); protected: WebVTTParser(WebVTTParserClient*, ScriptExecutionContext*); @@ -101,7 +103,7 @@ private: ParseState collectCueText(const String&, unsigned length, unsigned); ParseState ignoreBadCue(const String&); - void processCueText(); + void createNewCue(); void resetCueValues(); double collectTimeStamp(const String&, unsigned*); void skipWhiteSpace(const String&, unsigned*); @@ -119,7 +121,6 @@ private: WebVTTToken m_token; OwnPtr<WebVTTTokenizer> m_tokenizer; - RefPtr<DocumentFragment> m_attachmentRoot; RefPtr<ContainerNode> m_currentNode; WebVTTParserClient* m_client; diff --git a/Source/WebCore/inspector/DOMEditor.cpp b/Source/WebCore/inspector/DOMEditor.cpp new file mode 100644 index 000000000..6209fdb6d --- /dev/null +++ b/Source/WebCore/inspector/DOMEditor.cpp @@ -0,0 +1,293 @@ +/* + * Copyright (C) 2012 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 "DOMEditor.h" + +#if ENABLE(INSPECTOR) + +#include "Base64.h" +#include "Document.h" +#include "HTMLDocument.h" +#include "HTMLDocumentParser.h" +#include "HTMLElement.h" +#include "HTMLHeadElement.h" +#include "Node.h" + +#include <wtf/RefPtr.h> +#include <wtf/SHA1.h> +#include <wtf/text/CString.h> + +using namespace std; + +namespace WebCore { + +struct DOMEditor::NodeDigest { + NodeDigest(Node* node) : m_node(node) { } + + String m_digest; + String m_attrsDigest; + Node* m_node; + Vector<OwnPtr<NodeDigest> > m_children; +}; + +DOMEditor::DOMEditor(Document* document) : m_document(document) { } + +DOMEditor::~DOMEditor() { } + +void DOMEditor::patch(const String& markup) +{ + RefPtr<HTMLDocument> newDocument = HTMLDocument::create(0, KURL()); + RefPtr<DocumentParser> parser = HTMLDocumentParser::create(newDocument.get(), false); + parser->insert(markup); // Use insert() so that the parser will not yield. + parser->finish(); + parser->detach(); + + if (!patchElement(m_document->head(), newDocument->head()) || !patchElement(m_document->body(), newDocument->body())) { + // Fall back to rewrite. + m_document->write(markup); + m_document->close(); + } +} + +bool DOMEditor::patchElement(Element* oldElement, Element* newElement) +{ + if (oldElement) { + if (newElement) { + OwnPtr<NodeDigest> oldInfo = createNodeDigest(oldElement); + OwnPtr<NodeDigest> newInfo = createNodeDigest(newElement); + return patchNode(oldInfo.get(), newInfo.get()); + } + oldElement->removeAllChildren(); + return true; + } + if (newElement) { + ExceptionCode ec = 0; + m_document->documentElement()->appendChild(newElement, ec); + return !ec; + } + return true; +} + +bool DOMEditor::patchNode(NodeDigest* oldDigest, NodeDigest* newDigest) +{ + if (oldDigest->m_digest == newDigest->m_digest) + return true; + + Node* oldNode = oldDigest->m_node; + Node* newNode = newDigest->m_node; + + if (newNode->nodeType() != oldNode->nodeType() || newNode->nodeName() != oldNode->nodeName()) { + ExceptionCode ec = 0; + oldNode->parentNode()->replaceChild(newNode, oldNode, ec); + if (ec) + return false; + return true; + } + + ExceptionCode ec = 0; + if (oldNode->nodeValue() != newNode->nodeValue()) + oldNode->setNodeValue(newNode->nodeValue(), ec); + if (ec) + return false; + + if (oldNode->nodeType() == Node::ELEMENT_NODE && oldDigest->m_attrsDigest != newDigest->m_attrsDigest) { + Element* oldElement = static_cast<Element*>(oldNode); + Element* newElement = static_cast<Element*>(newNode); + oldElement->setAttributesFromElement(*newElement); + } + if (oldDigest->m_node->nodeType() != Node::ELEMENT_NODE) + return true; + + return patchChildren(static_cast<ContainerNode*>(oldNode), oldDigest->m_children, newDigest->m_children); +} + +bool DOMEditor::patchChildren(ContainerNode* oldParent, Vector<OwnPtr<NodeDigest> >& oldList, Vector<OwnPtr<NodeDigest> >& newList) +{ + // Trim tail. + size_t offset = 0; + for (; offset < oldList.size() && offset < newList.size() && oldList[oldList.size() - offset - 1]->m_digest == newList[newList.size() - offset - 1]->m_digest; ++offset) { } + if (offset > 0) { + oldList.resize(oldList.size() - offset); + newList.resize(newList.size() - offset); + } + + // Trim head. + for (offset = 0; offset < oldList.size() && offset < newList.size() && oldList[offset]->m_digest == newList[offset]->m_digest; ++offset) { } + if (offset > 0) { + oldList.remove(0, offset); + newList.remove(0, offset); + } + + // Diff the children lists. + typedef Vector<pair<NodeDigest*, size_t> > ResultMap; + ResultMap newMap(newList.size()); + ResultMap oldMap(oldList.size()); + + for (size_t i = 0; i < oldMap.size(); ++i) + oldMap[i].first = 0; + for (size_t i = 0; i < newMap.size(); ++i) + newMap[i].first = 0; + + typedef HashMap<String, Vector<size_t> > DiffTable; + DiffTable newTable; + DiffTable oldTable; + + for (size_t i = 0; i < newList.size(); ++i) { + DiffTable::iterator it = newTable.add(newList[i]->m_digest, Vector<size_t>()).first; + it->second.append(i); + } + + for (size_t i = 0; i < oldList.size(); ++i) { + DiffTable::iterator it = oldTable.add(oldList[i]->m_digest, Vector<size_t>()).first; + it->second.append(i); + } + + for (DiffTable::iterator newIt = newTable.begin(); newIt != newTable.end(); ++newIt) { + if (newIt->second.size() != 1) + continue; + + DiffTable::iterator oldIt = oldTable.find(newIt->first); + if (oldIt == oldTable.end() || oldIt->second.size() != 1) + continue; + make_pair(newList[newIt->second[0]].get(), oldIt->second[0]); + newMap[newIt->second[0]] = make_pair(newList[newIt->second[0]].get(), oldIt->second[0]); + oldMap[oldIt->second[0]] = make_pair(oldList[oldIt->second[0]].get(), newIt->second[0]); + } + + for (size_t i = 0; newList.size() > 0 && i < newList.size() - 1; ++i) { + if (!newMap[i].first || newMap[i + 1].first) + continue; + + size_t j = newMap[i].second + 1; + if (j < oldMap.size() && !oldMap[j].first && newList[i + 1]->m_digest == oldList[j]->m_digest) { + newMap[i + 1] = make_pair(newList[i + 1].get(), j); + oldMap[j] = make_pair(oldList[j].get(), i + 1); + } + } + + for (size_t i = newList.size() - 1; newList.size() > 0 && i > 0; --i) { + if (!newMap[i].first || newMap[i - 1].first || newMap[i].second <= 0) + continue; + + size_t j = newMap[i].second - 1; + if (!oldMap[j].first && newList[i - 1]->m_digest == oldList[j]->m_digest) { + newMap[i - 1] = make_pair(newList[i - 1].get(), j); + oldMap[j] = make_pair(oldList[j].get(), i - 1); + } + } + + HashSet<NodeDigest*> merges; + for (size_t i = 0; i < oldList.size(); ++i) { + if (oldMap[i].first) + continue; + + // Check if this change is between stable nodes. If it is, consider it as "modified". + if ((!i || oldMap[i - 1].first) && (i == oldMap.size() - 1 || oldMap[i + 1].first)) { + size_t anchorCandidate = i ? oldMap[i - 1].second + 1 : 0; + size_t anchorAfter = i == oldMap.size() - 1 ? anchorCandidate + 1 : oldMap[i + 1].second; + if (anchorAfter - anchorCandidate == 1 && anchorCandidate < newList.size()) { + if (!patchNode(oldList[i].get(), newList[anchorCandidate].get())) + return false; + + merges.add(newList[anchorCandidate].get()); + } else + oldList[i]->m_node->parentNode()->removeChild(oldList[i]->m_node); + } else { + ContainerNode* parentNode = static_cast<ContainerNode*>(oldList[i]->m_node->parentNode()); + parentNode->removeChild(oldList[i]->m_node); + } + } + + for (size_t i = 0; i < newMap.size(); ++i) { + if (newMap[i].first || merges.contains(newList[i].get())) + continue; + + ExceptionCode ec = 0; + oldParent->insertBefore(newList[i]->m_node, oldParent->childNode(i + offset), ec); + if (ec) + return false; + } + + return true; +} + +static void addStringToSHA1(SHA1& sha1, const String& string) +{ + CString cString = string.utf8(); + sha1.addBytes(reinterpret_cast<const uint8_t*>(cString.data()), cString.length()); +} + +PassOwnPtr<DOMEditor::NodeDigest> DOMEditor::createNodeDigest(Node* node) +{ + NodeDigest* nodeDigest = new NodeDigest(node); + + SHA1 sha1; + + Node::NodeType nodeType = node->nodeType(); + sha1.addBytes(reinterpret_cast<const uint8_t*>(&nodeType), sizeof(nodeType)); + addStringToSHA1(sha1, node->nodeName()); + addStringToSHA1(sha1, node->nodeValue()); + + if (node->nodeType() == Node::ELEMENT_NODE) { + Node* child = node->firstChild(); + while (child) { + OwnPtr<NodeDigest> childInfo = createNodeDigest(child); + addStringToSHA1(sha1, childInfo->m_digest); + child = child->nextSibling(); + nodeDigest->m_children.append(childInfo.release()); + } + + Element* element = static_cast<Element*>(node); + const NamedNodeMap* attrMap = element->attributes(true); + if (attrMap && attrMap->length()) { + unsigned numAttrs = attrMap->length(); + SHA1 attrsSHA1; + for (unsigned i = 0; i < numAttrs; ++i) { + const Attribute* attribute = attrMap->attributeItem(i); + addStringToSHA1(attrsSHA1, attribute->name().toString()); + addStringToSHA1(attrsSHA1, attribute->value()); + } + Vector<uint8_t, 20> attrsHash; + attrsSHA1.computeHash(attrsHash); + nodeDigest->m_attrsDigest = base64Encode(reinterpret_cast<const char*>(attrsHash.data()), 10); + addStringToSHA1(sha1, nodeDigest->m_attrsDigest); + } + } + + Vector<uint8_t, 20> hash; + sha1.computeHash(hash); + nodeDigest->m_digest = base64Encode(reinterpret_cast<const char*>(hash.data()), 10); + return adoptPtr(nodeDigest); +} + +} // namespace WebCore + +#endif // ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/DOMEditor.h b/Source/WebCore/inspector/DOMEditor.h new file mode 100644 index 000000000..657034c48 --- /dev/null +++ b/Source/WebCore/inspector/DOMEditor.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2012 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 DOMEditor_h +#define DOMEditor_h + +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/Vector.h> +#include <wtf/text/WTFString.h> + +namespace WebCore { + +class ContainerNode; +class Document; +class Element; +class Node; + +#if ENABLE(INSPECTOR) + +class DOMEditor { +public: + explicit DOMEditor(Document*); + virtual ~DOMEditor(); + + void patch(const String& markup); + +private: + struct NodeDigest; + + bool patchElement(Element* oldElement, Element* newElement); + bool patchNode(NodeDigest* oldNode, NodeDigest* newNode); + bool patchChildren(ContainerNode* oldParent, Vector<OwnPtr<NodeDigest> >& oldChildren, Vector<OwnPtr<NodeDigest> >& newChildren); + PassOwnPtr<NodeDigest> createNodeDigest(Node*); + + Document* m_document; +}; + +#endif // ENABLE(INSPECTOR) + +} // namespace WebCore + +#endif // !defined(DOMEditor_h) diff --git a/Source/WebCore/inspector/InspectorDOMAgent.cpp b/Source/WebCore/inspector/InspectorDOMAgent.cpp index 0c5cac033..60df0f6bc 100644 --- a/Source/WebCore/inspector/InspectorDOMAgent.cpp +++ b/Source/WebCore/inspector/InspectorDOMAgent.cpp @@ -47,6 +47,7 @@ #include "ContainerNode.h" #include "Cookie.h" #include "CookieJar.h" +#include "DOMEditor.h" #include "DOMNodeHighlighter.h" #include "DOMWindow.h" #include "Document.h" @@ -632,13 +633,22 @@ void InspectorDOMAgent::getOuterHTML(ErrorString* errorString, int nodeId, WTF:: void InspectorDOMAgent::setOuterHTML(ErrorString* errorString, int nodeId, const String& outerHTML, int* newId) { + if (!nodeId) { + DOMEditor domEditor(m_document.get()); + domEditor.patch(outerHTML); + *newId = 0; + return; + } + Node* node = assertNode(errorString, nodeId); if (!node) return; - Element* parentElement = node->parentElement(); - if (!parentElement) + Node* parentNode = node->parentNode(); + if (!parentNode) { + *errorString = "Editing of the detached nodes is not supported"; return; + } Document* document = node->ownerDocument(); if (!document->isHTMLDocument()) { @@ -649,10 +659,10 @@ void InspectorDOMAgent::setOuterHTML(ErrorString* errorString, int nodeId, const Node* previousSibling = node->previousSibling(); // Remember previous sibling before replacing node. RefPtr<DocumentFragment> fragment = DocumentFragment::create(document); - fragment->parseHTML(outerHTML, parentElement); + fragment->parseHTML(outerHTML, parentNode->nodeType() == Node::ELEMENT_NODE ? static_cast<Element*>(parentNode) : document->documentElement()); ExceptionCode ec = 0; - parentElement->replaceChild(fragment.release(), node, ec); + parentNode->replaceChild(fragment.release(), node, ec); if (ec) { *errorString = "Failed to replace Node with new contents"; return; @@ -670,7 +680,7 @@ void InspectorDOMAgent::setOuterHTML(ErrorString* errorString, int nodeId, const return; } - Node* newNode = previousSibling ? previousSibling->nextSibling() : parentElement->firstChild(); + Node* newNode = previousSibling ? previousSibling->nextSibling() : parentNode->firstChild(); if (!newNode) { // The only child node has been deleted. *newId = 0; diff --git a/Source/WebCore/inspector/InspectorDOMAgent.h b/Source/WebCore/inspector/InspectorDOMAgent.h index 31de399ed..17f62a6b7 100644 --- a/Source/WebCore/inspector/InspectorDOMAgent.h +++ b/Source/WebCore/inspector/InspectorDOMAgent.h @@ -169,7 +169,6 @@ public: PassRefPtr<InspectorObject> resolveNode(Node*, const String& objectGroup); bool handleMousePress(); - bool searchingForNodeInPage() const; void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags); void inspect(Node*); void focusNode(); diff --git a/Source/WebCore/inspector/front-end/DOMAgent.js b/Source/WebCore/inspector/front-end/DOMAgent.js index 6ee942316..dfd486ca7 100644 --- a/Source/WebCore/inspector/front-end/DOMAgent.js +++ b/Source/WebCore/inspector/front-end/DOMAgent.js @@ -529,6 +529,8 @@ WebInspector.DOMAgent = function() { this._document = null; this._attributeLoadNodeIds = {}; InspectorBackend.registerDOMDispatcher(new WebInspector.DOMDispatcher(this)); + if (WebInspector.experimentsSettings.freeFlowDOMEditing.isEnabled()) + new WebInspector.DOMModelResourceBinding(this); } WebInspector.DOMAgent.Events = { @@ -1074,3 +1076,27 @@ WebInspector.DOMDispatcher.prototype = { * @type {?WebInspector.DOMAgent} */ WebInspector.domAgent = null; + +/** + * @constructor + * @implements {WebInspector.ResourceDomainModelBinding} + */ +WebInspector.DOMModelResourceBinding = function(domAgent) +{ + this._domAgent = domAgent; + WebInspector.Resource.registerDomainModelBinding(WebInspector.Resource.Type.Document, this); +} + +WebInspector.DOMModelResourceBinding.prototype = { + setContent: function(resource, content, majorChange, userCallback) + { + DOMAgent.setOuterHTML(0, content, userCallback); + }, + + canSetContent: function() + { + return true; + } +} + +WebInspector.DOMModelResourceBinding.prototype.__proto__ = WebInspector.ResourceDomainModelBinding.prototype; diff --git a/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js b/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js index 6cfe683b3..76da658b3 100644 --- a/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js +++ b/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js @@ -36,6 +36,7 @@ WebInspector.DebuggerPresentationModel = function() { // FIXME: apply formatter from outside as a generic mapping. this._formatter = new WebInspector.ScriptFormatter(); + this._rawSourceCodes = []; this._rawSourceCodeForScriptId = {}; this._rawSourceCodeForURL = {}; this._rawSourceCodeForDocumentURL = {}; @@ -143,7 +144,8 @@ WebInspector.DebuggerPresentationModel.prototype = { if (WebInspector.settings.sourceMapsEnabled.get() && script.sourceMapURL) compilerSourceMapping = new WebInspector.ClosureCompilerSourceMapping(script.sourceMapURL, script.sourceURL); - rawSourceCode = new WebInspector.RawSourceCode(script.scriptId, script, resource, this._formatter, this._formatSource, compilerSourceMapping); + var rawSourceCode = new WebInspector.RawSourceCode(script.scriptId, script, resource, this._formatter, this._formatSource, compilerSourceMapping); + this._rawSourceCodes.push(rawSourceCode); this._bindScriptToRawSourceCode(script, rawSourceCode); if (isInlineScript) @@ -180,10 +182,10 @@ WebInspector.DebuggerPresentationModel.prototype = { uiSourceCodes: function() { var result = []; - for (var id in this._rawSourceCodeForScriptId) { - var uiSourceCodeList = this._rawSourceCodeForScriptId[id].sourceMapping.uiSourceCodeList(); - for (var i = 0; i < uiSourceCodeList.length; ++i) - result.push(uiSourceCodeList[i]); + for (var i = 0; i < this._rawSourceCodes.length; ++i) { + var uiSourceCodeList = this._rawSourceCodes[i].sourceMapping.uiSourceCodeList(); + for (var j = 0; j < uiSourceCodeList.length; ++j) + result.push(uiSourceCodeList[j]); } return result; }, @@ -335,8 +337,8 @@ WebInspector.DebuggerPresentationModel.prototype = { this._formatSource = formatSource; this._breakpointManager.reset(); - for (var id in this._rawSourceCodeForScriptId) - this._rawSourceCodeForScriptId[id].setFormatted(this._formatSource); + for (var i = 0; i < this._rawSourceCodes.length; ++i) + this._rawSourceCodes[i].setFormatted(this._formatSource); }, /** @@ -376,8 +378,8 @@ WebInspector.DebuggerPresentationModel.prototype = { _consoleCleared: function() { - for (var id in this._rawSourceCodeForScriptId) - this._rawSourceCodeForScriptId[id].messages = []; + for (var i = 0; i < this._rawSourceCodes.length; ++i) + this._rawSourceCodes[i].messages = []; this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.ConsoleMessagesCleared); }, @@ -655,15 +657,16 @@ WebInspector.DebuggerPresentationModel.prototype = { _debuggerReset: function() { - for (var id in this._rawSourceCodeForScriptId) { - var rawSourceCode = this._rawSourceCodeForScriptId[id]; + for (var i = 0; i < this._rawSourceCodes.length; ++i) { + var rawSourceCode = this._rawSourceCodes[i]; if (rawSourceCode.sourceMapping) { var uiSourceCodeList = rawSourceCode.sourceMapping.uiSourceCodeList(); - for (var i = 0; i < uiSourceCodeList.length; ++i) - this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.UISourceCodeRemoved, uiSourceCodeList[i]); + for (var j = 0; j < uiSourceCodeList.length; ++j) + this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.UISourceCodeRemoved, uiSourceCodeList[j]); } rawSourceCode.removeAllListeners(); } + this._rawSourceCodes = []; this._rawSourceCodeForScriptId = {}; this._rawSourceCodeForURL = {}; this._rawSourceCodeForDocumentURL = {}; diff --git a/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js b/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js index 56c585338..3e6c89fc7 100644 --- a/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js +++ b/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js @@ -37,13 +37,14 @@ */ WebInspector.JavaScriptSourceFrame = function(scriptsPanel, model, uiSourceCode) { - WebInspector.SourceFrame.call(this, uiSourceCode.url); - this._scriptsPanel = scriptsPanel; this._model = model; this._uiSourceCode = uiSourceCode; this._popoverObjectGroup = "popover"; this._breakpoints = {}; + + WebInspector.SourceFrame.call(this, uiSourceCode.url); + this._popoverHelper = new WebInspector.ObjectPopoverHelper(this.textViewer.element, this._getPopoverAnchor.bind(this), this._onShowPopover.bind(this), this._onHidePopover.bind(this), true); @@ -95,7 +96,7 @@ WebInspector.JavaScriptSourceFrame.prototype = { setReadOnly: function(readOnly) { - if (!readOnly) + if (this._popoverHelper && !readOnly) this._popoverHelper.hidePopover(); WebInspector.SourceFrame.prototype.setReadOnly.call(this, readOnly); if (readOnly) @@ -202,10 +203,13 @@ WebInspector.JavaScriptSourceFrame.prototype = { cancelEditing: function() { + if (WebInspector.experimentsSettings.sourceFrameAlwaysEditable.isEnabled()) + return false; + WebInspector.SourceFrame.prototype.cancelEditing.call(this); if (!this._javaScriptSourceFrameState) - return; + return true; if (typeof this._javaScriptSourceFrameState.executionLineNumber === "number") { this.clearExecutionLine(); @@ -225,6 +229,7 @@ WebInspector.JavaScriptSourceFrame.prototype = { } delete this._javaScriptSourceFrameState; + return true; }, didEditContent: function(error) diff --git a/Source/WebCore/inspector/front-end/NetworkPanel.js b/Source/WebCore/inspector/front-end/NetworkPanel.js index 41fbb23a2..772a4d2d6 100644 --- a/Source/WebCore/inspector/front-end/NetworkPanel.js +++ b/Source/WebCore/inspector/front-end/NetworkPanel.js @@ -76,7 +76,7 @@ WebInspector.NetworkLogView = function() { this._canClearBrowserCookies = result; } - NetworkAgent.canClearBrowserCache(onCanClearBrowserCookies.bind(this)); + NetworkAgent.canClearBrowserCookies(onCanClearBrowserCookies.bind(this)); } WebInspector.NetworkLogView.prototype = { diff --git a/Source/WebCore/inspector/front-end/ResourceView.js b/Source/WebCore/inspector/front-end/ResourceView.js index b99b58afa..3d3686ca2 100644 --- a/Source/WebCore/inspector/front-end/ResourceView.js +++ b/Source/WebCore/inspector/front-end/ResourceView.js @@ -82,8 +82,8 @@ WebInspector.ResourceView.nonSourceViewForResource = function(resource) */ WebInspector.ResourceSourceFrame = function(resource) { - WebInspector.SourceFrame.call(this, resource.url); this._resource = resource; + WebInspector.SourceFrame.call(this, resource.url); } //This is a map from resource.type to mime types @@ -147,11 +147,15 @@ WebInspector.EditableResourceSourceFrame.prototype = { cancelEditing: function() { + if (WebInspector.experimentsSettings.sourceFrameAlwaysEditable.isEnabled()) + return false; + this._clearIncrementalUpdateTimer(); const majorChange = false; if (this._viewerState) this.resource.setContent(this._viewerState.textModelContent, majorChange); WebInspector.SourceFrame.prototype.cancelEditing.call(this); + return true; }, afterTextChanged: function(oldRange, newRange) diff --git a/Source/WebCore/inspector/front-end/ScriptsPanel.js b/Source/WebCore/inspector/front-end/ScriptsPanel.js index 5baae8f70..ab1cd5799 100644 --- a/Source/WebCore/inspector/front-end/ScriptsPanel.js +++ b/Source/WebCore/inspector/front-end/ScriptsPanel.js @@ -1529,7 +1529,7 @@ WebInspector.ScriptsPanel.SingleFileEditorContainer.prototype = { { this._currentSourceFrame.detach(); this._currentSourceFrame = null; - this.showSourceFrame(title, sourceFrame); + this.showSourceFrame(title, sourceFrame, tooltip); }, /** diff --git a/Source/WebCore/inspector/front-end/Settings.js b/Source/WebCore/inspector/front-end/Settings.js index 9be95f85a..81805181f 100644 --- a/Source/WebCore/inspector/front-end/Settings.js +++ b/Source/WebCore/inspector/front-end/Settings.js @@ -168,7 +168,9 @@ WebInspector.ExperimentsSettings = function() // Add currently running experiments here. // FIXME: Move out from experiments once navigator is production-ready. this.useScriptsNavigator = this._createExperiment("useScriptsNavigator", "Use file navigator and tabbed editor container in scripts panel"); - + this.sourceFrameAlwaysEditable = this._createExperiment("sourceFrameAlwaysEditable", "Make resources always editable"); + this.freeFlowDOMEditing = this._createExperiment("freeFlowDOMEditing", "Enable free flow DOM editing"); + this._cleanUpSetting(); } diff --git a/Source/WebCore/inspector/front-end/SourceFrame.js b/Source/WebCore/inspector/front-end/SourceFrame.js index 29b45e531..f66f67b63 100644 --- a/Source/WebCore/inspector/front-end/SourceFrame.js +++ b/Source/WebCore/inspector/front-end/SourceFrame.js @@ -53,6 +53,9 @@ WebInspector.SourceFrame = function(url) this._messages = []; this._rowMessages = {}; this._messageBubbles = {}; + + if (WebInspector.experimentsSettings.sourceFrameAlwaysEditable.isEnabled()) + this.startEditing(); } WebInspector.SourceFrame.Events = { @@ -106,7 +109,7 @@ WebInspector.SourceFrame.prototype = { get statusBarItems() { - return [this._editButton.element]; + return WebInspector.experimentsSettings.sourceFrameAlwaysEditable.isEnabled() ? [] : [this._editButton.element]; }, get loaded() @@ -568,8 +571,12 @@ WebInspector.SourceFrame.prototype = { cancelEditing: function() { + if (WebInspector.experimentsSettings.sourceFrameAlwaysEditable.isEnabled()) + return false; + this._restoreViewerState(); this.setReadOnly(true); + return true; }, get readOnly() @@ -579,9 +586,10 @@ WebInspector.SourceFrame.prototype = { setReadOnly: function(readOnly) { + if (readOnly && WebInspector.experimentsSettings.sourceFrameAlwaysEditable.isEnabled()) + return; this._textViewer.readOnly = readOnly; this._editButton.toggled = !readOnly; - WebInspector.markBeingEdited(this._textViewer.element, !readOnly); } } @@ -620,7 +628,7 @@ WebInspector.TextViewerDelegateForSourceFrame.prototype = { cancelEditing: function() { - this._sourceFrame.cancelEditing(); + return this._sourceFrame.cancelEditing(); }, populateLineGutterContextMenu: function(contextMenu, lineNumber) diff --git a/Source/WebCore/inspector/front-end/TabbedPane.js b/Source/WebCore/inspector/front-end/TabbedPane.js index 9b59cfcee..80e71f75d 100644 --- a/Source/WebCore/inspector/front-end/TabbedPane.js +++ b/Source/WebCore/inspector/front-end/TabbedPane.js @@ -484,7 +484,7 @@ WebInspector.TabbedPaneTab.prototype = { }, /** - * @type {string=} + * @type {string|undefined} */ get tooltip() { diff --git a/Source/WebCore/inspector/front-end/TextViewer.js b/Source/WebCore/inspector/front-end/TextViewer.js index 0066e9a7b..eb44a5e15 100644 --- a/Source/WebCore/inspector/front-end/TextViewer.js +++ b/Source/WebCore/inspector/front-end/TextViewer.js @@ -329,8 +329,7 @@ WebInspector.TextViewer.prototype = { if (this.readOnly) return false; - this._delegate.cancelEditing(); - return true; + return this._delegate.cancelEditing(); } } diff --git a/Source/WebCore/inspector/front-end/elementsPanel.css b/Source/WebCore/inspector/front-end/elementsPanel.css index 337acce8f..d720c5438 100644 --- a/Source/WebCore/inspector/front-end/elementsPanel.css +++ b/Source/WebCore/inspector/front-end/elementsPanel.css @@ -31,6 +31,10 @@ white-space: nowrap; } +#elements-content { + padding-left: 0; +} + #elements-content > ol { display: inline-block; } diff --git a/Source/WebCore/inspector/front-end/externs.js b/Source/WebCore/inspector/front-end/externs.js index 05b6f50a8..f7421f9a2 100644 --- a/Source/WebCore/inspector/front-end/externs.js +++ b/Source/WebCore/inspector/front-end/externs.js @@ -184,3 +184,5 @@ WebInspector.showPanel = function(panel) * @type {string} */ WebInspector.inspectedPageDomain; + +WebInspector.isCompactMode = function() { return false; } diff --git a/Source/WebCore/inspector/front-end/treeoutline.js b/Source/WebCore/inspector/front-end/treeoutline.js index 84b70aa34..3144ee4e0 100644 --- a/Source/WebCore/inspector/front-end/treeoutline.js +++ b/Source/WebCore/inspector/front-end/treeoutline.js @@ -539,7 +539,7 @@ TreeOutline.prototype._searchInputKeyDown = function(event) /** * @param {string} searchText - * @param {TreeElement=} startTreeElement + * @param {TreeElement} startTreeElement * @param {boolean} skipStartTreeElement */ TreeOutline.prototype._nextSearchMatch = function(searchText, startTreeElement, skipStartTreeElement) diff --git a/Source/WebCore/loader/DocumentLoader.cpp b/Source/WebCore/loader/DocumentLoader.cpp index de47c2a2c..1e38660bf 100644 --- a/Source/WebCore/loader/DocumentLoader.cpp +++ b/Source/WebCore/loader/DocumentLoader.cpp @@ -233,7 +233,17 @@ void DocumentLoader::stopLoading() // Appcache uses ResourceHandle directly, DocumentLoader doesn't count these loads. m_applicationCacheHost->stopLoadingInFrame(m_frame); - if (!loading) + if (!loading) { + // If something above restarted loading we might run into mysterious crashes like + // https://bugs.webkit.org/show_bug.cgi?id=62764 and <rdar://problem/9328684> + ASSERT(!m_loading); + return; + } + + // We might run in to infinite recursion if we're stopping loading as the result of + // detaching from the frame, so break out of that recursion here. + // See <rdar://problem/9673866> for more details. + if (m_isStopping) return; RefPtr<Frame> protectFrame(m_frame); @@ -396,6 +406,10 @@ void DocumentLoader::detachFromFrame() { ASSERT(m_frame); + // It never makes sense to have a document loader that is detached from its + // frame have any loads active, so go ahead and kill all the loads. + stopLoading(); + m_applicationCacheHost->setDOMApplicationCache(0); InspectorInstrumentation::loaderDetachedFromFrame(m_frame, this); m_frame = 0; @@ -640,7 +654,7 @@ bool DocumentLoader::scheduleArchiveLoad(ResourceLoader* loader, const ResourceR #if ENABLE(WEB_ARCHIVE) case Archive::WebArchive: // WebArchiveDebugMode means we fail loads instead of trying to fetch them from the network if they're not in the archive. - return m_frame->settings()->webArchiveDebugModeEnabled() && ArchiveFactory::isArchiveMimeType(responseMIMEType()); + return m_frame->settings() && m_frame->settings()->webArchiveDebugModeEnabled() && ArchiveFactory::isArchiveMimeType(responseMIMEType()); #endif #if ENABLE(MHTML) case Archive::MHTML: diff --git a/Source/WebCore/loader/FrameLoaderClient.h b/Source/WebCore/loader/FrameLoaderClient.h index 28aa6d65e..35c689b22 100644 --- a/Source/WebCore/loader/FrameLoaderClient.h +++ b/Source/WebCore/loader/FrameLoaderClient.h @@ -78,6 +78,9 @@ namespace WebCore { #endif class HTMLPlugInElement; class IntSize; +#if ENABLE(WEB_INTENTS) + class IntentRequest; +#endif class KURL; class MessageEvent; class NavigationAction; @@ -323,6 +326,10 @@ namespace WebCore { // Returns true if the embedder intercepted the postMessage call virtual bool willCheckAndDispatchMessageEvent(SecurityOrigin* /*target*/, MessageEvent*) const { return false; } + +#if ENABLE(WEB_INTENTS) + virtual void dispatchIntent(PassRefPtr<IntentRequest> intentRequest) { } +#endif }; } // namespace WebCore diff --git a/Source/WebCore/loader/SubframeLoader.cpp b/Source/WebCore/loader/SubframeLoader.cpp index 236c72893..af0d074cd 100644 --- a/Source/WebCore/loader/SubframeLoader.cpp +++ b/Source/WebCore/loader/SubframeLoader.cpp @@ -109,7 +109,7 @@ bool SubframeLoader::requestPlugin(HTMLPlugInImageElement* ownerElement, const K // as opposed to third-party code such as Flash. The user agent decides whether or not they are // permitted, rather than WebKit. && !MIMETypeRegistry::isApplicationPluginMIMEType(mimeType)) - || (!settings->isJavaEnabled() && MIMETypeRegistry::isJavaAppletMIMEType(mimeType))) + || ((!settings || !settings->isJavaEnabled()) && MIMETypeRegistry::isJavaAppletMIMEType(mimeType))) return false; if (m_frame->document()) { diff --git a/Source/WebCore/loader/SubresourceLoader.cpp b/Source/WebCore/loader/SubresourceLoader.cpp index 703517bca..b9a1d7e3e 100644 --- a/Source/WebCore/loader/SubresourceLoader.cpp +++ b/Source/WebCore/loader/SubresourceLoader.cpp @@ -211,17 +211,24 @@ void SubresourceLoader::didReceiveData(const char* data, int length, long long e RefPtr<SubresourceLoader> protect(this); ResourceLoader::didReceiveData(data, length, encodedDataLength, allAtOnce); - if (m_resource->response().httpStatusCode() >= 400 && !m_resource->shouldIgnoreHTTPStatusCodeErrors()) { - m_resource->error(CachedResource::LoadError); - m_state = Finishing; - cancel(); + if (errorLoadingResource()) return; - } if (!m_loadingMultipartContent) sendDataToResource(data, length); } +bool SubresourceLoader::errorLoadingResource() +{ + if (m_resource->response().httpStatusCode() < 400 || m_resource->shouldIgnoreHTTPStatusCodeErrors()) + return false; + + m_resource->error(CachedResource::LoadError); + m_state = Finishing; + cancel(); + return true; +} + void SubresourceLoader::sendDataToResource(const char* data, int length) { // There are two cases where we might need to create our own SharedBuffer instead of copying the one in ResourceLoader. diff --git a/Source/WebCore/loader/SubresourceLoader.h b/Source/WebCore/loader/SubresourceLoader.h index 2da303917..3cf2f3661 100644 --- a/Source/WebCore/loader/SubresourceLoader.h +++ b/Source/WebCore/loader/SubresourceLoader.h @@ -71,6 +71,7 @@ private: #endif virtual void releaseResources(); + bool errorLoadingResource(); void sendDataToResource(const char*, int); enum SubresourceLoaderState { diff --git a/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp b/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp index 04c2f2991..ec2d71bc0 100644 --- a/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp +++ b/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp @@ -138,7 +138,7 @@ void ApplicationCacheGroup::selectCache(Frame* frame, const KURL& passedManifest { ASSERT(frame && frame->page()); - if (!frame->settings()->offlineWebApplicationCacheEnabled()) + if (!frame->settings() || !frame->settings()->offlineWebApplicationCacheEnabled()) return; DocumentLoader* documentLoader = frame->loader()->documentLoader(); @@ -193,7 +193,7 @@ void ApplicationCacheGroup::selectCache(Frame* frame, const KURL& passedManifest return; // Don't change anything on disk if private browsing is enabled. - if (!frame->settings() || frame->settings()->privateBrowsingEnabled()) { + if (frame->settings()->privateBrowsingEnabled()) { postListenerTask(ApplicationCacheHost::CHECKING_EVENT, documentLoader); postListenerTask(ApplicationCacheHost::ERROR_EVENT, documentLoader); return; @@ -211,7 +211,7 @@ void ApplicationCacheGroup::selectCache(Frame* frame, const KURL& passedManifest void ApplicationCacheGroup::selectCacheWithoutManifestURL(Frame* frame) { - if (!frame->settings()->offlineWebApplicationCacheEnabled()) + if (!frame->settings() || !frame->settings()->offlineWebApplicationCacheEnabled()) return; DocumentLoader* documentLoader = frame->loader()->documentLoader(); diff --git a/Source/WebCore/loader/appcache/DOMApplicationCache.cpp b/Source/WebCore/loader/appcache/DOMApplicationCache.cpp index 72c9fc989..042eb396f 100644 --- a/Source/WebCore/loader/appcache/DOMApplicationCache.cpp +++ b/Source/WebCore/loader/appcache/DOMApplicationCache.cpp @@ -40,7 +40,7 @@ namespace WebCore { DOMApplicationCache::DOMApplicationCache(Frame* frame) - : m_frame(frame) + : DOMWindowProperty(frame) { ApplicationCacheHost* cacheHost = applicationCacheHost(); if (cacheHost) @@ -52,7 +52,7 @@ void DOMApplicationCache::disconnectFrame() ApplicationCacheHost* cacheHost = applicationCacheHost(); if (cacheHost) cacheHost->setDOMApplicationCache(0); - m_frame = 0; + DOMWindowProperty::disconnectFrame(); } ApplicationCacheHost* DOMApplicationCache::applicationCacheHost() const diff --git a/Source/WebCore/loader/appcache/DOMApplicationCache.h b/Source/WebCore/loader/appcache/DOMApplicationCache.h index 022841ce7..2ca44c1b3 100644 --- a/Source/WebCore/loader/appcache/DOMApplicationCache.h +++ b/Source/WebCore/loader/appcache/DOMApplicationCache.h @@ -27,6 +27,7 @@ #define DOMApplicationCache_h #include "ApplicationCacheHost.h" +#include "DOMWindowProperty.h" #include "EventNames.h" #include "EventTarget.h" #include <wtf/Forward.h> @@ -41,13 +42,12 @@ namespace WebCore { class Frame; class KURL; -class DOMApplicationCache : public RefCounted<DOMApplicationCache>, public EventTarget { +class DOMApplicationCache : public RefCounted<DOMApplicationCache>, public EventTarget, public DOMWindowProperty { public: static PassRefPtr<DOMApplicationCache> create(Frame* frame) { return adoptRef(new DOMApplicationCache(frame)); } ~DOMApplicationCache() { ASSERT(!m_frame); } - Frame* frame() const { return m_frame; } - void disconnectFrame(); + virtual void disconnectFrame() OVERRIDE; unsigned short status() const; void update(ExceptionCode&); @@ -75,7 +75,7 @@ public: static const AtomicString& toEventType(ApplicationCacheHost::EventID id); private: - DOMApplicationCache(Frame*); + explicit DOMApplicationCache(Frame*); virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } @@ -84,7 +84,6 @@ private: ApplicationCacheHost* applicationCacheHost() const; - Frame* m_frame; EventTargetData m_eventTargetData; }; diff --git a/Source/WebCore/loader/cf/SubresourceLoaderCF.cpp b/Source/WebCore/loader/cf/SubresourceLoaderCF.cpp index 15ab887f8..5008a16b4 100644 --- a/Source/WebCore/loader/cf/SubresourceLoaderCF.cpp +++ b/Source/WebCore/loader/cf/SubresourceLoaderCF.cpp @@ -36,13 +36,16 @@ void SubresourceLoader::didReceiveDataArray(CFArrayRef dataArray) ResourceLoader::didReceiveDataArray(dataArray); + if (errorLoadingResource()) + return; + // A subresource loader does not load multipart sections progressively. // So don't deliver any data to the loader yet. if (!m_loadingMultipartContent) { CFIndex arrayCount = CFArrayGetCount(dataArray); for (CFIndex i = 0; i < arrayCount; ++i) { CFDataRef data = reinterpret_cast<CFDataRef>(CFArrayGetValueAtIndex(dataArray, i)); - didReceiveData(reinterpret_cast<const char *>(CFDataGetBytePtr(data)), static_cast<int>(CFDataGetLength(data)), -1, false); + sendDataToResource(reinterpret_cast<const char *>(CFDataGetBytePtr(data)), static_cast<int>(CFDataGetLength(data))); } } } diff --git a/Source/WebCore/page/BarInfo.cpp b/Source/WebCore/page/BarInfo.cpp index b6ab68619..36b2ad6a7 100644 --- a/Source/WebCore/page/BarInfo.cpp +++ b/Source/WebCore/page/BarInfo.cpp @@ -36,21 +36,11 @@ namespace WebCore { BarInfo::BarInfo(Frame* frame, Type type) - : m_frame(frame) + : DOMWindowProperty(frame) , m_type(type) { } -Frame* BarInfo::frame() const -{ - return m_frame; -} - -void BarInfo::disconnectFrame() -{ - m_frame = 0; -} - BarInfo::Type BarInfo::type() const { return m_type; diff --git a/Source/WebCore/page/BarInfo.h b/Source/WebCore/page/BarInfo.h index 376b8fc6d..b369b6e4c 100644 --- a/Source/WebCore/page/BarInfo.h +++ b/Source/WebCore/page/BarInfo.h @@ -29,6 +29,7 @@ #ifndef BarInfo_h #define BarInfo_h +#include "DOMWindowProperty.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> @@ -36,22 +37,17 @@ namespace WebCore { class Frame; - class BarInfo : public RefCounted<BarInfo> { + class BarInfo : public RefCounted<BarInfo>, public DOMWindowProperty { public: enum Type { Locationbar, Menubar, Personalbar, Scrollbars, Statusbar, Toolbar }; static PassRefPtr<BarInfo> create(Frame* frame, Type type) { return adoptRef(new BarInfo(frame, type)); } - Frame* frame() const; - void disconnectFrame(); - Type type() const; - bool visible() const; private: BarInfo(Frame*, Type); - Frame* m_frame; Type m_type; }; diff --git a/Source/WebCore/page/ChromeClient.h b/Source/WebCore/page/ChromeClient.h index 0bc863bd8..982a7cd15 100644 --- a/Source/WebCore/page/ChromeClient.h +++ b/Source/WebCore/page/ChromeClient.h @@ -258,6 +258,7 @@ namespace WebCore { PluginTrigger = 1 << 2, CanvasTrigger = 1 << 3, AnimationTrigger = 1 << 4, + FilterTrigger = 1 << 5, AllTriggers = 0xFFFFFFFF }; typedef unsigned CompositingTriggerFlags; diff --git a/Source/WebCore/page/Console.cpp b/Source/WebCore/page/Console.cpp index 011cd6c48..3cc4c2ebf 100644 --- a/Source/WebCore/page/Console.cpp +++ b/Source/WebCore/page/Console.cpp @@ -56,7 +56,7 @@ namespace WebCore { Console::Console(Frame* frame) - : m_frame(frame) + : DOMWindowProperty(frame) { } @@ -64,18 +64,6 @@ Console::~Console() { } -Frame* Console::frame() const -{ - return m_frame; -} - -void Console::disconnectFrame() -{ - if (m_memory) - m_memory = 0; - m_frame = 0; -} - static void printSourceURLAndLine(const String& sourceURL, unsigned lineNumber) { if (!sourceURL.isEmpty()) { @@ -348,10 +336,11 @@ void Console::warn(PassRefPtr<ScriptArguments> arguments, PassRefPtr<ScriptCallS addMessage(LogMessageType, WarningMessageLevel, arguments, callStack); } -MemoryInfo* Console::memory() const +PassRefPtr<MemoryInfo> Console::memory() const { - m_memory = MemoryInfo::create(m_frame); - return m_memory.get(); + // FIXME: Because we create a new object here each time, + // console.memory !== console.memory, which seems wrong. + return MemoryInfo::create(m_frame); } static bool printExceptions = false; diff --git a/Source/WebCore/page/Console.h b/Source/WebCore/page/Console.h index 87fe40746..5a1000443 100644 --- a/Source/WebCore/page/Console.h +++ b/Source/WebCore/page/Console.h @@ -30,6 +30,7 @@ #define Console_h #include "ConsoleTypes.h" +#include "DOMWindowProperty.h" #include "ScriptProfile.h" #include "ScriptState.h" #include <wtf/Forward.h> @@ -48,14 +49,11 @@ class ScriptCallStack; typedef Vector<RefPtr<ScriptProfile> > ProfilesArray; #endif -class Console : public RefCounted<Console> { +class Console : public RefCounted<Console>, public DOMWindowProperty { public: static PassRefPtr<Console> create(Frame* frame) { return adoptRef(new Console(frame)); } virtual ~Console(); - Frame* frame() const; - void disconnectFrame(); - void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL); void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack> callStack); @@ -85,19 +83,17 @@ public: static bool shouldPrintExceptions(); static void setShouldPrintExceptions(bool); - MemoryInfo* memory() const; + PassRefPtr<MemoryInfo> memory() const; private: inline Page* page() const; void addMessage(MessageType, MessageLevel, PassRefPtr<ScriptArguments>, PassRefPtr<ScriptCallStack>, bool acceptNoArguments = false); - Console(Frame*); + explicit Console(Frame*); - Frame* m_frame; #if ENABLE(JAVASCRIPT_DEBUGGER) ProfilesArray m_profiles; #endif - mutable RefPtr<MemoryInfo> m_memory; }; } // namespace WebCore diff --git a/Source/WebCore/page/ContentSecurityPolicy.h b/Source/WebCore/page/ContentSecurityPolicy.h index d94e317fa..fa7632465 100644 --- a/Source/WebCore/page/ContentSecurityPolicy.h +++ b/Source/WebCore/page/ContentSecurityPolicy.h @@ -52,6 +52,8 @@ public: }; void didReceiveHeader(const String&, HeaderType); + String policy() { return m_header; } + HeaderType headerType() { return m_reportOnly ? ReportOnly : EnforcePolicy; } bool allowJavaScriptURLs() const; bool allowInlineEventHandlers() const; diff --git a/Source/WebCore/page/DOMSelection.cpp b/Source/WebCore/page/DOMSelection.cpp index 23ad2de27..97a438dd0 100644 --- a/Source/WebCore/page/DOMSelection.cpp +++ b/Source/WebCore/page/DOMSelection.cpp @@ -54,20 +54,10 @@ static Node* selectionShadowAncestor(Frame* frame) } DOMSelection::DOMSelection(Frame* frame) - : m_frame(frame) + : DOMWindowProperty(frame) { } -Frame* DOMSelection::frame() const -{ - return m_frame; -} - -void DOMSelection::disconnectFrame() -{ - m_frame = 0; -} - const VisibleSelection& DOMSelection::visibleSelection() const { ASSERT(m_frame); @@ -419,7 +409,7 @@ void DOMSelection::addRange(Range* r) } } else { // We don't support discontiguous selection. We don't do anything if r and range don't intersect. - if (r->compareBoundaryPoints(Range::END_TO_START, range.get(), ec) < 1) { + if (r->compareBoundaryPoints(Range::END_TO_START, range.get(), ec) < 1 && !ec) { if (r->compareBoundaryPoints(Range::END_TO_END, range.get(), ec) == -1) // The original range contains r. selection->setSelection(VisibleSelection(range.get())); diff --git a/Source/WebCore/page/DOMSelection.h b/Source/WebCore/page/DOMSelection.h index b5fd19768..9803acca2 100644 --- a/Source/WebCore/page/DOMSelection.h +++ b/Source/WebCore/page/DOMSelection.h @@ -30,6 +30,7 @@ #ifndef DOMSelection_h #define DOMSelection_h +#include "DOMWindowProperty.h" #include <wtf/Forward.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> @@ -43,13 +44,10 @@ namespace WebCore { typedef int ExceptionCode; - class DOMSelection : public RefCounted<DOMSelection> { + class DOMSelection : public RefCounted<DOMSelection>, public DOMWindowProperty { public: static PassRefPtr<DOMSelection> create(Frame* frame) { return adoptRef(new DOMSelection(frame)); } - Frame* frame() const; - void disconnectFrame(); - // Safari Selection Object API // These methods return the valid equivalents of internal editing positions. Node* baseNode() const; @@ -90,13 +88,12 @@ namespace WebCore { void empty(); private: - DOMSelection(Frame*); + explicit DOMSelection(Frame*); // Convenience method for accessors, does not NULL check m_frame. const VisibleSelection& visibleSelection() const; bool isValidForPosition(Node*) const; - Frame* m_frame; }; } // namespace WebCore diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp index 346eb96c7..093266eca 100644 --- a/Source/WebCore/page/DOMWindow.cpp +++ b/Source/WebCore/page/DOMWindow.cpp @@ -397,16 +397,13 @@ bool DOMWindow::canShowModalDialogNow(const Frame* frame) } DOMWindow::DOMWindow(Frame* frame) - : m_shouldPrintWhenFinishedLoading(false) - , m_frame(frame) + : FrameDestructionObserver(frame) + , m_shouldPrintWhenFinishedLoading(false) { } DOMWindow::~DOMWindow() { - if (m_frame) - m_frame->clearFormerDOMWindow(this); - ASSERT(!m_screen); ASSERT(!m_selection); ASSERT(!m_history); @@ -473,98 +470,60 @@ void DOMWindow::setSecurityOrigin(SecurityOrigin* securityOrigin) m_securityOrigin = securityOrigin; } -void DOMWindow::disconnectFrame() +void DOMWindow::frameDestroyed() { - m_frame = 0; + FrameDestructionObserver::frameDestroyed(); clear(); } +void DOMWindow::registerProperty(DOMWindowProperty* property) +{ + m_properties.add(property); +} + +void DOMWindow::unregisterProperty(DOMWindowProperty* property) +{ + m_properties.remove(property); +} + void DOMWindow::clear() { - if (m_screen) - m_screen->disconnectFrame(); - m_screen = 0; + HashSet<DOMWindowProperty*>::iterator stop = m_properties.end(); + for (HashSet<DOMWindowProperty*>::iterator it = m_properties.begin(); it != stop; ++it) + (*it)->disconnectFrame(); + m_properties.clear(); - if (m_selection) - m_selection->disconnectFrame(); + m_screen = 0; m_selection = 0; - - if (m_history) - m_history->disconnectFrame(); m_history = 0; - m_crypto = 0; - - if (m_locationbar) - m_locationbar->disconnectFrame(); m_locationbar = 0; - - if (m_menubar) - m_menubar->disconnectFrame(); m_menubar = 0; - - if (m_personalbar) - m_personalbar->disconnectFrame(); m_personalbar = 0; - - if (m_scrollbars) - m_scrollbars->disconnectFrame(); m_scrollbars = 0; - - if (m_statusbar) - m_statusbar->disconnectFrame(); m_statusbar = 0; - - if (m_toolbar) - m_toolbar->disconnectFrame(); m_toolbar = 0; - - if (m_console) - m_console->disconnectFrame(); m_console = 0; - - if (m_navigator) - m_navigator->disconnectFrame(); m_navigator = 0; - #if ENABLE(WEB_TIMING) - if (m_performance) - m_performance->disconnectFrame(); m_performance = 0; #endif - - if (m_location) - m_location->disconnectFrame(); m_location = 0; - - if (m_media) - m_media->disconnectFrame(); m_media = 0; - - if (m_sessionStorage) - m_sessionStorage->disconnectFrame(); m_sessionStorage = 0; - - if (m_localStorage) - m_localStorage->disconnectFrame(); m_localStorage = 0; - - if (m_applicationCache) - m_applicationCache->disconnectFrame(); m_applicationCache = 0; - #if ENABLE(NOTIFICATIONS) + // FIXME: Notifications shouldn't have different disconnection logic than + // the rest of the DOMWindowProperties. resetNotifications(); #endif - #if ENABLE(INDEXED_DATABASE) m_idbFactory = 0; #endif - #if ENABLE(BLOB) m_domURL = 0; #endif - #if ENABLE(QUOTA) m_storageInfo = 0; #endif @@ -1422,23 +1381,6 @@ double DOMWindow::devicePixelRatio() const return page->deviceScaleFactor(); } -#if ENABLE(SQL_DATABASE) -PassRefPtr<Database> DOMWindow::openDatabase(const String& name, const String& version, const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback, ExceptionCode& ec) -{ - if (!isCurrentlyDisplayedInFrame()) - return 0; - - RefPtr<Database> database = 0; - if (m_frame && AbstractDatabase::isAvailable() && m_frame->document()->securityOrigin()->canAccessDatabase()) - database = Database::openDatabase(m_frame->document(), name, version, displayName, estimatedSize, creationCallback, ec); - - if (!database && !ec) - ec = SECURITY_ERR; - - return database; -} -#endif - void DOMWindow::scrollBy(int x, int y) const { if (!isCurrentlyDisplayedInFrame()) diff --git a/Source/WebCore/page/DOMWindow.h b/Source/WebCore/page/DOMWindow.h index c3e7ac453..cc297f797 100644 --- a/Source/WebCore/page/DOMWindow.h +++ b/Source/WebCore/page/DOMWindow.h @@ -28,6 +28,7 @@ #define DOMWindow_h #include "EventTarget.h" +#include "FrameDestructionObserver.h" #include "KURL.h" namespace WebCore { @@ -40,6 +41,7 @@ namespace WebCore { class DOMApplicationCache; class DOMSelection; class DOMURL; + class DOMWindowProperty; class Database; class DatabaseCallback; class Document; @@ -80,7 +82,7 @@ namespace WebCore { enum SetLocationLocking { LockHistoryBasedOnGestureState, LockHistoryAndBackForwardList }; - class DOMWindow : public RefCounted<DOMWindow>, public EventTarget { + class DOMWindow : public RefCounted<DOMWindow>, public EventTarget, public FrameDestructionObserver { public: static PassRefPtr<DOMWindow> create(Frame* frame) { return adoptRef(new DOMWindow(frame)); } virtual ~DOMWindow(); @@ -90,8 +92,10 @@ namespace WebCore { virtual DOMWindow* toDOMWindow(); - Frame* frame() const { return m_frame; } - void disconnectFrame(); + virtual void frameDestroyed() OVERRIDE; + + void registerProperty(DOMWindowProperty*); + void unregisterProperty(DOMWindowProperty*); void clear(); @@ -351,10 +355,6 @@ namespace WebCore { DOMURL* webkitURL() const; #endif -#if ENABLE(SQL_DATABASE) - PassRefPtr<Database> openDatabase(const String& name, const String& version, const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback, ExceptionCode&); -#endif - #if ENABLE(DEVICE_ORIENTATION) DEFINE_ATTRIBUTE_EVENT_LISTENER(devicemotion); DEFINE_ATTRIBUTE_EVENT_LISTENER(deviceorientation); @@ -414,15 +414,15 @@ namespace WebCore { Performance* performance() const; #endif - private: - DOMWindow(Frame*); - // FIXME: When this DOMWindow is no longer the active DOMWindow (i.e., // when its document is no longer the document that is displayed in its // frame), we would like to zero out m_frame to avoid being confused // by the document that is currently active in m_frame. bool isCurrentlyDisplayedInFrame() const; + private: + explicit DOMWindow(Frame*); + virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } virtual EventTargetData* eventTargetData(); @@ -437,7 +437,9 @@ namespace WebCore { KURL m_url; bool m_shouldPrintWhenFinishedLoading; - Frame* m_frame; + + HashSet<DOMWindowProperty*> m_properties; + mutable RefPtr<Screen> m_screen; mutable RefPtr<DOMSelection> m_selection; mutable RefPtr<History> m_history; diff --git a/Source/WebCore/page/DOMWindow.idl b/Source/WebCore/page/DOMWindow.idl index 19668e3d5..9ca8bd3cf 100644 --- a/Source/WebCore/page/DOMWindow.idl +++ b/Source/WebCore/page/DOMWindow.idl @@ -163,10 +163,6 @@ module window { in [Optional=CallWithDefaultValue] WebKitPoint p); readonly attribute [EnabledAtRuntime] DOMApplicationCache applicationCache; -#if defined(ENABLE_SQL_DATABASE) && ENABLE_SQL_DATABASE - [EnabledAtRuntime] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in [Callback, Optional] DatabaseCallback creationCallback) - raises(DOMException); -#endif readonly attribute [EnabledAtRuntime] Storage sessionStorage getter raises(DOMException); @@ -607,6 +603,8 @@ module window { attribute [EnabledAtRuntime=webkitVideoTrack] TrackEventConstructor TrackEvent; #endif + attribute [Conditional=WEB_INTENTS] IntentConstructor Intent; // Usable with the new operator + attribute DOMPluginConstructor Plugin; attribute DOMPluginArrayConstructor PluginArray; @@ -792,9 +790,6 @@ module window { #endif #endif - attribute [Conditional=SQL_DATABASE] SQLExceptionConstructor SQLException; - - attribute DOMFormDataConstructor FormData; attribute [Conditional=BLOB|FILE_SYSTEM] FileErrorConstructor FileError; diff --git a/Source/WebCore/page/DOMWindowProperty.cpp b/Source/WebCore/page/DOMWindowProperty.cpp new file mode 100644 index 000000000..b6a9aba43 --- /dev/null +++ b/Source/WebCore/page/DOMWindowProperty.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2011 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 GOOGLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "DOMWindowProperty.h" + +#include "DOMWindow.h" +#include "Frame.h" + +namespace WebCore { + +DOMWindowProperty::DOMWindowProperty(Frame* frame) + : m_frame(frame) +{ + if (m_frame) + m_frame->domWindow()->registerProperty(this); +} + +DOMWindowProperty::~DOMWindowProperty() +{ + if (m_frame) + m_frame->domWindow()->unregisterProperty(this); +} + +void DOMWindowProperty::disconnectFrame() +{ + m_frame = 0; +} + +} diff --git a/Source/WebCore/bridge/jni/v8/JavaFieldV8.h b/Source/WebCore/page/DOMWindowProperty.h index 8f9c9822b..41baf437e 100644 --- a/Source/WebCore/bridge/jni/v8/JavaFieldV8.h +++ b/Source/WebCore/page/DOMWindowProperty.h @@ -1,19 +1,19 @@ /* - * Copyright 2010, The Android Open Source Project + * Copyright (C) 2011 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 + * 1. 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 + * 2. Redistributions in binary form must reproduce the above copyright * notice, 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 ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY * EXPRESS OR 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 + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -23,29 +23,26 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef JavaFieldV8_h -#define JavaFieldV8_h +#ifndef DOMWindowProperty_h +#define DOMWindowProperty_h -#if ENABLE(JAVA_BRIDGE) +namespace WebCore { -#include "JNIUtility.h" -#include <wtf/text/WTFString.h> +class Frame; -namespace JSC { - -namespace Bindings { - -class JavaField { +class DOMWindowProperty { public: - virtual ~JavaField() {} + explicit DOMWindowProperty(Frame*); + virtual void disconnectFrame(); - virtual String name() const = 0; -}; + Frame* frame() const { return m_frame; } -} // namespace Bindings +protected: + virtual ~DOMWindowProperty(); -} // namespace JSC + Frame* m_frame; +}; -#endif // ENABLE(JAVA_BRIDGE) +} -#endif // JavaFieldV8_h +#endif diff --git a/Source/WebCore/page/DragController.cpp b/Source/WebCore/page/DragController.cpp index 79425629b..5d834df84 100644 --- a/Source/WebCore/page/DragController.cpp +++ b/Source/WebCore/page/DragController.cpp @@ -626,6 +626,7 @@ Node* DragController::draggableNode(const Frame* src, Node* startNode, const Int if (dragMode == DRAG_AUTO) { if ((m_dragSourceAction & DragSourceActionImage) && node->hasTagName(HTMLNames::imgTag) + && src->settings() && src->settings()->loadsImagesAutomatically()) { state.m_dragType = static_cast<DragSourceAction>(state.m_dragType | DragSourceActionImage); return node; diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp index c21eb7e25..1f470537c 100644 --- a/Source/WebCore/page/EventHandler.cpp +++ b/Source/WebCore/page/EventHandler.cpp @@ -771,7 +771,7 @@ bool EventHandler::handleMouseReleaseEvent(const MouseEventWithHitTestResults& e && event.event().button() != RightButton) { VisibleSelection newSelection; Node* node = targetNode(event); - bool caretBrowsing = m_frame->settings()->caretBrowsingEnabled(); + bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBrowsingEnabled(); if (node && (caretBrowsing || node->rendererIsEditable()) && node->renderer()) { VisiblePosition pos = node->renderer()->positionForPoint(event.localPoint()); newSelection = VisibleSelection(pos); diff --git a/Source/WebCore/page/FocusController.cpp b/Source/WebCore/page/FocusController.cpp index 4f58df3ed..b18d4d14d 100644 --- a/Source/WebCore/page/FocusController.cpp +++ b/Source/WebCore/page/FocusController.cpp @@ -244,7 +244,7 @@ bool FocusController::advanceFocusInDocumentOrder(FocusDirection direction, Keyb Node* currentNode = document->focusedNode(); // FIXME: Not quite correct when it comes to focus transitions leaving/entering the WebView itself - bool caretBrowsing = focusedOrMainFrame()->settings()->caretBrowsingEnabled(); + bool caretBrowsing = frame->settings() && frame->settings()->caretBrowsingEnabled(); if (caretBrowsing && !currentNode) currentNode = frame->selection()->start().deprecatedNode(); diff --git a/Source/WebCore/page/Frame.cpp b/Source/WebCore/page/Frame.cpp index 392a473b3..e1f5bcf99 100644 --- a/Source/WebCore/page/Frame.cpp +++ b/Source/WebCore/page/Frame.cpp @@ -47,6 +47,7 @@ #include "EventNames.h" #include "FloatQuad.h" #include "FocusController.h" +#include "FrameDestructionObserver.h" #include "FrameLoader.h" #include "FrameLoaderClient.h" #include "FrameView.h" @@ -218,13 +219,6 @@ Frame::~Frame() disconnectOwnerElement(); - if (m_domWindow) - m_domWindow->disconnectFrame(); - - HashSet<DOMWindow*>::iterator end = m_liveFormerWindows.end(); - for (HashSet<DOMWindow*>::iterator it = m_liveFormerWindows.begin(); it != end; ++it) - (*it)->disconnectFrame(); - HashSet<FrameDestructionObserver*>::iterator stop = m_destructionObservers.end(); for (HashSet<FrameDestructionObserver*>::iterator it = m_destructionObservers.begin(); it != stop; ++it) (*it)->frameDestroyed(); @@ -235,24 +229,6 @@ Frame::~Frame() } } -FrameDestructionObserver::FrameDestructionObserver(Frame* frame) - : m_frame(frame) -{ - if (m_frame) - m_frame->addDestructionObserver(this); -} - -FrameDestructionObserver::~FrameDestructionObserver() -{ - if (m_frame) - m_frame->removeDestructionObserver(this); -} - -void FrameDestructionObserver::frameDestroyed() -{ - m_frame = 0; -} - void Frame::addDestructionObserver(FrameDestructionObserver* observer) { m_destructionObservers.add(observer); @@ -593,10 +569,8 @@ void Frame::injectUserScriptsForWorld(DOMWrapperWorld* world, const UserScriptVe void Frame::clearDOMWindow() { - if (m_domWindow) { - m_liveFormerWindows.add(m_domWindow.get()); + if (m_domWindow) m_domWindow->clear(); - } m_domWindow = 0; } @@ -661,10 +635,8 @@ void Frame::clearTimers() void Frame::setDOMWindow(DOMWindow* domWindow) { - if (m_domWindow) { - m_liveFormerWindows.add(m_domWindow.get()); + if (m_domWindow) m_domWindow->clear(); - } m_domWindow = domWindow; } @@ -686,11 +658,6 @@ DOMWindow* Frame::domWindow() const return m_domWindow.get(); } -void Frame::clearFormerDOMWindow(DOMWindow* window) -{ - m_liveFormerWindows.remove(window); -} - void Frame::pageDestroyed() { // FIXME: Rename this function, since it's called not only from Page destructor, but in several other cases. diff --git a/Source/WebCore/page/Frame.h b/Source/WebCore/page/Frame.h index f3600b40d..18da5f36a 100644 --- a/Source/WebCore/page/Frame.h +++ b/Source/WebCore/page/Frame.h @@ -63,7 +63,7 @@ typedef struct HBITMAP__* HBITMAP; namespace WebCore { class Document; - class Frame; + class FrameDestructionObserver; class FrameView; class HTMLTableCellElement; class RegularExpression; @@ -74,18 +74,6 @@ namespace WebCore { class TiledBackingStoreClient { }; #endif - class FrameDestructionObserver { - public: - explicit FrameDestructionObserver(Frame*); - virtual void frameDestroyed(); - Frame* frame() const { return m_frame; } - - protected: - virtual ~FrameDestructionObserver(); - - Frame* m_frame; - }; - class Frame : public RefCounted<Frame>, public TiledBackingStoreClient { public: static PassRefPtr<Frame> create(Page*, HTMLFrameOwnerElement*, FrameLoaderClient*); @@ -145,7 +133,6 @@ namespace WebCore { DOMWindow* domWindow() const; DOMWindow* existingDOMWindow() { return m_domWindow.get(); } void setDOMWindow(DOMWindow*); - void clearFormerDOMWindow(DOMWindow*); void clearDOMWindow(); static Frame* frameForWidget(const Widget*); @@ -224,7 +211,6 @@ namespace WebCore { mutable NavigationScheduler m_navigationScheduler; mutable RefPtr<DOMWindow> m_domWindow; - HashSet<DOMWindow*> m_liveFormerWindows; HTMLFrameOwnerElement* m_ownerElement; RefPtr<FrameView> m_view; diff --git a/Source/WebCore/bridge/jni/v8/JNIUtilityPrivate.h b/Source/WebCore/page/FrameDestructionObserver.cpp index 215c55957..218f9ad8c 100644 --- a/Source/WebCore/bridge/jni/v8/JNIUtilityPrivate.h +++ b/Source/WebCore/page/FrameDestructionObserver.cpp @@ -1,19 +1,19 @@ /* - * Copyright 2010, The Android Open Source Project + * Copyright (C) 2011 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 + * 1. 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 + * 2. Redistributions in binary form must reproduce the above copyright * notice, 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 ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY * EXPRESS OR 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 + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -23,28 +23,29 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef JNIUtilityPrivate_h -#define JNIUtilityPrivate_h +#include "config.h" +#include "FrameDestructionObserver.h" -#if ENABLE(JAVA_BRIDGE) +#include "Frame.h" -#include "JNIUtility.h" -#include "npruntime.h" -#include <wtf/text/WTFString.h> +namespace WebCore { -namespace JSC { +FrameDestructionObserver::FrameDestructionObserver(Frame* frame) + : m_frame(frame) +{ + if (m_frame) + m_frame->addDestructionObserver(this); +} -namespace Bindings { +FrameDestructionObserver::~FrameDestructionObserver() +{ + if (m_frame) + m_frame->removeDestructionObserver(this); +} -class JavaValue; +void FrameDestructionObserver::frameDestroyed() +{ + m_frame = 0; +} -JavaValue convertNPVariantToJavaValue(NPVariant, const String& javaClass); -void convertJavaValueToNPVariant(JavaValue, NPVariant*); - -} // namespace Bindings - -} // namespace JSC - -#endif // ENABLE(JAVA_BRIDGE) - -#endif // JNIUtilityPrivate_h +} diff --git a/Source/WebCore/bridge/jni/v8/JavaClassV8.h b/Source/WebCore/page/FrameDestructionObserver.h index e60ca2dc6..aea02223e 100644 --- a/Source/WebCore/bridge/jni/v8/JavaClassV8.h +++ b/Source/WebCore/page/FrameDestructionObserver.h @@ -1,19 +1,19 @@ /* - * Copyright 2010, The Android Open Source Project + * Copyright (C) 2011 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 + * 1. 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 + * 2. Redistributions in binary form must reproduce the above copyright * notice, 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 ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY * EXPRESS OR 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 + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -23,38 +23,25 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef JavaClassV8_h -#define JavaClassV8_h +#ifndef FrameDestructionObserver_h +#define FrameDestructionObserver_h -#if ENABLE(JAVA_BRIDGE) +namespace WebCore { -#include <wtf/HashMap.h> -#include <wtf/Vector.h> -#include <wtf/text/StringHash.h> -#include <wtf/text/WTFString.h> +class Frame; -namespace JSC { - -namespace Bindings { - -class JavaField; -class JavaMethod; - -typedef Vector<JavaMethod*> MethodList; -typedef HashMap<WTF::String, JavaField*> FieldMap; - -class JavaClass { +class FrameDestructionObserver { public: - virtual ~JavaClass() {} + explicit FrameDestructionObserver(Frame*); + virtual void frameDestroyed(); + Frame* frame() const { return m_frame; } - virtual MethodList methodsNamed(const char* name) const = 0; - virtual JavaField* fieldNamed(const char* name) const = 0; -}; - -} // namespace Bindings +protected: + virtual ~FrameDestructionObserver(); -} // namespace JSC + Frame* m_frame; +}; -#endif // ENABLE(JAVA_BRIDGE) +} -#endif // JavaClassV8_h +#endif diff --git a/Source/WebCore/page/Geolocation.cpp b/Source/WebCore/page/Geolocation.cpp index 1daea7449..2703bcd1f 100644 --- a/Source/WebCore/page/Geolocation.cpp +++ b/Source/WebCore/page/Geolocation.cpp @@ -225,7 +225,7 @@ void Geolocation::Watchers::getNotifiersVector(GeoNotifierVector& copy) const } Geolocation::Geolocation(Frame* frame) - : m_frame(frame) + : DOMWindowProperty(frame) #if !ENABLE(CLIENT_BASED_GEOLOCATION) , m_service(GeolocationService::create(this)) #endif @@ -273,7 +273,7 @@ void Geolocation::disconnectFrame() reset(); if (m_frame && m_frame->document()) m_frame->document()->setUsingGeolocation(false); - m_frame = 0; + DOMWindowProperty::disconnectFrame(); } Geoposition* Geolocation::lastPosition() @@ -762,7 +762,7 @@ void Geolocation::reset() {} void Geolocation::disconnectFrame() {} -Geolocation::Geolocation(Frame*) {} +Geolocation::Geolocation(Frame*) : DOMWindowProperty(0) {} Geolocation::~Geolocation() {} diff --git a/Source/WebCore/page/Geolocation.h b/Source/WebCore/page/Geolocation.h index b27d80b98..ea55cbf1f 100644 --- a/Source/WebCore/page/Geolocation.h +++ b/Source/WebCore/page/Geolocation.h @@ -27,6 +27,7 @@ #ifndef Geolocation_h #define Geolocation_h +#include "DOMWindowProperty.h" #include "Geoposition.h" #include "PositionCallback.h" #include "PositionError.h" @@ -47,25 +48,23 @@ class GeolocationError; #endif class Page; -class Geolocation : public RefCounted<Geolocation> +class Geolocation : public RefCounted<Geolocation>, public DOMWindowProperty #if !ENABLE(CLIENT_BASED_GEOLOCATION) && ENABLE(GEOLOCATION) , public GeolocationServiceClient #endif { public: static PassRefPtr<Geolocation> create(Frame* frame) { return adoptRef(new Geolocation(frame)); } - ~Geolocation(); + virtual void disconnectFrame() OVERRIDE; void reset(); - void disconnectFrame(); - + void getCurrentPosition(PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PassRefPtr<PositionOptions>); int watchPosition(PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PassRefPtr<PositionOptions>); void clearWatch(int watchId); void setIsAllowed(bool); - Frame* frame() const { return m_frame; } #if ENABLE(CLIENT_BASED_GEOLOCATION) void positionChanged(); @@ -79,8 +78,8 @@ private: bool isAllowed() const { return m_allowGeolocation == Yes; } bool isDenied() const { return m_allowGeolocation == No; } - - Geolocation(Frame*); + + explicit Geolocation(Frame*); Page* page() const; @@ -172,7 +171,6 @@ private: GeoNotifierSet m_oneShots; Watchers m_watchers; - Frame* m_frame; #if !ENABLE(CLIENT_BASED_GEOLOCATION) OwnPtr<GeolocationService> m_service; #endif diff --git a/Source/WebCore/page/History.cpp b/Source/WebCore/page/History.cpp index cbfc2bbdc..1f5a39f28 100644 --- a/Source/WebCore/page/History.cpp +++ b/Source/WebCore/page/History.cpp @@ -41,20 +41,10 @@ namespace WebCore { History::History(Frame* frame) - : m_frame(frame) + : DOMWindowProperty(frame) { } -Frame* History::frame() const -{ - return m_frame; -} - -void History::disconnectFrame() -{ - m_frame = 0; -} - unsigned History::length() const { if (!m_frame) diff --git a/Source/WebCore/page/History.h b/Source/WebCore/page/History.h index 9ec1914b3..bd50fccd2 100644 --- a/Source/WebCore/page/History.h +++ b/Source/WebCore/page/History.h @@ -26,6 +26,7 @@ #ifndef History_h #define History_h +#include "DOMWindowProperty.h" #include "KURL.h" #include <wtf/Forward.h> #include <wtf/PassRefPtr.h> @@ -38,12 +39,9 @@ class ScriptExecutionContext; class SerializedScriptValue; typedef int ExceptionCode; -class History : public RefCounted<History> { +class History : public RefCounted<History>, public DOMWindowProperty { public: static PassRefPtr<History> create(Frame* frame) { return adoptRef(new History(frame)); } - - Frame* frame() const; - void disconnectFrame(); unsigned length() const; void back(); @@ -61,11 +59,9 @@ public: void stateObjectAdded(PassRefPtr<SerializedScriptValue>, const String& title, const String& url, StateObjectType, ExceptionCode&); private: - History(Frame*); + explicit History(Frame*); KURL urlForState(const String& url); - - Frame* m_frame; }; } // namespace WebCore diff --git a/Source/WebCore/page/Location.cpp b/Source/WebCore/page/Location.cpp index ca6f99875..1a2d2db99 100644 --- a/Source/WebCore/page/Location.cpp +++ b/Source/WebCore/page/Location.cpp @@ -40,15 +40,10 @@ namespace WebCore { Location::Location(Frame* frame) - : m_frame(frame) + : DOMWindowProperty(frame) { } -void Location::disconnectFrame() -{ - m_frame = 0; -} - inline const KURL& Location::url() const { ASSERT(m_frame); diff --git a/Source/WebCore/page/Location.h b/Source/WebCore/page/Location.h index 3a1047a61..b882671a8 100644 --- a/Source/WebCore/page/Location.h +++ b/Source/WebCore/page/Location.h @@ -29,6 +29,7 @@ #ifndef Location_h #define Location_h +#include "DOMWindowProperty.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/text/WTFString.h> @@ -41,13 +42,10 @@ class KURL; typedef int ExceptionCode; -class Location : public RefCounted<Location> { +class Location : public RefCounted<Location>, public DOMWindowProperty { public: static PassRefPtr<Location> create(Frame* frame) { return adoptRef(new Location(frame)); } - Frame* frame() const { return m_frame; } - void disconnectFrame(); - void setHref(const String&, DOMWindow* activeWindow, DOMWindow* firstWindow); String href() const; @@ -74,11 +72,9 @@ public: String toString() const { return href(); } private: - Location(Frame*); + explicit Location(Frame*); const KURL& url() const; - - Frame* m_frame; }; } // namespace WebCore diff --git a/Source/WebCore/page/Navigator.cpp b/Source/WebCore/page/Navigator.cpp index 4926632ee..c35e99496 100644 --- a/Source/WebCore/page/Navigator.cpp +++ b/Source/WebCore/page/Navigator.cpp @@ -59,13 +59,12 @@ namespace WebCore { Navigator::Navigator(Frame* frame) - : m_frame(frame) + : DOMWindowProperty(frame) { } Navigator::~Navigator() { - disconnectFrame(); } void Navigator::resetGeolocation() @@ -74,23 +73,6 @@ void Navigator::resetGeolocation() m_geolocation->reset(); } -void Navigator::disconnectFrame() -{ - if (m_plugins) { - m_plugins->disconnectFrame(); - m_plugins = 0; - } - if (m_mimeTypes) { - m_mimeTypes->disconnectFrame(); - m_mimeTypes = 0; - } - if (m_geolocation) { - m_geolocation->disconnectFrame(); - m_geolocation = 0; - } - m_frame = 0; -} - // If this function returns true, we need to hide the substring "4." that would otherwise // appear in the appVersion string. This is to avoid problems with old versions of a // library called OpenCube QuickMenu, which as of this writing is still being used on diff --git a/Source/WebCore/page/Navigator.h b/Source/WebCore/page/Navigator.h index 84f30bde3..07c9d2b4b 100644 --- a/Source/WebCore/page/Navigator.h +++ b/Source/WebCore/page/Navigator.h @@ -20,6 +20,7 @@ #ifndef Navigator_h #define Navigator_h +#include "DOMWindowProperty.h" #include "NavigatorBase.h" #include <wtf/Forward.h> #include <wtf/PassRefPtr.h> @@ -40,14 +41,12 @@ class PluginData; typedef int ExceptionCode; -class Navigator : public NavigatorBase, public RefCounted<Navigator> { +class Navigator : public NavigatorBase, public RefCounted<Navigator>, public DOMWindowProperty { public: static PassRefPtr<Navigator> create(Frame* frame) { return adoptRef(new Navigator(frame)); } virtual ~Navigator(); void resetGeolocation(); - void disconnectFrame(); - Frame* frame() const { return m_frame; } String appVersion() const; String language() const; @@ -81,8 +80,8 @@ public: #endif private: - Navigator(Frame*); - Frame* m_frame; + explicit Navigator(Frame*); + mutable RefPtr<DOMPluginArray> m_plugins; mutable RefPtr<DOMMimeTypeArray> m_mimeTypes; mutable RefPtr<Geolocation> m_geolocation; diff --git a/Source/WebCore/page/Performance.cpp b/Source/WebCore/page/Performance.cpp index 4e130ea8f..36ddcd242 100644 --- a/Source/WebCore/page/Performance.cpp +++ b/Source/WebCore/page/Performance.cpp @@ -42,34 +42,13 @@ namespace WebCore { Performance::Performance(Frame* frame) - : m_frame(frame) + : DOMWindowProperty(frame) { } -Frame* Performance::frame() const +PassRefPtr<MemoryInfo> Performance::memory() const { - return m_frame; -} - -void Performance::disconnectFrame() -{ - if (m_memory) - m_memory = 0; - if (m_navigation) { - m_navigation->disconnectFrame(); - m_navigation = 0; - } - if (m_timing) { - m_timing->disconnectFrame(); - m_timing = 0; - } - m_frame = 0; -} - -MemoryInfo* Performance::memory() const -{ - m_memory = MemoryInfo::create(m_frame); - return m_memory.get(); + return MemoryInfo::create(m_frame); } PerformanceNavigation* Performance::navigation() const diff --git a/Source/WebCore/page/Performance.h b/Source/WebCore/page/Performance.h index be9e124e0..78263605e 100644 --- a/Source/WebCore/page/Performance.h +++ b/Source/WebCore/page/Performance.h @@ -33,6 +33,7 @@ #if ENABLE(WEB_TIMING) +#include "DOMWindowProperty.h" #include "MemoryInfo.h" #include "PerformanceNavigation.h" #include "PerformanceTiming.h" @@ -42,27 +43,23 @@ namespace WebCore { -class Performance : public RefCounted<Performance> { +class Performance : public RefCounted<Performance>, public DOMWindowProperty { public: static PassRefPtr<Performance> create(Frame* frame) { return adoptRef(new Performance(frame)); } - Frame* frame() const; - void disconnectFrame(); - - MemoryInfo* memory() const; + PassRefPtr<MemoryInfo> memory() const; PerformanceNavigation* navigation() const; PerformanceTiming* timing() const; private: - Performance(Frame*); + explicit Performance(Frame*); - mutable RefPtr<MemoryInfo> m_memory; mutable RefPtr<PerformanceNavigation> m_navigation; mutable RefPtr<PerformanceTiming> m_timing; - Frame* m_frame; }; } -#endif // !ENABLE(WEB_TIMING) -#endif // !defined(Performance_h) +#endif // ENABLE(WEB_TIMING) + +#endif // Performance_h diff --git a/Source/WebCore/page/PerformanceNavigation.cpp b/Source/WebCore/page/PerformanceNavigation.cpp index 663e942a1..d764b620b 100644 --- a/Source/WebCore/page/PerformanceNavigation.cpp +++ b/Source/WebCore/page/PerformanceNavigation.cpp @@ -40,20 +40,10 @@ namespace WebCore { PerformanceNavigation::PerformanceNavigation(Frame* frame) - : m_frame(frame) + : DOMWindowProperty(frame) { } -Frame* PerformanceNavigation::frame() const -{ - return m_frame; -} - -void PerformanceNavigation::disconnectFrame() -{ - m_frame = 0; -} - unsigned short PerformanceNavigation::type() const { if (!m_frame) diff --git a/Source/WebCore/page/PerformanceNavigation.h b/Source/WebCore/page/PerformanceNavigation.h index bdf6eaa93..f397923e6 100644 --- a/Source/WebCore/page/PerformanceNavigation.h +++ b/Source/WebCore/page/PerformanceNavigation.h @@ -33,6 +33,7 @@ #if ENABLE(WEB_TIMING) +#include "DOMWindowProperty.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> @@ -40,13 +41,10 @@ namespace WebCore { class Frame; -class PerformanceNavigation : public RefCounted<PerformanceNavigation> { +class PerformanceNavigation : public RefCounted<PerformanceNavigation>, public DOMWindowProperty { public: static PassRefPtr<PerformanceNavigation> create(Frame* frame) { return adoptRef(new PerformanceNavigation(frame)); } - Frame* frame() const; - void disconnectFrame(); - enum PerformanceNavigationType { TYPE_NAVIGATE, TYPE_RELOAD, @@ -58,9 +56,7 @@ public: unsigned short redirectCount() const; private: - PerformanceNavigation(Frame*); - - Frame* m_frame; + explicit PerformanceNavigation(Frame*); }; } diff --git a/Source/WebCore/page/PerformanceTiming.cpp b/Source/WebCore/page/PerformanceTiming.cpp index bdce07e73..6a4524b09 100644 --- a/Source/WebCore/page/PerformanceTiming.cpp +++ b/Source/WebCore/page/PerformanceTiming.cpp @@ -51,20 +51,10 @@ static unsigned long long toIntegerMilliseconds(double seconds) } PerformanceTiming::PerformanceTiming(Frame* frame) - : m_frame(frame) + : DOMWindowProperty(frame) { } -Frame* PerformanceTiming::frame() const -{ - return m_frame; -} - -void PerformanceTiming::disconnectFrame() -{ - m_frame = 0; -} - unsigned long long PerformanceTiming::navigationStart() const { DocumentLoadTiming* timing = documentLoadTiming(); diff --git a/Source/WebCore/page/PerformanceTiming.h b/Source/WebCore/page/PerformanceTiming.h index 52abd55ad..30b80b967 100644 --- a/Source/WebCore/page/PerformanceTiming.h +++ b/Source/WebCore/page/PerformanceTiming.h @@ -33,6 +33,7 @@ #if ENABLE(WEB_TIMING) +#include "DOMWindowProperty.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> @@ -44,13 +45,10 @@ struct DocumentTiming; class Frame; class ResourceLoadTiming; -class PerformanceTiming : public RefCounted<PerformanceTiming> { +class PerformanceTiming : public RefCounted<PerformanceTiming>, public DOMWindowProperty { public: static PassRefPtr<PerformanceTiming> create(Frame* frame) { return adoptRef(new PerformanceTiming(frame)); } - Frame* frame() const; - void disconnectFrame(); - unsigned long long navigationStart() const; unsigned long long unloadEventStart() const; unsigned long long unloadEventEnd() const; @@ -74,7 +72,7 @@ public: unsigned long long loadEventEnd() const; private: - PerformanceTiming(Frame*); + explicit PerformanceTiming(Frame*); const DocumentTiming* documentTiming() const; DocumentLoader* documentLoader() const; @@ -82,8 +80,6 @@ private: ResourceLoadTiming* resourceLoadTiming() const; unsigned long long resourceLoadTimeRelativeToAbsolute(int) const; unsigned long long monotonicTimeToIntegerMilliseconds(double) const; - - Frame* m_frame; }; } diff --git a/Source/WebCore/page/Screen.cpp b/Source/WebCore/page/Screen.cpp index df88fa4e9..b021e5f17 100644 --- a/Source/WebCore/page/Screen.cpp +++ b/Source/WebCore/page/Screen.cpp @@ -39,20 +39,10 @@ namespace WebCore { Screen::Screen(Frame* frame) - : m_frame(frame) + : DOMWindowProperty(frame) { } -Frame* Screen::frame() const -{ - return m_frame; -} - -void Screen::disconnectFrame() -{ - m_frame = 0; -} - unsigned Screen::horizontalDPI() const { if (!m_frame) diff --git a/Source/WebCore/page/Screen.h b/Source/WebCore/page/Screen.h index d084db788..2624f1a13 100644 --- a/Source/WebCore/page/Screen.h +++ b/Source/WebCore/page/Screen.h @@ -30,6 +30,7 @@ #ifndef Screen_h #define Screen_h +#include "DOMWindowProperty.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> @@ -37,13 +38,10 @@ namespace WebCore { class Frame; - class Screen : public RefCounted<Screen> { + class Screen : public RefCounted<Screen>, public DOMWindowProperty { public: static PassRefPtr<Screen> create(Frame *frame) { return adoptRef(new Screen(frame)); } - Frame* frame() const; - void disconnectFrame(); - unsigned horizontalDPI() const; unsigned verticalDPI() const; unsigned height() const; @@ -56,9 +54,7 @@ namespace WebCore { unsigned availWidth() const; private: - Screen(Frame*); - - Frame* m_frame; + explicit Screen(Frame*); }; } // namespace WebCore diff --git a/Source/WebCore/page/Settings.cpp b/Source/WebCore/page/Settings.cpp index 2528a2b33..403b4087f 100644 --- a/Source/WebCore/page/Settings.cpp +++ b/Source/WebCore/page/Settings.cpp @@ -192,7 +192,6 @@ Settings::Settings(Page* page) , m_privilegedWebGLExtensionsEnabled(false) , m_webAudioEnabled(false) , m_acceleratedCanvas2dEnabled(false) - , m_legacyAcceleratedCanvas2dEnabled(false) , m_loadDeferringEnabled(true) , m_tiledBackingStoreEnabled(false) , m_paginateDuringLayoutEnabled(false) @@ -810,11 +809,6 @@ void Settings::setAccelerated2dCanvasEnabled(bool enabled) m_acceleratedCanvas2dEnabled = enabled; } -void Settings::setLegacyAccelerated2dCanvasEnabled(bool enabled) -{ - m_legacyAcceleratedCanvas2dEnabled = enabled; -} - void Settings::setMinimumAccelerated2dCanvasSize(int numPixels) { m_minimumAccelerated2dCanvasSize = numPixels; diff --git a/Source/WebCore/page/Settings.h b/Source/WebCore/page/Settings.h index 27b42e0cf..edece2f1f 100644 --- a/Source/WebCore/page/Settings.h +++ b/Source/WebCore/page/Settings.h @@ -360,9 +360,6 @@ namespace WebCore { void setAccelerated2dCanvasEnabled(bool); bool accelerated2dCanvasEnabled() const { return m_acceleratedCanvas2dEnabled; } - void setLegacyAccelerated2dCanvasEnabled(bool); - bool legacyAccelerated2dCanvasEnabled() const { return m_legacyAcceleratedCanvas2dEnabled; } - // Number of pixels below which 2D canvas is rendered in software // even if hardware acceleration is enabled. // Hardware acceleration is useful for large canvases where it can avoid the @@ -612,7 +609,6 @@ namespace WebCore { bool m_privilegedWebGLExtensionsEnabled : 1; bool m_webAudioEnabled : 1; bool m_acceleratedCanvas2dEnabled : 1; - bool m_legacyAcceleratedCanvas2dEnabled : 1; bool m_loadDeferringEnabled : 1; bool m_tiledBackingStoreEnabled : 1; bool m_paginateDuringLayoutEnabled : 1; diff --git a/Source/WebCore/page/mac/FrameMac.mm b/Source/WebCore/page/mac/FrameMac.mm index 234627858..1c835afac 100644 --- a/Source/WebCore/page/mac/FrameMac.mm +++ b/Source/WebCore/page/mac/FrameMac.mm @@ -113,21 +113,17 @@ NSImage *Frame::rangeImage(Range* range, bool forceBlackText) const if (!view) return nil; - VisibleSelection visibleSelection(range); - - if (!visibleSelection.isRange()) - return nil; - - Position start = visibleSelection.start(); + Position start = range->startPosition(); Position candidate = start.downstream(); - if (candidate.isCandidate()) + if (candidate.deprecatedNode() && candidate.deprecatedNode()->renderer()) start = candidate; - Position end = visibleSelection.end(); + + Position end = range->endPosition(); candidate = end.upstream(); - if (candidate.isCandidate()) + if (candidate.deprecatedNode() && candidate.deprecatedNode()->renderer()) end = candidate; - if (start.isNull() || end.isNull() || visibleSelection.visibleStart() == visibleSelection.visibleEnd()) + if (start.isNull() || end.isNull() || start == end) return nil; RenderObject* savedStartRenderer; @@ -137,7 +133,12 @@ NSImage *Frame::rangeImage(Range* range, bool forceBlackText) const view->getSelection(savedStartRenderer, savedStartOffset, savedEndRenderer, savedEndOffset); RenderObject* startRenderer = start.deprecatedNode()->renderer(); + if (!startRenderer) + return nil; + RenderObject* endRenderer = end.deprecatedNode()->renderer(); + if (!endRenderer) + return nil; view->setSelection(startRenderer, start.deprecatedEditingOffset(), endRenderer, end.deprecatedEditingOffset(), RenderView::RepaintNothing); NSImage* result = imageFromRect(view->selectionBounds()); diff --git a/Source/WebCore/platform/KURL.cpp b/Source/WebCore/platform/KURL.cpp index 9eb1e2fc5..2408cc2b4 100644 --- a/Source/WebCore/platform/KURL.cpp +++ b/Source/WebCore/platform/KURL.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2007, 2008, 2011 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2007, 2008, 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -1050,6 +1050,8 @@ void KURL::parse(const String& string) parse(buffer.data(), &string); } +// FIXME: (lenA != lenB) is never true in the way this function is used. +// FIXME: This is only used for short string, we should replace equal() by a recursive template comparing the strings without loop. static inline bool equal(const char* a, size_t lenA, const char* b, size_t lenB) { if (lenA != lenB) @@ -1104,6 +1106,23 @@ static bool isNonFileHierarchicalScheme(const char* scheme, size_t schemeLength) return false; } +static bool isCanonicalHostnameLowercaseForScheme(const char* scheme, size_t schemeLength) +{ + switch (schemeLength) { + case 2: + return equal("ws", 2, scheme, schemeLength); + case 3: + return equal("ftp", 3, scheme, schemeLength) || equal("wss", 3, scheme, schemeLength); + case 4: + return equal("http", 4, scheme, schemeLength) || equal("file", 4, scheme, schemeLength); + case 5: + return equal("https", 5, scheme, schemeLength); + case 6: + return equal("gopher", 6, scheme, schemeLength); + } + return false; +} + void KURL::parse(const char* url, const String* originalString) { if (!url || url[0] == '\0') { @@ -1344,8 +1363,13 @@ void KURL::parse(const char* url, const String* originalString) if (!(isFile && hostIsLocalHost && !haveNonHostAuthorityPart)) { strPtr = url + hostStart; const char* hostEndPtr = url + hostEnd; - while (strPtr < hostEndPtr) - *p++ = *strPtr++; + if (isCanonicalHostnameLowercaseForScheme(buffer.data(), m_schemeEnd)) { + while (strPtr < hostEndPtr) + *p++ = toASCIILower(*strPtr++); + } else { + while (strPtr < hostEndPtr) + *p++ = *strPtr++; + } } m_hostEnd = p - buffer.data(); diff --git a/Source/WebCore/platform/audio/AudioBus.cpp b/Source/WebCore/platform/audio/AudioBus.cpp index d14305e29..800197e2d 100644 --- a/Source/WebCore/platform/audio/AudioBus.cpp +++ b/Source/WebCore/platform/audio/AudioBus.cpp @@ -244,8 +244,7 @@ void AudioBus::sumFrom(const AudioBus &sourceBus) GAIN_DEZIPPER \ } \ gain = totalDesiredGain; \ - for (; k < framesToProcess; ++k) \ - OP + OP##_V #define STEREO_SUM \ { \ @@ -255,6 +254,11 @@ void AudioBus::sumFrom(const AudioBus &sourceBus) *destinationR++ = sumR; \ } +// FIXME: this can be optimized with additional VectorMath functions. +#define STEREO_SUM_V \ + for (; k < framesToProcess; ++k) \ + STEREO_SUM + // Mono -> stereo (mix equally into L and R) // FIXME: Really we should apply an equal-power scaling factor here, since we're effectively panning center... #define MONO2STEREO_SUM \ @@ -266,12 +270,20 @@ void AudioBus::sumFrom(const AudioBus &sourceBus) *destinationR++ = sumR; \ } +#define MONO2STEREO_SUM_V \ + for (; k < framesToProcess; ++k) \ + MONO2STEREO_SUM + #define MONO_SUM \ { \ float sum = DenormalDisabler::flushDenormalFloatToZero(*destinationL + gain * *sourceL++); \ *destinationL++ = sum; \ } +#define MONO_SUM_V \ + for (; k < framesToProcess; ++k) \ + MONO_SUM + #define STEREO_NO_SUM \ { \ float sampleL = *sourceL++; \ @@ -280,6 +292,12 @@ void AudioBus::sumFrom(const AudioBus &sourceBus) *destinationR++ = DenormalDisabler::flushDenormalFloatToZero(gain * sampleR); \ } +#define STEREO_NO_SUM_V \ + { \ + vsmul(sourceL, 1, &gain, destinationL, 1, framesToProcess - k); \ + vsmul(sourceR, 1, &gain, destinationR, 1, framesToProcess - k); \ + } + // Mono -> stereo (mix equally into L and R) // FIXME: Really we should apply an equal-power scaling factor here, since we're effectively panning center... #define MONO2STEREO_NO_SUM \ @@ -289,18 +307,28 @@ void AudioBus::sumFrom(const AudioBus &sourceBus) *destinationR++ = DenormalDisabler::flushDenormalFloatToZero(gain * sample); \ } +#define MONO2STEREO_NO_SUM_V \ + { \ + vsmul(sourceL, 1, &gain, destinationL, 1, framesToProcess - k); \ + vsmul(sourceL, 1, &gain, destinationR, 1, framesToProcess - k); \ + } + #define MONO_NO_SUM \ { \ float sampleL = *sourceL++; \ *destinationL++ = DenormalDisabler::flushDenormalFloatToZero(gain * sampleL); \ } +#define MONO_NO_SUM_V \ + { \ + vsmul(sourceL, 1, &gain, destinationL, 1, framesToProcess - k); \ + } + void AudioBus::processWithGainFromMonoStereo(const AudioBus &sourceBus, double* lastMixGain, double targetGain, bool sumToBus) { // We don't want to suddenly change the gain from mixing one time slice to the next, // so we "de-zipper" by slowly changing the gain each sample-frame until we've achieved the target gain. - // FIXME: optimize this method (SSE, etc.) // FIXME: targetGain and lastMixGain should be changed to floats instead of doubles. // Take master bus gain into account as well as the targetGain. @@ -351,8 +379,6 @@ void AudioBus::processWithGainFromMonoStereo(const AudioBus &sourceBus, double* if (this == &sourceBus && *lastMixGain == targetGain && targetGain == 1.0) return; - // FIXME: if (framesToDezipper == 0) and DenormalDisabler::flushDenormalFloatToZero() is a NOP (gcc vs. Visual Studio) - // then we can further optimize the PROCESS_WITH_GAIN codepaths below using vsmul(). if (sourceR && destinationR) { // Stereo PROCESS_WITH_GAIN(STEREO_NO_SUM) diff --git a/Source/WebCore/platform/audio/Reverb.cpp b/Source/WebCore/platform/audio/Reverb.cpp index b6204fff7..2b787ebf3 100644 --- a/Source/WebCore/platform/audio/Reverb.cpp +++ b/Source/WebCore/platform/audio/Reverb.cpp @@ -87,16 +87,23 @@ static double calculateNormalizationScale(AudioBus* response) return scale; } -Reverb::Reverb(AudioBus* impulseResponse, size_t renderSliceSize, size_t maxFFTSize, size_t numberOfChannels, bool useBackgroundThreads) +Reverb::Reverb(AudioBus* impulseResponse, size_t renderSliceSize, size_t maxFFTSize, size_t numberOfChannels, bool useBackgroundThreads, bool normalize) { - double scale = calculateNormalizationScale(impulseResponse); - if (scale) - impulseResponse->scale(scale); + double scale = 1; + + if (normalize) { + scale = calculateNormalizationScale(impulseResponse); + + if (scale) + impulseResponse->scale(scale); + } initialize(impulseResponse, renderSliceSize, maxFFTSize, numberOfChannels, useBackgroundThreads); - // Undo scaling since this shouldn't be a destructive operation on impulseResponse - if (scale) + // Undo scaling since this shouldn't be a destructive operation on impulseResponse. + // FIXME: What about roundoff? Perhaps consider making a temporary scaled copy + // instead of scaling and unscaling in place. + if (normalize && scale) impulseResponse->scale(1.0 / scale); } diff --git a/Source/WebCore/platform/audio/Reverb.h b/Source/WebCore/platform/audio/Reverb.h index 26f5f8e64..f162e0b70 100644 --- a/Source/WebCore/platform/audio/Reverb.h +++ b/Source/WebCore/platform/audio/Reverb.h @@ -43,7 +43,7 @@ public: enum { MaxFrameSize = 256 }; // renderSliceSize is a rendering hint, so the FFTs can be optimized to not all occur at the same time (very bad when rendering on a real-time thread). - Reverb(AudioBus* impulseResponseBuffer, size_t renderSliceSize, size_t maxFFTSize, size_t numberOfChannels, bool useBackgroundThreads); + Reverb(AudioBus* impulseResponseBuffer, size_t renderSliceSize, size_t maxFFTSize, size_t numberOfChannels, bool useBackgroundThreads, bool normalize); void process(AudioBus* sourceBus, AudioBus* destinationBus, size_t framesToProcess); void reset(); diff --git a/Source/WebCore/platform/chromium/PasteboardChromium.cpp b/Source/WebCore/platform/chromium/PasteboardChromium.cpp index f6908de89..26a9f101f 100644 --- a/Source/WebCore/platform/chromium/PasteboardChromium.cpp +++ b/Source/WebCore/platform/chromium/PasteboardChromium.cpp @@ -182,10 +182,12 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefP unsigned fragmentEnd = 0; PlatformSupport::clipboardReadHTML(buffer, &markup, &srcURL, &fragmentStart, &fragmentEnd); - RefPtr<DocumentFragment> fragment = - createFragmentFromMarkupWithContext(frame->document(), markup, fragmentStart, fragmentEnd, srcURL, FragmentScriptingNotAllowed); - if (fragment) - return fragment.release(); + if (!markup.isEmpty()) { + RefPtr<DocumentFragment> fragment = + createFragmentFromMarkupWithContext(frame->document(), markup, fragmentStart, fragmentEnd, srcURL, FragmentScriptingNotAllowed); + if (fragment) + return fragment.release(); + } } if (allowPlainText) { diff --git a/Source/WebCore/platform/graphics/Font.cpp b/Source/WebCore/platform/graphics/Font.cpp index 445d1d085..c2d9c58c3 100644 --- a/Source/WebCore/platform/graphics/Font.cpp +++ b/Source/WebCore/platform/graphics/Font.cpp @@ -404,12 +404,22 @@ Font::CodePath Font::codePath(const TextRun& run) const if (supplementaryCharacter <= 0x1F1FF) return Complex; + if (supplementaryCharacter < 0xE0100) // U+E0100 through U+E01EF Unicode variation selectors. + continue; + if (supplementaryCharacter <= 0xE01EF) + return Complex; + // FIXME: Check for Brahmi (U+11000 block), Kaithi (U+11080 block) and other complex scripts // in plane 1 or higher. continue; } + if (c < 0xFE00) // U+FE00 through U+FE0F Unicode variation selectors + continue; + if (c <= 0xFE0F) + return Complex; + if (c < 0xFE20) // U+FE20 through U+FE2F Combining half marks continue; if (c <= 0xFE2F) diff --git a/Source/WebCore/platform/graphics/Font.h b/Source/WebCore/platform/graphics/Font.h index 11484db61..9a7a86213 100644 --- a/Source/WebCore/platform/graphics/Font.h +++ b/Source/WebCore/platform/graphics/Font.h @@ -116,7 +116,20 @@ public: TypesettingFeatures typesettingFeatures() const { TextRenderingMode textRenderingMode = m_fontDescription.textRenderingMode(); - return textRenderingMode == OptimizeLegibility || textRenderingMode == GeometricPrecision ? Kerning | Ligatures : 0; + TypesettingFeatures features = textRenderingMode == OptimizeLegibility || textRenderingMode == GeometricPrecision ? Kerning | Ligatures : 0; + + switch (m_fontDescription.kerning()) { + case FontDescription::NoneKerning: + features &= ~Kerning; + break; + case FontDescription::NormalKerning: + features |= Kerning; + break; + case FontDescription::AutoKerning: + break; + } + + return features; } FontFamily& firstFamily() { return m_fontDescription.firstFamily(); } diff --git a/Source/WebCore/platform/graphics/FontDescription.h b/Source/WebCore/platform/graphics/FontDescription.h index 71ca2180b..51a257b41 100644 --- a/Source/WebCore/platform/graphics/FontDescription.h +++ b/Source/WebCore/platform/graphics/FontDescription.h @@ -72,6 +72,8 @@ public: enum GenericFamilyType { NoFamily, StandardFamily, SerifFamily, SansSerifFamily, MonospaceFamily, CursiveFamily, FantasyFamily, PictographFamily }; + enum Kerning { AutoKerning, NormalKerning, NoneKerning }; + FontDescription() : m_specifiedSize(0) , m_computedSize(0) @@ -85,6 +87,7 @@ public: , m_genericFamily(NoFamily) , m_usePrinterFont(false) , m_renderingMode(NormalRenderingMode) + , m_kerning(AutoKerning) , m_keywordSize(0) , m_fontSmoothing(AutoSmoothing) , m_textRendering(AutoTextRendering) @@ -112,6 +115,7 @@ public: // only use fixed default size when there is only one font family, and that family is "monospace" bool useFixedDefaultSize() const { return genericFamily() == MonospaceFamily && !family().next() && family().family() == monospaceFamily; } FontRenderingMode renderingMode() const { return static_cast<FontRenderingMode>(m_renderingMode); } + Kerning kerning() const { return static_cast<Kerning>(m_kerning); } unsigned keywordSize() const { return m_keywordSize; } FontSmoothingMode fontSmoothing() const { return static_cast<FontSmoothingMode>(m_fontSmoothing); } TextRenderingMode textRenderingMode() const { return static_cast<TextRenderingMode>(m_textRendering); } @@ -141,6 +145,7 @@ public: void setUsePrinterFont(bool p) { m_usePrinterFont = p; } #endif void setRenderingMode(FontRenderingMode mode) { m_renderingMode = mode; } + void setKerning(Kerning kerning) { m_kerning = kerning; } void setKeywordSize(unsigned s) { m_keywordSize = s; } void setFontSmoothing(FontSmoothingMode smoothing) { m_fontSmoothing = smoothing; } void setTextRenderingMode(TextRenderingMode rendering) { m_textRendering = rendering; } @@ -173,6 +178,7 @@ private: bool m_usePrinterFont : 1; unsigned m_renderingMode : 1; // Used to switch between CG and GDI text on Windows. + unsigned m_kerning : 2; // Kerning unsigned m_keywordSize : 4; // We cache whether or not a font is currently represented by a CSS keyword (e.g., medium). If so, // then we can accurately translate across different generic families to adjust for different preference settings @@ -196,6 +202,7 @@ inline bool FontDescription::operator==(const FontDescription& other) const && m_genericFamily == other.m_genericFamily && m_usePrinterFont == other.m_usePrinterFont && m_renderingMode == other.m_renderingMode + && m_kerning == other.m_kerning && m_keywordSize == other.m_keywordSize && m_fontSmoothing == other.m_fontSmoothing && m_textRendering == other.m_textRendering diff --git a/Source/WebCore/platform/graphics/ImageBuffer.h b/Source/WebCore/platform/graphics/ImageBuffer.h index 7df134280..13070004c 100644 --- a/Source/WebCore/platform/graphics/ImageBuffer.h +++ b/Source/WebCore/platform/graphics/ImageBuffer.h @@ -59,6 +59,7 @@ namespace WebCore { enum RenderingMode { Unaccelerated, + UnacceleratedNonPlatformBuffer, // Use plain memory allocation rather than platform API to allocate backing store. Accelerated }; diff --git a/Source/WebCore/platform/graphics/Path.h b/Source/WebCore/platform/graphics/Path.h index 3d1e7b12c..d14d90879 100644 --- a/Source/WebCore/platform/graphics/Path.h +++ b/Source/WebCore/platform/graphics/Path.h @@ -80,13 +80,16 @@ namespace WebCore { class StrokeStyleApplier; enum PathElementType { - PathElementMoveToPoint, - PathElementAddLineToPoint, - PathElementAddQuadCurveToPoint, - PathElementAddCurveToPoint, - PathElementCloseSubpath + PathElementMoveToPoint, // The points member will contain 1 value. + PathElementAddLineToPoint, // The points member will contain 1 value. + PathElementAddQuadCurveToPoint, // The points member will contain 2 values. + PathElementAddCurveToPoint, // The points member will contain 3 values. + PathElementCloseSubpath // The points member will contain no values. }; + // The points in the sturcture are the same as those that would be used with the + // add... method. For example, a line returns the endpoint, while a cubic returns + // two tangent points and the endpoint. struct PathElement { PathElementType type; FloatPoint* points; diff --git a/Source/WebCore/platform/graphics/SimpleFontData.h b/Source/WebCore/platform/graphics/SimpleFontData.h index de4a56bb8..dd86f004e 100644 --- a/Source/WebCore/platform/graphics/SimpleFontData.h +++ b/Source/WebCore/platform/graphics/SimpleFontData.h @@ -158,7 +158,6 @@ public: const GlyphData& missingGlyphData() const { return m_missingGlyphData; } void setMissingGlyphData(const GlyphData& glyphData) { m_missingGlyphData = glyphData; } - void updateGlyphWithVariationSelector(UChar32 character, UChar32 selector, Glyph&) const; #ifndef NDEBUG virtual String description() const; diff --git a/Source/WebCore/platform/graphics/SurrogatePairAwareTextIterator.cpp b/Source/WebCore/platform/graphics/SurrogatePairAwareTextIterator.cpp index 119b3a428..ac0bae306 100644 --- a/Source/WebCore/platform/graphics/SurrogatePairAwareTextIterator.cpp +++ b/Source/WebCore/platform/graphics/SurrogatePairAwareTextIterator.cpp @@ -32,21 +32,6 @@ using namespace Unicode; namespace WebCore { -inline static bool isUnicodeBMPVariationSelector(UChar character) -{ - return (0x180B <= character && character <= 0x180D) || (0xFE00 <= character && character <= 0xFE0F); -} - -inline static bool isUnicodeSupplementaryVariationSelector(UChar lead, UChar trail) -{ - // A non-BMP variation selector character is in the range of U+E0100 to U+E01EF. - // It can be a surrogate pair in which the high surrogate is 0xDB40 and - // the low surrogate is in the range of U16_TRAIL(0xE0100 - 0x10000) to U16_TRAIL(0xE01EF - 0x10000). - static const UChar trailStart = U16_TRAIL(0xE0100 - 0x10000); - static const UChar trailEnd = U16_TRAIL(0xE01EF - 0x10000); - return lead == 0xDB40 && trailStart <= trail && trail <= trailEnd; -} - SurrogatePairAwareTextIterator::SurrogatePairAwareTextIterator(const UChar* characters, int currentCharacter, int lastCharacter, int endCharacter) : m_characters(characters) , m_currentCharacter(currentCharacter) @@ -98,21 +83,6 @@ bool SurrogatePairAwareTextIterator::consume(UChar32& character, unsigned& clust return true; } -bool SurrogatePairAwareTextIterator::hasTrailingVariationSelector(UChar32& selector, unsigned& clusterLength) -{ - if (static_cast<int>(m_currentCharacter + clusterLength) < m_endCharacter && isUnicodeBMPVariationSelector(m_characters[clusterLength])) { - selector = m_characters[clusterLength]; - clusterLength += 1; - return true; - } - if (static_cast<int>(m_currentCharacter + clusterLength + 1) < m_endCharacter && isUnicodeSupplementaryVariationSelector(m_characters[clusterLength], m_characters[clusterLength + 1])) { - selector = U16_GET_SUPPLEMENTARY(m_characters[clusterLength], m_characters[clusterLength + 1]); - clusterLength += 2; - return true; - } - return false; -} - void SurrogatePairAwareTextIterator::advance(unsigned advanceLength) { m_characters += advanceLength; diff --git a/Source/WebCore/platform/graphics/SurrogatePairAwareTextIterator.h b/Source/WebCore/platform/graphics/SurrogatePairAwareTextIterator.h index 8dcea8d76..1d56eb8b2 100644 --- a/Source/WebCore/platform/graphics/SurrogatePairAwareTextIterator.h +++ b/Source/WebCore/platform/graphics/SurrogatePairAwareTextIterator.h @@ -32,7 +32,6 @@ public: SurrogatePairAwareTextIterator(const UChar*, int currentCharacter, int lastCharacter, int endCharacter); bool consume(UChar32& character, unsigned& clusterLength); - bool hasTrailingVariationSelector(UChar32& selector, unsigned& clusterLength); void advance(unsigned advanceLength); int currentCharacter() const { return m_currentCharacter; } diff --git a/Source/WebCore/platform/graphics/WidthIterator.cpp b/Source/WebCore/platform/graphics/WidthIterator.cpp index 06826bef3..d749a4f46 100644 --- a/Source/WebCore/platform/graphics/WidthIterator.cpp +++ b/Source/WebCore/platform/graphics/WidthIterator.cpp @@ -115,13 +115,6 @@ unsigned WidthIterator::advance(int offset, GlyphBuffer* glyphBuffer) ASSERT(fontData); - // If a variation selector follows, update glyph with the selector if possible. - UChar32 selector = 0; - if (textIterator.hasTrailingVariationSelector(selector, clusterLength)) { - fontData->updateGlyphWithVariationSelector(character, selector, glyph); - advanceLength = clusterLength; - } - // Now that we have a glyph and font data, get its width. float width; if (character == '\t' && m_run.allowTabs()) { diff --git a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp b/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp index f9e4afb24..e73272ded 100644 --- a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp +++ b/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp @@ -2181,10 +2181,8 @@ bool GraphicsLayerCA::requiresTiledLayer(float pageScaleFactor) const if (!m_drawsContent || !m_allowTiledLayer || m_layer->layerType() == PlatformCALayer::LayerTypeTileCacheLayer) return false; - float contentsScale = pageScaleFactor * deviceScaleFactor(); - // FIXME: catch zero-size height or width here (or earlier)? - return m_size.width() * contentsScale > cMaxPixelDimension || m_size.height() * contentsScale > cMaxPixelDimension; + return m_size.width() * pageScaleFactor > cMaxPixelDimension || m_size.height() * pageScaleFactor > cMaxPixelDimension; } void GraphicsLayerCA::swapFromOrToTiledLayer(bool useTiledLayer, float pageScaleFactor, const FloatPoint& positionRelativeToBase) diff --git a/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm b/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm index edf3ffd0d..34c9710d9 100644 --- a/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm +++ b/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm @@ -29,6 +29,7 @@ #import "PlatformCALayer.h" +#import "AnimationUtilities.h" #import "BlockExceptions.h" #import "FloatConversion.h" #import "GraphicsContext.h" @@ -44,6 +45,9 @@ #define HAVE_MODERN_QUARTZCORE (!defined(BUILDING_ON_LEOPARD)) +using std::min; +using std::max; + using namespace WebCore; // This value must be the same as in PlatformCAAnimationMac.mm @@ -746,9 +750,18 @@ void PlatformCALayer::setFilters(const FilterOperations& filters) } case FilterOperation::SEPIA: { const BasicColorMatrixFilterOperation* op = static_cast<const BasicColorMatrixFilterOperation*>(filterOperation); - CIFilter* caFilter = [CIFilter filterWithName:@"CISepiaTone"]; + CIFilter* caFilter = [CIFilter filterWithName:@"CIColorMatrix"]; [caFilter setDefaults]; - [caFilter setValue:[NSNumber numberWithFloat:op->amount()] forKey:@"inputIntensity"]; + + double t = op->amount(); + t = min(max(0.0, t), 1.0); + + // FIXME: Should put these values into constants (https://bugs.webkit.org/show_bug.cgi?id=76008) + [caFilter setValue:[CIVector vectorWithX:WebCore::blend(1.0, 0.393, t) Y:WebCore::blend(0.0, 0.769, t) Z:WebCore::blend(0.0, 0.189, t) W:0] forKey:@"inputRVector"]; + [caFilter setValue:[CIVector vectorWithX:WebCore::blend(0.0, 0.349, t) Y:WebCore::blend(1.0, 0.686, t) Z:WebCore::blend(0.0, 0.168, t) W:0] forKey:@"inputGVector"]; + [caFilter setValue:[CIVector vectorWithX:WebCore::blend(0.0, 0.272, t) Y:WebCore::blend(0.0, 0.534, t) Z:WebCore::blend(1.0, 0.131, t) W:0] forKey:@"inputBVector"]; + [caFilter setValue:[CIVector vectorWithX:0 Y:0 Z:0 W:1] forKey:@"inputAVector"]; + [caFilter setValue:[CIVector vectorWithX:0 Y:0 Z:0 W:0] forKey:@"inputBiasVector"]; [caFilter setName:@"sepiaFilter"]; [array.get() addObject:caFilter]; break; diff --git a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp index ee87f5327..20ffba646 100644 --- a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp +++ b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp @@ -527,8 +527,9 @@ void GraphicsContext::clipConvexPolygon(size_t numberOfPoints, const FloatPoint* void GraphicsContext::applyStrokePattern() { CGContextRef cgContext = platformContext(); + AffineTransform userToBaseCTM = AffineTransform(wkGetUserToBaseCTM(cgContext)); - RetainPtr<CGPatternRef> platformPattern(AdoptCF, m_state.strokePattern->createPlatformPattern(getCTM())); + RetainPtr<CGPatternRef> platformPattern(AdoptCF, m_state.strokePattern->createPlatformPattern(userToBaseCTM)); if (!platformPattern) return; @@ -542,8 +543,9 @@ void GraphicsContext::applyStrokePattern() void GraphicsContext::applyFillPattern() { CGContextRef cgContext = platformContext(); + AffineTransform userToBaseCTM = AffineTransform(wkGetUserToBaseCTM(cgContext)); - RetainPtr<CGPatternRef> platformPattern(AdoptCF, m_state.fillPattern->createPlatformPattern(getCTM())); + RetainPtr<CGPatternRef> platformPattern(AdoptCF, m_state.fillPattern->createPlatformPattern(userToBaseCTM)); if (!platformPattern) return; @@ -1253,8 +1255,7 @@ AffineTransform GraphicsContext::getCTM() const if (paintingDisabled()) return AffineTransform(); - CGAffineTransform t = CGContextGetCTM(platformContext()); - return AffineTransform(t.a, t.b, t.c, t.d, t.tx, t.ty); + return AffineTransform(CGContextGetCTM(platformContext())); } FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect, RoundingMode roundingMode) diff --git a/Source/WebCore/platform/graphics/cg/TransformationMatrixCG.cpp b/Source/WebCore/platform/graphics/cg/TransformationMatrixCG.cpp index b49a2ab38..dd60cfca0 100644 --- a/Source/WebCore/platform/graphics/cg/TransformationMatrixCG.cpp +++ b/Source/WebCore/platform/graphics/cg/TransformationMatrixCG.cpp @@ -54,6 +54,11 @@ TransformationMatrix::operator CGAffineTransform() const narrowPrecisionToCGFloat(f())); } +AffineTransform::AffineTransform(const CGAffineTransform& t) +{ + setMatrix(t.a, t.b, t.c, t.d, t.tx, t.ty); +} + AffineTransform::operator CGAffineTransform() const { return CGAffineTransformMake(narrowPrecisionToCGFloat(a()), diff --git a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h index fa64818ad..153dd2c3c 100644 --- a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h @@ -37,7 +37,9 @@ namespace WebCore { class LayerPainterChromium; -// A CanvasLayerTextureUpdater with an internal bitmap. +// This class rasterizes the contentRect into a PlatformCanvas. It then updates +// textures by copying from the canvas into the texture, using MapSubImage if +// possible. class BitmapCanvasLayerTextureUpdater : public CanvasLayerTextureUpdater { public: class Texture : public LayerTextureUpdater::Texture { diff --git a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h index e5163c202..6f2f10d9b 100644 --- a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h @@ -36,6 +36,8 @@ namespace WebCore { +// This class records the contentRect into an SkPicture, then software rasterizes +// the SkPicture into bitmaps for each tile. This implements CCSettings::perTilePainting. class BitmapSkPictureCanvasLayerTextureUpdater : public SkPictureCanvasLayerTextureUpdater { public: class Texture : public CanvasLayerTextureUpdater::Texture { diff --git a/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.h index a8feff342..4415f6986 100644 --- a/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.h @@ -36,7 +36,9 @@ namespace WebCore { class GraphicsContext3D; class LayerPainterChromium; -// A LayerTextureUpdater with an internal canvas. +// Base class for BitmapCanvasLayerTextureUpdater and +// SkPictureCanvasLayerTextureUpdater that reduces code duplication between +// their respective paintContents implementations. class CanvasLayerTextureUpdater : public LayerTextureUpdater { public: virtual ~CanvasLayerTextureUpdater(); diff --git a/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h index 1b1d11bfa..4a10c858e 100644 --- a/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h @@ -34,6 +34,9 @@ namespace WebCore { +// This class records the contentRect into an SkPicture, then uses accelerated +// drawing to update the texture. The accelerated drawing goes to an +// intermediate framebuffer and then is copied to the destination texture once done. class FrameBufferSkPictureCanvasLayerTextureUpdater : public SkPictureCanvasLayerTextureUpdater { public: class Texture : public LayerTextureUpdater::Texture { diff --git a/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp index 1d6294964..a0fb35f02 100644 --- a/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp @@ -189,7 +189,9 @@ bool ImageLayerChromium::drawsContent() const void ImageLayerChromium::createTextureUpdater(const CCLayerTreeHost* host) { - m_textureUpdater = ImageLayerTextureUpdater::create(host->layerRendererCapabilities().usingMapSub); + // Avoid creating a new texture updater which would not have a valid copy of the current image. + if (!m_textureUpdater) + m_textureUpdater = ImageLayerTextureUpdater::create(host->layerRendererCapabilities().usingMapSub); } bool ImageLayerChromium::needsContentsScale() const diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp index daeb97f9a..933e78253 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp @@ -435,13 +435,14 @@ void LayerRendererChromium::drawDebugBorderQuad(const CCDebugBorderDrawQuad* qua ASSERT(program && program->initialized()); GLC(context(), context()->useProgram(program->program())); - TransformationMatrix renderMatrix = quad->layerTransform(); const IntRect& layerRect = quad->quadRect(); + TransformationMatrix renderMatrix = quad->quadTransform(); + renderMatrix.translate(0.5 * layerRect.width() + layerRect.x(), 0.5 * layerRect.height() + layerRect.y()); renderMatrix.scaleNonUniform(layerRect.width(), layerRect.height()); LayerRendererChromium::toGLMatrix(&glMatrix[0], projectionMatrix() * renderMatrix); GLC(context(), context()->uniformMatrix4fv(program->vertexShader().matrixLocation(), false, &glMatrix[0], 1)); - GLC(context(), context()->uniform4f(program->fragmentShader().colorLocation(), quad->color().red() / 255.0, quad->color().green() / 255.0, quad->color().blue() / 255.0, 1)); + GLC(context(), context()->uniform4f(program->fragmentShader().colorLocation(), quad->color().red() / 255.0, quad->color().green() / 255.0, quad->color().blue() / 255.0, quad->color().alpha() / 255.0)); GLC(context(), context()->lineWidth(quad->width())); @@ -679,11 +680,9 @@ void LayerRendererChromium::finishDrawingFrame() size_t contentsMemoryUseBytes = m_contentsTextureAllocator->currentMemoryUseBytes(); size_t reclaimLimit = TextureManager::reclaimLimitBytes(viewportSize()); - if (reclaimLimit > contentsMemoryUseBytes) - m_renderSurfaceTextureManager->setPreferredMemoryLimitBytes(reclaimLimit - contentsMemoryUseBytes); - else - m_renderSurfaceTextureManager->setPreferredMemoryLimitBytes(0); - + size_t preferredLimit = reclaimLimit > contentsMemoryUseBytes ? reclaimLimit - contentsMemoryUseBytes : 0; + m_renderSurfaceTextureManager->setPreferredMemoryLimitBytes(preferredLimit); + m_renderSurfaceTextureManager->reduceMemoryToLimit(preferredLimit); m_renderSurfaceTextureManager->deleteEvictedTextures(m_renderSurfaceTextureAllocator.get()); if (settings().compositeOffscreen) diff --git a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h index 93e8d86c6..4e1822b31 100644 --- a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h +++ b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h @@ -96,6 +96,11 @@ private: TransformationMatrix m_originTransform; IntRect m_clipRect; Vector<RefPtr<LayerChromium> > m_layerList; + + // For CCLayerIteratorActions + int m_targetRenderSurfaceLayerIndexHistory; + int m_currentLayerIndexHistory; + friend struct CCLayerIteratorActions; }; } diff --git a/Source/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp b/Source/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp index 9681746ba..78ad56af9 100644 --- a/Source/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp +++ b/Source/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp @@ -199,9 +199,4 @@ float SimpleFontData::platformWidthForGlyph(Glyph glyph) const return static_cast<float>(width); } -void SimpleFontData::updateGlyphWithVariationSelector(UChar32 character, UChar32 selector, Glyph& glyph) const -{ - // FIXME: Implement. -} - } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.h index 440f8b03e..95b78c3b9 100644 --- a/Source/WebCore/platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.h @@ -39,6 +39,11 @@ namespace WebCore { class LayerPainterChromium; +// This class records the contentRect into an SkPicture. Subclasses, provide +// different implementations of tile updating based on this recorded picture. +// The BitmapSkPictureCanvasLayerTextureUpdater and +// FrameBufferSkPictureCanvasLayerTextureUpdater are two examples of such +// implementations. class SkPictureCanvasLayerTextureUpdater : public CanvasLayerTextureUpdater { public: virtual ~SkPictureCanvasLayerTextureUpdater(); diff --git a/Source/WebCore/platform/graphics/chromium/TextureManager.cpp b/Source/WebCore/platform/graphics/chromium/TextureManager.cpp index 30207be38..516cea90a 100644 --- a/Source/WebCore/platform/graphics/chromium/TextureManager.cpp +++ b/Source/WebCore/platform/graphics/chromium/TextureManager.cpp @@ -112,7 +112,6 @@ void TextureManager::setMaxMemoryLimitBytes(size_t memoryLimitBytes) void TextureManager::setPreferredMemoryLimitBytes(size_t memoryLimitBytes) { - reduceMemoryToLimit(memoryLimitBytes); m_preferredMemoryLimitBytes = memoryLimitBytes; } diff --git a/Source/WebCore/platform/graphics/chromium/TextureManager.h b/Source/WebCore/platform/graphics/chromium/TextureManager.h index c6c21ad59..a66e9d536 100644 --- a/Source/WebCore/platform/graphics/chromium/TextureManager.h +++ b/Source/WebCore/platform/graphics/chromium/TextureManager.h @@ -64,7 +64,9 @@ public: static size_t memoryUseBytes(const IntSize&, GC3Denum format); void setMaxMemoryLimitBytes(size_t); + size_t maxMemoryLimitBytes() { return m_maxMemoryLimitBytes; } void setPreferredMemoryLimitBytes(size_t); + size_t preferredMemoryLimitBytes() { return m_preferredMemoryLimitBytes; } TextureToken getToken(); void releaseToken(TextureToken); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDebugBorderDrawQuad.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCDebugBorderDrawQuad.cpp index 4056a4284..b4a71dc5f 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCDebugBorderDrawQuad.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCDebugBorderDrawQuad.cpp @@ -40,7 +40,7 @@ CCDebugBorderDrawQuad::CCDebugBorderDrawQuad(const CCSharedQuadState* sharedQuad , m_width(width) { m_quadOpaque = false; - if (m_color.alpha() != 1) + if (m_color.hasAlpha()) m_needsBlending = true; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp index 35477065e..e7b19a760 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp @@ -40,10 +40,11 @@ PassRefPtr<CCDelayBasedTimeSource> CCDelayBasedTimeSource::create(double interva CCDelayBasedTimeSource::CCDelayBasedTimeSource(double intervalMs, CCThread* thread) : m_client(0) + , m_hasTickTarget(false) , m_intervalMs(intervalMs) , m_tickTarget(0) , m_state(STATE_INACTIVE) - , m_thread(thread) + , m_timer(thread, this) { } @@ -51,29 +52,45 @@ void CCDelayBasedTimeSource::setActive(bool active) { if (!active) { m_state = STATE_INACTIVE; + m_timer.stop(); return; } - // Becoming active is deferred: we post a 0-delay task. When it runs, we use - // that to establish the timebase, become truly active, and fire the first - // tick. if (m_state == STATE_STARTING || m_state == STATE_ACTIVE) return; - m_state = STATE_STARTING; - postTickTask(0); -} + if (!m_hasTickTarget) { + // Becoming active the first time is deferred: we post a 0-delay task. When + // it runs, we use that to establish the timebase, become truly active, and + // fire the first tick. + m_state = STATE_STARTING; + m_timer.startOneShot(0); + return; + } -void CCDelayBasedTimeSource::postTickTask(long long delay) -{ - this->ref(); - m_thread->postDelayedTask(createCCThreadTask(this, &CCDelayBasedTimeSource::onTick), delay); + m_state = STATE_ACTIVE; + + double nowMs = monotonicallyIncreasingTimeMs(); + postNextTickTask(nowMs); } -void CCDelayBasedTimeSource::onTick() +void CCDelayBasedTimeSource::onTimerFired() { - updateState(); - this->deref(); + ASSERT(m_state != STATE_INACTIVE); + + double nowMs = monotonicallyIncreasingTimeMs(); + + if (m_state == STATE_STARTING) { + m_hasTickTarget = true; + m_tickTarget = nowMs; + m_state = STATE_ACTIVE; + } + + postNextTickTask(nowMs); + + // Fire the tick + if (m_client) + m_client->onTimerTick(); } double CCDelayBasedTimeSource::monotonicallyIncreasingTimeMs() const @@ -124,36 +141,22 @@ double CCDelayBasedTimeSource::monotonicallyIncreasingTimeMs() const // // For the really late delay, we we move to the next logical tick. The timebase is not reset. // now=37 tickTarget=16.667 newTarget=50.000 --> tick(), postDelayedTask(floor(50.000-37)) --> postDelayedTask(13) -void CCDelayBasedTimeSource::updateState() +void CCDelayBasedTimeSource::postNextTickTask(double nowMs) { - if (m_state == STATE_INACTIVE) - return; - - double now = monotonicallyIncreasingTimeMs(); - - if (m_state == STATE_STARTING) { - m_tickTarget = now; - m_state = STATE_ACTIVE; - } - - int numIntervalsElapsed = static_cast<int>(floor((now - m_tickTarget) / m_intervalMs)); + int numIntervalsElapsed = static_cast<int>(floor((nowMs - m_tickTarget) / m_intervalMs)); double lastEffectiveTick = m_tickTarget + m_intervalMs * numIntervalsElapsed; double newTickTarget = lastEffectiveTick + m_intervalMs; - long long delay = static_cast<long long>(newTickTarget - now); + long long delay = static_cast<long long>(newTickTarget - nowMs); if (!delay) { newTickTarget = newTickTarget + m_intervalMs; - delay = static_cast<long long>(newTickTarget - now); + delay = static_cast<long long>(newTickTarget - nowMs); } // Post another task *before* the tick and update state - ASSERT(newTickTarget > now); - postTickTask(delay); + ASSERT(newTickTarget > nowMs); + m_timer.startOneShot(delay); m_tickTarget = newTickTarget; - - // Fire the tick - if (m_client) - m_client->onTimerTick(); } } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.h b/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.h index 6cc7338d5..6336b8849 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.h @@ -26,6 +26,7 @@ #define CCDelayBasedTimeSource_h #include "cc/CCTimeSource.h" +#include "cc/CCTimer.h" #include <wtf/PassRefPtr.h> @@ -35,7 +36,7 @@ class CCThread; // This timer implements a time source that achieves the specified interval // in face of millisecond-precision delayed callbacks and random queueing delays. -class CCDelayBasedTimeSource : public CCTimeSource { +class CCDelayBasedTimeSource : public CCTimeSource, CCTimerClient { public: static PassRefPtr<CCDelayBasedTimeSource> create(double intervalMs, CCThread*); @@ -45,14 +46,15 @@ public: virtual void setActive(bool); + // CCTimerClient implementation. + virtual void onTimerFired(); + // Virtual for testing. virtual double monotonicallyIncreasingTimeMs() const; protected: CCDelayBasedTimeSource(double intervalMs, CCThread*); - void onTick(); - void updateState(); - void postTickTask(long long delay); + void postNextTickTask(double nowMs); enum State { STATE_INACTIVE, @@ -60,10 +62,12 @@ protected: STATE_ACTIVE, }; CCTimeSourceClient* m_client; + bool m_hasTickTarget; double m_intervalMs; double m_tickTarget; State m_state; CCThread* m_thread; + CCTimer m_timer; }; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp index 21fe68438..6837f0a5c 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp @@ -129,15 +129,13 @@ PassOwnPtr<CCSharedQuadState> CCLayerImpl::createSharedQuadState() const void CCLayerImpl::appendQuads(CCQuadList& quadList, const CCSharedQuadState* sharedQuadState) { - IntRect layerRect(IntPoint(), bounds()); - quadList.append(CCCustomLayerDrawQuad::create(sharedQuadState, layerRect, this)); + IntRect quadRect(IntPoint(), bounds()); + quadList.append(CCCustomLayerDrawQuad::create(sharedQuadState, quadRect, this)); } void CCLayerImpl::appendDebugBorderQuad(CCQuadList& quadList, const CCSharedQuadState* sharedQuadState) const { - if (!debugBorderColor().alpha()) - return; - if (debugBorderWidth() <= 0) + if (!hasDebugBorders()) return; IntRect layerRect(IntPoint(), bounds()); @@ -176,7 +174,13 @@ const IntRect CCLayerImpl::getDrawRect() const TransformationMatrix CCLayerImpl::quadTransform() const { - return drawTransform(); + TransformationMatrix quadTransformation = drawTransform(); + + float offsetX = -0.5 * bounds().width(); + float offsetY = -0.5 * bounds().height(); + quadTransformation.translate(offsetX, offsetY); + + return quadTransformation; } void CCLayerImpl::writeIndent(TextStream& ts, int indent) @@ -420,6 +424,11 @@ void CCLayerImpl::setDebugBorderWidth(float debugBorderWidth) m_layerPropertyChanged = true; } +bool CCLayerImpl::hasDebugBorders() const +{ + return debugBorderColor().alpha() && debugBorderWidth() > 0; +} + void CCLayerImpl::setContentBounds(const IntSize& contentBounds) { if (m_contentBounds == contentBounds) diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h index a18fd4420..0136b01f8 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h @@ -132,6 +132,7 @@ public: Color debugBorderColor() const { return m_debugBorderColor; } void setDebugBorderWidth(float); float debugBorderWidth() const { return m_debugBorderWidth; } + bool hasDebugBorders() const; CCRenderSurface* renderSurface() const { return m_renderSurface.get(); } void createRenderSurface(); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerIterator.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerIterator.cpp new file mode 100644 index 000000000..0767ff0e7 --- /dev/null +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerIterator.cpp @@ -0,0 +1,170 @@ +/* + * Copyright (C) 2012 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 INC. 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 INC. 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" + +#if USE(ACCELERATED_COMPOSITING) + +#include "cc/CCLayerIterator.h" + +#include "LayerChromium.h" +#include "RenderSurfaceChromium.h" +#include "cc/CCLayerImpl.h" +#include "cc/CCRenderSurface.h" + +namespace WebCore { + +template <typename LayerType, typename RenderSurfaceType> +void CCLayerIteratorActions::BackToFront::begin(CCLayerIteratorPosition<LayerType, RenderSurfaceType>& pos) +{ + pos.targetRenderSurfaceLayerIndex = 0; + pos.currentLayerIndex = CCLayerIteratorPositionValue::LayerIndexRepresentingTargetRenderSurface; + + m_highestTargetRenderSurfaceLayer = 0; +} + +template <typename LayerType, typename RenderSurfaceType> +void CCLayerIteratorActions::BackToFront::end(CCLayerIteratorPosition<LayerType, RenderSurfaceType>& pos) +{ + pos.targetRenderSurfaceLayerIndex = CCLayerIteratorPositionValue::InvalidTargetRenderSurfaceLayerIndex; + pos.currentLayerIndex = 0; +} + +template <typename LayerType, typename RenderSurfaceType> +void CCLayerIteratorActions::BackToFront::next(CCLayerIteratorPosition<LayerType, RenderSurfaceType>& pos) +{ + // If the current layer has a RS, move to its layer list. Otherwise, visit the next layer in the current RS layer list. + if (pos.currentLayerRepresentsContributingRenderSurface()) { + // Save our position in the childLayer list for the RenderSurface, then jump to the next RenderSurface. Save where we + // came from in the next RenderSurface so we can get back to it. + pos.targetRenderSurface()->m_currentLayerIndexHistory = pos.currentLayerIndex; + int previousTargetRenderSurfaceLayer = pos.targetRenderSurfaceLayerIndex; + + pos.targetRenderSurfaceLayerIndex = ++m_highestTargetRenderSurfaceLayer; + pos.currentLayerIndex = CCLayerIteratorPositionValue::LayerIndexRepresentingTargetRenderSurface; + + pos.targetRenderSurface()->m_targetRenderSurfaceLayerIndexHistory = previousTargetRenderSurfaceLayer; + } else { + ++pos.currentLayerIndex; + + int targetRenderSurfaceNumChildren = pos.targetRenderSurfaceChildren().size(); + while (pos.currentLayerIndex == targetRenderSurfaceNumChildren) { + // Jump back to the previous RenderSurface, and get back the position where we were in that list, and move to the next position there. + if (!pos.targetRenderSurfaceLayerIndex) { + // End of the list + pos.targetRenderSurfaceLayerIndex = CCLayerIteratorPositionValue::InvalidTargetRenderSurfaceLayerIndex; + pos.currentLayerIndex = 0; + return; + } + pos.targetRenderSurfaceLayerIndex = pos.targetRenderSurface()->m_targetRenderSurfaceLayerIndexHistory; + pos.currentLayerIndex = pos.targetRenderSurface()->m_currentLayerIndexHistory + 1; + + targetRenderSurfaceNumChildren = pos.targetRenderSurfaceChildren().size(); + } + } +} + +template <typename LayerType, typename RenderSurfaceType> +void CCLayerIteratorActions::FrontToBack::begin(CCLayerIteratorPosition<LayerType, RenderSurfaceType>& pos) +{ + pos.targetRenderSurfaceLayerIndex = 0; + pos.currentLayerIndex = pos.targetRenderSurfaceChildren().size() - 1; + goToHighestInSubtree(pos); +} + +template <typename LayerType, typename RenderSurfaceType> +void CCLayerIteratorActions::FrontToBack::end(CCLayerIteratorPosition<LayerType, RenderSurfaceType>& pos) +{ + pos.targetRenderSurfaceLayerIndex = CCLayerIteratorPositionValue::InvalidTargetRenderSurfaceLayerIndex; + pos.currentLayerIndex = 0; +} + +template <typename LayerType, typename RenderSurfaceType> +void CCLayerIteratorActions::FrontToBack::next(CCLayerIteratorPosition<LayerType, RenderSurfaceType>& pos) +{ + // Moves to the previous layer in the current RS layer list. Then we check if the + // new current layer has its own RS, in which case there are things in that RS layer list that are higher, so + // we find the highest layer in that subtree. + // If we move back past the front of the list, we jump up to the previous RS layer list, picking up again where we + // had previously recursed into the current RS layer list. + + if (!pos.currentLayerRepresentsTargetRenderSurface()) { + // Subtracting one here will eventually cause the current layer to become that layer + // representing the target render surface. + --pos.currentLayerIndex; + goToHighestInSubtree(pos); + } else { + while (pos.currentLayerRepresentsTargetRenderSurface()) { + if (!pos.targetRenderSurfaceLayerIndex) { + // End of the list + pos.targetRenderSurfaceLayerIndex = CCLayerIteratorPositionValue::InvalidTargetRenderSurfaceLayerIndex; + pos.currentLayerIndex = 0; + return; + } + pos.targetRenderSurfaceLayerIndex = pos.targetRenderSurface()->m_targetRenderSurfaceLayerIndexHistory; + pos.currentLayerIndex = pos.targetRenderSurface()->m_currentLayerIndexHistory; + } + } +} + +template <typename LayerType, typename RenderSurfaceType> +void CCLayerIteratorActions::FrontToBack::goToHighestInSubtree(CCLayerIteratorPosition<LayerType, RenderSurfaceType>& pos) +{ + if (pos.currentLayerRepresentsTargetRenderSurface()) + return; + while (pos.currentLayerRepresentsContributingRenderSurface()) { + // Save where we were in the current target surface, move to the next one, and save the target surface that we + // came from there so we can go back to it. + pos.targetRenderSurface()->m_currentLayerIndexHistory = pos.currentLayerIndex; + int previousTargetRenderSurfaceLayer = pos.targetRenderSurfaceLayerIndex; + + for (LayerType* layer = pos.currentLayer(); pos.targetRenderSurfaceLayer() != layer; ++pos.targetRenderSurfaceLayerIndex) { } + pos.currentLayerIndex = pos.targetRenderSurfaceChildren().size() - 1; + + pos.targetRenderSurface()->m_targetRenderSurfaceLayerIndexHistory = previousTargetRenderSurfaceLayer; + } +} + +// Declare each of the above functions for LayerChromium and CCLayerImpl classes so that they are linked. +template void CCLayerIteratorActions::BackToFront::begin(CCLayerIteratorPosition<LayerChromium, RenderSurfaceChromium>&); +template void CCLayerIteratorActions::BackToFront::end(CCLayerIteratorPosition<LayerChromium, RenderSurfaceChromium>&); +template void CCLayerIteratorActions::BackToFront::next(CCLayerIteratorPosition<LayerChromium, RenderSurfaceChromium>&); + +template void CCLayerIteratorActions::BackToFront::begin(CCLayerIteratorPosition<CCLayerImpl, CCRenderSurface>&); +template void CCLayerIteratorActions::BackToFront::end(CCLayerIteratorPosition<CCLayerImpl, CCRenderSurface>&); +template void CCLayerIteratorActions::BackToFront::next(CCLayerIteratorPosition<CCLayerImpl, CCRenderSurface>&); + +template void CCLayerIteratorActions::FrontToBack::next(CCLayerIteratorPosition<LayerChromium, RenderSurfaceChromium>&); +template void CCLayerIteratorActions::FrontToBack::end(CCLayerIteratorPosition<LayerChromium, RenderSurfaceChromium>&); +template void CCLayerIteratorActions::FrontToBack::begin(CCLayerIteratorPosition<LayerChromium, RenderSurfaceChromium>&); +template void CCLayerIteratorActions::FrontToBack::goToHighestInSubtree(CCLayerIteratorPosition<LayerChromium, RenderSurfaceChromium>&); + +template void CCLayerIteratorActions::FrontToBack::next(CCLayerIteratorPosition<CCLayerImpl, CCRenderSurface>&); +template void CCLayerIteratorActions::FrontToBack::end(CCLayerIteratorPosition<CCLayerImpl, CCRenderSurface>&); +template void CCLayerIteratorActions::FrontToBack::begin(CCLayerIteratorPosition<CCLayerImpl, CCRenderSurface>&); +template void CCLayerIteratorActions::FrontToBack::goToHighestInSubtree(CCLayerIteratorPosition<CCLayerImpl, CCRenderSurface>&); + +} // namespace WebCore + +#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerIterator.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerIterator.h new file mode 100644 index 000000000..8f412c44d --- /dev/null +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerIterator.h @@ -0,0 +1,162 @@ +/* + * Copyright (C) 2012 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 INC. 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 INC. 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 CCLayerIterator_h +#define CCLayerIterator_h + +#include "cc/CCLayerIteratorPosition.h" + +#include <wtf/PassOwnPtr.h> +#include <wtf/RefPtr.h> +#include <wtf/Vector.h> + +namespace WebCore { + +// These classes provide means to iterate over the RenderSurface-Layer tree. + +// Example code follows, for a tree of LayerChromium/RenderSurfaceChromium objects. See below for details. +// +// void doStuffOnLayers(const Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList) +// { +// typedef CCLayerIterator<LayerChromium, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType; +// +// CCLayerIteratorType end = CCLayerIteratorType::end(&renderSurfaceLayerList); +// for (CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); it != end; ++it) { +// // Only one of these will be true +// if (it.representsTargetRenderSurface()) +// foo(*it); // *it is a layer representing a target RenderSurface +// if (it.representsContributingRenderSurface()) +// bar(*it); // *it is a layer representing a RenderSurface that contributes to the layer's target RenderSurface +// if (it.representsItself()) +// baz(*it); // *it is a layer representing itself, as it contributes to its own target RenderSurface +// } +// } + +// A RenderSurface R may be referred to in one of two different contexts. One RenderSurface is "current" at any time, for +// whatever operation is being performed. This current surface is referred to as a target surface. For example, when R is +// being painted it would be the target surface. Once R has been painted, its contents may be included into another +// surface S. While S is considered the target surface when it is being painted, R is called a contributing surface +// in this context as it contributes to the content of the target surface S. +// +// The iterator's current position in the tree always points to some layer. The state of the iterator indicates the role of the +// layer, and will be one of the following three states. A single layer L will appear in the iteration process in at least one, +// and possibly all, of these states. +// 1. Representing the target surface: The iterator in this state, pointing at layer L, indicates that the target RenderSurface +// is now the surface owned by L. This will occur exactly once for each RenderSurface in the tree. +// 2. Representing a contributing surface: The iterator in this state, pointing at layer L, refers to the RenderSurface owned +// by L as a contributing surface, without changing the current target RenderSurface. +// 3. Representing itself: The iterator in this state, pointing at layer L, refers to the layer itself, as a child of the +// current target RenderSurface. +// +// The BackToFront iterator will return a layer representing the target surface before returning layers representing themselves +// as children of the current target surface. Whereas the FrontToBack ordering will iterate over children layers of a surface +// before the layer representing the surface as a target surface. +// +// To use the iterators: +// +// Create a stepping iterator and end iterator by calling CCLayerIterator::begin() and CCLayerIterator::end() and passing in the +// list of layers owning target RenderSurfaces. Step through the tree by incrementing the stepping iterator while it is != to +// the end iterator. At each step the iterator knows what the layer is representing, and you can query the iterator to decide +// what actions to perform with the layer given what it represents. + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +// An iterator class for walking over layers in the RenderSurface-Layer tree. +template <typename LayerType, typename RenderSurfaceType, typename IteratorActionType> +class CCLayerIterator { + typedef CCLayerIterator<LayerType, RenderSurfaceType, IteratorActionType> CCLayerIteratorType; + +public: + CCLayerIterator() { } + + static CCLayerIteratorType begin(const Vector<RefPtr<LayerType> >* renderSurfaceLayerList) { return CCLayerIteratorType(renderSurfaceLayerList, true); } + static CCLayerIteratorType end(const Vector<RefPtr<LayerType> >* renderSurfaceLayerList) { return CCLayerIteratorType(renderSurfaceLayerList, false); } + + CCLayerIteratorType& operator++() { ASSERT(m_actions); m_actions->next(m_position); return *this; } + bool operator==(const CCLayerIteratorType& other) const { return m_position == other.m_position; } + bool operator!=(const CCLayerIteratorType& other) const { return !(*this == other); } + + LayerType* operator->() const { return m_position.currentLayer(); } + LayerType* operator*() const { return m_position.currentLayer(); } + + bool representsTargetRenderSurface() const { return m_position.currentLayerRepresentsTargetRenderSurface(); } + bool representsContributingRenderSurface() const { return !representsTargetRenderSurface() && m_position.currentLayerRepresentsContributingRenderSurface(); } + bool representsItself() const { return !representsTargetRenderSurface() && !representsContributingRenderSurface(); } + + LayerType* targetRenderSurfaceLayer() const { return m_position.targetRenderSurfaceLayer(); } + +private: + CCLayerIterator(const Vector<RefPtr<LayerType> >* renderSurfaceLayerList, bool start) + : m_position(renderSurfaceLayerList) + , m_actions(adoptPtr(new IteratorActionType())) + { + if (start && !renderSurfaceLayerList->isEmpty()) + m_actions->begin(m_position); + else + m_actions->end(m_position); + } + + CCLayerIteratorPosition<LayerType, RenderSurfaceType> m_position; + OwnPtr<IteratorActionType> m_actions; +}; + +// Orderings for iterating over the RenderSurface-Layer tree. +struct CCLayerIteratorActions { + // Walks layers sorted by z-order from back to front. + class BackToFront { + public: + template <typename LayerType, typename RenderSurfaceType> + void begin(CCLayerIteratorPosition<LayerType, RenderSurfaceType>&); + + template <typename LayerType, typename RenderSurfaceType> + void end(CCLayerIteratorPosition<LayerType, RenderSurfaceType>&); + + template <typename LayerType, typename RenderSurfaceType> + void next(CCLayerIteratorPosition<LayerType, RenderSurfaceType>&); + + private: + int m_highestTargetRenderSurfaceLayer; + }; + + // Walks layers sorted by z-order from front to back + class FrontToBack { + public: + template <typename LayerType, typename RenderSurfaceType> + void begin(CCLayerIteratorPosition<LayerType, RenderSurfaceType>&); + + template <typename LayerType, typename RenderSurfaceType> + void end(CCLayerIteratorPosition<LayerType, RenderSurfaceType>&); + + template <typename LayerType, typename RenderSurfaceType> + void next(CCLayerIteratorPosition<LayerType, RenderSurfaceType>&); + + private: + template <typename LayerType, typename RenderSurfaceType> + void goToHighestInSubtree(CCLayerIteratorPosition<LayerType, RenderSurfaceType>&); + }; +}; + +} // namespace WebCore + +#endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerIteratorPosition.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerIteratorPosition.h new file mode 100644 index 000000000..b1f63c45f --- /dev/null +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerIteratorPosition.h @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2012 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 INC. 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 INC. 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 CCLayerIteratorPosition_h +#define CCLayerIteratorPosition_h + +#include "cc/CCLayerTreeHostCommon.h" + +#include <wtf/RefPtr.h> +#include <wtf/Vector.h> + +namespace WebCore { + +// Non-templated constants +struct CCLayerIteratorPositionValue { + static const int InvalidTargetRenderSurfaceLayerIndex = -1; + // This must be -1 since the iterator action code assumes that this value can be + // reached by subtracting one from the position of the first layer in the current + // target surface's child layer list, which is 0. + static const int LayerIndexRepresentingTargetRenderSurface = -1; +}; + +// A struct to hold the iterator's current position, which is passed to the various CCLayerIteratorAction functions, for them to +// read and update. This struct exists so the templated action functions don't need to access the CCLayerIterator class. +// +// There is a 1:1 relationship between an instance of the CCLayerIteratorPosition class and a CCLayerIteratorActions::Foo class, +// so an iterator action class can hold extra position data, if required, in its own class instance. +// +// The current position of the iterator is held in two integer variables. +// - The targetRenderSurfaceLayerIndex is a position in the renderSurfaceLayerList. This points to a layer which owns the current +// target surface. This is a value from 0 to n-1 (n = size of renderSurfaceLayerList = number of surfaces). A value outside of +// this range (for example, CCLayerIteratorPositionValue::InvalidTargetRenderSurfaceLayerIndex) is used to indicate a position +// outside the bounds of the tree. +// - The currentLayerIndex is a position in the list of layers that are children of the current target surface. When pointing to +// one of these layers, this is a value from 0 to n-1 (n = number of children). Since the iterator must also stop at the layers +// representing the target surface, this is done by setting the currentLayerIndex to a value of +// CCLayerIteratorPositionValue::LayerRepresentingTargetRenderSurface. +template<typename LayerType, typename RenderSurfaceType> +struct CCLayerIteratorPosition { + CCLayerIteratorPosition() : renderSurfaceLayerList(0) { } + explicit CCLayerIteratorPosition(const Vector<RefPtr<LayerType> >* renderSurfaceLayerList) : renderSurfaceLayerList(renderSurfaceLayerList) { } + + inline LayerType* currentLayer() const { return currentLayerRepresentsTargetRenderSurface() ? targetRenderSurfaceLayer() : targetRenderSurfaceChildren()[currentLayerIndex].get(); } + + inline bool currentLayerRepresentsContributingRenderSurface() const { return CCLayerTreeHostCommon::renderSurfaceContributesToTarget<LayerType>(currentLayer(), targetRenderSurfaceLayer()->id()); } + inline bool currentLayerRepresentsTargetRenderSurface() const { return currentLayerIndex == CCLayerIteratorPositionValue::LayerIndexRepresentingTargetRenderSurface; } + + inline LayerType* targetRenderSurfaceLayer() const { return (*renderSurfaceLayerList)[targetRenderSurfaceLayerIndex].get(); } + inline RenderSurfaceType* targetRenderSurface() const { return targetRenderSurfaceLayer()->renderSurface(); } + inline const Vector<RefPtr<LayerType> >& targetRenderSurfaceChildren() const { return targetRenderSurface()->layerList(); } + + inline bool operator==(const CCLayerIteratorPosition& other) const + { + return targetRenderSurfaceLayerIndex == other.targetRenderSurfaceLayerIndex + && currentLayerIndex == other.currentLayerIndex; + } + + const Vector<RefPtr<LayerType> >* renderSurfaceLayerList; + int targetRenderSurfaceLayerIndex; + int currentLayerIndex; +}; + +} // namespace WebCore + +#endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp index 379d16083..8663ec0ac 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp @@ -31,6 +31,7 @@ #include "LayerRendererChromium.h" #include "TraceEvent.h" #include "TreeSynchronizer.h" +#include "cc/CCLayerIterator.h" #include "cc/CCLayerTreeHostCommon.h" #include "cc/CCLayerTreeHostImpl.h" #include "cc/CCSingleThreadProxy.h" @@ -156,7 +157,7 @@ void CCLayerTreeHost::finishCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) hostImpl->setSourceFrameNumber(frameNumber()); hostImpl->setHaveWheelEventHandlers(m_haveWheelEventHandlers); - hostImpl->setViewport(viewportSize()); + hostImpl->setViewportSize(viewportSize()); hostImpl->setPageScaleFactorAndLimits(pageScale(), m_minPageScale, m_maxPageScale); m_frameNumber++; @@ -247,8 +248,11 @@ void CCLayerTreeHost::setRootLayer(PassRefPtr<LayerChromium> rootLayer) setNeedsCommit(); } -void CCLayerTreeHost::setViewport(const IntSize& viewportSize) +void CCLayerTreeHost::setViewportSize(const IntSize& viewportSize) { + if (viewportSize == m_viewportSize) + return; + contentsTextureManager()->setMaxMemoryLimitBytes(TextureManager::highLimitBytes(viewportSize)); contentsTextureManager()->setPreferredMemoryLimitBytes(TextureManager::reclaimLimitBytes(viewportSize)); m_viewportSize = viewportSize; @@ -428,57 +432,40 @@ void CCLayerTreeHost::paintMaskAndReplicaForRenderSurface(LayerChromium* renderS void CCLayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList, PaintType paintType) { - for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { - LayerChromium* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex].get(); - RenderSurfaceChromium* renderSurface = renderSurfaceLayer->renderSurface(); - ASSERT(renderSurface); - ASSERT(renderSurface->drawOpacity()); - - paintMaskAndReplicaForRenderSurface(renderSurfaceLayer, paintType); - - const LayerList& layerList = renderSurface->layerList(); - for (unsigned layerIndex = 0; layerIndex < layerList.size(); ++layerIndex) { - LayerChromium* layer = layerList[layerIndex].get(); - - // Layers that start a new render surface will be painted when the render - // surface's list is processed. - if (CCLayerTreeHostCommon::renderSurfaceContributesToTarget<LayerChromium>(layer, renderSurfaceLayer->id())) - continue; - - ASSERT(!layer->bounds().isEmpty()); - - paintContentsIfDirty(layer, paintType); + // Use FrontToBack to allow for testing occlusion and performing culling during the tree walk. + typedef CCLayerIterator<LayerChromium, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType; + + CCLayerIteratorType end = CCLayerIteratorType::end(&renderSurfaceLayerList); + for (CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); it != end; ++it) { + if (it.representsTargetRenderSurface()) { + ASSERT(it->renderSurface()->drawOpacity()); + paintMaskAndReplicaForRenderSurface(*it, paintType); + } else if (it.representsItself()) { + ASSERT(!it->bounds().isEmpty()); + paintContentsIfDirty(*it, paintType); } } } void CCLayerTreeHost::updateCompositorResources(GraphicsContext3D* context, CCTextureUpdater& updater) { - for (int surfaceIndex = m_updateList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { - LayerChromium* renderSurfaceLayer = m_updateList[surfaceIndex].get(); - RenderSurfaceChromium* renderSurface = renderSurfaceLayer->renderSurface(); - ASSERT(renderSurface); - ASSERT(renderSurface->drawOpacity()); - - if (renderSurfaceLayer->maskLayer()) - renderSurfaceLayer->maskLayer()->updateCompositorResources(context, updater); - - if (renderSurfaceLayer->replicaLayer()) { - renderSurfaceLayer->replicaLayer()->updateCompositorResources(context, updater); - - if (renderSurfaceLayer->replicaLayer()->maskLayer()) - renderSurfaceLayer->replicaLayer()->maskLayer()->updateCompositorResources(context, updater); - } - - const LayerList& layerList = renderSurface->layerList(); - for (unsigned layerIndex = 0; layerIndex < layerList.size(); ++layerIndex) { - LayerChromium* layer = layerList[layerIndex].get(); - - if (CCLayerTreeHostCommon::renderSurfaceContributesToTarget<LayerChromium>(layer, renderSurfaceLayer->id())) - continue; - - layer->updateCompositorResources(context, updater); - } + // Use BackToFront since it's cheap and this isn't order-dependent. + typedef CCLayerIterator<LayerChromium, RenderSurfaceChromium, CCLayerIteratorActions::BackToFront> CCLayerIteratorType; + + CCLayerIteratorType end = CCLayerIteratorType::end(&m_updateList); + for (CCLayerIteratorType it = CCLayerIteratorType::begin(&m_updateList); it != end; ++it) { + if (it.representsTargetRenderSurface()) { + ASSERT(it->renderSurface()->drawOpacity()); + if (it->maskLayer()) + it->maskLayer()->updateCompositorResources(context, updater); + + if (it->replicaLayer()) { + it->replicaLayer()->updateCompositorResources(context, updater); + if (it->replicaLayer()->maskLayer()) + it->replicaLayer()->maskLayer()->updateCompositorResources(context, updater); + } + } else if (it.representsItself()) + it->updateCompositorResources(context, updater); } } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h index 4f293eca5..2f989bcf6 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h @@ -169,7 +169,7 @@ public: const CCSettings& settings() const { return m_settings; } - void setViewport(const IntSize& viewportSize); + void setViewportSize(const IntSize&); const IntSize& viewportSize() const { return m_viewportSize; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp index fc08f71ee..b4e7be415 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp @@ -33,6 +33,7 @@ #include "RenderSurfaceChromium.h" #include "TransformationMatrix.h" #include "cc/CCLayerImpl.h" +#include "cc/CCLayerIterator.h" #include "cc/CCLayerSorter.h" #include "cc/CCRenderSurface.h" @@ -469,15 +470,14 @@ static bool calculateDrawTransformsAndVisibilityInternal(LayerType* layer, Layer template<typename LayerType, typename RenderSurfaceType> static void walkLayersAndCalculateVisibleLayerRects(const Vector<RefPtr<LayerType> >& renderSurfaceLayerList) { - for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { - LayerType* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex].get(); - RenderSurfaceType* renderSurface = renderSurfaceLayer->renderSurface(); - - Vector<RefPtr<LayerType> >& layerList = renderSurface->layerList(); - for (unsigned layerIndex = 0; layerIndex < layerList.size(); ++layerIndex) { - LayerType* layer = layerList[layerIndex].get(); - IntRect visibleLayerRect = CCLayerTreeHostCommon::calculateVisibleLayerRect<LayerType>(layer); - layer->setVisibleLayerRect(visibleLayerRect); + // Use BackToFront since it's cheap and this isn't order-dependent. + typedef CCLayerIterator<LayerType, RenderSurfaceType, CCLayerIteratorActions::BackToFront> CCLayerIteratorType; + + CCLayerIteratorType end = CCLayerIteratorType::end(&renderSurfaceLayerList); + for (CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); it != end; ++it) { + if (!it.representsTargetRenderSurface()) { + IntRect visibleLayerRect = CCLayerTreeHostCommon::calculateVisibleLayerRect<LayerType>(*it); + it->setVisibleLayerRect(visibleLayerRect); } } } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp index f6cfaa54f..02186caaf 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp @@ -187,7 +187,7 @@ static FloatRect damageInSurfaceSpace(CCLayerImpl* renderSurfaceLayer, const Flo return surfaceDamageRect; } -void CCLayerTreeHostImpl::calculateRenderPasses(Vector<OwnPtr<CCRenderPass> >& passes) +void CCLayerTreeHostImpl::calculateRenderPasses(CCRenderPassList& passes) { CCLayerList renderSurfaceLayerList; renderSurfaceLayerList.append(rootLayer()); @@ -238,6 +238,12 @@ void CCLayerTreeHostImpl::calculateRenderPasses(Vector<OwnPtr<CCRenderPass> >& p } } +void CCLayerTreeHostImpl::optimizeRenderPasses(CCRenderPassList& passes) +{ + for (unsigned i = 0; i < passes.size(); ++i) + passes[i]->optimizeQuads(); +} + void CCLayerTreeHostImpl::drawLayers() { TRACE_EVENT("CCLayerTreeHostImpl::drawLayers", this, 0); @@ -246,9 +252,11 @@ void CCLayerTreeHostImpl::drawLayers() if (!rootLayer()) return; - Vector<OwnPtr<CCRenderPass> > passes; + CCRenderPassList passes; calculateRenderPasses(passes); + optimizeRenderPasses(passes); + m_layerRenderer->beginDrawingFrame(); for (size_t i = 0; i < passes.size(); ++i) m_layerRenderer->drawRenderPass(passes[i].get()); @@ -353,7 +361,7 @@ bool CCLayerTreeHostImpl::initializeLayerRenderer(PassRefPtr<GraphicsContext3D> return m_layerRenderer; } -void CCLayerTreeHostImpl::setViewport(const IntSize& viewportSize) +void CCLayerTreeHostImpl::setViewportSize(const IntSize& viewportSize) { if (viewportSize == m_viewportSize) return; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h index fe774ee00..e4d006d4f 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h @@ -107,7 +107,7 @@ public: int sourceFrameNumber() const { return m_sourceFrameNumber; } void setSourceFrameNumber(int frameNumber) { m_sourceFrameNumber = frameNumber; } - void setViewport(const IntSize& viewportSize); + void setViewportSize(const IntSize&); const IntSize& viewportSize() const { return m_viewportSize; } void setPageScaleFactorAndLimits(float pageScale, float minPageScale, float maxPageScale); @@ -133,7 +133,8 @@ private: void adjustScrollsForPageScaleChange(float); void updateMaxScrollPosition(); void trackDamageForAllSurfaces(CCLayerImpl* rootDrawLayer, const CCLayerList& renderSurfaceLayerList); - void calculateRenderPasses(Vector<OwnPtr<CCRenderPass> >&); + void calculateRenderPasses(CCRenderPassList&); + void optimizeRenderPasses(CCRenderPassList&); OwnPtr<LayerRendererChromium> m_layerRenderer; RefPtr<CCLayerImpl> m_rootLayerImpl; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp new file mode 100644 index 000000000..4a8b85130 --- /dev/null +++ b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2012 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 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" + +#if USE(ACCELERATED_COMPOSITING) + +#include "cc/CCQuadCuller.h" + +#include "Region.h" +#include "TransformationMatrix.h" +#include "cc/CCCustomLayerDrawQuad.h" +#include "cc/CCLayerImpl.h" +#include "cc/CCRenderPass.h" +#include "cc/CCRenderSurfaceDrawQuad.h" + +namespace std { + +// Specialize for OwnPtr<CCDrawQuad> since Vector doesn't know how to reverse a Vector of OwnPtr<T> in general. +template<> +void swap(OwnPtr<WebCore::CCDrawQuad>& a, OwnPtr<WebCore::CCDrawQuad>& b) +{ + a.swap(b); +} + +} + +namespace WebCore { + +static bool regionContainsRect(const Region& region, const IntRect& rect) +{ + Region rectRegion(rect); + Region intersectRegion(intersect(region, rectRegion)); + + if (intersectRegion.isEmpty()) + return false; + + rectRegion.subtract(intersectRegion); + return rectRegion.isEmpty(); +} + +void CCQuadCuller::cullOccludedQuads(CCQuadList& quadList) +{ + if (!quadList.size()) + return; + + CCQuadList culledList; + culledList.reserveCapacity(quadList.size()); + + Region opaqueCoverageThusFar; + + for (int i = quadList.size() - 1; i >= 0; --i) { + CCDrawQuad* drawQuad = quadList[i].get(); + + IntRect quadRect(drawQuad->quadTransform().mapRect(drawQuad->quadRect())); + + bool keepQuad = !regionContainsRect(opaqueCoverageThusFar, quadRect); + + if (keepQuad && drawQuad->drawsOpaque() && drawQuad->isLayerAxisAlignedIntRect()) + opaqueCoverageThusFar.unite(Region(quadRect)); + + if (keepQuad) + culledList.append(quadList[i].release()); + } + quadList.clear(); // Release anything that remains. + + culledList.reverse(); + quadList.swap(culledList); +} + +} // namespace WebCore +#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h new file mode 100644 index 000000000..7179285ac --- /dev/null +++ b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2012 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 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 CCQuadCuller_h +#define CCQuadCuller_h + +#include "cc/CCRenderPass.h" + +namespace WebCore { + +class CCQuadCuller { +public: + static void cullOccludedQuads(CCQuadList&); + +private: + // Make non-instantiable. + CCQuadCuller() { } +}; + +} +#endif // CCQuadCuller_h diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp index 71adc4b3e..6f51fbcde 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp @@ -28,6 +28,7 @@ #include "cc/CCRenderPass.h" #include "cc/CCLayerImpl.h" +#include "cc/CCQuadCuller.h" #include "cc/CCRenderSurfaceDrawQuad.h" #include "cc/CCSharedQuadState.h" @@ -63,4 +64,9 @@ void CCRenderPass::appendQuadsForRenderSurfaceLayer(CCLayerImpl* layer) m_sharedQuadStateList.append(sharedQuadState.release()); } +void CCRenderPass::optimizeQuads() +{ + CCQuadCuller::cullOccludedQuads(m_quadList); +} + } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h index 16e072e80..9fb77166c 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h @@ -46,6 +46,8 @@ public: void appendQuadsForLayer(CCLayerImpl*); void appendQuadsForRenderSurfaceLayer(CCLayerImpl*); + void optimizeQuads(); + const CCQuadList& quadList() const { return m_quadList; } CCRenderSurface* targetSurface() const { return m_targetSurface; } @@ -61,6 +63,8 @@ private: FloatRect m_surfaceDamageRect; }; +typedef Vector<OwnPtr<CCRenderPass> > CCRenderPassList; + } #endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h index a8e87a9f9..ab8386d5d 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h @@ -129,6 +129,11 @@ private: // Stored in the "surface space" where this damage can be used for scissoring. FloatRect m_damageRect; + + // For CCLayerIteratorActions + int m_targetRenderSurfaceLayerIndexHistory; + int m_currentLayerIndexHistory; + friend struct CCLayerIteratorActions; }; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp index 6ccb40704..5849ef1eb 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp @@ -30,6 +30,7 @@ #include "cc/CCTiledLayerImpl.h" #include "LayerRendererChromium.h" +#include "cc/CCDebugBorderDrawQuad.h" #include "cc/CCSolidColorDrawQuad.h" #include "cc/CCTileDrawQuad.h" #include <wtf/text/WTFString.h> @@ -38,6 +39,9 @@ using namespace std; namespace WebCore { +static const int debugTileBorderWidth = 1; +static const int debugTileBorderAlpha = 100; + class ManagedTexture; class DrawableTile : public CCLayerTilingData::Tile { @@ -156,6 +160,11 @@ void CCTiledLayerImpl::appendQuads(CCQuadList& quadList, const CCSharedQuadState const GC3Dint textureFilter = m_tiler->hasBorderTexels() ? GraphicsContext3D::LINEAR : GraphicsContext3D::NEAREST; quadList.append(CCTileDrawQuad::create(sharedQuadState, tileRect, tile->textureId(), textureOffset, textureSize, textureFilter, contentsSwizzled(), leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA)); + + if (hasDebugBorders()) { + Color color(debugBorderColor().red(), debugBorderColor().green(), debugBorderColor().blue(), debugTileBorderAlpha); + quadList.append(CCDebugBorderDrawQuad::create(sharedQuadState, tileRect, color, debugTileBorderWidth)); + } } } } diff --git a/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp b/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp index f9a86eb17..027642be7 100644 --- a/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp +++ b/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp @@ -273,13 +273,6 @@ void FEGaussianBlur::determineAbsolutePaintRect() void FEGaussianBlur::platformApplySoftware() { -#if USE(SKIA) - if (filter()->renderingMode() == Accelerated) { - platformApplySkia(); - return; - } -#endif - FilterEffect* in = inputEffect(0); ByteArray* srcPixelArray = createPremultipliedImageResult(); diff --git a/Source/WebCore/platform/graphics/filters/FEGaussianBlur.h b/Source/WebCore/platform/graphics/filters/FEGaussianBlur.h index 7f6c3bbee..b295d3608 100644 --- a/Source/WebCore/platform/graphics/filters/FEGaussianBlur.h +++ b/Source/WebCore/platform/graphics/filters/FEGaussianBlur.h @@ -74,7 +74,9 @@ private: inline void platformApplyGeneric(ByteArray* srcPixelArray, ByteArray* tmpPixelArray, unsigned kernelSizeX, unsigned kernelSizeY, IntSize& paintSize); inline void platformApplyNeon(ByteArray* srcPixelArray, ByteArray* tmpPixelArray, unsigned kernelSizeX, unsigned kernelSizeY, IntSize& paintSize); - void platformApplySkia(); +#if USE(SKIA) + virtual bool platformApplySkia(); +#endif float m_stdX; float m_stdY; diff --git a/Source/WebCore/platform/graphics/filters/FilterEffect.cpp b/Source/WebCore/platform/graphics/filters/FilterEffect.cpp index 6516faadc..fbeb4bbcb 100644 --- a/Source/WebCore/platform/graphics/filters/FilterEffect.cpp +++ b/Source/WebCore/platform/graphics/filters/FilterEffect.cpp @@ -104,6 +104,10 @@ void FilterEffect::apply() determineAbsolutePaintRect(); // Add platform specific apply functions here and return earlier. +#if USE(SKIA) + if (platformApplySkia()) + return; +#endif platformApplySoftware(); } diff --git a/Source/WebCore/platform/graphics/filters/FilterEffect.h b/Source/WebCore/platform/graphics/filters/FilterEffect.h index 073010d27..1bae4ca0a 100644 --- a/Source/WebCore/platform/graphics/filters/FilterEffect.h +++ b/Source/WebCore/platform/graphics/filters/FilterEffect.h @@ -87,6 +87,9 @@ public: void apply(); virtual void platformApplySoftware() = 0; +#if USE(SKIA) + virtual bool platformApplySkia() { return false; } +#endif virtual void dump() = 0; virtual void determineAbsolutePaintRect(); diff --git a/Source/WebCore/platform/graphics/filters/skia/FEColorMatrixSkia.cpp b/Source/WebCore/platform/graphics/filters/skia/FEColorMatrixSkia.cpp new file mode 100644 index 000000000..0fd07776e --- /dev/null +++ b/Source/WebCore/platform/graphics/filters/skia/FEColorMatrixSkia.cpp @@ -0,0 +1,133 @@ +/* + * Copyright (C) 2012 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 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" +#if ENABLE(FILTERS) && USE(SKIA) +#include "FEColorMatrix.h" + +#include "NativeImageSkia.h" +#include "SkColorMatrixFilter.h" + +namespace WebCore { + +static void saturateMatrix(float s, SkScalar matrix[20]) +{ + matrix[0] = 0.213f + 0.787f * s; + matrix[1] = 0.715f - 0.715f * s; + matrix[2] = 0.072f - 0.072f * s; + matrix[3] = matrix[4] = 0; + matrix[5] = 0.213f - 0.213f * s; + matrix[6] = 0.715f + 0.285f * s; + matrix[7] = 0.072f - 0.072f * s; + matrix[8] = matrix[9] = 0; + matrix[10] = 0.213f - 0.213f * s; + matrix[11] = 0.715f - 0.715f * s; + matrix[12] = 0.072f + 0.928f * s; + matrix[13] = matrix[14] = 0; + matrix[15] = matrix[16] = matrix[17] = 0; + matrix[18] = 1; + matrix[19] = 0; +} + +static void hueRotateMatrix(float hue, SkScalar matrix[20]) +{ + float cosHue = cosf(hue * piFloat / 180); + float sinHue = sinf(hue * piFloat / 180); + matrix[0] = 0.213f + cosHue * 0.787f - sinHue * 0.213f; + matrix[1] = 0.715f - cosHue * 0.715f - sinHue * 0.715f; + matrix[2] = 0.072f - cosHue * 0.072f + sinHue * 0.928f; + matrix[3] = matrix[4] = 0; + matrix[5] = 0.213f - cosHue * 0.213f + sinHue * 0.143f; + matrix[6] = 0.715f + cosHue * 0.285f + sinHue * 0.140f; + matrix[7] = 0.072f - cosHue * 0.072f - sinHue * 0.283f; + matrix[8] = matrix[9] = 0; + matrix[10] = 0.213f - cosHue * 0.213f - sinHue * 0.787f; + matrix[11] = 0.715f - cosHue * 0.715f + sinHue * 0.715f; + matrix[12] = 0.072f + cosHue * 0.928f + sinHue * 0.072f; + matrix[13] = matrix[14] = 0; + matrix[15] = matrix[16] = matrix[17] = 0; + matrix[18] = 1; + matrix[19] = 0; +} + +static void luminanceToAlphaMatrix(SkScalar matrix[20]) +{ + memset(matrix, 0, 20 * sizeof(SkScalar)); + matrix[15] = 0.2125f; + matrix[16] = 0.7154f; + matrix[17] = 0.0721f; +} + +bool FEColorMatrix::platformApplySkia() +{ + ImageBuffer* resultImage = createImageBufferResult(); + if (!resultImage) + return false; + + FilterEffect* in = inputEffect(0); + + IntRect imageRect(IntPoint(), absolutePaintRect().size()); + + SkScalar matrix[20]; + + switch (m_type) { + case FECOLORMATRIX_TYPE_UNKNOWN: + break; + case FECOLORMATRIX_TYPE_MATRIX: + for (int i = 0; i < 20; ++i) + matrix[i] = m_values[i]; + + matrix[4] *= SkScalar(255); + matrix[9] *= SkScalar(255); + matrix[14] *= SkScalar(255); + matrix[19] *= SkScalar(255); + break; + case FECOLORMATRIX_TYPE_SATURATE: + saturateMatrix(m_values[0], matrix); + break; + case FECOLORMATRIX_TYPE_HUEROTATE: + hueRotateMatrix(m_values[0], matrix); + break; + case FECOLORMATRIX_TYPE_LUMINANCETOALPHA: + luminanceToAlphaMatrix(matrix); + break; + } + + RefPtr<Image> image = in->asImageBuffer()->copyImage(DontCopyBackingStore); + NativeImageSkia* nativeImage = image->nativeImageForCurrentFrame(); + if (!nativeImage) + return false; + + SkCanvas* canvas = resultImage->context()->platformContext()->canvas(); + SkPaint paint; + paint.setColorFilter(new SkColorMatrixFilter(matrix))->unref(); + paint.setXfermodeMode(SkXfermode::kSrc_Mode); + canvas->drawBitmap(nativeImage->bitmap(), 0, 0, &paint); + return true; +} + +} // namespace WebCore + +#endif // ENABLE(FILTERS) && USE(SKIA) diff --git a/Source/WebCore/platform/graphics/filters/skia/FEGaussianBlurSkia.cpp b/Source/WebCore/platform/graphics/filters/skia/FEGaussianBlurSkia.cpp index ceb1146c7..4b36751fa 100644 --- a/Source/WebCore/platform/graphics/filters/skia/FEGaussianBlurSkia.cpp +++ b/Source/WebCore/platform/graphics/filters/skia/FEGaussianBlurSkia.cpp @@ -32,11 +32,11 @@ namespace WebCore { -void FEGaussianBlur::platformApplySkia() +bool FEGaussianBlur::platformApplySkia() { ImageBuffer* resultImage = createImageBufferResult(); if (!resultImage) - return; + return false; FilterEffect* in = inputEffect(0); @@ -57,7 +57,7 @@ void FEGaussianBlur::platformApplySkia() paint.setColor(0xFFFFFFFF); dstContext->drawImage(image.get(), ColorSpaceDeviceRGB, drawingRegion.location(), CompositeCopy); canvas->restore(); - return; + return true; } }; diff --git a/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp b/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp index 3cc6be713..5d6e7fb26 100644 --- a/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp +++ b/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp @@ -162,9 +162,4 @@ float SimpleFontData::platformWidthForGlyph(Glyph glyph) const return w; } -void SimpleFontData::updateGlyphWithVariationSelector(UChar32 character, UChar32 selector, Glyph& glyph) const -{ - // FIXME: Implement. -} - } diff --git a/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp index 32f587c46..fd5e977ce 100644 --- a/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp +++ b/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp @@ -212,7 +212,7 @@ static void webkit_web_src_class_init(WebKitWebSrcClass* klass) static void webkit_web_src_init(WebKitWebSrc* src) { - GstPadTemplate* padTemplate = gst_static_pad_template_get(&srcTemplate); + GRefPtr<GstPadTemplate> padTemplate = adoptGRef(gst_static_pad_template_get(&srcTemplate)); WebKitWebSrcPrivate* priv = WEBKIT_WEB_SRC_GET_PRIVATE(src); src->priv = priv; @@ -232,7 +232,7 @@ static void webkit_web_src_init(WebKitWebSrc* src) GRefPtr<GstPad> targetPad = adoptGRef(gst_element_get_static_pad(GST_ELEMENT(priv->appsrc), "src")); - priv->srcpad = gst_ghost_pad_new_from_template("src", targetPad.get(), padTemplate); + priv->srcpad = gst_ghost_pad_new_from_template("src", targetPad.get(), padTemplate.get()); gst_element_add_pad(GST_ELEMENT(src), priv->srcpad); gst_pad_set_query_function(priv->srcpad, webKitWebSrcQuery); diff --git a/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp b/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp index 5045e1070..f8bef5c00 100644 --- a/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp +++ b/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp @@ -36,6 +36,7 @@ #include "PlatformSupport.h" #include "SkAdvancedTypefaceMetrics.h" +#include "SkFontHost.h" #include "SkPaint.h" #include "SkTypeface.h" @@ -116,9 +117,17 @@ int FontPlatformData::emSizeInFontUnits() const if (m_emSizeInFontUnits) return m_emSizeInFontUnits; + // FIXME: Switch to the SkTypeface::GetUnitsPerEm API once this becomes available. + // https://bugs.webkit.org/show_bug.cgi?id=75961 +#if OS(ANDROID) + // Android doesn't currently support Skia's getAdvancedTypefaceMetrics(), + // but it has access to another method to replace this functionality. + m_emSizeInFontUnits = SkFontHost::GetUnitsPerEm(m_typeface->uniqueID()); +#else SkAdvancedTypefaceMetrics* metrics = m_typeface->getAdvancedTypefaceMetrics(SkAdvancedTypefaceMetrics::kNo_PerGlyphInfo); m_emSizeInFontUnits = metrics->fEmSize; metrics->unref(); +#endif return m_emSizeInFontUnits; } diff --git a/Source/WebCore/platform/graphics/harfbuzz/SimpleFontDataSkia.cpp b/Source/WebCore/platform/graphics/harfbuzz/SimpleFontDataSkia.cpp index d02c12ada..782b02fa9 100644 --- a/Source/WebCore/platform/graphics/harfbuzz/SimpleFontDataSkia.cpp +++ b/Source/WebCore/platform/graphics/harfbuzz/SimpleFontDataSkia.cpp @@ -236,9 +236,4 @@ float SimpleFontData::platformWidthForGlyph(Glyph glyph) const return round(SkScalarToFloat(width)); } -void SimpleFontData::updateGlyphWithVariationSelector(UChar32 character, UChar32 selector, Glyph& glyph) const -{ - // FIXME: Implement. -} - } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm b/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm index 17f226495..54c03f879 100644 --- a/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm +++ b/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm @@ -467,32 +467,4 @@ bool SimpleFontData::canRenderCombiningCharacterSequence(const UChar* characters return true; } -static inline void decomposeToUTF16(UChar* buffer, unsigned& length, const UChar32 character) -{ - if (U_IS_BMP(character)) { - buffer[length] = character; - ++length; - return; - } - - buffer[length] = U16_LEAD(character); - buffer[length + 1] = U16_TRAIL(character); - length += 2; -} - -void SimpleFontData::updateGlyphWithVariationSelector(UChar32 character, UChar32 selector, Glyph& glyph) const -{ - unsigned length = 0; - UChar buffer[4]; - - decomposeToUTF16(buffer, length, character); - decomposeToUTF16(buffer, length, selector); - ASSERT(length <= 4); - - CGGlyph glyphs[4]; - wkGetGlyphsForCharacters(platformData().cgFont(), buffer, glyphs, length); - if (glyphs[0]) - glyph = glyphs[0]; -} - } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp index f5c44e536..16a3b4a9c 100644 --- a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp +++ b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp @@ -1248,7 +1248,7 @@ String GraphicsContext3D::getProgramInfoLog(Platform3DObject program) return String(); GLsizei size = 0; - OwnArrayPtr<GLchar> info = adoptArrayPtr(static_cast<GLchar*>(fastMalloc(length))); + OwnArrayPtr<GLchar> info = adoptArrayPtr(new GLchar[length]); ::glGetProgramInfoLog(program, length, &size, info.get()); return String(info.get()); @@ -1315,7 +1315,7 @@ String GraphicsContext3D::getShaderInfoLog(Platform3DObject shader) return String(); GLsizei size = 0; - OwnArrayPtr<GLchar> info = adoptArrayPtr(static_cast<GLchar*>(fastMalloc(length))); + OwnArrayPtr<GLchar> info = adoptArrayPtr(new GLchar[length]); ::glGetShaderInfoLog(shader, length, &size, info.get()); return String(info.get()); diff --git a/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp b/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp index 28ee2ba10..0ff7022e3 100644 --- a/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp +++ b/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp @@ -41,6 +41,16 @@ #include <GL/gl.h> #endif +#if defined(TEXMAP_OPENGL_ES_2) +#include <EGL/egl.h> +#elif OS(WINDOWS) +#include <windows.h> +#elif OS(MAC_OS_X) +#include <AGL/agl.h> +#elif defined(XP_UNIX) +#include <GL/glx.h> +#endif + #if !defined(TEXMAP_OPENGL_ES_2) && !PLATFORM(QT) extern "C" { void glUniform1f(GLint, GLfloat); @@ -103,7 +113,60 @@ inline static void debugGLCommand(const char* command, int line) #endif struct TextureMapperGLData { - static struct GlobalGLData { + struct SharedGLData : public RefCounted<SharedGLData> { +#if defined(TEXMAP_OPENGL_ES_2) + typedef EGLContext GLContext; + static GLContext getCurrentGLContext() + { + return eglGetCurrentContext(); + } +#elif OS(WINDOWS) + typedef HGLRC GLContext; + static GLContext getCurrentGLContext() + { + return wglGetCurrentContext(); + } +#elif OS(MAC_OS_X) + typedef AGLContext GLContext; + static GLContext getCurrentGLContext() + { + return aglGetCurrentContext(); + } +#elif defined(XP_UNIX) + typedef GLXContext GLContext; + static GLContext getCurrentGLContext() + { + return glXGetCurrentContext(); + } +#else + // Default implementation for unknown opengl. + // Returns always increasing number and disables GL context data sharing. + typedef unsigned int GLContext; + static GLContext getCurrentGLContext() + { + static GLContext dummyContextCounter = 0; + return ++dummyContextCounter; + } + +#endif + + typedef HashMap<GLContext, SharedGLData*> GLContextDataMap; + static GLContextDataMap& glContextDataMap() + { + static GLContextDataMap map; + return map; + } + + static PassRefPtr<SharedGLData> currentSharedGLData() + { + GLContext currentGLConext = getCurrentGLContext(); + GLContextDataMap::iterator it = glContextDataMap().find(currentGLConext); + if (it != glContextDataMap().end()) + return it->second; + + return adoptRef(new SharedGLData(getCurrentGLContext())); + } + enum ShaderProgramIndex { NoProgram = -1, SimpleProgram, @@ -128,6 +191,9 @@ struct TextureMapperGLData { GLuint id; GLuint vertexAttrib; GLint vars[VariableCount]; + GLuint vertexShader; + GLuint fragmentShader; + ProgramInfo() : id(0) { } }; GLint getUniformLocation(ShaderProgramIndex prog, ShaderVariableIndex var, const char* name) @@ -149,16 +215,53 @@ struct TextureMapperGLData { GL_CMD(glLinkProgram(programID)) programs[index].vertexAttrib = glGetAttribLocation(programID, "InVertex"); programs[index].id = programID; + programs[index].vertexShader = vertexShader; + programs[index].fragmentShader = fragmentShader; + } + + void deleteShaderProgram(ShaderProgramIndex index) + { + ProgramInfo& programInfo = programs[index]; + GLuint programID = programInfo.id; + if (!programID) + return; + + GL_CMD(glDetachShader(programID, programInfo.vertexShader)) + GL_CMD(glDeleteShader(programInfo.vertexShader)) + GL_CMD(glDetachShader(programID, programInfo.fragmentShader)) + GL_CMD(glDeleteShader(programInfo.fragmentShader)) + GL_CMD(glDeleteProgram(programID)) } + void initializeShaders(); + ProgramInfo programs[ProgramCount]; int stencilIndex; - GlobalGLData() - : stencilIndex(1) - { } - } globalGLData; + SharedGLData(GLContext glContext) : stencilIndex(1) + { + glContextDataMap().add(glContext, this); + initializeShaders(); + } + + ~SharedGLData() + { + for (int i = SimpleProgram; i < ProgramCount; ++i) + deleteShaderProgram(ShaderProgramIndex(i)); + + GLContextDataMap::const_iterator end = glContextDataMap().end(); + GLContextDataMap::iterator it; + for (it = glContextDataMap().begin(); it != end; ++it) { + if (it->second == this) + break; + } + + ASSERT(it != end); + glContextDataMap().remove(it); + } + + }; struct DirectlyCompositedImageRepository { struct Entry { @@ -211,17 +314,22 @@ struct TextureMapperGLData { } } directlyCompositedImages; + SharedGLData& sharedGLData() const + { + return *(m_sharedGLData.get()); + } + TextureMapperGLData() - : currentProgram(TextureMapperGLData::GlobalGLData::NoProgram) + : currentProgram(SharedGLData::NoProgram) + , m_sharedGLData(TextureMapperGLData::SharedGLData::currentSharedGLData()) { } TransformationMatrix projectionMatrix; int currentProgram; int previousProgram; + RefPtr<SharedGLData> m_sharedGLData; }; -TextureMapperGLData::GlobalGLData TextureMapperGLData::globalGLData; - class BitmapTextureGL : public BitmapTexture { public: virtual void destroy(); @@ -289,11 +397,11 @@ private: }; #define TEXMAP_GET_SHADER_VAR_LOCATION(prog, var) \ - if (TextureMapperGLData::globalGLData.getUniformLocation(TextureMapperGLData::globalGLData.prog##Program, TextureMapperGLData::globalGLData.var##Variable, #var) < 0) \ + if (getUniformLocation(prog##Program, var##Variable, #var) < 0) \ LOG_ERROR("Couldn't find variable "#var" in program "#prog"\n"); #define TEXMAP_BUILD_SHADER(program) \ - TextureMapperGLData::globalGLData.createShaderProgram(vertexShaderSource##program, fragmentShaderSource##program, TextureMapperGLData::globalGLData.program##Program); + createShaderProgram(vertexShaderSource##program, fragmentShaderSource##program, program##Program); TextureMapperGL::TextureMapperGL() : m_data(new TextureMapperGLData) @@ -301,12 +409,8 @@ TextureMapperGL::TextureMapperGL() { } -void TextureMapperGL::initializeShaders() +void TextureMapperGLData::SharedGLData::initializeShaders() { - static bool shadersCompiled = false; - if (shadersCompiled) - return; - shadersCompiled = true; #ifndef TEXMAP_OPENGL_ES_2 #define OES2_PRECISION_DEFINITIONS \ "#define lowp\n#define highp\n" @@ -322,6 +426,9 @@ void TextureMapperGL::initializeShaders() OES2_FRAGMENT_SHADER_DEFAULT_PRECISION\ #src + if (!initializeOpenGLShims()) + return; + const char* fragmentShaderSourceOpacityAndMask = FRAGMENT_SHADER( uniform sampler2D SourceTexture, MaskTexture; @@ -426,7 +533,6 @@ void TextureMapperGL::beginPainting() glClear(GL_STENCIL_BUFFER_BIT); bindSurface(0); #endif - initializeShaders(); } void TextureMapperGL::endPainting() @@ -454,13 +560,13 @@ void TextureMapperGL::drawTexture(const BitmapTexture& texture, const FloatRect& void TextureMapperGL::drawTexture(uint32_t texture, bool opaque, const FloatSize& relativeSize, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix, float opacity, const BitmapTexture* maskTexture, bool flip) { - TextureMapperGLData::GlobalGLData::ShaderProgramIndex program; + TextureMapperGLData::SharedGLData::ShaderProgramIndex program; if (maskTexture) - program = TextureMapperGLData::GlobalGLData::OpacityAndMaskProgram; + program = TextureMapperGLData::SharedGLData::OpacityAndMaskProgram; else - program = TextureMapperGLData::GlobalGLData::SimpleProgram; + program = TextureMapperGLData::SharedGLData::SimpleProgram; - const TextureMapperGLData::GlobalGLData::ProgramInfo& programInfo = data().globalGLData.programs[program]; + const TextureMapperGLData::SharedGLData::ProgramInfo& programInfo = data().sharedGLData().programs[program]; GL_CMD(glUseProgram(programInfo.id)) data().currentProgram = program; GL_CMD(glEnableVertexAttribArray(programInfo.vertexAttrib)) @@ -487,10 +593,10 @@ void TextureMapperGL::drawTexture(uint32_t texture, bool opaque, const FloatSize 0, 0, 1, 0, 0, flip ? relativeSize.height() : 0, 0, 1}; - GL_CMD(glUniformMatrix4fv(programInfo.vars[TextureMapperGLData::GlobalGLData::InMatrixVariable], 1, GL_FALSE, m4)) - GL_CMD(glUniformMatrix4fv(programInfo.vars[TextureMapperGLData::GlobalGLData::InSourceMatrixVariable], 1, GL_FALSE, m4src)) - GL_CMD(glUniform1i(programInfo.vars[TextureMapperGLData::GlobalGLData::SourceTextureVariable], 0)) - GL_CMD(glUniform1f(programInfo.vars[TextureMapperGLData::GlobalGLData::OpacityVariable], opacity)) + GL_CMD(glUniformMatrix4fv(programInfo.vars[TextureMapperGLData::SharedGLData::InMatrixVariable], 1, GL_FALSE, m4)) + GL_CMD(glUniformMatrix4fv(programInfo.vars[TextureMapperGLData::SharedGLData::InSourceMatrixVariable], 1, GL_FALSE, m4src)) + GL_CMD(glUniform1i(programInfo.vars[TextureMapperGLData::SharedGLData::SourceTextureVariable], 0)) + GL_CMD(glUniform1f(programInfo.vars[TextureMapperGLData::SharedGLData::OpacityVariable], opacity)) if (maskTexture && maskTexture->isValid()) { const BitmapTextureGL* maskTextureGL = static_cast<const BitmapTextureGL*>(maskTexture); @@ -500,8 +606,8 @@ void TextureMapperGL::drawTexture(uint32_t texture, bool opaque, const FloatSize 0, maskTextureGL->relativeSize().height(), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}; - GL_CMD(glUniformMatrix4fv(programInfo.vars[TextureMapperGLData::GlobalGLData::InMaskMatrixVariable], 1, GL_FALSE, m4mask)); - GL_CMD(glUniform1i(programInfo.vars[TextureMapperGLData::GlobalGLData::MaskTextureVariable], 1)) + GL_CMD(glUniformMatrix4fv(programInfo.vars[TextureMapperGLData::SharedGLData::InMaskMatrixVariable], 1, GL_FALSE, m4mask)); + GL_CMD(glUniform1i(programInfo.vars[TextureMapperGLData::SharedGLData::MaskTextureVariable], 1)) GL_CMD(glActiveTexture(GL_TEXTURE0)) } @@ -670,7 +776,7 @@ static inline TransformationMatrix createProjectionMatrix(const IntSize& size, b void BitmapTextureGL::bind() { - int& stencilIndex = TextureMapperGLData::globalGLData.stencilIndex; + int& stencilIndex = m_textureMapper->data().sharedGLData().stencilIndex; if (m_surfaceNeedsReset || !m_fbo) { if (!m_fbo) GL_CMD(glGenFramebuffers(1, &m_fbo)) @@ -743,7 +849,7 @@ void TextureMapperGL::bindSurface(BitmapTexture *surfacePointer) if (!surface) { GL_CMD(glBindFramebuffer(GL_FRAMEBUFFER, 0)) data().projectionMatrix = createProjectionMatrix(viewportSize(), true).multiply(transform()); - GL_CMD(glStencilFunc(data().globalGLData.stencilIndex > 1 ? GL_EQUAL : GL_ALWAYS, data().globalGLData.stencilIndex - 1, data().globalGLData.stencilIndex - 1)) + GL_CMD(glStencilFunc(data().sharedGLData().stencilIndex > 1 ? GL_EQUAL : GL_ALWAYS, data().sharedGLData().stencilIndex - 1, data().sharedGLData().stencilIndex - 1)) GL_CMD(glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP)) GL_CMD(glViewport(0, 0, viewportSize().width(), viewportSize().height())) return; @@ -754,8 +860,8 @@ void TextureMapperGL::bindSurface(BitmapTexture *surfacePointer) void TextureMapperGL::beginClip(const TransformationMatrix& modelViewMatrix, const FloatRect& targetRect) { - TextureMapperGLData::GlobalGLData::ShaderProgramIndex program = TextureMapperGLData::GlobalGLData::ClipProgram; - const TextureMapperGLData::GlobalGLData::ProgramInfo& programInfo = data().globalGLData.programs[program]; + TextureMapperGLData::SharedGLData::ShaderProgramIndex program = TextureMapperGLData::SharedGLData::ClipProgram; + const TextureMapperGLData::SharedGLData::ProgramInfo& programInfo = data().sharedGLData().programs[program]; GL_CMD(glUseProgram(programInfo.id)) GL_CMD(glEnableVertexAttribArray(programInfo.vertexAttrib)) const GLfloat unitRect[] = {0, 0, 1, 0, 1, 1, 0, 1}; @@ -775,9 +881,9 @@ void TextureMapperGL::beginClip(const TransformationMatrix& modelViewMatrix, con matrix.m41(), matrix.m42(), matrix.m43(), matrix.m44() }; - int& stencilIndex = data().globalGLData.stencilIndex; + int& stencilIndex = data().sharedGLData().stencilIndex; - GL_CMD(glUniformMatrix4fv(programInfo.vars[TextureMapperGLData::GlobalGLData::InMatrixVariable], 1, GL_FALSE, m4)) + GL_CMD(glUniformMatrix4fv(programInfo.vars[TextureMapperGLData::SharedGLData::InMatrixVariable], 1, GL_FALSE, m4)) GL_CMD(glEnable(GL_STENCIL_TEST)) GL_CMD(glStencilFunc(GL_NEVER, stencilIndex, stencilIndex)) GL_CMD(glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE)) @@ -791,8 +897,8 @@ void TextureMapperGL::beginClip(const TransformationMatrix& modelViewMatrix, con void TextureMapperGL::endClip() { - data().globalGLData.stencilIndex >>= 1; - glStencilFunc(data().globalGLData.stencilIndex > 1 ? GL_EQUAL : GL_ALWAYS, data().globalGLData.stencilIndex - 1, data().globalGLData.stencilIndex - 1); + data().sharedGLData().stencilIndex >>= 1; + glStencilFunc(data().sharedGLData().stencilIndex > 1 ? GL_EQUAL : GL_ALWAYS, data().sharedGLData().stencilIndex - 1, data().sharedGLData().stencilIndex - 1); } PassRefPtr<BitmapTexture> TextureMapperGL::createTexture() diff --git a/Source/WebCore/platform/graphics/opengl/TextureMapperGL.h b/Source/WebCore/platform/graphics/opengl/TextureMapperGL.h index 6f4c29d80..dd2e1a7c9 100644 --- a/Source/WebCore/platform/graphics/opengl/TextureMapperGL.h +++ b/Source/WebCore/platform/graphics/opengl/TextureMapperGL.h @@ -55,7 +55,6 @@ public: virtual bool isOpenGLBacked() const { return true; } private: - void initializeShaders(); inline TextureMapperGLData& data() { return *m_data; } TextureMapperGLData* m_data; GraphicsContext* m_context; diff --git a/Source/WebCore/platform/graphics/pango/SimpleFontDataPango.cpp b/Source/WebCore/platform/graphics/pango/SimpleFontDataPango.cpp index d6428d98e..ee8ee0f74 100644 --- a/Source/WebCore/platform/graphics/pango/SimpleFontDataPango.cpp +++ b/Source/WebCore/platform/graphics/pango/SimpleFontDataPango.cpp @@ -160,9 +160,4 @@ float SimpleFontData::platformWidthForGlyph(Glyph glyph) const return width; } -void SimpleFontData::updateGlyphWithVariationSelector(UChar32 character, UChar32 selector, Glyph& glyph) const -{ - // FIXME: Implement. -} - } diff --git a/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp b/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp index 4ff23be1c..e95b8c5ea 100644 --- a/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp +++ b/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp @@ -189,9 +189,4 @@ void SimpleFontData::platformDestroy() { } -void SimpleFontData::updateGlyphWithVariationSelector(UChar32 character, UChar32 selector, Glyph& glyph) const -{ - // FIXME: Implement. -} - } diff --git a/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp index 9135ff4e0..db343615f 100644 --- a/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp @@ -440,7 +440,17 @@ static void setPathFromConvexPoints(SkPath* path, size_t numPoints, const FloatP path->lineTo(WebCoreFloatToSkScalar(points[i].x()), WebCoreFloatToSkScalar(points[i].y())); } - path->setIsConvex(true); + + /* The code used to just blindly call this + path->setIsConvex(true); + But webkit can sometimes send us non-convex 4-point values, so we mark the path's + convexity as unknown, so it will get computed by skia at draw time. + See crbug.com 108605 + */ + SkPath::Convexity convexity = SkPath::kConvex_Convexity; + if (numPoints == 4) + convexity = SkPath::kUnknown_Convexity; + path->setConvexity(convexity); } void GraphicsContext::drawConvexPolygon(size_t numPoints, diff --git a/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp b/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp index 37d459d16..f96c5690d 100644 --- a/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp @@ -93,6 +93,13 @@ static SkCanvas* createAcceleratedCanvas(const IntSize& size, ImageBufferData* d return canvas; } +static SkCanvas* createNonPlatformCanvas(const IntSize& size) +{ + SkCanvas* canvas = new SkCanvas(); + canvas->setDevice(new SkDevice(SkBitmap::kARGB_8888_Config, size.width(), size.height()))->unref(); + return canvas; +} + ImageBuffer::ImageBuffer(const IntSize& size, ColorSpace, RenderingMode renderingMode, bool& success) : m_data(size) , m_size(size) @@ -101,6 +108,8 @@ ImageBuffer::ImageBuffer(const IntSize& size, ColorSpace, RenderingMode renderin if (renderingMode == Accelerated) canvas = adoptPtr(createAcceleratedCanvas(size, &m_data)); + else if (renderingMode == UnacceleratedNonPlatformBuffer) + canvas = adoptPtr(createNonPlatformCanvas(size)); if (!canvas) canvas = adoptPtr(skia::TryCreateBitmapCanvas(size.width(), size.height(), false)); diff --git a/Source/WebCore/platform/graphics/skia/PathSkia.cpp b/Source/WebCore/platform/graphics/skia/PathSkia.cpp index 7c8aea070..0ba6d070e 100644 --- a/Source/WebCore/platform/graphics/skia/PathSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/PathSkia.cpp @@ -197,7 +197,7 @@ static FloatPoint* convertPathPoints(FloatPoint dst[], const SkPoint src[], int void Path::apply(void* info, PathApplierFunction function) const { - SkPath::Iter iter(*m_path, false); + SkPath::RawIter iter(*m_path); SkPoint pts[4]; PathElement pathElement; FloatPoint pathPoints[3]; diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapper.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapper.cpp new file mode 100644 index 000000000..2622d21ca --- /dev/null +++ b/Source/WebCore/platform/graphics/texmap/TextureMapper.cpp @@ -0,0 +1,79 @@ +/* + Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "TextureMapper.h" + +#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER) + +namespace WebCore { + +PassRefPtr<BitmapTexture> TextureMapper::acquireTextureFromPool(const IntSize& size) +{ + if (m_texturePool.isEmpty()) { + RefPtr<BitmapTexture> selectedTexture = createTexture(); + selectedTexture->reset(size, false); + selectedTexture->lock(); + return selectedTexture; + } + + size_t index = 0; + RefPtr<BitmapTexture> selectedTexture = m_texturePool[0]; + + for (size_t i = 1; i < m_texturePool.size(); ++i) { + RefPtr<BitmapTexture> texture = m_texturePool[i]; + + IntSize textureSize = texture->size(); + IntSize selectedTextureSize = selectedTexture->size(); + + // We prefer to pick a texture that's equal or larger than the requested size. + if (textureSize.width() < size.width() || textureSize.height() < size.height()) + continue; + + // We select the new texture if the currently selected texture is smaller than the + // required size, and the new texture has a smaller area. + int textureArea = textureSize.width() * textureSize.height(); + int selectedTextureArea = selectedTextureSize.width() * selectedTextureSize.height(); + bool selectedTextureFitsSize = + selectedTextureSize.width() >= size.width() + && selectedTextureSize.height() >= size.height(); + + if (selectedTextureFitsSize && selectedTextureArea <= textureArea) + continue; + + selectedTexture = texture; + index = i; + } + + m_texturePool.remove(index); + selectedTexture->reset(size, false); + selectedTexture->lock(); + return selectedTexture; +} + +void TextureMapper::releaseTextureToPool(BitmapTexture* texture) +{ + if (!texture) + return; + m_texturePool.append(texture); + texture->unlock(); +} + +} +#endif diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapper.h b/Source/WebCore/platform/graphics/texmap/TextureMapper.h index 27058aaca..d81333daa 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapper.h +++ b/Source/WebCore/platform/graphics/texmap/TextureMapper.h @@ -126,6 +126,9 @@ public: virtual void beginPainting() { } virtual void endPainting() { } + virtual void releaseTextureToPool(BitmapTexture* surface); + virtual PassRefPtr<BitmapTexture> acquireTextureFromPool(const IntSize&); + protected: TextureMapper() @@ -138,6 +141,7 @@ private: TextDrawingModeFlags m_textDrawingMode; TransformationMatrix m_transform; IntSize m_viewportSize; + Vector<RefPtr<BitmapTexture> > m_texturePool; }; }; diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperNode.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperNode.cpp index 9157e23ac..15dff5aeb 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperNode.cpp +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperNode.cpp @@ -31,40 +31,6 @@ namespace { namespace WebCore { -class TextureMapperSurfaceManager { -public: - TextureMapper* textureMapper; - Vector<RefPtr<BitmapTexture> > surfaces; - IntSize viewportSize; - - PassRefPtr<BitmapTexture> getIntermediateSurface() - { - IntSize newViewportSize = textureMapper->viewportSize(); - if (newViewportSize != viewportSize) { - viewportSize = newViewportSize; - surfaces.clear(); - } - if (surfaces.isEmpty()) { - RefPtr<BitmapTexture> newSurface = textureMapper->createTexture(); - newSurface->reset(viewportSize, false); - return newSurface.get(); - } - RefPtr<BitmapTexture> surface = surfaces.last(); - surface->reset(viewportSize, false); - surfaces.removeLast(); - surface->lock(); - return surface.get(); - } - - void releaseIntermediateSurface(BitmapTexture* surface) - { - if (!surface) - return; - surfaces.append(surface); - surface->unlock(); - } -}; - TextureMapperNode* toTextureMapperNode(GraphicsLayer* layer) { return layer ? toGraphicsLayerTextureMapper(layer)->node() : 0; @@ -346,11 +312,7 @@ void TextureMapperNode::paint() if (m_size.isEmpty()) return; - if (!m_surfaceManager) - m_surfaceManager = new TextureMapperSurfaceManager; - m_surfaceManager->textureMapper = m_textureMapper; TextureMapperPaintOptions opt; - opt.surfaceManager = m_surfaceManager; opt.textureMapper = m_textureMapper; opt.textureMapper->bindSurface(0); paintRecursive(opt); @@ -496,7 +458,7 @@ bool TextureMapperNode::paintReflection(const TextureMapperPaintOptions& options // The mask has to be adjusted to target coordinates. if (maskTexture) { - maskSurface = options.surfaceManager->getIntermediateSurface(); + maskSurface = options.textureMapper->acquireTextureFromPool(options.textureMapper->viewportSize()); options.textureMapper->bindSurface(maskSurface.get()); options.textureMapper->drawTexture(*maskTexture.get(), entireRect(), m_transforms.target, 1, 0); maskTexture = maskSurface; @@ -504,7 +466,7 @@ bool TextureMapperNode::paintReflection(const TextureMapperPaintOptions& options // The replica's mask has to be adjusted to target coordinates. if (replicaMaskTexture) { - replicaMaskSurface = options.surfaceManager->getIntermediateSurface(); + replicaMaskSurface = options.textureMapper->acquireTextureFromPool(options.textureMapper->viewportSize()); options.textureMapper->bindSurface(replicaMaskSurface.get()); options.textureMapper->drawTexture(*replicaMaskTexture.get(), entireRect(), m_transforms.target, 1, 0); replicaMaskTexture = replicaMaskSurface; @@ -512,21 +474,21 @@ bool TextureMapperNode::paintReflection(const TextureMapperPaintOptions& options // We might need to apply the mask of the content layer before we draw the reflection, as there might be yet another mask for the reflection itself. if (useIntermediateBufferForMask) { - RefPtr<BitmapTexture> maskSurface = options.surfaceManager->getIntermediateSurface(); + RefPtr<BitmapTexture> maskSurface = options.textureMapper->acquireTextureFromPool(options.textureMapper->viewportSize()); options.textureMapper->bindSurface(maskSurface.get()); options.textureMapper->drawTexture(*surface.get(), viewportRect, TransformationMatrix(), 1, maskTexture.get()); - options.surfaceManager->releaseIntermediateSurface(surface.get()); + options.textureMapper->releaseTextureToPool(surface.get()); surface = maskSurface; maskTexture.clear(); } // We blend the layer and its replica in an intermediate buffer before blending into the target surface. if (useIntermediateBufferForReplica) { - RefPtr<BitmapTexture> replicaSurface = options.surfaceManager->getIntermediateSurface(); + RefPtr<BitmapTexture> replicaSurface = options.textureMapper->acquireTextureFromPool(options.textureMapper->viewportSize()); options.textureMapper->bindSurface(replicaSurface.get()); options.textureMapper->drawTexture(*surface.get(), viewportRect, m_transforms.replica, m_state.replicaLayer->m_opacity, replicaMaskTexture.get()); options.textureMapper->drawTexture(*surface.get(), viewportRect, TransformationMatrix(), 1, maskTexture.get()); - options.surfaceManager->releaseIntermediateSurface(surface.get()); + options.textureMapper->releaseTextureToPool(surface.get()); surface = replicaSurface; } @@ -539,8 +501,8 @@ bool TextureMapperNode::paintReflection(const TextureMapperPaintOptions& options // Draw the original. options.textureMapper->drawTexture(*surface.get(), viewportRect, TransformationMatrix(), options.opacity, maskTexture.get()); - options.surfaceManager->releaseIntermediateSurface(maskSurface.get()); - options.surfaceManager->releaseIntermediateSurface(replicaMaskSurface.get()); + options.textureMapper->releaseTextureToPool(maskSurface.get()); + options.textureMapper->releaseTextureToPool(replicaMaskSurface.get()); return true; } @@ -570,12 +532,12 @@ void TextureMapperNode::paintRecursive(TextureMapperPaintOptions options) // The mask has to be adjusted to target coordinates. if (m_state.maskLayer) { - maskSurface = options.surfaceManager->getIntermediateSurface(); + maskSurface = options.textureMapper->acquireTextureFromPool(options.textureMapper->viewportSize()); options.textureMapper->bindSurface(maskSurface.get()); options.textureMapper->drawTexture(*m_state.maskLayer->texture(), entireRect(), m_transforms.target, 1.0, 0); } - surface = options.surfaceManager->getIntermediateSurface(); + surface = options.textureMapper->acquireTextureFromPool(options.textureMapper->viewportSize()); optionsForDescendants.surface = surface.get(); options.isSurface = true; optionsForDescendants.opacity = 1; @@ -588,8 +550,8 @@ void TextureMapperNode::paintRecursive(TextureMapperPaintOptions options) options.textureMapper->drawTexture(*surface.get(), viewportRect, TransformationMatrix(), options.opacity, 0); } - options.surfaceManager->releaseIntermediateSurface(surface.get()); - options.surfaceManager->releaseIntermediateSurface(maskSurface.get()); + options.textureMapper->releaseTextureToPool(surface.get()); + options.textureMapper->releaseTextureToPool(maskSurface.get()); } TextureMapperNode::~TextureMapperNode() diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperNode.h b/Source/WebCore/platform/graphics/texmap/TextureMapperNode.h index fc479bac6..b40cd5d38 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperNode.h +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperNode.h @@ -39,17 +39,20 @@ namespace WebCore { class TextureMapperPlatformLayer; class TextureMapperNode; class GraphicsLayerTextureMapper; -class TextureMapperSurfaceManager; class TextureMapperPaintOptions { public: BitmapTexture* surface; TextureMapper* textureMapper; - TextureMapperSurfaceManager* surfaceManager; float opacity; bool isSurface; - TextureMapperPaintOptions() : surface(0), textureMapper(0), opacity(1.0), isSurface(false) { } + TextureMapperPaintOptions() + : surface(0) + , textureMapper(0) + , opacity(1) + , isSurface(false) + { } }; class TextureMapperAnimation : public RefCounted<TextureMapperAnimation> { @@ -135,7 +138,11 @@ public: }; TextureMapperNode() - : m_parent(0), m_effectTarget(0), m_opacity(1.0), m_surfaceManager(0), m_textureMapper(0) { } + : m_parent(0) + , m_effectTarget(0) + , m_opacity(1) + , m_textureMapper(0) + { } virtual ~TextureMapperNode(); @@ -317,7 +324,6 @@ private: }; State m_state; - TextureMapperSurfaceManager* m_surfaceManager; TextureMapper* m_textureMapper; Vector<RefPtr<TextureMapperAnimation> > m_animations; diff --git a/Source/WebCore/platform/graphics/transforms/AffineTransform.h b/Source/WebCore/platform/graphics/transforms/AffineTransform.h index 4d6c7da9a..d3970da29 100644 --- a/Source/WebCore/platform/graphics/transforms/AffineTransform.h +++ b/Source/WebCore/platform/graphics/transforms/AffineTransform.h @@ -63,6 +63,10 @@ public: AffineTransform(); AffineTransform(double a, double b, double c, double d, double e, double f); +#if USE(CG) + AffineTransform(const CGAffineTransform&); +#endif + void setMatrix(double a, double b, double c, double d, double e, double f); void map(double x, double y, double& x2, double& y2) const; diff --git a/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp b/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp index a49abe2ef..de6687f5c 100644 --- a/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp +++ b/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp @@ -282,9 +282,4 @@ SCRIPT_FONTPROPERTIES* SimpleFontData::scriptFontProperties() const return m_scriptFontProperties; } -void SimpleFontData::updateGlyphWithVariationSelector(UChar32 character, UChar32 selector, Glyph& glyph) const -{ - // FIXME: Implement. -} - } diff --git a/Source/WebCore/platform/graphics/wince/SimpleFontDataWinCE.cpp b/Source/WebCore/platform/graphics/wince/SimpleFontDataWinCE.cpp index 1ba669074..e3b842463 100644 --- a/Source/WebCore/platform/graphics/wince/SimpleFontDataWinCE.cpp +++ b/Source/WebCore/platform/graphics/wince/SimpleFontDataWinCE.cpp @@ -180,9 +180,4 @@ void SimpleFontData::platformCharWidthInit() m_maxCharWidth = (tm.tmMaxCharWidth * m_platformData.size() + 36) / 72; } -void SimpleFontData::updateGlyphWithVariationSelector(UChar32 character, UChar32 selector, Glyph& glyph) const -{ - // FIXME: Implement. -} - } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp b/Source/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp index d98ecbd60..cb7fb3d7a 100644 --- a/Source/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp +++ b/Source/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp @@ -194,9 +194,4 @@ float SimpleFontData::widthForGDIGlyph(Glyph glyph) const } #endif -void SimpleFontData::updateGlyphWithVariationSelector(UChar32 character, UChar32 selector, Glyph& glyph) const -{ - // FIXME: Implement. -} - } diff --git a/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp b/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp index 6df47339f..0cbdd0453 100644 --- a/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp +++ b/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp @@ -75,7 +75,11 @@ extern "C" { #if defined(JCS_EXTENSIONS) && ASSUME_LITTLE_ENDIAN #define TURBO_JPEG_RGB_SWIZZLE +#if USE(SKIA) && (!SK_R32_SHIFT && SK_G32_SHIFT == 8 && SK_B32_SHIFT == 16) +inline J_COLOR_SPACE rgbOutputColorSpace() { return JCS_EXT_RGBX; } +#else inline J_COLOR_SPACE rgbOutputColorSpace() { return JCS_EXT_BGRX; } +#endif inline bool turboSwizzled(J_COLOR_SPACE colorSpace) { return colorSpace == rgbOutputColorSpace(); } #else inline J_COLOR_SPACE rgbOutputColorSpace() { return JCS_RGB; } diff --git a/Source/WebCore/platform/mac/ScrollAnimatorMac.h b/Source/WebCore/platform/mac/ScrollAnimatorMac.h index 29c13aa25..94383ca5e 100644 --- a/Source/WebCore/platform/mac/ScrollAnimatorMac.h +++ b/Source/WebCore/platform/mac/ScrollAnimatorMac.h @@ -123,13 +123,16 @@ private: FloatPoint adjustScrollPositionIfNecessary(const FloatPoint&) const; void immediateScrollTo(const FloatPoint&); - void immediateScrollBy(const FloatSize&); #if ENABLE(RUBBER_BANDING) /// ScrollElasticityControllerClient member functions. virtual IntSize stretchAmount() OVERRIDE; virtual bool pinnedInDirection(const FloatSize&) OVERRIDE; + virtual bool canScrollHorizontally() OVERRIDE; + virtual bool canScrollVertically() OVERRIDE; + virtual WebCore::IntPoint absoluteScrollPosition() OVERRIDE; virtual void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&) OVERRIDE; + virtual void immediateScrollBy(const FloatSize&) OVERRIDE; virtual void startSnapRubberbandTimer() OVERRIDE; virtual void stopSnapRubberbandTimer() OVERRIDE; @@ -138,7 +141,7 @@ private: bool pinnedInDirection(float deltaX, float deltaY); void snapRubberBand(); void snapRubberBandTimerFired(Timer<ScrollAnimatorMac>*); - void smoothScrollWithEvent(const PlatformWheelEvent&); + bool smoothScrollWithEvent(const PlatformWheelEvent&); void beginScrollGesture(); void endScrollGesture(); diff --git a/Source/WebCore/platform/mac/ScrollAnimatorMac.mm b/Source/WebCore/platform/mac/ScrollAnimatorMac.mm index 884a87d8b..4011f33e8 100644 --- a/Source/WebCore/platform/mac/ScrollAnimatorMac.mm +++ b/Source/WebCore/platform/mac/ScrollAnimatorMac.mm @@ -82,7 +82,7 @@ static NSTimeInterval systemUptime() return [[NSProcessInfo processInfo] systemUptime]; // Get how long system has been up. Found by looking getting "boottime" from the kernel. - static struct timeval boottime = {}; + static struct timeval boottime = {0, 0}; if (!boottime.tv_sec) { int mib[2] = {CTL_KERN, KERN_BOOTTIME}; size_t size = sizeof(boottime); @@ -690,19 +690,6 @@ void ScrollAnimatorMac::immediateScrollTo(const FloatPoint& newPosition) notifyPositionChanged(); } -void ScrollAnimatorMac::immediateScrollBy(const FloatSize& delta) -{ - float newPosX = adjustScrollXPositionIfNecessary(m_currentPosX + delta.width()); - float newPosY = adjustScrollYPositionIfNecessary(m_currentPosY + delta.height()); - - if (newPosX == m_currentPosX && newPosY == m_currentPosY) - return; - - m_currentPosX = newPosX; - m_currentPosY = newPosY; - notifyPositionChanged(); -} - void ScrollAnimatorMac::immediateScrollToPointForScrollAnimation(const FloatPoint& newPosition) { ASSERT(m_scrollAnimationHelper); @@ -1008,17 +995,7 @@ bool ScrollAnimatorMac::handleWheelEvent(const PlatformWheelEvent& wheelEvent) } } - bool isMomentumScrollEvent = (wheelEvent.momentumPhase() != PlatformWheelEventPhaseNone); - if (m_scrollElasticityController.m_ignoreMomentumScrolls && (isMomentumScrollEvent || m_scrollElasticityController.m_snapRubberbandTimerIsActive)) { - if (wheelEvent.momentumPhase() == PlatformWheelEventPhaseEnded) { - m_scrollElasticityController.m_ignoreMomentumScrolls = false; - return true; - } - return false; - } - - smoothScrollWithEvent(wheelEvent); - return true; + return smoothScrollWithEvent(wheelEvent); } void ScrollAnimatorMac::handleGestureEvent(const PlatformGestureEvent& gestureEvent) @@ -1065,6 +1042,27 @@ bool ScrollAnimatorMac::pinnedInDirection(const FloatSize& direction) return pinnedInDirection(direction.width(), direction.height()); } +bool ScrollAnimatorMac::canScrollHorizontally() +{ + Scrollbar* scrollbar = m_scrollableArea->horizontalScrollbar(); + if (!scrollbar) + return false; + return scrollbar->enabled(); +} + +bool ScrollAnimatorMac::canScrollVertically() +{ + Scrollbar* scrollbar = m_scrollableArea->verticalScrollbar(); + if (!scrollbar) + return false; + return scrollbar->enabled(); +} + +IntPoint ScrollAnimatorMac::absoluteScrollPosition() +{ + return m_scrollableArea->visibleContentRect().location() + m_scrollableArea->scrollOrigin(); +} + void ScrollAnimatorMac::immediateScrollByWithoutContentEdgeConstraints(const FloatSize& delta) { m_scrollableArea->setConstrainsScrollingToContentEdge(false); @@ -1072,6 +1070,19 @@ void ScrollAnimatorMac::immediateScrollByWithoutContentEdgeConstraints(const Flo m_scrollableArea->setConstrainsScrollingToContentEdge(true); } +void ScrollAnimatorMac::immediateScrollBy(const FloatSize& delta) +{ + float newPosX = adjustScrollXPositionIfNecessary(m_currentPosX + delta.width()); + float newPosY = adjustScrollYPositionIfNecessary(m_currentPosY + delta.height()); + + if (newPosX == m_currentPosX && newPosY == m_currentPosY) + return; + + m_currentPosX = newPosX; + m_currentPosY = newPosY; + notifyPositionChanged(); +} + void ScrollAnimatorMac::startSnapRubberbandTimer() { m_snapRubberBandTimer.startRepeating(1.0 / 60.0); @@ -1118,8 +1129,17 @@ bool ScrollAnimatorMac::allowsHorizontalStretching() const return false; } -void ScrollAnimatorMac::smoothScrollWithEvent(const PlatformWheelEvent& wheelEvent) +bool ScrollAnimatorMac::smoothScrollWithEvent(const PlatformWheelEvent& wheelEvent) { + bool isMomentumScrollEvent = (wheelEvent.momentumPhase() != PlatformWheelEventPhaseNone); + if (m_scrollElasticityController.m_ignoreMomentumScrolls && (isMomentumScrollEvent || m_scrollElasticityController.m_snapRubberbandTimerIsActive)) { + if (wheelEvent.momentumPhase() == PlatformWheelEventPhaseEnded) { + m_scrollElasticityController.m_ignoreMomentumScrolls = false; + return true; + } + return false; + } + m_haveScrolledSincePageLoad = true; float deltaX = m_scrollElasticityController.m_overflowScrollDelta.width(); @@ -1144,7 +1164,7 @@ void ScrollAnimatorMac::smoothScrollWithEvent(const PlatformWheelEvent& wheelEve bool isHorizontallyStretched = false; bool shouldStretch = false; - IntSize stretchAmount = m_scrollableArea->overhangAmount(); + IntSize stretchAmount = m_scrollElasticityController.m_client->stretchAmount(); isHorizontallyStretched = stretchAmount.width(); isVerticallyStretched = stretchAmount.height(); @@ -1207,11 +1227,11 @@ void ScrollAnimatorMac::smoothScrollWithEvent(const PlatformWheelEvent& wheelEve if (!(shouldStretch || isVerticallyStretched || isHorizontallyStretched)) { if (deltaY != 0) { deltaY *= scrollWheelMultiplier(); - immediateScrollBy(FloatSize(0, deltaY)); + m_scrollElasticityController.m_client->immediateScrollBy(FloatSize(0, deltaY)); } if (deltaX != 0) { deltaX *= scrollWheelMultiplier(); - immediateScrollBy(FloatSize(deltaX, 0)); + m_scrollElasticityController.m_client->immediateScrollBy(FloatSize(deltaX, 0)); } } else { if (!allowsHorizontalStretching()) { @@ -1220,7 +1240,7 @@ void ScrollAnimatorMac::smoothScrollWithEvent(const PlatformWheelEvent& wheelEve } else if ((deltaX != 0) && !isHorizontallyStretched && !pinnedInDirection(deltaX, 0)) { deltaX *= scrollWheelMultiplier(); - immediateScrollByWithoutContentEdgeConstraints(FloatSize(deltaX, 0)); + m_scrollElasticityController.m_client->immediateScrollByWithoutContentEdgeConstraints(FloatSize(deltaX, 0)); deltaX = 0; } @@ -1230,11 +1250,11 @@ void ScrollAnimatorMac::smoothScrollWithEvent(const PlatformWheelEvent& wheelEve } else if ((deltaY != 0) && !isVerticallyStretched && !pinnedInDirection(0, deltaY)) { deltaY *= scrollWheelMultiplier(); - immediateScrollByWithoutContentEdgeConstraints(FloatSize(0, deltaY)); + m_scrollElasticityController.m_client->immediateScrollByWithoutContentEdgeConstraints(FloatSize(0, deltaY)); deltaY = 0; } - IntSize stretchAmount = m_scrollableArea->overhangAmount(); + IntSize stretchAmount = m_scrollElasticityController.m_client->stretchAmount(); if (m_scrollElasticityController.m_momentumScrollInProgress) { if ((pinnedInDirection(eventCoalescedDeltaX, eventCoalescedDeltaY) || (fabsf(eventCoalescedDeltaX) + fabsf(eventCoalescedDeltaY) <= 0)) && m_scrollElasticityController.m_lastMomentumScrollTimestamp) { @@ -1249,7 +1269,7 @@ void ScrollAnimatorMac::smoothScrollWithEvent(const PlatformWheelEvent& wheelEve FloatSize dampedDelta(ceilf(elasticDeltaForReboundDelta(m_scrollElasticityController.m_stretchScrollForce.width())), ceilf(elasticDeltaForReboundDelta(m_scrollElasticityController.m_stretchScrollForce.height()))); - immediateScrollByWithoutContentEdgeConstraints(dampedDelta - stretchAmount); + m_scrollElasticityController.m_client->immediateScrollByWithoutContentEdgeConstraints(dampedDelta - stretchAmount); } } @@ -1258,6 +1278,8 @@ void ScrollAnimatorMac::smoothScrollWithEvent(const PlatformWheelEvent& wheelEve m_scrollElasticityController.m_ignoreMomentumScrolls = false; m_scrollElasticityController.m_lastMomentumScrollTimestamp = 0; } + + return true; } void ScrollAnimatorMac::beginScrollGesture() @@ -1296,7 +1318,7 @@ void ScrollAnimatorMac::snapRubberBand() m_scrollElasticityController.m_origOrigin = FloatPoint(); m_scrollElasticityController.m_origVelocity = FloatSize(); - m_snapRubberBandTimer.startRepeating(1.0/60.0); + m_scrollElasticityController.m_client->startSnapRubberbandTimer(); m_scrollElasticityController.m_snapRubberbandTimerIsActive = true; } @@ -1320,9 +1342,9 @@ void ScrollAnimatorMac::snapRubberBandTimerFired(Timer<ScrollAnimatorMac>*) CFTimeInterval timeDelta = [NSDate timeIntervalSinceReferenceDate] - m_scrollElasticityController.m_startTime; if (m_scrollElasticityController.m_startStretch == FloatSize()) { - m_scrollElasticityController.m_startStretch = m_scrollableArea->overhangAmount(); - if (m_scrollElasticityController.m_startStretch == FloatSize()) { - m_snapRubberBandTimer.stop(); + m_scrollElasticityController.m_startStretch = m_scrollElasticityController.m_client->stretchAmount(); + if (m_scrollElasticityController.m_startStretch == FloatSize()) { + m_scrollElasticityController.m_client->stopSnapRubberbandTimer(); m_scrollElasticityController.m_stretchScrollForce = FloatSize(); m_scrollElasticityController.m_startTime = 0; @@ -1334,7 +1356,7 @@ void ScrollAnimatorMac::snapRubberBandTimerFired(Timer<ScrollAnimatorMac>*) return; } - m_scrollElasticityController.m_origOrigin = (m_scrollableArea->visibleContentRect().location() + m_scrollableArea->scrollOrigin()) - m_scrollElasticityController.m_startStretch; + m_scrollElasticityController.m_origOrigin = m_scrollElasticityController.m_client->absoluteScrollPosition() - m_scrollElasticityController.m_startStretch; m_scrollElasticityController.m_origVelocity = m_scrollElasticityController.m_momentumVelocity; // Just like normal scrolling, prefer vertical rubberbanding @@ -1342,13 +1364,11 @@ void ScrollAnimatorMac::snapRubberBandTimerFired(Timer<ScrollAnimatorMac>*) m_scrollElasticityController.m_origVelocity.setWidth(0); // Don't rubber-band horizontally if it's not possible to scroll horizontally - Scrollbar* hScroller = m_scrollableArea->horizontalScrollbar(); - if (!hScroller || !hScroller->enabled()) + if (!m_scrollElasticityController.m_client->canScrollHorizontally()) m_scrollElasticityController.m_origVelocity.setWidth(0); - // Don't rubber-band vertically if it's not possible to scroll horizontally - Scrollbar* vScroller = m_scrollableArea->verticalScrollbar(); - if (!vScroller || !vScroller->enabled()) + // Don't rubber-band vertically if it's not possible to scroll vertically + if (!m_scrollElasticityController.m_client->canScrollVertically()) m_scrollElasticityController.m_origVelocity.setHeight(0); } @@ -1358,16 +1378,16 @@ void ScrollAnimatorMac::snapRubberBandTimerFired(Timer<ScrollAnimatorMac>*) if (fabs(delta.x()) >= 1 || fabs(delta.y()) >= 1) { FloatPoint newOrigin = m_scrollElasticityController.m_origOrigin + delta; - immediateScrollByWithoutContentEdgeConstraints(FloatSize(delta.x(), delta.y()) - m_scrollableArea->overhangAmount()); + m_scrollElasticityController.m_client->immediateScrollByWithoutContentEdgeConstraints(FloatSize(delta.x(), delta.y()) - m_scrollElasticityController.m_client->stretchAmount()); - FloatSize newStretch = m_scrollableArea->overhangAmount(); + FloatSize newStretch = m_scrollElasticityController.m_client->stretchAmount(); m_scrollElasticityController.m_stretchScrollForce.setWidth(reboundDeltaForElasticDelta(newStretch.width())); m_scrollElasticityController.m_stretchScrollForce.setHeight(reboundDeltaForElasticDelta(newStretch.height())); } else { immediateScrollTo(m_scrollElasticityController.m_origOrigin); - m_snapRubberBandTimer.stop(); + m_scrollElasticityController.m_client->stopSnapRubberbandTimer(); m_scrollElasticityController.m_stretchScrollForce = FloatSize(); m_scrollElasticityController.m_startTime = 0; diff --git a/Source/WebCore/platform/mac/ScrollElasticityController.h b/Source/WebCore/platform/mac/ScrollElasticityController.h index f1b89b28d..066184473 100644 --- a/Source/WebCore/platform/mac/ScrollElasticityController.h +++ b/Source/WebCore/platform/mac/ScrollElasticityController.h @@ -41,6 +41,13 @@ protected: public: virtual IntSize stretchAmount() = 0; virtual bool pinnedInDirection(const FloatSize&) = 0; + virtual bool canScrollHorizontally() = 0; + virtual bool canScrollVertically() = 0; + + // Return the absolute scroll position, not relative to the scroll origin. + virtual WebCore::IntPoint absoluteScrollPosition() = 0; + + virtual void immediateScrollBy(const FloatSize&) = 0; virtual void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&) = 0; virtual void startSnapRubberbandTimer() = 0; virtual void stopSnapRubberbandTimer() = 0; @@ -55,13 +62,13 @@ public: void beginScrollGesture(); private: - ScrollElasticityControllerClient* m_client; - void stopSnapRubberbandTimer(); // FIXME: These member variables should be private. They are currently public as a stop-gap measure, while // the rubber-band related code from ScrollAnimatorMac is being moved over. public: + ScrollElasticityControllerClient* m_client; + bool m_inScrollGesture; bool m_momentumScrollInProgress; bool m_ignoreMomentumScrolls; diff --git a/Source/WebCore/platform/mock/ScrollbarThemeMock.cpp b/Source/WebCore/platform/mock/ScrollbarThemeMock.cpp index 70707d480..5d2bc3ec0 100644 --- a/Source/WebCore/platform/mock/ScrollbarThemeMock.cpp +++ b/Source/WebCore/platform/mock/ScrollbarThemeMock.cpp @@ -42,14 +42,15 @@ int ScrollbarThemeMock::scrollbarThickness(ScrollbarControlSize controlSize) return cScrollbarThickness[controlSize]; } -void ScrollbarThemeMock::paintTrackBackground(GraphicsContext* context, Scrollbar*, const IntRect& trackRect) +void ScrollbarThemeMock::paintTrackBackground(GraphicsContext* context, Scrollbar* scrollbar, const IntRect& trackRect) { - context->fillRect(trackRect, Color::lightGray, ColorSpaceDeviceRGB); + context->fillRect(trackRect, scrollbar->enabled() ? Color::lightGray : Color(0xFFE0E0E0), ColorSpaceDeviceRGB); } -void ScrollbarThemeMock::paintThumb(GraphicsContext* context, Scrollbar*, const IntRect& thumbRect) +void ScrollbarThemeMock::paintThumb(GraphicsContext* context, Scrollbar* scrollbar, const IntRect& thumbRect) { - context->fillRect(thumbRect, Color::darkGray, ColorSpaceDeviceRGB); + if (scrollbar->enabled()) + context->fillRect(thumbRect, Color::darkGray, ColorSpaceDeviceRGB); } } diff --git a/Source/WebCore/platform/network/blackberry/ResourceHandleBlackBerry.cpp b/Source/WebCore/platform/network/blackberry/ResourceHandleBlackBerry.cpp index 0820348b8..fe0df4e1b 100644 --- a/Source/WebCore/platform/network/blackberry/ResourceHandleBlackBerry.cpp +++ b/Source/WebCore/platform/network/blackberry/ResourceHandleBlackBerry.cpp @@ -22,6 +22,7 @@ #include "EventLoop.h" #include "Frame.h" #include "FrameLoaderClientBlackBerry.h" +#include "FrameNetworkingContextBlackBerry.h" #include "NetworkManager.h" #include "NotImplemented.h" #include "Page.h" @@ -112,7 +113,7 @@ bool ResourceHandle::start(NetworkingContext* context) return false; // FIXME: clean up use of Frame now that we have NetworkingContext (see RIM Bug #1515) - Frame* frame = context->wrappedFrame(); + Frame* frame = static_cast<FrameNetworkingContextBlackBerry*>(context)->frame(); if (!frame || !frame->loader() || !frame->loader()->client() || !client()) return false; int playerId = static_cast<FrameLoaderClientBlackBerry*>(frame->loader()->client())->playerId(); @@ -144,7 +145,7 @@ void ResourceHandle::loadResourceSynchronously(NetworkingContext* context, const } // FIXME: clean up use of Frame now that we have NetworkingContext (see RIM Bug #1515) - Frame* frame = context->wrappedFrame(); + Frame* frame = static_cast<FrameNetworkingContextBlackBerry*>(context)->frame(); if (!frame || !frame->loader() || !frame->loader()->client() || !frame->page()) { ASSERT(false && "loadResourceSynchronously called without a frame or frame client"); return; diff --git a/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp b/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp index 7e1edc05f..3ec325444 100644 --- a/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp +++ b/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp @@ -333,11 +333,20 @@ static CFCachedURLResponseRef willCacheResponse(CFURLConnectionRef, CFCachedURLR handle->client()->willCacheResponse(handle, policy); if (static_cast<CFURLCacheStoragePolicy>(policy) != CFCachedURLResponseGetStoragePolicy(cachedResponse)) { +#if HAVE(NETWORK_CFDATA_ARRAY_CALLBACK) + RetainPtr<CFArrayRef> receiverData(AdoptCF, CFCachedURLResponseCopyReceiverDataArray(cachedResponse)); + cachedResponse = CFCachedURLResponseCreateWithDataArray(kCFAllocatorDefault, + CFCachedURLResponseGetWrappedResponse(cachedResponse), + receiverData.get(), + CFCachedURLResponseGetUserInfo(cachedResponse), + static_cast<CFURLCacheStoragePolicy>(policy)); +#else cachedResponse = CFCachedURLResponseCreateWithUserInfo(kCFAllocatorDefault, CFCachedURLResponseGetWrappedResponse(cachedResponse), CFCachedURLResponseGetReceiverData(cachedResponse), CFCachedURLResponseGetUserInfo(cachedResponse), static_cast<CFURLCacheStoragePolicy>(policy)); +#endif } else CFRetain(cachedResponse); @@ -1001,7 +1010,7 @@ void ResourceHandle::setPrivateBrowsingStorageSessionIdentifierBase(const String privateBrowsingStorageSessionIdentifierBase() = identifier; } -#if PLATFORM(WIN) +#if PLATFORM(WIN) || USE(CFNETWORK) String ResourceHandle::privateBrowsingStorageSessionIdentifierDefaultBase() { diff --git a/Source/WebCore/plugins/DOMMimeType.h b/Source/WebCore/plugins/DOMMimeType.h index 2acbc46df..1906484af 100644 --- a/Source/WebCore/plugins/DOMMimeType.h +++ b/Source/WebCore/plugins/DOMMimeType.h @@ -21,6 +21,7 @@ #define DOMMimeType_h #include "Frame.h" +#include "FrameDestructionObserver.h" #include "PluginData.h" #include <wtf/Forward.h> diff --git a/Source/WebCore/plugins/DOMMimeTypeArray.cpp b/Source/WebCore/plugins/DOMMimeTypeArray.cpp index 82d40064b..d39e9f155 100644 --- a/Source/WebCore/plugins/DOMMimeTypeArray.cpp +++ b/Source/WebCore/plugins/DOMMimeTypeArray.cpp @@ -29,7 +29,7 @@ namespace WebCore { DOMMimeTypeArray::DOMMimeTypeArray(Frame* frame) - : m_frame(frame) + : DOMWindowProperty(frame) { } diff --git a/Source/WebCore/plugins/DOMMimeTypeArray.h b/Source/WebCore/plugins/DOMMimeTypeArray.h index 54fff7bf4..25c276d38 100644 --- a/Source/WebCore/plugins/DOMMimeTypeArray.h +++ b/Source/WebCore/plugins/DOMMimeTypeArray.h @@ -22,6 +22,7 @@ #define DOMMimeTypeArray_h #include "DOMMimeType.h" +#include "DOMWindowProperty.h" #include <wtf/Forward.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> @@ -32,24 +33,19 @@ namespace WebCore { class Frame; class PluginData; -class DOMMimeTypeArray : public RefCounted<DOMMimeTypeArray> { +class DOMMimeTypeArray : public RefCounted<DOMMimeTypeArray>, public DOMWindowProperty { public: static PassRefPtr<DOMMimeTypeArray> create(Frame* frame) { return adoptRef(new DOMMimeTypeArray(frame)); } ~DOMMimeTypeArray(); - Frame* frame() { return m_frame; } - void disconnectFrame() { m_frame = 0; } - unsigned length() const; PassRefPtr<DOMMimeType> item(unsigned index); bool canGetItemsForName(const AtomicString& propertyName); PassRefPtr<DOMMimeType> namedItem(const AtomicString& propertyName); private: - DOMMimeTypeArray(Frame*); + explicit DOMMimeTypeArray(Frame*); PluginData* getPluginData() const; - - Frame* m_frame; }; } // namespace WebCore diff --git a/Source/WebCore/plugins/DOMPlugin.h b/Source/WebCore/plugins/DOMPlugin.h index ee7f001be..15b36d43a 100644 --- a/Source/WebCore/plugins/DOMPlugin.h +++ b/Source/WebCore/plugins/DOMPlugin.h @@ -20,6 +20,7 @@ #ifndef DOMPlugin_h #define DOMPlugin_h +#include "FrameDestructionObserver.h" #include "DOMMimeType.h" #include <wtf/Forward.h> #include <wtf/RefPtr.h> diff --git a/Source/WebCore/plugins/DOMPluginArray.cpp b/Source/WebCore/plugins/DOMPluginArray.cpp index 766c3eb3d..c8a53a579 100644 --- a/Source/WebCore/plugins/DOMPluginArray.cpp +++ b/Source/WebCore/plugins/DOMPluginArray.cpp @@ -29,7 +29,7 @@ namespace WebCore { DOMPluginArray::DOMPluginArray(Frame* frame) - : m_frame(frame) + : DOMWindowProperty(frame) { } diff --git a/Source/WebCore/plugins/DOMPluginArray.h b/Source/WebCore/plugins/DOMPluginArray.h index 0b1f2ba98..6c3545721 100644 --- a/Source/WebCore/plugins/DOMPluginArray.h +++ b/Source/WebCore/plugins/DOMPluginArray.h @@ -22,6 +22,7 @@ #define DOMPluginArray_h #include "DOMPlugin.h" +#include "DOMWindowProperty.h" #include <wtf/Forward.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> @@ -32,14 +33,11 @@ namespace WebCore { class Frame; class PluginData; -class DOMPluginArray : public RefCounted<DOMPluginArray> { +class DOMPluginArray : public RefCounted<DOMPluginArray>, public DOMWindowProperty { public: static PassRefPtr<DOMPluginArray> create(Frame* frame) { return adoptRef(new DOMPluginArray(frame)); } ~DOMPluginArray(); - Frame* frame() { return m_frame; } - void disconnectFrame() { m_frame = 0; } - unsigned length() const; PassRefPtr<DOMPlugin> item(unsigned index); bool canGetItemsForName(const AtomicString& propertyName); @@ -48,10 +46,8 @@ public: void refresh(bool reload); private: - DOMPluginArray(Frame*); + explicit DOMPluginArray(Frame*); PluginData* pluginData() const; - - Frame* m_frame; }; } // namespace WebCore diff --git a/Source/WebCore/rendering/RenderBlockLineLayout.cpp b/Source/WebCore/rendering/RenderBlockLineLayout.cpp index 92dceb104..77c3ce383 100755 --- a/Source/WebCore/rendering/RenderBlockLineLayout.cpp +++ b/Source/WebCore/rendering/RenderBlockLineLayout.cpp @@ -1889,6 +1889,10 @@ void RenderBlock::LineBreaker::skipLeadingWhitespace(InlineBidiResolver& resolve } } else if (object->isFloating()) m_block->positionNewFloatOnLine(m_block->insertFloatingObject(toRenderBox(object)), lastFloatFromPreviousLine, lineInfo, width); + else if (object->isText() && object->style()->hasTextCombine() && object->isCombineText()) { + toRenderCombineText(object)->combineText(); + continue; + } resolver.increment(); } resolver.commitExplicitEmbedding(); @@ -2279,7 +2283,7 @@ InlineIterator RenderBlock::LineBreaker::nextLineBreak(InlineBidiResolver& resol #endif RenderStyle* style = t->style(lineInfo.isFirstLine()); - if (style->hasTextCombine() && current.m_obj->isCombineText()) + if (style->hasTextCombine() && current.m_obj->isCombineText() && !toRenderCombineText(current.m_obj)->isCombined()) toRenderCombineText(current.m_obj)->combineText(); const Font& f = style->font(); diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp index 40adf387e..506105636 100644 --- a/Source/WebCore/rendering/RenderBox.cpp +++ b/Source/WebCore/rendering/RenderBox.cpp @@ -858,23 +858,12 @@ void RenderBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) void RenderBox::paintRootBoxFillLayers(const PaintInfo& paintInfo) { - const FillLayer* bgLayer = style()->backgroundLayers(); - Color bgColor = style()->visitedDependentColor(CSSPropertyBackgroundColor); - RenderObject* bodyObject = 0; - if (!hasBackground() && node() && node()->hasTagName(HTMLNames::htmlTag)) { - // Locate the <body> element using the DOM. This is easier than trying - // to crawl around a render tree with potential :before/:after content and - // anonymous blocks created by inline <body> tags etc. We can locate the <body> - // render object very easily via the DOM. - HTMLElement* body = document()->body(); - bodyObject = (body && body->hasLocalName(bodyTag)) ? body->renderer() : 0; - if (bodyObject) { - bgLayer = bodyObject->style()->backgroundLayers(); - bgColor = bodyObject->style()->visitedDependentColor(CSSPropertyBackgroundColor); - } - } + RenderObject* rootBackgroundRenderer = rendererForRootBackground(); + + const FillLayer* bgLayer = rootBackgroundRenderer->style()->backgroundLayers(); + Color bgColor = rootBackgroundRenderer->style()->visitedDependentColor(CSSPropertyBackgroundColor); - paintFillLayers(paintInfo, bgColor, bgLayer, view()->backgroundRect(this), BackgroundBleedNone, CompositeSourceOver, bodyObject); + paintFillLayers(paintInfo, bgColor, bgLayer, view()->backgroundRect(this), BackgroundBleedNone, CompositeSourceOver, rootBackgroundRenderer); } BackgroundBleedAvoidance RenderBox::determineBackgroundBleedAvoidance(GraphicsContext* context) const @@ -1804,7 +1793,7 @@ bool RenderBox::sizesToIntrinsicLogicalWidth(LogicalWidthType widthType) const // Flexible box items should shrink wrap, so we lay them out at their intrinsic widths. // In the case of columns that have a stretch alignment, we go ahead and layout at the // stretched size to avoid an extra layout when applying alignment. - if (parent()->isFlexibleBox() && (!parent()->style()->isColumnFlexDirection() || style()->flexAlign() != AlignStretch)) + if (parent()->isFlexibleBox() && (!parent()->style()->isColumnFlexDirection() || style()->flexItemAlign() != AlignStretch)) return true; // Flexible horizontal boxes lay out children at their intrinsic widths. Also vertical boxes diff --git a/Source/WebCore/rendering/RenderFlexibleBox.cpp b/Source/WebCore/rendering/RenderFlexibleBox.cpp index 8f6a8684e..0a646d993 100644 --- a/Source/WebCore/rendering/RenderFlexibleBox.cpp +++ b/Source/WebCore/rendering/RenderFlexibleBox.cpp @@ -32,6 +32,7 @@ #include "RenderFlexibleBox.h" #include "LayoutRepainter.h" +#include "RenderLayer.h" #include "RenderView.h" namespace WebCore { @@ -488,8 +489,11 @@ void RenderFlexibleBox::computePreferredMainAxisExtent(bool relayoutChildren, Tr LayoutUnit flexboxAvailableContentExtent = mainAxisContentExtent(); for (RenderBox* child = iterator.first(); child; child = iterator.next()) { + if (child->isPositioned()) + continue; + + child->clearOverrideSize(); if (mainAxisLengthForChild(child).isAuto()) { - child->clearOverrideSize(); if (!relayoutChildren) child->setChildNeedsLayout(true); child->layoutIfNeeded(); @@ -523,6 +527,11 @@ bool RenderFlexibleBox::runFreeSpaceAllocationAlgorithm(FlexOrderIterator& itera LayoutUnit flexboxAvailableContentExtent = mainAxisContentExtent(); for (RenderBox* child = iterator.first(); child; child = iterator.next()) { + if (child->isPositioned()) { + childSizes.append(0); + continue; + } + LayoutUnit childPreferredSize; if (inflexibleItems.contains(child)) childPreferredSize = inflexibleItems.get(child); @@ -591,6 +600,24 @@ void RenderFlexibleBox::setLogicalOverrideSize(RenderBox* child, LayoutUnit chil child->setOverrideWidth(childPreferredSize); } +void RenderFlexibleBox::prepareChildForPositionedLayout(RenderBox* child, LayoutUnit mainAxisOffset, LayoutUnit crossAxisOffset) +{ + ASSERT(child->isPositioned()); + child->containingBlock()->insertPositionedObject(child); + RenderLayer* childLayer = child->layer(); + LayoutUnit inlinePosition = isColumnFlow() ? crossAxisOffset : mainAxisOffset; + if (style()->flexDirection() == FlowRowReverse) + inlinePosition = mainAxisExtent() - mainAxisOffset; + childLayer->setStaticInlinePosition(inlinePosition); // FIXME: Not right for regions. + + LayoutUnit staticBlockPosition = isColumnFlow() ? mainAxisOffset : crossAxisOffset; + if (childLayer->staticBlockPosition() != staticBlockPosition) { + childLayer->setStaticBlockPosition(staticBlockPosition); + if (child->style()->hasStaticBlockPosition(style()->isHorizontalWritingMode())) + child->setChildNeedsLayout(true, false); + } +} + void RenderFlexibleBox::layoutAndPlaceChildren(FlexOrderIterator& iterator, const WTF::Vector<LayoutUnit>& childSizes, LayoutUnit availableFreeSpace, float totalPositiveFlexibility) { LayoutUnit mainAxisOffset = flowAwareBorderStart() + flowAwarePaddingStart(); @@ -602,12 +629,17 @@ void RenderFlexibleBox::layoutAndPlaceChildren(FlexOrderIterator& iterator, cons bool shouldFlipMainAxis = !isColumnFlow() && !isLeftToRightFlow(); size_t i = 0; for (RenderBox* child = iterator.first(); child; child = iterator.next(), ++i) { + if (child->isPositioned()) { + prepareChildForPositionedLayout(child, mainAxisOffset, crossAxisOffset); + mainAxisOffset += packingSpaceBetweenChildren(availableFreeSpace, totalPositiveFlexibility, style()->flexPack(), childSizes.size()); + continue; + } LayoutUnit childPreferredSize = childSizes[i] + mainAxisBorderAndPaddingExtentForChild(child); setLogicalOverrideSize(child, childPreferredSize); child->setChildNeedsLayout(true); child->layoutIfNeeded(); - if (child->style()->flexAlign() == AlignBaseline) { + if (child->style()->flexItemAlign() == AlignBaseline) { LayoutUnit ascent = marginBoxAscent(child); LayoutUnit descent = (crossAxisMarginExtentForChild(child) + crossAxisExtentForChild(child)) - ascent; @@ -657,6 +689,11 @@ void RenderFlexibleBox::layoutColumnReverse(FlexOrderIterator& iterator, const W LayoutUnit crossAxisOffset = flowAwareBorderBefore() + flowAwarePaddingBefore(); size_t i = 0; for (RenderBox* child = iterator.first(); child; child = iterator.next(), ++i) { + if (child->isPositioned()) { + child->layer()->setStaticBlockPosition(mainAxisOffset); + mainAxisOffset -= packingSpaceBetweenChildren(availableFreeSpace, totalPositiveFlexibility, style()->flexPack(), childSizes.size()); + continue; + } mainAxisOffset -= mainAxisExtentForChild(child) + flowAwareMarginEndForChild(child); LayoutRect oldRect = child->frameRect(); @@ -695,13 +732,23 @@ void RenderFlexibleBox::alignChildren(FlexOrderIterator& iterator, LayoutUnit ma } // FIXME: Make sure this does the right thing with column flows. - switch (child->style()->flexAlign()) { + switch (child->style()->flexItemAlign()) { + case AlignAuto: + // FIXME: Handle this once we add flex-align. + break; case AlignStretch: { if (!isColumnFlow() && child->style()->logicalHeight().isAuto()) { + LayoutUnit logicalHeightBefore = child->logicalHeight(); LayoutUnit stretchedLogicalHeight = child->logicalHeight() + RenderFlexibleBox::availableAlignmentSpaceForChild(child); child->setLogicalHeight(stretchedLogicalHeight); child->computeLogicalHeight(); - // FIXME: We need to relayout if the height changed. + + if (child->logicalHeight() != logicalHeightBefore) { + child->setOverrideHeight(child->logicalHeight()); + child->setLogicalHeight(0); + child->setChildNeedsLayout(true); + child->layoutIfNeeded(); + } } break; } diff --git a/Source/WebCore/rendering/RenderFlexibleBox.h b/Source/WebCore/rendering/RenderFlexibleBox.h index fe0dfa21e..fd8a3113b 100644 --- a/Source/WebCore/rendering/RenderFlexibleBox.h +++ b/Source/WebCore/rendering/RenderFlexibleBox.h @@ -96,6 +96,7 @@ private: void computePreferredMainAxisExtent(bool relayoutChildren, TreeOrderIterator&, LayoutUnit&, float& totalPositiveFlexibility, float& totalNegativeFlexibility); bool runFreeSpaceAllocationAlgorithm(FlexOrderIterator&, LayoutUnit& availableFreeSpace, float& totalPositiveFlexibility, float& totalNegativeFlexibility, InflexibleFlexItemSize&, WTF::Vector<LayoutUnit>& childSizes); void setLogicalOverrideSize(RenderBox* child, LayoutUnit childPreferredSize); + void prepareChildForPositionedLayout(RenderBox* child, LayoutUnit mainAxisOffset, LayoutUnit crossAxisOffset); void layoutAndPlaceChildren(FlexOrderIterator&, const WTF::Vector<LayoutUnit>& childSizes, LayoutUnit availableFreeSpace, float totalPositiveFlexibility); void layoutColumnReverse(FlexOrderIterator&, const WTF::Vector<LayoutUnit>& childSizes, LayoutUnit availableFreeSpace, float totalPositiveFlexibility); void alignChildren(FlexOrderIterator&, LayoutUnit maxAscent); diff --git a/Source/WebCore/rendering/RenderFrameSet.cpp b/Source/WebCore/rendering/RenderFrameSet.cpp index 00d9c0d47..074f3ed5d 100644 --- a/Source/WebCore/rendering/RenderFrameSet.cpp +++ b/Source/WebCore/rendering/RenderFrameSet.cpp @@ -662,7 +662,7 @@ void RenderFrameSet::positionFramesWithFlattening() bool RenderFrameSet::flattenFrameSet() const { - return frame() && frame()->settings()->frameFlatteningEnabled(); + return frame() && frame()->settings() && frame()->settings()->frameFlatteningEnabled(); } void RenderFrameSet::startResizing(GridAxis& axis, int position) diff --git a/Source/WebCore/rendering/RenderFullScreen.cpp b/Source/WebCore/rendering/RenderFullScreen.cpp index 014f17a2c..1d689f5c9 100644 --- a/Source/WebCore/rendering/RenderFullScreen.cpp +++ b/Source/WebCore/rendering/RenderFullScreen.cpp @@ -117,21 +117,20 @@ RenderObject* RenderFullScreen::wrapRenderer(RenderObject* object, Document* doc fullscreenRenderer->addChild(object); } document->setFullScreenRenderer(fullscreenRenderer); - if (fullscreenRenderer->placeholder()) - return fullscreenRenderer->placeholder(); return fullscreenRenderer; } void RenderFullScreen::unwrapRenderer() { - RenderObject* holder = placeholder() ? placeholder() : this; - if (holder->parent()) { + if (parent()) { RenderObject* child; while ((child = firstChild())) { child->remove(); - holder->parent()->addChild(child, holder); + parent()->addChild(child, this); } } + if (placeholder()) + placeholder()->remove(); remove(); document()->setFullScreenRenderer(0); } @@ -151,11 +150,8 @@ void RenderFullScreen::createPlaceholder(PassRefPtr<RenderStyle> style, const In if (!m_placeholder) { m_placeholder = new (document()->renderArena()) RenderFullScreenPlaceholder(this); m_placeholder->setStyle(style); - if (parent()) { + if (parent()) parent()->addChild(m_placeholder, this); - remove(); - } - m_placeholder->addChild(this); } else m_placeholder->setStyle(style); } diff --git a/Source/WebCore/rendering/RenderIFrame.cpp b/Source/WebCore/rendering/RenderIFrame.cpp index 7e8738399..743e3f4c2 100644 --- a/Source/WebCore/rendering/RenderIFrame.cpp +++ b/Source/WebCore/rendering/RenderIFrame.cpp @@ -95,7 +95,7 @@ bool RenderIFrame::flattenFrame() } Frame* frame = element->document()->frame(); - bool enabled = frame && frame->settings()->frameFlatteningEnabled(); + bool enabled = frame && frame->settings() && frame->settings()->frameFlatteningEnabled(); if (!enabled || !frame->page()) return false; diff --git a/Source/WebCore/rendering/RenderInline.cpp b/Source/WebCore/rendering/RenderInline.cpp index 4b8556bc7..0182459a1 100644 --- a/Source/WebCore/rendering/RenderInline.cpp +++ b/Source/WebCore/rendering/RenderInline.cpp @@ -147,7 +147,7 @@ void RenderInline::styleDidChange(StyleDifference diff, const RenderStyle* oldSt m_lineHeight = -1; if (!m_alwaysCreateLineBoxes) { - bool alwaysCreateLineBoxes = hasSelfPaintingLayer() || hasBoxDecorations() || style()->hasPadding() || style()->hasMargin() || style()->hasOutline(); + bool alwaysCreateLineBoxes = hasSelfPaintingLayer() || hasBoxDecorations() || style()->hasPadding() || style()->hasMargin() || hasOutline(); if (oldStyle && alwaysCreateLineBoxes) { dirtyLineBoxes(false); setNeedsLayout(true); diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp index 587e2371c..90915a3d9 100644 --- a/Source/WebCore/rendering/RenderLayer.cpp +++ b/Source/WebCore/rendering/RenderLayer.cpp @@ -465,11 +465,6 @@ void RenderLayer::updateLayerPositionsAfterScroll(UpdateLayerPositionsAfterScrol // FIXME: Is it worth passing the offsetFromRoot around like in updateLayerPositions? computeRepaintRects(); flags |= HasSeenFixedPositionedAncestor; - } else if (renderer()->hasTransform() && !renderer()->isRenderView()) { - // Transforms act as fixed position containers, so nothing inside a - // transformed element can be fixed relative to the viewport if the - // transformed element is not fixed itself or child of a fixed element. - return; } else if ((flags & HasSeenAncestorWithOverflowClip) && !m_canSkipRepaintRectsUpdateOnScroll) { // If we have seen an overflow clip, we should update our repaint rects as clippedOverflowRectForRepaint // intersects it with our ancestor overflow clip that may have moved. diff --git a/Source/WebCore/rendering/RenderLayerBacking.cpp b/Source/WebCore/rendering/RenderLayerBacking.cpp index 917d2869e..aa617f6bd 100644 --- a/Source/WebCore/rendering/RenderLayerBacking.cpp +++ b/Source/WebCore/rendering/RenderLayerBacking.cpp @@ -777,40 +777,13 @@ static bool hasBoxDecorationsOrBackgroundImage(const RenderStyle* style) return hasBoxDecorations(style) || style->hasBackgroundImage(); } -bool RenderLayerBacking::rendererHasBackground() const -{ - // FIXME: share more code here - if (renderer()->node() && renderer()->node()->isDocumentNode()) { - RenderObject* htmlObject = renderer()->firstChild(); - if (!htmlObject) - return false; - - if (htmlObject->hasBackground()) - return true; - - RenderObject* bodyObject = htmlObject->firstChild(); - if (!bodyObject) - return false; - - return bodyObject->hasBackground(); - } - - return renderer()->hasBackground(); -} - Color RenderLayerBacking::rendererBackgroundColor() const { - // FIXME: share more code here - if (renderer()->node() && renderer()->node()->isDocumentNode()) { - RenderObject* htmlObject = renderer()->firstChild(); - if (htmlObject->hasBackground()) - return htmlObject->style()->visitedDependentColor(CSSPropertyBackgroundColor); - - RenderObject* bodyObject = htmlObject->firstChild(); - return bodyObject->style()->visitedDependentColor(CSSPropertyBackgroundColor); - } + RenderObject* backgroundRenderer = renderer(); + if (backgroundRenderer->isRoot()) + backgroundRenderer = backgroundRenderer->rendererForRootBackground(); - return renderer()->style()->visitedDependentColor(CSSPropertyBackgroundColor); + return backgroundRenderer->style()->visitedDependentColor(CSSPropertyBackgroundColor); } void RenderLayerBacking::updateBackgroundColor() diff --git a/Source/WebCore/rendering/RenderLayerBacking.h b/Source/WebCore/rendering/RenderLayerBacking.h index ba1dcfaec..8b1c790be 100644 --- a/Source/WebCore/rendering/RenderLayerBacking.h +++ b/Source/WebCore/rendering/RenderLayerBacking.h @@ -194,7 +194,6 @@ private: bool isDirectlyCompositedImage() const; void updateImageContents(); - bool rendererHasBackground() const; Color rendererBackgroundColor() const; void updateBackgroundColor(); diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp index ac4464132..93331aee7 100644 --- a/Source/WebCore/rendering/RenderLayerCompositor.cpp +++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp @@ -368,11 +368,12 @@ bool RenderLayerCompositor::updateBacking(RenderLayer* layer, CompositingChangeR layer->ensureBacking(); #if PLATFORM(MAC) && USE(CA) - if (m_renderView->document()->settings()->acceleratedDrawingEnabled()) + Settings* settings = m_renderView->document()->settings(); + if (settings && settings->acceleratedDrawingEnabled()) layer->backing()->graphicsLayer()->setAcceleratesDrawing(true); else if (layer->renderer()->isCanvas()) { HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(layer->renderer()->node()); - if (canvas->renderingContext() && canvas->renderingContext()->isAccelerated()) + if (canvas->shouldAccelerate(canvas->size())) layer->backing()->graphicsLayer()->setAcceleratesDrawing(true); } #endif @@ -1331,6 +1332,7 @@ bool RenderLayerCompositor::requiresCompositingLayer(const RenderLayer* layer) c || clipsCompositingDescendants(layer) || requiresCompositingForAnimation(renderer) || requiresCompositingForFullScreen(renderer) + || requiresCompositingForFilters(renderer) || requiresCompositingForPosition(renderer, layer); } @@ -1516,6 +1518,19 @@ bool RenderLayerCompositor::requiresCompositingForFullScreen(RenderObject* rende #endif } +bool RenderLayerCompositor::requiresCompositingForFilters(RenderObject* renderer) const +{ +#if ENABLE(CSS_FILTERS) + if (!(m_compositingTriggers & ChromeClient::FilterTrigger)) + return false; + + return renderer->hasFilter(); +#else + UNUSED_PARAM(renderer); + return false; +#endif +} + bool RenderLayerCompositor::requiresCompositingForPosition(RenderObject* renderer, const RenderLayer* layer) const { // position:fixed elements that create their own stacking context (e.g. have an explicit z-index, diff --git a/Source/WebCore/rendering/RenderLayerCompositor.h b/Source/WebCore/rendering/RenderLayerCompositor.h index dc4b27de3..a55ce9af7 100644 --- a/Source/WebCore/rendering/RenderLayerCompositor.h +++ b/Source/WebCore/rendering/RenderLayerCompositor.h @@ -285,6 +285,7 @@ private: bool requiresCompositingForFrame(RenderObject*) const; bool requiresCompositingWhenDescendantsAreCompositing(RenderObject*) const; bool requiresCompositingForFullScreen(RenderObject*) const; + bool requiresCompositingForFilters(RenderObject*) const; bool requiresCompositingForScrollableFrame() const; bool requiresCompositingForPosition(RenderObject*, const RenderLayer*) const; diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp index 1f1eb26c8..5e217c82c 100755 --- a/Source/WebCore/rendering/RenderObject.cpp +++ b/Source/WebCore/rendering/RenderObject.cpp @@ -38,6 +38,7 @@ #include "Frame.h" #include "FrameView.h" #include "GraphicsContext.h" +#include "HTMLElement.h" #include "HTMLNames.h" #include "HitTestResult.h" #include "Page.h" @@ -2126,6 +2127,23 @@ bool RenderObject::isRooted(RenderView** view) return true; } +RenderObject* RenderObject::rendererForRootBackground() +{ + ASSERT(isRoot()); + if (!hasBackground() && node() && node()->hasTagName(HTMLNames::htmlTag)) { + // Locate the <body> element using the DOM. This is easier than trying + // to crawl around a render tree with potential :before/:after content and + // anonymous blocks created by inline <body> tags etc. We can locate the <body> + // render object very easily via the DOM. + HTMLElement* body = document()->body(); + RenderObject* bodyObject = (body && body->hasLocalName(bodyTag)) ? body->renderer() : 0; + if (bodyObject) + return bodyObject; + } + + return this; +} + bool RenderObject::hasOutlineAnnotation() const { return node() && node()->isLink() && document()->printing(); diff --git a/Source/WebCore/rendering/RenderObject.h b/Source/WebCore/rendering/RenderObject.h index 3fe185f6a..ac3339eee 100644 --- a/Source/WebCore/rendering/RenderObject.h +++ b/Source/WebCore/rendering/RenderObject.h @@ -851,6 +851,9 @@ public: return outlineBoundsForRepaint(0); } + // Return the renderer whose background style is used to paint the root background. Should only be called on the renderer for which isRoot() is true. + RenderObject* rendererForRootBackground(); + protected: // Overrides should call the superclass at the end virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); diff --git a/Source/WebCore/rendering/RenderText.cpp b/Source/WebCore/rendering/RenderText.cpp index 8177503a7..0e1210621 100644 --- a/Source/WebCore/rendering/RenderText.cpp +++ b/Source/WebCore/rendering/RenderText.cpp @@ -68,7 +68,8 @@ public: void restartWithNewText(unsigned lastTypedCharacterOffset) { m_lastTypedCharacterOffset = lastTypedCharacterOffset; - startOneShot(m_renderText->document()->settings()->passwordEchoDurationInSeconds()); + if (Settings* settings = m_renderText->document()->settings()) + startOneShot(settings->passwordEchoDurationInSeconds()); } void invalidate() { m_lastTypedCharacterOffset = -1; } unsigned lastTypedCharacterOffset() { return m_lastTypedCharacterOffset; } diff --git a/Source/WebCore/rendering/RenderThemeChromiumMac.h b/Source/WebCore/rendering/RenderThemeChromiumMac.h index d9bc2f2df..8d4e52e56 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumMac.h +++ b/Source/WebCore/rendering/RenderThemeChromiumMac.h @@ -33,6 +33,7 @@ public: static PassRefPtr<RenderTheme> create(); protected: + virtual bool paintTextField(RenderObject*, const PaintInfo&, const IntRect&); #if ENABLE(VIDEO) virtual void adjustMediaSliderThumbSize(RenderStyle*) const; virtual bool paintMediaPlayButton(RenderObject*, const PaintInfo&, const IntRect&); diff --git a/Source/WebCore/rendering/RenderThemeChromiumMac.mm b/Source/WebCore/rendering/RenderThemeChromiumMac.mm index 11bbafe20..5d4c9539e 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumMac.mm +++ b/Source/WebCore/rendering/RenderThemeChromiumMac.mm @@ -19,10 +19,12 @@ */ #import "config.h" +#import "LocalCurrentGraphicsContext.h" #import "RenderThemeChromiumMac.h" #import "PaintInfo.h" #import "PlatformSupport.h" #import "RenderMediaControlsChromium.h" +#import "WebCoreSystemInterface.h" #import "UserAgentStyleSheets.h" #import <Carbon/Carbon.h> #import <Cocoa/Cocoa.h> @@ -125,6 +127,23 @@ bool RenderThemeChromiumMac::shouldShowPlaceholderWhenFocused() const return true; } +bool RenderThemeChromiumMac::paintTextField(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) +{ + // Using the Cocoa code to paint the text field as RenderThemeMac does runs + // into a bug when building against the 10.5 SDK, so we are forced here to + // use the SPI. This override of paintTextField should be able to be removed + // when 10.6 is the minimum required system and Chromium is built against + // the 10.6 SDK. + // + // https://bugs.webkit.org/show_bug.cgi?id=75860 + // http://code.google.com/p/chromium/issues/detail?id=109567 + + LocalCurrentGraphicsContext localContext(paintInfo.context); + wkDrawBezeledTextFieldCell(r, isEnabled(o) && !isReadOnlyControl(o)); + + return false; +} + #if ENABLE(VIDEO) void RenderThemeChromiumMac::adjustMediaSliderThumbSize(RenderStyle* style) const diff --git a/Source/WebCore/rendering/RenderThemeMac.mm b/Source/WebCore/rendering/RenderThemeMac.mm index a88bd3ca8..54f13f70b 100644 --- a/Source/WebCore/rendering/RenderThemeMac.mm +++ b/Source/WebCore/rendering/RenderThemeMac.mm @@ -1511,7 +1511,9 @@ void RenderThemeMac::adjustSearchFieldStyle(CSSStyleSelector* selector, RenderSt bool RenderThemeMac::paintSearchFieldCancelButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { - Node* input = o->node()->shadowAncestorNode(); + Element* input = toElement(o->node()->shadowAncestorNode()); + ASSERT(input); + if (!input->renderer()->isBox()) return false; @@ -1520,8 +1522,12 @@ bool RenderThemeMac::paintSearchFieldCancelButton(RenderObject* o, const PaintIn NSSearchFieldCell* search = this->search(); - updateActiveState([search cancelButtonCell], o); - updatePressedState([search cancelButtonCell], o); + if (input->isEnabledFormControl() && !input->isReadOnlyFormControl()) { + updateActiveState([search cancelButtonCell], o); + updatePressedState([search cancelButtonCell], o); + } + else if ([[search cancelButtonCell] isHighlighted]) + [[search cancelButtonCell] setHighlighted:NO]; GraphicsContextStateSaver stateSaver(*paintInfo.context); diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h index c037ace12..eddd0f88c 100644 --- a/Source/WebCore/rendering/style/RenderStyle.h +++ b/Source/WebCore/rendering/style/RenderStyle.h @@ -800,7 +800,7 @@ public: float flexboxHeightNegativeFlex() const { return rareNonInheritedData->m_flexibleBox->m_heightNegativeFlex; } int flexOrder() const { return rareNonInheritedData->m_flexibleBox->m_flexOrder; } EFlexPack flexPack() const { return static_cast<EFlexPack>(rareNonInheritedData->m_flexibleBox->m_flexPack); } - EFlexAlign flexAlign() const { return static_cast<EFlexAlign>(rareNonInheritedData->m_flexibleBox->m_flexAlign); } + EFlexAlign flexItemAlign() const { return static_cast<EFlexAlign>(rareNonInheritedData->m_flexibleBox->m_flexItemAlign); } EFlexDirection flexDirection() const { return static_cast<EFlexDirection>(rareNonInheritedData->m_flexibleBox->m_flexDirection); } bool isColumnFlexDirection() const { return flexDirection() == FlowColumn || flexDirection() == FlowColumnReverse; } EFlexWrap flexWrap() const { return static_cast<EFlexWrap>(rareNonInheritedData->m_flexibleBox->m_flexWrap); } @@ -1220,7 +1220,7 @@ public: void setFlexboxHeightNegativeFlex(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_heightNegativeFlex, f); } void setFlexOrder(int o) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexOrder, o); } void setFlexPack(EFlexPack p) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexPack, p); } - void setFlexAlign(EFlexAlign a) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexAlign, a); } + void setFlexItemAlign(EFlexAlign a) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexItemAlign, a); } void setFlexDirection(EFlexDirection direction) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexDirection, direction); } void setFlexWrap(EFlexWrap w) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexWrap, w); } #if ENABLE(CSS_GRID_LAYOUT) @@ -1544,7 +1544,8 @@ public: static float initialFlexboxHeightNegativeFlex() { return 0; } static int initialFlexOrder() { return 0; } static EFlexPack initialFlexPack() { return PackStart; } - static EFlexAlign initialFlexAlign() { return AlignStretch; } + // FIXME: When we add in flex-align, default flex-item-align to AlignAuto. + static EFlexAlign initialFlexItemAlign() { return AlignStretch; } static EFlexDirection initialFlexDirection() { return FlowRow; } static EFlexWrap initialFlexWrap() { return FlexNoWrap; } static int initialMarqueeLoopCount() { return -1; } diff --git a/Source/WebCore/rendering/style/RenderStyleConstants.h b/Source/WebCore/rendering/style/RenderStyleConstants.h index ada7f6101..9191ba274 100644 --- a/Source/WebCore/rendering/style/RenderStyleConstants.h +++ b/Source/WebCore/rendering/style/RenderStyleConstants.h @@ -177,7 +177,7 @@ enum EBoxDirection { BNORMAL, BREVERSE }; // CSS3 Flexbox Properties enum EFlexPack { PackStart, PackEnd, PackCenter, PackJustify }; -enum EFlexAlign { AlignStart, AlignEnd, AlignCenter, AlignStretch, AlignBaseline }; +enum EFlexAlign { AlignAuto, AlignStart, AlignEnd, AlignCenter, AlignStretch, AlignBaseline }; enum EFlexDirection { FlowRow, FlowRowReverse, FlowColumn, FlowColumnReverse }; enum EFlexWrap { FlexNoWrap, FlexWrap, FlexWrapReverse }; diff --git a/Source/WebCore/rendering/style/StyleFlexibleBoxData.cpp b/Source/WebCore/rendering/style/StyleFlexibleBoxData.cpp index 53e2a23c3..5ca0edbb3 100644 --- a/Source/WebCore/rendering/style/StyleFlexibleBoxData.cpp +++ b/Source/WebCore/rendering/style/StyleFlexibleBoxData.cpp @@ -37,7 +37,7 @@ StyleFlexibleBoxData::StyleFlexibleBoxData() , m_heightNegativeFlex(RenderStyle::initialFlexboxHeightNegativeFlex()) , m_flexOrder(RenderStyle::initialFlexOrder()) , m_flexPack(RenderStyle::initialFlexPack()) - , m_flexAlign(RenderStyle::initialFlexAlign()) + , m_flexItemAlign(RenderStyle::initialFlexItemAlign()) , m_flexDirection(RenderStyle::initialFlexDirection()) , m_flexWrap(RenderStyle::initialFlexWrap()) { @@ -51,7 +51,7 @@ StyleFlexibleBoxData::StyleFlexibleBoxData(const StyleFlexibleBoxData& o) , m_heightNegativeFlex(o.m_heightNegativeFlex) , m_flexOrder(o.m_flexOrder) , m_flexPack(o.m_flexPack) - , m_flexAlign(o.m_flexAlign) + , m_flexItemAlign(o.m_flexItemAlign) , m_flexDirection(o.m_flexDirection) , m_flexWrap(o.m_flexWrap) { @@ -61,7 +61,7 @@ bool StyleFlexibleBoxData::operator==(const StyleFlexibleBoxData& o) const { return m_widthPositiveFlex == o.m_widthPositiveFlex && m_widthNegativeFlex == o.m_widthNegativeFlex && m_heightPositiveFlex == o.m_heightPositiveFlex && m_heightNegativeFlex == o.m_heightNegativeFlex - && m_flexOrder == o.m_flexOrder && m_flexPack == o.m_flexPack && m_flexAlign == o.m_flexAlign + && m_flexOrder == o.m_flexOrder && m_flexPack == o.m_flexPack && m_flexItemAlign == o.m_flexItemAlign && m_flexDirection == o.m_flexDirection && m_flexWrap == o.m_flexWrap; } diff --git a/Source/WebCore/rendering/style/StyleFlexibleBoxData.h b/Source/WebCore/rendering/style/StyleFlexibleBoxData.h index a5f1a03f9..4a90fbe49 100644 --- a/Source/WebCore/rendering/style/StyleFlexibleBoxData.h +++ b/Source/WebCore/rendering/style/StyleFlexibleBoxData.h @@ -50,7 +50,7 @@ public: int m_flexOrder; unsigned m_flexPack : 2; // EFlexPack - unsigned m_flexAlign : 3; // EFlexAlign + unsigned m_flexItemAlign : 3; // EFlexAlign unsigned m_flexDirection : 2; // EFlexDirection unsigned m_flexWrap : 2; // EFlexWrap diff --git a/Source/WebCore/storage/DOMWindowSQLDatabase.cpp b/Source/WebCore/storage/DOMWindowSQLDatabase.cpp new file mode 100644 index 000000000..e4b609080 --- /dev/null +++ b/Source/WebCore/storage/DOMWindowSQLDatabase.cpp @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2012 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 "DOMWindowSQLDatabase.h" + +#include "AbstractDatabase.h" +#include "DOMWindow.h" +#include "Database.h" +#include "DatabaseCallback.h" +#include "Document.h" +#include "Frame.h" +#include "SecurityOrigin.h" + +#if ENABLE(SQL_DATABASE) + +namespace WebCore { + +PassRefPtr<Database> DOMWindowSQLDatabase::openDatabase(DOMWindow* window, const String& name, const String& version, const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback, ExceptionCode& ec) +{ + if (!window->isCurrentlyDisplayedInFrame()) + return 0; + + RefPtr<Database> database = 0; + if (AbstractDatabase::isAvailable() && window->document()->securityOrigin()->canAccessDatabase()) + database = Database::openDatabase(window->document(), name, version, displayName, estimatedSize, creationCallback, ec); + + if (!database && !ec) + ec = SECURITY_ERR; + + return database; +} + +} // namespace WebCore + +#endif // ENABLE(SQL_DATABASE) diff --git a/Source/WebCore/storage/DOMWindowSQLDatabase.h b/Source/WebCore/storage/DOMWindowSQLDatabase.h new file mode 100644 index 000000000..7af60be7a --- /dev/null +++ b/Source/WebCore/storage/DOMWindowSQLDatabase.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2012 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 DOMWindowSQLDatabase_h +#define DOMWindowSQLDatabase_h + +#if ENABLE(SQL_DATABASE) +#include "ExceptionCode.h" +#include "PlatformString.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + +class DOMWindow; +class Database; +class DatabaseCallback; +class Frame; + +class DOMWindowSQLDatabase { +public: + static PassRefPtr<Database> openDatabase(DOMWindow*, const String& name, const String& version, const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback, ExceptionCode&); + +private: + DOMWindowSQLDatabase() { }; + ~DOMWindowSQLDatabase() { }; +}; + +} // namespace WebCore + +#endif // ENABLE(SQL_DATABASE) + +#endif // DOMWindowSQLDatabase_h diff --git a/Source/WebCore/storage/DOMWindowSQLDatabase.idl b/Source/WebCore/storage/DOMWindowSQLDatabase.idl new file mode 100644 index 000000000..678035867 --- /dev/null +++ b/Source/WebCore/storage/DOMWindowSQLDatabase.idl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2012 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. + */ + +module window { + + interface [ + Conditional=SQL_DATABASE, + Supplemental=DOMWindow + ] DOMWindowSQLDatabase { + [EnabledAtRuntime] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in [Callback, Optional] DatabaseCallback creationCallback) + raises(DOMException); + attribute SQLExceptionConstructor SQLException; + }; + +} diff --git a/Source/WebCore/storage/IDBCursorBackendImpl.cpp b/Source/WebCore/storage/IDBCursorBackendImpl.cpp index ad96c5f1a..2351f6750 100644 --- a/Source/WebCore/storage/IDBCursorBackendImpl.cpp +++ b/Source/WebCore/storage/IDBCursorBackendImpl.cpp @@ -97,6 +97,22 @@ void IDBCursorBackendImpl::update(PassRefPtr<SerializedScriptValue> value, PassR void IDBCursorBackendImpl::continueFunction(PassRefPtr<IDBKey> prpKey, PassRefPtr<IDBCallbacks> prpCallbacks, ExceptionCode& ec) { RefPtr<IDBKey> key = prpKey; + + if (m_cursor && key) { + ASSERT(m_cursor->key()); + if (m_direction == IDBCursor::NEXT || m_direction == IDBCursor::NEXT_NO_DUPLICATE) { + if (key->isLessThan(m_cursor->key().get())) { + ec = IDBDatabaseException::DATA_ERR; + return; + } + } else { + if (m_cursor->key()->isLessThan(key.get())) { + ec = IDBDatabaseException::DATA_ERR; + return; + } + } + } + if (!m_transaction->scheduleTask(createCallbackTask(&IDBCursorBackendImpl::continueFunctionInternal, this, key, prpCallbacks))) ec = IDBDatabaseException::NOT_ALLOWED_ERR; } diff --git a/Source/WebCore/storage/Storage.cpp b/Source/WebCore/storage/Storage.cpp index 5ba4602fb..260ef4f74 100644 --- a/Source/WebCore/storage/Storage.cpp +++ b/Source/WebCore/storage/Storage.cpp @@ -41,7 +41,7 @@ PassRefPtr<Storage> Storage::create(Frame* frame, PassRefPtr<StorageArea> storag } Storage::Storage(Frame* frame, PassRefPtr<StorageArea> storageArea) - : m_frame(frame) + : DOMWindowProperty(frame) , m_storageArea(storageArea) { ASSERT(m_frame); diff --git a/Source/WebCore/storage/Storage.h b/Source/WebCore/storage/Storage.h index 219bc55b9..98f041ec0 100644 --- a/Source/WebCore/storage/Storage.h +++ b/Source/WebCore/storage/Storage.h @@ -26,6 +26,7 @@ #ifndef Storage_h #define Storage_h +#include "DOMWindowProperty.h" #include <wtf/Forward.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> @@ -36,7 +37,7 @@ namespace WebCore { class StorageArea; typedef int ExceptionCode; - class Storage : public RefCounted<Storage> { + class Storage : public RefCounted<Storage>, public DOMWindowProperty { public: static PassRefPtr<Storage> create(Frame*, PassRefPtr<StorageArea>); ~Storage(); @@ -50,13 +51,9 @@ namespace WebCore { bool contains(const String& key) const; - Frame* frame() { return m_frame; } - void disconnectFrame() { m_frame = 0; } - private: Storage(Frame*, PassRefPtr<StorageArea>); - Frame* m_frame; RefPtr<StorageArea> m_storageArea; }; diff --git a/Source/WebCore/webaudio/ConvolverNode.cpp b/Source/WebCore/webaudio/ConvolverNode.cpp index 315835619..6afc095bc 100644 --- a/Source/WebCore/webaudio/ConvolverNode.cpp +++ b/Source/WebCore/webaudio/ConvolverNode.cpp @@ -47,6 +47,7 @@ namespace WebCore { ConvolverNode::ConvolverNode(AudioContext* context, float sampleRate) : AudioNode(context, sampleRate) + , m_normalize(true) { addInput(adoptPtr(new AudioNodeInput(this))); addOutput(adoptPtr(new AudioNodeOutput(this, 2))); @@ -134,7 +135,7 @@ void ConvolverNode::setBuffer(AudioBuffer* buffer) // Create the reverb with the given impulse response. bool useBackgroundThreads = !context()->isOfflineContext(); - OwnPtr<Reverb> reverb = adoptPtr(new Reverb(&bufferBus, AudioNode::ProcessingSizeInFrames, MaxFFTSize, 2, useBackgroundThreads)); + OwnPtr<Reverb> reverb = adoptPtr(new Reverb(&bufferBus, AudioNode::ProcessingSizeInFrames, MaxFFTSize, 2, useBackgroundThreads, m_normalize)); { // Synchronize with process(). diff --git a/Source/WebCore/webaudio/ConvolverNode.h b/Source/WebCore/webaudio/ConvolverNode.h index fb29d5c5d..12f417281 100644 --- a/Source/WebCore/webaudio/ConvolverNode.h +++ b/Source/WebCore/webaudio/ConvolverNode.h @@ -54,6 +54,8 @@ public: void setBuffer(AudioBuffer*); AudioBuffer* buffer(); + bool normalize() const { return m_normalize; } + void setNormalize(bool normalize) { m_normalize = normalize; } private: ConvolverNode(AudioContext*, float sampleRate); @@ -62,6 +64,9 @@ private: // This synchronizes dynamic changes to the convolution impulse response with process(). mutable Mutex m_processLock; + + // Normalize the impulse response or not. Must default to true. + bool m_normalize; }; } // namespace WebCore diff --git a/Source/WebCore/webaudio/ConvolverNode.idl b/Source/WebCore/webaudio/ConvolverNode.idl index d3eb475f0..c658bdc19 100644 --- a/Source/WebCore/webaudio/ConvolverNode.idl +++ b/Source/WebCore/webaudio/ConvolverNode.idl @@ -29,5 +29,6 @@ module audio { GenerateToJS ] ConvolverNode : AudioNode { attribute [JSCCustomSetter] AudioBuffer buffer; + attribute boolean normalize; }; } diff --git a/Source/WebCore/workers/DedicatedWorkerContext.cpp b/Source/WebCore/workers/DedicatedWorkerContext.cpp index ec3eca89b..202e29907 100644 --- a/Source/WebCore/workers/DedicatedWorkerContext.cpp +++ b/Source/WebCore/workers/DedicatedWorkerContext.cpp @@ -41,8 +41,8 @@ namespace WebCore { -DedicatedWorkerContext::DedicatedWorkerContext(const KURL& url, const String& userAgent, DedicatedWorkerThread* thread) - : WorkerContext(url, userAgent, thread) +DedicatedWorkerContext::DedicatedWorkerContext(const KURL& url, const String& userAgent, DedicatedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) + : WorkerContext(url, userAgent, thread, contentSecurityPolicy, contentSecurityPolicyType) { } diff --git a/Source/WebCore/workers/DedicatedWorkerContext.h b/Source/WebCore/workers/DedicatedWorkerContext.h index 4edf64f4f..be5befc03 100644 --- a/Source/WebCore/workers/DedicatedWorkerContext.h +++ b/Source/WebCore/workers/DedicatedWorkerContext.h @@ -33,6 +33,7 @@ #if ENABLE(WORKERS) +#include "ContentSecurityPolicy.h" #include "MessagePort.h" #include "WorkerContext.h" @@ -43,9 +44,9 @@ namespace WebCore { class DedicatedWorkerContext : public WorkerContext { public: typedef WorkerContext Base; - static PassRefPtr<DedicatedWorkerContext> create(const KURL& url, const String& userAgent, DedicatedWorkerThread* thread) + static PassRefPtr<DedicatedWorkerContext> create(const KURL& url, const String& userAgent, DedicatedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) { - return adoptRef(new DedicatedWorkerContext(url, userAgent, thread)); + return adoptRef(new DedicatedWorkerContext(url, userAgent, thread, contentSecurityPolicy, contentSecurityPolicyType)); } virtual bool isDedicatedWorkerContext() const { return true; } @@ -65,7 +66,7 @@ namespace WebCore { DedicatedWorkerThread* thread(); private: - DedicatedWorkerContext(const KURL&, const String&, DedicatedWorkerThread*); + DedicatedWorkerContext(const KURL&, const String& userAgent, DedicatedWorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); }; } // namespace WebCore diff --git a/Source/WebCore/workers/DedicatedWorkerThread.cpp b/Source/WebCore/workers/DedicatedWorkerThread.cpp index bd406a241..5f60dd85e 100644 --- a/Source/WebCore/workers/DedicatedWorkerThread.cpp +++ b/Source/WebCore/workers/DedicatedWorkerThread.cpp @@ -39,13 +39,13 @@ namespace WebCore { -PassRefPtr<DedicatedWorkerThread> DedicatedWorkerThread::create(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerObjectProxy& workerObjectProxy, WorkerThreadStartMode startMode) +PassRefPtr<DedicatedWorkerThread> DedicatedWorkerThread::create(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerObjectProxy& workerObjectProxy, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) { - return adoptRef(new DedicatedWorkerThread(scriptURL, userAgent, sourceCode, workerLoaderProxy, workerObjectProxy, startMode)); + return adoptRef(new DedicatedWorkerThread(scriptURL, userAgent, sourceCode, workerLoaderProxy, workerObjectProxy, startMode, contentSecurityPolicy, contentSecurityPolicyType)); } -DedicatedWorkerThread::DedicatedWorkerThread(const KURL& url, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerObjectProxy& workerObjectProxy, WorkerThreadStartMode startMode) - : WorkerThread(url, userAgent, sourceCode, workerLoaderProxy, workerObjectProxy, startMode) +DedicatedWorkerThread::DedicatedWorkerThread(const KURL& url, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerObjectProxy& workerObjectProxy, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) + : WorkerThread(url, userAgent, sourceCode, workerLoaderProxy, workerObjectProxy, startMode, contentSecurityPolicy, contentSecurityPolicyType) , m_workerObjectProxy(workerObjectProxy) { } @@ -54,9 +54,9 @@ DedicatedWorkerThread::~DedicatedWorkerThread() { } -PassRefPtr<WorkerContext> DedicatedWorkerThread::createWorkerContext(const KURL& url, const String& userAgent) +PassRefPtr<WorkerContext> DedicatedWorkerThread::createWorkerContext(const KURL& url, const String& userAgent, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) { - return DedicatedWorkerContext::create(url, userAgent, this); + return DedicatedWorkerContext::create(url, userAgent, this, contentSecurityPolicy, contentSecurityPolicyType); } void DedicatedWorkerThread::runEventLoop() diff --git a/Source/WebCore/workers/DedicatedWorkerThread.h b/Source/WebCore/workers/DedicatedWorkerThread.h index cafffc00f..12a44da04 100644 --- a/Source/WebCore/workers/DedicatedWorkerThread.h +++ b/Source/WebCore/workers/DedicatedWorkerThread.h @@ -32,6 +32,7 @@ #if ENABLE(WORKERS) +#include "ContentSecurityPolicy.h" #include "WorkerThread.h" namespace WebCore { @@ -40,16 +41,16 @@ namespace WebCore { class DedicatedWorkerThread : public WorkerThread { public: - static PassRefPtr<DedicatedWorkerThread> create(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerObjectProxy&, WorkerThreadStartMode); + static PassRefPtr<DedicatedWorkerThread> create(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerObjectProxy&, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); WorkerObjectProxy& workerObjectProxy() const { return m_workerObjectProxy; } ~DedicatedWorkerThread(); protected: - virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL& url, const String& userAgent); + virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL&, const String& userAgent, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); virtual void runEventLoop(); private: - DedicatedWorkerThread(const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerObjectProxy&, WorkerThreadStartMode); + DedicatedWorkerThread(const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerObjectProxy&, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); WorkerObjectProxy& m_workerObjectProxy; }; diff --git a/Source/WebCore/workers/DefaultSharedWorkerRepository.cpp b/Source/WebCore/workers/DefaultSharedWorkerRepository.cpp index 9cf5297fa..8ca4db897 100644 --- a/Source/WebCore/workers/DefaultSharedWorkerRepository.cpp +++ b/Source/WebCore/workers/DefaultSharedWorkerRepository.cpp @@ -319,7 +319,10 @@ void SharedWorkerScriptLoader::notifyFinished() m_worker->dispatchEvent(Event::create(eventNames().errorEvent, false, true)); else { InspectorInstrumentation::scriptImported(m_worker->scriptExecutionContext(), m_scriptLoader->identifier(), m_scriptLoader->script()); - DefaultSharedWorkerRepository::instance().workerScriptLoaded(*m_proxy, m_worker->scriptExecutionContext()->userAgent(m_scriptLoader->url()), m_scriptLoader->script(), m_port.release()); + DefaultSharedWorkerRepository::instance().workerScriptLoaded(*m_proxy, m_worker->scriptExecutionContext()->userAgent(m_scriptLoader->url()), + m_scriptLoader->script(), m_port.release(), + m_worker->scriptExecutionContext()->contentSecurityPolicy()->policy(), + m_worker->scriptExecutionContext()->contentSecurityPolicy()->headerType()); } m_worker->unsetPendingActivity(m_worker.get()); this->deref(); // This frees this object - must be the last action in this function. @@ -331,7 +334,7 @@ DefaultSharedWorkerRepository& DefaultSharedWorkerRepository::instance() return *instance; } -void DefaultSharedWorkerRepository::workerScriptLoaded(SharedWorkerProxy& proxy, const String& userAgent, const String& workerScript, PassOwnPtr<MessagePortChannel> port) +void DefaultSharedWorkerRepository::workerScriptLoaded(SharedWorkerProxy& proxy, const String& userAgent, const String& workerScript, PassOwnPtr<MessagePortChannel> port, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) { MutexLocker lock(m_lock); if (proxy.isClosing()) @@ -339,7 +342,7 @@ void DefaultSharedWorkerRepository::workerScriptLoaded(SharedWorkerProxy& proxy, // Another loader may have already started up a thread for this proxy - if so, just send a connect to the pre-existing thread. if (!proxy.thread()) { - RefPtr<SharedWorkerThread> thread = SharedWorkerThread::create(proxy.name(), proxy.url(), userAgent, workerScript, proxy, proxy, DontPauseWorkerContextOnStart); + RefPtr<SharedWorkerThread> thread = SharedWorkerThread::create(proxy.name(), proxy.url(), userAgent, workerScript, proxy, proxy, DontPauseWorkerContextOnStart, contentSecurityPolicy, contentSecurityPolicyType); proxy.setThread(thread); thread->start(); } diff --git a/Source/WebCore/workers/DefaultSharedWorkerRepository.h b/Source/WebCore/workers/DefaultSharedWorkerRepository.h index 5d5bfe8ad..75d90e0d1 100644 --- a/Source/WebCore/workers/DefaultSharedWorkerRepository.h +++ b/Source/WebCore/workers/DefaultSharedWorkerRepository.h @@ -33,6 +33,7 @@ #if ENABLE(SHARED_WORKERS) +#include "ContentSecurityPolicy.h" #include <wtf/Forward.h> #include <wtf/HashMap.h> #include <wtf/Noncopyable.h> @@ -58,7 +59,7 @@ namespace WebCore { WTF_MAKE_NONCOPYABLE(DefaultSharedWorkerRepository); WTF_MAKE_FAST_ALLOCATED; public: // Invoked once the worker script has been loaded to fire up the worker thread. - void workerScriptLoaded(SharedWorkerProxy&, const String& userAgent, const String& workerScript, PassOwnPtr<MessagePortChannel>); + void workerScriptLoaded(SharedWorkerProxy&, const String& userAgent, const String& workerScript, PassOwnPtr<MessagePortChannel>, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); // Internal implementation of SharedWorkerRepository::connect() void connectToWorker(PassRefPtr<SharedWorker>, PassOwnPtr<MessagePortChannel>, const KURL&, const String& name, ExceptionCode&); diff --git a/Source/WebCore/workers/SharedWorkerContext.cpp b/Source/WebCore/workers/SharedWorkerContext.cpp index 9c94cd8c4..72d98274b 100644 --- a/Source/WebCore/workers/SharedWorkerContext.cpp +++ b/Source/WebCore/workers/SharedWorkerContext.cpp @@ -50,8 +50,8 @@ PassRefPtr<MessageEvent> createConnectEvent(PassRefPtr<MessagePort> port) return event.release(); } -SharedWorkerContext::SharedWorkerContext(const String& name, const KURL& url, const String& userAgent, SharedWorkerThread* thread) - : WorkerContext(url, userAgent, thread) +SharedWorkerContext::SharedWorkerContext(const String& name, const KURL& url, const String& userAgent, SharedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) + : WorkerContext(url, userAgent, thread, contentSecurityPolicy, contentSecurityPolicyType) , m_name(name) { } diff --git a/Source/WebCore/workers/SharedWorkerContext.h b/Source/WebCore/workers/SharedWorkerContext.h index 4f2b1dfc5..79d87b924 100644 --- a/Source/WebCore/workers/SharedWorkerContext.h +++ b/Source/WebCore/workers/SharedWorkerContext.h @@ -33,6 +33,7 @@ #if ENABLE(SHARED_WORKERS) +#include "ContentSecurityPolicy.h" #include "WorkerContext.h" namespace WebCore { @@ -43,9 +44,9 @@ namespace WebCore { class SharedWorkerContext : public WorkerContext { public: typedef WorkerContext Base; - static PassRefPtr<SharedWorkerContext> create(const String& name, const KURL& url, const String& userAgent, SharedWorkerThread* thread) + static PassRefPtr<SharedWorkerContext> create(const String& name, const KURL& url, const String& userAgent, SharedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) { - return adoptRef(new SharedWorkerContext(name, url, userAgent, thread)); + return adoptRef(new SharedWorkerContext(name, url, userAgent, thread, contentSecurityPolicy, contentSecurityPolicyType)); } virtual ~SharedWorkerContext(); @@ -60,7 +61,7 @@ namespace WebCore { SharedWorkerThread* thread(); private: - SharedWorkerContext(const String& name, const KURL&, const String&, SharedWorkerThread*); + SharedWorkerContext(const String& name, const KURL&, const String&, SharedWorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); virtual void logExceptionToConsole(const String& errorMessage, int lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack>); diff --git a/Source/WebCore/workers/SharedWorkerThread.cpp b/Source/WebCore/workers/SharedWorkerThread.cpp index 917be3edc..13432ece8 100644 --- a/Source/WebCore/workers/SharedWorkerThread.cpp +++ b/Source/WebCore/workers/SharedWorkerThread.cpp @@ -38,13 +38,13 @@ namespace WebCore { -PassRefPtr<SharedWorkerThread> SharedWorkerThread::create(const String& name, const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerReportingProxy& workerReportingProxy, WorkerThreadStartMode startMode) +PassRefPtr<SharedWorkerThread> SharedWorkerThread::create(const String& name, const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerReportingProxy& workerReportingProxy, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) { - return adoptRef(new SharedWorkerThread(name, scriptURL, userAgent, sourceCode, workerLoaderProxy, workerReportingProxy, startMode)); + return adoptRef(new SharedWorkerThread(name, scriptURL, userAgent, sourceCode, workerLoaderProxy, workerReportingProxy, startMode, contentSecurityPolicy, contentSecurityPolicyType)); } -SharedWorkerThread::SharedWorkerThread(const String& name, const KURL& url, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerReportingProxy& workerReportingProxy, WorkerThreadStartMode startMode) - : WorkerThread(url, userAgent, sourceCode, workerLoaderProxy, workerReportingProxy, startMode) +SharedWorkerThread::SharedWorkerThread(const String& name, const KURL& url, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerReportingProxy& workerReportingProxy, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) + : WorkerThread(url, userAgent, sourceCode, workerLoaderProxy, workerReportingProxy, startMode, contentSecurityPolicy, contentSecurityPolicyType) , m_name(name.isolatedCopy()) { } @@ -53,9 +53,9 @@ SharedWorkerThread::~SharedWorkerThread() { } -PassRefPtr<WorkerContext> SharedWorkerThread::createWorkerContext(const KURL& url, const String& userAgent) +PassRefPtr<WorkerContext> SharedWorkerThread::createWorkerContext(const KURL& url, const String& userAgent, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) { - return SharedWorkerContext::create(m_name, url, userAgent, this); + return SharedWorkerContext::create(m_name, url, userAgent, this, contentSecurityPolicy, contentSecurityPolicyType); } } // namespace WebCore diff --git a/Source/WebCore/workers/SharedWorkerThread.h b/Source/WebCore/workers/SharedWorkerThread.h index d60378dee..a58230dc2 100644 --- a/Source/WebCore/workers/SharedWorkerThread.h +++ b/Source/WebCore/workers/SharedWorkerThread.h @@ -32,20 +32,21 @@ #if ENABLE(SHARED_WORKERS) +#include "ContentSecurityPolicy.h" #include "WorkerThread.h" namespace WebCore { class SharedWorkerThread : public WorkerThread { public: - static PassRefPtr<SharedWorkerThread> create(const String& name, const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode); + static PassRefPtr<SharedWorkerThread> create(const String& name, const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); ~SharedWorkerThread(); protected: - virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL&, const String&); + virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL&, const String&, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); private: - SharedWorkerThread(const String& name, const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode); + SharedWorkerThread(const String& name, const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); String m_name; }; diff --git a/Source/WebCore/workers/WorkerContext.cpp b/Source/WebCore/workers/WorkerContext.cpp index c284608f1..65851854f 100644 --- a/Source/WebCore/workers/WorkerContext.cpp +++ b/Source/WebCore/workers/WorkerContext.cpp @@ -108,7 +108,7 @@ public: virtual bool isCleanupTask() const { return true; } }; -WorkerContext::WorkerContext(const KURL& url, const String& userAgent, WorkerThread* thread) +WorkerContext::WorkerContext(const KURL& url, const String& userAgent, WorkerThread* thread, const String& policy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) : m_url(url) , m_userAgent(userAgent) , m_script(adoptPtr(new WorkerScriptController(this))) @@ -120,10 +120,8 @@ WorkerContext::WorkerContext(const KURL& url, const String& userAgent, WorkerThr , m_eventQueue(WorkerEventQueue::create(this)) { setSecurityOrigin(SecurityOrigin::create(url)); - - // FIXME: This should probably adopt the ContentSecurityPolicy of the document - // that created this worker or use the header that came with the worker script. setContentSecurityPolicy(ContentSecurityPolicy::create(this)); + contentSecurityPolicy()->didReceiveHeader(policy, contentSecurityPolicyType); } WorkerContext::~WorkerContext() diff --git a/Source/WebCore/workers/WorkerContext.h b/Source/WebCore/workers/WorkerContext.h index c94fa0978..c1801b107 100644 --- a/Source/WebCore/workers/WorkerContext.h +++ b/Source/WebCore/workers/WorkerContext.h @@ -29,6 +29,7 @@ #if ENABLE(WORKERS) +#include "ContentSecurityPolicy.h" #include "EventListener.h" #include "EventNames.h" #include "EventTarget.h" @@ -179,7 +180,7 @@ namespace WebCore { #endif protected: - WorkerContext(const KURL&, const String&, WorkerThread*); + WorkerContext(const KURL&, const String&, WorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); virtual void logExceptionToConsole(const String& errorMessage, int lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack>); void addMessageToWorkerConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack>); diff --git a/Source/WebCore/workers/WorkerMessagingProxy.cpp b/Source/WebCore/workers/WorkerMessagingProxy.cpp index 392a60953..e4cd796f2 100644 --- a/Source/WebCore/workers/WorkerMessagingProxy.cpp +++ b/Source/WebCore/workers/WorkerMessagingProxy.cpp @@ -31,6 +31,7 @@ #include "WorkerMessagingProxy.h" +#include "ContentSecurityPolicy.h" #include "CrossThreadTask.h" #include "DedicatedWorkerContext.h" #include "DedicatedWorkerThread.h" @@ -270,7 +271,9 @@ WorkerMessagingProxy::~WorkerMessagingProxy() void WorkerMessagingProxy::startWorkerContext(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerThreadStartMode startMode) { - RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(scriptURL, userAgent, sourceCode, *this, *this, startMode); + RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(scriptURL, userAgent, sourceCode, *this, *this, startMode, + m_scriptExecutionContext->contentSecurityPolicy()->policy(), + m_scriptExecutionContext->contentSecurityPolicy()->headerType()); workerThreadCreated(thread); thread->start(); } diff --git a/Source/WebCore/workers/WorkerThread.cpp b/Source/WebCore/workers/WorkerThread.cpp index 9682cd583..93ba0bfb0 100644 --- a/Source/WebCore/workers/WorkerThread.cpp +++ b/Source/WebCore/workers/WorkerThread.cpp @@ -65,32 +65,36 @@ unsigned WorkerThread::workerThreadCount() struct WorkerThreadStartupData { WTF_MAKE_NONCOPYABLE(WorkerThreadStartupData); WTF_MAKE_FAST_ALLOCATED; public: - static PassOwnPtr<WorkerThreadStartupData> create(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerThreadStartMode startMode) + static PassOwnPtr<WorkerThreadStartupData> create(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) { - return adoptPtr(new WorkerThreadStartupData(scriptURL, userAgent, sourceCode, startMode)); + return adoptPtr(new WorkerThreadStartupData(scriptURL, userAgent, sourceCode, startMode, contentSecurityPolicy, contentSecurityPolicyType)); } KURL m_scriptURL; String m_userAgent; String m_sourceCode; WorkerThreadStartMode m_startMode; + String m_contentSecurityPolicy; + ContentSecurityPolicy::HeaderType m_contentSecurityPolicyType; private: - WorkerThreadStartupData(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerThreadStartMode); + WorkerThreadStartupData(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType); }; -WorkerThreadStartupData::WorkerThreadStartupData(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerThreadStartMode startMode) +WorkerThreadStartupData::WorkerThreadStartupData(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) : m_scriptURL(scriptURL.copy()) , m_userAgent(userAgent.isolatedCopy()) , m_sourceCode(sourceCode.isolatedCopy()) , m_startMode(startMode) + , m_contentSecurityPolicy(contentSecurityPolicy.isolatedCopy()) + , m_contentSecurityPolicyType(contentSecurityPolicyType) { } -WorkerThread::WorkerThread(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerReportingProxy& workerReportingProxy, WorkerThreadStartMode startMode) +WorkerThread::WorkerThread(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerReportingProxy& workerReportingProxy, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) : m_threadID(0) , m_workerLoaderProxy(workerLoaderProxy) , m_workerReportingProxy(workerReportingProxy) - , m_startupData(WorkerThreadStartupData::create(scriptURL, userAgent, sourceCode, startMode)) + , m_startupData(WorkerThreadStartupData::create(scriptURL, userAgent, sourceCode, startMode, contentSecurityPolicy, contentSecurityPolicyType)) #if ENABLE(NOTIFICATIONS) , m_notificationPresenter(0) #endif @@ -128,7 +132,7 @@ void* WorkerThread::workerThread() { { MutexLocker lock(m_threadCreationMutex); - m_workerContext = createWorkerContext(m_startupData->m_scriptURL, m_startupData->m_userAgent); + m_workerContext = createWorkerContext(m_startupData->m_scriptURL, m_startupData->m_userAgent, m_startupData->m_contentSecurityPolicy, m_startupData->m_contentSecurityPolicyType); if (m_runLoop.terminated()) { // The worker was terminated before the thread had a chance to run. Since the context didn't exist yet, diff --git a/Source/WebCore/workers/WorkerThread.h b/Source/WebCore/workers/WorkerThread.h index 6f3b2220f..6646b1148 100644 --- a/Source/WebCore/workers/WorkerThread.h +++ b/Source/WebCore/workers/WorkerThread.h @@ -29,6 +29,7 @@ #if ENABLE(WORKERS) +#include "ContentSecurityPolicy.h" #include "WorkerRunLoop.h" #include <wtf/Forward.h> #include <wtf/OwnPtr.h> @@ -67,10 +68,10 @@ namespace WebCore { #endif protected: - WorkerThread(const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode); + WorkerThread(const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); // Factory method for creating a new worker context for the thread. - virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL& url, const String& userAgent) = 0; + virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL&, const String& userAgent, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType) = 0; // Executes the event loop for the worker thread. Derived classes can override to perform actions before/after entering the event loop. virtual void runEventLoop(); |